[PATCH] D67605: [ELF][Hexagon] Allow PT_LOAD to have overlapping p_offset ranges on EM_HEXAGON
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 16 00:25:06 PDT 2019
MaskRay created this revision.
MaskRay added reviewers: bcain, kparzysz, ruiu, shankare, sidneym.
Herald added subscribers: llvm-commits, arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.
Port the D64906 <https://reviews.llvm.org/D64906> technique to EM_HEXAGON. This concludes the patch
series.
Repository:
rLLD LLVM Linker
https://reviews.llvm.org/D67605
Files:
ELF/Writer.cpp
test/ELF/hexagon-gotrel.s
test/ELF/hexagon-shared.s
Index: test/ELF/hexagon-shared.s
===================================================================
--- test/ELF/hexagon-shared.s
+++ test/ELF/hexagon-shared.s
@@ -40,26 +40,26 @@
.word var
.size pvar, 4
-# PLT: { immext(#131008
-# PLT: r28 = add(pc,##131032) }
+# PLT: { immext(#131200
+# PLT: r28 = add(pc,##131260) }
# PLT: { r14 -= add(r28,#16)
# PLT: r15 = memw(r28+#8)
# PLT: r28 = memw(r28+#4) }
# PLT: { r14 = asr(r14,#2)
# PLT: jumpr r28 }
# PLT: { trap0(#219) }
-# PLT: immext(#131008)
-# PLT: r14 = add(pc,##131016) }
+# PLT: immext(#131200)
+# PLT: r14 = add(pc,##131244) }
# PLT: r28 = memw(r14+#0) }
# PLT: jumpr r28 }
-# TEXT: 10000: 00 00 01 00 00010000
-# TEXT: { call 0x10050 }
-# TEXT: r0 = add(r1,##-65416) }
+# TEXT: 102b0: 60 00 01 00 00010060
+# TEXT: { call 0x10300 }
+# TEXT: r0 = add(r1,##-65548) }
# GOT: .got:
-# GOT: 20080: 00 00 00 00 00000000 <unknown>
+# GOT: 20390: 00 00 00 00 00000000 <unknown>
-# RELO: 00020080 00000121 R_HEX_GLOB_DAT
-# RELO: 00030004 00000406 R_HEX_32
-# RELO: 00030018 00000122 R_HEX_JMP_SLOT
+# RELO: 00020390 00000121 R_HEX_GLOB_DAT
+# RELO: 00030398 00000406 R_HEX_32
+# RELO: 000303ac 00000122 R_HEX_JMP_SLOT
Index: test/ELF/hexagon-gotrel.s
===================================================================
--- test/ELF/hexagon-gotrel.s
+++ test/ELF/hexagon-gotrel.s
@@ -1,7 +1,7 @@
# REQUIRES: hexagon
# RUN: llvm-mc -filetype=obj -triple=hexagon-unknown-elf %s -o %t.o
# RUN: llvm-mc -filetype=obj -triple=hexagon-unknown-elf %S/Inputs/hexagon-shared.s -o %t2.o
-# RUN: ld.lld -shared %t2.o -o %t2.so
+# RUN: ld.lld -shared %t2.o -soname=so -o %t2.so
# RUN: ld.lld -shared %t.o %t2.so -o %t3.so
# RUN: llvm-objdump --print-imm-hex -d -j .text %t3.so | FileCheck --check-prefix=TEXT %s
@@ -19,9 +19,9 @@
# R_HEX_GOTREL_32_6_X and R_HEX_GOTREL_16_X
r0 = ##(.Lpc at GOTREL)
-# TEXT: r0.l = #0x0 }
-# TEXT: r0.h = #0xfffe }
-# TEXT: immext(#0xfffe0000)
-# TEXT: r0 = memw(r1+##-0x20000) }
-# TEXT: immext(#0xfffe0000)
-# TEXT: r0 = ##-0x20000 }
+# TEXT: r0.l = #0xffa8 }
+# TEXT: r0.h = #0xfffd }
+# TEXT: immext(#0xfffdff80)
+# TEXT: r0 = memw(r1+##-0x20058) }
+# TEXT: immext(#0xfffdff80)
+# TEXT: r0 = ##-0x20058 }
Index: ELF/Writer.cpp
===================================================================
--- ELF/Writer.cpp
+++ ELF/Writer.cpp
@@ -2216,12 +2216,7 @@
// maximum page size boundary so that we can find the ELF header at the
// start. We cannot benefit from overlapping p_offset ranges with the
// previous segment anyway.
- //
- // TODO Enable this technique on all targets.
- bool enable = config->emachine != EM_HEXAGON;
-
- if (!enable ||
- (config->zSeparateCode && prev &&
+ if ((config->zSeparateCode && prev &&
(prev->p_flags & PF_X) != (p->p_flags & PF_X)) ||
cmd->type == SHT_LLVM_PART_EHDR)
cmd->addrExpr = [] {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67605.220282.patch
Type: text/x-patch
Size: 2934 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190916/c487aa42/attachment.bin>
More information about the llvm-commits
mailing list