Imported Upstream version 5.18.0.167

Former-commit-id: 289509151e0fee68a1b591a20c9f109c3c789d3a
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-10-20 08:25:10 +00:00
parent e19d552987
commit b084638f15
28489 changed files with 184 additions and 3866856 deletions

View File

@ -1,85 +0,0 @@
// RUN: llvm-mc -triple i686-windows -filetype obj -o %t.obj %s
// RUN: llvm-rtdyld -triple i686-windows -dummy-extern _printf=0x7ffffffd -dummy-extern _OutputDebugStringA@4=0x7ffffffe -dummy-extern _ExitProcess@4=0x7fffffff -verify -check=%s %t.obj
.text
.def _main
.scl 2
.type 32
.endef
.global _main
_main:
rel1:
call _function // IMAGE_REL_I386_REL32
# rtdyld-check: decode_operand(rel1, 0) = (_function-_main-4-1)
xorl %eax, %eax
rel12:
jmp _printf
# rtdyld-check: decode_operand(rel12, 0)[31:0] = (_printf-_main-4-8)
.def _function
.scl 2
.type 32
.endef
_function:
rel2:
pushl string
rel3:
calll *__imp__OutputDebugStringA // IMAGE_REL_I386_DIR32
# rtdyld-check: decode_operand(rel3, 3) = __imp__OutputDebugStringA
addl $4, %esp
pushl $0
rel4:
calll *__imp__ExitProcess // IMAGE_REL_I386_DIR32
# rtdyld-check: decode_operand(rel4, 3) = __imp__ExitProcess
addl $4, %esp
retl
.data
.global __imp__OutputDebugStringA
.align 4
__imp__OutputDebugStringA:
.long "_OutputDebugStringA@4" // IMAGE_REL_I386_DIR32
# rtdyld-check: *{4}__imp__OutputDebugStringA = 0x7ffffffe
.global __imp__ExitProcess
.align 4
__imp__ExitProcess:
.long "_ExitProcess@4" // IMAGE_REL_I386_DIR32
# rtdyld-check: *{4}__imp__ExitProcess = 0x7fffffff
.global relocations
relocations:
rel5:
.long _function@imgrel // IMAGE_REL_I386_DIR32NB
# rtdyld-check: *{4}rel5 = _function - section_addr(COFF_i386.s.tmp.obj, .text)
rel6:
# rtdyld-check: *{2}rel6 = 1
.secidx __imp__OutputDebugStringA // IMAGE_REL_I386_SECTION
rel7:
# rtdyld-check: *{4}rel7 = string - section_addr(COFF_i386.s.tmp.obj, .data)
.secrel32 string // IMAGE_REL_I386_SECREL
# Test that addends work.
rel8:
# rtdyld-check: *{4}rel8 = string
.long string // IMAGE_REL_I386_DIR32
rel9:
# rtdyld-check: *{4}rel9 = string+1
.long string+1 // IMAGE_REL_I386_DIR32
rel10:
# rtdyld-check: *{4}rel10 = string - section_addr(COFF_i386.s.tmp.obj, .text) + 1
.long string@imgrel+1 // IMAGE_REL_I386_DIR32NB
rel11:
# rtdyld-check: *{4}rel11 = string - section_addr(COFF_i386.s.tmp.obj, .data) + 1
.long string@SECREL32+1 // IMAGE_REL_I386_SECREL
# We explicitly add padding to put string outside of the 16bit address space
# (absolute and as an offset from .data), so that relocations involving
# 32bit addresses / offsets are not accidentally truncated to 16 bits.
.space 65536
.global string
.align 1
string:
.asciz "Hello World!\n"

View File

@ -1,41 +0,0 @@
# RUN: rm -rf %t && mkdir -p %t
# RUN: llvm-mc -triple=x86_64-pc-win32 -filetype=obj -o %t/COFF_x86_64.o %s
# RUN: llvm-rtdyld -triple=x86_64-pc-win32 -verify -check=%s %t/COFF_x86_64.o
.text
.def F;
.scl 2;
.type 32;
.endef
.globl __real400921f9f01b866e
.section .rdata,"dr",discard,__real400921f9f01b866e
.align 8
__real400921f9f01b866e:
.quad 4614256650576692846 # double 3.1415899999999999
.text
.globl F
.global inst1
.align 16, 0x90
F: # @F
.Ltmp0:
.seh_proc F
# %bb.0: # %entry
.Ltmp1:
.seh_endprologue
# rtdyld-check: decode_operand(inst1, 4) = __real400921f9f01b866e - next_pc(inst1)
inst1:
movsd __real400921f9f01b866e(%rip), %xmm0 # xmm0 = mem[0],zero
retq
.Leh_func_end0:
.Ltmp2:
.seh_endproc
.data
.globl x # @x
# rtdyld-check: *{8}x = F
x:
.quad F
# Make sure the JIT doesn't bail out on BSS sections.
.bss
bss_check:
.fill 8, 1, 0

View File

@ -1,9 +0,0 @@
# RUN: rm -rf %t && mkdir -p %t
# RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj -o %t/file.o %p/Inputs/ELF_STT_FILE_GLOBAL.s
# RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj -o %t/relaxed.o %s
# RUN: llvm-rtdyld -triple=x86_64-pc-linux -verify %t/file.o %t/relaxed.o
# Test that RTDyldELF does not crash with 'unimplemented relocation'
_main:
movq foo.c@GOTPCREL(%rip), %rax

View File

@ -1,15 +0,0 @@
# RUN: rm -rf %t && mkdir -p %t
# RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj -o %t/test_ELF_STT_FILE_FILE_x86-64.o %p/Inputs/ELF_STT_FILE_FILE.s
# RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj -o %t/test_ELF_STT_FILE_GLOBAL_x86-64.o %p/Inputs/ELF_STT_FILE_GLOBAL.s
# RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj -o %t/test_ELF_STT_FILE_x86-64.o %s
# RUN: llvm-rtdyld -triple=x86_64-pc-linux -verify %t/test_ELF_STT_FILE_GLOBAL_x86-64.o %t/test_ELF_STT_FILE_FILE_x86-64.o %t/test_ELF_STT_FILE_x86-64.o
# Test that RTDyldELF ignores STT_FILE symbols, and in particular does
# crash if we are relocating against a symbol that happens to have the
# same name as an STT_FILE symbol.
_main:
movq foo.c@GOTPCREL(%rip), %rax
movq bar.c@GOTPCREL(%rip), %rax
movq $0, %rax
retq

View File

@ -1,27 +0,0 @@
# RUN: rm -rf %t && mkdir -p %t
# RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj -o %t/test_ELF_x86-64_PC8.o %s
# RUN: llvm-rtdyld -triple=x86_64-pc-linux -verify -map-section test_ELF_x86-64_PC8.o,.text.bar=0x10000 -map-section test_ELF_x86-64_PC8.o,.text.baz=0x10040 %t/test_ELF_x86-64_PC8.o
# RUN: llvm-rtdyld -triple=x86_64-pc-linux -verify -map-section test_ELF_x86-64_PC8.o,.text.baz=0x10000 -map-section test_ELF_x86-64_PC8.o,.text.bar=0x10040 %t/test_ELF_x86-64_PC8.o
# Test that R_X86_64_PC8 relocation works.
.section .text.bar,"ax"
.align 16, 0x90
.type bar,@function
bar:
retq
.Ltmp1:
.size bar, .Ltmp1-bar
.section .text.baz,"ax"
.align 16, 0x90
.type baz,@function
baz:
movq %rdi, %rcx
jrcxz bar
retq
.Ltmp2:
.size baz, .Ltmp2-baz
.section ".note.GNU-stack","",@progbits

View File

@ -1,32 +0,0 @@
# RUN: rm -rf %t && mkdir -p %t
# RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj -o %t/test_ELF1_x86-64.o %s
# RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj -o %t/test_ELF2_x86-64.o %s
# RUN: llc -mtriple=x86_64-pc-linux -filetype=obj -o %t/test_ELF_ExternalGlobal_x86-64.o %S/Inputs/ExternalGlobal.ll
# RUN: llvm-rtdyld -triple=x86_64-pc-linux -verify %t/test_ELF1_x86-64.o %t/test_ELF_ExternalGlobal_x86-64.o
# Test that we can load this code twice at memory locations more than 2GB apart
# RUN: llvm-rtdyld -triple=x86_64-pc-linux -verify -map-section test_ELF1_x86-64.o,.got=0x10000 -map-section test_ELF2_x86-64.o,.text=0x100000000 -map-section test_ELF2_x86-64.o,.got=0x100010000 %t/test_ELF1_x86-64.o %t/test_ELF2_x86-64.o %t/test_ELF_ExternalGlobal_x86-64.o
# Assembly obtained by compiling the following and adding checks:
# @G = external global i8*
#
# define i8* @foo() {
# %ret = load i8** @G
# ret i32 %ret
# }
#
#
.text
.file "ELF_x64-64_PIC_relocations.ll"
.align 16, 0x90
.type foo,@function
foo: # @foo
# %bb.0:
movq G@GOTPCREL(%rip), %rax
movl (%rax), %eax
retq
.Ltmp0:
.size foo, .Ltmp0-foo
.section ".note.GNU-stack","",@progbits

View File

@ -1,16 +0,0 @@
# RUN: rm -rf %t && mkdir -p %t
# RUN: llvm-mc -triple=x86_64-unknown-freebsd -filetype=obj -o %t/testsmall_x86-64.o %s
# RUN: llvm-rtdyld -triple=x86_64-unknown-freebsd -verify -check=%s %t/testsmall_x86-64.o
.globl foo
.align 4, 0x90
foo:
retq
.globl main
.align 4, 0x90
main:
# Test PC-rel branch.
# rtdyld-check: decode_operand(insn1, 0) = foo - next_pc(insn1)
insn1:
callq foo

View File

@ -1,21 +0,0 @@
# RUN: rm -rf %t && mkdir -p %t
# RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj -o %t/ELF_x86-64_debug_frame.o %s
# RUN: llvm-rtdyld -triple=x86_64-pc-linux -verify -check=%s %t/ELF_x86-64_debug_frame.o
.text
.file "debug_frame_test.c"
.align 16, 0x90
.type foo,@function
foo:
.cfi_startproc
retq
.Ltmp0:
.size foo, .Ltmp0-foo
.cfi_endproc
.cfi_sections .debug_frame
# Check that .debug_frame is mapped to 0.
# rtdyld-check: section_addr(ELF_x86-64_debug_frame.o, .debug_frame) = 0
# Check that The relocated FDE's CIE offset also points to zero.
# rtdyld-check: *{4}(section_addr(ELF_x86-64_debug_frame.o, .debug_frame) + 0x1C) = 0

View File

@ -1,30 +0,0 @@
# RUN: yaml2obj %s -o %t.o
# RUN: llvm-rtdyld -triple=x86_64-pc-linux %t.o -printline
# Verify rtdyld doesn't abort in presence of R_X86_64_NONE
!ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
OSABI: ELFOSABI_FREEBSD
Type: ET_REL
Machine: EM_X86_64
Sections:
- Name: .text
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC ]
- Name: .rela.text
Type: SHT_RELA
Link: .symtab
Info: .text
Relocations:
- Offset: 0x0000000000000000
Symbol: ''
Type: R_X86_64_NONE
Symbols:
Global:
- Name: _main
Section: .text
Value: 0
Size: 4

View File

@ -1,26 +0,0 @@
# RUN: llvm-mc -triple=x86_64-apple-macosx10.10.0 -filetype=obj -o %t %s
# RUN: llvm-rtdyld -print-alloc-requests -triple=x86_64-pc-linux -dummy-extern _g=196608 -verify %t
# Compiled from Inputs/ELF/ELF_x86_64_StubBuf.ll
# CHECK: allocateCodeSection(Size = 42, Alignment = 16, SectionName = __text)
.section __TEXT,__text,regular,pure_instructions
.macosx_version_min 10, 10
.globl _f
.align 4, 0x90
_f: ## @f
.cfi_startproc
## %bb.0: ## %entry
pushq %rax
Ltmp0:
.cfi_def_cfa_offset 16
callq _g
callq _g
callq _g
popq %rax
retq
.cfi_endproc
.subsections_via_symbols

View File

@ -1,3 +0,0 @@
.file "foo.c"
.global bar.c
bar.c:

View File

@ -1,2 +0,0 @@
.global foo.c
foo.c:

View File

@ -1,12 +0,0 @@
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.10.0"
declare void @g()
define void @f() {
entry:
call void @g()
call void @g()
call void @g()
ret void
}

View File

@ -1,2 +0,0 @@
@F = global i8 0
@G = global i8* @F

View File

@ -1,7 +0,0 @@
# RUN: llvm-mc -triple=x86_64-apple-macosx10.9 -filetype=obj -o %t %s
# RUN: llvm-rtdyld -verify -triple=x86_64-apple-macosx10.9 %t
.section __TEXT,__eh_frame
.macosx_version_min 10, 10
.subsections_via_symbols

View File

@ -1,49 +0,0 @@
# RUN: rm -rf %t && mkdir -p %t
# RUN: llvm-mc -triple=i386-apple-macosx10.4 -filetype=obj -o %t/test_i386.o %s
# RUN: llvm-rtdyld -triple=i386-apple-macosx10.4 -verify -check=%s %t/test_i386.o
// Put the section used in the test at a non zero address.
.long 4
.section __TEXT,__text2,regular,pure_instructions
.globl bar
.align 4, 0x90
bar:
calll tmp0$pb
tmp0$pb:
popl %eax
# Test section difference relocation to non-lazy ptr section.
# rtdyld-check: decode_operand(inst1, 4) = x$non_lazy_ptr - tmp0$pb + 8
inst1:
movl (x$non_lazy_ptr-tmp0$pb)+8(%eax), %eax
movl (%eax), %ebx
# Test VANILLA relocation to jump table.
# rtdyld-check: decode_operand(inst2, 0) = bling$stub - next_pc(inst2)
inst2:
calll bling$stub
addl %ebx, %eax
# Test scattered VANILLA relocations.
inst3:
movl y+4, %ecx
addl %ecx, %eax
retl
.section __IMPORT,__jump_table,symbol_stubs,pure_instructions+self_modifying_code,5
bling$stub:
.indirect_symbol bling
.ascii "\364\364\364\364\364"
.section __IMPORT,__pointers,non_lazy_symbol_pointers
x$non_lazy_ptr:
.indirect_symbol x
.long 0
.comm x,4,2
.comm bling,4,2
.globl y
.zerofill __DATA,__common,y,8,3
.subsections_via_symbols

View File

@ -1,31 +0,0 @@
# RUN: rm -rf %t && mkdir -p %t
# RUN: llvm-mc -triple=i386-apple-macosx10.4 -filetype=obj -o %t/MachO_i386_eh_frame.o %s
# RUN: llvm-rtdyld -triple=i386-apple-macosx10.4 -verify -map-section MachO_i386_eh_frame.o,__text=0x2000 -check=%s %t/MachO_i386_eh_frame.o
# rtdyld-check: *{4}(section_addr(MachO_i386_eh_frame.o, __eh_frame) + 0x20) = (main - (section_addr(MachO_i386_eh_frame.o, __eh_frame) + 0x20))[31:0]
# rtdyld-check: *{4}(section_addr(MachO_i386_eh_frame.o, __eh_frame) + 0x24) = 0x9
.section __TEXT,__text,regular,pure_instructions
.globl bar
.align 4, 0x90
bar:
retl
.globl main
.align 4, 0x90
main:
.cfi_startproc
pushl %ebp
Ltmp0:
.cfi_def_cfa_offset 8
Ltmp1:
.cfi_offset %ebp, -8
movl %esp, %ebp
Ltmp2:
.cfi_def_cfa_register %ebp
popl %ebp
jmp bar
.cfi_endproc
.subsections_via_symbols

View File

@ -1,103 +0,0 @@
# RUN: rm -rf %t && mkdir -p %t
# RUN: llvm-mc -triple=x86_64-apple-macosx10.9 -filetype=obj -o %t/test_x86-64.o %s
# RUN: llvm-rtdyld -triple=x86_64-apple-macosx10.9 -dummy-extern ds1=0xfffffffffffffffe -dummy-extern ds2=0xffffffffffffffff -verify -check=%s %t/test_x86-64.o
.section __TEXT,__text,regular,pure_instructions
.globl foo
.align 4, 0x90
foo:
retq
.globl main
.align 4, 0x90
main:
# Test PC-rel branch.
# rtdyld-check: decode_operand(insn1, 0) = foo - next_pc(insn1)
insn1:
callq foo
# Test PC-rel signed.
# rtdyld-check: decode_operand(insn2, 4) = x - next_pc(insn2)
insn2:
movl x(%rip), %eax
# Test PC-rel GOT relocation.
# Verify both the contents of the GOT entry for y, and that the movq instruction
# references the correct GOT entry address:
# rtdyld-check: *{8}(stub_addr(test_x86-64.o, __text, y)) = y
# rtdyld-check: decode_operand(insn3, 4) = stub_addr(test_x86-64.o, __text, y) - next_pc(insn3)
insn3:
movq y@GOTPCREL(%rip), %rax
movl $0, %eax
retq
# Test processing of the __eh_frame section.
# rtdyld-check: *{8}(section_addr(test_x86-64.o, __eh_frame) + 0x20) = eh_frame_test - (section_addr(test_x86-64.o, __eh_frame) + 0x20)
eh_frame_test:
.cfi_startproc
retq
.cfi_endproc
.comm y,4,2
.section __DATA,__data
.globl x
.align 2
x:
.long 5
# Test dummy-extern relocation.
# rtdyld-check: *{8}z1 = ds1
z1:
.quad ds1
# Test external-symbol relocation bypass: symbols with addr 0xffffffffffffffff
# don't have their relocations applied.
# rtdyld-check: *{8}z2 = 0
z2:
.quad ds2
# Test absolute symbols.
# rtdyld-check: abssym = 0xdeadbeef
.globl abssym
abssym = 0xdeadbeef
# Test subtractor relocations between named symbols.
# rtdyld-check: *{8}z3a = z4 - z5 + 4
z3a:
.quad z4 - z5 + 4
# Test subtractor relocations between anonymous symbols.
# rtdyld-check: *{8}z3b = (section_addr(test_x86-64.o, _tmp3) + 4) - (section_addr(test_x86-64.o, _tmp4)) + 8
z3b:
.quad Lanondiff_1 - Lanondiff_2 + 8
# Test subtractor relocations between named and anonymous symbols.
# rtdyld-check: *{8}z3c = z4 - (section_addr(test_x86-64.o, _tmp4)) + 12
z3c:
.quad z4 - Lanondiff_2 + 12
# Test subtractor relocations between anonymous and named symbols.
# rtdyld-check: *{8}z3d = (section_addr(test_x86-64.o, _tmp3) + 4) - z4 + 16
z3d:
.quad Lanondiff_1 - z4 + 16
.section __DATA,_tmp1
z4:
.byte 1
.section __DATA,_tmp2
z5:
.byte 1
.section __DATA,_tmp3
.long 1 # padding to make sure we handle non-zero offsets.
Lanondiff_1:
.byte 1
.section __DATA,_tmp4
Lanondiff_2:
.byte 1
.subsections_via_symbols

View File

@ -1,9 +0,0 @@
; REQUIRES: system-windows
; RUN: opt -mtriple=x86_64-pc-win32-coff %s -o - | lli
@o = common global i32 0, align 4
define i32 @main() {
%patatino = load i32, i32* @o, align 4
ret i32 %patatino
}

View File

@ -1,3 +0,0 @@
if not 'X86' in config.root.targets:
config.unsupported = True