[PATCH] D16201: [ELF/AArch64] - Implemented set of R_AARCH64_TLSDESC_* relocations.

Adhemerval Zanella via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 29 14:10:55 PST 2016


zatrazz added a comment.

I see placing TLSDESC after jump slots seems to be the right way. From elf aarch64 code in glibc (sysdeps/aarch64/dl-machine.h) I see that only TLSDESC is a double GOT, so we should we place it on the end to avoid dynamic relocation handling issues (gold also place the TLSDESC in .got.plt after jump slot and IRELATIVE).

However I still think it is something missing, I am still seeing some issues with bootstrap with an random testcase:

$ gdb ./bin/lld-link
(gdb) r @tools/lld/test/COFF/Output/responsefile.test.tmp.rsp /heap:0x3000
(gdb) bt
#0  0x00454211f0000f10 in ?? ()
#1  0x0000007fb7f52030 in __pthread_once_slow (once_control=0x1aac6d0, init_routine=0xf9454211f0000f10) at pthread_once.c:114
#2  0x0000000000900368 in std::__future_base::_Async_state_commonV2::_M_complete_async() ()
#3  0x00000000008fd3e4 in std::future<lld::coff::InputFile*>::get() ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb) up
[...]
(gdb) disas
[...]

  0x0000007fb7f52020 <+132>:   add     x1, x1, #0x7c
  0x0000007fb7f52024 <+136>:   mov     x19, x4
  0x0000007fb7f52028 <+140>:   bl      0x7fb7f53440 <_pthread_cleanup_push>
  0x0000007fb7f5202c <+144>:   blr     x20

> 0x0000007fb7f52030 <+148>:   mov     x0, x21
==============================================


================
Comment at: ELF/InputSection.cpp:282
@@ +281,3 @@
+      Target->relocateOne(BufLoc, BufEnd, Type, AddrLoc,
+                          Body->getGotPltRevVA<ELFT>() + getAddend<ELFT>(RI));
+      continue;
----------------
I think you could just use the already got addend 'A' at line 235.

================
Comment at: ELF/OutputSections.cpp:239
@@ -209,1 +238,3 @@
+                                 Out<ELFT>::Got->getTlsDescEntryVA(),
+                                 Out<ELF64LE>::GotPlt->getVA());
 }
----------------
I think this should use the non-specialized 'GotPlt' access (Out<ELT>::GotPlt).


http://reviews.llvm.org/D16201





More information about the llvm-commits mailing list