[PATCH] D72819: [ELF] Decrease alignment of ThunkSection on 64-bit targets from 8 to 4
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 15 18:06:34 PST 2020
MaskRay created this revision.
MaskRay added reviewers: PowerPC, grimar, peter.smith, pcc, ruiu.
Herald added subscribers: llvm-commits, kbarton, arichardson, nemanjai, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.
ThunkSection contains 4-byte instructions on all targets that use
thunks. Thunks should not be used in any performance sensitive places,
and locality/cache line arguments should not apply.
I'll fix the remaining tests (offset change) if the idea does not sound silly.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D72819
Files:
lld/ELF/SyntheticSections.cpp
lld/test/ELF/aarch64-call26-thunk.s
lld/test/ELF/aarch64-jump26-thunk.s
lld/test/ELF/ppc64-long-branch.s
Index: lld/test/ELF/ppc64-long-branch.s
===================================================================
--- lld/test/ELF/ppc64-long-branch.s
+++ lld/test/ELF/ppc64-long-branch.s
@@ -64,9 +64,9 @@
# CHECK-NEXT: 2002000: addis 2, 12, 1
# CHECK-NEXT: addi 2, 2, -32728
# CHECK-NEXT: bl .-33554432
-# CHECK-NEXT: bl .+12
+# CHECK-NEXT: bl .+8
# CHECK: __long_branch_:
-# CHECK-NEXT: 2002018: addis 12, 2, 0
+# CHECK-NEXT: 2002014: addis 12, 2, 0
# CHECK-NEXT: ld 12, -32744(12)
# CHECK-NEXT: mtctr 12
# CHECK-NEXT: bctr
Index: lld/test/ELF/aarch64-jump26-thunk.s
===================================================================
--- lld/test/ELF/aarch64-jump26-thunk.s
+++ lld/test/ELF/aarch64-jump26-thunk.s
@@ -12,10 +12,10 @@
// CHECK: Disassembly of section .text:
// CHECK-EMPTY:
// CHECK-NEXT: _start:
-// CHECK-NEXT: 210120: b #8
+// CHECK-NEXT: 210120: b #4
// CHECK: __AArch64AbsLongThunk_big:
-// CHECK-NEXT: 210128: ldr x16, #8
-// CHECK-NEXT: 21012c: br x16
+// CHECK-NEXT: 210124: ldr x16, #8
+// CHECK-NEXT: 210128: br x16
// CHECK: $d:
-// CHECK-NEXT: 210130: 00 00 00 00 .word 0x00000000
-// CHECK-NEXT: 210134: 10 00 00 00 .word 0x00000010
+// CHECK-NEXT: 21012c: 00 00 00 00 .word 0x00000000
+// CHECK-NEXT: 210130: 10 00 00 00 .word 0x00000010
Index: lld/test/ELF/aarch64-call26-thunk.s
===================================================================
--- lld/test/ELF/aarch64-call26-thunk.s
+++ lld/test/ELF/aarch64-call26-thunk.s
@@ -12,11 +12,11 @@
// CHECK: Disassembly of section .text:
// CHECK-EMPTY:
// CHECK-NEXT: _start:
-// CHECK-NEXT: 210120: bl #8
+// CHECK-NEXT: 210120: bl #4
// CHECK: __AArch64AbsLongThunk_big:
-// CHECK-NEXT: 210128: ldr x16, #8
-// CHECK-NEXT: 21012c: br x16
+// CHECK-NEXT: 210124: ldr x16, #8
+// CHECK-NEXT: 210128: br x16
// CHECK: $d:
-// CHECK-NEXT: 210130: 00 00 00 00 .word 0x00000000
-// CHECK-NEXT: 210134: 10 00 00 00 .word 0x00000010
+// CHECK-NEXT: 21012c: 00 00 00 00 .word 0x00000000
+// CHECK-NEXT: 210130: 10 00 00 00 .word 0x00000010
Index: lld/ELF/SyntheticSections.cpp
===================================================================
--- lld/ELF/SyntheticSections.cpp
+++ lld/ELF/SyntheticSections.cpp
@@ -3451,8 +3451,8 @@
}
ThunkSection::ThunkSection(OutputSection *os, uint64_t off)
- : SyntheticSection(SHF_ALLOC | SHF_EXECINSTR, SHT_PROGBITS,
- config->wordsize, ".text.thunk") {
+ : SyntheticSection(SHF_ALLOC | SHF_EXECINSTR, SHT_PROGBITS, 4,
+ ".text.thunk") {
this->parent = os;
this->outSecOff = off;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72819.238402.patch
Type: text/x-patch
Size: 3000 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200116/bc345f6b/attachment.bin>
More information about the llvm-commits
mailing list