1 ## Check how the PointerToRawData field is set for empty sections.
3 ## Some tools may leave it set to a nonzero value, while others
4 ## set it to zero. Currently, the LLVM MC layer produces a .data
5 ## section with a nonzero PointerToRawData value, even if no
6 ## .data section needs to be emitted. Other tools, such as yaml2obj
7 ## writes a zero field if there's no data.
9 ## When llvm-objcopy copies object files, it either needs to
10 ## update the value to a valid value (within the bounds of the
11 ## file, even if the section is empty) or zero. Some tools
12 ## (such as obj2yaml or llvm-objcopy) can error out if the value
15 ## Check that our input file has got a nonzero field, and that
16 ## it is set to zero after a run with llvm-objcopy.
18 # REQUIRES: x86-registered-target
20 # RUN: llvm-mc -triple x86_64-pc-win32 -filetype=obj %s -o %t.in.obj
21 # RUN: llvm-readobj --sections %t.in.obj | FileCheck %s --check-prefix=INPUT
22 # RUN: llvm-objcopy --remove-section=.bss %t.in.obj %t.out.obj
23 # RUN: llvm-readobj --sections %t.out.obj | FileCheck %s --check-prefix=OUTPUT
26 # INPUT-NEXT: VirtualSize: 0x0
27 # INPUT-NEXT: VirtualAddress: 0x0
28 # INPUT-NEXT: RawDataSize: 0
29 # INPUT-NEXT: PointerToRawData: 0x8D
32 # OUTPUT-NEXT: VirtualSize: 0x0
33 # OUTPUT-NEXT: VirtualAddress: 0x0
34 # OUTPUT-NEXT: RawDataSize: 0
35 # OUTPUT-NEXT: PointerToRawData: 0x0{{$}}