https://bugs.llvm.org/show_bug.cgi?id=45600
Bug ID: 45600
Summary: Support TLS relocations referencing non STT_TLS
symbols (e.g. STT_SECTION or STT_NOTYPE)
Product: lld
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: ELF
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
Two weeks ago I was trying deleting a hack in MC (integrated assembler)
https://reviews.llvm.org/D77361 and I noticed I can't do that because lld does
not support a TLS relocation referencing a non-TLS symbol.
Related gABI discussion:
https://groups.google.com/forum/#!searchin/generic-abi/TLS%7Csort:date/generic-abi/dJ4_Y78aQ2M/WKggp9fKCgAJ
# a.o
movl %fs:.tdata+4@tpoff, %eax
movl %fs:a@tpoff, %eax
.section .tdata,"awT"
.long 0
a:
.long 0
# lld
movl %fs:2105868, %eax # a TLS relocation referencing a STT_SECTION
movl %fs:-4, %eax
# gold and GNU ld
movl %fs:-4, %eax
movl %fs:-4, %eax
Supporting this requires to fix
// Symbols.cpp:getSymVA
if (d.isTls() && !config->relocatable) {
// Use the address of the TLS segment's first section rather than the
// segment's address, because segment addresses aren't initialized until
// after sections are finalized. (e.g. Measuring the size of .rela.dyn
// for Android relocation packing requires knowing TLS symbol addresses
// during section finalization.)
if (!Out::tlsPhdr || !Out::tlsPhdr->firstSec)
fatal(toString(d.file) +
" has an STT_TLS symbol but doesn't have an SHF_TLS section");
return va - Out::tlsPhdr->firstSec->addr;
and
// Relocations.cpp isStaticLinkTimeConstant
// For the target and the relocation, we want to know if they are
// absolute or relative.
bool absVal = isAbsoluteValue(sym); // STT_SECTION/STT_NOTYPE can be used as
TLS as well
bool relE = isRelExpr(e);
if (absVal && !relE)
return true;
if (!absVal && relE)
return true;
if (!absVal && !relE)
return target->usesOnlyLowPageBits(type);
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs