forked from OSchip/llvm-project
[ELF][Hexagon] Allow PT_LOAD to have overlapping p_offset ranges on EM_HEXAGON
Port the D64906 technique to EM_HEXAGON. This concludes the patch series. Differential Revision: https://reviews.llvm.org/D67605 llvm-svn: 372059
This commit is contained in:
parent
cbd13bc1ed
commit
4816e516e5
|
@ -2223,12 +2223,7 @@ template <class ELFT> void Writer<ELFT>::fixSectionAlignments() {
|
|||
// 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 = [] {
|
||||
|
|
|
@ -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 @@ foo:
|
|||
# R_HEX_GOTREL_32_6_X and R_HEX_GOTREL_16_X
|
||||
r0 = ##(.Lpc@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 }
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
# 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
|
||||
# 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: ld.lld -shared %t2.o -soname so -o %t3.so
|
||||
# RUN: ld.lld -shared %t %t3.so -o %t4.so
|
||||
# RUN: llvm-objdump -d -j .plt %t4.so | FileCheck --check-prefix=PLT %s
|
||||
# RUN: llvm-objdump -d -j .text %t4.so | FileCheck --check-prefix=TEXT %s
|
||||
# RUN: llvm-objdump -D -j .got %t4.so | FileCheck --check-prefix=GOT %s
|
||||
|
@ -40,26 +40,26 @@ pvar:
|
|||
.word var
|
||||
.size pvar, 4
|
||||
|
||||
# PLT: { immext(#131008
|
||||
# PLT: r28 = add(pc,##131032) }
|
||||
# PLT: { immext(#131200
|
||||
# PLT: r28 = add(pc,##131252) }
|
||||
# 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,##131236) }
|
||||
# PLT: r28 = memw(r14+#0) }
|
||||
# PLT: jumpr r28 }
|
||||
|
||||
# TEXT: 10000: 00 00 01 00 00010000
|
||||
# TEXT: { call 0x10050 }
|
||||
# TEXT: r0 = add(r1,##-65416) }
|
||||
# TEXT: 10218: 68 00 01 00 00010068
|
||||
# TEXT: { call 0x10270 }
|
||||
# TEXT: r0 = add(r1,##-65548) }
|
||||
|
||||
# GOT: .got:
|
||||
# GOT: 20080: 00 00 00 00 00000000 <unknown>
|
||||
# GOT: 202f8: 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: 000202f8 00000121 R_HEX_GLOB_DAT
|
||||
# RELO: 00030300 00000406 R_HEX_32
|
||||
# RELO: 00030314 00000122 R_HEX_JMP_SLOT
|
||||
|
|
|
@ -1,156 +1,156 @@
|
|||
# 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.s -o %t2
|
||||
# RUN: ld.lld %t2 %t -o %t3
|
||||
# RUN: llvm-objdump -d %t3 | FileCheck %s
|
||||
# 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.s -o %t1.o
|
||||
# RUN: ld.lld %t.o %t1.o -o %t
|
||||
# RUN: llvm-objdump -d %t | FileCheck %s
|
||||
|
||||
# Note: 131072 == 0x20000
|
||||
# Note: 131648 == 0x20240
|
||||
# R_HEX_32_6_X
|
||||
# R_HEX_12_X
|
||||
if (p0) r0 = ##_start
|
||||
# CHECK: immext(#131072)
|
||||
# CHECK: if (p0) r0 = ##131072
|
||||
# CHECK: immext(#131648)
|
||||
# CHECK: if (p0) r0 = ##131648
|
||||
|
||||
# R_HEX_B15_PCREL
|
||||
if (p0) jump:nt #_start
|
||||
# CHECK: if (p0) jump:nt 0x20000
|
||||
# CHECK: if (p0) jump:nt 0x20240
|
||||
|
||||
# R_HEX_B32_PCREL_X
|
||||
# R_HEX_B15_PCREL_X
|
||||
if (p0) jump:nt ##_start
|
||||
# CHECK: if (p0) jump:nt 0x20000
|
||||
# CHECK: if (p0) jump:nt 0x20240
|
||||
|
||||
# R_HEX_B22_PCREL
|
||||
call #_start
|
||||
# CHECK: call 0x20000
|
||||
# CHECK: call 0x20240
|
||||
|
||||
# R_HEX_B32_PCREL_X
|
||||
# R_HEX_B22_PCREL_X
|
||||
call ##_start
|
||||
# CHECK: immext(#4294967232)
|
||||
# CHECK: call 0x20000
|
||||
# CHECK: immext(#320)
|
||||
# CHECK: call 0x20240
|
||||
|
||||
# R_HEX_6_X tests:
|
||||
# One test for each mask in the lookup table.
|
||||
|
||||
#0x38000000
|
||||
if (!P0) memw(r0+#8)=##_start
|
||||
# CHECK: 38c0c100 if (!p0) memw(r0+#8) = ##131072 }
|
||||
# CHECK: 38c0c100 if (!p0) memw(r0+#8) = ##131648 }
|
||||
|
||||
#0x39000000
|
||||
{ p0 = p1
|
||||
if (!P0.new) memw(r0+#0)=##_start }
|
||||
# CHECK: 39c0c000 if (!p0.new) memw(r0+#0) = ##131072 }
|
||||
# CHECK: 39c0c000 if (!p0.new) memw(r0+#0) = ##131648 }
|
||||
|
||||
#0x3e000000
|
||||
memw(r0+##_start)+=r1
|
||||
# CHECK: 3e40c001 memw(r0+##131072) += r1 }
|
||||
# CHECK: 3e40c001 memw(r0+##131648) += r1 }
|
||||
|
||||
#0x3f000000
|
||||
memw(r0+##_start)+=#4
|
||||
# CHECK: 3f40c004 memw(r0+##131072) += #4 }
|
||||
# CHECK: 3f40c004 memw(r0+##131648) += #4 }
|
||||
|
||||
#0x40000000
|
||||
{ r0 = r1
|
||||
if (p0) memb(r0+##_start)=r0.new }
|
||||
# CHECK: 40a0c200 if (p0) memb(r0+##131072) = r0.new }
|
||||
# CHECK: 40a0c200 if (p0) memb(r0+##131648) = r0.new }
|
||||
|
||||
#0x41000000
|
||||
if (p0) r0=memb(r1+##_start)
|
||||
# CHECK: 4101c000 if (p0) r0 = memb(r1+##131072) }
|
||||
# CHECK: 4101c000 if (p0) r0 = memb(r1+##131648) }
|
||||
|
||||
#0x42000000
|
||||
{ r0 = r1
|
||||
p0 = p1
|
||||
if (p0.new) memb(r0+##_start)=r0.new }
|
||||
# CHECK: 42a0c200 if (p0.new) memb(r0+##131072) = r0.new }
|
||||
# CHECK: 42a0c200 if (p0.new) memb(r0+##131648) = r0.new }
|
||||
|
||||
#0x43000000
|
||||
{ p0 = p1
|
||||
if (P0.new) r0=memb(r0+##_start) }
|
||||
# CHECK: 4300c000 if (p0.new) r0 = memb(r0+##131072) }
|
||||
# CHECK: 4300c000 if (p0.new) r0 = memb(r0+##131648) }
|
||||
|
||||
#0x44000000
|
||||
if (!p0) memb(r0+##_start)=r1
|
||||
# CHECK: 4400c100 if (!p0) memb(r0+##131072) = r1 }
|
||||
# CHECK: 4400c100 if (!p0) memb(r0+##131648) = r1 }
|
||||
|
||||
#0x45000000
|
||||
if (!p0) r0=memb(r1+##_start)
|
||||
# CHECK: 4501c000 if (!p0) r0 = memb(r1+##131072) }
|
||||
# CHECK: 4501c000 if (!p0) r0 = memb(r1+##131648) }
|
||||
|
||||
#0x46000000
|
||||
{ p0 = p1
|
||||
if (!p0.new) memb(r0+##_start)=r1 }
|
||||
# CHECK: 4600c100 if (!p0.new) memb(r0+##131072) = r1 }
|
||||
# CHECK: 4600c100 if (!p0.new) memb(r0+##131648) = r1 }
|
||||
|
||||
#0x47000000
|
||||
{ p0 = p1
|
||||
if (!p0.new) r0=memb(r1+##_start) }
|
||||
# CHECK: 4701c000 if (!p0.new) r0 = memb(r1+##131072) }
|
||||
# CHECK: 4701c000 if (!p0.new) r0 = memb(r1+##131648) }
|
||||
|
||||
#0x6a000000 -- Note 4294967132 == -0xa4 the distance between
|
||||
# here and _start, so this will change if
|
||||
# tests are added between here and _start
|
||||
r0=add(pc,##_start@pcrel)
|
||||
# CHECK: 6a49ce00 r0 = add(pc,##4294967132) }
|
||||
# CHECK: 6a49d800 r0 = add(pc,##240) }
|
||||
|
||||
#0x7c000000
|
||||
r1:0=combine(#8,##_start)
|
||||
# CHECK: 7c80c100 r1:0 = combine(#8,##131072) }
|
||||
# CHECK: 7c80c100 r1:0 = combine(#8,##131648) }
|
||||
|
||||
#0x9a000000
|
||||
r1:0=memb_fifo(r2=##_start)
|
||||
# CHECK: 9a82d000 r1:0 = memb_fifo(r2=##131072) }
|
||||
# CHECK: 9a82d000 r1:0 = memb_fifo(r2=##131648) }
|
||||
|
||||
#0x9b000000
|
||||
r0=memb(r1=##_start)
|
||||
# CHECK: 9b01d000 r0 = memb(r1=##131072) }
|
||||
# CHECK: 9b01d000 r0 = memb(r1=##131648) }
|
||||
|
||||
#0x9c000000
|
||||
r1:0=memb_fifo(r2<<#2+##_start)
|
||||
# CHECK: 9c82f000 r1:0 = memb_fifo(r2<<#2+##131072) }
|
||||
# CHECK: 9c82f000 r1:0 = memb_fifo(r2<<#2+##131648) }
|
||||
|
||||
#0x9d000000
|
||||
r0=memb(r1<<#2+##_start)
|
||||
# CHECK: 9d01f000 r0 = memb(r1<<#2+##131072) }
|
||||
# CHECK: 9d01f000 r0 = memb(r1<<#2+##131648) }
|
||||
|
||||
#0x9f000000
|
||||
if (!p0) r0=memb(##_start)
|
||||
# CHECK: 9f00e880 if (!p0) r0 = memb(##131072) }
|
||||
# CHECK: 9f00e880 if (!p0) r0 = memb(##131648) }
|
||||
|
||||
#0xab000000
|
||||
memb(r0=##_start)=r1
|
||||
# CHECK: ab00c180 memb(r0=##131072) = r1 }
|
||||
# CHECK: ab00c180 memb(r0=##131648) = r1 }
|
||||
|
||||
#0xad000000
|
||||
memb(r0<<#2+##_start)=r1
|
||||
# CHECK: ad00e180 memb(r0<<#2+##131072) = r1 }
|
||||
# CHECK: ad00e180 memb(r0<<#2+##131648) = r1 }
|
||||
|
||||
#0xaf000000
|
||||
if (!p0) memb(##_start)=r1
|
||||
# CHECK: af00c184 if (!p0) memb(##131072) = r1 }
|
||||
# CHECK: af00c184 if (!p0) memb(##131648) = r1 }
|
||||
|
||||
#0xd7000000
|
||||
r0=add(##_start,mpyi(r1,r2))
|
||||
# CHECK: d701c200 r0 = add(##131072,mpyi(r1,r2)) }
|
||||
# CHECK: d701c200 r0 = add(##131648,mpyi(r1,r2)) }
|
||||
|
||||
#0xd8000000
|
||||
R0=add(##_start,mpyi(r0,#2))
|
||||
# CHECK: d800c002 r0 = add(##131072,mpyi(r0,#2)) }
|
||||
# CHECK: d800c002 r0 = add(##131648,mpyi(r0,#2)) }
|
||||
|
||||
#0xdb000000
|
||||
r0=add(r1,add(r2,##_start))
|
||||
# CHECK: db01c002 r0 = add(r1,add(r2,##131072)) }
|
||||
# CHECK: db01c002 r0 = add(r1,add(r2,##131648)) }
|
||||
|
||||
#0xdf000000
|
||||
r0=add(r1,mpyi(r2,##_start))
|
||||
# CHECK: df82c001 r0 = add(r1,mpyi(r2,##131072)) }
|
||||
# CHECK: df82c001 r0 = add(r1,mpyi(r2,##131648)) }
|
||||
|
||||
# Duplex form of R_HEX_6_X
|
||||
# R_HEX_32_6_X
|
||||
# R_HEX_6_X
|
||||
{ r0 = ##_start; r2 = r16 }
|
||||
# CHECK: 28003082 r0 = ##131072; r2 = r16 }
|
||||
# CHECK: 28003082 r0 = ##131648; r2 = r16 }
|
||||
|
||||
# R_HEX_HI16
|
||||
r0.h = #HI(_start)
|
||||
|
@ -158,66 +158,66 @@ r0.h = #HI(_start)
|
|||
|
||||
# R_HEX_LO16
|
||||
r0.l = #LO(_start)
|
||||
# CHECK: r0.l = #0
|
||||
# CHECK: r0.l = #576
|
||||
|
||||
# R_HEX_8_X has 3 relocation mask variations
|
||||
#0xde000000
|
||||
r0=sub(##_start, asl(r0, #1))
|
||||
# CHECK: de00c106 r0 = sub(##131072,asl(r0,#1)) }
|
||||
# CHECK: de40c106 r0 = sub(##131648,asl(r0,#1)) }
|
||||
|
||||
#0x3c000000
|
||||
memw(r0+#0) = ##_start
|
||||
# CHECK: 3c40c000 memw(r0+#0) = ##131072 }
|
||||
# CHECK: 3c40c040 memw(r0+#0) = ##131648 }
|
||||
|
||||
# The rest:
|
||||
r1:0=combine(r2,##_start);
|
||||
# CHECK: 7302e000 r1:0 = combine(r2,##131072) }
|
||||
# CHECK: 7302e800 r1:0 = combine(r2,##131648) }
|
||||
|
||||
# R_HEX_32:
|
||||
r_hex_32:
|
||||
.word _start
|
||||
# CHECK: 00020000
|
||||
# CHECK: 00020240
|
||||
|
||||
# R_HEX_16_X has 4 relocation mask variations
|
||||
# 0x48000000
|
||||
memw(##_start) = r0
|
||||
# CHECK: 4880c000 memw(##131072) = r0 }
|
||||
# CHECK: 4880c000 memw(##131648) = r0 }
|
||||
|
||||
# 0x49000000
|
||||
r0 = memw(##_start)
|
||||
# CHECK: 4980c000 r0 = memw(##131072)
|
||||
# CHECK: 4980c000 r0 = memw(##131648)
|
||||
|
||||
# 0x78000000
|
||||
r0 = ##_start
|
||||
# CHECK: 7800c000 r0 = ##131072 }
|
||||
# CHECK: 7800c000 r0 = ##131648 }
|
||||
|
||||
# 0xb0000000
|
||||
r0 = add(r1, ##_start)
|
||||
# CHECK: b001c000 r0 = add(r1,##131072) }
|
||||
# CHECK: b001c000 r0 = add(r1,##131648) }
|
||||
|
||||
# R_HEX_B9_PCREL:
|
||||
{r0=#1 ; jump #_start}
|
||||
# CHECK: jump 0x20000
|
||||
# CHECK: jump 0x20240
|
||||
|
||||
# R_HEX_B9_PCREL_X:
|
||||
{r0=#1 ; jump ##_start}
|
||||
# CHECK: jump 0x20000
|
||||
# CHECK: jump 0x20240
|
||||
|
||||
# R_HEX_B13_PCREL
|
||||
if (r0 == #0) jump:t #_start
|
||||
# CHECK: if (r0==#0) jump:t 0x20000
|
||||
# CHECK: if (r0==#0) jump:t 0x20240
|
||||
|
||||
# R_HEX_9_X
|
||||
p0 = !cmp.gtu(r0, ##_start)
|
||||
# CHECK: p0 = !cmp.gtu(r0,##131072)
|
||||
# CHECK: p0 = !cmp.gtu(r0,##131648)
|
||||
|
||||
# R_HEX_10_X
|
||||
p0 = !cmp.gt(r0, ##_start)
|
||||
# CHECK: p0 = !cmp.gt(r0,##131072)
|
||||
# CHECK: p0 = !cmp.gt(r0,##131648)
|
||||
|
||||
# R_HEX_11_X
|
||||
r0 = memw(r1+##_start)
|
||||
# CHECK: r0 = memw(r1+##131072)
|
||||
# CHECK: r0 = memw(r1+##131648)
|
||||
|
||||
memw(r0+##_start) = r1
|
||||
# CHECK: memw(r0+##131072) = r1
|
||||
# CHECK: memw(r0+##131648) = r1
|
||||
|
|
Loading…
Reference in New Issue