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
13 # CHECK: Name: .eh_frame
14 # CHECK-NEXT: Type: SHT_PROGBITS
16 # CHECK-NEXT: SHF_ALLOC
18 # CHECK-NEXT: Address: 0x1001
19 # CHECK-NEXT: Offset: 0x1001
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
30 # DFFFFFFF = _start(0x1000) - PC(.eh_frame(0x1001) + 0x20)
34 # CHECK: Name: .eh_frame_hdr
35 # CHECK-NEXT: Type: SHT_PROGBITS
37 # CHECK-NEXT: SHF_ALLOC
39 # CHECK-NEXT: Address: 0x1028
40 # CHECK-NEXT: Offset: 0x1028
41 # CHECK-NEXT: Size: 20
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)
60 .section .eh_frame,"a",@unwind
65 .byte 0x7A # Augmentation string: "zR"
75 .byte 0x1A # DW_EH_PE_pcrel | DW_EH_PE_sdata2