[lld] 011b785 - [ELF] Create readonly PT_LOAD in the presence of a SECTIONS command
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 19 19:11:36 PDT 2020
Author: Fangrui Song
Date: 2020-03-19T19:11:11-07:00
New Revision: 011b785505b1f6d315a93fd0a0409576ad8d1805
URL: https://github.com/llvm/llvm-project/commit/011b785505b1f6d315a93fd0a0409576ad8d1805
DIFF: https://github.com/llvm/llvm-project/commit/011b785505b1f6d315a93fd0a0409576ad8d1805.diff
LOG: [ELF] Create readonly PT_LOAD in the presence of a SECTIONS command
This essentially drops the change by r288021 (discussed with Georgii Rymar
and Peter Smith and noted down in the release note of lld 10).
GNU ld>=2.31 enables -z separate-code by default for Linux x86. By
default (in the absence of a PHDRS command) a readonly PT_LOAD is
created, which is different from its traditional behavior.
Not emulating GNU ld's traditional behavior is good for us because it
improves code consistency (we create a readonly PT_LOAD in the absence
of a SECTIONS command).
Users can add --no-rosegment to restore the previous behavior (combined
readonly and read-executable sections in a single RX PT_LOAD).
Added:
Modified:
lld/ELF/ScriptParser.cpp
lld/test/ELF/arm-force-pi-thunk.s
lld/test/ELF/arm-thumb-thunk-v6m.s
lld/test/ELF/arm-thunk-linkerscript-dotexpr.s
lld/test/ELF/arm-thunk-linkerscript.s
lld/test/ELF/linkerscript/absolute-expr.test
lld/test/ELF/linkerscript/align-empty.test
lld/test/ELF/linkerscript/at.s
lld/test/ELF/linkerscript/at4.s
lld/test/ELF/linkerscript/extend-pt-load1.test
lld/test/ELF/linkerscript/extend-pt-load2.test
lld/test/ELF/linkerscript/extend-pt-load3.test
lld/test/ELF/linkerscript/loadaddr.s
lld/test/ELF/linkerscript/map-file2.test
lld/test/ELF/linkerscript/merge-header-load.s
lld/test/ELF/linkerscript/merge-sections-syms.s
lld/test/ELF/linkerscript/merge-sections.s
lld/test/ELF/linkerscript/non-alloc.s
lld/test/ELF/linkerscript/orphan-align.s
lld/test/ELF/linkerscript/overlapping-sections.s
lld/test/ELF/linkerscript/overlay.test
lld/test/ELF/linkerscript/repsection-symbol.s
lld/test/ELF/linkerscript/rosegment.test
lld/test/ELF/linkerscript/sections-keep.s
lld/test/ELF/linkerscript/sizeofheaders.s
lld/test/ELF/linkerscript/synthetic-symbols1.test
Removed:
################################################################################
diff --git a/lld/ELF/ScriptParser.cpp b/lld/ELF/ScriptParser.cpp
index 92768bae0c83..89b099d49200 100644
--- a/lld/ELF/ScriptParser.cpp
+++ b/lld/ELF/ScriptParser.cpp
@@ -545,12 +545,6 @@ void ScriptParser::readSections() {
v.end());
if (atEOF() || !consume("INSERT")) {
- // --no-rosegment is used to avoid placing read only non-executable sections
- // in their own segment. We do the same if SECTIONS command is present in
- // linker script. See comment for computeFlags().
- // TODO This rule will be dropped in the future.
- config->singleRoRx = true;
-
script->hasSectionsCommand = true;
return;
}
diff --git a/lld/test/ELF/arm-force-pi-thunk.s b/lld/test/ELF/arm-force-pi-thunk.s
index 5504b4e19bd9..582d1e4babda 100644
--- a/lld/test/ELF/arm-force-pi-thunk.s
+++ b/lld/test/ELF/arm-force-pi-thunk.s
@@ -5,7 +5,7 @@
// RUN: .text_low : { *(.text_low) *(.text_low2) } \
// RUN: .text_high 0x2000000 : { *(.text_high) *(.text_high2) } \
// RUN: } " > %t.script
-// RUN: ld.lld --pic-veneer --script %t.script %t -o %t2
+// RUN: ld.lld --pic-veneer --no-rosegment --script %t.script %t -o %t2
// RUN: llvm-objdump -d --triple=thumbv7a-none-linux-gnueabi %t2 | FileCheck %s
// Test that we can force generation of position independent thunks even when
diff --git a/lld/test/ELF/arm-thumb-thunk-v6m.s b/lld/test/ELF/arm-thumb-thunk-v6m.s
index b97f9f767adf..6036febf8e63 100644
--- a/lld/test/ELF/arm-thumb-thunk-v6m.s
+++ b/lld/test/ELF/arm-thumb-thunk-v6m.s
@@ -5,9 +5,9 @@
// RUN: .text_low : { *(.text_low) *(.text_low2) } \
// RUN: .text_high 0x2000000 : { *(.text_high) *(.text_high2) } \
// RUN: } " > %t.script
-// RUN: ld.lld --script %t.script %t -o %t2
+// RUN: ld.lld --no-rosegment --script %t.script %t -o %t2
// RUN: llvm-objdump -d %t2 --triple=armv6m-none-eabi | FileCheck %s
-// RUN: ld.lld --script %t.script %t -o %t3 --pie
+// RUN: ld.lld --no-rosegment --script %t.script %t -o %t3 --pie
// RUN: llvm-objdump -d %t3 --triple=armv6m-none-eabi | FileCheck --check-prefix=CHECK-PI %s
// Range extension thunks for Arm Architecture v6m. Only Thumb instructions
diff --git a/lld/test/ELF/arm-thunk-linkerscript-dotexpr.s b/lld/test/ELF/arm-thunk-linkerscript-dotexpr.s
index 1da6da5f33ba..62b5ea0ebc95 100644
--- a/lld/test/ELF/arm-thunk-linkerscript-dotexpr.s
+++ b/lld/test/ELF/arm-thunk-linkerscript-dotexpr.s
@@ -4,7 +4,7 @@
// RUN: . = SIZEOF_HEADERS; \
// RUN: .text_low : { *(.text_low) *(.text_low2) . = . + 0x2000000 ; *(.text_high) *(.text_high2) } \
// RUN: } " > %t.script
-// RUN: ld.lld --script %t.script %t -o %t2
+// RUN: ld.lld --no-rosegment --script %t.script %t -o %t2
// RUN: llvm-objdump -d %t2 --start-address=148 --stop-address=188 --triple=thumbv7a-linux-gnueabihf | FileCheck --check-prefix=CHECK1 %s
// RUN: llvm-objdump -d %t2 --start-address=33554620 --stop-address=33554654 --triple=thumbv7a-linux-gnueabihf | FileCheck --check-prefix=CHECK2 %s
// Test that range extension thunks can handle location expressions within
diff --git a/lld/test/ELF/arm-thunk-linkerscript.s b/lld/test/ELF/arm-thunk-linkerscript.s
index 5de80fc0d5c4..a08aadc795e7 100644
--- a/lld/test/ELF/arm-thunk-linkerscript.s
+++ b/lld/test/ELF/arm-thunk-linkerscript.s
@@ -5,7 +5,7 @@
// RUN: .text_low : { *(.text_low) *(.text_low2) } \
// RUN: .text_high 0x2000000 : { *(.text_high) *(.text_high2) } \
// RUN: } " > %t.script
-// RUN: ld.lld --script %t.script %t -o %t2
+// RUN: ld.lld --no-rosegment --script %t.script %t -o %t2
// RUN: llvm-objdump -d --triple=thumbv7a-none-linux-gnueabi %t2 | FileCheck %s
// Simple test that we can support range extension thunks with linker scripts
.syntax unified
diff --git a/lld/test/ELF/linkerscript/absolute-expr.test b/lld/test/ELF/linkerscript/absolute-expr.test
index 47016d3f5d88..6786c1d5807f 100644
--- a/lld/test/ELF/linkerscript/absolute-expr.test
+++ b/lld/test/ELF/linkerscript/absolute-expr.test
@@ -53,7 +53,7 @@ SECTIONS {
# CHECK-NEXT: }
# CHECK-NEXT: Symbol {
# CHECK-NEXT: Name: bar4
-# CHECK-NEXT: Value: 0x190
+# CHECK-NEXT: Value:
# CHECK-NEXT: Size: 0
# CHECK-NEXT: Binding: Global
# CHECK-NEXT: Type: None
diff --git a/lld/test/ELF/linkerscript/align-empty.test b/lld/test/ELF/linkerscript/align-empty.test
index 13edafe92eff..0f212e877e67 100644
--- a/lld/test/ELF/linkerscript/align-empty.test
+++ b/lld/test/ELF/linkerscript/align-empty.test
@@ -15,8 +15,8 @@ SECTIONS {
# CHECK: Sections:
# CHECK-NEXT: Idx Name Size VMA
# CHECK-NEXT: 0 00000000 0000000000000000
-# CHECK-NEXT: 1 .dynsym 00000018 0000000000000190
-# CHECK-NEXT: 2 .gnu.hash 0000001c 00000000000001a8
-# CHECK-NEXT: 3 .hash 00000010 00000000000001c4
-# CHECK-NEXT: 4 .dynstr 00000001 00000000000001d4
+# CHECK-NEXT: 1 .dynsym 00000018 00000000000001c8
+# CHECK-NEXT: 2 .gnu.hash 0000001c 00000000000001e0
+# CHECK-NEXT: 3 .hash 00000010 00000000000001fc
+# CHECK-NEXT: 4 .dynstr 00000001 000000000000020c
# CHECK-NEXT: 5 foo 00000001 0000000000001000
diff --git a/lld/test/ELF/linkerscript/at.s b/lld/test/ELF/linkerscript/at.s
index 8240d004c9a8..f1681656c38b 100644
--- a/lld/test/ELF/linkerscript/at.s
+++ b/lld/test/ELF/linkerscript/at.s
@@ -12,10 +12,11 @@
# RUN: llvm-readelf -l %t | FileCheck %s
# CHECK: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
-# CHECK-NEXT: LOAD 0x001000 0x0000000000001000 0x0000000000002000 0x000010 0x000010 R E 0x1000
-# CHECK-NEXT: LOAD 0x001010 0x0000000000001010 0x0000000000003000 0x000008 0x000008 R E 0x1000
-# CHECK-NEXT: LOAD 0x001018 0x0000000000001018 0x0000000000004000 0x000008 0x000008 R E 0x1000
-# CHECK-NEXT: LOAD 0x002000 0x0000000000005000 0x0000000000005000 0x000009 0x000009 R E 0x1000
+# CHECK-NEXT: LOAD 0x001000 0x0000000000001000 0x0000000000002000 0x000010 0x000010 R 0x1000
+# CHECK-NEXT: LOAD 0x001010 0x0000000000001010 0x0000000000003000 0x000008 0x000008 R 0x1000
+# CHECK-NEXT: LOAD 0x001018 0x0000000000001018 0x0000000000004000 0x000008 0x000008 R 0x1000
+# CHECK-NEXT: LOAD 0x002000 0x0000000000005000 0x0000000000005000 0x000008 0x000008 R 0x1000
+# CHECK-NEXT: LOAD 0x002008 0x0000000000005008 0x0000000000005008 0x000001 0x000001 R E 0x1000
.global _start
_start:
diff --git a/lld/test/ELF/linkerscript/at4.s b/lld/test/ELF/linkerscript/at4.s
index c4500e31ada8..a52a33e5cee4 100644
--- a/lld/test/ELF/linkerscript/at4.s
+++ b/lld/test/ELF/linkerscript/at4.s
@@ -10,8 +10,9 @@
# RUN: llvm-readelf -l %t | FileCheck %s
# CHECK: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
-# CHECK-NEXT: LOAD 0x001000 0x0000000000001000 0x0000000000001000 0x000008 0x000008 R E 0x1000
-# CHECK-NEXT: LOAD 0x001008 0x0000000000001008 0x0000000000002008 0x000011 0x000011 R E 0x1000
+# CHECK-NEXT: LOAD 0x001000 0x0000000000001000 0x0000000000001000 0x000008 0x000008 R 0x1000
+# CHECK-NEXT: LOAD 0x001008 0x0000000000001008 0x0000000000002008 0x000010 0x000010 R 0x1000
+# CHECK-NEXT: LOAD 0x001018 0x0000000000001018 0x0000000000001018 0x000001 0x000001 R E 0x1000
.global _start
_start:
diff --git a/lld/test/ELF/linkerscript/extend-pt-load1.test b/lld/test/ELF/linkerscript/extend-pt-load1.test
index c39e0244ec2c..63c6f0d9ca8e 100644
--- a/lld/test/ELF/linkerscript/extend-pt-load1.test
+++ b/lld/test/ELF/linkerscript/extend-pt-load1.test
@@ -16,8 +16,8 @@ SECTIONS {
.data.rel.ro : { *(.data.rel.ro) }
}
-# CHECK: .text PROGBITS 00000000000001bc 0001bc 000001 00 AX
+# CHECK: .text PROGBITS 00000000000001f4 0001f4 000001 00 AX
# CHECK-NEXT: .data.rel.ro PROGBITS 0000000000001000 001000 000001 00 WA
-# CHECK: LOAD 0x000000 0x0000000000000000 0x0000000000000000 0x0001bd 0x0001bd R E
-# CHECK-NEXT: LOAD 0x001000 0x0000000000001000 0x0000000000001000 0x000068 0x000068 RW
+# CHECK: LOAD 0x000000 0x0000000000000000 0x0000000000000000 0x0001f1 0x0001f1 R 0x1000
+# CHECK-NEXT: LOAD 0x0001f4 0x00000000000001f4 0x00000000000001f4 0x000001 0x000001 R E 0x1000
diff --git a/lld/test/ELF/linkerscript/extend-pt-load2.test b/lld/test/ELF/linkerscript/extend-pt-load2.test
index 4fbeb505b178..3e91f3b4f162 100644
--- a/lld/test/ELF/linkerscript/extend-pt-load2.test
+++ b/lld/test/ELF/linkerscript/extend-pt-load2.test
@@ -16,9 +16,10 @@ SECTIONS {
.data.rel.ro : { *(.data.rel.ro) }
}
-# CHECK: .text PROGBITS 00000000000001bc 0001bc 000001 00 AX
-# CHECK-NEXT: bar PROGBITS 00000000000001bd 0001bd 000e43 00 AX
+# CHECK: .text PROGBITS 00000000000001f4 0001f4 000001 00 AX
+# CHECK-NEXT: bar PROGBITS 00000000000001f5 0001f5 000e0b 00 AX
# CHECK-NEXT: .data.rel.ro PROGBITS 0000000000001000 001000 000001 00 WA
-# CHECK: LOAD 0x000000 0x0000000000000000 0x0000000000000000 0x001000 0x001000 R E
-# CHECK-NEXT: LOAD 0x001000 0x0000000000001000 0x0000000000001000 0x000068 0x000068 RW
+# CHECK: LOAD 0x000000 0x0000000000000000 0x0000000000000000 0x0001f1 0x0001f1 R 0x1000
+# CHECK: LOAD 0x0001f4 0x00000000000001f4 0x00000000000001f4 0x000e0c 0x000e0c R E 0x1000
+# CHECK-NEXT: LOAD 0x001000 0x0000000000001000 0x0000000000001000 0x000068 0x000068 RW 0x1000
diff --git a/lld/test/ELF/linkerscript/extend-pt-load3.test b/lld/test/ELF/linkerscript/extend-pt-load3.test
index 9dd4ab8e0c43..072fe90a6461 100644
--- a/lld/test/ELF/linkerscript/extend-pt-load3.test
+++ b/lld/test/ELF/linkerscript/extend-pt-load3.test
@@ -17,8 +17,9 @@ SECTIONS {
.data.rel.ro : { *(.data.rel.ro) }
}
-# CHECK: .text PROGBITS 00000000000001bc 0001bc 000001 00 AX
+# CHECK: .text PROGBITS 00000000000001f4 0001f4 000001 00 AX
# CHECK-NEXT: .data.rel.ro PROGBITS 0000000000001000 001000 000001 00 WA
-# CHECK: LOAD 0x000000 0x0000000000000000 0x0000000000000000 0x0001bd 0x0001bd R E
-# CHECK-NEXT: LOAD 0x001000 0x0000000000001000 0x0000000000001000 0x000068 0x000068 RW
\ No newline at end of file
+# CHECK: LOAD 0x000000 0x0000000000000000 0x0000000000000000 0x0001f1 0x0001f1 R 0x1000
+# CHECK-NEXT: LOAD 0x0001f4 0x00000000000001f4 0x00000000000001f4 0x000001 0x000001 R E 0x1000
+# CHECK-NEXT: LOAD 0x001000 0x0000000000001000 0x0000000000001000 0x000068 0x000068 RW 0x1000
diff --git a/lld/test/ELF/linkerscript/loadaddr.s b/lld/test/ELF/linkerscript/loadaddr.s
index 055b7422baeb..e2c82fc6c8cb 100644
--- a/lld/test/ELF/linkerscript/loadaddr.s
+++ b/lld/test/ELF/linkerscript/loadaddr.s
@@ -22,7 +22,7 @@
# CHECK-NEXT: 0000000000002008 g *ABS* 0000000000000000 bbb_lma
# CHECK-NEXT: 0000000000003000 g *ABS* 0000000000000000 ccc_lma
# CHECK-NEXT: 0000000000004000 g *ABS* 0000000000000000 ddd_lma
-# CHECK-NEXT: 0000000000004008 g *ABS* 0000000000000000 txt_lma
+# CHECK-NEXT: 0000000000001020 g *ABS* 0000000000000000 txt_lma
# ERROR: {{.*}}.script:1: undefined section .zzz
.global _start
diff --git a/lld/test/ELF/linkerscript/map-file2.test b/lld/test/ELF/linkerscript/map-file2.test
index 535043282249..f527e8ecdf80 100644
--- a/lld/test/ELF/linkerscript/map-file2.test
+++ b/lld/test/ELF/linkerscript/map-file2.test
@@ -32,10 +32,10 @@ SECTIONS {
# CHECK-NEXT: 1219 3209 8 1 {{.*}}{{/|\\}}map-file2.test.tmp.o:(.ddd)
# CHECK-NEXT: 1228 3218 34 8 .eh_frame
# CHECK-NEXT: 1228 3218 30 1 {{.*}}{{/|\\}}map-file2.test.tmp.o:(.eh_frame+0x0)
-# CHECK-NEXT: 125c 324c 1 4 .text
-# CHECK-NEXT: 125c 324c 1 4 {{.*}}{{/|\\}}map-file2.test.tmp.o:(.text)
-# CHECK-NEXT: 125c 324c 0 1 f(int)
-# CHECK-NEXT: 125c 324c 0 1 _start
+# CHECK-NEXT: 125c 125c 1 4 .text
+# CHECK-NEXT: 125c 125c 1 4 {{.*}}{{/|\\}}map-file2.test.tmp.o:(.text)
+# CHECK-NEXT: 125c 125c 0 1 f(int)
+# CHECK-NEXT: 125c 125c 0 1 _start
# CHECK-NEXT: 0 0 8 1 .comment
# CHECK-NEXT: 0 0 8 1 <internal>:(.comment)
# CHECK-NEXT: 0 0 48 8 .symtab
diff --git a/lld/test/ELF/linkerscript/merge-header-load.s b/lld/test/ELF/linkerscript/merge-header-load.s
index 5fb866abef85..d067c40d67ab 100644
--- a/lld/test/ELF/linkerscript/merge-header-load.s
+++ b/lld/test/ELF/linkerscript/merge-header-load.s
@@ -12,8 +12,9 @@
# CHECK: Program Headers:
# CHECK: Type Offset VirtAddr PhysAddr
-# CHECK-NEXT: PHDR 0x000040 0xffffffff80000040 0x0000000000004040
-# CHECK-NEXT: LOAD 0x000000 0xffffffff80000000 0x0000000000004000
+# CHECK-NEXT: PHDR 0x000040 0xffffffff80000040 0xffffffff80000040
+# CHECK-NEXT: LOAD 0x000000 0xffffffff80000000 0xffffffff80000000
+# CHECK-NEXT: LOAD 0x000200 0xffffffff80000200 0x0000000000004200
# CHECK-NOT: LOAD
.global _start
diff --git a/lld/test/ELF/linkerscript/merge-sections-syms.s b/lld/test/ELF/linkerscript/merge-sections-syms.s
index 229cfc6fcb13..ed9e7d3d523f 100644
--- a/lld/test/ELF/linkerscript/merge-sections-syms.s
+++ b/lld/test/ELF/linkerscript/merge-sections-syms.s
@@ -8,8 +8,8 @@
# RUN: ld.lld -o %t.so --script %t.script %t.o -shared
# RUN: llvm-nm -D %t.so | FileCheck %s
-# CHECK: 0000000000000226 R A
-# CHECK: 0000000000000227 R B
+# CHECK: 000000000000025e R A
+# CHECK: 000000000000025f R B
.section .aaa,"a"
.byte 11
diff --git a/lld/test/ELF/linkerscript/merge-sections.s b/lld/test/ELF/linkerscript/merge-sections.s
index ea53ba3e4201..366961051e6f 100644
--- a/lld/test/ELF/linkerscript/merge-sections.s
+++ b/lld/test/ELF/linkerscript/merge-sections.s
@@ -28,7 +28,7 @@
# CHECK-NEXT: Value: 0x[[ADDR1]]
# CHECK: Name: end
-# CHECK-NEXT: Value: 0x230
+# CHECK-NEXT: Value: 0x268
# Check that we don't crash with --gc-sections
# RUN: ld.lld --gc-sections -o %t2 --script %t.script %t -shared
diff --git a/lld/test/ELF/linkerscript/non-alloc.s b/lld/test/ELF/linkerscript/non-alloc.s
index e6fb84d17d41..aa1a3ac7ca68 100644
--- a/lld/test/ELF/linkerscript/non-alloc.s
+++ b/lld/test/ELF/linkerscript/non-alloc.s
@@ -10,13 +10,15 @@
# CHECK: Program Headers:
# CHECK-NEXT: Type
+# CHECK-NEXT: LOAD {{.*}} R
# CHECK-NEXT: LOAD {{.*}} R E
# CHECK-NEXT: LOAD {{.*}} RW
# CHECK: Section to Segment mapping:
# CHECK-NEXT: Segment Sections...
-# CHECK-NEXT: 00 .dynsym .hash .dynstr .text
-# CHECK-NEXT: 01 .dynamic
+# CHECK-NEXT: 00 .dynsym .hash .dynstr
+# CHECK-NEXT: 01 .text
+# CHECK-NEXT: 02 .dynamic
nop
.section foo
diff --git a/lld/test/ELF/linkerscript/orphan-align.s b/lld/test/ELF/linkerscript/orphan-align.s
index edd637b92820..b866beaa898b 100644
--- a/lld/test/ELF/linkerscript/orphan-align.s
+++ b/lld/test/ELF/linkerscript/orphan-align.s
@@ -6,7 +6,7 @@
# RUN: . = ALIGN(0x1000); \
# RUN: .data.rel.ro : { *(.data.rel.ro) } \
# RUN: }" > %t.script
-# RUN: ld.lld -o %t -T %t.script %t.o -shared
+# RUN: ld.lld -o %t -T %t.script %t.o -shared --no-rosegment
# RUN: llvm-readobj -l %t | FileCheck %s
diff --git a/lld/test/ELF/linkerscript/overlapping-sections.s b/lld/test/ELF/linkerscript/overlapping-sections.s
index a6c63d5d8d0e..ad59aa2d472f 100644
--- a/lld/test/ELF/linkerscript/overlapping-sections.s
+++ b/lld/test/ELF/linkerscript/overlapping-sections.s
@@ -5,15 +5,15 @@
# RUN: .sec1 0x8000 : AT(0x8000) { sec1_start = .; *(.first_sec) sec1_end = .;} \
# RUN: .sec2 0x8800 : AT(0x8080) { sec2_start = .; *(.second_sec) sec2_end = .;} \
# RUN: }" > %t-lma.script
-# RUN: not ld.lld -o /dev/null --script %t-lma.script %t.o -shared 2>&1 | FileCheck %s -check-prefix LMA-OVERLAP-ERR
+# RUN: not ld.lld -o /dev/null -T %t-lma.script %t.o -shared --no-rosegment 2>&1 | FileCheck %s -check-prefix LMA-OVERLAP-ERR
# LMA-OVERLAP-ERR: error: section .sec1 load address range overlaps with .sec2
# LMA-OVERLAP-ERR-NEXT: >>> .sec1 range is [0x8000, 0x80FF]
# LMA-OVERLAP-ERR-NEXT: >>> .sec2 range is [0x8080, 0x817F]
# Check that we create the expected binary with --noinhibit-exec or --no-check-sections:
-# RUN: ld.lld -o %t.so --script %t-lma.script %t.o -shared --noinhibit-exec
-# RUN: ld.lld -o %t.so --script %t-lma.script %t.o -shared --no-check-sections -fatal-warnings
-# RUN: ld.lld -o %t.so --script %t-lma.script %t.o -shared --check-sections --no-check-sections -fatal-warnings
+# RUN: ld.lld -o %t.so --script %t-lma.script %t.o -shared --no-rosegment --noinhibit-exec
+# RUN: ld.lld -o %t.so --script %t-lma.script %t.o -shared --no-rosegment --no-check-sections -fatal-warnings
+# RUN: ld.lld -o %t.so --script %t-lma.script %t.o -shared --no-rosegment --check-sections --no-check-sections -fatal-warnings
# Verify that the .sec2 was indeed placed in a PT_LOAD where the PhysAddr
# overlaps with where .sec1 is loaded:
@@ -42,7 +42,7 @@
# VADDR-OVERLAP-ERR-NEXT: >>> .sec2 range is [0x8020, 0x811F]
# Check that the expected binary was created with --noinhibit-exec:
-# RUN: ld.lld -o %t.so --script %t-vaddr.script %t.o -shared --noinhibit-exec
+# RUN: ld.lld -o %t.so --script %t-vaddr.script %t.o -shared --no-rosegment --noinhibit-exec
# RUN: llvm-readelf --sections -l %t.so | FileCheck %s -check-prefix BAD-VADDR
# BAD-VADDR-LABEL: Section Headers:
# BAD-VADDR: .sec1 PROGBITS 0000000000008000 002000 000100 00 WA 0 0 1
@@ -75,7 +75,7 @@
# BOTH-OVERLAP-ERR-NEXT: >>> .sec1 range is [0x8000, 0x80FF]
# BOTH-OVERLAP-ERR-NEXT: >>> .sec2 range is [0x8040, 0x813F]
-# RUN: ld.lld -o %t.so --script %t-both-overlap.script %t.o -shared --noinhibit-exec
+# RUN: ld.lld -o %t.so --script %t-both-overlap.script %t.o -shared --no-rosegment --noinhibit-exec
# Note: In case everything overlaps we create a binary with overlapping file
# offsets. ld.bfd seems to place .sec1 to file offset 18000 and .sec2
# at 18100 so that only virtual addr and LMA overlap
diff --git a/lld/test/ELF/linkerscript/overlay.test b/lld/test/ELF/linkerscript/overlay.test
index aaa8619a94fc..85e140d60ab0 100644
--- a/lld/test/ELF/linkerscript/overlay.test
+++ b/lld/test/ELF/linkerscript/overlay.test
@@ -26,5 +26,6 @@ SECTIONS {
# CHECK: Program Headers:
# CHECK: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
-# CHECK-NEXT: LOAD 0x001000 0x0000000000001000 0x0000000000004000 0x000008 0x000008 R E 0x1000
-# CHECK-NEXT: LOAD 0x002000 0x0000000000001000 0x0000000000004008 0x000009 0x000009 R E 0x1000
+# CHECK-NEXT: LOAD 0x001000 0x0000000000001000 0x0000000000004000 0x000008 0x000008 R 0x1000
+# CHECK-NEXT: LOAD 0x002000 0x0000000000001000 0x0000000000004008 0x000004 0x000004 R 0x1000
+# CHECK-NEXT: LOAD 0x002008 0x0000000000001008 0x0000000000001008 0x000001 0x000001 R E 0x1000
diff --git a/lld/test/ELF/linkerscript/repsection-symbol.s b/lld/test/ELF/linkerscript/repsection-symbol.s
index 96963eef3abe..d5f61ee82cec 100644
--- a/lld/test/ELF/linkerscript/repsection-symbol.s
+++ b/lld/test/ELF/linkerscript/repsection-symbol.s
@@ -6,17 +6,17 @@
# RUN: .text : { *(.text) } \
# RUN: .foo : {foo1 = .; *(.foo.*) foo2 = .; *(.bar) foo3 = .;} \
# RUN: }" > %t.script
-# RUN: ld.lld --hash-style=sysv -o %t1 --script %t.script %t -shared
+# RUN: ld.lld -o %t1 --script %t.script %t -shared
# RUN: llvm-readobj --symbols %t1 | FileCheck %s
# CHECK: Name: foo1
-# CHECK-NEXT: Value: 0x2C0
+# CHECK-NEXT: Value: 0x330
# CHECK: Name: foo2
-# CHECK-NEXT: Value: 0x2C8
+# CHECK-NEXT: Value: 0x338
# CHECK: Name: foo3
-# CHECK-NEXT: Value: 0x2CC
+# CHECK-NEXT: Value: 0x33C
.section .foo.1,"a"
.long 1
diff --git a/lld/test/ELF/linkerscript/rosegment.test b/lld/test/ELF/linkerscript/rosegment.test
index 72b9414daca1..1fece2898d8f 100644
--- a/lld/test/ELF/linkerscript/rosegment.test
+++ b/lld/test/ELF/linkerscript/rosegment.test
@@ -1,8 +1,7 @@
# REQUIRES: x86
-# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux /dev/null -o %t
-
-# Test that with linker scripts we don't create a RO PT_LOAD.
+## Create a readonly PT_LOAD in the absence of PHDRS.
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux /dev/null -o %t
# RUN: ld.lld -o %t1 --script %s %t -shared
# RUN: llvm-readelf -l %t1 | FileCheck %s
@@ -10,5 +9,5 @@ SECTIONS {
}
# CHECK: Type {{.*}} Flg Align
-# CHECK-NEXT: LOAD {{.*}} R E 0x1000
+# CHECK-NEXT: LOAD {{.*}} R 0x1000
# CHECK-NEXT: LOAD {{.*}} RW 0x1000
diff --git a/lld/test/ELF/linkerscript/sections-keep.s b/lld/test/ELF/linkerscript/sections-keep.s
index 6532f7b93930..9abc9893bc8c 100644
--- a/lld/test/ELF/linkerscript/sections-keep.s
+++ b/lld/test/ELF/linkerscript/sections-keep.s
@@ -44,8 +44,8 @@
# MIXED1-NEXT: Idx Name Size
# MIXED1-NEXT: 0 00000000
# MIXED1-NEXT: 1 .keep 00000004
-# MIXED1-NEXT: 2 .temp 00000004 00000000000000ec
-# MIXED1-NEXT: 3 .text 00000007 00000000000000f0
+# MIXED1-NEXT: 2 .temp 00000004 0000000000000124
+# MIXED1-NEXT: 3 .text 00000007 0000000000000128
# MIXED1-NEXT: 4 .comment 00000008 0000000000000000
# MIXED1-NEXT: 5 .symtab 00000060 0000000000000000
# MIXED1-NEXT: 6 .shstrtab 00000036 0000000000000000
@@ -64,9 +64,9 @@
# MIXED2: Sections:
# MIXED2-NEXT: Idx Name Size
# MIXED2-NEXT: 0 00000000
-# MIXED2-NEXT: 1 .nokeep 00000004 00000000000000e8
-# MIXED2-NEXT: 2 .temp 00000004 00000000000000ec
-# MIXED2-NEXT: 3 .text 00000007 00000000000000f0
+# MIXED2-NEXT: 1 .nokeep 00000004 0000000000000120
+# MIXED2-NEXT: 2 .temp 00000004 0000000000000124
+# MIXED2-NEXT: 3 .text 00000007 0000000000000128
# MIXED2-NEXT: 4 .comment 00000008 0000000000000000
# MIXED2-NEXT: 5 .symtab 00000060 0000000000000000
# MIXED2-NEXT: 6 .shstrtab 00000038 0000000000000000
@@ -80,7 +80,7 @@
# RUN: ld.lld --gc-sections -o %t --script %t.script %t1.o %t.o
# RUN: llvm-objdump -s %t | FileCheck --check-prefix=FILEMATCH %s
# FILEMATCH: Contents of section .keep:
-# FILEMATCH-NEXT: 00e8 41414141 AAAA
+# FILEMATCH-NEXT: 0120 41414141 AAAA
.global _start
_start:
diff --git a/lld/test/ELF/linkerscript/sizeofheaders.s b/lld/test/ELF/linkerscript/sizeofheaders.s
index 3293c4ea34e4..c01ab23dca81 100644
--- a/lld/test/ELF/linkerscript/sizeofheaders.s
+++ b/lld/test/ELF/linkerscript/sizeofheaders.s
@@ -9,8 +9,8 @@
# RUN: llvm-readelf -s %t | FileCheck %s
# CHECK: Value Size Type Bind Vis Ndx Name
-# CHECK: 00000000000000e8 0 NOTYPE GLOBAL DEFAULT 1 _start
-# CHECK-NEXT: 00000000000000e8 0 NOTYPE GLOBAL DEFAULT ABS _size
+# CHECK: 0000000000000120 0 NOTYPE GLOBAL DEFAULT 1 _start
+# CHECK-NEXT: 0000000000000120 0 NOTYPE GLOBAL DEFAULT ABS _size
.global _start
_start:
diff --git a/lld/test/ELF/linkerscript/synthetic-symbols1.test b/lld/test/ELF/linkerscript/synthetic-symbols1.test
index 36b526534da1..f32248b40592 100644
--- a/lld/test/ELF/linkerscript/synthetic-symbols1.test
+++ b/lld/test/ELF/linkerscript/synthetic-symbols1.test
@@ -38,19 +38,19 @@ SECTIONS {
.eh_frame : {}
}
-# CHECK: 0000000000000128 l .foo 0000000000000000 .hidden _end_sec
-# CHECK-NEXT: 0000000000000120 g .foo 0000000000000000 _begin_sec
-# CHECK-NEXT: 0000000000000128 g *ABS* 0000000000000000 _end_sec_abs
+# CHECK: 0000000000000160 l .foo 0000000000000000 .hidden _end_sec
+# CHECK-NEXT: 0000000000000158 g .foo 0000000000000000 _begin_sec
+# CHECK-NEXT: 0000000000000160 g *ABS* 0000000000000000 _end_sec_abs
# CHECK-NEXT: 000000000000104c g .text 0000000000000000 _start
-# CHECK-NEXT: 0000000000000120 g .foo 0000000000000000 begin_foo
-# CHECK-NEXT: 0000000000000128 g .foo 0000000000000000 end_foo
+# CHECK-NEXT: 0000000000000158 g .foo 0000000000000000 begin_foo
+# CHECK-NEXT: 0000000000000160 g .foo 0000000000000000 end_foo
# CHECK-NEXT: 0000000000000008 g *ABS* 0000000000000000 size_foo_1
# CHECK-NEXT: 0000000000000008 g *ABS* 0000000000000000 size_foo_1_abs
# CHECK-NEXT: 0000000000001000 g .foo 0000000000000000 begin_bar
# CHECK-NEXT: 0000000000001004 g .foo 0000000000000000 end_bar
-# CHECK-NEXT: 0000000000000ee4 g *ABS* 0000000000000000 size_foo_2
-# CHECK-NEXT: 0000000000000ee4 g *ABS* 0000000000000000 size_foo_3
+# CHECK-NEXT: 0000000000000eac g *ABS* 0000000000000000 size_foo_2
+# CHECK-NEXT: 0000000000000eac g *ABS* 0000000000000000 size_foo_3
# CHECK-NEXT: 0000000000001004 g .eh_frame_hdr 0000000000000000 __eh_frame_hdr_start
-# CHECK-NEXT: 0000000000001010 g *ABS* 0000000000000000 __eh_frame_hdr_start2
+# CHECK-NEXT: 0000000000001010 g *ABS* 0000000000000000 __eh_frame_hdr_start2
# CHECK-NEXT: 0000000000001018 g .eh_frame_hdr 0000000000000000 __eh_frame_hdr_end
-# CHECK-NEXT: 0000000000001020 g *ABS* 0000000000000000 __eh_frame_hdr_end2
+# CHECK-NEXT: 0000000000001020 g *ABS* 0000000000000000 __eh_frame_hdr_end2
More information about the llvm-commits
mailing list