123 lines · plain
1// Verify the .fix data section conveys the right offsets and the right relocations2// RUN: llvm-mc -filetype=obj -triple x86_64-pc-win32 %s -o - | llvm-readobj -r --expand-relocs -S --section-data - | FileCheck %s --check-prefix=READOBJ3 4 .text5 .section .rdata,"dr"6 .globl g1 # @g17 .align 48g1:9 .long 1 # 0x110 11 .globl g2 # @g212 .align 413g2:14 .long 2 # 0x215 16 .globl g3 # @g317 .align 418g3:19 .long 3 # 0x320 21 .globl g4 # @g422 .align 423g4:24 .long 4 # 0x425 26 .section .fix,"dw"27 .globl t1 # @t128 .align 829t1:30 31 .globl t2 # @t232 .align 833t2:34 35 .globl t3 # @t336 .align 837t3:38 39 .globl t4 # @t440 .align 441t4:42 .long g3-t443 44 .globl t5 # @t545 .align 446t5:47 .long g3@IMGREL48 49 .globl t6 # @t650 .align 1651t6:52 .ascii "\001\002"53 .zero 654 .quad 256 # 0x10055 .long g3-(t6+16)56 .zero 457 58.long foobar - .59 60// As an extension, we allow 64-bit label differences. They lower to61// IMAGE_REL_AMD64_REL32 because IMAGE_REL_AMD64_REL64 does not exist.62.quad foobar - .63 64// READOBJ: Section {65// READOBJ: Number:66// READOBJ: Name: .fix (2E 66 69 78 00 00 00 00)67// READOBJ-NEXT: VirtualSize: 0x068// READOBJ-NEXT: VirtualAddress: 0x069// READOBJ-NEXT: RawDataSize:70// READOBJ-NEXT: PointerToRawData: 0xEC71// READOBJ-NEXT: PointerToRelocations:72// READOBJ-NEXT: PointerToLineNumbers: 0x073// READOBJ-NEXT: RelocationCount:74// READOBJ-NEXT: LineNumberCount: 075// READOBJ-NEXT: Characteristics [ (0xC0500040)76// READOBJ-NEXT: IMAGE_SCN_ALIGN_16BYTES (0x500000)77// READOBJ-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA (0x40)78// READOBJ-NEXT: IMAGE_SCN_MEM_READ (0x40000000)79// READOBJ-NEXT: IMAGE_SCN_MEM_WRITE (0x80000000)80// READOBJ-NEXT: ]81// READOBJ-NEXT: SectionData (82// READOBJ-NEXT: 0000: 04000000 00000000 00000000 00000000 |83// READOBJ-NEXT: 0010: 01020000 00000000 00010000 00000000 |84// READOBJ-NEXT: 0020: 04000000 00000000 04000000 04000000 |85// READOBJ-NEXT: 0030: 00000000 |86// READOBJ-NEXT: )87// READOBJ-NEXT: }88// READOBJ-NEXT: ]89// READOBJ-NEXT: Relocations [90// READOBJ-NEXT: Section (5) .fix {91// READOBJ-NEXT: Relocation {92// READOBJ-NEXT: Offset: 0x093// READOBJ-NEXT: Type: IMAGE_REL_AMD64_REL32 (4)94// READOBJ-NEXT: Symbol: g395// READOBJ-NEXT: SymbolIndex: 1296// READOBJ-NEXT: }97// READOBJ-NEXT: Relocation {98// READOBJ-NEXT: Offset: 0x499// READOBJ-NEXT: Type: IMAGE_REL_AMD64_ADDR32NB (3)100// READOBJ-NEXT: Symbol: g3101// READOBJ-NEXT: SymbolIndex: 12102// READOBJ-NEXT: }103// READOBJ-NEXT: Relocation {104// READOBJ-NEXT: Offset: 0x20105// READOBJ-NEXT: Type: IMAGE_REL_AMD64_REL32 (4)106// READOBJ-NEXT: Symbol: g3107// READOBJ-NEXT: SymbolIndex: 12108// READOBJ-NEXT: }109// READOBJ-NEXT: Relocation {110// READOBJ-NEXT: Offset: 0x28111// READOBJ-NEXT: Type: IMAGE_REL_AMD64_REL32 (4)112// READOBJ-NEXT: Symbol: foobar113// READOBJ-NEXT: SymbolIndex: 20114// READOBJ-NEXT: }115// READOBJ-NEXT: Relocation {116// READOBJ-NEXT: Offset: 0x2C117// READOBJ-NEXT: Type: IMAGE_REL_AMD64_REL32 (4)118// READOBJ-NEXT: Symbol: foobar119// READOBJ-NEXT: SymbolIndex: 20120// READOBJ-NEXT: }121// READOBJ-NEXT: }122// READOBJ-NEXT:]123