1## Check how the PointerToRawData field is set for empty sections. 2## 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. 8## 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 13## is out of bounds. 14## 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. 17 18# REQUIRES: x86-registered-target 19 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 24 25# INPUT: Name: .data 26# INPUT-NEXT: VirtualSize: 0x0 27# INPUT-NEXT: VirtualAddress: 0x0 28# INPUT-NEXT: RawDataSize: 0 29# INPUT-NEXT: PointerToRawData: 0x8D 30 31# OUTPUT: Name: .data 32# OUTPUT-NEXT: VirtualSize: 0x0 33# OUTPUT-NEXT: VirtualAddress: 0x0 34# OUTPUT-NEXT: RawDataSize: 0 35# OUTPUT-NEXT: PointerToRawData: 0x0{{$}} 36 37 .text 38 .globl func 39func: 40 ret 41