Files
clang-p2996/lld/test/COFF/debug-reloc.s
Martin Storsjo a55fc71614 [COFF] Write the debug directory and build id to a separate section for MinGW
For dwarf debug info, an executable normally either contains the debug
info, or it is stripped out. To reduce the storage needed (slightly)
for the debug info kept separately from the released, stripped binaries,
one can choose to only copy the debug data from the original executable
(essentially the reverse of the strip operation), producing a file with
only debug info.

When copying the debug data from an executable with GNU objcopy,
the build id and debug directory need to reside in a separate section,
as this will be kept while the rest of the .rdata section is removed.

Differential Revision: https://reviews.llvm.org/D49352

llvm-svn: 337526
2018-07-20 05:44:34 +00:00

59 lines
1.5 KiB
ArmAsm

# REQUIRES: x86
# RUN: llvm-mc -triple=x86_64-windows-gnu %s -filetype=obj -o %t.obj
# RUN: lld-link -lldmingw -debug:dwarf -out:%t.exe -entry:mainfunc -subsystem:console %t.obj
# RUN: llvm-readobj -sections %t.exe | FileCheck %s -check-prefix SECTIONS
# RUN: llvm-readobj -coff-basereloc %t.exe | FileCheck %s -check-prefix RELOCS
# RUN: llvm-readobj -file-headers %t.exe | FileCheck %s -check-prefix HEADERS
# RUN: llvm-readobj -coff-debug-directory %t.exe | FileCheck %s -check-prefix DEBUG
# SECTIONS: Number: 2
# SECTIONS-NEXT: Name: .buildid (2E 62 75 69 6C 64 69 64)
# SECTIONS-NEXT: VirtualSize: 0x35
# SECTIONS-NEXT: VirtualAddress: 0x2000
# SECTIONS: Number: 3
# SECTIONS-NEXT: Name: .data (2E 64 61 74 61 00 00 00)
# SECTIONS-NEXT: VirtualSize: 0x8
# SECTIONS-NEXT: VirtualAddress: 0x3000
# RELOCS: BaseReloc [
# RELOCS-NEXT: Entry {
# RELOCS-NEXT: Type: DIR64
# RELOCS-NEXT: Address: 0x3000
# RELOCS-NEXT: }
# RELOCS-NEXT: Entry {
# RELOCS-NEXT: Type: ABSOLUTE
# RELOCS-NEXT: Address: 0x3000
# RELOCS-NEXT: }
# RELOCS-NEXT: ]
# HEADERS: DebugRVA: 0x2000
# HEADERS: DebugSize: 0x1C
# DEBUG: DebugDirectory [
# DEBUG: DebugEntry {
# DEBUG: Type: CodeView (0x2)
# DEBUG: SizeOfData: 0x19
# DEBUG: AddressOfRawData: 0x201C
# DEBUG: PointerToRawData: 0x61C
.text
.def mainfunc;
.scl 2;
.type 32;
.endef
.globl mainfunc
mainfunc:
.Lfunc_begin0:
xorl %eax, %eax
retq
.data
.globl ptr
ptr:
.quad mainfunc
.section .debug_info,"dr"
.quad .Lfunc_begin0