[lld] ee9a251 - [ELF] Set DF_1_PIE for -pie
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 1 10:19:51 PDT 2020
Author: Fangrui Song
Date: 2020-06-01T10:19:41-07:00
New Revision: ee9a251caf1d785798c3602d473c3d2d84180d50
URL: https://github.com/llvm/llvm-project/commit/ee9a251caf1d785798c3602d473c3d2d84180d50
DIFF: https://github.com/llvm/llvm-project/commit/ee9a251caf1d785798c3602d473c3d2d84180d50.diff
LOG: [ELF] Set DF_1_PIE for -pie
DF_1_PIE originated from Solaris (https://docs.oracle.com/cd/E36784_01/html/E36857/chapter6-42444.html ).
GNU ld since
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=5fe2850dd96483f176858fd75c098313d5b20bc2
sets the flag on non-Solaris platforms.
It can help distinguish PIE from ET_DYN.
eu-classify from elfutils uses this to recognize PIE (https://sourceware.org/git/?p=elfutils.git;a=commit;h=3f489b5c7c78df6d52f8982f79c36e9a220e8951 )
glibc uses this flag to reject dlopen'ing a PIE (https://sourceware.org/bugzilla/show_bug.cgi?id=24323 )
Reviewed By: psmith
Differential Revision: https://reviews.llvm.org/D80872
Added:
Modified:
lld/ELF/SyntheticSections.cpp
lld/test/ELF/aarch64-feature-bti.s
lld/test/ELF/aarch64-gnu-ifunc-nonpreemptable.s
lld/test/ELF/aarch64-ifunc-bti.s
lld/test/ELF/arm-pie-relative.s
lld/test/ELF/gnu-ifunc-dyntags.s
lld/test/ELF/i386-retpoline-pic.s
lld/test/ELF/local-got-pie.s
lld/test/ELF/pack-dyn-relocs-arm2.s
lld/test/ELF/pack-dyn-relocs-relr-loop.s
lld/test/ELF/pack-dyn-relocs.s
lld/test/ELF/pie.s
lld/test/ELF/ppc32-call-stub-pic.s
lld/test/ELF/ppc32-ifunc-nonpreemptible-pic.s
lld/test/ELF/ppc64-long-branch-pi.s
lld/test/ELF/relative-dynamic-reloc-pie.s
lld/test/ELF/riscv-gp.s
lld/test/ELF/riscv-ifunc-nonpreemptible.s
lld/test/ELF/separate-segments.s
Removed:
################################################################################
diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp
index 16f4d1e96fa5..f6d66fff6d4b 100644
--- a/lld/ELF/SyntheticSections.cpp
+++ b/lld/ELF/SyntheticSections.cpp
@@ -1317,6 +1317,8 @@ template <class ELFT> void DynamicSection<ELFT>::finalizeContents() {
dtFlags1 |= DF_1_NODELETE;
if (config->zNodlopen)
dtFlags1 |= DF_1_NOOPEN;
+ if (config->pie)
+ dtFlags1 |= DF_1_PIE;
if (config->zNow) {
dtFlags |= DF_BIND_NOW;
dtFlags1 |= DF_1_NOW;
diff --git a/lld/test/ELF/aarch64-feature-bti.s b/lld/test/ELF/aarch64-feature-bti.s
index 4c24061462f7..f4fb701cc77c 100644
--- a/lld/test/ELF/aarch64-feature-bti.s
+++ b/lld/test/ELF/aarch64-feature-bti.s
@@ -127,16 +127,16 @@
# PIE-NEXT: 10350: bti c
# PIE-NEXT: stp x16, x30, [sp, #-16]!
# PIE-NEXT: adrp x16, #131072
-# PIE-NEXT: ldr x17, [x16, #1160]
-# PIE-NEXT: add x16, x16, #1160
+# PIE-NEXT: ldr x17, [x16, #1176]
+# PIE-NEXT: add x16, x16, #1176
# PIE-NEXT: br x17
# PIE-NEXT: nop
# PIE-NEXT: nop
# PIE: 0000000000010370 <func2 at plt>:
# PIE-NEXT: 10370: bti c
# PIE-NEXT: adrp x16, #131072
-# PIE-NEXT: ldr x17, [x16, #1168]
-# PIE-NEXT: add x16, x16, #1168
+# PIE-NEXT: ldr x17, [x16, #1184]
+# PIE-NEXT: add x16, x16, #1184
# PIE-NEXT: br x17
# PIE-NEXT: nop
diff --git a/lld/test/ELF/aarch64-gnu-ifunc-nonpreemptable.s b/lld/test/ELF/aarch64-gnu-ifunc-nonpreemptable.s
index 31b826c8b580..9f8a59367b0e 100644
--- a/lld/test/ELF/aarch64-gnu-ifunc-nonpreemptable.s
+++ b/lld/test/ELF/aarch64-gnu-ifunc-nonpreemptable.s
@@ -63,10 +63,10 @@ main:
# PIE-EMPTY:
# PIE-NEXT: <myfunc>:
# PIE-NEXT: 10270: adrp x16, #131072
-# PIE-NEXT: 10274: ldr x17, [x16, #880]
-# PIE-NEXT: 10278: add x16, x16, #880
+# PIE-NEXT: 10274: ldr x17, [x16, #896]
+# PIE-NEXT: 10278: add x16, x16, #896
# PIE-NEXT: 1027c: br x17
# PIE-RELOC: .rela.dyn {
-# PIE-RELOC-NEXT: 0x30370 R_AARCH64_IRELATIVE - 0x10260
+# PIE-RELOC-NEXT: 0x30380 R_AARCH64_IRELATIVE - 0x10260
# PIE-RELOC-NEXT: }
diff --git a/lld/test/ELF/aarch64-ifunc-bti.s b/lld/test/ELF/aarch64-ifunc-bti.s
index a6434289691a..ab6c6236d2a0 100644
--- a/lld/test/ELF/aarch64-ifunc-bti.s
+++ b/lld/test/ELF/aarch64-ifunc-bti.s
@@ -15,16 +15,16 @@
# CHECK-NEXT: 10380: bti c
# CHECK-NEXT: stp x16, x30, [sp, #-16]!
# CHECK-NEXT: adrp x16, #131072
-# CHECK-NEXT: ldr x17, [x16, #1272]
-# CHECK-NEXT: add x16, x16, #1272
+# CHECK-NEXT: ldr x17, [x16, #1288]
+# CHECK-NEXT: add x16, x16, #1288
# CHECK-NEXT: br x17
# CHECK-NEXT: nop
# CHECK-NEXT: nop
# CHECK: 00000000000103a0 <func1 at plt>:
# CHECK-NEXT: 103a0: bti c
# CHECK-NEXT: adrp x16, #131072
-# CHECK-NEXT: ldr x17, [x16, #1280]
-# CHECK-NEXT: add x16, x16, #1280
+# CHECK-NEXT: ldr x17, [x16, #1296]
+# CHECK-NEXT: add x16, x16, #1296
# CHECK-NEXT: br x17
# CHECK-NEXT: nop
# CHECK-EMPTY:
@@ -33,8 +33,8 @@
# CHECK-NEXT: 00000000000103c0 <myfunc>:
# CHECK-NEXT: 103c0: bti c
# CHECK-NEXT: adrp x16, #131072
-# CHECK-NEXT: ldr x17, [x16, #1288]
-# CHECK-NEXT: add x16, x16, #1288
+# CHECK-NEXT: ldr x17, [x16, #1304]
+# CHECK-NEXT: add x16, x16, #1304
# CHECK-NEXT: br x17
# CHECK-NEXT: nop
diff --git a/lld/test/ELF/arm-pie-relative.s b/lld/test/ELF/arm-pie-relative.s
index e0758895a9db..20421f2d0c8e 100644
--- a/lld/test/ELF/arm-pie-relative.s
+++ b/lld/test/ELF/arm-pie-relative.s
@@ -19,7 +19,7 @@ sym:
// CHECK: Relocations [
// CHECK-NEXT: Section (5) .rel.dyn {
-// CHECK-NEXT: 0x201DC R_ARM_RELATIVE
+// CHECK-NEXT: 0x201E4 R_ARM_RELATIVE
// GOT: section '.got':
-// GOT-NEXT: 0x000201dc e0010300
+// GOT-NEXT: 0x000201e4 e8010300
diff --git a/lld/test/ELF/gnu-ifunc-dyntags.s b/lld/test/ELF/gnu-ifunc-dyntags.s
index 9d1a0c5e23ad..fd80dc24f2f8 100644
--- a/lld/test/ELF/gnu-ifunc-dyntags.s
+++ b/lld/test/ELF/gnu-ifunc-dyntags.s
@@ -9,14 +9,14 @@
# CHECK: Name Size VMA
# CHECK: .rela.dyn 00000030 0000000000000248
-# CHECK: .got.plt 00000010 00000000000033a0
+# CHECK: .got.plt 00000010 00000000000033b0
# TAGS: Tag Type Name/Value
# TAGS: 0x0000000000000007 RELA 0x248
# TAGS: 0x0000000000000008 RELASZ 48 (bytes)
# TAGS: 0x0000000000000017 JMPREL 0x0
# TAGS: 0x0000000000000002 PLTRELSZ 0 (bytes)
-# TAGS: 0x0000000000000003 PLTGOT 0x33A0
+# TAGS: 0x0000000000000003 PLTGOT 0x33B0
# TAGS: 0x0000000000000014 PLTREL RELA
# TAGS: Relocations [
diff --git a/lld/test/ELF/i386-retpoline-pic.s b/lld/test/ELF/i386-retpoline-pic.s
index b6a01243c175..293506d74628 100644
--- a/lld/test/ELF/i386-retpoline-pic.s
+++ b/lld/test/ELF/i386-retpoline-pic.s
@@ -7,8 +7,8 @@
// RUN: llvm-objdump -d -s --no-show-raw-insn %t.exe | FileCheck %s
// CHECK: Contents of section .got.plt:
-// CHECK-NEXT: 32a8 40220000 00000000 00000000 11120000
-// CHECK-NEXT: 32b8 31120000
+// CHECK-NEXT: 32b0 40220000 00000000 00000000 11120000
+// CHECK-NEXT: 32c0 31120000
// CHECK: Disassembly of section .plt:
// CHECK-EMPTY:
diff --git a/lld/test/ELF/local-got-pie.s b/lld/test/ELF/local-got-pie.s
index 41c33c2513b5..b9c72076a15c 100644
--- a/lld/test/ELF/local-got-pie.s
+++ b/lld/test/ELF/local-got-pie.s
@@ -2,7 +2,7 @@
// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
// RUN: ld.lld --hash-style=sysv %t.o -o %t -pie
// RUN: llvm-readobj -S -d -r %t | FileCheck %s
-// RUN: llvm-objdump -d %t | FileCheck --check-prefix=DISASM %s
+// RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=DISASM %s
.globl _start
_start:
@@ -13,13 +13,12 @@ _start:
foo:
nop
-// 0x22C8 - 0x1210 - 5 = 4275
// DISASM: Disassembly of section .text:
// DISASM-EMPTY:
// DISASM-NEXT: <_start>:
-// DISASM-NEXT: 1210: {{.*}} callq 0x22c8
+// DISASM-NEXT: 1210: callq 0x22d8
// DISASM: <foo>:
-// DISASM-NEXT: 1215: {{.*}} nop
+// DISASM-NEXT: 1215: nop
// CHECK: Name: .got
// CHECK-NEXT: Type: SHT_PROGBITS
@@ -27,7 +26,7 @@ foo:
// CHECK-NEXT: SHF_ALLOC
// CHECK-NEXT: SHF_WRITE
// CHECK-NEXT: ]
-// CHECK-NEXT: Address: 0x22C8
+// CHECK-NEXT: Address: 0x22D8
// CHECK-NEXT: Offset:
// CHECK-NEXT: Size: 8
@@ -35,6 +34,6 @@ foo:
// CHECK: Relocations [
// CHECK-NEXT: Section ({{.*}}) .rela.dyn {
-// CHECK-NEXT: 0x22C8 R_X86_64_RELATIVE - 0x1215
+// CHECK-NEXT: 0x22D8 R_X86_64_RELATIVE - 0x1215
// CHECK-NEXT: }
// CHECK-NEXT: ]
diff --git a/lld/test/ELF/pack-dyn-relocs-arm2.s b/lld/test/ELF/pack-dyn-relocs-arm2.s
index dbe6d1aca21c..b2aa8a5f0add 100644
--- a/lld/test/ELF/pack-dyn-relocs-arm2.s
+++ b/lld/test/ELF/pack-dyn-relocs-arm2.s
@@ -8,8 +8,6 @@
// RUN: llvm-readobj -r %t.exe | FileCheck %s
// CHECK: Section (5) .relr.dyn {
-// CHECK-NEXT: 0x301E0 R_ARM_RELATIVE - 0x0
-// CHECK-NEXT: 0x301E4 R_ARM_RELATIVE - 0x0
// CHECK-NEXT: 0x301E8 R_ARM_RELATIVE - 0x0
// CHECK-NEXT: 0x301EC R_ARM_RELATIVE - 0x0
// CHECK-NEXT: 0x301F0 R_ARM_RELATIVE - 0x0
@@ -42,6 +40,8 @@
// CHECK-NEXT: 0x3025C R_ARM_RELATIVE - 0x0
// CHECK-NEXT: 0x30260 R_ARM_RELATIVE - 0x0
// CHECK-NEXT: 0x30264 R_ARM_RELATIVE - 0x0
+// CHECK-NEXT: 0x30268 R_ARM_RELATIVE - 0x0
+// CHECK-NEXT: 0x3026C R_ARM_RELATIVE - 0x0
// CHECK-NEXT: }
// RUN: llvm-readobj -S --dynamic-table %t.exe | FileCheck --check-prefix=HEADER %s
diff --git a/lld/test/ELF/pack-dyn-relocs-relr-loop.s b/lld/test/ELF/pack-dyn-relocs-relr-loop.s
index 3fd524a65dc2..883b8a3339a6 100644
--- a/lld/test/ELF/pack-dyn-relocs-relr-loop.s
+++ b/lld/test/ELF/pack-dyn-relocs-relr-loop.s
@@ -12,14 +12,14 @@
# CHECK: .relr.dyn needs 1 padding word(s)
# RELR: .relr.dyn {
-# RELR-NEXT: 0x2F40 R_AARCH64_RELATIVE - 0x0
-# RELR-NEXT: 0x2F48 R_AARCH64_RELATIVE - 0x0
+# RELR-NEXT: 0x2F30 R_AARCH64_RELATIVE - 0x0
+# RELR-NEXT: 0x2F38 R_AARCH64_RELATIVE - 0x0
# RELR-NEXT: 0x3000 R_AARCH64_RELATIVE - 0x0
# RELR-NEXT: }
.section .data.rel.ro
.align 3
-.space 0xce0
+.space 0xcd0
foo:
## Encoded by the first word of .relr.dyn
.quad foo
diff --git a/lld/test/ELF/pack-dyn-relocs.s b/lld/test/ELF/pack-dyn-relocs.s
index 6c78a91c9d61..5b4d91070f5e 100644
--- a/lld/test/ELF/pack-dyn-relocs.s
+++ b/lld/test/ELF/pack-dyn-relocs.s
@@ -8,25 +8,23 @@
/// Unpacked should have the relative relocations in their natural order.
/// UNPACKED32: Section ({{.+}}) .rel.dyn {
-// UNPACKED32-NEXT: 0x3031C R_ARM_RELATIVE - 0x0
-// UNPACKED32-NEXT: 0x30320 R_ARM_RELATIVE - 0x0
// UNPACKED32-NEXT: 0x30324 R_ARM_RELATIVE - 0x0
// UNPACKED32-NEXT: 0x30328 R_ARM_RELATIVE - 0x0
// UNPACKED32-NEXT: 0x3032C R_ARM_RELATIVE - 0x0
// UNPACKED32-NEXT: 0x30330 R_ARM_RELATIVE - 0x0
// UNPACKED32-NEXT: 0x30334 R_ARM_RELATIVE - 0x0
// UNPACKED32-NEXT: 0x30338 R_ARM_RELATIVE - 0x0
-
+// UNPACKED32-NEXT: 0x3033C R_ARM_RELATIVE - 0x0
// UNPACKED32-NEXT: 0x30340 R_ARM_RELATIVE - 0x0
-// UNPACKED32-NEXT: 0x30344 R_ARM_RELATIVE - 0x0
+
// UNPACKED32-NEXT: 0x30348 R_ARM_RELATIVE - 0x0
// UNPACKED32-NEXT: 0x3034C R_ARM_RELATIVE - 0x0
// UNPACKED32-NEXT: 0x30350 R_ARM_RELATIVE - 0x0
// UNPACKED32-NEXT: 0x30354 R_ARM_RELATIVE - 0x0
// UNPACKED32-NEXT: 0x30358 R_ARM_RELATIVE - 0x0
+// UNPACKED32-NEXT: 0x3035C R_ARM_RELATIVE - 0x0
+// UNPACKED32-NEXT: 0x30360 R_ARM_RELATIVE - 0x0
-// UNPACKED32-NEXT: 0x30364 R_ARM_RELATIVE - 0x0
-// UNPACKED32-NEXT: 0x30368 R_ARM_RELATIVE - 0x0
// UNPACKED32-NEXT: 0x3036C R_ARM_RELATIVE - 0x0
// UNPACKED32-NEXT: 0x30370 R_ARM_RELATIVE - 0x0
// UNPACKED32-NEXT: 0x30374 R_ARM_RELATIVE - 0x0
@@ -34,16 +32,18 @@
// UNPACKED32-NEXT: 0x3037C R_ARM_RELATIVE - 0x0
// UNPACKED32-NEXT: 0x30380 R_ARM_RELATIVE - 0x0
// UNPACKED32-NEXT: 0x30384 R_ARM_RELATIVE - 0x0
-// UNPACKED32-NEXT: 0x30389 R_ARM_RELATIVE - 0x0
+// UNPACKED32-NEXT: 0x30388 R_ARM_RELATIVE - 0x0
+// UNPACKED32-NEXT: 0x3038C R_ARM_RELATIVE - 0x0
+// UNPACKED32-NEXT: 0x30391 R_ARM_RELATIVE - 0x0
-// UNPACKED32-NEXT: 0x3033C R_ARM_ABS32 bar2 0x0
-// UNPACKED32-NEXT: 0x30360 R_ARM_ABS32 bar2 0x0
-// UNPACKED32-NEXT: 0x3038D R_ARM_ABS32 bar2 0x0
-// UNPACKED32-NEXT: 0x30391 R_ARM_ABS32 bar2 0x0
+// UNPACKED32-NEXT: 0x30344 R_ARM_ABS32 bar2 0x0
+// UNPACKED32-NEXT: 0x30368 R_ARM_ABS32 bar2 0x0
// UNPACKED32-NEXT: 0x30395 R_ARM_ABS32 bar2 0x0
// UNPACKED32-NEXT: 0x30399 R_ARM_ABS32 bar2 0x0
// UNPACKED32-NEXT: 0x3039D R_ARM_ABS32 bar2 0x0
-// UNPACKED32-NEXT: 0x3035C R_ARM_ABS32 zed2 0x0
+// UNPACKED32-NEXT: 0x303A1 R_ARM_ABS32 bar2 0x0
+// UNPACKED32-NEXT: 0x303A5 R_ARM_ABS32 bar2 0x0
+// UNPACKED32-NEXT: 0x30364 R_ARM_ABS32 zed2 0x0
// UNPACKED32-NEXT: }
// RUN: ld.lld -pie --pack-dyn-relocs=android %t.a32.o %t.a32.so -o %t3.a32
@@ -73,42 +73,42 @@
/// by the larger groups of relative relocations (i.e. the 8 and 9 followed
/// by the 7.)
// ANDROID32: Section ({{.+}}) .rel.dyn {
-// ANDROID32-NEXT: 0x3024C R_ARM_RELATIVE - 0
-// ANDROID32-NEXT: 0x30250 R_ARM_RELATIVE - 0
-// ANDROID32-NEXT: 0x30254 R_ARM_RELATIVE - 0
-// ANDROID32-NEXT: 0x30258 R_ARM_RELATIVE - 0
-// ANDROID32-NEXT: 0x3025C R_ARM_RELATIVE - 0
-// ANDROID32-NEXT: 0x30260 R_ARM_RELATIVE - 0
-// ANDROID32-NEXT: 0x30264 R_ARM_RELATIVE - 0
-// ANDROID32-NEXT: 0x30268 R_ARM_RELATIVE - 0
-
-// ANDROID32-NEXT: 0x30294 R_ARM_RELATIVE - 0
-// ANDROID32-NEXT: 0x30298 R_ARM_RELATIVE - 0
-// ANDROID32-NEXT: 0x3029C R_ARM_RELATIVE - 0
-// ANDROID32-NEXT: 0x302A0 R_ARM_RELATIVE - 0
-// ANDROID32-NEXT: 0x302A4 R_ARM_RELATIVE - 0
-// ANDROID32-NEXT: 0x302A8 R_ARM_RELATIVE - 0
-// ANDROID32-NEXT: 0x302AC R_ARM_RELATIVE - 0
-// ANDROID32-NEXT: 0x302B0 R_ARM_RELATIVE - 0
-// ANDROID32-NEXT: 0x302B4 R_ARM_RELATIVE - 0
-// ANDROID32-NEXT: 0x30270 R_ARM_RELATIVE - 0
-// ANDROID32-NEXT: 0x30274 R_ARM_RELATIVE - 0
-// ANDROID32-NEXT: 0x30278 R_ARM_RELATIVE - 0
-// ANDROID32-NEXT: 0x3027C R_ARM_RELATIVE - 0
-// ANDROID32-NEXT: 0x30280 R_ARM_RELATIVE - 0
-// ANDROID32-NEXT: 0x30284 R_ARM_RELATIVE - 0
-// ANDROID32-NEXT: 0x30288 R_ARM_RELATIVE - 0
-// ANDROID32-NEXT: 0x302B9 R_ARM_RELATIVE - 0
-
-// ANDROID32-NEXT: 0x3026C R_ARM_ABS32 bar2 0
-// ANDROID32-NEXT: 0x30290 R_ARM_ABS32 bar2 0
-// ANDROID32-NEXT: 0x302BD R_ARM_ABS32 bar2 0
-// ANDROID32-NEXT: 0x302C1 R_ARM_ABS32 bar2 0
-// ANDROID32-NEXT: 0x302C5 R_ARM_ABS32 bar2 0
-// ANDROID32-NEXT: 0x302C9 R_ARM_ABS32 bar2 0
-// ANDROID32-NEXT: 0x302CD R_ARM_ABS32 bar2 0
-
-// ANDROID32-NEXT: 0x3028C R_ARM_ABS32 zed2 0
+// ANDROID32-NEXT: 0x30254 R_ARM_RELATIVE - 0x0
+// ANDROID32-NEXT: 0x30258 R_ARM_RELATIVE - 0x0
+// ANDROID32-NEXT: 0x3025C R_ARM_RELATIVE - 0x0
+// ANDROID32-NEXT: 0x30260 R_ARM_RELATIVE - 0x0
+// ANDROID32-NEXT: 0x30264 R_ARM_RELATIVE - 0x0
+// ANDROID32-NEXT: 0x30268 R_ARM_RELATIVE - 0x0
+// ANDROID32-NEXT: 0x3026C R_ARM_RELATIVE - 0x0
+// ANDROID32-NEXT: 0x30270 R_ARM_RELATIVE - 0x0
+
+// ANDROID32-NEXT: 0x3029C R_ARM_RELATIVE - 0x0
+// ANDROID32-NEXT: 0x302A0 R_ARM_RELATIVE - 0x0
+// ANDROID32-NEXT: 0x302A4 R_ARM_RELATIVE - 0x0
+// ANDROID32-NEXT: 0x302A8 R_ARM_RELATIVE - 0x0
+// ANDROID32-NEXT: 0x302AC R_ARM_RELATIVE - 0x0
+// ANDROID32-NEXT: 0x302B0 R_ARM_RELATIVE - 0x0
+// ANDROID32-NEXT: 0x302B4 R_ARM_RELATIVE - 0x0
+// ANDROID32-NEXT: 0x302B8 R_ARM_RELATIVE - 0x0
+// ANDROID32-NEXT: 0x302BC R_ARM_RELATIVE - 0x0
+// ANDROID32-NEXT: 0x30278 R_ARM_RELATIVE - 0x0
+// ANDROID32-NEXT: 0x3027C R_ARM_RELATIVE - 0x0
+// ANDROID32-NEXT: 0x30280 R_ARM_RELATIVE - 0x0
+// ANDROID32-NEXT: 0x30284 R_ARM_RELATIVE - 0x0
+// ANDROID32-NEXT: 0x30288 R_ARM_RELATIVE - 0x0
+// ANDROID32-NEXT: 0x3028C R_ARM_RELATIVE - 0x0
+// ANDROID32-NEXT: 0x30290 R_ARM_RELATIVE - 0x0
+// ANDROID32-NEXT: 0x302C1 R_ARM_RELATIVE - 0x0
+
+// ANDROID32-NEXT: 0x30274 R_ARM_ABS32 bar2 0x0
+// ANDROID32-NEXT: 0x30298 R_ARM_ABS32 bar2 0x0
+// ANDROID32-NEXT: 0x302C5 R_ARM_ABS32 bar2 0x0
+// ANDROID32-NEXT: 0x302C9 R_ARM_ABS32 bar2 0x0
+// ANDROID32-NEXT: 0x302CD R_ARM_ABS32 bar2 0x0
+// ANDROID32-NEXT: 0x302D1 R_ARM_ABS32 bar2 0x0
+// ANDROID32-NEXT: 0x302D5 R_ARM_ABS32 bar2 0x0
+
+// ANDROID32-NEXT: 0x30294 R_ARM_ABS32 zed2 0x0
// ANDROID32-NEXT: }
// RUN: ld.lld -pie --pack-dyn-relocs=relr %t.a32.o %t.a32.so -o %t4.a32
@@ -139,7 +139,7 @@
/// SHT_RELR section contains address/bitmap entries
/// encoding the offsets for relative relocation.
// RAW-RELR32: Section ({{.+}}) .relr.dyn {
-// RAW-RELR32-NEXT: 0x3027C
+// RAW-RELR32-NEXT: 0x30284
// RAW-RELR32-NEXT: 0x7FCFEFF
// RAW-RELR32-NEXT: }
@@ -147,36 +147,34 @@
/// but contains only the relative relocations.
/// Any relative relocations with odd offset stay in SHT_REL.
// RELR32: Section ({{.+}}) .rel.dyn {
-// RELR32-NEXT: 0x302E9 R_ARM_RELATIVE - 0x0
-// RELR32-NEXT: 0x3029C R_ARM_ABS32 bar2 0x0
-// RELR32-NEXT: 0x302C0 R_ARM_ABS32 bar2 0x0
-// RELR32-NEXT: 0x302ED R_ARM_ABS32 bar2 0x0
-// RELR32-NEXT: 0x302F1 R_ARM_ABS32 bar2 0x0
+// RELR32-NEXT: 0x302F1 R_ARM_RELATIVE - 0x0
+// RELR32-NEXT: 0x302A4 R_ARM_ABS32 bar2 0x0
+// RELR32-NEXT: 0x302C8 R_ARM_ABS32 bar2 0x0
// RELR32-NEXT: 0x302F5 R_ARM_ABS32 bar2 0x0
// RELR32-NEXT: 0x302F9 R_ARM_ABS32 bar2 0x0
// RELR32-NEXT: 0x302FD R_ARM_ABS32 bar2 0x0
-// RELR32-NEXT: 0x302BC R_ARM_ABS32 zed2 0x0
+// RELR32-NEXT: 0x30301 R_ARM_ABS32 bar2 0x0
+// RELR32-NEXT: 0x30305 R_ARM_ABS32 bar2 0x0
+// RELR32-NEXT: 0x302C4 R_ARM_ABS32 zed2 0x0
// RELR32-NEXT: }
// RELR32-NEXT: Section ({{.+}}) .relr.dyn {
-// RELR32-NEXT: 0x3027C R_ARM_RELATIVE - 0x0
-// RELR32-NEXT: 0x30280 R_ARM_RELATIVE - 0x0
// RELR32-NEXT: 0x30284 R_ARM_RELATIVE - 0x0
// RELR32-NEXT: 0x30288 R_ARM_RELATIVE - 0x0
// RELR32-NEXT: 0x3028C R_ARM_RELATIVE - 0x0
// RELR32-NEXT: 0x30290 R_ARM_RELATIVE - 0x0
// RELR32-NEXT: 0x30294 R_ARM_RELATIVE - 0x0
// RELR32-NEXT: 0x30298 R_ARM_RELATIVE - 0x0
-
+// RELR32-NEXT: 0x3029C R_ARM_RELATIVE - 0x0
// RELR32-NEXT: 0x302A0 R_ARM_RELATIVE - 0x0
-// RELR32-NEXT: 0x302A4 R_ARM_RELATIVE - 0x0
+
// RELR32-NEXT: 0x302A8 R_ARM_RELATIVE - 0x0
// RELR32-NEXT: 0x302AC R_ARM_RELATIVE - 0x0
// RELR32-NEXT: 0x302B0 R_ARM_RELATIVE - 0x0
// RELR32-NEXT: 0x302B4 R_ARM_RELATIVE - 0x0
// RELR32-NEXT: 0x302B8 R_ARM_RELATIVE - 0x0
+// RELR32-NEXT: 0x302BC R_ARM_RELATIVE - 0x0
+// RELR32-NEXT: 0x302C0 R_ARM_RELATIVE - 0x0
-// RELR32-NEXT: 0x302C4 R_ARM_RELATIVE - 0x0
-// RELR32-NEXT: 0x302C8 R_ARM_RELATIVE - 0x0
// RELR32-NEXT: 0x302CC R_ARM_RELATIVE - 0x0
// RELR32-NEXT: 0x302D0 R_ARM_RELATIVE - 0x0
// RELR32-NEXT: 0x302D4 R_ARM_RELATIVE - 0x0
@@ -184,6 +182,8 @@
// RELR32-NEXT: 0x302DC R_ARM_RELATIVE - 0x0
// RELR32-NEXT: 0x302E0 R_ARM_RELATIVE - 0x0
// RELR32-NEXT: 0x302E4 R_ARM_RELATIVE - 0x0
+// RELR32-NEXT: 0x302E8 R_ARM_RELATIVE - 0x0
+// RELR32-NEXT: 0x302EC R_ARM_RELATIVE - 0x0
// RELR32-NEXT: }
// RUN: llvm-mc -filetype=obj -triple=aarch64-unknown-linux %p/Inputs/shared2.s -o %t.a64.so.o
@@ -193,42 +193,42 @@
// RUN: llvm-readobj -r %t2.a64 | FileCheck --check-prefix=UNPACKED64 %s
// UNPACKED64: Section ({{.+}}) .rela.dyn {
-// UNPACKED64-NEXT: 0x30680 R_AARCH64_RELATIVE - 0x1
-// UNPACKED64-NEXT: 0x30688 R_AARCH64_RELATIVE - 0x2
-// UNPACKED64-NEXT: 0x30690 R_AARCH64_RELATIVE - 0x3
-// UNPACKED64-NEXT: 0x30698 R_AARCH64_RELATIVE - 0x4
-// UNPACKED64-NEXT: 0x306A0 R_AARCH64_RELATIVE - 0x5
-// UNPACKED64-NEXT: 0x306A8 R_AARCH64_RELATIVE - 0x6
-// UNPACKED64-NEXT: 0x306B0 R_AARCH64_RELATIVE - 0x7
-// UNPACKED64-NEXT: 0x306B8 R_AARCH64_RELATIVE - 0x8
-
-// UNPACKED64-NEXT: 0x306C8 R_AARCH64_RELATIVE - 0x1
-// UNPACKED64-NEXT: 0x306D0 R_AARCH64_RELATIVE - 0x2
-// UNPACKED64-NEXT: 0x306D8 R_AARCH64_RELATIVE - 0x3
-// UNPACKED64-NEXT: 0x306E0 R_AARCH64_RELATIVE - 0x4
-// UNPACKED64-NEXT: 0x306E8 R_AARCH64_RELATIVE - 0x5
-// UNPACKED64-NEXT: 0x306F0 R_AARCH64_RELATIVE - 0x6
-// UNPACKED64-NEXT: 0x306F8 R_AARCH64_RELATIVE - 0x7
-
-// UNPACKED64-NEXT: 0x30710 R_AARCH64_RELATIVE - 0x1
-// UNPACKED64-NEXT: 0x30718 R_AARCH64_RELATIVE - 0x2
-// UNPACKED64-NEXT: 0x30720 R_AARCH64_RELATIVE - 0x3
-// UNPACKED64-NEXT: 0x30728 R_AARCH64_RELATIVE - 0x4
-// UNPACKED64-NEXT: 0x30730 R_AARCH64_RELATIVE - 0x5
-// UNPACKED64-NEXT: 0x30738 R_AARCH64_RELATIVE - 0x6
-// UNPACKED64-NEXT: 0x30740 R_AARCH64_RELATIVE - 0x7
-// UNPACKED64-NEXT: 0x30748 R_AARCH64_RELATIVE - 0x8
-// UNPACKED64-NEXT: 0x30750 R_AARCH64_RELATIVE - 0x9
-
-// UNPACKED64-NEXT: 0x30759 R_AARCH64_RELATIVE - 0xA
-// UNPACKED64-NEXT: 0x306C0 R_AARCH64_ABS64 bar2 0x1
-// UNPACKED64-NEXT: 0x30708 R_AARCH64_ABS64 bar2 0x0
-// UNPACKED64-NEXT: 0x30761 R_AARCH64_ABS64 bar2 0x0
-// UNPACKED64-NEXT: 0x30769 R_AARCH64_ABS64 bar2 0x0
-// UNPACKED64-NEXT: 0x30771 R_AARCH64_ABS64 bar2 0x1
-// UNPACKED64-NEXT: 0x30779 R_AARCH64_ABS64 bar2 0x1
-// UNPACKED64-NEXT: 0x30781 R_AARCH64_ABS64 bar2 0x0
-// UNPACKED64-NEXT: 0x30700 R_AARCH64_ABS64 zed2 0x0
+// UNPACKED64-NEXT: 0x30690 R_AARCH64_RELATIVE - 0x1
+// UNPACKED64-NEXT: 0x30698 R_AARCH64_RELATIVE - 0x2
+// UNPACKED64-NEXT: 0x306A0 R_AARCH64_RELATIVE - 0x3
+// UNPACKED64-NEXT: 0x306A8 R_AARCH64_RELATIVE - 0x4
+// UNPACKED64-NEXT: 0x306B0 R_AARCH64_RELATIVE - 0x5
+// UNPACKED64-NEXT: 0x306B8 R_AARCH64_RELATIVE - 0x6
+// UNPACKED64-NEXT: 0x306C0 R_AARCH64_RELATIVE - 0x7
+// UNPACKED64-NEXT: 0x306C8 R_AARCH64_RELATIVE - 0x8
+
+// UNPACKED64-NEXT: 0x306D8 R_AARCH64_RELATIVE - 0x1
+// UNPACKED64-NEXT: 0x306E0 R_AARCH64_RELATIVE - 0x2
+// UNPACKED64-NEXT: 0x306E8 R_AARCH64_RELATIVE - 0x3
+// UNPACKED64-NEXT: 0x306F0 R_AARCH64_RELATIVE - 0x4
+// UNPACKED64-NEXT: 0x306F8 R_AARCH64_RELATIVE - 0x5
+// UNPACKED64-NEXT: 0x30700 R_AARCH64_RELATIVE - 0x6
+// UNPACKED64-NEXT: 0x30708 R_AARCH64_RELATIVE - 0x7
+
+// UNPACKED64-NEXT: 0x30720 R_AARCH64_RELATIVE - 0x1
+// UNPACKED64-NEXT: 0x30728 R_AARCH64_RELATIVE - 0x2
+// UNPACKED64-NEXT: 0x30730 R_AARCH64_RELATIVE - 0x3
+// UNPACKED64-NEXT: 0x30738 R_AARCH64_RELATIVE - 0x4
+// UNPACKED64-NEXT: 0x30740 R_AARCH64_RELATIVE - 0x5
+// UNPACKED64-NEXT: 0x30748 R_AARCH64_RELATIVE - 0x6
+// UNPACKED64-NEXT: 0x30750 R_AARCH64_RELATIVE - 0x7
+// UNPACKED64-NEXT: 0x30758 R_AARCH64_RELATIVE - 0x8
+// UNPACKED64-NEXT: 0x30760 R_AARCH64_RELATIVE - 0x9
+
+// UNPACKED64-NEXT: 0x30769 R_AARCH64_RELATIVE - 0xA
+// UNPACKED64-NEXT: 0x306D0 R_AARCH64_ABS64 bar2 0x1
+// UNPACKED64-NEXT: 0x30718 R_AARCH64_ABS64 bar2 0x0
+// UNPACKED64-NEXT: 0x30771 R_AARCH64_ABS64 bar2 0x0
+// UNPACKED64-NEXT: 0x30779 R_AARCH64_ABS64 bar2 0x0
+// UNPACKED64-NEXT: 0x30781 R_AARCH64_ABS64 bar2 0x1
+// UNPACKED64-NEXT: 0x30789 R_AARCH64_ABS64 bar2 0x1
+// UNPACKED64-NEXT: 0x30791 R_AARCH64_ABS64 bar2 0x0
+// UNPACKED64-NEXT: 0x30710 R_AARCH64_ABS64 zed2 0x0
// UNPACKED64-NEXT: }
// RUN: ld.lld -pie --pack-dyn-relocs=android %t.a64.o %t.a64.so -o %t3.a64
@@ -255,42 +255,42 @@
// ANDROID64-HEADERS: 0x0000000060000012 ANDROID_RELASZ [[SIZE]]
// ANDROID64: Section ({{.+}}) .rela.dyn {
-// ANDROID64-NEXT: 0x303E0 R_AARCH64_RELATIVE - 0x1
-// ANDROID64-NEXT: 0x303E8 R_AARCH64_RELATIVE - 0x2
-// ANDROID64-NEXT: 0x303F0 R_AARCH64_RELATIVE - 0x3
-// ANDROID64-NEXT: 0x303F8 R_AARCH64_RELATIVE - 0x4
-// ANDROID64-NEXT: 0x30400 R_AARCH64_RELATIVE - 0x5
-// ANDROID64-NEXT: 0x30408 R_AARCH64_RELATIVE - 0x6
-// ANDROID64-NEXT: 0x30410 R_AARCH64_RELATIVE - 0x7
-// ANDROID64-NEXT: 0x30418 R_AARCH64_RELATIVE - 0x8
-
-// ANDROID64-NEXT: 0x30470 R_AARCH64_RELATIVE - 0x1
-// ANDROID64-NEXT: 0x30478 R_AARCH64_RELATIVE - 0x2
-// ANDROID64-NEXT: 0x30480 R_AARCH64_RELATIVE - 0x3
-// ANDROID64-NEXT: 0x30488 R_AARCH64_RELATIVE - 0x4
-// ANDROID64-NEXT: 0x30490 R_AARCH64_RELATIVE - 0x5
-// ANDROID64-NEXT: 0x30498 R_AARCH64_RELATIVE - 0x6
-// ANDROID64-NEXT: 0x304A0 R_AARCH64_RELATIVE - 0x7
-// ANDROID64-NEXT: 0x304A8 R_AARCH64_RELATIVE - 0x8
-// ANDROID64-NEXT: 0x304B0 R_AARCH64_RELATIVE - 0x9
-
-// ANDROID64-NEXT: 0x30428 R_AARCH64_RELATIVE - 0x1
-// ANDROID64-NEXT: 0x30430 R_AARCH64_RELATIVE - 0x2
-// ANDROID64-NEXT: 0x30438 R_AARCH64_RELATIVE - 0x3
-// ANDROID64-NEXT: 0x30440 R_AARCH64_RELATIVE - 0x4
-// ANDROID64-NEXT: 0x30448 R_AARCH64_RELATIVE - 0x5
-// ANDROID64-NEXT: 0x30450 R_AARCH64_RELATIVE - 0x6
-// ANDROID64-NEXT: 0x30458 R_AARCH64_RELATIVE - 0x7
-// ANDROID64-NEXT: 0x304B9 R_AARCH64_RELATIVE - 0xA
-
-// ANDROID64-NEXT: 0x30468 R_AARCH64_ABS64 bar2 0x0
-// ANDROID64-NEXT: 0x304C1 R_AARCH64_ABS64 bar2 0x0
-// ANDROID64-NEXT: 0x304C9 R_AARCH64_ABS64 bar2 0x0
-// ANDROID64-NEXT: 0x304E1 R_AARCH64_ABS64 bar2 0x0
-// ANDROID64-NEXT: 0x30420 R_AARCH64_ABS64 bar2 0x1
-// ANDROID64-NEXT: 0x30460 R_AARCH64_ABS64 zed2 0x0
-// ANDROID64-NEXT: 0x304D1 R_AARCH64_ABS64 bar2 0x1
-// ANDROID64-NEXT: 0x304D9 R_AARCH64_ABS64 bar2 0x1
+// ANDROID64-NEXT: 0x303F0 R_AARCH64_RELATIVE - 0x1
+// ANDROID64-NEXT: 0x303F8 R_AARCH64_RELATIVE - 0x2
+// ANDROID64-NEXT: 0x30400 R_AARCH64_RELATIVE - 0x3
+// ANDROID64-NEXT: 0x30408 R_AARCH64_RELATIVE - 0x4
+// ANDROID64-NEXT: 0x30410 R_AARCH64_RELATIVE - 0x5
+// ANDROID64-NEXT: 0x30418 R_AARCH64_RELATIVE - 0x6
+// ANDROID64-NEXT: 0x30420 R_AARCH64_RELATIVE - 0x7
+// ANDROID64-NEXT: 0x30428 R_AARCH64_RELATIVE - 0x8
+
+// ANDROID64-NEXT: 0x30480 R_AARCH64_RELATIVE - 0x1
+// ANDROID64-NEXT: 0x30488 R_AARCH64_RELATIVE - 0x2
+// ANDROID64-NEXT: 0x30490 R_AARCH64_RELATIVE - 0x3
+// ANDROID64-NEXT: 0x30498 R_AARCH64_RELATIVE - 0x4
+// ANDROID64-NEXT: 0x304A0 R_AARCH64_RELATIVE - 0x5
+// ANDROID64-NEXT: 0x304A8 R_AARCH64_RELATIVE - 0x6
+// ANDROID64-NEXT: 0x304B0 R_AARCH64_RELATIVE - 0x7
+// ANDROID64-NEXT: 0x304B8 R_AARCH64_RELATIVE - 0x8
+// ANDROID64-NEXT: 0x304C0 R_AARCH64_RELATIVE - 0x9
+
+// ANDROID64-NEXT: 0x30438 R_AARCH64_RELATIVE - 0x1
+// ANDROID64-NEXT: 0x30440 R_AARCH64_RELATIVE - 0x2
+// ANDROID64-NEXT: 0x30448 R_AARCH64_RELATIVE - 0x3
+// ANDROID64-NEXT: 0x30450 R_AARCH64_RELATIVE - 0x4
+// ANDROID64-NEXT: 0x30458 R_AARCH64_RELATIVE - 0x5
+// ANDROID64-NEXT: 0x30460 R_AARCH64_RELATIVE - 0x6
+// ANDROID64-NEXT: 0x30468 R_AARCH64_RELATIVE - 0x7
+// ANDROID64-NEXT: 0x304C9 R_AARCH64_RELATIVE - 0xA
+
+// ANDROID64-NEXT: 0x30478 R_AARCH64_ABS64 bar2 0x0
+// ANDROID64-NEXT: 0x304D1 R_AARCH64_ABS64 bar2 0x0
+// ANDROID64-NEXT: 0x304D9 R_AARCH64_ABS64 bar2 0x0
+// ANDROID64-NEXT: 0x304F1 R_AARCH64_ABS64 bar2 0x0
+// ANDROID64-NEXT: 0x30430 R_AARCH64_ABS64 bar2 0x1
+// ANDROID64-NEXT: 0x30470 R_AARCH64_ABS64 zed2 0x0
+// ANDROID64-NEXT: 0x304E1 R_AARCH64_ABS64 bar2 0x1
+// ANDROID64-NEXT: 0x304E9 R_AARCH64_ABS64 bar2 0x1
// ANDROID64-NEXT: }
// RUN: ld.lld -pie --pack-dyn-relocs=relr %t.a64.o %t.a64.so -o %t4.a64
@@ -321,7 +321,7 @@
/// SHT_RELR section contains address/bitmap entries
/// encoding the offsets for relative relocation.
// RAW-RELR64: Section ({{.+}}) .relr.dyn {
-// RAW-RELR64-NEXT: 0x30480
+// RAW-RELR64-NEXT: 0x30490
// RAW-RELR64-NEXT: 0x7FCFEFF
// RAW-RELR64-NEXT: }
@@ -329,34 +329,32 @@
/// but contains only the relative relocations.
/// Any relative relocations with odd offset stay in SHT_RELA.
// RELR64: Section ({{.+}}) .rela.dyn {
-// RELR64-NEXT: 0x30559 R_AARCH64_RELATIVE - 0xA
-// RELR64-NEXT: 0x304C0 R_AARCH64_ABS64 bar2 0x1
-// RELR64-NEXT: 0x30508 R_AARCH64_ABS64 bar2 0x0
-// RELR64-NEXT: 0x30561 R_AARCH64_ABS64 bar2 0x0
-// RELR64-NEXT: 0x30569 R_AARCH64_ABS64 bar2 0x0
-// RELR64-NEXT: 0x30571 R_AARCH64_ABS64 bar2 0x1
-// RELR64-NEXT: 0x30579 R_AARCH64_ABS64 bar2 0x1
-// RELR64-NEXT: 0x30581 R_AARCH64_ABS64 bar2 0x0
-// RELR64-NEXT: 0x30500 R_AARCH64_ABS64 zed2 0x0
+// RELR64-NEXT: 0x30569 R_AARCH64_RELATIVE - 0xA
+// RELR64-NEXT: 0x304D0 R_AARCH64_ABS64 bar2 0x1
+// RELR64-NEXT: 0x30518 R_AARCH64_ABS64 bar2 0x0
+// RELR64-NEXT: 0x30571 R_AARCH64_ABS64 bar2 0x0
+// RELR64-NEXT: 0x30579 R_AARCH64_ABS64 bar2 0x0
+// RELR64-NEXT: 0x30581 R_AARCH64_ABS64 bar2 0x1
+// RELR64-NEXT: 0x30589 R_AARCH64_ABS64 bar2 0x1
+// RELR64-NEXT: 0x30591 R_AARCH64_ABS64 bar2 0x0
+// RELR64-NEXT: 0x30510 R_AARCH64_ABS64 zed2 0x0
// RELR64-NEXT: }
// RELR64-NEXT: Section ({{.+}}) .relr.dyn {
-// RELR64-NEXT: 0x30480 R_AARCH64_RELATIVE - 0x0
-// RELR64-NEXT: 0x30488 R_AARCH64_RELATIVE - 0x0
// RELR64-NEXT: 0x30490 R_AARCH64_RELATIVE - 0x0
// RELR64-NEXT: 0x30498 R_AARCH64_RELATIVE - 0x0
// RELR64-NEXT: 0x304A0 R_AARCH64_RELATIVE - 0x0
// RELR64-NEXT: 0x304A8 R_AARCH64_RELATIVE - 0x0
// RELR64-NEXT: 0x304B0 R_AARCH64_RELATIVE - 0x0
// RELR64-NEXT: 0x304B8 R_AARCH64_RELATIVE - 0x0
+// RELR64-NEXT: 0x304C0 R_AARCH64_RELATIVE - 0x0
// RELR64-NEXT: 0x304C8 R_AARCH64_RELATIVE - 0x0
-// RELR64-NEXT: 0x304D0 R_AARCH64_RELATIVE - 0x0
// RELR64-NEXT: 0x304D8 R_AARCH64_RELATIVE - 0x0
// RELR64-NEXT: 0x304E0 R_AARCH64_RELATIVE - 0x0
// RELR64-NEXT: 0x304E8 R_AARCH64_RELATIVE - 0x0
// RELR64-NEXT: 0x304F0 R_AARCH64_RELATIVE - 0x0
// RELR64-NEXT: 0x304F8 R_AARCH64_RELATIVE - 0x0
-// RELR64-NEXT: 0x30510 R_AARCH64_RELATIVE - 0x0
-// RELR64-NEXT: 0x30518 R_AARCH64_RELATIVE - 0x0
+// RELR64-NEXT: 0x30500 R_AARCH64_RELATIVE - 0x0
+// RELR64-NEXT: 0x30508 R_AARCH64_RELATIVE - 0x0
// RELR64-NEXT: 0x30520 R_AARCH64_RELATIVE - 0x0
// RELR64-NEXT: 0x30528 R_AARCH64_RELATIVE - 0x0
// RELR64-NEXT: 0x30530 R_AARCH64_RELATIVE - 0x0
@@ -364,6 +362,8 @@
// RELR64-NEXT: 0x30540 R_AARCH64_RELATIVE - 0x0
// RELR64-NEXT: 0x30548 R_AARCH64_RELATIVE - 0x0
// RELR64-NEXT: 0x30550 R_AARCH64_RELATIVE - 0x0
+// RELR64-NEXT: 0x30558 R_AARCH64_RELATIVE - 0x0
+// RELR64-NEXT: 0x30560 R_AARCH64_RELATIVE - 0x0
// RELR64-NEXT: }
.data
diff --git a/lld/test/ELF/pie.s b/lld/test/ELF/pie.s
index 5626cca8617a..4545b5d78048 100644
--- a/lld/test/ELF/pie.s
+++ b/lld/test/ELF/pie.s
@@ -8,11 +8,11 @@
## Check -pie.
# RUN: ld.lld -pie %t1.o -o %t
-# RUN: llvm-readobj --file-headers --sections -l --symbols -r %t | FileCheck %s
+# RUN: llvm-readobj --file-headers --sections -l -d --symbols -r %t | FileCheck %s
## Test --pic-executable alias
# RUN: ld.lld --pic-executable %t1.o -o %t
-# RUN: llvm-readobj --file-headers --sections -l --symbols -r %t | FileCheck %s
+# RUN: llvm-readobj --file-headers --sections -l -d --symbols -r %t | FileCheck %s
# CHECK: ElfHeader {
# CHECK-NEXT: Ident {
@@ -47,6 +47,9 @@
# CHECK: Type: PT_DYNAMIC
+# CHECK: DynamicSection [
+# CHECK: 0x000000006FFFFFFB FLAGS_1 PIE
+
## Check -nopie
# RUN: ld.lld -no-pie %t1.o -o %t2
# RUN: llvm-readobj --file-headers -r %t2 | FileCheck %s --check-prefix=NOPIE
diff --git a/lld/test/ELF/ppc32-call-stub-pic.s b/lld/test/ELF/ppc32-call-stub-pic.s
index 7dae81f77c89..392be1fa2c9b 100644
--- a/lld/test/ELF/ppc32-call-stub-pic.s
+++ b/lld/test/ELF/ppc32-call-stub-pic.s
@@ -28,15 +28,15 @@
# RELOC-NEXT: R_PPC_JMP_SLOT h 0x0
# RELOC-NEXT: }
-# SEC: .got PROGBITS 00020368
-# DYN: PPC_GOT 0x20368
+# SEC: .got PROGBITS 00020370
+# DYN: PPC_GOT 0x20370
## .got2+0x8000-0x10004 = 0x30000+0x8000-0x10004 = 65536*2+32764
# CHECK-LABEL: <_start>:
# PIE-NEXT: bcl 20, 31, 0x10210
# PIE-NEXT: 10210: mflr 30
# PIE-NEXT: addis 30, 30, 3
-# PIE-NEXT: addi 30, 30, -32412
+# PIE-NEXT: addi 30, 30, -32404
## Two bl 00008000.got2.plt_pic32.f
# PIE-NEXT: bl 0x10244
# PIE-NEXT: bl 0x10244
@@ -104,7 +104,7 @@
# CHECK-NEXT: <00008000.got2.plt_pic32.f>:
## In Secure PLT ABI, .plt stores function pointers to first instructions of .glink
-# HEX: 0x0004036c 00010294 00010298 0001029c
+# HEX: 0x00040374 00010294 00010298 0001029c
## These instructions are referenced by .plt entries.
# CHECK: [[#%x,GLINK:]] <.glink>:
@@ -113,7 +113,7 @@
# CHECK-NEXT: b 0x[[#%x,GLINK+12]]
## PLTresolve
-## Operand of addi: 0x100a8-.glink = 24
+## Operand of addi: 0x102cc-.glink = 24
# CHECK-NEXT: addis 11, 11, 0
# CHECK-NEXT: mflr 0
# CHECK-NEXT: bcl 20, 31, 0x[[#%x,NEXT:]]
@@ -123,12 +123,12 @@
# CHECK-NEXT: mtlr 0
# CHECK-NEXT: sub 11, 11, 12
-## Operand of lwz in -pie mode: &.got[1] - 0x100a8 = 0x20088+4 - 0x100a8 = 65536*1-28
+## Operand of lwz in -pie mode: &.got[1] - 0x102bc = 0x20380+4 - 0x102bc = 65536*1+200
# CHECK-NEXT: addis 12, 12, 1
-# PIE-NEXT: lwz 0, 192(12)
+# PIE-NEXT: lwz 0, 200(12)
# SHARED-NEXT: lwz 0, 184(12)
-# PIE-NEXT: lwz 12, 196(12)
+# PIE-NEXT: lwz 12, 204(12)
# SHARED-NEXT: lwz 12, 188(12)
# CHECK-NEXT: mtctr 0
# CHECK-NEXT: add 0, 11, 11
diff --git a/lld/test/ELF/ppc32-ifunc-nonpreemptible-pic.s b/lld/test/ELF/ppc32-ifunc-nonpreemptible-pic.s
index 0bb715a191d8..a88927fdfd75 100644
--- a/lld/test/ELF/ppc32-ifunc-nonpreemptible-pic.s
+++ b/lld/test/ELF/ppc32-ifunc-nonpreemptible-pic.s
@@ -7,12 +7,12 @@
# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
# RELOC: .rela.dyn {
-# RELOC-NEXT: 0x30240 R_PPC_RELATIVE - 0x101A8
-# RELOC-NEXT: 0x30244 R_PPC_IRELATIVE - 0x10188
+# RELOC-NEXT: 0x30248 R_PPC_RELATIVE - 0x101A8
+# RELOC-NEXT: 0x3024C R_PPC_IRELATIVE - 0x10188
# RELOC-NEXT: }
# SYM: 000101a8 0 FUNC GLOBAL DEFAULT {{.*}} func
-# HEX: 0x00030240 00000000
+# HEX: 0x00030248 00000000
.section .got2,"aw"
.long func
diff --git a/lld/test/ELF/ppc64-long-branch-pi.s b/lld/test/ELF/ppc64-long-branch-pi.s
index dca63878c0e7..36f14f5cc319 100644
--- a/lld/test/ELF/ppc64-long-branch-pi.s
+++ b/lld/test/ELF/ppc64-long-branch-pi.s
@@ -14,19 +14,19 @@
# RUN: llvm-objdump -d --no-show-raw-insn %t.so | FileCheck %s
# SEC-PIE: Name Type Address Off Size ES Flg Lk Inf Al
-# SEC-PIE: .got PROGBITS 00000000020020e0 20120e0 000008 00 WA 0 0 8
-# SEC-PIE: .branch_lt NOBITS 00000000020020f0 20120f0 000020 00 WA 0 0 8
+# SEC-PIE: .got PROGBITS 00000000020020f0 20120f0 000008 00 WA 0 0 8
+# SEC-PIE: .branch_lt NOBITS 0000000002002100 2012100 000020 00 WA 0 0 8
# SEC-SHARED: Name Type Address Off Size ES Flg Lk Inf Al
# SEC-SHARED: .got PROGBITS 00000000020020d0 20120d0 000008 00 WA 0 0 8
# SEC-SHARED: .branch_lt NOBITS 00000000020020e0 20120e0 000020 00 WA 0 0 8
# RELOC: .rela.dyn {
-# RELOC-NEXT: 0x20020E8 R_PPC64_RELATIVE - 0x8000
-# RELOC-NEXT: 0x20020F0 R_PPC64_RELATIVE - 0x2002000
-# RELOC-NEXT: 0x20020F8 R_PPC64_RELATIVE - 0x2002008
-# RELOC-NEXT: 0x2002100 R_PPC64_RELATIVE - 0x200200C
-# RELOC-NEXT: 0x2002108 R_PPC64_RELATIVE - 0x2000
+# RELOC-NEXT: 0x20020F8 R_PPC64_RELATIVE - 0x8000
+# RELOC-NEXT: 0x2002100 R_PPC64_RELATIVE - 0x2002000
+# RELOC-NEXT: 0x2002108 R_PPC64_RELATIVE - 0x2002008
+# RELOC-NEXT: 0x2002110 R_PPC64_RELATIVE - 0x200200C
+# RELOC-NEXT: 0x2002118 R_PPC64_RELATIVE - 0x2000
# RELOC-NEXT: }
# CHECK: <_start>:
diff --git a/lld/test/ELF/relative-dynamic-reloc-pie.s b/lld/test/ELF/relative-dynamic-reloc-pie.s
index 22a1c01b35c5..8c6e4a8402f4 100644
--- a/lld/test/ELF/relative-dynamic-reloc-pie.s
+++ b/lld/test/ELF/relative-dynamic-reloc-pie.s
@@ -6,9 +6,9 @@
## Test that we create R_X86_64_RELATIVE relocations with -pie.
# CHECK: Relocations [
# CHECK-NEXT: Section ({{.*}}) .rela.dyn {
-# CHECK-NEXT: 0x3358 R_X86_64_RELATIVE - 0x3358
-# CHECK-NEXT: 0x3360 R_X86_64_RELATIVE - 0x3360
-# CHECK-NEXT: 0x3368 R_X86_64_RELATIVE - 0x3361
+# CHECK-NEXT: 0x3368 R_X86_64_RELATIVE - 0x3368
+# CHECK-NEXT: 0x3370 R_X86_64_RELATIVE - 0x3370
+# CHECK-NEXT: 0x3378 R_X86_64_RELATIVE - 0x3371
# CHECK-NEXT: }
# CHECK-NEXT: ]
diff --git a/lld/test/ELF/riscv-gp.s b/lld/test/ELF/riscv-gp.s
index 5f0819fcc856..e21cc0cc5bce 100644
--- a/lld/test/ELF/riscv-gp.s
+++ b/lld/test/ELF/riscv-gp.s
@@ -11,12 +11,12 @@
# RUN: llvm-readelf -S %t.64 | FileCheck --check-prefix=SEC64 %s
# RUN: not ld.lld -shared %t.64.o -o /dev/null 2>&1 | FileCheck --check-prefix=ERR %s
-## __global_pointer$ = .sdata+0x800 = 0x39b8
-# SEC32: [ 7] .sdata PROGBITS {{0*}}000031b8
-# SYM32: {{0*}}000039b8 0 NOTYPE GLOBAL DEFAULT 7 __global_pointer$
+## __global_pointer$ = .sdata+0x800 = 0x39c0
+# SEC32: [ 7] .sdata PROGBITS {{0*}}000031c0
+# SYM32: {{0*}}000039c0 0 NOTYPE GLOBAL DEFAULT 7 __global_pointer$
-# SEC64: [ 7] .sdata PROGBITS {{0*}}000032d0
-# SYM64: {{0*}}00003ad0 0 NOTYPE GLOBAL DEFAULT 7 __global_pointer$
+# SEC64: [ 7] .sdata PROGBITS {{0*}}000032e0
+# SYM64: {{0*}}00003ae0 0 NOTYPE GLOBAL DEFAULT 7 __global_pointer$
## __global_pointer$ - 0x1000 = 4096*3-2048
# DIS: 1000: auipc gp, 3
diff --git a/lld/test/ELF/riscv-ifunc-nonpreemptible.s b/lld/test/ELF/riscv-ifunc-nonpreemptible.s
index 3e255456ad21..99d75a28a391 100644
--- a/lld/test/ELF/riscv-ifunc-nonpreemptible.s
+++ b/lld/test/ELF/riscv-ifunc-nonpreemptible.s
@@ -12,7 +12,7 @@
# RUN: llvm-objdump -d --no-show-raw-insn %t.64 | FileCheck --check-prefix=DIS64 %s
# RELOC32: .rela.dyn {
-# RELOC32-NEXT: 0x3218 R_RISCV_IRELATIVE - 0x117C
+# RELOC32-NEXT: 0x3220 R_RISCV_IRELATIVE - 0x117C
# RELOC32-NEXT: }
# SYM32: 0001190 0 FUNC GLOBAL DEFAULT {{.*}} func
@@ -22,14 +22,14 @@
# DIS32-NEXT: addi a0, a0, 16
# DIS32: Disassembly of section .iplt:
# DIS32: <func>:
-## 32-bit: &.got.plt[func]-. = 0x3218-0x1190 = 4096*2+136
+## 32-bit: &.got.plt[func]-. = 0x3220-0x1190 = 4096*2+144
# DIS32-NEXT: 1190: auipc t3, 2
-# DIS32-NEXT: lw t3, 136(t3)
+# DIS32-NEXT: lw t3, 144(t3)
# DIS32-NEXT: jalr t1, t3
# DIS32-NEXT: nop
# RELOC64: .rela.dyn {
-# RELOC64-NEXT: 0x3370 R_RISCV_IRELATIVE - 0x1260
+# RELOC64-NEXT: 0x3380 R_RISCV_IRELATIVE - 0x1260
# RELOC64-NEXT: }
# SYM64: 000000000001270 0 FUNC GLOBAL DEFAULT {{.*}} func
@@ -39,9 +39,9 @@
# DIS64-NEXT: addi a0, a0, 12
# DIS64: Disassembly of section .iplt:
# DIS64: <func>:
-## 64-bit: &.got.plt[func]-. = 0x3370-0x1270 = 4096*2+256
+## 64-bit: &.got.plt[func]-. = 0x3380-0x1270 = 4096*2+272
# DIS64-NEXT: 1270: auipc t3, 2
-# DIS64-NEXT: ld t3, 256(t3)
+# DIS64-NEXT: ld t3, 272(t3)
# DIS64-NEXT: jalr t1, t3
# DIS64-NEXT: nop
diff --git a/lld/test/ELF/separate-segments.s b/lld/test/ELF/separate-segments.s
index a0c910f31338..d0e4afe7fb66 100644
--- a/lld/test/ELF/separate-segments.s
+++ b/lld/test/ELF/separate-segments.s
@@ -7,8 +7,8 @@
# RUN: llvm-readelf -l %t | FileCheck --check-prefix=NONE %s
# NONE: LOAD 0x000000 0x0000000000000000 0x0000000000000000 0x000245 0x000245 R 0x1000
# NONE-NEXT: LOAD 0x000248 0x0000000000001248 0x0000000000001248 0x000001 0x000001 R E 0x1000
-# NONE-NEXT: LOAD 0x000250 0x0000000000002250 0x0000000000002250 0x000080 0x000080 RW 0x1000
-# NONE-NEXT: LOAD 0x0002d0 0x00000000000032d0 0x00000000000032d0 0x000001 0x000001 RW 0x1000
+# NONE-NEXT: LOAD 0x000250 0x0000000000002250 0x0000000000002250 0x000090 0x000090 RW 0x1000
+# NONE-NEXT: LOAD 0x0002e0 0x00000000000032e0 0x00000000000032e0 0x000001 0x000001 RW 0x1000
## -z separate-code makes text segment (RX) separate.
## The two RW can have overlapping p_offset ranges at runtime.
@@ -16,15 +16,15 @@
# RUN: llvm-readelf -l %t | FileCheck --check-prefix=CODE %s
# CODE: LOAD 0x000000 0x0000000000000000 0x0000000000000000 0x000245 0x000245 R 0x1000
# CODE-NEXT: LOAD 0x001000 0x0000000000001000 0x0000000000001000 0x000001 0x000001 R E 0x1000
-# CODE-NEXT: LOAD 0x002000 0x0000000000002000 0x0000000000002000 0x000080 0x000080 RW 0x1000
-# CODE-NEXT: LOAD 0x002080 0x0000000000003080 0x0000000000003080 0x000001 0x000001 RW 0x1000
+# CODE-NEXT: LOAD 0x002000 0x0000000000002000 0x0000000000002000 0x000090 0x000090 RW 0x1000
+# CODE-NEXT: LOAD 0x002090 0x0000000000003090 0x0000000000003090 0x000001 0x000001 RW 0x1000
## -z separate-loadable-segments makes all segments separate.
# RUN: ld.lld -pie %t.o -z separate-loadable-segments -o %t
# RUN: llvm-readelf -l %t | FileCheck --check-prefix=ALL %s
# ALL: LOAD 0x000000 0x0000000000000000 0x0000000000000000 0x000245 0x000245 R 0x1000
# ALL-NEXT: LOAD 0x001000 0x0000000000001000 0x0000000000001000 0x000001 0x000001 R E 0x1000
-# ALL-NEXT: LOAD 0x002000 0x0000000000002000 0x0000000000002000 0x000080 0x000080 RW 0x1000
+# ALL-NEXT: LOAD 0x002000 0x0000000000002000 0x0000000000002000 0x000090 0x000090 RW 0x1000
# ALL-NEXT: LOAD 0x003000 0x0000000000003000 0x0000000000003000 0x000001 0x000001 RW 0x1000
nop
More information about the llvm-commits
mailing list