[PATCH] D87504: [PowerPC][LLD] Support for PC Relative TLS for Local Dynamic

Sean Fertile via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 16 12:22:56 PDT 2020


sfertile added inline comments.


================
Comment at: lld/ELF/Arch/PPC64.cpp:1319
+    val -= dynamicThreadPointerOffset;
+    [[clang::fallthrough]];
   case R_PPC64_PCREL34:
----------------
`LLVM_FALLTHROUGH;`


================
Comment at: lld/test/ELF/ppc64-tls-pcrel-ld.s:2
+# REQUIRES: ppc
+# RUN: echo 'SECTIONS { \
+# RUN:   .text_addr 0x1001000 : { *(.text_addr) } \
----------------
Is using split file the preferred way to do this now?


================
Comment at: lld/test/ELF/ppc64-tls-pcrel-ld.s:10
+# RUN: llvm-mc -filetype=obj -triple=powerpc64le %s -o %t.o
+# RUN: ld.lld -T %t.script --shared %t.o -o %t-ld.so
+# RUN: ld.lld -T %t.script %t.o -o %t-ldtole
----------------
missing `--soname` 


================
Comment at: lld/test/ELF/ppc64-tls-pcrel-ld.s:35
+# LD-GOT:      section '.got':
+# LD-GOT-NEXT: 0x01004150 50c10001 00000000 00000000 00000000
+
----------------
Am I reading/interpreting this correctly?

The .got section is at address: `0x01004150`, This is the first word of hex.
The first entry is the .TOC. symbol with a value of `.got + 0x8000` = `0x000000000100c150`. This is the second and third words of hex.
Then there are 2 words of zeros --> This is the `ti_module` field of the `struct tls_index` for local tls symbols for this module.

Then output ends. I would expect 2 more words of zeros for the `ti_offset` field, although maybe readobj is truncating the output, or we are missing a line?

Also shouldn't the relocation `0000000001004150  0000000000000044 R_PPC64_DTPMOD64                  0`
Be relocating address `0x1004158`, since that is the address of the e `ti_module` field? Right now it seems to me like it would modify the toc-base value instead of filing in the second entry with the module tls id ... 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87504/new/

https://reviews.llvm.org/D87504



More information about the llvm-commits mailing list