// considerations:
// * Read-only sections come first such that they go in the
// PT_LOAD covering the program headers at the start of the file.
- // * Read-only, executable sections come next, unless the
- // -no-rosegment option is used.
+ // * Read-only, executable sections come next.
// * Writable, executable sections follow such that .plt on
// architectures where it needs to be writable will be placed
// between .text and .data.
if (IsExec) {
if (IsWrite)
Rank |= RF_EXEC_WRITE;
- else if (!Config->SingleRoRx)
+ else
Rank |= RF_EXEC;
} else {
if (IsWrite)
bl high_target
ret
// CHECK: low_target:
-// CHECK-NEXT: 0: 04 00 00 94 bl #16
-// CHECK-NEXT: 4: c0 03 5f d6 ret
+// CHECK-NEXT: 8: 04 00 00 94 bl #16
+// CHECK-NEXT: c: c0 03 5f d6 ret
.hidden low_target2
.globl low_target2
bl high_target2
ret
// CHECK: low_target2:
-// CHECK-NEXT: 8: 05 00 00 94 bl #20
-// CHECK-NEXT: c: c0 03 5f d6 ret
+// CHECK-NEXT: 0: 05 00 00 94 bl #20
+// CHECK-NEXT: 4: c0 03 5f d6 ret
// Expect range extension thunks for .text_low
// adrp calculation is (PC + signed immediate) & (!0xfff)
// CHECK: __AArch64ADRPThunk_high_target:
-// CHECK-NEXT: 70: 10 00 08 90 adrp x16, #268435456
-// CHECK-NEXT: 74: 10 02 03 91 add x16, x16, #192
-// CHECK-NEXT: 78: 00 02 1f d6 br x16
+// CHECK-NEXT: e8: 10 00 08 90 adrp x16, #268435456
+// CHECK-NEXT: ec: 10 02 01 91 add x16, x16, #64
+// CHECK-NEXT: f0: 00 02 1f d6 br x16
// CHECK: __AArch64ADRPThunk_high_target2:
-// CHECK-NEXT: 7c: 10 00 08 90 adrp x16, #268435456
-// CHECK-NEXT: 80: 10 22 00 91 add x16, x16, #8
-// CHECK-NEXT: 84: 00 02 1f d6 br x16
+// CHECK-NEXT: f4: 10 00 08 90 adrp x16, #268435456
+// CHECK-NEXT: f8: 10 22 00 91 add x16, x16, #8
+// CHECK-NEXT: fc: 00 02 1f d6 br x16
.section .text_high, "ax", %progbits
bl low_target
ret
// CHECK: high_target:
-// CHECK-NEXT: 10000000: 34 00 00 94 bl #208
+// CHECK-NEXT: 10000000: 14 00 00 94 bl #80
// CHECK-NEXT: 10000004: c0 03 5f d6 ret
.hidden high_target2
// CHECK: __AArch64ADRPThunk_low_target2:
// CHECK-NEXT: 10000010: 10 00 f8 90 adrp x16, #-268435456
-// CHECK-NEXT: 10000014: 10 a2 01 91 add x16, x16, #104
+// CHECK-NEXT: 10000014: 10 82 03 91 add x16, x16, #224
// CHECK-NEXT: 10000018: 00 02 1f d6 br x16
// CHECK: Disassembly of section .plt:
// CHECK-NEXT: .plt:
-// CHECK-NEXT: 100000a0: f0 7b bf a9 stp x16, x30, [sp, #-16]!
-// CHECK-NEXT: 100000a4: 10 00 00 90 adrp x16, #0
-// CHECK-NEXT: 100000a8: 11 7a 40 f9 ldr x17, [x16, #240]
-// CHECK-NEXT: 100000ac: 10 c2 03 91 add x16, x16, #240
-// CHECK-NEXT: 100000b0: 20 02 1f d6 br x17
-// CHECK-NEXT: 100000b4: 1f 20 03 d5 nop
-// CHECK-NEXT: 100000b8: 1f 20 03 d5 nop
-// CHECK-NEXT: 100000bc: 1f 20 03 d5 nop
-// CHECK-NEXT: 100000c0: 10 00 00 90 adrp x16, #0
-// CHECK-NEXT: 100000c4: 11 7e 40 f9 ldr x17, [x16, #248]
-// CHECK-NEXT: 100000c8: 10 e2 03 91 add x16, x16, #248
-// CHECK-NEXT: 100000cc: 20 02 1f d6 br x17
-// CHECK-NEXT: 100000d0: 10 00 00 90 adrp x16, #0
-// CHECK-NEXT: 100000d4: 11 82 40 f9 ldr x17, [x16, #256]
-// CHECK-NEXT: 100000d8: 10 02 04 91 add x16, x16, #256
-// CHECK-NEXT: 100000dc: 20 02 1f d6 br x17
+// CHECK-NEXT: 10000020: f0 7b bf a9 stp x16, x30, [sp, #-16]!
+// CHECK-NEXT: 10000024: 10 00 00 90 adrp x16, #0
+// CHECK-NEXT: 10000028: 11 3a 40 f9 ldr x17, [x16, #112]
+// CHECK-NEXT: 1000002c: 10 c2 01 91 add x16, x16, #112
+// CHECK-NEXT: 10000030: 20 02 1f d6 br x17
+// CHECK-NEXT: 10000034: 1f 20 03 d5 nop
+// CHECK-NEXT: 10000038: 1f 20 03 d5 nop
+// CHECK-NEXT: 1000003c: 1f 20 03 d5 nop
+// CHECK-NEXT: 10000040: 10 00 00 90 adrp x16, #0
+// CHECK-NEXT: 10000044: 11 3e 40 f9 ldr x17, [x16, #120]
+// CHECK-NEXT: 10000048: 10 e2 01 91 add x16, x16, #120
+// CHECK-NEXT: 1000004c: 20 02 1f d6 br x17
+// CHECK-NEXT: 10000050: 10 00 00 90 adrp x16, #0
+// CHECK-NEXT: 10000054: 11 42 40 f9 ldr x17, [x16, #128]
+// CHECK-NEXT: 10000058: 10 02 02 91 add x16, x16, #128
+// CHECK-NEXT: 1000005c: 20 02 1f d6 br x17
+// REQUIRES: arm
// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t
// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %S/Inputs/arm-exidx-cantunwind.s -o %tcantunwind
// RUN: ld.lld --no-merge-exidx-entries %t %tcantunwind -o %t2 2>&1
// RUN: ld.lld --no-merge-exidx-entries --script %t.script %tcantunwind %t -o %t3 2>&1
// RUN: llvm-objdump -d -triple=armv7a-none-linux-gnueabi %t3 | FileCheck -check-prefix=CHECK-SCRIPT %s
// RUN: llvm-objdump -s -triple=armv7a-none-linux-gnueabi %t3 | FileCheck -check-prefix=CHECK-SCRIPT-EXIDX %s
-// REQUIRES: arm
// Each assembler created .ARM.exidx section has the SHF_LINK_ORDER flag set
// with the sh_link containing the section index of the executable section
// CHECK-SCRIPT-NEXT: 11014: 1e ff 2f e1 bx lr
// CHECK-SCRIPT-NEXT: Disassembly of section .func1:
// CHECK-SCRIPT-NEXT: func1:
-// CHECK-SCRIPT-NEXT: 11068: 1e ff 2f e1 bx lr
+// CHECK-SCRIPT-NEXT: 11018: 1e ff 2f e1 bx lr
// CHECK-SCRIPT-NEXT: Disassembly of section .func2:
// CHECK-SCRIPT-NEXT: func2:
-// CHECK-SCRIPT-NEXT: 1106c: 1e ff 2f e1 bx lr
+// CHECK-SCRIPT-NEXT: 1101c: 1e ff 2f e1 bx lr
// CHECK-SCRIPT-NEXT: Disassembly of section .func3:
// CHECK-SCRIPT-NEXT: func3:
-// CHECK-SCRIPT-NEXT: 11070: 1e ff 2f e1 bx lr
+// CHECK-SCRIPT-NEXT: 11020: 1e ff 2f e1 bx lr
// Check that the .ARM.exidx section is sorted in order as the functions
// The offset in field 1, is 32-bit so in the binary the most significant bit
-// 11018 - 18 = 11000 func4
-// 11020 - 1c = 11004 func5
-// CHECK-SCRIPT-EXIDX: 11018 e8ffff7f 01000000 e4ffff7f 01000000
-// 11028 - 20 = 11008 _start
-// 11030 - 24 = 1100c f1
-// CHECK-SCRIPT-EXIDX-NEXT: 11028 e0ffff7f 01000000 dcffff7f 01000000
-// 11038 - 28 = 11010 f2
-// 11040 - 2c = 11014 f3
-// CHECK-SCRIPT-EXIDX-NEXT: 11038 d8ffff7f 01000000 d4ffff7f 01000000
-// 11048 + 20 = 11068 func1
-// 11050 + 1c = 1106c func2
-// CHECK-SCRIPT-EXIDX-NEXT: 11048 20000000 01000000 1c000000 01000000
-// 11058 + 18 = 11070 func3
-// 11060 + 14 = 11074 func3 + sizeof(func3)
-// CHECK-SCRIPT-EXIDX-NEXT: 11058 18000000 01000000 14000000 01000000
+// 11024 - 24 = 11000 func4
+// 1102c - 28 = 11004 func5
+// CHECK-SCRIPT-EXIDX: 11024 dcffff7f 01000000 d8ffff7f 01000000
+// 11034 - 2c = 11008 _start
+// 1103c - 30 = 1100c f1
+// CHECK-SCRIPT-EXIDX-NEXT: 11034 d4ffff7f 01000000 d0ffff7f 01000000
+// 11044 - 34 = 11010 f2
+// 1104c - 38 = 11014 f3
+// CHECK-SCRIPT-EXIDX-NEXT: 11044 ccffff7f 01000000 c8ffff7f 01000000
+// 11054 - 3c = 11018 func1
+// 1105c - 40 = 1101c func2
+// CHECK-SCRIPT-EXIDX-NEXT: 11054 c4ffff7f 01000000 c0ffff7f 01000000
+// 11064 - 44 = 11020 func3
+// 11068 - 48 = 11024 func3 + sizeof(func3)
+// CHECK-SCRIPT-EXIDX-NEXT: 11064 bcffff7f 01000000 b8ffff7f 01000000
// CHECK: Contents of section .ARM.exidx:
// 11004 - 4 = 0x11000 = _start
// 1100c - 8 = 0x11004 = _start + sizeof(_start)
-// CHECK-NEXT: 11004 fcffff7f 01000000 f8ffff7f 01000000
+// CHECK-NEXT: 0000 00100100 01000000 fc0f0100 01000000
.global bar
.hidden bar
bar:
+ ret
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
// RUN: llvm-readobj -l --elf-output-style=GNU %t | FileCheck --check-prefix=PHDR %s
// PHDR: Segment Sections
-// PHDR: .text
-// PHDR-SAME: .eh_frame
+// PHDR: .eh_frame {{.*}}.text
// Check that the CIE and FDE are padded with 0x00 and not 0xCC when the
// .eh_frame section is placed in the executable segment
// CHECK-NEXT: EntrySize:
// CHECK-NEXT: SectionData (
// CHECK-NEXT: 0000: 1C000000 00000000 017A5052 00017810
-// CHECK-NEXT: 0010: 061BDAFF FFFF1B0C 07089001 00000000
-// CHECK-NEXT: 0020: 14000000 24000000 C4FFFFFF 00000000
+// CHECK-NEXT: 0010: 061B2A00 00001B0C 07089001 00000000
+// CHECK-NEXT: 0020: 14000000 24000000 14000000 00000000
// CHECK-NEXT: 0030: 00000000 00000000
// CHECK-NEXT: )
// CHECK: Disassembly of section .plt:
// CHECK-NEXT: .plt:
-// CHECK-NEXT: 10: ff 35 cc 00 00 00 pushl 204
+// CHECK-NEXT: 10: ff 35 84 00 00 00 pushl 132
// CHECK-NEXT: 16: 50 pushl %eax
-// CHECK-NEXT: 17: a1 d0 00 00 00 movl 208, %eax
+// CHECK-NEXT: 17: a1 88 00 00 00 movl 136, %eax
// CHECK-NEXT: 1c: e8 0f 00 00 00 calll 15 <.plt+0x20>
// CHECK-NEXT: 21: f3 90 pause
// CHECK-NEXT: 23: 0f ae e8 lfence
// CHECK-NEXT: 3e: c3 retl
// CHECK-NEXT: 3f: cc int3
// CHECK-NEXT: 40: 50 pushl %eax
-// CHECK-NEXT: 41: a1 d4 00 00 00 movl 212, %eax
+// CHECK-NEXT: 41: a1 8c 00 00 00 movl 140, %eax
// CHECK-NEXT: 46: e8 e5 ff ff ff calll -27 <.plt+0x20>
// CHECK-NEXT: 4b: e9 d1 ff ff ff jmp -47 <.plt+0x11>
// CHECK-NEXT: 50: 68 00 00 00 00 pushl $0
// CHECK-NEXT: 5e: cc int3
// CHECK-NEXT: 5f: cc int3
// CHECK-NEXT: 60: 50 pushl %eax
-// CHECK-NEXT: 61: a1 d8 00 00 00 movl 216, %eax
+// CHECK-NEXT: 61: a1 90 00 00 00 movl 144, %eax
// CHECK-NEXT: 66: e8 c5 ff ff ff calll -59 <.plt+0x20>
// CHECK-NEXT: 6b: e9 b1 ff ff ff jmp -79 <.plt+0x11>
// CHECK-NEXT: 70: 68 08 00 00 00 pushl $8
// CHECK: Disassembly of section .plt:
// CHECK-NEXT: .plt:
-// CHECK-NEXT: 10: ff b3 cc 00 00 00 pushl 204(%ebx)
+// CHECK-NEXT: 10: ff b3 84 00 00 00 pushl 132(%ebx)
// CHECK-NEXT: 16: 50 pushl %eax
-// CHECK-NEXT: 17: 8b 83 d0 00 00 00 movl 208(%ebx), %eax
+// CHECK-NEXT: 17: 8b 83 88 00 00 00 movl 136(%ebx), %eax
// CHECK-NEXT: 1d: e8 0e 00 00 00 calll 14 <.plt+0x20>
// CHECK-NEXT: 22: f3 90 pause
// CHECK-NEXT: 24: 0f ae e8 lfence
// CHECK-NEXT: 3e: c3 retl
// CHECK-NEXT: 3f: cc int3
// CHECK-NEXT: 40: 50 pushl %eax
-// CHECK-NEXT: 41: 8b 83 d4 00 00 00 movl 212(%ebx), %eax
+// CHECK-NEXT: 41: 8b 83 8c 00 00 00 movl 140(%ebx), %eax
// CHECK-NEXT: 47: e8 e4 ff ff ff calll -28 <.plt+0x20>
// CHECK-NEXT: 4c: e9 d1 ff ff ff jmp -47 <.plt+0x12>
// CHECK-NEXT: 51: 68 00 00 00 00 pushl $0
// CHECK-NEXT: 5e: cc int3
// CHECK-NEXT: 5f: cc int3
// CHECK-NEXT: 60: 50 pushl %eax
-// CHECK-NEXT: 61: 8b 83 d8 00 00 00 movl 216(%ebx), %eax
+// CHECK-NEXT: 61: 8b 83 90 00 00 00 movl 144(%ebx), %eax
// CHECK-NEXT: 67: e8 c4 ff ff ff calll -60 <.plt+0x20>
// CHECK-NEXT: 6c: e9 b1 ff ff ff jmp -79 <.plt+0x12>
// CHECK-NEXT: 71: 68 08 00 00 00 pushl $8
# CHECK: Symbol {
# CHECK: Name: foo
-# CHECK-NEXT: Value: 0x38
+# CHECK-NEXT: Value: 0x70
# CHECK-NEXT: Size: 0
# CHECK-NEXT: Binding: Global
# CHECK-NEXT: Type: None
# RUN: ld.lld --gc-sections -o %t %t.o --script %t.script
# RUN: llvm-objdump -t %t | FileCheck %s
-# CHECK: 0000000000000011 .rodata 00000000 bar
+# CHECK: 0000000000000008 .rodata 00000000 bar
.section .rodata.bar
.quad 0x1122334455667788
# CHECK-NEXT: SHF_ALLOC
# CHECK-NEXT: SHF_EXECINSTR
# CHECK-NEXT: ]
-# CHECK-NEXT: Address: 0x1C
+# CHECK-NEXT: Address: 0x0
# CHECK-NEXT: Offset:
# CHECK-NEXT: Size: 4
# CHECK-NEXT: Link:
# CHECK: Symbol {
# CHECK: Name: foo
-# CHECK-NEXT: Value: 0x20
+# CHECK-NEXT: Value: 0x4
# CHECK-NEXT: Size: 0
# CHECK-NEXT: Binding: Local
# CHECK-NEXT: Type: None
}
};
-# CHECK: 3 .text 00000000 00000000000000d0 TEXT
+# CHECK: 5 .text 00000000 000000000000014c
-# CHECK: 00000000000000d1 .text 00000000 foo1
-# CHECK: 00000000000000d1 .text 00000000 bar1
+# CHECK: 000000000000014d .text 00000000 foo1
+# CHECK: 000000000000014d .text 00000000 bar1
# CHECK: 0000000000000000 .text 00000000 foo2
# CHECK: 0000000000000000 .text 00000000 bar2
-# CHECK: 00000000000000d1 .text 00000000 foo3
-# CHECK: 00000000000000d1 .text 00000000 bar3
+# CHECK: 000000000000014d .text 00000000 foo3
+# CHECK: 000000000000014d .text 00000000 bar3
# RUN: llvm-readelf -l %t1 | FileCheck %s
# CHECK: Segment Sections...
-# CHECK-NEXT: 00 .text .hash .dynamic
-# CHECK-NEXT: 01 .bar .dynsym .dynstr .foo
+# CHECK-NEXT: 00 .dynsym .dynstr .hash .bar .foo .text .dynamic
+# CHECK-NEXT: 01 .bar .foo
PHDRS {
ph_write PT_LOAD FLAGS(2);
# RUN: echo ". = 0x150; . = 0x10; .text : {} }" >> %t.script
# RUN: ld.lld %t.o --script %t.script -o %t -shared
# RUN: llvm-objdump -section-headers %t | FileCheck %s
-# CHECK: Idx Name Size Address
-# CHECK: 3 .text 00000000 0000000000000010
+# CHECK: Name Size Address
+# CHECK: .text 00000000 0000000000000010
# RUN: echo "SECTIONS { . = 0x20; . = ASSERT(0x1, "foo"); }" > %t2.script
# RUN: ld.lld %t.o --script %t2.script -o %t -shared
# CHECK-NEXT: 1018 3008 1 1 BYTE ( 0x11 )
# CHECK-NEXT: 1019 3009 100 1 . += 0x100
# CHECK-NEXT: 1119 3109 8 1 {{.*}}{{/|\\}}map-file2.test.tmp.o:(.ddd)
-# CHECK-NEXT: 1124 3114 1 4 .text
-# CHECK-NEXT: 1124 3114 1 4 {{.*}}{{/|\\}}map-file2.test.tmp.o:(.text)
-# CHECK-NEXT: 1124 3114 0 1 f(int)
-# CHECK-NEXT: 1124 3114 0 1 _start
# CHECK-NEXT: 1128 3118 34 8 .eh_frame
# CHECK-NEXT: 1128 3118 30 1 {{.*}}{{/|\\}}map-file2.test.tmp.o:(.eh_frame+0x0)
+# CHECK-NEXT: 115c 314c 1 4 .text
+# CHECK-NEXT: 115c 314c 1 4 {{.*}}{{/|\\}}map-file2.test.tmp.o:(.text)
+# CHECK-NEXT: 115c 314c 0 1 f(int)
+# CHECK-NEXT: 115c 314c 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
# CHECK: Section to Segment mapping:
# CHECK-NEXT: Segment Sections...
-# CHECK-NEXT: 00 foo .text .hash .dynsym .dynstr
+# CHECK-NEXT: 00 foo .hash .dynsym .dynstr
.section foo, "a"
.quad 0
# RUN: llvm-objdump -d %t | FileCheck %s --check-prefix=DUMP
# RUN: llvm-readobj -t %t | FileCheck %s --check-prefix=SYMBOL
+# B = A + 0x1 = -0x10 + 0x1 = -0xf -> 0xFFFFFFFFFFFFFFF1
+# B - (0x94+6) = -0xf - (0x94+6) = -169
# DUMP: Disassembly of section .text:
# DUMP-NEXT: foo:
-# DUMP-NEXT: 50: {{.*}} -101(%rip), %eax
+# DUMP-NEXT: 94: {{.*}} -169(%rip), %eax
# SYMBOL: Symbol {
# SYMBOL: Name: B
# CHECK-NEXT: 0 00000000 0000000000000000
# CHECK-NEXT: 1 .dynsym 00000030 0000000000001000
# CHECK-NEXT: 2 .dynstr 00000003 0000000000001030
-# CHECK-NEXT: 3 .text 00000000 0000000000001034
+# CHECK: 5 .text 00000000 0000000000001070
# CHECK: 0000000000000001 .dynsym 00000000 A
# CHECK: Section to Segment mapping:
# CHECK-NEXT: Segment Sections...
-# CHECK-NEXT: 00 .dynsym .dynstr .text .hash
+# CHECK-NEXT: 00 .dynsym .dynstr .hash .text
# CHECK-NEXT: 01 .dynamic
nop
# CHECK-NEXT: SHF_ALLOC
# CHECK-NEXT: SHF_EXECINSTR
# CHECK-NEXT: ]
-# CHECK-NEXT: Address: 0x1038
+# CHECK-NEXT: Address: 0x1070
# CHECK-NEXT: 0 00000000 0000000000000000
# CHECK-NEXT: 1 .data 00000008 0000000000004000
# CHECK-NEXT: 2 .dynamic 00000060 0000000000004008
-# CHECK-NEXT: 3 .dynsym 00000018 0000000000002000
+# CHECK-NEXT: 3 .dynsym 00000018 0000000000002000
# CHECK-NEXT: 4 .dynstr 00000001 0000000000002018
-# CHECK-NEXT: 5 .text 00000008 000000000000201c
-# CHECK-NEXT: 6 .hash 00000010 0000000000002024
+# CHECK-NEXT: 5 .hash 00000010 000000000000201c
+# CHECK-NEXT: 6 .text 00000008 000000000000202c
.quad 0
.data
# RUN: llvm-objdump -s %t | FileCheck --check-prefix=INV %s
-# CHECK: Contents of section .text:
-# CHECK-NEXT: 02000000 00000000 01000000 00000000
# CHECK: Contents of section .rodata:
# CHECK-NEXT: 02000000 00000000 01000000 00000000
+# CHECK: Contents of section .text:
+# CHECK-NEXT: 02000000 00000000 01000000 00000000
-# INV: Contents of section .text:
-# INV-NEXT: 01000000 00000000 02000000 00000000
# INV: Contents of section .rodata:
# INV-NEXT: 01000000 00000000 02000000 00000000
+# INV: Contents of section .text:
+# INV-NEXT: 01000000 00000000 02000000 00000000
.global _start
_start:
# RUN: ld.lld --symbol-ordering-file %t.ord -o %t --script %t.script %t.o
# RUN: llvm-objdump -s %t | FileCheck %s
-# CHECK: Contents of section .text:
-# CHECK-NEXT: 02000000 00000000 01000000 00000000
# CHECK: Contents of section .rodata:
# CHECK-NEXT: 02000000 00000000 01000000 00000000
+# CHECK: Contents of section .text:
+# CHECK-NEXT: 02000000 00000000 01000000 00000000
# RUN: echo "_foo" > %t.ord
# RUN: echo "_bar" >> %t.ord
# RUN: ld.lld --symbol-ordering-file %t.ord -o %t --script %t.script %t.o
# RUN: llvm-objdump -s %t | FileCheck %s --check-prefix=INV
-# INV: Contents of section .text:
-# INV-NEXT: 01000000 00000000 02000000 00000000
# INV: Contents of section .rodata:
# INV-NEXT: 01000000 00000000 02000000 00000000
+# INV: Contents of section .text:
+# INV-NEXT: 01000000 00000000 02000000 00000000
.section .text.foo,"a",@progbits
_foo:
# MIXED1-NEXT: Idx Name Size
# MIXED1-NEXT: 0 00000000
# MIXED1-NEXT: 1 .keep 00000004
-# MIXED1-NEXT: 2 .text 00000007 00000000000000ec
-# MIXED1-NEXT: 3 .temp 00000004 00000000000000f3
+# MIXED1-NEXT: 2 .temp 00000004 00000000000000ec
+# MIXED1-NEXT: 3 .text 00000007 00000000000000f0
# MIXED1-NEXT: 4 .comment 00000008 0000000000000000
# MIXED1-NEXT: 5 .symtab 00000060 0000000000000000
# MIXED1-NEXT: 6 .shstrtab 00000036 0000000000000000
# MIXED2-NEXT: Idx Name Size
# MIXED2-NEXT: 0 00000000
# MIXED2-NEXT: 1 .nokeep 00000004 00000000000000e8
-# MIXED2-NEXT: 2 .text 00000007 00000000000000ec
-# MIXED2-NEXT: 3 .temp 00000004 00000000000000f3
+# MIXED2-NEXT: 2 .temp 00000004 00000000000000ec
+# MIXED2-NEXT: 3 .text 00000007 00000000000000f0
# MIXED2-NEXT: 4 .comment 00000008 0000000000000000
# MIXED2-NEXT: 5 .symtab 00000060 0000000000000000
# MIXED2-NEXT: 6 .shstrtab 00000038 0000000000000000
# CHECK: Idx
# CHECK-NEXT: 0
-# CHECK-NEXT: 1 .dynsym
-# CHECK-NEXT: 2 .dynstr
-# CHECK-NEXT: 3 .text
+# CHECK-NEXT: 1 .text
+# CHECK-NEXT: 2 .dynsym
+# CHECK-NEXT: 3 .dynstr
# CHECK-NEXT: 4 foo
# CHECK-NEXT: 5 .hash
# CHECK-NEXT: 6 .dynamic
# CHECK: .dynsym {{.*}} A
# CHECK-NEXT: .dynstr {{.*}} A
-# CHECK-NEXT: .text {{.*}} AX
# CHECK-NEXT: .hash {{.*}} A
+# CHECK-NEXT: .text {{.*}} AX
# CHECK-NEXT: foo {{.*}} WA
# CHECK-NEXT: .dynamic {{.*}} WA
PROVIDE_HIDDEN(_end_sec = ADDR(.text) + SIZEOF(.text));
}
-# CHECK: 0000000000201000 .text 00000000 .hidden _begin_sec
-# CHECK-NEXT: 0000000000201001 .text 00000000 .hidden _end_sec
+# CHECK: 0000000000201054 .text 00000000 .hidden _begin_sec
+# CHECK-NEXT: 0000000000201055 .text 00000000 .hidden _end_sec
# RUN: }" > %t.script
# RUN: ld.lld -shared -o %t.so --script %t.script %t.o
-# RUN: llvm-objdump -section-headers %t.so | FileCheck %s
+# RUN: llvm-readelf -s %t.so | FileCheck %s
# CHECK-NOT: .got
# CHECK-NOT: .plt
# CHECK: .dynsym
# CHECK-NEXT: .dynstr
-# CHECK-NEXT: .text
# CHECK-NEXT: .gnu.hash
+# CHECK: .text
# Test that the size of a removed unused synthetic input section is not added
# to the output section size. Adding a symbol assignment prevents removal of
# RUN: ld.lld -o %t1 --script %t.script %t
# RUN: llvm-objdump -section-headers %t1 | FileCheck %s
# CHECK: Sections:
-# CHECK-NEXT: Idx Name Size Address Type
+# CHECK-NEXT: Idx Name Size Address
# CHECK-NEXT: 0 00000000 0000000000000000
-# CHECK-NEXT: 1 .text 00000001 0000000000000000 TEXT
-# CHECK-NEXT: 2 .foo 00000004 0000000000000001 DATA
-# CHECK-NEXT: 3 .boo 00000004 0000000000000005 DATA
+# CHECK-NEXT: 1 .foo 00000004 0000000000000000
+# CHECK-NEXT: 2 .boo 00000004 0000000000000004
+# CHECK-NEXT: 3 .text 00000001 0000000000000008
.global _start
_start:
# RUN: ld.lld -shared -o %t.abs.so --script %t.abs.script %t.o
# RUN: llvm-objdump -s -t %t.abs.so | FileCheck --check-prefix=ABS %s
+# REL: Contents of section .reginfo:
+# REL-NEXT: 0040 10000104 00000000 00000000 00000000
+# REL-NEXT: 0050 00000000 000001ec
+# ^-- _gp
+
# REL: Contents of section .text:
-# REL-NEXT: 0030 3c080000 2108010c 8f82ffcc
+# REL-NEXT: 00e0 3c080000 2108010c 8f82ff1c
# ^-- %hi(_gp_disp)
# ^-- %lo(_gp_disp)
-# ^-- 8 - (0x13c - 0x100)
+# ^-- 8 - (0x1ec - 0x100)
# G - (GP - .got)
-# REL: Contents of section .reginfo:
-# REL-NEXT: 0058 10000104 00000000 00000000 00000000
-# REL-NEXT: 0068 00000000 0000013c
-# ^-- _gp
-
# REL: Contents of section .data:
# REL-NEXT: 00f0 fffffef4
-# ^-- 0x30-0x13c
+# ^-- 0x30-0x1ec
# foo - GP
-# REL: 00000030 .text 00000000 foo
+# REL: 000000e0 .text 00000000 foo
# REL: 00000000 *ABS* 00000000 .hidden _gp_disp
-# REL: 0000013c *ABS* 00000000 .hidden _gp
+# REL: 000001ec *ABS* 00000000 .hidden _gp
+
+# ABS: Contents of section .reginfo:
+# ABS-NEXT: 0040 10000104 00000000 00000000 00000000
+# ABS-NEXT: 0050 00000000 00000200
+# ^-- _gp
# ABS: Contents of section .text:
-# ABS-NEXT: 0030 3c080000 210801d0 8f82ff08
+# ABS-NEXT: 00e0 3c080000 21080120 8f82ff08
# ^-- %hi(_gp_disp)
# ^-- %lo(_gp_disp)
# ^-- 8 - (0x200 - 0x100)
# G - (GP - .got)
-# ABS: Contents of section .reginfo:
-# ABS-NEXT: 0058 10000104 00000000 00000000 00000000
-# ABS-NEXT: 0068 00000000 00000200
-# ^-- _gp
-
# ABS: Contents of section .data:
-# ABS-NEXT: 00f0 fffffe30
-# ^-- 0x30-0x200
+# ABS-NEXT: 00f0 fffffee0
+# ^-- 0xe0-0x200
# foo - GP
-# ABS: 00000030 .text 00000000 foo
+# ABS: 000000e0 .text 00000000 foo
# ABS: 00000000 *ABS* 00000000 .hidden _gp_disp
# ABS: 00000200 *ABS* 00000000 .hidden _gp
# CHECK: .dynsym {{.*}} A
# CHECK-NEXT: .dynstr {{.*}} A
-# CHECK-NEXT: .text {{.*}} AX
# CHECK-NEXT: .hash {{.*}} A
+# CHECK-NEXT: .text {{.*}} AX
# CHECK-NEXT: foo {{.*}} WA
# CHECK-NEXT: .dynamic {{.*}} WA
# RUN: | FileCheck %s --check-prefix=GOTDATA
# GOT: Sections:
-# GOT: 8 .got.plt 00000020 00000000000000d0 DATA
-# GOT: 10 .got 00000008 00000000000001c0 DATA
+# GOT: 8 .got.plt 00000020 00000000000000e0 DATA
+# GOT: 10 .got 00000008 00000000000001d0 DATA
# GOTDATA: Contents of section .got.plt:
-# GOTDATA-NEXT: 00d0 f0000000 00000000 00000000 00000000
-# GOTDATA-NEXT: 00e0 00000000 00000000 c6000000 00000000
+# GOTDATA-NEXT: 00e0 00010000 00000000 00000000 00000000
+# GOTDATA-NEXT: 00f0 00000000 00000000 d6000000 00000000
# GOTDATA-NEXT: Contents of section .got:
-# GOTDATA-NEXT: 01c0 00000000 00000000
+# GOTDATA-NEXT: 01d0 00000000 00000000
# RUN: echo "SECTIONS { .mygot : { *(.got) *(.got.plt) } }" > %t1.script
# RUN: ld.lld --hash-style=sysv -shared %t.o -o %t1.out --script %t1.script
# RUN: llvm-objdump -s -section=.mygot %t1.out | FileCheck %s --check-prefix=MYGOTDATA
# MYGOT: Sections:
-# MYGOT: 8 .mygot 00000028 00000000000000d0 DATA
+# MYGOT: 8 .mygot 00000028 00000000000000e0 DATA
# MYGOT-NOT: .got
# MYGOT-NOT: .got.plt
-# MYGOTDATA: 00d0 00000000 00000000 f8000000 00000000
-# MYGOTDATA-NEXT: 00e0 00000000 00000000 00000000 00000000
-# MYGOTDATA-NEXT: 00f0 c6000000 00000000
+# MYGOTDATA: 00e0 00000000 00000000 08010000 00000000
+# MYGOTDATA-NEXT: 00f0 00000000 00000000 00000000 00000000
+# MYGOTDATA-NEXT: 0100 d6000000 00000000
mov bar@gotpcrel(%rip), %rax
call foo@plt
// CHECK: Disassembly of section .plt:
// CHECK-NEXT: .plt:
-// CHECK-NEXT: 10: ff 35 ea 00 00 00 pushq 234(%rip)
-// CHECK-NEXT: 16: 4c 8b 1d eb 00 00 00 movq 235(%rip), %r11
+// CHECK-NEXT: 10: ff 35 72 00 00 00 pushq 114(%rip)
+// CHECK-NEXT: 16: 4c 8b 1d 73 00 00 00 movq 115(%rip), %r11
// CHECK-NEXT: 1d: e8 0e 00 00 00 callq 14 <.plt+0x20>
// CHECK-NEXT: 22: f3 90 pause
// CHECK-NEXT: 24: 0f ae e8 lfence
// CHECK-NEXT: 3d: cc int3
// CHECK-NEXT: 3e: cc int3
// CHECK-NEXT: 3f: cc int3
-// CHECK-NEXT: 40: 4c 8b 1d c9 00 00 00 movq 201(%rip), %r11
+// CHECK-NEXT: 40: 4c 8b 1d 51 00 00 00 movq 81(%rip), %r11
// CHECK-NEXT: 47: e8 e4 ff ff ff callq -28 <.plt+0x20>
// CHECK-NEXT: 4c: e9 d1 ff ff ff jmp -47 <.plt+0x12>
// CHECK-NEXT: 51: 68 00 00 00 00 pushq $0
// CHECK-NEXT: 5d: cc int3
// CHECK-NEXT: 5e: cc int3
// CHECK-NEXT: 5f: cc int3
-// CHECK-NEXT: 60: 4c 8b 1d b1 00 00 00 movq 177(%rip), %r11
+// CHECK-NEXT: 60: 4c 8b 1d 39 00 00 00 movq 57(%rip), %r11
// CHECK-NEXT: 67: e8 c4 ff ff ff callq -60 <.plt+0x20>
// CHECK-NEXT: 6c: e9 b1 ff ff ff jmp -79 <.plt+0x12>
// CHECK-NEXT: 71: 68 01 00 00 00 pushq $1
// CHECK-NEXT: 2d: cc int3
// CHECK-NEXT: 2e: cc int3
// CHECK-NEXT: 2f: cc int3
-// CHECK-NEXT: 30: 4c 8b 1d a9 00 00 00 movq 169(%rip), %r11
+// CHECK-NEXT: 30: 4c 8b 1d 31 00 00 00 movq 49(%rip), %r11
// CHECK-NEXT: 37: e9 d4 ff ff ff jmp -44 <.plt>
// CHECK-NEXT: 3c: cc int3
// CHECK-NEXT: 3d: cc int3
// CHECK-NEXT: 3e: cc int3
// CHECK-NEXT: 3f: cc int3
-// CHECK-NEXT: 40: 4c 8b 1d a1 00 00 00 movq 161(%rip), %r11
+// CHECK-NEXT: 40: 4c 8b 1d 29 00 00 00 movq 41(%rip), %r11
// CHECK-NEXT: 47: e9 c4 ff ff ff jmp -60 <.plt>
// CHECK-NEXT: 4c: cc int3
// CHECK-NEXT: 4d: cc int3