brintos

brintos / llvm-project-archived public Read only

0
0
Text · 7.5 KiB · 31ccd08 Raw
188 lines · plain
1# REQUIRES: x862 3# Test merging code sections with data sections.4 5# RUN: llvm-mc -triple x86_64-windows-msvc %s -filetype=obj -o %t.obj6# RUN: lld-link -machine:amd64 -dll -noentry -out:%t.dll %t.obj -merge:.testx=.testd -merge:.testx2=.testbss -merge:.testd2=.testx3 -merge:.testbss2=.testx47 8# RUN: llvm-readobj --sections %t.dll | FileCheck %s9# CHECK:      Sections [10# CHECK-NEXT:   Section {11# CHECK-NEXT:     Number: 112# CHECK-NEXT:     Name: .testbss (2E 74 65 73 74 62 73 73)13# CHECK-NEXT:     VirtualSize: 0x1814# CHECK-NEXT:     VirtualAddress: 0x100015# CHECK-NEXT:     RawDataSize: 51216# CHECK-NEXT:     PointerToRawData: 0x40017# CHECK-NEXT:     PointerToRelocations: 0x018# CHECK-NEXT:     PointerToLineNumbers: 0x019# CHECK-NEXT:     RelocationCount: 020# CHECK-NEXT:     LineNumberCount: 021# CHECK-NEXT:     Characteristics [ (0xC0000020)22# CHECK-NEXT:       IMAGE_SCN_CNT_CODE (0x20)23# CHECK-NEXT:       IMAGE_SCN_MEM_READ (0x40000000)24# CHECK-NEXT:       IMAGE_SCN_MEM_WRITE (0x80000000)25# CHECK-NEXT:     ]26# CHECK-NEXT:   }27# CHECK-NEXT:   Section {28# CHECK-NEXT:     Number: 229# CHECK-NEXT:     Name: .testd (2E 74 65 73 74 64 00 00)30# CHECK-NEXT:     VirtualSize: 0x1831# CHECK-NEXT:     VirtualAddress: 0x200032# CHECK-NEXT:     RawDataSize: 51233# CHECK-NEXT:     PointerToRawData: 0x60034# CHECK-NEXT:     PointerToRelocations: 0x035# CHECK-NEXT:     PointerToLineNumbers: 0x036# CHECK-NEXT:     RelocationCount: 037# CHECK-NEXT:     LineNumberCount: 038# CHECK-NEXT:     Characteristics [ (0x40000020)39# CHECK-NEXT:       IMAGE_SCN_CNT_CODE (0x20)40# CHECK-NEXT:       IMAGE_SCN_MEM_READ (0x40000000)41# CHECK-NEXT:     ]42# CHECK-NEXT:   }43# CHECK-NEXT:   Section {44# CHECK-NEXT:     Number: 345# CHECK-NEXT:     Name: .testx3 (2E 74 65 73 74 78 33 00)46# CHECK-NEXT:     VirtualSize: 0x1247# CHECK-NEXT:     VirtualAddress: 0x300048# CHECK-NEXT:     RawDataSize: 51249# CHECK-NEXT:     PointerToRawData: 0x80050# CHECK-NEXT:     PointerToRelocations: 0x051# CHECK-NEXT:     PointerToLineNumbers: 0x052# CHECK-NEXT:     RelocationCount: 053# CHECK-NEXT:     LineNumberCount: 054# CHECK-NEXT:     Characteristics [ (0x60000020)55# CHECK-NEXT:       IMAGE_SCN_CNT_CODE (0x20)56# CHECK-NEXT:       IMAGE_SCN_MEM_EXECUTE (0x20000000)57# CHECK-NEXT:       IMAGE_SCN_MEM_READ (0x40000000)58# CHECK-NEXT:     ]59# CHECK-NEXT:   }60# CHECK-NEXT:   Section {61# CHECK-NEXT:     Number: 462# CHECK-NEXT:     Name: .testx4 (2E 74 65 73 74 78 34 00)63# CHECK-NEXT:     VirtualSize: 0x1464# CHECK-NEXT:     VirtualAddress: 0x400065# CHECK-NEXT:     RawDataSize: 51266# CHECK-NEXT:     PointerToRawData: 0xA0067# CHECK-NEXT:     PointerToRelocations: 0x068# CHECK-NEXT:     PointerToLineNumbers: 0x069# CHECK-NEXT:     RelocationCount: 070# CHECK-NEXT:     LineNumberCount: 071# CHECK-NEXT:     Characteristics [ (0x60000020)72# CHECK-NEXT:       IMAGE_SCN_CNT_CODE (0x20)73# CHECK-NEXT:       IMAGE_SCN_MEM_EXECUTE (0x20000000)74# CHECK-NEXT:       IMAGE_SCN_MEM_READ (0x40000000)75# CHECK-NEXT:     ]76# CHECK-NEXT:   }77# CHECK-NEXT: ]78 79# RUN: llvm-objdump -d %t.dll | FileCheck -check-prefix=DISASM %s80# DISASM:      Disassembly of section .testbss:81# DISASM-EMPTY:82# DISASM-NEXT: 0000000180001000 <.testbss>:83# DISASM-NEXT: 180001000: 00 00                        addb    %al, (%rax)84# DISASM-NEXT: 180001002: 00 00                        addb    %al, (%rax)85# DISASM-NEXT: 180001004: cc                           int386# DISASM-NEXT: 180001005: cc                           int387# DISASM-NEXT: 180001006: cc                           int388# DISASM-NEXT: 180001007: cc                           int389# DISASM-NEXT: 180001008: cc                           int390# DISASM-NEXT: 180001009: cc                           int391# DISASM-NEXT: 18000100a: cc                           int392# DISASM-NEXT: 18000100b: cc                           int393# DISASM-NEXT: 18000100c: cc                           int394# DISASM-NEXT: 18000100d: cc                           int395# DISASM-NEXT: 18000100e: cc                           int396# DISASM-NEXT: 18000100f: cc                           int397# DISASM-NEXT: 180001010: 48 c7 c0 02 00 00 00         movq    $0x2, %rax98# DISASM-NEXT: 180001017: c3                           retq99# DISASM-EMPTY:100# DISASM-NEXT: Disassembly of section .testd:101# DISASM-EMPTY:102# DISASM-NEXT: 0000000180002000 <.testd>:103# DISASM-NEXT: 180002000: 01 00                        addl    %eax, (%rax)104# DISASM-NEXT: 180002002: cc                           int3105# DISASM-NEXT: 180002003: cc                           int3106# DISASM-NEXT: 180002004: cc                           int3107# DISASM-NEXT: 180002005: cc                           int3108# DISASM-NEXT: 180002006: cc                           int3109# DISASM-NEXT: 180002007: cc                           int3110# DISASM-NEXT: 180002008: cc                           int3111# DISASM-NEXT: 180002009: cc                           int3112# DISASM-NEXT: 18000200a: cc                           int3113# DISASM-NEXT: 18000200b: cc                           int3114# DISASM-NEXT: 18000200c: cc                           int3115# DISASM-NEXT: 18000200d: cc                           int3116# DISASM-NEXT: 18000200e: cc                           int3117# DISASM-NEXT: 18000200f: cc                           int3118# DISASM-NEXT: 180002010: 48 c7 c0 01 00 00 00         movq    $0x1, %rax119# DISASM-NEXT: 180002017: c3                           retq120# DISASM-EMPTY:121# DISASM-NEXT: Disassembly of section .testx3:122# DISASM-EMPTY:123# DISASM-NEXT: 0000000180003000 <.testx3>:124# DISASM-NEXT: 180003000: 48 c7 c0 03 00 00 00         movq    $0x3, %rax125# DISASM-NEXT: 180003007: c3                           retq126# DISASM-NEXT: 180003008: cc                           int3127# DISASM-NEXT: 180003009: cc                           int3128# DISASM-NEXT: 18000300a: cc                           int3129# DISASM-NEXT: 18000300b: cc                           int3130# DISASM-NEXT: 18000300c: cc                           int3131# DISASM-NEXT: 18000300d: cc                           int3132# DISASM-NEXT: 18000300e: cc                           int3133# DISASM-NEXT: 18000300f: cc                           int3134# DISASM-NEXT: 180003010: 02 00                        addb    (%rax), %al135# DISASM-EMPTY:136# DISASM-NEXT: Disassembly of section .testx4:137# DISASM-EMPTY:138# DISASM-NEXT: 0000000180004000 <.testx4>:139# DISASM-NEXT: 180004000: 48 c7 c0 04 00 00 00         movq    $0x4, %rax140# DISASM-NEXT: 180004007: c3                           retq141# DISASM-NEXT: 180004008: cc                           int3142# DISASM-NEXT: 180004009: cc                           int3143# DISASM-NEXT: 18000400a: cc                           int3144# DISASM-NEXT: 18000400b: cc                           int3145# DISASM-NEXT: 18000400c: cc                           int3146# DISASM-NEXT: 18000400d: cc                           int3147# DISASM-NEXT: 18000400e: cc                           int3148# DISASM-NEXT: 18000400f: cc                           int3149# DISASM-NEXT: 180004010: 00 00                        addb    %al, (%rax)150# DISASM-NEXT: 180004012: 00 00                        addb    %al, (%rax)151 152 153        .section .testx, "xr"154        .p2align 4155        movq $1, %rax156        retq157 158        .section .testx2, "xr"159        .p2align 4160        movq $2, %rax161        retq162 163        .section .testd, "dr"164        .p2align 4165        .word 1166 167        .section .testbss, "b"168        .p2align 4169        .skip 4170 171        .section .testx3, "xr"172        .p2align 4173        movq $3, %rax174        retq175 176        .section .testx4, "xr"177        .p2align 4178        movq $4, %rax179        retq180 181        .section .testd2, "dr"182        .p2align 4183        .word 2184 185        .section .testbss2, "b"186        .p2align 4187        .skip 4188