85 changes: 85 additions & 0 deletions llvm/test/ExecutionEngine/JITLink/X86/COFF_addr32nb_reloc.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# RUN: yaml2obj %s -o %t
# RUN: llvm-jitlink -noexec -abs __ImageBase=0xfff00000 \
# RUN: -slab-allocate 100Kb -slab-address 0xfff00000 -slab-page-size 4096 \
# RUN: -check %s %t
#
# Check IMAGE_REL_AMD64_ADDR32NB relocation properly sets the delta of target
# from imagebase.
#
# jitlink-check: *{4}(pdata) = func - __ImageBase
--- !COFF
header:
Machine: IMAGE_FILE_MACHINE_AMD64
Characteristics: [ ]
sections:
- Name: .text
Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
Alignment: 16
SectionData: '0000000000000000'
- Name: .func
Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
Alignment: 16
SectionData: '0000000000000000'
- Name: .pdata
Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
Alignment: 4
SectionData: '0000000000000000'
Relocations:
- VirtualAddress: 0
SymbolTableIndex: 7
Type: IMAGE_REL_AMD64_ADDR32NB
symbols:
- Name: .text
Value: 0
SectionNumber: 1
SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_NULL
StorageClass: IMAGE_SYM_CLASS_STATIC
SectionDefinition:
Length: 8
NumberOfRelocations: 0
CheckSum: 0
NumberOfLinenumbers: 0
Number: 1
- Name: .func
Value: 0
SectionNumber: 2
SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_NULL
StorageClass: IMAGE_SYM_CLASS_STATIC
SectionDefinition:
Length: 8
NumberOfRelocations: 0
CheckSum: 0
NumberOfLinenumbers: 0
Number: 2
- Name: .pdata
Value: 0
SectionNumber: 3
SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_NULL
StorageClass: IMAGE_SYM_CLASS_STATIC
SectionDefinition:
Length: 8
NumberOfRelocations: 1
CheckSum: 0
NumberOfLinenumbers: 0
Number: 3
- Name: main
Value: 0
SectionNumber: 1
SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_FUNCTION
StorageClass: IMAGE_SYM_CLASS_EXTERNAL
- Name: func
Value: 0
SectionNumber: 2
SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_FUNCTION
StorageClass: IMAGE_SYM_CLASS_EXTERNAL
- Name: pdata
Value: 0
SectionNumber: 3
SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_FUNCTION
StorageClass: IMAGE_SYM_CLASS_EXTERNAL
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# RUN: yaml2obj %s -o %t
# RUN: llvm-jitlink -noexec -abs __ImageBase=0xfff00000 \
# RUN: -slab-allocate 100Kb -slab-address 0xfff00000 -slab-page-size 4096 \
# RUN: -check %s %t
#
# Check IMAGE_REL_AMD64_ADDR32NB relocation properly sets the delta of target
# from imagebase with a negative addend.
#
# jitlink-check: *{4}(pdata) = func - __ImageBase - 4
--- !COFF
header:
Machine: IMAGE_FILE_MACHINE_AMD64
Characteristics: [ ]
sections:
- Name: .text
Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
Alignment: 16
SectionData: '000000000000000B'
- Name: .func
Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
Alignment: 16
SectionData: '000000000000000A'
- Name: .pdata
Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
Alignment: 4
SectionData: 'FCFFFFFF00000000'
Relocations:
- VirtualAddress: 0
SymbolTableIndex: 7
Type: IMAGE_REL_AMD64_ADDR32NB
symbols:
- Name: .text
Value: 0
SectionNumber: 1
SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_NULL
StorageClass: IMAGE_SYM_CLASS_STATIC
SectionDefinition:
Length: 8
NumberOfRelocations: 0
CheckSum: 0
NumberOfLinenumbers: 0
Number: 1
- Name: .func
Value: 0
SectionNumber: 2
SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_NULL
StorageClass: IMAGE_SYM_CLASS_STATIC
SectionDefinition:
Length: 8
NumberOfRelocations: 0
CheckSum: 0
NumberOfLinenumbers: 0
Number: 2
- Name: .pdata
Value: 0
SectionNumber: 3
SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_NULL
StorageClass: IMAGE_SYM_CLASS_STATIC
SectionDefinition:
Length: 8
NumberOfRelocations: 1
CheckSum: 0
NumberOfLinenumbers: 0
Number: 3
- Name: main
Value: 0
SectionNumber: 1
SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_FUNCTION
StorageClass: IMAGE_SYM_CLASS_EXTERNAL
- Name: func
Value: 0
SectionNumber: 2
SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_FUNCTION
StorageClass: IMAGE_SYM_CLASS_EXTERNAL
- Name: pdata
Value: 0
SectionNumber: 3
SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_FUNCTION
StorageClass: IMAGE_SYM_CLASS_EXTERNAL
29 changes: 0 additions & 29 deletions llvm/test/ExecutionEngine/JITLink/X86/COFF_basic.s

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
#
# CHECK: section weakfunc:
# CHECK-EMPTY:
# CHECK-NEXT: block 0xfff02000 size = 0x00000001, align = 16, alignment-offset = 0
# CHECK-NEXT: block 0xfff01000 size = 0x00000001, align = 16, alignment-offset = 0
# CHECK-NEXT: symbols:
# CHECK-NEXT: 0xfff02000 (block + 0x00000000): size: 0x00000001, linkage: weak, scope: default, live - func
# CHECK-NEXT: 0xfff01000 (block + 0x00000000): size: 0x00000001, linkage: weak, scope: default, live - func
# CHECK-NEXT: no edges

.text
Expand Down
20 changes: 0 additions & 20 deletions llvm/test/ExecutionEngine/JITLink/X86/COFF_external_func.s

This file was deleted.

8 changes: 3 additions & 5 deletions llvm/test/ExecutionEngine/JITLink/X86/COFF_external_var.s
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
# REQUIRES: asserts
# RUN: llvm-mc -filetype=obj -triple=x86_64-windows-msvc %s -o %t
# RUN: llvm-jitlink -abs var=0xcafef00d --debug-only=jitlink -noexec %t 2>&1 | FileCheck %s
# RUN: not llvm-jitlink -slab-allocate 100Kb -slab-address 0xfff00000 -slab-page-size 4096 \
# RUN: -abs var=0x7fff00000000 -noexec %t
#
# Check an external symbol to a variable is created.
# Check data access to a external variable out of reach causes an error.
#
# CHECK: Creating graph symbols...
# CHECK: 7: Creating external graph symbol for COFF symbol "var" in (external) (index: 0)

.text

Expand Down
3 changes: 1 addition & 2 deletions llvm/test/ExecutionEngine/JITLink/X86/COFF_file_debug.s
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Check a file debug symbol is skipped.
#
# CHECK: Creating graph symbols...
# CHECK: 8: Skipping FileRecord symbol ".file" in (debug) (index: -2)
# CHECK: 7: Skipping FileRecord symbol ".file" in (debug) (index: -2)

.text

Expand All @@ -18,5 +18,4 @@
.globl main
.p2align 4, 0x90
main:
callq func
retq
Original file line number Diff line number Diff line change
Expand Up @@ -40,26 +40,6 @@ test_rel32_func:
test_rel32_data:
leaq named_data(%rip), %rax

# Check that calls to external functions out-of-range from the callsite trigger
# the generation of stubs and GOT entries. This produces a BranchPCRel32 edge,
# but STUB table manager will create a STUB sequence because external function
# is out-of-range from the callsite.
#
# jitlink-check: decode_operand(test_call_extern_out_of_range32, 0) = \
# jitlink-check: stub_addr(coff_sm_reloc.o, extern_out_of_range32) - \
# jitlink-check: next_pc(test_call_extern_out_of_range32)
# jitlink-check: *{8}(got_addr(coff_sm_reloc.o, extern_out_of_range32)) = \
# jitlink-check: extern_out_of_range32
.def test_call_extern_out_of_range32;
.scl 2;
.type 32;
.endef
.globl main
.p2align 4, 0x90
test_call_extern_out_of_range32:
callq extern_out_of_range32
retq

# Local named data/func that is used in conjunction with other test cases
.text
.def named_func;
Expand Down