[PATCH] D35724: [ELF] - Fix missing relocation when linking executable with --unresolved-symbols=ignore-all
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 26 10:28:45 PDT 2017
>> +bool Symbol::canBeExternal() const {
>> + return computeBinding() != STB_LOCAL &&
>> + body()->getVisibility() == STV_DEFAULT;
>> +}
>> +
>> bool Symbol::includeInDynsym() const {
>> if (computeBinding() == STB_LOCAL)
>> return false;
>> - return ExportDynamic || body()->isShared() ||
>> - (body()->isUndefined() && Config->Shared);
>> + if (ExportDynamic || body()->isShared())
>> + return true;
>> + if (!body()->isUndefined())
>> + return false;
>> + return Config->Shared || (canBeExternal() && !body()->symbol()->isWeak());
>
>computeBinding() already took care of what canBeExternal() is doing in
>here, no?
>
>Cheers,
>Rafael
Honestly what I was trying to do using canBeExternal() call is to filter out
STV_PROTECTED symbols left.
Now I do not think that was correct. At least that seem excessive.
Looks I was confused by the fact that ld.bfd
does not produce output even with --no-inhibit-exec for following code:
.protected foo
_start:
callq foo at PLT
ld.bfd -pie ooo.o -o ooo --noinhibit-exec
ld.bfd: warning: cannot find entry symbol _start; defaulting to 0000000000000280
ooo.o: In function `_start':
(.text+0x1): undefined reference to `foo'
ld.bfd: ooo: protected symbol `foo' isn't defined
ld.bfd: final link failed: Bad value
FWIW, gold links that fine.
I'll update patch and testcase.
George.
More information about the llvm-commits
mailing list