[PATCH] D79289: [LLD][ELF][ARM] Do not create .ARM.exidx sections for out of range inputs

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat May 2 10:35:06 PDT 2020


MaskRay added inline comments.


================
Comment at: lld/ELF/SyntheticSections.cpp:3377
+    uint64_t p = getVA();
+    int64_t off = s - p;
+    return off != llvm::SignExtend64(off, 31);
----------------
`int64_t off = isec->getVA() - getVA();`

Even better: add an explicit cast.


================
Comment at: lld/test/ELF/arm-exidx-range.s:1
+// RUN: llvm-mc --arm-add-build-attributes --triple=armv7a-linux-gnueabihf -filetype=obj %s -o %t.o
+// RUN: echo "SECTIONS { \
----------------
`// REQUIRES: arm`


================
Comment at: lld/test/ELF/arm-exidx-range.s:5
+// RUN:         .text : { *(.text) } \
+// RUN:         .vectors 0xffff0000 : AT(0xffff0000) { *(.vectors) } \
+// RUN: } " > %t.script
----------------
AT(...) can be omitted.


================
Comment at: lld/test/ELF/arm-exidx-range.s:10
+/// Adapted from Linux kernel linker script failing due to out of range
+/// relocation. The .vectors at 0xffff0000 (one of two places the vector table
+/// can go, the other is 0x0) in earlier Arm CPUs.
----------------
> The .vectors at 0xffff0000 (...) in earlier Arm CPUs.

This sentence lacks a verb.


================
Comment at: lld/test/ELF/arm-exidx-range.s:19
+// CHECK-NEXT: 0x80000000 10000000 01000000 0c000000 01000000
+
+ .text
----------------
Add `CHECK-NOT: 0x` to make sure there is the last line ("Expect only .ARM.exidx from _start and sentinel")


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

https://reviews.llvm.org/D79289





More information about the llvm-commits mailing list