[PATCH] D63564: Add undefined symbols from linker script to output file

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 20 07:47:05 PDT 2019


MaskRay added a comment.

In D63564#1551811 <https://reviews.llvm.org/D63564#1551811>, @ruiu wrote:

> Is there any possibility that this is a GNU ld's bug? Their behavior is different from their man page, and the thing that defines what is the right behavior is usually a manual than an actual behavior.


GNU ld's behavior seems consistent: both `EXTERN(foo)` and `-u foo` force the undefined symbol `foo`. In lld, I think this option is only useful when the symbol exists and is a LazyArchive/LazyObject.

@ihalip To make `foo` appears in .symtab but not in .dynsym for `ld.bfd -shared a.o -u test -o a.so` will be difficult. I think another Symbol bit, like `ExportDynamic`, will be required to represent this.

Even if we can do that, the semantics of -u will be different from `--undefined-glob`. In any case, `-r -u` looks weird to me: if you use the partially linked object to link a shared object or an executable, why can't you delay the use of `EXTERN(foo)`? So I asked if this issue can be worked around in the Linux kernel.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63564/new/

https://reviews.llvm.org/D63564





More information about the llvm-commits mailing list