[PATCH] D33621: Fix for -wrap linker option and LTO, PR 33145

Mikulin, Dmitry via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 2 22:11:56 PDT 2017


If a symbol is either defined or referenced in one of the bitcode files, post-LTO when the symbols are re-created, it will get the IsUsedInRegularObj set, so no harm if we set it early. The only way I can see it happen is when both defs and refs come from shared objects, but I don’t think it’s possible to do –wrap or –defsym in this case.

On 6/2/17, 5:20 PM, "Davide Italiano via Phabricator" <reviews at reviews.llvm.org> wrote:

    davide added inline comments.
    
    
    ================
    Comment at: lld/ELF/SymbolTable.cpp:167
    +  // Tell LTO not to eliminate this symbol
    +  Wrap->IsUsedInRegularObj = true;
     
    ----------------
    You're setting `IsUsedInRegularObj` from what I can see, here, for all the symbols passed with `--wrap`.
    Can you check this is really NFC? IIRC it could impact the way symbols are added (or not) to the symbol table.
    
    
    ================
    Comment at: lld/ELF/SymbolTable.cpp:184
    +  // Tell LTO not to eliminate this symbol
    +  Sym->IsUsedInRegularObj = true;
    +  Config->RenamedSymbols[AliasSym] = RenamedSymbol{Sym, AliasSym->Binding};
    ----------------
    Same here.
    
    
    https://reviews.llvm.org/D33621
    
    
    
    



More information about the llvm-commits mailing list