diff options
Diffstat (limited to 'test/ELF')
-rw-r--r-- | test/ELF/incompatible-section-flags.s | 18 | ||||
-rw-r--r-- | test/ELF/incompatible-section-types.s | 10 | ||||
-rw-r--r-- | test/ELF/linkerscript/phdrs.s | 2 | ||||
-rw-r--r-- | test/ELF/linkerscript/sections.s | 40 | ||||
-rw-r--r-- | test/ELF/reproduce-backslash.s | 8 | ||||
-rw-r--r-- | test/ELF/reproduce-error.s | 7 | ||||
-rw-r--r-- | test/ELF/reproduce-linkerscript.s | 4 | ||||
-rw-r--r-- | test/ELF/reproduce-thin-archive.s | 4 | ||||
-rw-r--r-- | test/ELF/reproduce-windows.s | 6 | ||||
-rw-r--r-- | test/ELF/reproduce-windows2.s | 7 | ||||
-rw-r--r-- | test/ELF/reproduce.s | 18 | ||||
-rw-r--r-- | test/ELF/section-name.s | 15 | ||||
-rw-r--r-- | test/ELF/string-table.s | 18 | ||||
-rw-r--r-- | test/ELF/undef.s | 6 |
14 files changed, 83 insertions, 80 deletions
diff --git a/test/ELF/incompatible-section-flags.s b/test/ELF/incompatible-section-flags.s new file mode 100644 index 000000000000..efca31bb9a80 --- /dev/null +++ b/test/ELF/incompatible-section-flags.s @@ -0,0 +1,18 @@ +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +// RUN: not ld.lld -shared %t.o -o %t 2>&1 | FileCheck %s + +// CHECK: error: Section has flags incompatible with others with the same name {{.*}}incompatible-section-flags.s.tmp.o:(.foo) +// CHECK: error: Section has flags incompatible with others with the same name {{.*}}incompatible-section-flags.s.tmp.o:(.bar) + +.section .foo, "awT", @progbits, unique, 1 +.quad 0 + +.section .foo, "aw", @progbits, unique, 2 +.quad 0 + + +.section .bar, "aw", @progbits, unique, 3 +.quad 0 + +.section .bar, "awT", @progbits, unique, 4 +.quad 0 diff --git a/test/ELF/incompatible-section-types.s b/test/ELF/incompatible-section-types.s new file mode 100644 index 000000000000..0d075aca068b --- /dev/null +++ b/test/ELF/incompatible-section-types.s @@ -0,0 +1,10 @@ +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +// RUN: not ld.lld -shared %t.o -o %t 2>&1 | FileCheck %s + +// CHECK: error: Section has different type from others with the same name {{.*}}incompatible-section-types.s.tmp.o:(.foo) + +.section .foo, "aw", @progbits, unique, 1 +.quad 0 + +.section .foo, "aw", @nobits, unique, 2 +.quad 0 diff --git a/test/ELF/linkerscript/phdrs.s b/test/ELF/linkerscript/phdrs.s index a7476e802341..025ced95b30a 100644 --- a/test/ELF/linkerscript/phdrs.s +++ b/test/ELF/linkerscript/phdrs.s @@ -93,7 +93,7 @@ ## Check the numetic values for PHDRS. # RUN: echo "PHDRS {text PT_LOAD FILEHDR PHDRS; foo 0x11223344; } \ -# RUN: SECTIONS { . = SIZEOF_HEADERS; .foo : { *(.*) } : text : foo}" > %t1.script +# RUN: SECTIONS { . = SIZEOF_HEADERS; .foo : { *(.foo* .text*) } : text : foo}" > %t1.script # RUN: ld.lld -o %t2 --script %t1.script %t # RUN: llvm-readobj -program-headers %t2 | FileCheck --check-prefix=INT-PHDRS %s diff --git a/test/ELF/linkerscript/sections.s b/test/ELF/linkerscript/sections.s index 416e77346a59..2cb9395e6692 100644 --- a/test/ELF/linkerscript/sections.s +++ b/test/ELF/linkerscript/sections.s @@ -20,11 +20,10 @@ # SEC-DEFAULT: 2 .data 00000020 {{[0-9a-f]*}} DATA # SEC-DEFAULT: 3 other 00000003 {{[0-9a-f]*}} DATA # SEC-DEFAULT: 4 .bss 00000002 {{[0-9a-f]*}} BSS -# SEC-DEFAULT: 5 .shstrtab 00000002 {{[0-9a-f]*}} -# SEC-DEFAULT: 6 .comment 00000008 {{[0-9a-f]*}} -# SEC-DEFAULT: 7 .symtab 00000030 {{[0-9a-f]*}} -# SEC-DEFAULT: 8 .shstrtab 0000003b {{[0-9a-f]*}} -# SEC-DEFAULT: 9 .strtab 00000008 {{[0-9a-f]*}} +# SEC-DEFAULT: 5 .comment 00000008 {{[0-9a-f]*}} +# SEC-DEFAULT: 6 .symtab 00000030 {{[0-9a-f]*}} +# SEC-DEFAULT: 7 .shstrtab 0000003b {{[0-9a-f]*}} +# SEC-DEFAULT: 8 .strtab 00000008 {{[0-9a-f]*}} # Sections are put in order specified in linker script, other than alloc # sections going first. @@ -43,12 +42,11 @@ # Idx Name Size # SEC-ORDER: 1 .bss 00000002 {{[0-9a-f]*}} BSS # SEC-ORDER: 2 other 00000003 {{[0-9a-f]*}} DATA -# SEC-ORDER: 3 .shstrtab 00000002 {{[0-9a-f]*}} -# SEC-ORDER: 4 .shstrtab 0000003b {{[0-9a-f]*}} -# SEC-ORDER: 5 .symtab 00000030 {{[0-9a-f]*}} -# SEC-ORDER: 6 .strtab 00000008 {{[0-9a-f]*}} -# SEC-ORDER: 7 .data 00000020 {{[0-9a-f]*}} DATA -# SEC-ORDER: 8 .text 0000000e {{[0-9a-f]*}} TEXT DATA +# SEC-ORDER: 3 .shstrtab 0000003b {{[0-9a-f]*}} +# SEC-ORDER: 4 .symtab 00000030 {{[0-9a-f]*}} +# SEC-ORDER: 5 .strtab 00000008 {{[0-9a-f]*}} +# SEC-ORDER: 6 .data 00000020 {{[0-9a-f]*}} DATA +# SEC-ORDER: 7 .text 0000000e {{[0-9a-f]*}} TEXT DATA # .text and .data have swapped names but proper sizes and types. # RUN: echo "SECTIONS { \ @@ -63,11 +61,10 @@ # SEC-SWAP-NAMES: 2 .text 00000020 {{[0-9a-f]*}} DATA # SEC-SWAP-NAMES: 3 other 00000003 {{[0-9a-f]*}} DATA # SEC-SWAP-NAMES: 4 .bss 00000002 {{[0-9a-f]*}} BSS -# SEC-SWAP-NAMES: 5 .shstrtab 00000002 {{[0-9a-f]*}} -# SEC-SWAP-NAMES: 6 .comment 00000008 {{[0-9a-f]*}} -# SEC-SWAP-NAMES: 7 .symtab 00000030 {{[0-9a-f]*}} -# SEC-SWAP-NAMES: 8 .shstrtab 0000003b {{[0-9a-f]*}} -# SEC-SWAP-NAMES: 9 .strtab 00000008 {{[0-9a-f]*}} +# SEC-SWAP-NAMES: 5 .comment 00000008 {{[0-9a-f]*}} +# SEC-SWAP-NAMES: 6 .symtab 00000030 {{[0-9a-f]*}} +# SEC-SWAP-NAMES: 7 .shstrtab 0000003b {{[0-9a-f]*}} +# SEC-SWAP-NAMES: 8 .strtab 00000008 {{[0-9a-f]*}} # .shstrtab from the input object file is discarded. # RUN: echo "SECTIONS { \ @@ -102,11 +99,10 @@ # SEC-MULTI: 1 .text 0000000e {{[0-9a-f]*}} TEXT DATA # SEC-MULTI: 2 .data 00000023 {{[0-9a-f]*}} DATA # SEC-MULTI: 3 .bss 00000002 {{[0-9a-f]*}} BSS -# SEC-MULTI: 4 .shstrtab 00000002 {{[0-9a-f]*}} -# SEC-MULTI: 5 .comment 00000008 {{[0-9a-f]*}} -# SEC-MULTI: 6 .symtab 00000030 {{[0-9a-f]*}} -# SEC-MULTI: 7 .shstrtab 00000035 {{[0-9a-f]*}} -# SEC-MULTI: 8 .strtab 00000008 {{[0-9a-f]*}} +# SEC-MULTI: 4 .comment 00000008 {{[0-9a-f]*}} +# SEC-MULTI: 5 .symtab 00000030 {{[0-9a-f]*}} +# SEC-MULTI: 6 .shstrtab 00000035 {{[0-9a-f]*}} +# SEC-MULTI: 7 .strtab 00000008 {{[0-9a-f]*}} .globl _start _start: @@ -118,7 +114,5 @@ _start: .section other,"aw" .short 10 .byte 20 -.section .shstrtab,"" -.short 20 .section .bss,"",@nobits .short 0 diff --git a/test/ELF/reproduce-backslash.s b/test/ELF/reproduce-backslash.s index 849c8f8fb3dd..53feb5ff3223 100644 --- a/test/ELF/reproduce-backslash.s +++ b/test/ELF/reproduce-backslash.s @@ -1,9 +1,9 @@ -# REQUIRES: x86, cpio, shell +# REQUIRES: x86, shell # Test that we don't erroneously replace \ with / on UNIX, as it's # legal for a filename to contain backslashes. # RUN: llvm-mc %s -o foo\\.o -filetype=obj -triple=x86_64-pc-linux -# RUN: ld.lld foo\\.o --reproduce repro -# RUN: cpio -it < repro.cpio | FileCheck %s +# RUN: ld.lld foo\\.o --reproduce repro.tar +# RUN: tar tf repro.tar | FileCheck %s -# CHECK: repro/{{.*}}/foo\.o +# CHECK: repro/{{.*}}/foo\\.o diff --git a/test/ELF/reproduce-error.s b/test/ELF/reproduce-error.s index c66132c4bd01..e2de8a4feeba 100644 --- a/test/ELF/reproduce-error.s +++ b/test/ELF/reproduce-error.s @@ -1,15 +1,14 @@ -# Extracting the cpio archive can get over the path limit on windows. +# Extracting the tar archive can get over the path limit on windows. # REQUIRES: shell # RUN: rm -rf %t.dir # RUN: mkdir -p %t.dir # RUN: cd %t.dir -# RUN: not ld.lld --reproduce repro abc -o t 2>&1 | FileCheck %s +# RUN: not ld.lld --reproduce repro.tar abc -o t 2>&1 | FileCheck %s # CHECK: cannot open abc: {{N|n}}o such file or directory -# RUN: grep TRAILER repro.cpio -# RUN: cpio -id < repro.cpio +# RUN: tar xf repro.tar # RUN: FileCheck --check-prefix=RSP %s < repro/response.txt # RSP: abc # RSP: -o t diff --git a/test/ELF/reproduce-linkerscript.s b/test/ELF/reproduce-linkerscript.s index a020fcc9a4f1..1938e2b6cf94 100644 --- a/test/ELF/reproduce-linkerscript.s +++ b/test/ELF/reproduce-linkerscript.s @@ -5,8 +5,8 @@ # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.dir/build/foo.o # RUN: echo "INPUT(\"%t.dir/build/foo.o\")" > %t.dir/build/foo.script # RUN: cd %t.dir -# RUN: ld.lld build/foo.script -o bar --reproduce repro -# RUN: cpio -id < repro.cpio +# RUN: ld.lld build/foo.script -o bar --reproduce repro.tar +# RUN: tar xf repro.tar # RUN: diff build/foo.script repro/%:t.dir/build/foo.script # RUN: diff build/foo.o repro/%:t.dir/build/foo.o diff --git a/test/ELF/reproduce-thin-archive.s b/test/ELF/reproduce-thin-archive.s index 0797b6c67e9c..2de88d77f51b 100644 --- a/test/ELF/reproduce-thin-archive.s +++ b/test/ELF/reproduce-thin-archive.s @@ -5,8 +5,8 @@ # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.dir/foo.o # RUN: cd %t.dir # RUN: llvm-ar --format=gnu rcT foo.a foo.o -# RUN: ld.lld -m elf_x86_64 foo.a -o bar --reproduce repro -# RUN: cpio -id < repro.cpio +# RUN: ld.lld -m elf_x86_64 foo.a -o bar --reproduce repro.tar +# RUN: tar xf repro.tar # RUN: diff foo.a repro/%:t.dir/foo.a # RUN: diff foo.o repro/%:t.dir/foo.o diff --git a/test/ELF/reproduce-windows.s b/test/ELF/reproduce-windows.s index 4825a8a95e78..6dd1fe2eeadb 100644 --- a/test/ELF/reproduce-windows.s +++ b/test/ELF/reproduce-windows.s @@ -1,12 +1,12 @@ -# REQUIRES: x86, cpio +# REQUIRES: x86 # Test that a repro archive always uses / instead of \. # RUN: rm -rf %t.dir # RUN: mkdir -p %t.dir/build # RUN: llvm-mc %s -o %t.dir/build/foo.o -filetype=obj -triple=x86_64-pc-linux # RUN: cd %t.dir -# RUN: ld.lld build/foo.o --reproduce repro -# RUN: cpio -it < repro.cpio | FileCheck %s +# RUN: ld.lld build/foo.o --reproduce repro.tar +# RUN: tar tf repro.tar | FileCheck %s # CHECK: repro/response.txt # CHECK: repro/{{.*}}/build/foo.o diff --git a/test/ELF/reproduce-windows2.s b/test/ELF/reproduce-windows2.s index d428288a3640..38e00247eaf1 100644 --- a/test/ELF/reproduce-windows2.s +++ b/test/ELF/reproduce-windows2.s @@ -1,11 +1,10 @@ -# REQUIRES: system-windows, x86, cpio +# REQUIRES: system-windows, x86 # Test that a response.txt file always uses / instead of \. # RUN: rm -rf %t.dir # RUN: mkdir -p %t.dir/build # RUN: llvm-mc %s -o %t.dir/build/foo.o -filetype=obj -triple=x86_64-pc-linux # RUN: cd %t.dir -# RUN: ld.lld build/foo.o --reproduce repro -# RUN: echo "*response.txt" > list.txt -# RUN: cpio -i --to-stdout --pattern-file=list.txt < repro.cpio | FileCheck %s +# RUN: ld.lld build/foo.o --reproduce repro.tar +# RUN: tar -O -x -f repro.tar repro/response.txt | FileCheck %s # CHECK: {{.*}}/build/foo.o diff --git a/test/ELF/reproduce.s b/test/ELF/reproduce.s index 471a0f82da44..c7955e02a822 100644 --- a/test/ELF/reproduce.s +++ b/test/ELF/reproduce.s @@ -1,14 +1,14 @@ -# REQUIRES: x86, cpio +# REQUIRES: x86 -# Extracting the cpio archive can get over the path limit on windows. +# Extracting the tar archive can get over the path limit on windows. # REQUIRES: shell # RUN: rm -rf %t.dir # RUN: mkdir -p %t.dir/build1 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.dir/build1/foo.o # RUN: cd %t.dir -# RUN: ld.lld --hash-style=gnu build1/foo.o -o bar -shared --as-needed --reproduce repro -# RUN: cpio -id < repro.cpio +# RUN: ld.lld --hash-style=gnu build1/foo.o -o bar -shared --as-needed --reproduce repro.tar +# RUN: tar xf repro.tar # RUN: diff build1/foo.o repro/%:t.dir/build1/foo.o # RUN: FileCheck %s --check-prefix=RSP < repro/response.txt @@ -25,8 +25,8 @@ # RUN: mkdir -p %t.dir/build2/a/b/c # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.dir/build2/foo.o # RUN: cd %t.dir/build2/a/b/c -# RUN: env LLD_REPRODUCE=repro ld.lld ./../../../foo.o -o bar -shared --as-needed -# RUN: cpio -id < repro.cpio +# RUN: env LLD_REPRODUCE=repro.tar ld.lld ./../../../foo.o -o bar -shared --as-needed +# RUN: tar xf repro.tar # RUN: diff %t.dir/build2/foo.o repro/%:t.dir/build2/foo.o # RUN: echo "{ local: *; };" > ver @@ -34,10 +34,10 @@ # RUN: echo > file # RUN: echo > file2 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o 'foo bar' -# RUN: ld.lld --reproduce repro2 'foo bar' -L"foo bar" -Lfile -Tfile2 \ +# RUN: ld.lld --reproduce repro2.tar 'foo bar' -L"foo bar" -Lfile -Tfile2 \ # RUN: --dynamic-list dyn -rpath file --script=file --version-script ver \ # RUN: --dynamic-linker "some unusual/path" -soname 'foo bar' -soname='foo bar' -# RUN: cpio -id < repro2.cpio +# RUN: tar xf repro2.tar # RUN: FileCheck %s --check-prefix=RSP2 < repro2/response.txt # RSP2: "{{.*}}foo bar" # RSP2-NEXT: -L "{{.*}}foo bar" @@ -51,7 +51,7 @@ # RSP2-NEXT: -soname="foo bar" # RSP2-NEXT: -soname="foo bar" -# RUN: cpio -it < repro2.cpio | FileCheck %s +# RUN: tar tf repro2.tar | FileCheck %s # CHECK: repro2/response.txt # CHECK-NEXT: repro2/version.txt # CHECK-NEXT: repro2/{{.*}}/dyn diff --git a/test/ELF/section-name.s b/test/ELF/section-name.s index 53f0e536f3d6..06d741b2ea77 100644 --- a/test/ELF/section-name.s +++ b/test/ELF/section-name.s @@ -19,9 +19,9 @@ _start: .byte 0 .section .data,"aw" .byte 0 -.section .bss.a,"",@nobits +.section .bss.a,"aw",@nobits .byte 0 -.section .bss,"",@nobits +.section .bss,"aw",@nobits .byte 0 .section .foo.a,"aw" .byte 0 @@ -51,9 +51,8 @@ _start: // CHECK: 7 .data 00000002 // CHECK: 8 .foo.a 00000001 // CHECK: 9 .foo 00000001 -// CHECK: 10 .bss 00000001 -// CHECK: 11 .bss 00000001 -// CHECK: 12 .comment 00000008 -// CHECK: 13 .symtab 00000060 -// CHECK: 14 .shstrtab 00000075 -// CHECK: 15 .strtab 0000001d +// CHECK: 10 .bss 00000002 +// CHECK: 11 .comment 00000008 +// CHECK: 12 .symtab 00000060 +// CHECK: 13 .shstrtab 00000075 +// CHECK: 14 .strtab 0000001d diff --git a/test/ELF/string-table.s b/test/ELF/string-table.s index 92b8345976d8..490c4d574cf1 100644 --- a/test/ELF/string-table.s +++ b/test/ELF/string-table.s @@ -6,10 +6,7 @@ .global _start _start: -.section foobar,"",@progbits,unique,1 -.section foobar,"T",@progbits,unique,2 -.section foobar,"",@nobits,unique,3 -.section foobar,"",@nobits,unique,4 +.section foobar,"",@progbits .section bar, "a" @@ -27,17 +24,4 @@ _start: // CHECK-NEXT: ] // CHECK-NEXT: Address: 0x0 -// CHECK: Name: foobar -// CHECK-NEXT: Type: SHT_PROGBITS -// CHECK-NEXT: Flags [ -// CHECK-NEXT: SHF_TLS -// CHECK-NEXT: ] -// CHECK-NEXT: Address: 0x0 - -// CHECK: Name: foobar -// CHECK-NEXT: Type: SHT_NOBITS -// CHECK-NEXT: Flags [ -// CHECK-NEXT: ] -// CHECK-NEXT: Address: 0x0 - // CHECK-NOT: Name: foobar diff --git a/test/ELF/undef.s b/test/ELF/undef.s index 5fcd75f948b0..d0f95a3b6381 100644 --- a/test/ELF/undef.s +++ b/test/ELF/undef.s @@ -9,9 +9,9 @@ # CHECK: error: undef.s:(.text+0x6): undefined symbol 'bar' # CHECK: error: undef.s:(.text+0x10): undefined symbol 'foo(int)' # CHECK: error: {{.*}}2.a({{.*}}.o):(.text+0x0): undefined symbol 'zed2' -# CHECK: error: dir/undef-debug.s:3: undefined symbol 'zed3' -# CHECK: error: dir/undef-debug.s:7: undefined symbol 'zed4' -# CHECK: error: dir/undef-debug.s:11: undefined symbol 'zed5' +# CHECK: error: dir{{/|\\}}undef-debug.s:3: undefined symbol 'zed3' +# CHECK: error: dir{{/|\\}}undef-debug.s:7: undefined symbol 'zed4' +# CHECK: error: dir{{/|\\}}undef-debug.s:11: undefined symbol 'zed5' # RUN: not ld.lld %t.o %t2.a -o %t.exe -no-demangle 2>&1 | \ # RUN: FileCheck -check-prefix=NO-DEMANGLE %s |