diff options
| author | Fangrui Song <maskray@google.com> | 2019-05-18 01:58:40 +0000 |
|---|---|---|
| committer | Fangrui Song <maskray@google.com> | 2019-05-18 01:58:40 +0000 |
| commit | 898896836dd17e093ffb9c8293193332d3d68b62 (patch) | |
| tree | 651b092d6c5d6459bbef8b70fed803e596e797c0 /lld/ELF/InputSection.cpp | |
| parent | 8803124d234ef26c40fbd66711b6d98bfd1ebe75 (diff) | |
| download | bcm5719-llvm-898896836dd17e093ffb9c8293193332d3d68b62.tar.gz bcm5719-llvm-898896836dd17e093ffb9c8293193332d3d68b62.zip | |
[ELF][X86] Fix R_RELAX_TLS_GD_TO_LE_NEG and R_NEG_TLS after D62059
After D62059, we don't align p_memsz of PT_TLS to p_align. The
getRelocTargetVA formula should align it instead.
It becomes clear that R_NEG_TLS and R_TLS are opposite from each other.
In i386-tls-le-align.s, I put ret after call ___tls_get_addr@plt as
otherwise ld.bfd would reject the relaxation:
TLS transition from R_386_TLS_GD to R_386_TLS_LE_32 against `a' at 0x3 in section `.text' failed
llvm-svn: 361088
Diffstat (limited to 'lld/ELF/InputSection.cpp')
| -rw-r--r-- | lld/ELF/InputSection.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp index 72a2c298d5e..1fcc3db0448 100644 --- a/lld/ELF/InputSection.cpp +++ b/lld/ELF/InputSection.cpp @@ -752,7 +752,7 @@ static uint64_t getRelocTargetVA(const InputFile *File, RelType Type, int64_t A, return Sym.getVA(A) + getTlsTpOffset(); case R_RELAX_TLS_GD_TO_LE_NEG: case R_NEG_TLS: - return Out::TlsPhdr->p_memsz - Sym.getVA(A); + return -(Sym.getVA(A) + getTlsTpOffset()); case R_SIZE: return Sym.getSize() + A; case R_TLSDESC: |

