[ELF] Make section member orders consistent
[llvm-project.git] / lld / test / ELF / merge-reloc.s
blob044fef5ab4f26a7afc426fcaa9b98999679bcf23
1 # REQUIRES: x86
2 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
3 # RUN: ld.lld %t.o -r -o %t.ro
4 # RUN: llvm-readelf -S %t.ro | FileCheck %s
5 # RUN: llvm-objdump -s %t.ro | FileCheck %s --check-prefix=OBJDUMP
7 # RUN: ld.lld %t.o -o %t
8 # RUN: llvm-readelf -S %t | FileCheck %s --check-prefix=CHECK-PDE
10 # CHECK: [Nr] Name Type Address Off Size ES Flg Lk Inf Al
11 # CHECK-NEXT: [ 0] NULL 0000000000000000 000000 000000 00 0 0 0
12 # CHECK-NEXT: [ 1] .text PROGBITS 0000000000000000 000040 000000 00 AX 0 0 4
13 # CHECK-NEXT: [ 2] .rodata.1 PROGBITS 0000000000000000 000040 000004 04 AM 0 0 4
14 # CHECK-NEXT: [ 3] .rodata.2 PROGBITS 0000000000000000 000048 000008 08 AM 0 0 8
15 # CHECK-NEXT: [ 4] .rodata.cst8 PROGBITS 0000000000000000 000050 000010 00 AM 0 0 1
16 # CHECK-NEXT: [ 5] .rela.rodata.cst8 RELA 0000000000000000 000068 000030 18 I 9 4 8
17 # CHECK-NEXT: [ 6] .cst4 PROGBITS 0000000000000000 000060 000008 00 AM 0 0 1
18 # CHECK-NEXT: [ 7] .rela.cst4 RELA 0000000000000000 000098 000030 18 I 9 6 8
20 # OBJDUMP: Contents of section .rodata.1:
21 # OBJDUMP-NEXT: 0000 42000000 B...
22 # OBJDUMP-NEXT: Contents of section .rodata.2:
23 # OBJDUMP-NEXT: 0000 42000000 42000000 B...B...
24 # OBJDUMP-NEXT: Contents of section .rodata.cst8:
25 # OBJDUMP-NEXT: 0000 00000000 00000000 00000000 00000000 ................
26 # OBJDUMP: Contents of section .cst4:
27 # OBJDUMP-NEXT: 0000 00000000 00000000 ........
29 # CHECK-PDE: [ 2] .cst4 PROGBITS 0000000000200140 000140 000008 00 AM 0 0 1
31 foo:
33 .section .rodata.1,"aM",@progbits,4
34 .align 4
35 .long 0x42
36 .long 0x42
37 .long 0x42
39 .section .rodata.2,"aM",@progbits,8
40 .align 8
41 .long 0x42
42 .long 0x42
43 .long 0x42
44 .long 0x42
46 ## Test that we keep a SHT_REL[A] section which relocates a SHF_MERGE section
47 ## in -r mode. The relocated SHF_MERGE section is handled as non-mergeable.
48 .section .rodata.cst8,"aM",@progbits,8,unique,0
49 .quad foo
51 .section .rodata.cst8,"aM",@progbits,8,unique,1
52 .quad foo
54 .section .cst4,"aM",@progbits,4,unique,0
55 .long foo
56 .section .cst4,"aM",@progbits,4,unique,1
57 .long foo