hanchenye-llvm-project/lld/test/pecoff/base-reloc.test

52 lines
2.1 KiB
Plaintext

# RUN: yaml2obj %p/Inputs/hello.obj.yaml > %t.obj
#
# RUN: lld -flavor link /out:%t1.exe /subsystem:console /force /opt:noref \
# RUN: -- %t.obj
# RUN: llvm-objdump -s %t1.exe | FileCheck %s --check-prefix=BASEREL-SECTION
#
# RUN: lld -flavor link /out:%t2.exe /subsystem:console /force /fixed \
# RUN: /opt:noref -- %t.obj
# RUN: llvm-objdump -s %t2.exe | FileCheck %s --check-prefix=NOBASEREL-SECTION
# Because llvm-objdump cannot pretty-print the contents of .reloc section, we
# have no choice other than comparing the result with this binary blob.
#
# TODO: Improve llvm-objdump to pretty print .reloc section as GNU binutil
# objdump does.
BASEREL-SECTION: Contents of section .reloc:
BASEREL-SECTION-NEXT: 3000 00200000 0c000000 07300c30
NOBASEREL-SECTION-NOT: Contents of section .reloc:
# RUN: lld -flavor link /out:%t3.exe /subsystem:console /force /opt:noref \
# RUN: -- %t.obj
# RUN: llvm-readobj -file-headers -sections %t3.exe | FileCheck %s \
# RUN: --check-prefix=BASEREL-HEADER
#
# RUN: lld -flavor link /out:%t4.exe /subsystem:console /force /opt:noref \
# RUN: /fixed -- %t.obj
# RUN: llvm-readobj -file-headers %t4.exe | FileCheck %s \
# RUN: --check-prefix=NOBASEREL-HEADER
BASEREL-HEADER-NOT: IMAGE_FILE_RELOCS_STRIPPED
NOBASEREL-HEADER: IMAGE_FILE_RELOCS_STRIPPED
BASEREL-HEADER: BaseRelocationTableRVA: 0x3000
BASEREL-HEADER: BaseRelocationTableSize: 0xC
BASEREL-HEADER: Name: .reloc (2E 72 65 6C 6F 63 00 00)
BASEREL-HEADER-NEXT: VirtualSize: 0xC
BASEREL-HEADER-NEXT: VirtualAddress: 0x3000
BASEREL-HEADER-NEXT: RawDataSize: 12
BASEREL-HEADER-NEXT: PointerToRawData: 0x600
BASEREL-HEADER-NEXT: PointerToRelocations: 0x0
BASEREL-HEADER-NEXT: PointerToLineNumbers: 0x0
BASEREL-HEADER-NEXT: RelocationCount: 0
BASEREL-HEADER-NEXT: LineNumberCount: 0
BASEREL-HEADER-NEXT: Characteristics [ (0x42000040)
BASEREL-HEADER-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA (0x40)
BASEREL-HEADER-NEXT: IMAGE_SCN_MEM_DISCARDABLE (0x2000000)
BASEREL-HEADER-NEXT: IMAGE_SCN_MEM_READ (0x40000000)
BASEREL-HEADER-NEXT: ]