Page MenuHomePhabricator

lldProject
ActivePublic

Details

Description

LLVM Linker

Recent Activity

Wed, Jan 16

aganea added inline comments to D55293: [LLD][COFF] Partial sections.
Wed, Jan 16, 9:51 AM · lld
aganea updated the diff for D55293: [LLD][COFF] Partial sections.

Updated following @ruiu 's comments - thank you!

Wed, Jan 16, 9:51 AM · lld
atanasyan added a comment to D40147: [MIPS] Handle cross-mode (regular <-> microMIPS) jumps.

I am pretty sure we can land this because having a patch on a review for about a year is always a terrible thing. My comments are inline.

Wed, Jan 16, 8:23 AM · lld

Tue, Jan 15

ruiu added inline comments to D55293: [LLD][COFF] Partial sections.
Tue, Jan 15, 1:12 PM · lld
rnk added a comment to D55293: [LLD][COFF] Partial sections.

Hi @ruiu ! This is waiting for your final review / approval. Could you possibly take a quick look please? Thank you!

Tue, Jan 15, 11:34 AM · lld

Sun, Jan 13

mgorny added inline comments to D56215: [lld] [ELF] Include default search paths for NetBSD driver.
Sun, Jan 13, 2:05 PM · lld
mgorny removed child revisions for D56215: [lld] [ELF] Include default search paths for NetBSD driver: D56554: [ELF] Add '-z nognustack' opt to suppress emitting PT_GNU_STACK, D56288: [ELF] Do not enable 'new dtags' on NetBSD by default.
Sun, Jan 13, 2:05 PM · lld
mgorny added a parent revision for D56215: [lld] [ELF] Include default search paths for NetBSD driver: D56650: [lld] [ELF] Support customizing behavior on target triple.
Sun, Jan 13, 2:05 PM · lld
mgorny updated the diff for D56215: [lld] [ELF] Include default search paths for NetBSD driver.

Split target logic into D56650, switched to using target to determine which paths to apply. While at it, copied the code from clang since it now can match exactly.

Sun, Jan 13, 2:05 PM · lld

Fri, Jan 11

krytarowski added a comment to D56215: [lld] [ELF] Include default search paths for NetBSD driver.

To be honest, I don't think I would lgtm a patch that changes lld's default behavior depending on host/target only for NetBSD, and it seems like a NetBSD's issue rather than an lld's issue. As I said, could you please make an effort to pass the flags you need from the compiler driver to the linker just like other systems do? That is easy to do, doesn't hurt anyone, probably a good thing to do anyway as it makes options explicit rather than implicit, and solves at least most of the problems you have.

Fri, Jan 11, 2:23 PM · lld
krytarowski added a comment to D56215: [lld] [ELF] Include default search paths for NetBSD driver.

Actually probably Linux MIPS used it and some proprietary OSes.. but we skip them for now. Only FreeBSD sets OSABI in lld and uses an emulation name detection hack. Once we will get merged TripleTarget detection we can switch it to use proper Triple check.

Fri, Jan 11, 1:50 PM · lld
joerg added a comment to D56215: [lld] [ELF] Include default search paths for NetBSD driver.

Right, I'm not aware of anyone but FreeBSD really using the OSABI field. For FreeBSD it was a long standing hack around limitations in the ELF kernel loader. I'm not even sure if FreeBSD use(d) to set the OSABI field for the intermediate object files.

Fri, Jan 11, 1:24 PM · lld
krytarowski added inline comments to D56215: [lld] [ELF] Include default search paths for NetBSD driver.
Fri, Jan 11, 1:17 PM · lld
krytarowski added a comment to D56215: [lld] [ELF] Include default search paths for NetBSD driver.

@mgorny could you check if we can get crossbuilding functional for:

  • to !NetBSD from NetBSD
  • from !NetBSD to NetBSD.
  • from NetBSD/amd64 to NetBSD/aarch64

    I wonder whether it can work if we will keep using 'ld' file name for a linker.
Fri, Jan 11, 1:15 PM · lld
krytarowski added a comment to D56215: [lld] [ELF] Include default search paths for NetBSD driver.

@mgorny could you check if we can get crossbuilding functional for:

Fri, Jan 11, 11:00 AM · lld
krytarowski added a child revision for D56215: [lld] [ELF] Include default search paths for NetBSD driver: D56554: [ELF] Add '-z nognustack' opt to suppress emitting PT_GNU_STACK.
Fri, Jan 11, 10:50 AM · lld
krytarowski added inline comments to D56215: [lld] [ELF] Include default search paths for NetBSD driver.
Fri, Jan 11, 10:36 AM · lld
krytarowski added inline comments to D56215: [lld] [ELF] Include default search paths for NetBSD driver.
Fri, Jan 11, 10:09 AM · lld
arichardson requested changes to D56215: [lld] [ELF] Include default search paths for NetBSD driver.
Fri, Jan 11, 9:36 AM · lld
mgorny updated the diff for D56215: [lld] [ELF] Include default search paths for NetBSD driver.

Implemented checking the triple against target registry. Also made --version output the detected target.

Fri, Jan 11, 7:39 AM · lld
joerg added inline comments to D56215: [lld] [ELF] Include default search paths for NetBSD driver.
Fri, Jan 11, 5:57 AM · lld

Thu, Jan 10

krytarowski added a comment to D56215: [lld] [ELF] Include default search paths for NetBSD driver.

@joerg if you think that this patch is OK, please click accept so we can be aware that this is what you want.

Thu, Jan 10, 8:48 AM · lld
grimar added a comment to D40147: [MIPS] Handle cross-mode (regular <-> microMIPS) jumps.

I am pretty sure we can land this because having a patch on a review for about a year is always a terrible thing. My comments are inline.

Thu, Jan 10, 3:50 AM · lld
atanasyan edited reviewers for D40147: [MIPS] Handle cross-mode (regular <-> microMIPS) jumps, added: grimar; removed: espindola.

Gentle ping...

Thu, Jan 10, 2:02 AM · lld

Wed, Jan 9

mgorny updated the diff for D56215: [lld] [ELF] Include default search paths for NetBSD driver.

Adjusted to make paths sysroot-relative.

Wed, Jan 9, 11:13 AM · lld

Tue, Jan 8

krytarowski added inline comments to D56215: [lld] [ELF] Include default search paths for NetBSD driver.
Tue, Jan 8, 4:20 PM · lld
arichardson added inline comments to D56215: [lld] [ELF] Include default search paths for NetBSD driver.
Tue, Jan 8, 2:58 PM · lld
ruiu added a comment to D56215: [lld] [ELF] Include default search paths for NetBSD driver.

I want to handle NetBSD in the same way as the other operating systems. I'm sorry to have been saying no to a few recent patches for NetBSD, but I think that's for a good reason, and I don't think you presented a convincing reason why we had to handle only NetBSD differently.

Tue, Jan 8, 1:57 PM · lld
joerg added inline comments to D56215: [lld] [ELF] Include default search paths for NetBSD driver.
Tue, Jan 8, 1:48 PM · lld
joerg added a comment to D56215: [lld] [ELF] Include default search paths for NetBSD driver.

@ruiu: No, it is exactly what you want, since it allows you to point lld into the normal sysroot. Cross-compiling is the default case for the NetBSD toolchain.

Tue, Jan 8, 1:40 PM · lld
krytarowski added a comment to D56215: [lld] [ELF] Include default search paths for NetBSD driver.

Thanks, this looks like a good starting point.

Tue, Jan 8, 1:34 PM · lld
ruiu added a comment to D56215: [lld] [ELF] Include default search paths for NetBSD driver.

To be honest, I don't think I would lgtm a patch that changes lld's default behavior depending on host/target only for NetBSD, and it seems like a NetBSD's issue rather than an lld's issue. As I said, could you please make an effort to pass the flags you need from the compiler driver to the linker just like other systems do? That is easy to do, doesn't hurt anyone, probably a good thing to do anyway as it makes options explicit rather than implicit, and solves at least most of the problems you have.

Tue, Jan 8, 1:30 PM · lld
ruiu added a comment to D56215: [lld] [ELF] Include default search paths for NetBSD driver.

I'm sorry to say this but I don't think this is a good approach. Just like changing the default behavior depending on host hurts cross-build and is against the policy of the lld driver, changing the default behavior depending on the target hurts it too. Imagine that you are doing a cross-build on non-NetBSD system to create a NetBSD executable. You definitely want to ignore /usr/lib/i386 and /usr/lib on the host system. This patch does the opposite.

Tue, Jan 8, 1:08 PM · lld
mgorny added inline comments to D56215: [lld] [ELF] Include default search paths for NetBSD driver.
Tue, Jan 8, 1:07 PM · lld
joerg added inline comments to D56215: [lld] [ELF] Include default search paths for NetBSD driver.
Tue, Jan 8, 12:59 PM · lld
joerg added a comment to D56215: [lld] [ELF] Include default search paths for NetBSD driver.

Thanks, this looks like a good starting point.

Tue, Jan 8, 12:59 PM · lld
mgorny added a child revision for D56215: [lld] [ELF] Include default search paths for NetBSD driver: D56288: [ELF] Do not enable 'new dtags' on NetBSD by default.
Tue, Jan 8, 12:43 PM · lld
mgorny updated the diff for D56215: [lld] [ELF] Include default search paths for NetBSD driver.

Next version, based on recognizing NetBSD from triple.

Tue, Jan 8, 12:40 PM · lld

Mon, Jan 7

emaste added a comment to D56215: [lld] [ELF] Include default search paths for NetBSD driver.

There is a list of 140-150 unsafe (LLD_UNSAFE) packages with LLD.

Mon, Jan 7, 12:37 PM · lld

Sat, Jan 5

krytarowski added a comment to D56215: [lld] [ELF] Include default search paths for NetBSD driver.

I've grepped FreeBSD, OpenBSD and pkgsrc.

Sat, Jan 5, 12:26 PM · lld

Fri, Jan 4

aganea added a comment to D55293: [LLD][COFF] Partial sections.

Hi @ruiu ! This is waiting for your final review / approval. Could you possibly take a quick look please? Thank you!

Fri, Jan 4, 1:55 PM · lld
ruiu added a comment to D56215: [lld] [ELF] Include default search paths for NetBSD driver.

Not sure what I understand the point, but as to make lld work on/for NetBSD, I wonder if you can just add -L<path> to the command line in the compiler driver. Isn't a NetBSD triple passed to the compiler driver? If so, I wonder if you can add a few extra options when invoking the linker.

This describes the original patch of passing flags from compiler driver and breaks GNU ld compat. Joerg expects to pass no extra -L<path> or --disable-new-dtags options, treating lld as a drop-in replacement for GNU ld.

Fri, Jan 4, 10:33 AM · lld
krytarowski added a comment to D56215: [lld] [ELF] Include default search paths for NetBSD driver.

For the record, another option is to actually fix other software not to call LD directly.

Or if you really need to call the linker directly without specifying search paths you could also install a shell script as /usr/bin/ld that passes the appropriate flags to /usr/bin/ld.lld?

I don't think ifdefs in the source code are a good idea. Cross linking should just work as expected. But you could look at the OS field in the first input ELF file to choose default config options/a different emulation for NetBSD.

The approach we are using in CheriBSD to differentiate between MIPS and CHERI pure-capability to either pass an explicitly -m elf_btsmip_cheri_fbsd/ -m elf_btsmip_fbsd or infer whether it is CHERI or MIPS based on the e_flags field of the first input file.

Fri, Jan 4, 9:54 AM · lld
arichardson added a comment to D56215: [lld] [ELF] Include default search paths for NetBSD driver.

For the record, another option is to actually fix other software not to call LD directly.

Or if you really need to call the linker directly without specifying search paths you could also install a shell script as /usr/bin/ld that passes the appropriate flags to /usr/bin/ld.lld?

Fri, Jan 4, 6:48 AM · lld
atanasyan added a comment to D40147: [MIPS] Handle cross-mode (regular <-> microMIPS) jumps.

Gentle ping...

Fri, Jan 4, 5:48 AM · lld

Thu, Jan 3

mgorny added a comment to D56215: [lld] [ELF] Include default search paths for NetBSD driver.

For the record, another option is to actually fix other software not to call LD directly.

Thu, Jan 3, 9:52 PM · lld
krytarowski added a comment to D56215: [lld] [ELF] Include default search paths for NetBSD driver.

Not sure what I understand the point, but as to make lld work on/for NetBSD, I wonder if you can just add -L<path> to the command line in the compiler driver. Isn't a NetBSD triple passed to the compiler driver? If so, I wonder if you can add a few extra options when invoking the linker.

Thu, Jan 3, 3:37 PM · lld
ruiu added a comment to D56215: [lld] [ELF] Include default search paths for NetBSD driver.

Not sure what I understand the point, but as to make lld work on/for NetBSD, I wonder if you can just add -L<path> to the command line in the compiler driver. Isn't a NetBSD triple passed to the compiler driver? If so, I wonder if you can add a few extra options when invoking the linker.

Thu, Jan 3, 3:26 PM · lld
krytarowski added a comment to D56215: [lld] [ELF] Include default search paths for NetBSD driver.

Actually I think that we can handle two cases witch a combination of proposals:

  • native mode
  • cross mode
Thu, Jan 3, 2:56 PM · lld
krytarowski added a comment to D56215: [lld] [ELF] Include default search paths for NetBSD driver.

Talking from the perspective of having had to deal with thousands of packages in pkgsrc over the years: it is naive to believe that there isn't a lot of software that calls the linker directly for various reasons. As such, it is very important to have a useful configuration in the linker by default. Such a configuration is by its very nature target specific. This doesn't mean it can't be done in a cross-compiler friendly way, on the contrary. Over the years NetBSD has been pushing its toolchain to be as similar for the native build and a cross-target as reasonable possible. Modulo the build time choices in the config.h sense, the only difference between the native and cross tools is the built-in default of the former.

It might be naive but I don't think it's too naive. Most programs use ld via cc, and I don't think it is too unreasonable to not implement a host-specific logic for a very small percentage of programs that directly use ld. If we do, that logic would be the same or very similar to the one that we already have in cc. I think we should avoid that duplication of the host-specific config in the toolchain.

I see there are pros and cons to not have host-specific config in ld. That said, if other operating systems can live without host-specific config in lld, why can't NetBSD do? I really don't like to be in a situation where only one operating system have a host-specific config while others don't.

Thu, Jan 3, 2:42 PM · lld