Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / ELF / eh-frame-negative-pcrel-sdata8.s
blob794258f75803fd86c44eda952b7719adc59a2a5a
1 # REQUIRES: x86
3 # Test handling of FDE pc negative relative addressing with DW_EH_PE_sdata8.
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: 1C000000 10000000 18000000 E3FFFFFF
28 # CHECK-NEXT: 0020: FFFFFFFF 00000000 00000000
29 # ^
30 # E3FFFFFF FFFFFFFF = _start(0x1000) - PC(.eh_frame(0x1001) + 0x1C)
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: 0x1030
40 # CHECK-NEXT: Offset: 0x1030
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 CDFFFFFF 01000000 D0FFFFFF
48 # CHECK-NEXT: 0010: E5FFFFFF
49 # Header (always 4 bytes): 011B033B
50 # CDFFFFFF = .eh_frame(0x1001) - .eh_frame_hdr(0x1030) - 4
51 # 01000000 = 1 = the number of FDE pointers in the table.
52 # D0FFFFFF = _start(0x1000) - .eh_frame_hdr(0x1030)
53 # E5FFFFFF = FDE(.eh_frame(0x1001) + 0x18) - .eh_frame_hdr(0x1030)
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 0x1C # DW_EH_PE_pcrel | DW_EH_PE_sdata8
77 .byte 0x00
78 .byte 0x00
79 .byte 0x00
81 .long 16 # Size
82 .long 24 # ID
83 fde:
84 .quad _start - fde
85 .long 0