diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/COFF/ignore4217.yaml | 72 | ||||
-rw-r--r-- | test/ELF/Inputs/writable-sec-plt-reloc.s | 4 | ||||
-rw-r--r-- | test/ELF/Inputs/znotext-copy-relocations.s | 5 | ||||
-rw-r--r-- | test/ELF/Inputs/znotext-plt-relocations-protected.s | 5 | ||||
-rw-r--r-- | test/ELF/arm-thumb-no-undefined-thunk.s | 2 | ||||
-rw-r--r-- | test/ELF/arm-undefined-weak.s | 2 | ||||
-rw-r--r-- | test/ELF/gnu-ifunc-i386.s | 4 | ||||
-rw-r--r-- | test/ELF/gnu-ifunc.s | 4 | ||||
-rw-r--r-- | test/ELF/writable-sec-plt-reloc.s | 14 | ||||
-rw-r--r-- | test/ELF/x86-64-dyn-rel-error.s | 4 | ||||
-rw-r--r-- | test/ELF/x86-64-dyn-rel-error2.s | 4 | ||||
-rw-r--r-- | test/ELF/znotext-copy-relocation.s | 16 | ||||
-rw-r--r-- | test/ELF/znotext-plt-relocations-protected.s | 11 | ||||
-rw-r--r-- | test/ELF/znotext-weak-undef.s | 16 |
14 files changed, 153 insertions, 10 deletions
diff --git a/test/COFF/ignore4217.yaml b/test/COFF/ignore4217.yaml new file mode 100644 index 0000000000000..5f9d3e3ddf845 --- /dev/null +++ b/test/COFF/ignore4217.yaml @@ -0,0 +1,72 @@ +# Tests that /ignore:4217 suppresses "locally defined symbol imported" warnings. +# RUN: yaml2obj < %s > %t.obj + +# RUN: lld-link -entry:main -out:%t.exe %t.obj 2>&1 \ +# RUN: | FileCheck -check-prefix=WARNINGS %s +# RUN: lld-link -ignore:4217 -entry:main -out:%t.exe %t.obj 2>&1 \ +# RUN: | FileCheck -allow-empty -check-prefix=SUPPRESSED %s + +# WARNINGS: locally defined symbol imported +# SUPPRESSED-NOT: locally defined symbol imported + +--- !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: B82A000000C3662E0F1F8400000000004883EC28C744242400000000E800000000904883C428C3 + Relocations: + - VirtualAddress: 29 + SymbolName: __imp_foo + Type: IMAGE_REL_AMD64_REL32 + - Name: .data + Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ] + Alignment: 4 + SectionData: '' +symbols: + - Name: .text + Value: 0 + SectionNumber: 1 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 39 + NumberOfRelocations: 1 + NumberOfLinenumbers: 0 + CheckSum: 3087210877 + Number: 1 + - Name: .data + Value: 0 + SectionNumber: 2 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 0 + NumberOfRelocations: 0 + NumberOfLinenumbers: 0 + CheckSum: 0 + Number: 2 + - Name: foo + Value: 0 + SectionNumber: 1 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_FUNCTION + StorageClass: IMAGE_SYM_CLASS_EXTERNAL + - Name: main + Value: 16 + SectionNumber: 1 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_FUNCTION + StorageClass: IMAGE_SYM_CLASS_EXTERNAL + - Name: __imp_foo + Value: 0 + SectionNumber: 0 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_EXTERNAL +... diff --git a/test/ELF/Inputs/writable-sec-plt-reloc.s b/test/ELF/Inputs/writable-sec-plt-reloc.s new file mode 100644 index 0000000000000..fc5d839a51669 --- /dev/null +++ b/test/ELF/Inputs/writable-sec-plt-reloc.s @@ -0,0 +1,4 @@ + .global foo + .type foo, @function +foo: + retq diff --git a/test/ELF/Inputs/znotext-copy-relocations.s b/test/ELF/Inputs/znotext-copy-relocations.s new file mode 100644 index 0000000000000..a23abbe3d4027 --- /dev/null +++ b/test/ELF/Inputs/znotext-copy-relocations.s @@ -0,0 +1,5 @@ +.global foo +.type foo,@object +.size foo, 8 +foo: +.quad 42 diff --git a/test/ELF/Inputs/znotext-plt-relocations-protected.s b/test/ELF/Inputs/znotext-plt-relocations-protected.s new file mode 100644 index 0000000000000..c9eacf5b54c5b --- /dev/null +++ b/test/ELF/Inputs/znotext-plt-relocations-protected.s @@ -0,0 +1,5 @@ +.global foo +.type foo,@function +.protected foo +foo: + nop diff --git a/test/ELF/arm-thumb-no-undefined-thunk.s b/test/ELF/arm-thumb-no-undefined-thunk.s index 775e6fa9c0e08..e8d8d8db684cd 100644 --- a/test/ELF/arm-thumb-no-undefined-thunk.s +++ b/test/ELF/arm-thumb-no-undefined-thunk.s @@ -21,4 +21,4 @@ _start: // 69636 = 0x11004 = next instruction // CHECK: 11000: {{.*}} bl #0 // CHECK-NEXT: 11004: {{.*}} b.w #0 <_start+0x8> -// CHECK-NEXT: 11008: {{.*}} b.w #0 <_start+0xC> +// CHECK-NEXT: 11008: {{.*}} b.w #0 <_start+0xc> diff --git a/test/ELF/arm-undefined-weak.s b/test/ELF/arm-undefined-weak.s index 57a3f57dea1b5..8af9f4916a953 100644 --- a/test/ELF/arm-undefined-weak.s +++ b/test/ELF/arm-undefined-weak.s @@ -32,7 +32,7 @@ _start: // CHECK: 11000: {{.*}} b #-4 <_start+0x4> // CHECK-NEXT: 11004: {{.*}} bl #-4 <_start+0x8> // blx is transformed into bl so we don't change state -// CHECK-NEXT: 11008: {{.*}} bl #-4 <_start+0xC> +// CHECK-NEXT: 11008: {{.*}} bl #-4 <_start+0xc> // CHECK-NEXT: 1100c: {{.*}} movt r0, #0 // CHECK-NEXT: 11010: {{.*}} movw r0, #0 // CHECK: 11014: {{.*}} .word 0x00000000 diff --git a/test/ELF/gnu-ifunc-i386.s b/test/ELF/gnu-ifunc-i386.s index 559e98a3e6256..4eda32f378d9e 100644 --- a/test/ELF/gnu-ifunc-i386.s +++ b/test/ELF/gnu-ifunc-i386.s @@ -102,10 +102,10 @@ // DISASM-NEXT: .plt: // DISASM-NEXT: 11020: ff 25 00 20 01 00 jmpl *73728 // DISASM-NEXT: 11026: 68 10 00 00 00 pushl $16 -// DISASM-NEXT: 1102b: e9 e0 ff ff ff jmp -32 <_start+0xE> +// DISASM-NEXT: 1102b: e9 e0 ff ff ff jmp -32 <_start+0xe> // DISASM-NEXT: 11030: ff 25 04 20 01 00 jmpl *73732 // DISASM-NEXT: 11036: 68 18 00 00 00 pushl $24 -// DISASM-NEXT: 1103b: e9 d0 ff ff ff jmp -48 <_start+0xE> +// DISASM-NEXT: 1103b: e9 d0 ff ff ff jmp -48 <_start+0xe> .text .type foo STT_GNU_IFUNC diff --git a/test/ELF/gnu-ifunc.s b/test/ELF/gnu-ifunc.s index 17883a3209f5d..4911da6bce003 100644 --- a/test/ELF/gnu-ifunc.s +++ b/test/ELF/gnu-ifunc.s @@ -102,10 +102,10 @@ // DISASM-NEXT: .plt: // DISASM-NEXT: 201020: {{.*}} jmpq *4058(%rip) // DISASM-NEXT: 201026: {{.*}} pushq $0 -// DISASM-NEXT: 20102b: {{.*}} jmp -32 <_start+0xE> +// DISASM-NEXT: 20102b: {{.*}} jmp -32 <_start+0xe> // DISASM-NEXT: 201030: {{.*}} jmpq *4050(%rip) // DISASM-NEXT: 201036: {{.*}} pushq $1 -// DISASM-NEXT: 20103b: {{.*}} jmp -48 <_start+0xE> +// DISASM-NEXT: 20103b: {{.*}} jmp -48 <_start+0xe> .text .type foo STT_GNU_IFUNC diff --git a/test/ELF/writable-sec-plt-reloc.s b/test/ELF/writable-sec-plt-reloc.s new file mode 100644 index 0000000000000..97a21b5fac027 --- /dev/null +++ b/test/ELF/writable-sec-plt-reloc.s @@ -0,0 +1,14 @@ +# REQUIRES: x86 +# RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux +# RUN: llvm-mc %p/Inputs/writable-sec-plt-reloc.s -o %t2.o -filetype=obj -triple=x86_64-pc-linux +# RUN: ld.lld %t2.o -o %t2.so -shared +# RUN: ld.lld %t.o %t2.so -o %t +# RUN: llvm-readelf --symbols -r %t | FileCheck %s + +# CHECK: R_X86_64_JUMP_SLOT {{.*}} foo + 0 +# CHECK: 0000000000201010 0 FUNC GLOBAL DEFAULT UND foo + +.section .bar,"awx" +.global _start +_start: + call foo diff --git a/test/ELF/x86-64-dyn-rel-error.s b/test/ELF/x86-64-dyn-rel-error.s index f479eca2e7782..7a705eb541778 100644 --- a/test/ELF/x86-64-dyn-rel-error.s +++ b/test/ELF/x86-64-dyn-rel-error.s @@ -2,12 +2,12 @@ // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/shared.s -o %t2.o // RUN: ld.lld %t2.o -shared -o %t2.so -// RUN: not ld.lld %t.o %t2.so -o %t 2>&1 | FileCheck %s +// RUN: not ld.lld -shared %t.o %t2.so -o %t 2>&1 | FileCheck %s .global _start _start: .data - .long bar + .long zed // CHECK: relocation R_X86_64_32 cannot be used against shared object; recompile with -fPIC diff --git a/test/ELF/x86-64-dyn-rel-error2.s b/test/ELF/x86-64-dyn-rel-error2.s index e316aeae54f42..9b731e2688757 100644 --- a/test/ELF/x86-64-dyn-rel-error2.s +++ b/test/ELF/x86-64-dyn-rel-error2.s @@ -2,7 +2,7 @@ // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/shared.s -o %t2.o // RUN: ld.lld %t2.o -shared -o %t2.so -// RUN: not ld.lld %t.o %t2.so -o %t 2>&1 | FileCheck %s +// RUN: not ld.lld -shared %t.o %t2.so -o %t 2>&1 | FileCheck %s // CHECK: relocation R_X86_64_PC32 cannot be used against shared object; recompile with -fPIC // CHECK: >>> defined in {{.*}}.so @@ -11,4 +11,4 @@ .global _start _start: .data - .long bar - . + .long zed - . diff --git a/test/ELF/znotext-copy-relocation.s b/test/ELF/znotext-copy-relocation.s new file mode 100644 index 0000000000000..a5fc4f99dba50 --- /dev/null +++ b/test/ELF/znotext-copy-relocation.s @@ -0,0 +1,16 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/znotext-copy-relocations.s -o %t2.o +# RUN: ld.lld %t2.o -o %t2.so -shared +# RUN: ld.lld -z notext %t.o %t2.so -o %t +# RUN: llvm-readobj -r %t | FileCheck %s + +# CHECK: Relocations [ +# CHECK-NEXT: Section ({{.*}}) .rela.dyn { +# CHECK-NEXT: R_X86_64_COPY foo 0x0 +# CHECK-NEXT: } +# CHECK-NEXT: ] + +.global _start +_start: +.long foo diff --git a/test/ELF/znotext-plt-relocations-protected.s b/test/ELF/znotext-plt-relocations-protected.s new file mode 100644 index 0000000000000..03d20b12e3526 --- /dev/null +++ b/test/ELF/znotext-plt-relocations-protected.s @@ -0,0 +1,11 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/znotext-plt-relocations-protected.s -o %t2.o +# RUN: ld.lld %t2.o -o %t2.so -shared +# RUN: not ld.lld -z notext %t.o %t2.so -o %t 2>&1 | FileCheck %s + +# CHECK: error: cannot preempt symbol: foo + +.global _start +_start: +callq foo diff --git a/test/ELF/znotext-weak-undef.s b/test/ELF/znotext-weak-undef.s new file mode 100644 index 0000000000000..d606d872bc4f2 --- /dev/null +++ b/test/ELF/znotext-weak-undef.s @@ -0,0 +1,16 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +# RUN: not ld.lld -z notext -shared %t.o -o %t 2>&1 | FileCheck %s +# CHECK: relocation R_X86_64_32 cannot be used against shared object; recompile with -fPIC + +# RUN: ld.lld -z notext %t.o -o %t +# RUN: llvm-readobj -r %t | FileCheck %s --check-prefix=EXE +# EXE: Relocations [ +# EXE-NEXT: ] + +.text +.global foo +.weak foo + +_start: +mov $foo,%eax |