[PATCH] D66260: [lld][Hexagon] Add GOTREL relocations

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 14 23:04:42 PDT 2019


MaskRay added inline comments.


================
Comment at: lld/test/ELF/hexagon-gotrel.s:2
+# REQUIRES: hexagon
+# RUN: llvm-mc -filetype=obj -triple=hexagon-unknown-elf %s -o %t
+# RUN: llvm-mc -filetype=obj -triple=hexagon-unknown-elf %S/Inputs/hexagon-shared.s -o %t2.o
----------------
`%t.o`


================
Comment at: lld/test/ELF/hexagon-gotrel.s:4
+# RUN: llvm-mc -filetype=obj -triple=hexagon-unknown-elf %S/Inputs/hexagon-shared.s -o %t2.o
+# RUN: ld.lld -shared %t2.o -soname %t3.so -o %t3.so
+# RUN: ld.lld -shared %t %t3.so -soname %t4.so -o %t4.so
----------------
I'd use `%t2.so` because it makes it stand out that `%t2.so` is created from `%t2.so`


================
Comment at: lld/test/ELF/hexagon-gotrel.s:5
+# RUN: ld.lld -shared %t2.o -soname %t3.so -o %t3.so
+# RUN: ld.lld -shared %t %t3.so -soname %t4.so -o %t4.so
+# RUN: llvm-objdump --print-imm-hex -d -j .text %t4.so | FileCheck --check-prefix=TEXT %s
----------------
`-soname %t4.so` is not needed because %t4.so is the final output. The rule to use `-soname`:

    When linking an executable with %t.so, the path %t.so will be recorded in the DT_NEEDED entry if %t.so doesn't have DT_SONAME. .dynstr will have varying lengths on different systems. Add -soname so that the string in .dynstr is of fixed length to make tests more robust.

If you name the object `%t.o`, `%t` will be a good output name.


Repository:
  rLLD LLVM Linker

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

https://reviews.llvm.org/D66260





More information about the llvm-commits mailing list