[PATCH] D81184: [lld][ELF][AArch64] Handle R_AARCH64_PLT32 relocation

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 22 17:12:50 PDT 2020


MaskRay added inline comments.


================
Comment at: lld/ELF/Arch/AArch64.cpp:269
+  uint64_t range =
+      (type == R_AARCH64_PLT32) ? (UINT64_C(1) << 31) : (128 * 1024 * 1024);
   if (dst > src) {
----------------
`(type == R_AARCH64_PLT32)` => `type == R_AARCH64_PLT32`

Drop two other unneeded parentheses.


================
Comment at: lld/test/ELF/aarch64-plt32.s:15
+
+// RUN: ld.lld -z max-page-size=4096 %t.o %t256.o -o %t2
+// RUN: llvm-objdump -s --section=.data %t2 | FileCheck %s
----------------
Place RUN and CHECK lines before code. (I know that some tests do not enforce this rule.)


================
Comment at: lld/test/ELF/aarch64-range-thunk-extension-plt32.s:24
+// CHECK: 0000000000010000 <_start>:
+// CHECK:    10000:       04 00 00 00     .word   0x00000004
+
----------------
```
// CHECK-LABEL: <_start>:
// CHECK-NEXT:    10000:     04 00 00 00     .word   0x00000004
```

Omitting addresses on the label line avoids duplication.


================
Comment at: lld/test/ELF/aarch64-range-thunk-extension-plt32.s:28
+// CHECK: 0000000000010004 <__AArch64AbsLongThunk_callee>:
+// CHECK:    10004:       ldr     x16, 0x1000c <$d>
+// CHECK:    10008:       br      x16
----------------
ditto


================
Comment at: lld/test/ELF/aarch64-undefined-weak-plt32.s:1
+// REQUIRES: aarch64
+// RUN: llvm-mc -filetype=obj -triple=aarch64 %s -o %t.o
----------------
As a separate test file this adds very little value. You can move the test to the main test file.


================
Comment at: lld/test/ELF/aarch64-undefined-weak-plt32.s:13
+
+// CHECK: Disassembly of section .text:
+// CHECK-EMPTY:
----------------
Delete `Disassembly of section .text:` - not useful.


================
Comment at: lld/test/ELF/aarch64-undefined-weak-plt32.s:15
+// CHECK-EMPTY:
+// CHECK-NEXT: 0000000010010120 <_start>:
+// CHECK-NEXT: 10010120: 00 00 00 00     .word   0x00000000
----------------
Omitting addresses on the label line avoids duplication.


================
Comment at: lld/test/ELF/relocation-plt32-aarch64.s:11
+// CHECK:      Contents of section .data:
+// CHECK:       30370 40fffdff
+// The calculation is
----------------
NEXT


================
Comment at: lld/test/ELF/relocation-plt32-aarch64.s:12
+// CHECK:       30370 40fffdff
+// The calculation is
+//   0x10290  (foo at PLT)
----------------
Use `/// ` for non-CHECK-non-RUN comments, or use `# RUN` and `## ` for comments.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81184





More information about the llvm-commits mailing list