[PATCH] D27276: [ELF] Allow defined symbols to be assigned from linker script
Rui Ueyama via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 5 20:52:39 PST 2017
ruiu added inline comments.
================
Comment at: ELF/LinkerScript.cpp:62
uint8_t Visibility = Cmd->Hidden ? STV_HIDDEN : STV_DEFAULT;
- Symbol *Sym = Symtab<ELFT>::X->addRegular(Cmd->Name, Visibility, STT_NOTYPE,
- 0, 0, STB_GLOBAL, nullptr, nullptr);
- Cmd->Sym = Sym->body();
+ if (Sym) {
----------------
It is probably easier to add a dummy symbol and then replace that unconditionally like this.
Symbol *Sym = Symtab<ELFT>::X->addUndefined(Cmd->Name);
replaceBody<DefinedRegular<ELFT>>(Sym, Cmd->Name, ...);
return Sym->body();
You can remove `Symbol *Sym` from the parameter list of this function.
================
Comment at: ELF/LinkerScript.cpp:76
+template <class ELFT>
+static SymbolBody *addSynthetic(SymbolAssignment *Cmd, Symbol *Sym) {
+ uint8_t Visibility = Cmd->Hidden ? STV_HIDDEN : STV_DEFAULT;
----------------
Ditto. You don't need to pass `Sym`.
https://reviews.llvm.org/D27276
More information about the llvm-commits
mailing list