[PATCH] D40549: [ELF] - Add support for --just-symbols flag.
Rafael Avila de Espindola via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 29 09:29:22 PST 2017
George Rimar <grimar at accesssoftek.com> writes:
>>> + StringRef Name = check(Sym.getName(this->StringTable), toString(this));
>>> + // We do not want to automatically resolve undefined symbols here, so
>>> + // leaving them as is, assuming they must be defined somewhere else.
>>> + if (Sym.st_shndx == SHN_UNDEF) {
>>> + this->Symbols.push_back(Symtab->addUndefined<ELFT>(
>>> + Name, Sym.getBinding(), Sym.st_other, Sym.getType(),
>>> + /*CanOmitFromDynSym=*/false, this));
>>> + continue;
>>> + }
>>
>>bfd seems to ignore undefined symbols, no?
>
> No, if you have symbols.o with undefined symbol:
> .globl test
> test:
> callq undef at PLT
>
> and link it using --just-symbols=symbols.o with stub main.o:
> _start:
> nop
>
> Symbol will remain undefined:
> ld.bfd main.o --just-symbols=symbols.o -o out
> readelf -a out
>
> Symbol table '.symtab' contains 10 entries:
> Num: Value Size Type Bind Vis Ndx Name
> ....
> 6: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND undef
I can't reproduce this with 2.27-28.fc26. In any case, it is probably
better to start without .o files support. With that we don't have to
worry about undefined symbols.
Cheers,
Rafael
More information about the llvm-commits
mailing list