[PATCH] D46029: [llvm-objcopy] Implement --redefine-sym option
Jake Ehrlich via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 24 16:18:36 PDT 2018
jakehehrlich added inline comments.
================
Comment at: tools/llvm-objcopy/Object.cpp:915
+void Object::renameSymbol(StringRef Old, StringRef New) {
+ for (auto &S : Sections)
----------------
alexshap wrote:
> jakehehrlich wrote:
> > This method isn't needed, the symbol table of an Object isn't private and (currently) there will only ever be one symbol table (the spec still ensures this). obj->SymbolTable->renameSymbol(Old, New) is sufficient to do this (with a null check since the symbol table isn't necessarily defined).
> https://wiki.osdev.org/ELF_Tutorial
> i was under impression that an elf file theoretically can contain many symbol tables,
> but i'm not sure + not sure if they are handled correctly anyway,
> so yeah, i agree, I will use obj->SymbolTable.
The spec leaves that open but is intentionally cautious on this but does make a rulling: http://www.sco.com/developers/gabi/latest/ch4.sheader.html
(In refering to SHT_SYMTAB and SHT_DYNSYM)
"These sections hold a symbol table. Currently, an object file may have only one section of each type, but this restriction may be relaxed in the future."
Repository:
rL LLVM
https://reviews.llvm.org/D46029
More information about the llvm-commits
mailing list