[PATCH] D47379: [lld] Rename R_TLSGD/R_TLSLD to R_TLSGD_FROM_END/R_TLSLD_FROM_END
Sean Fertile via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 25 10:49:49 PDT 2018
sfertile created this revision.
sfertile added reviewers: ruiu, syzaara, rdhindsa.
Herald added subscribers: arichardson, emaste.
Herald added a reviewer: espindola.
`getRelocTargetVA` for R_TLSGD and R_TLSLD RelExprs calculate an offset from the end of the got, so adjust the names to reflect this.
Repository:
rLLD LLVM Linker
https://reviews.llvm.org/D47379
Files:
ELF/Arch/X86.cpp
ELF/InputSection.cpp
ELF/Relocations.cpp
ELF/Relocations.h
Index: ELF/Relocations.h
===================================================================
--- ELF/Relocations.h
+++ ELF/Relocations.h
@@ -77,9 +77,9 @@
R_TLSDESC,
R_TLSDESC_CALL,
R_TLSDESC_PAGE,
- R_TLSGD,
+ R_TLSGD_FROM_END,
R_TLSGD_PC,
- R_TLSLD,
+ R_TLSLD_FROM_END,
R_TLSLD_PC,
};
Index: ELF/Relocations.cpp
===================================================================
--- ELF/Relocations.cpp
+++ ELF/Relocations.cpp
@@ -198,7 +198,7 @@
return 1;
}
- if (isRelExprOneOf<R_TLSLD_PC, R_TLSLD>(Expr)) {
+ if (isRelExprOneOf<R_TLSLD_PC, R_TLSLD_FROM_END>(Expr)) {
// Local-Dynamic relocs can be relaxed to Local-Exec.
if (!Config->Shared) {
C.Relocations.push_back(
@@ -213,13 +213,14 @@
}
// Local-Dynamic relocs can be relaxed to Local-Exec.
- if (isRelExprOneOf<R_ABS, R_TLSLD, R_TLSLD_PC>(Expr) && !Config->Shared) {
+ if (isRelExprOneOf<R_ABS, R_TLSLD_FROM_END, R_TLSLD_PC>(Expr) &&
+ !Config->Shared) {
C.Relocations.push_back({R_RELAX_TLS_LD_TO_LE, Type, Offset, Addend, &Sym});
return 1;
}
- if (isRelExprOneOf<R_TLSDESC, R_TLSDESC_PAGE, R_TLSDESC_CALL, R_TLSGD,
- R_TLSGD_PC>(Expr)) {
+ if (isRelExprOneOf<R_TLSDESC, R_TLSDESC_PAGE, R_TLSDESC_CALL,
+ R_TLSGD_FROM_END, R_TLSGD_PC>(Expr)) {
if (Config->Shared) {
if (InX::Got->addDynTlsEntry(Sym)) {
uint64_t Off = InX::Got->getGlobalDynOffset(Sym);
@@ -348,8 +349,8 @@
R_MIPS_GOTREL, R_MIPS_GOT_OFF, R_MIPS_GOT_OFF32,
R_MIPS_GOT_GP_PC, R_MIPS_TLSGD, R_GOT_PAGE_PC, R_GOT_PC,
R_GOTONLY_PC, R_GOTONLY_PC_FROM_END, R_PLT_PC, R_TLSGD_PC,
- R_TLSGD, R_PPC_CALL_PLT, R_TLSDESC_CALL, R_TLSDESC_PAGE,
- R_HINT>(E))
+ R_TLSGD_FROM_END, R_PPC_CALL_PLT, R_TLSDESC_CALL,
+ R_TLSDESC_PAGE, R_HINT>(E))
return true;
// These never do, except if the entire file is position dependent or if
Index: ELF/InputSection.cpp
===================================================================
--- ELF/InputSection.cpp
+++ ELF/InputSection.cpp
@@ -631,11 +631,11 @@
case R_TLSDESC_PAGE:
return getAArch64Page(InX::Got->getGlobalDynAddr(Sym) + A) -
getAArch64Page(P);
- case R_TLSGD:
+ case R_TLSGD_FROM_END:
return InX::Got->getGlobalDynOffset(Sym) + A - InX::Got->getSize();
case R_TLSGD_PC:
return InX::Got->getGlobalDynAddr(Sym) + A - P;
- case R_TLSLD:
+ case R_TLSLD_FROM_END:
return InX::Got->getTlsIndexOff() + A - InX::Got->getSize();
case R_TLSLD_PC:
return InX::Got->getTlsIndexVA() + A - P;
Index: ELF/Arch/X86.cpp
===================================================================
--- ELF/Arch/X86.cpp
+++ ELF/Arch/X86.cpp
@@ -73,9 +73,9 @@
case R_386_TLS_LDO_32:
return R_ABS;
case R_386_TLS_GD:
- return R_TLSGD;
+ return R_TLSGD_FROM_END;
case R_386_TLS_LDM:
- return R_TLSLD;
+ return R_TLSLD_FROM_END;
case R_386_PLT32:
return R_PLT_PC;
case R_386_PC8:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47379.148630.patch
Type: text/x-patch
Size: 3103 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180525/06f369c0/attachment.bin>
More information about the llvm-commits
mailing list