[ELF] Make section member orders consistent
[llvm-project.git] / lld / test / ELF / eh-frame-negative-pcrel-sdata2.s
blob72325bbf14407785ee86af3ea5b4805775a2c220
1 # REQUIRES: x86
3 # Test handling of FDE pc negative relative addressing with DW_EH_PE_sdata2.
4 # This situation can arise when .eh_frame is placed after .text.
6 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
7 # RUN: echo "SECTIONS { .text : { *(.text) } .eh_frame : { *(.eh_frame) } }" > %t.script
8 # RUN: ld.lld --eh-frame-hdr --script %t.script --section-start .text=0x1000 %t.o -o %t
9 # RUN: llvm-readobj -S --section-data %t | FileCheck %s
11 # CHECK: Section {
12 # CHECK: Index:
13 # CHECK: Name: .eh_frame
14 # CHECK-NEXT: Type: SHT_PROGBITS
15 # CHECK-NEXT: Flags [
16 # CHECK-NEXT: SHF_ALLOC
17 # CHECK-NEXT: ]
18 # CHECK-NEXT: Address: 0x1001
19 # CHECK-NEXT: Offset: 0x1001
20 # CHECK-NEXT: Size:
21 # CHECK-NEXT: Link:
22 # CHECK-NEXT: Info:
23 # CHECK-NEXT: AddressAlignment:
24 # CHECK-NEXT: EntrySize:
25 # CHECK-NEXT: SectionData (
26 # CHECK-NEXT: 0000: 10000000 00000000 017A5200 01010101
27 # CHECK-NEXT: 0010: 1A000000 0A000000 18000000 E3FFFFFF
28 # CHECK-NEXT: 0020: 00000000 0000
29 # ^
30 # DFFFFFFF = _start(0x1000) - PC(.eh_frame(0x1001) + 0x20)
32 # CHECK: Section {
33 # CHECK: Index:
34 # CHECK: Name: .eh_frame_hdr
35 # CHECK-NEXT: Type: SHT_PROGBITS
36 # CHECK-NEXT: Flags [
37 # CHECK-NEXT: SHF_ALLOC
38 # CHECK-NEXT: ]
39 # CHECK-NEXT: Address: 0x1028
40 # CHECK-NEXT: Offset: 0x1028
41 # CHECK-NEXT: Size: 20
42 # CHECK-NEXT: Link: 0
43 # CHECK-NEXT: Info: 0
44 # CHECK-NEXT: AddressAlignment: 4
45 # CHECK-NEXT: EntrySize: 0
46 # CHECK-NEXT: SectionData (
47 # CHECK-NEXT: 0000: 011B033B D5FFFFFF 01000000 D8FFFFFF
48 # CHECK-NEXT: 0010: EDFFFFFF
49 # Header (always 4 bytes): 011B033B
50 # D5FFFFFF = .eh_frame(0x1001) - .eh_frame_hdr(0x1028) - 4
51 # 01000000 = 1 = the number of FDE pointers in the table.
52 # D8FFFFFF = _start(0x1000) - .eh_frame_hdr(0x1028)
53 # EDFFFFFF = FDE(.eh_frame(0x1001) + 0x18) - .eh_frame_hdr(0x1028)
55 .text
56 .global _start
57 _start:
58 nop
60 .section .eh_frame,"a",@unwind
61 .long 16 # Size
62 .long 0x00 # ID
63 .byte 0x01 # Version.
65 .byte 0x7A # Augmentation string: "zR"
66 .byte 0x52
67 .byte 0x00
69 .byte 0x01
71 .byte 0x01 # LEB128
72 .byte 0x01 # LEB128
74 .byte 0x01 # LEB128
75 .byte 0x1A # DW_EH_PE_pcrel | DW_EH_PE_sdata2
77 .byte 0x00
78 .byte 0x00
79 .byte 0x00
81 .long 10 # Size
82 .long 24 # ID
83 fde:
84 .long _start - fde
85 .word 0