[PATCH] D81052: [ELF] Handle -u before input files
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 3 08:44:59 PDT 2020
MaskRay marked an inline comment as done.
MaskRay added inline comments.
================
Comment at: lld/ELF/Driver.cpp:1473
// Force Sym to be entered in the output. Used for -u or equivalent.
static void handleUndefined(Symbol *sym) {
----------------
psmith wrote:
> We now no longer use this function for -u, will be worth updating comment.
All handleUndefined call sites may use addUndefined instead. I'll experiment. Two `--wrap` uses of addUndefined should probably be addUnusedUndefined instead (to fix https://bugs.llvm.org/show_bug.cgi?id=46169 )
================
Comment at: lld/ELF/Driver.cpp:1885
- // Handle the `--undefined <sym>` options.
- for (StringRef arg : config->undefined)
- if (Symbol *sym = symtab->find(arg))
- handleUndefined(sym);
+ // Keep bitcode definitions in the symbol table.
+ for (StringRef name : config->undefined)
----------------
psmith wrote:
> IIUC this is to prevent LTO from removing definitions. May be worth saying
> ```
> // Prevent LTO from removing any definition referenced by an undefined.
> ```
Thanks for the suggestion!
The logic was introduced in D38348 .
We seem to consider a bitcode file a variant of an archive (its symbol table does not translate to .symtab in the output, but -u can force it).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D81052/new/
https://reviews.llvm.org/D81052
More information about the llvm-commits
mailing list