41 lines · plain
1## Check how the PointerToRawData field is set for empty sections.2##3## Some tools may leave it set to a nonzero value, while others4## set it to zero. Currently, the LLVM MC layer produces a .data5## section with a nonzero PointerToRawData value, even if no6## .data section needs to be emitted. Other tools, such as yaml2obj7## writes a zero field if there's no data.8##9## When llvm-objcopy copies object files, it either needs to10## update the value to a valid value (within the bounds of the11## file, even if the section is empty) or zero. Some tools12## (such as obj2yaml or llvm-objcopy) can error out if the value13## is out of bounds.14##15## Check that our input file has got a nonzero field, and that16## it is set to zero after a run with llvm-objcopy.17 18# REQUIRES: x86-registered-target19 20# RUN: llvm-mc -triple x86_64-pc-win32 -filetype=obj %s -o %t.in.obj21# RUN: llvm-readobj --sections %t.in.obj | FileCheck %s --check-prefix=INPUT22# RUN: llvm-objcopy --remove-section=.bss %t.in.obj %t.out.obj23# RUN: llvm-readobj --sections %t.out.obj | FileCheck %s --check-prefix=OUTPUT24 25# INPUT: Name: .data26# INPUT-NEXT: VirtualSize: 0x027# INPUT-NEXT: VirtualAddress: 0x028# INPUT-NEXT: RawDataSize: 029# INPUT-NEXT: PointerToRawData: 0x8D30 31# OUTPUT: Name: .data32# OUTPUT-NEXT: VirtualSize: 0x033# OUTPUT-NEXT: VirtualAddress: 0x034# OUTPUT-NEXT: RawDataSize: 035# OUTPUT-NEXT: PointerToRawData: 0x0{{$}}36 37 .text38 .globl func39func:40 ret41