Index: test/ELF/linkerscript/Inputs/linkerscript-filename-spec.s =================================================================== --- /dev/null +++ test/ELF/linkerscript/Inputs/linkerscript-filename-spec.s @@ -1,2 +0,0 @@ -.section .foo,"a" - .quad 0x11 Index: test/ELF/linkerscript/Inputs/linkerscript-merge-sections-reloc.s =================================================================== --- /dev/null +++ test/ELF/linkerscript/Inputs/linkerscript-merge-sections-reloc.s @@ -1,3 +0,0 @@ -.globl _start -_start: - .quad 0x11223344 Index: test/ELF/linkerscript/Inputs/linkerscript-sort-nested.s =================================================================== --- /dev/null +++ test/ELF/linkerscript/Inputs/linkerscript-sort-nested.s @@ -1,7 +0,0 @@ -.section .aaa.1, "a" -.align 16 -.quad 0x11 - -.section .aaa.2, "a" -.align 4 -.quad 0x22 Index: test/ELF/linkerscript/Inputs/linkerscript-sort.s =================================================================== --- /dev/null +++ test/ELF/linkerscript/Inputs/linkerscript-sort.s @@ -1,19 +0,0 @@ -.section .aaa.5, "a" -.align 2 -.quad 0x55 - -.section .aaa.1, "a" -.align 32 -.quad 0x11 - -.section .aaa.3, "a" -.align 8 -.quad 0x33 - -.section .aaa.2, "a" -.align 16 -.quad 0x22 - -.section .aaa.4, "a" -.align 4 -.quad 0x44 Index: test/ELF/linkerscript/filename-spec.s =================================================================== --- test/ELF/linkerscript/filename-spec.s +++ test/ELF/linkerscript/filename-spec.s @@ -1,7 +1,7 @@ # REQUIRES: x86 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %tfirst.o # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux \ -# RUN: %p/Inputs/linkerscript-filename-spec.s -o %tsecond.o +# RUN: %p/Inputs/filename-spec.s -o %tsecond.o # RUN: echo "SECTIONS { .foo : { \ # RUN: KEEP(*first.o(.foo)) \ @@ -33,22 +33,22 @@ # RUN: ld.lld -o %t4 --script %t4.script %tfirst.o %tsecond.o # RUN: llvm-objdump -s %t4 | FileCheck --check-prefix=SECONDFIRST %s -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %T/linkerscript-filename-spec1.o +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %T/filename-spec1.o # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux \ -# RUN: %p/Inputs/linkerscript-filename-spec.s -o %T/linkerscript-filename-spec2.o +# RUN: %p/Inputs/filename-spec.s -o %T/filename-spec2.o # RUN: echo "SECTIONS { .foo : { \ -# RUN: linkerscript-filename-spec2.o(.foo) \ -# RUN: linkerscript-filename-spec1.o(.foo) } }" > %t5.script +# RUN: filename-spec2.o(.foo) \ +# RUN: filename-spec1.o(.foo) } }" > %t5.script # RUN: ld.lld -o %t5 --script %t5.script \ -# RUN: %T/linkerscript-filename-spec1.o %T/linkerscript-filename-spec2.o +# RUN: %T/filename-spec1.o %T/filename-spec2.o # RUN: llvm-objdump -s %t5 | FileCheck --check-prefix=SECONDFIRST %s # RUN: echo "SECTIONS { .foo : { \ -# RUN: linkerscript-filename-spec1.o(.foo) \ -# RUN: linkerscript-filename-spec2.o(.foo) } }" > %t6.script +# RUN: filename-spec1.o(.foo) \ +# RUN: filename-spec2.o(.foo) } }" > %t6.script # RUN: ld.lld -o %t6 --script %t6.script \ -# RUN: %T/linkerscript-filename-spec1.o %T/linkerscript-filename-spec2.o +# RUN: %T/filename-spec1.o %T/filename-spec2.o # RUN: llvm-objdump -s %t6 | FileCheck --check-prefix=FIRSTSECOND %s .global _start Index: test/ELF/linkerscript/linkerscript-addr.s =================================================================== --- /dev/null +++ test/ELF/linkerscript/linkerscript-addr.s @@ -1,32 +0,0 @@ -# REQUIRES: x86 -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t -# RUN: echo "SECTIONS { \ -# RUN: . = 0x1000; \ -# RUN: .text : { *(.text*) } \ -# RUN: .foo.1 : { *(.foo.1) } \ -# RUN: .foo.2 ADDR(.foo.1) + 0x100 : { *(.foo.2) } \ -# RUN: .foo.3 : { *(.foo.3) } \ -# RUN: }" > %t.script -# RUN: ld.lld %t --script %t.script -o %t1 -# RUN: llvm-objdump -section-headers %t1 | FileCheck %s - -# CHECK: Sections: -# CHECK-NEXT: Idx Name Size Address Type -# CHECK-NEXT: 0 00000000 0000000000000000 -# CHECK-NEXT: 1 .text 00000000 0000000000001000 TEXT DATA -# CHECK-NEXT: 2 .foo.1 00000008 0000000000001000 DATA -# CHECK-NEXT: 3 .foo.2 00000008 0000000000001100 DATA -# CHECK-NEXT: 4 .foo.3 00000008 0000000000001108 DATA - -.text -.globl _start -_start: - -.section .foo.1,"a" - .quad 1 - -.section .foo.2,"a" - .quad 2 - -.section .foo.3,"a" - .quad 3 Index: test/ELF/linkerscript/linkerscript-align.s =================================================================== --- /dev/null +++ test/ELF/linkerscript/linkerscript-align.s @@ -1,61 +0,0 @@ -# REQUIRES: x86 -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t - -## Check that ALIGN command workable using location counter -# RUN: echo "SECTIONS { \ -# RUN: . = 0x10000; \ -# RUN: .aaa : \ -# RUN: { \ -# RUN: *(.aaa) \ -# RUN: } \ -# RUN: . = ALIGN(4096); \ -# RUN: .bbb : \ -# RUN: { \ -# RUN: *(.bbb) \ -# RUN: } \ -# RUN: . = ALIGN(4096 * 4); \ -# RUN: .ccc : \ -# RUN: { \ -# RUN: *(.ccc) \ -# RUN: } \ -# RUN: }" > %t.script -# RUN: ld.lld -o %t1 --script %t.script %t -# RUN: llvm-objdump -section-headers %t1 | FileCheck %s -# CHECK: Sections: -# CHECK-NEXT: Idx Name Size Address Type -# CHECK-NEXT: 0 00000000 0000000000000000 -# CHECK-NEXT: 1 .aaa 00000008 0000000000010000 DATA -# CHECK-NEXT: 2 .bbb 00000008 0000000000011000 DATA -# CHECK-NEXT: 3 .ccc 00000008 0000000000014000 DATA - -## Check output sections ALIGN modificator -# RUN: echo "SECTIONS { \ -# RUN: . = 0x10000; \ -# RUN: .aaa : \ -# RUN: { \ -# RUN: *(.aaa) \ -# RUN: } \ -# RUN: .bbb : ALIGN(4096) \ -# RUN: { \ -# RUN: *(.bbb) \ -# RUN: } \ -# RUN: .ccc : ALIGN(4096 * 4) \ -# RUN: { \ -# RUN: *(.ccc) \ -# RUN: } \ -# RUN: }" > %t2.script -# RUN: ld.lld -o %t2 --script %t2.script %t -# RUN: llvm-objdump -section-headers %t1 | FileCheck %s - -.global _start -_start: - nop - -.section .aaa, "a" -.quad 0 - -.section .bbb, "a" -.quad 0 - -.section .ccc, "a" -.quad 0 Index: test/ELF/linkerscript/linkerscript-assert.s =================================================================== --- /dev/null +++ test/ELF/linkerscript/linkerscript-assert.s @@ -1,27 +0,0 @@ -# REQUIRES: x86 -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1.o - -# RUN: echo "SECTIONS { \ -# RUN: ASSERT(1, \"true\") \ -# RUN: }" > %t1.script -# RUN: ld.lld -shared -o %t1 --script %t1.script %t1.o -# RUN: llvm-readobj %t1 > /dev/null - -# RUN: echo "SECTIONS { \ -# RUN: ASSERT(ASSERT(42, \"true\") == 42, \"true\") \ -# RUN: }" > %t2.script -# RUN: ld.lld -shared -o %t2 --script %t2.script %t1.o -# RUN: llvm-readobj %t2 > /dev/null - -# RUN: echo "SECTIONS { \ -# RUN: ASSERT(0, \"fail\") \ -# RUN: }" > %t3.script -# RUN: not ld.lld -shared -o %t3 --script %t3.script %t1.o > %t.log 2>&1 -# RUN: FileCheck %s -check-prefix=FAIL < %t.log -# FAIL: fail - -# RUN: echo "SECTIONS { \ -# RUN: . = ASSERT(0x1000, \"true\"); \ -# RUN: }" > %t4.script -# RUN: ld.lld -shared -o %t4 --script %t4.script %t1.o -# RUN: llvm-readobj %t4 > /dev/null Index: test/ELF/linkerscript/linkerscript-at.s =================================================================== --- /dev/null +++ test/ELF/linkerscript/linkerscript-at.s @@ -1,128 +0,0 @@ -# REQUIRES: x86 -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t -# RUN: echo "SECTIONS { \ -# RUN: . = 0x1000; \ -# RUN: .aaa : AT(0x2000) \ -# RUN: { \ -# RUN: *(.aaa) \ -# RUN: } \ -# RUN: .bbb : \ -# RUN: { \ -# RUN: *(.bbb) \ -# RUN: } \ -# RUN: .ccc : AT(0x3000) \ -# RUN: { \ -# RUN: *(.ccc) \ -# RUN: } \ -# RUN: .ddd : AT(0x4000) \ -# RUN: { \ -# RUN: *(.ddd) \ -# RUN: } \ -# RUN: }" > %t.script -# RUN: ld.lld %t --script %t.script -o %t2 -# RUN: llvm-readobj -program-headers %t2 | FileCheck %s - -# CHECK: ProgramHeaders [ -# CHECK-NEXT: ProgramHeader { -# CHECK-NEXT: Type: PT_PHDR -# CHECK-NEXT: Offset: 0x40 -# CHECK-NEXT: VirtualAddress: 0x40 -# CHECK-NEXT: PhysicalAddress: 0x40 -# CHECK-NEXT: FileSize: -# CHECK-NEXT: MemSize: -# CHECK-NEXT: Flags [ -# CHECK-NEXT: PF_R -# CHECK-NEXT: ] -# CHECK-NEXT: Alignment: 8 -# CHECK-NEXT: } -# CHECK-NEXT: ProgramHeader { -# CHECK-NEXT: Type: PT_LOAD -# CHECK-NEXT: Offset: 0x0 -# CHECK-NEXT: VirtualAddress: 0x0 -# CHECK-NEXT: PhysicalAddress: 0x0 -# CHECK-NEXT: FileSize: -# CHECK-NEXT: MemSize: -# CHECK-NEXT: Flags [ -# CHECK-NEXT: PF_R -# CHECK-NEXT: ] -# CHECK-NEXT: Alignment: -# CHECK-NEXT: } -# CHECK-NEXT: ProgramHeader { -# CHECK-NEXT: Type: PT_LOAD -# CHECK-NEXT: Offset: 0x1000 -# CHECK-NEXT: VirtualAddress: 0x1000 -# CHECK-NEXT: PhysicalAddress: 0x2000 -# CHECK-NEXT: FileSize: 16 -# CHECK-NEXT: MemSize: 16 -# CHECK-NEXT: Flags [ -# CHECK-NEXT: PF_R -# CHECK-NEXT: ] -# CHECK-NEXT: Alignment: -# CHECK-NEXT: } -# CHECK-NEXT: ProgramHeader { -# CHECK-NEXT: Type: PT_LOAD -# CHECK-NEXT: Offset: 0x1010 -# CHECK-NEXT: VirtualAddress: 0x1010 -# CHECK-NEXT: PhysicalAddress: 0x3000 -# CHECK-NEXT: FileSize: 8 -# CHECK-NEXT: MemSize: 8 -# CHECK-NEXT: Flags [ -# CHECK-NEXT: PF_R -# CHECK-NEXT: ] -# CHECK-NEXT: Alignment: 4096 -# CHECK-NEXT: } -# CHECK-NEXT: ProgramHeader { -# CHECK-NEXT: Type: PT_LOAD -# CHECK-NEXT: Offset: 0x1018 -# CHECK-NEXT: VirtualAddress: 0x1018 -# CHECK-NEXT: PhysicalAddress: 0x4000 -# CHECK-NEXT: FileSize: 8 -# CHECK-NEXT: MemSize: 8 -# CHECK-NEXT: Flags [ -# CHECK-NEXT: PF_R -# CHECK-NEXT: ] -# CHECK-NEXT: Alignment: 4096 -# CHECK-NEXT: } -# CHECK-NEXT: ProgramHeader { -# CHECK-NEXT: Type: PT_LOAD -# CHECK-NEXT: Offset: 0x1020 -# CHECK-NEXT: VirtualAddress: 0x1020 -# CHECK-NEXT: PhysicalAddress: 0x1020 -# CHECK-NEXT: FileSize: 1 -# CHECK-NEXT: MemSize: 1 -# CHECK-NEXT: Flags [ -# CHECK-NEXT: PF_R -# CHECK-NEXT: PF_X -# CHECK-NEXT: ] -# CHECK-NEXT: Alignment: 4096 -# CHECK-NEXT: } -# CHECK-NEXT: ProgramHeader { -# CHECK-NEXT: Type: PT_GNU_STACK -# CHECK-NEXT: Offset: -# CHECK-NEXT: VirtualAddress: 0x0 -# CHECK-NEXT: PhysicalAddress: 0x0 -# CHECK-NEXT: FileSize: -# CHECK-NEXT: MemSize: -# CHECK-NEXT: Flags [ -# CHECK-NEXT: PF_R -# CHECK-NEXT: PF_W -# CHECK-NEXT: ] -# CHECK-NEXT: Alignment: 0 -# CHECK-NEXT: } -# CHECK-NEXT: ] - -.global _start -_start: - nop - -.section .aaa, "a" -.quad 0 - -.section .bbb, "a" -.quad 0 - -.section .ccc, "a" -.quad 0 - -.section .ddd, "a" -.quad 0 Index: test/ELF/linkerscript/linkerscript-common.s =================================================================== --- /dev/null +++ test/ELF/linkerscript/linkerscript-common.s @@ -1,49 +0,0 @@ -# REQUIRES: x86 -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t -# RUN: echo "SECTIONS { .common : { *(COMMON) } }" > %t.script -# RUN: ld.lld -o %t1 --script %t.script %t -# RUN: llvm-readobj -s -t %t1 | FileCheck %s - -# q2 alignment is greater than q1, so it should have smaller offset -# because of sorting -# CHECK: Section { -# CHECK: Index: 1 -# CHECK-NEXT: Name: .common (1) -# CHECK-NEXT: Type: SHT_NOBITS (0x8) -# CHECK-NEXT: Flags [ (0x3) -# CHECK-NEXT: SHF_ALLOC (0x2) -# CHECK-NEXT: SHF_WRITE (0x1) -# CHECK-NEXT: ] -# CHECK-NEXT: Address: 0x200 -# CHECK-NEXT: Offset: 0x158 -# CHECK-NEXT: Size: 256 -# CHECK-NEXT: Link: 0 -# CHECK-NEXT: Info: 0 -# CHECK-NEXT: AddressAlignment: 256 -# CHECK-NEXT: EntrySize: 0 -# CHECK-NEXT: } -# CHECK: Symbol { -# CHECK: Name: q1 (8) -# CHECK-NEXT: Value: 0x280 -# CHECK-NEXT: Size: 128 -# CHECK-NEXT: Binding: Global (0x1) -# CHECK-NEXT: Type: Object (0x1) -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: .common (0x1) -# CHECK-NEXT: } -# CHECK-NEXT: Symbol { -# CHECK-NEXT: Name: q2 (11) -# CHECK-NEXT: Value: 0x200 -# CHECK-NEXT: Size: 128 -# CHECK-NEXT: Binding: Global (0x1) -# CHECK-NEXT: Type: Object (0x1) -# CHECK-NEXT: Other: 0 -# CHECK-NEXT: Section: .common (0x1) -# CHECK-NEXT: } - -.globl _start -_start: - jmp _start - -.comm q1,128,8 -.comm q2,128,256 Index: test/ELF/linkerscript/linkerscript-data-segment-relro.s =================================================================== --- /dev/null +++ test/ELF/linkerscript/linkerscript-data-segment-relro.s @@ -1,69 +0,0 @@ -# REQUIRES: x86 -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1.o -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/shared.s -o %t2.o -# RUN: ld.lld -shared %t2.o -o %t2.so - -# RUN: echo "SECTIONS { \ -# RUN: .plt : { *(.plt) } \ -# RUN: .text : { *(.text) } \ -# RUN: . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE)); \ -# RUN: .dynamic : { *(.dynamic) } \ -# RUN: .got : { *(.got) } \ -# RUN: . = DATA_SEGMENT_RELRO_END (24, .); \ -# RUN: .got.plt : { *(.got.plt) } \ -# RUN: .data : { *(.data) } \ -# RUN: .bss : { *(.bss) } \ -# RUN: . = DATA_SEGMENT_END (.); \ -# RUN: }" > %t.script - -## With relro or without DATA_SEGMENT_RELRO_END just aligns to -## page boundary. -# RUN: ld.lld -z norelro %t1.o %t2.so --script %t.script -o %t -# RUN: llvm-readobj -s %t | FileCheck %s -# RUN: ld.lld -z relro %t1.o %t2.so --script %t.script -o %t2 -# RUN: llvm-readobj -s %t2 | FileCheck %s - -# CHECK: Section { -# CHECK: Index: 4 -# CHECK-NEXT: Name: .got -# CHECK-NEXT: Type: SHT_PROGBITS -# CHECK-NEXT: Flags [ -# CHECK-NEXT: SHF_ALLOC -# CHECK-NEXT: SHF_WRITE -# CHECK-NEXT: ] -# CHECK-NEXT: Address: 0x2000F0 -# CHECK-NEXT: Offset: 0x10F0 -# CHECK-NEXT: Size: -# CHECK-NEXT: Link: -# CHECK-NEXT: Info: -# CHECK-NEXT: AddressAlignment: -# CHECK-NEXT: EntrySize: -# CHECK-NEXT: } -# CHECK-NEXT: Section { -# CHECK-NEXT: Index: 5 -# CHECK-NEXT: Name: .got.plt -# CHECK-NEXT: Type: SHT_PROGBITS -# CHECK-NEXT: Flags [ -# CHECK-NEXT: SHF_ALLOC -# CHECK-NEXT: SHF_WRITE -# CHECK-NEXT: ] -# CHECK-NEXT: Address: 0x201000 -# CHECK-NEXT: Offset: 0x2000 -# CHECK-NEXT: Size: -# CHECK-NEXT: Link: -# CHECK-NEXT: Info: -# CHECK-NEXT: AddressAlignment: -# CHECK-NEXT: EntrySize: -# CHECK-NEXT: } - -.global _start -_start: - .long bar - jmp *bar2@GOTPCREL(%rip) - -.section .data,"aw" -.quad 0 - -.zero 4 -.section .foo,"aw" -.section .bss,"",@nobits Index: test/ELF/linkerscript/linkerscript-diagnostic.s =================================================================== --- /dev/null +++ test/ELF/linkerscript/linkerscript-diagnostic.s @@ -1,66 +0,0 @@ -# REQUIRES: x86 -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t - -## Take some valid script with multiline comments -## and check it actually works: -# RUN: echo "SECTIONS {" > %t.script -# RUN: echo ".text : { *(.text) }" >> %t.script -# RUN: echo ".keep : { *(.keep) } /*" >> %t.script -# RUN: echo "comment line 1" >> %t.script -# RUN: echo "comment line 2 */" >> %t.script -# RUN: echo ".temp : { *(.temp) } }" >> %t.script -# RUN: ld.lld -shared %t -o %t1 --script %t.script - -## Change ":" to "+" at line 2, check that error -## message starts from correct line number: -# RUN: echo "SECTIONS {" > %t.script -# RUN: echo ".text + { *(.text) }" >> %t.script -# RUN: echo ".keep : { *(.keep) } /*" >> %t.script -# RUN: echo "comment line 1" >> %t.script -# RUN: echo "comment line 2 */" >> %t.script -# RUN: echo ".temp : { *(.temp) } }" >> %t.script -# RUN: not ld.lld -shared %t -o %t1 --script %t.script 2>&1 | FileCheck -check-prefix=ERR1 %s -# ERR1: line 2: - -## Change ":" to "+" at line 3 now, check correct error line number: -# RUN: echo "SECTIONS {" > %t.script -# RUN: echo ".text : { *(.text) }" >> %t.script -# RUN: echo ".keep + { *(.keep) } /*" >> %t.script -# RUN: echo "comment line 1" >> %t.script -# RUN: echo "comment line 2 */" >> %t.script -# RUN: echo ".temp : { *(.temp) } }" >> %t.script -# RUN: not ld.lld -shared %t -o %t1 --script %t.script 2>&1 | FileCheck -check-prefix=ERR2 %s -# ERR2: line 3: - -## Change ":" to "+" at line 6, after multiline comment, -## check correct error line number: -# RUN: echo "SECTIONS {" > %t.script -# RUN: echo ".text : { *(.text) }" >> %t.script -# RUN: echo ".keep : { *(.keep) } /*" >> %t.script -# RUN: echo "comment line 1" >> %t.script -# RUN: echo "comment line 2 */" >> %t.script -# RUN: echo ".temp + { *(.temp) } }" >> %t.script -# RUN: not ld.lld -shared %t -o %t1 --script %t.script 2>&1 | FileCheck -check-prefix=ERR5 %s -# ERR5: line 6: - -## Check that text of lines and pointer to 'bad' token are working ok. -# RUN: echo "UNKNOWN_TAG {" > %t.script -# RUN: echo ".text : { *(.text) }" >> %t.script -# RUN: echo ".keep : { *(.keep) }" >> %t.script -# RUN: echo ".temp : { *(.temp) } }" >> %t.script -# RUN: not ld.lld -shared %t -o %t1 --script %t.script > %t.log 2>&1 -# RUN: FileCheck -check-prefix=ERR6 %s < %t.log -# ERR6: line 1: -# ERR6-NEXT: UNKNOWN_TAG { -# RUN: grep '^^' %t.log - -## One more check that text of lines and pointer to 'bad' token are working ok. -# RUN: echo "SECTIONS {" > %t.script -# RUN: echo ".text : { *(.text) }" >> %t.script -# RUN: echo ".keep : { *(.keep) }" >> %t.script -# RUN: echo "boom .temp : { *(.temp) } }" >> %t.script -# RUN: not ld.lld -shared %t -o %t1 --script %t.script > %t.log 2>&1 -# RUN: FileCheck -check-prefix=ERR7 %s < %t.log -# ERR7: line 4: malformed number: .temp -# ERR7-NEXT: boom .temp : { *(.temp) } } -# RUN: grep '^ ^' %t.log Index: test/ELF/linkerscript/linkerscript-discard-interp.s =================================================================== --- /dev/null +++ test/ELF/linkerscript/linkerscript-discard-interp.s @@ -1,12 +0,0 @@ -// RUN: llvm-mc -filetype=obj -triple=i686-unknown-linux %s -o %t.o -// RUN: llvm-mc -filetype=obj -triple=i686-unknown-linux %p/../Inputs/shared.s -o %t2.o -// RUN: ld.lld -shared %t2.o -o %t2.so -// RUN: echo "PHDRS { text PT_LOAD FILEHDR PHDRS; } \ -// RUN: SECTIONS { .text : { *(.text) } : text }" >> %t.script -// RUN: ld.lld -dynamic-linker /lib64/ld-linux-x86-64.so.2 -rpath foo -rpath bar --script %t.script --export-dynamic %t.o %t2.so -o %t -// RUN: llvm-readobj -s %t | FileCheck %s - -// CHECK-NOT: Name: .interp - -.global _start -_start: Index: test/ELF/linkerscript/linkerscript-dynamic.s =================================================================== --- /dev/null +++ test/ELF/linkerscript/linkerscript-dynamic.s @@ -1,28 +0,0 @@ -# REQUIRES: x86 -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1.o -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/shared.s -o %t2.o -# RUN: ld.lld -shared %t2.o -o %t2.so - -# RUN: echo "SECTIONS { }" > %t.script -# RUN: ld.lld %t1.o %t2.so -o %t -# RUN: llvm-readobj -dynamic-table %t | FileCheck %s - -# CHECK: DynamicSection [ -# CHECK-NEXT: Tag Type Name/Value -# CHECK: 0x0000000000000021 PREINIT_ARRAYSZ 9 (bytes) -# CHECK: 0x000000000000001B INIT_ARRAYSZ 8 (bytes) -# CHECK: 0x000000000000001C FINI_ARRAYSZ 10 (bytes) - -.globl _start -_start: - -.section .init_array,"aw",@init_array - .quad 0 - -.section .preinit_array,"aw",@preinit_array - .quad 0 - .byte 0 - -.section .fini_array,"aw",@fini_array - .quad 0 - .short 0 Index: test/ELF/linkerscript/linkerscript-edata-etext.s =================================================================== --- /dev/null +++ test/ELF/linkerscript/linkerscript-edata-etext.s @@ -1,20 +0,0 @@ -# REQUIRES: x86 -# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o -# RUN: echo "SECTIONS { }" > %t.script -# RUN: not ld.lld %t.o -script %t.script -o %t 2>&1 | FileCheck %s -# CHECK: undefined symbol: _edata -# CHECK: undefined symbol: _end -# CHECK: undefined symbol: _etext - -.global _start,_end,_etext,_edata -.text -_start: - .quad _edata + 0x1 - .quad _etext + 0x1 - .quad _end + 0x1 - -.data - .word 1 -.bss - .align 4 - .space 6 Index: test/ELF/linkerscript/linkerscript-eh-frame-hdr.s =================================================================== --- /dev/null +++ test/ELF/linkerscript/linkerscript-eh-frame-hdr.s @@ -1,20 +0,0 @@ -# REQUIRES: x86 -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t -# RUN: echo "SECTIONS { \ -# RUN: .eh_frame_hdr : {} \ -# RUN: .eh_frame : {} \ -# RUN: }" > %t.script -# RUN: ld.lld -o %t1 --eh-frame-hdr --script %t.script %t -# RUN: llvm-objdump -s -section=".eh_frame_hdr" %t1 | FileCheck %s - -# CHECK: 0158 011b033b 14000000 01000000 49000000 -# CHECK-NEXT: 0168 30000000 - -.global _start -_start: - nop - -.section .dah,"ax",@progbits -.cfi_startproc - nop -.cfi_endproc Index: test/ELF/linkerscript/linkerscript-ehdr_start.s =================================================================== --- /dev/null +++ test/ELF/linkerscript/linkerscript-ehdr_start.s @@ -1,11 +0,0 @@ -# REQUIRES: x86 - -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o -# RUN: echo "SECTIONS { }" > %t.script -# RUN: not ld.lld %t.o -script %t.script -o %t 2>&1 | FileCheck %s -# CHECK: undefined symbol: __ehdr_start - -.text -.global _start, __ehdr_start -_start: - .quad __ehdr_start Index: test/ELF/linkerscript/linkerscript-excludefile.s =================================================================== --- /dev/null +++ test/ELF/linkerscript/linkerscript-excludefile.s @@ -1,46 +0,0 @@ -# REQUIRES: x86 -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1 -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux \ -# RUN: %p/Inputs/include.s -o %t2 -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux \ -# RUN: %p/Inputs/notinclude.s -o %t3.notinclude - -# RUN: echo "SECTIONS {} " > %t.script -# RUN: ld.lld -o %t --script %t.script %t1 %t2 %t3.notinclude -# RUN: llvm-objdump -d %t | FileCheck %s - -# CHECK: Disassembly of section .text: -# CHECK: _start: -# CHECK: 120: 48 c7 c0 3c 00 00 00 movq $60, %rax -# CHECK: 127: 48 c7 c7 2a 00 00 00 movq $42, %rdi -# CHECK: 12e: 00 00 addb %al, (%rax) -# CHECK: _potato: -# CHECK: 130: 90 nop -# CHECK: 131: 90 nop -# CHECK: 132: 00 00 addb %al, (%rax) -# CHECK: tomato: -# CHECK: 134: b8 01 00 00 00 movl $1, %eax - -# RUN: echo "SECTIONS { .patatino : \ -# RUN: { KEEP(*(EXCLUDE_FILE(*notinclude) .text)) } }" \ -# RUN: > %t.script -# RUN: ld.lld -o %t4 --script %t.script %t1 %t2 %t3.notinclude -# RUN: llvm-objdump -d %t4 | FileCheck %s --check-prefix=EXCLUDE - -# EXCLUDE: Disassembly of section .patatino: -# EXCLUDE: _start: -# EXCLUDE: 120: 48 c7 c0 3c 00 00 00 movq $60, %rax -# EXCLUDE: 127: 48 c7 c7 2a 00 00 00 movq $42, %rdi -# EXCLUDE: 12e: 00 00 addb %al, (%rax) -# EXCLUDE: _potato: -# EXCLUDE: 130: 90 nop -# EXCLUDE: 131: 90 nop -# EXCLUDE: Disassembly of section .text: -# EXCLUDE: tomato: -# EXCLUDE: 134: b8 01 00 00 00 movl $1, %eax - -.section .text -.globl _start -_start: - mov $60, %rax - mov $42, %rdi Index: test/ELF/linkerscript/linkerscript-input-order.s =================================================================== --- /dev/null +++ test/ELF/linkerscript/linkerscript-input-order.s @@ -1,38 +0,0 @@ -# REQUIRES: x86 -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t - -# This test case should place input sections in script order: -# .foo.1 .foo.2 .bar.1 .bar.2 -# RUN: echo "SECTIONS { . = 0x1000; .foo : {*(.foo.*) *(.bar.*) } }" > %t.script -# RUN: ld.lld -o %t1 --script %t.script %t -# RUN: llvm-objdump -section=.foo -s %t1 | FileCheck --check-prefix=SCRIPT_ORDER %s -# SCRIPT_ORDER: Contents of section .foo: -# SCRIPT_ORDER-NEXT: 1000 00000000 00000000 ffffffff eeeeeeee - -# This test case should place input sections in native order: -# .bar.1 .foo.1 .bar.2 .foo.2 -# RUN: echo "SECTIONS { . = 0x1000; .foo : {*(.foo.* .bar.*)} }" > %t.script -# RUN: ld.lld -o %t1 --script %t.script %t -# RUN: llvm-objdump -section=.foo -s %t1 | FileCheck --check-prefix=FILE_ORDER %s -# FILE_ORDER: Contents of section .foo: -# FILE_ORDER-NEXT: 1000 ffffffff 00000000 eeeeeeee 00000000 - -.global _start -_start: - nop - -.section .bar.1,"a" -bar1: - .long 0xFFFFFFFF - -.section .foo.1,"a" -foo1: - .long 0 - -.section .bar.2,"a" -bar2: - .long 0xEEEEEEEE - -.section .foo.2,"a" -foo2: - .long 0 Index: test/ELF/linkerscript/linkerscript-input-sec-dup.s =================================================================== --- /dev/null +++ test/ELF/linkerscript/linkerscript-input-sec-dup.s @@ -1,18 +0,0 @@ -# REQUIRES: x86 -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t - -# RUN: echo "SECTIONS {.foo : { *(.foo) *(.foo) } }" > %t.script -# RUN: ld.lld -o %t1 --script %t.script %t -# RUN: llvm-objdump -section-headers %t1 | FileCheck %s -# CHECK: Sections: -# CHECK-NEXT: Idx Name Size Address Type -# CHECK-NEXT: 0 00000000 0000000000000000 -# CHECK-NEXT: 1 .foo 00000004 0000000000000120 DATA -# CHECK-NEXT: 2 .text 00000001 0000000000000124 TEXT DATA - -.global _start -_start: - nop - -.section .foo,"a" - .long 0 Index: test/ELF/linkerscript/linkerscript-locationcounter.s =================================================================== --- /dev/null +++ test/ELF/linkerscript/linkerscript-locationcounter.s @@ -1,422 +0,0 @@ -# REQUIRES: x86 -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t -# RUN: echo "SECTIONS { \ -# RUN: . = 0xFFF0; \ -# RUN: . = . + 0x10; \ -# RUN: .plus : { *(.plus) } \ -# RUN: . = 0x11010 - 0x10; \ -# RUN: .minus : { *(.minus) } \ -# RUN: . = 0x24000 / 0x2; \ -# RUN: .div : { *(.div) } \ -# RUN: . = 0x11000 + 0x1000 * 0x2; \ -# RUN: .mul : { *(.mul) } \ -# RUN: . = 0x10000 + (0x1000 + 0x1000) * 0x2; \ -# RUN: .bracket : { *(.bracket) } \ -# RUN: . = 0x17000 & 0x15000; \ -# RUN: .and : { *(.and) } \ -# RUN: . = 0x1 ? 0x16000 : 0x999999; \ -# RUN: .ternary1 : { *(.ternary1) } \ -# RUN: . = 0x0 ? 0x999999 : 0x17000; \ -# RUN: .ternary2 : { *(.ternary2) } \ -# RUN: . = 0x0 < 0x1 ? 0x18000 : 0x999999; \ -# RUN: .less : { *(.less) } \ -# RUN: . = 0x1 <= 0x1 ? 0x19000 : 0x999999; \ -# RUN: .lesseq : { *(.lesseq) } \ -# RUN: . = 0x1 > 0x0 ? 0x20000 : 0x999999; \ -# RUN: .great : { *(.great) } \ -# RUN: . = 0x1 >= 0x1 ? 0x21000 : 0x999999; \ -# RUN: .greateq : { *(.greateq) } \ -# RUN: . = 0x1 == 0x1 ? 0x22000 : 0x999999; \ -# RUN: .eq : { *(.eq) } \ -# RUN: . = 0x2 != 0x1 ? 0x23000 : 0x999999; \ -# RUN: .neq : { *(.neq) } \ -# RUN: . = CONSTANT (MAXPAGESIZE) * 0x24; \ -# RUN: .maxpagesize : { *(.maxpagesize) } \ -# RUN: . = CONSTANT (COMMONPAGESIZE) * 0x25; \ -# RUN: .commonpagesize : { *(.commonpagesize) } \ -# RUN: . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE)); \ -# RUN: .datasegmentalign : { *(.datasegmentalign) } \ -# RUN: . = DATA_SEGMENT_END (.); \ -# RUN: . = 0x27000; \ -# RUN: . += 0x1000; \ -# RUN: .plusassign : { *(.plusassign) } \ -# RUN: }" > %t.script -# RUN: ld.lld %t --script %t.script -o %t2 -# RUN: llvm-readobj -s %t2 | FileCheck %s - -# CHECK: Section { -# CHECK: Index: 1 -# CHECK: Name: .plus -# CHECK-NEXT: Type: SHT_PROGBITS -# CHECK-NEXT: Flags [ -# CHECK-NEXT: SHF_ALLOC -# CHECK-NEXT: ] -# CHECK-NEXT: Address: 0x10000 -# CHECK-NEXT: Offset: -# CHECK-NEXT: Size: -# CHECK-NEXT: Link: -# CHECK-NEXT: Info: -# CHECK-NEXT: AddressAlignment: -# CHECK-NEXT: EntrySize: -# CHECK-NEXT: } -# CHECK-NEXT: Section { -# CHECK-NEXT: Index: 2 -# CHECK-NEXT: Name: .minus -# CHECK-NEXT: Type: SHT_PROGBITS -# CHECK-NEXT: Flags [ -# CHECK-NEXT: SHF_ALLOC -# CHECK-NEXT: ] -# CHECK-NEXT: Address: 0x11000 -# CHECK-NEXT: Offset: -# CHECK-NEXT: Size: -# CHECK-NEXT: Link: -# CHECK-NEXT: Info: -# CHECK-NEXT: AddressAlignment: -# CHECK-NEXT: EntrySize: -# CHECK-NEXT: } -# CHECK-NEXT: Section { -# CHECK-NEXT: Index: 3 -# CHECK-NEXT: Name: .div -# CHECK-NEXT: Type: SHT_PROGBITS -# CHECK-NEXT: Flags [ -# CHECK-NEXT: SHF_ALLOC -# CHECK-NEXT: ] -# CHECK-NEXT: Address: 0x12000 -# CHECK-NEXT: Offset: -# CHECK-NEXT: Size: -# CHECK-NEXT: Link: -# CHECK-NEXT: Info: -# CHECK-NEXT: AddressAlignment: -# CHECK-NEXT: EntrySize: -# CHECK-NEXT: } -# CHECK-NEXT: Section { -# CHECK-NEXT: Index: 4 -# CHECK-NEXT: Name: .mul -# CHECK-NEXT: Type: SHT_PROGBITS -# CHECK-NEXT: Flags [ -# CHECK-NEXT: SHF_ALLOC -# CHECK-NEXT: ] -# CHECK-NEXT: Address: 0x13000 -# CHECK-NEXT: Offset: -# CHECK-NEXT: Size: -# CHECK-NEXT: Link: -# CHECK-NEXT: Info: -# CHECK-NEXT: AddressAlignment: -# CHECK-NEXT: EntrySize: -# CHECK-NEXT: } -# CHECK-NEXT: Section { -# CHECK-NEXT: Index: 5 -# CHECK-NEXT: Name: .bracket -# CHECK-NEXT: Type: SHT_PROGBITS -# CHECK-NEXT: Flags [ -# CHECK-NEXT: SHF_ALLOC -# CHECK-NEXT: ] -# CHECK-NEXT: Address: 0x14000 -# CHECK-NEXT: Offset: -# CHECK-NEXT: Size: -# CHECK-NEXT: Link: -# CHECK-NEXT: Info: -# CHECK-NEXT: AddressAlignment: -# CHECK-NEXT: EntrySize: -# CHECK-NEXT: } -# CHECK-NEXT: Section { -# CHECK-NEXT: Index: -# CHECK-NEXT: Name: .and -# CHECK-NEXT: Type: SHT_PROGBITS -# CHECK-NEXT: Flags [ -# CHECK-NEXT: SHF_ALLOC -# CHECK-NEXT: ] -# CHECK-NEXT: Address: 0x15000 -# CHECK-NEXT: Offset: -# CHECK-NEXT: Size: -# CHECK-NEXT: Link: -# CHECK-NEXT: Info: -# CHECK-NEXT: AddressAlignment: -# CHECK-NEXT: EntrySize: -# CHECK-NEXT: } -# CHECK-NEXT: Section { -# CHECK-NEXT: Index: -# CHECK-NEXT: Name: .ternary1 -# CHECK-NEXT: Type: SHT_PROGBITS -# CHECK-NEXT: Flags [ -# CHECK-NEXT: SHF_ALLOC -# CHECK-NEXT: ] -# CHECK-NEXT: Address: 0x16000 -# CHECK-NEXT: Offset: -# CHECK-NEXT: Size: -# CHECK-NEXT: Link: -# CHECK-NEXT: Info: -# CHECK-NEXT: AddressAlignment: -# CHECK-NEXT: EntrySize: -# CHECK-NEXT: } -# CHECK-NEXT: Section { -# CHECK-NEXT: Index: -# CHECK-NEXT: Name: .ternary2 -# CHECK-NEXT: Type: SHT_PROGBITS -# CHECK-NEXT: Flags [ -# CHECK-NEXT: SHF_ALLOC -# CHECK-NEXT: ] -# CHECK-NEXT: Address: 0x17000 -# CHECK-NEXT: Offset: -# CHECK-NEXT: Size: -# CHECK-NEXT: Link: -# CHECK-NEXT: Info: -# CHECK-NEXT: AddressAlignment: -# CHECK-NEXT: EntrySize: -# CHECK-NEXT: } -# CHECK-NEXT: Section { -# CHECK-NEXT: Index: -# CHECK-NEXT: Name: .less -# CHECK-NEXT: Type: SHT_PROGBITS -# CHECK-NEXT: Flags [ -# CHECK-NEXT: SHF_ALLOC -# CHECK-NEXT: ] -# CHECK-NEXT: Address: 0x18000 -# CHECK-NEXT: Offset: -# CHECK-NEXT: Size: -# CHECK-NEXT: Link: -# CHECK-NEXT: Info: -# CHECK-NEXT: AddressAlignment: -# CHECK-NEXT: EntrySize: -# CHECK-NEXT: } -# CHECK-NEXT: Section { -# CHECK-NEXT: Index: -# CHECK-NEXT: Name: .lesseq -# CHECK-NEXT: Type: SHT_PROGBITS -# CHECK-NEXT: Flags [ -# CHECK-NEXT: SHF_ALLOC -# CHECK-NEXT: ] -# CHECK-NEXT: Address: 0x19000 -# CHECK-NEXT: Offset: -# CHECK-NEXT: Size: -# CHECK-NEXT: Link: -# CHECK-NEXT: Info: -# CHECK-NEXT: AddressAlignment: -# CHECK-NEXT: EntrySize: -# CHECK-NEXT: } -# CHECK-NEXT: Section { -# CHECK-NEXT: Index: -# CHECK-NEXT: Name: .great -# CHECK-NEXT: Type: SHT_PROGBITS -# CHECK-NEXT: Flags [ -# CHECK-NEXT: SHF_ALLOC -# CHECK-NEXT: ] -# CHECK-NEXT: Address: 0x20000 -# CHECK-NEXT: Offset: -# CHECK-NEXT: Size: -# CHECK-NEXT: Link: -# CHECK-NEXT: Info: -# CHECK-NEXT: AddressAlignment: -# CHECK-NEXT: EntrySize: -# CHECK-NEXT: } -# CHECK-NEXT: Section { -# CHECK-NEXT: Index: -# CHECK-NEXT: Name: .greateq -# CHECK-NEXT: Type: SHT_PROGBITS -# CHECK-NEXT: Flags [ -# CHECK-NEXT: SHF_ALLOC -# CHECK-NEXT: ] -# CHECK-NEXT: Address: 0x21000 -# CHECK-NEXT: Offset: -# CHECK-NEXT: Size: -# CHECK-NEXT: Link: -# CHECK-NEXT: Info: -# CHECK-NEXT: AddressAlignment: -# CHECK-NEXT: EntrySize: -# CHECK-NEXT: } -# CHECK-NEXT: Section { -# CHECK-NEXT: Index: -# CHECK-NEXT: Name: .eq -# CHECK-NEXT: Type: SHT_PROGBITS -# CHECK-NEXT: Flags [ -# CHECK-NEXT: SHF_ALLOC -# CHECK-NEXT: ] -# CHECK-NEXT: Address: 0x22000 -# CHECK-NEXT: Offset: -# CHECK-NEXT: Size: -# CHECK-NEXT: Link: -# CHECK-NEXT: Info: -# CHECK-NEXT: AddressAlignment: -# CHECK-NEXT: EntrySize: -# CHECK-NEXT: } -# CHECK-NEXT: Section { -# CHECK-NEXT: Index: -# CHECK-NEXT: Name: .neq -# CHECK-NEXT: Type: SHT_PROGBITS -# CHECK-NEXT: Flags [ -# CHECK-NEXT: SHF_ALLOC -# CHECK-NEXT: ] -# CHECK-NEXT: Address: 0x23000 -# CHECK-NEXT: Offset: -# CHECK-NEXT: Size: -# CHECK-NEXT: Link: -# CHECK-NEXT: Info: -# CHECK-NEXT: AddressAlignment: -# CHECK-NEXT: EntrySize: -# CHECK-NEXT: } -# CHECK-NEXT: Section { -# CHECK-NEXT: Index: -# CHECK-NEXT: Name: .maxpagesize -# CHECK-NEXT: Type: SHT_PROGBITS -# CHECK-NEXT: Flags [ -# CHECK-NEXT: SHF_ALLOC -# CHECK-NEXT: ] -# CHECK-NEXT: Address: 0x4800000 -# CHECK-NEXT: Offset: -# CHECK-NEXT: Size: -# CHECK-NEXT: Link: -# CHECK-NEXT: Info: -# CHECK-NEXT: AddressAlignment: -# CHECK-NEXT: EntrySize: 0 -# CHECK-NEXT: } -# CHECK-NEXT: Section { -# CHECK-NEXT: Index: -# CHECK-NEXT: Name: .commonpagesize -# CHECK-NEXT: Type: SHT_PROGBITS -# CHECK-NEXT: Flags [ -# CHECK-NEXT: SHF_ALLOC -# CHECK-NEXT: ] -# CHECK-NEXT: Address: 0x25000 -# CHECK-NEXT: Offset: -# CHECK-NEXT: Size: -# CHECK-NEXT: Link: -# CHECK-NEXT: Info: -# CHECK-NEXT: AddressAlignment: -# CHECK-NEXT: EntrySize: -# CHECK-NEXT: } -# CHECK-NEXT: Section { -# CHECK-NEXT: Index: -# CHECK-NEXT: Name: .datasegmentalign -# CHECK-NEXT: Type: SHT_PROGBITS -# CHECK-NEXT: Flags [ -# CHECK-NEXT: SHF_ALLOC -# CHECK-NEXT: ] -# CHECK-NEXT: Address: 0x200000 -# CHECK-NEXT: Offset: -# CHECK-NEXT: Size: -# CHECK-NEXT: Link: -# CHECK-NEXT: Info: -# CHECK-NEXT: AddressAlignment: -# CHECK-NEXT: EntrySize: -# CHECK-NEXT: } -# CHECK-NEXT: Section { -# CHECK-NEXT: Index: -# CHECK-NEXT: Name: .plusassign -# CHECK-NEXT: Type: SHT_PROGBITS -# CHECK-NEXT: Flags [ -# CHECK-NEXT: SHF_ALLOC -# CHECK-NEXT: ] -# CHECK-NEXT: Address: 0x28000 -# CHECK-NEXT: Offset: -# CHECK-NEXT: Size: -# CHECK-NEXT: Link: -# CHECK-NEXT: Info: -# CHECK-NEXT: AddressAlignment: -# CHECK-NEXT: EntrySize: -# CHECK-NEXT: } - -## Mailformed number error. -# RUN: echo "SECTIONS { \ -# RUN: . = 0x12Q41; \ -# RUN: }" > %t.script -# RUN: not ld.lld %t --script %t.script -o %t2 2>&1 | \ -# RUN: FileCheck --check-prefix=NUMERR %s -# NUMERR: malformed number: 0x12Q41 - -## Missing closing bracket. -# RUN: echo "SECTIONS { \ -# RUN: . = 0x10000 + (0x1000 + 0x1000 * 0x2; \ -# RUN: }" > %t.script -# RUN: not ld.lld %t --script %t.script -o %t2 2>&1 | \ -# RUN: FileCheck --check-prefix=BRACKETERR %s -# BRACKETERR: ) expected, but got ; - -## Missing opening bracket. -# RUN: echo "SECTIONS { \ -# RUN: . = 0x10000 + 0x1000 + 0x1000) * 0x2; \ -# RUN: }" > %t.script -# RUN: not ld.lld %t --script %t.script -o %t2 2>&1 | \ -# RUN: FileCheck --check-prefix=BRACKETERR2 %s -# BRACKETERR2: ; expected, but got ) - -## Empty expression. -# RUN: echo "SECTIONS { \ -# RUN: . = ; \ -# RUN: }" > %t.script -# RUN: not ld.lld %t --script %t.script -o %t2 2>&1 | \ -# RUN: FileCheck --check-prefix=ERREXPR %s -# ERREXPR: malformed number: ; - -## Div by zero error. -# RUN: echo "SECTIONS { \ -# RUN: . = 0x10000 / 0x0; \ -# RUN: }" > %t.script -# RUN: not ld.lld %t --script %t.script -o %t2 2>&1 | \ -# RUN: FileCheck --check-prefix=DIVZERO %s -# DIVZERO: division by zero - -## Broken ternary operator expression. -# RUN: echo "SECTIONS { \ -# RUN: . = 0x1 ? 0x2; \ -# RUN: }" > %t.script -# RUN: not ld.lld %t --script %t.script -o %t2 2>&1 | \ -# RUN: FileCheck --check-prefix=TERNERR %s -# TERNERR: : expected, but got ; - -.globl _start -_start: -nop - -.section .plus, "a" -.quad 0 - -.section .minus, "a" -.quad 0 - -.section .div, "a" -.quad 0 - -.section .mul, "a" -.quad 0 - -.section .bracket, "a" -.quad 0 - -.section .and, "a" -.quad 0 - -.section .ternary1, "a" -.quad 0 - -.section .ternary2, "a" -.quad 0 - -.section .less, "a" -.quad 0 - -.section .lesseq, "a" -.quad 0 - -.section .great, "a" -.quad 0 - -.section .greateq, "a" -.quad 0 - -.section .eq, "a" -.quad 0 - -.section .neq, "a" -.quad 0 - -.section .maxpagesize, "a" -.quad 0 - -.section .commonpagesize, "a" -.quad 0 - -.section .datasegmentalign, "a" -.quad 0 - -.section .plusassign, "a" -.quad 0 Index: test/ELF/linkerscript/linkerscript-merge-sections.s =================================================================== --- /dev/null +++ test/ELF/linkerscript/linkerscript-merge-sections.s @@ -1,28 +0,0 @@ -# REQUIRES: x86 -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t - -# RUN: echo "SECTIONS { .foo : { *(.foo.*) } }" > %t.script -# RUN: ld.lld -o %t1 --script %t.script %t -# RUN: llvm-objdump -s %t1 | FileCheck %s -# CHECK: Contents of section .foo: -# CHECK-NEXT: 0158 01000000 02000000 00000000 73686f72 ............shor -# CHECK-NEXT: 0168 7420756e 7369676e 65642069 6e7400 t unsigned int. - -.global _start -_start: - nop - -.section .foo.1, "aw" -writable: - .long 1 - -.section .foo.2, "aM",@progbits,1 -readable: - .long 2 - -.section .foo.3, "awx" - .long 0 - -.section .foo.4, "MS",@progbits,1 -.LASF2: - .string "short unsigned int" Index: test/ELF/linkerscript/linkerscript-multi-sections-constraint.s =================================================================== --- /dev/null +++ test/ELF/linkerscript/linkerscript-multi-sections-constraint.s @@ -1,41 +0,0 @@ -# REQUIRES: x86 -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t -# RUN: echo "SECTIONS { \ -# RUN: . = 0x1000; .aaa : ONLY_IF_RO { *(.aaa.*) } \ -# RUN: . = 0x2000; .aaa : ONLY_IF_RW { *(.aaa.*) } } " > %t.script -# RUN: ld.lld -o %t1 --script %t.script %t -# RUN: llvm-objdump -section-headers %t1 | FileCheck %s - -# CHECK: Sections: -# CHECK-NEXT: Idx Name Size Address Type -# CHECK-NEXT: 0 00000000 0000000000000000 -# CHECK-NEXT: 1 .aaa 00000010 0000000000002000 DATA -# CHECK-NEXT: 2 .text 00000001 0000000000002010 TEXT DATA -# CHECK-NEXT: 3 .symtab 00000030 0000000000000000 -# CHECK-NEXT: 4 .shstrtab 00000026 0000000000000000 -# CHECK-NEXT: 5 .strtab 00000008 0000000000000000 - -# RUN: echo "SECTIONS { \ -# RUN: . = 0x1000; .aaa : ONLY_IF_RW { *(.aaa.*) } \ -# RUN: . = 0x2000; .aaa : ONLY_IF_RO { *(.aaa.*) } } " > %t2.script -# RUN: ld.lld -o %t2 --script %t2.script %t -# RUN: llvm-objdump -section-headers %t2 | FileCheck %s --check-prefix=REV - -# REV: Sections: -# REV-NEXT: Idx Name Size Address Type -# REV-NEXT: 0 00000000 0000000000000000 -# REV-NEXT: 1 .aaa 00000010 0000000000001000 DATA -# REV-NEXT: 2 .text 00000001 0000000000002000 TEXT DATA -# REV-NEXT: 3 .symtab 00000030 0000000000000000 -# REV-NEXT: 4 .shstrtab 00000026 0000000000000000 -# REV-NEXT: 5 .strtab 00000008 0000000000000000 - -.global _start -_start: - nop - -.section .aaa.1, "aw" -.quad 1 - -.section .aaa.2, "aw" -.quad 1 Index: test/ELF/linkerscript/linkerscript-numbers.s =================================================================== --- /dev/null +++ test/ELF/linkerscript/linkerscript-numbers.s @@ -1,72 +0,0 @@ -# REQUIRES: x86 -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t -# RUN: echo "SECTIONS { \ -# RUN: . = 1000h; \ -# RUN: .hex1 : { *(.hex.1) } \ -# RUN: . = 1010H; \ -# RUN: .hex2 : { *(.hex.2) } \ -# RUN: . = 10k; \ -# RUN: .kilo1 : { *(.kilo.1) } \ -# RUN: . = 11K; \ -# RUN: .kilo2 : { *(.kilo.2) } \ -# RUN: . = 1m; \ -# RUN: .mega1 : { *(.mega.1) } \ -# RUN: . = 2M; \ -# RUN: .mega2 : { *(.mega.2) } \ -# RUN: }" > %t.script -# RUN: ld.lld %t --script %t.script -o %t2 -# RUN: llvm-objdump -section-headers %t2 | FileCheck %s - -# CHECK: Sections: -# CHECK-NEXT: Idx Name Size Address -# CHECK-NEXT: 0 00000000 0000000000000000 -# CHECK-NEXT: 1 .hex1 00000008 0000000000001000 -# CHECK-NEXT: 2 .hex2 00000008 0000000000001010 -# CHECK-NEXT: 3 .kilo1 00000008 0000000000002800 -# CHECK-NEXT: 4 .kilo2 00000008 0000000000002c00 -# CHECK-NEXT: 5 .mega1 00000008 0000000000100000 -# CHECK-NEXT: 6 .mega2 00000008 0000000000200000 - -## Mailformed number errors. -# RUN: echo "SECTIONS { \ -# RUN: . = 0x11h; \ -# RUN: }" > %t2.script -# RUN: not ld.lld %t --script %t2.script -o %t3 2>&1 | \ -# RUN: FileCheck --check-prefix=ERR1 %s -# ERR1: malformed number: 0x11h - -# RUN: echo "SECTIONS { \ -# RUN: . = 0x11k; \ -# RUN: }" > %t3.script -# RUN: not ld.lld %t --script %t3.script -o %t4 2>&1 | \ -# RUN: FileCheck --check-prefix=ERR2 %s -# ERR2: malformed number: 0x11k - -# RUN: echo "SECTIONS { \ -# RUN: . = 0x11m; \ -# RUN: }" > %t4.script -# RUN: not ld.lld %t --script %t4.script -o %t5 2>&1 | \ -# RUN: FileCheck --check-prefix=ERR3 %s -# ERR3: malformed number: 0x11m - -.globl _start -_start: -nop - -.section .hex.1, "a" -.quad 0 - -.section .kilo.1, "a" -.quad 0 - -.section .mega.1, "a" -.quad 0 - -.section .hex.2, "a" -.quad 0 - -.section .kilo.2, "a" -.quad 0 - -.section .mega.2, "a" -.quad 0 Index: test/ELF/linkerscript/linkerscript-orphans.s =================================================================== --- /dev/null +++ test/ELF/linkerscript/linkerscript-orphans.s @@ -1,31 +0,0 @@ -# REQUIRES: x86 -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t - -# RUN: echo "SECTIONS { .writable : { *(.writable) } }" > %t.script -# RUN: ld.lld -o %t.out --script %t.script %t -# RUN: llvm-objdump -section-headers %t.out | \ -# RUN: FileCheck -check-prefix=TEXTORPHAN %s - -# RUN: echo "SECTIONS { .text : { *(.text) } }" > %t.script -# RUN: ld.lld -o %t.out --script %t.script %t -# RUN: llvm-objdump -section-headers %t.out | \ -# RUN: FileCheck -check-prefix=WRITABLEORPHAN %s - -# TEXTORPHAN: Sections: -# TEXTORPHAN-NEXT: Idx Name -# TEXTORPHAN-NEXT: 0 -# TEXTORPHAN-NEXT: 1 .writable -# TEXTORPHAN-NEXT: 2 .text - -# WRITABLEORPHAN: Sections: -# WRITABLEORPHAN-NEXT: Idx Name -# WRITABLEORPHAN-NEXT: 0 -# WRITABLEORPHAN-NEXT: 1 .text -# WRITABLEORPHAN-NEXT: 2 .writable - -.global _start -_start: - nop - -.section .writable,"aw" - .zero 4 Index: test/ELF/linkerscript/linkerscript-ouputformat.s =================================================================== --- /dev/null +++ test/ELF/linkerscript/linkerscript-ouputformat.s @@ -1,9 +0,0 @@ -# REQUIRES: x86 -# RUN: echo "OUTPUT_FORMAT(x, y, z)" > %t.script -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-freebsd %s -o %t1 -# RUN: ld.lld -shared -o %t2 %t1 %t.script -# RUN: llvm-readobj %t2 > /dev/null - -# RUN: echo "OUTPUT_FORMAT(x, y)" > %t.script -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-freebsd %s -o %t1 -# RUN: not ld.lld -shared -o %t2 %t1 %t.script Index: test/ELF/linkerscript/linkerscript-outputarch.s =================================================================== --- /dev/null +++ test/ELF/linkerscript/linkerscript-outputarch.s @@ -1,10 +0,0 @@ -# REQUIRES: x86 -# RUN: echo "OUTPUT_ARCH(x)" > %t.script -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-freebsd %s -o %t1 -# RUN: ld.lld -shared -o %t2 %t1 %t.script -# RUN: llvm-readobj %t2 > /dev/null - -# RUN: echo "OUTPUT_ARCH(x, y)" > %t.script -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-freebsd %s -o %t1 -# RUN: not ld.lld -shared -o %t2 %t1 %t.script -# RUN: llvm-readobj %t2 > /dev/null Index: test/ELF/linkerscript/linkerscript-phdr-check.s =================================================================== --- /dev/null +++ test/ELF/linkerscript/linkerscript-phdr-check.s @@ -1,15 +0,0 @@ -# REQUIRES: x86 -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t - -# RUN: echo "SECTIONS { . = 0x10000000; .text : {*(.text.*)} }" > %t.script -# RUN: ld.lld -o %t1 --script %t.script %t -# RUN: llvm-readobj -program-headers %t1 | FileCheck %s -# CHECK: ProgramHeaders [ -# CHECK-NEXT: ProgramHeader { -# CHECK-NEXT: Type: PT_PHDR (0x6) -# CHECK-NEXT: Offset: 0x40 -# CHECK-NEXT: VirtualAddress: 0xFFFF040 - -.global _start -_start: - nop Index: test/ELF/linkerscript/linkerscript-phdrs-flags.s =================================================================== --- /dev/null +++ test/ELF/linkerscript/linkerscript-phdrs-flags.s @@ -1,35 +0,0 @@ -# REQUIRES: x86 -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t -# RUN: echo "PHDRS {all PT_LOAD FILEHDR PHDRS FLAGS (1 | 1 + 0x1);} \ -# RUN: SECTIONS { \ -# RUN: . = 0x10000200; \ -# RUN: .text : {*(.text*)} :all \ -# RUN: .foo : {*(.foo.*)} :all \ -# RUN: .data : {*(.data.*)} :all}" > %t.script - -# RUN: ld.lld -o %t1 --script %t.script %t -# RUN: llvm-readobj -program-headers %t1 | FileCheck %s -# CHECK: ProgramHeaders [ -# CHECK-NEXT: ProgramHeader { -# CHECK-NEXT: Type: PT_LOAD (0x1) -# CHECK-NEXT: Offset: 0x0 -# CHECK-NEXT: VirtualAddress: 0x10000000 -# CHECK-NEXT: PhysicalAddress: 0x10000000 -# CHECK-NEXT: FileSize: 521 -# CHECK-NEXT: MemSize: 521 -# CHECK-NEXT: Flags [ -# CHECK-NEXT: PF_W (0x2) -# CHECK-NEXT: PF_X (0x1) -# CHECK-NEXT: ] - -.global _start -_start: - nop - -.section .foo.1,"a" -foo1: - .long 0 - -.section .foo.2,"aw" -foo2: - .long 0 Index: test/ELF/linkerscript/linkerscript-phdrs.s =================================================================== --- /dev/null +++ test/ELF/linkerscript/linkerscript-phdrs.s @@ -1,35 +0,0 @@ -# REQUIRES: x86 -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t -# RUN: echo "PHDRS {all PT_LOAD FILEHDR PHDRS ;} \ -# RUN: SECTIONS { \ -# RUN: . = 0x10000200; \ -# RUN: .text : {*(.text*)} :all \ -# RUN: .foo : {*(.foo.*)} :all \ -# RUN: .data : {*(.data.*)} :all}" > %t.script - -# RUN: ld.lld -o %t1 --script %t.script %t -# RUN: llvm-readobj -program-headers %t1 | FileCheck %s -# CHECK: ProgramHeaders [ -# CHECK-NEXT: ProgramHeader { -# CHECK-NEXT: Type: PT_LOAD (0x1) -# CHECK-NEXT: Offset: 0x0 -# CHECK-NEXT: VirtualAddress: 0x10000000 -# CHECK-NEXT: PhysicalAddress: 0x10000000 -# CHECK-NEXT: FileSize: 521 -# CHECK-NEXT: MemSize: 521 -# CHECK-NEXT: Flags [ (0x5) -# CHECK-NEXT: PF_R (0x4) -# CHECK-NEXT: PF_X (0x1) -# CHECK-NEXT: ] - -.global _start -_start: - nop - -.section .foo.1,"a" -foo1: - .long 0 - -.section .foo.2,"aw" -foo2: - .long 0 Index: test/ELF/linkerscript/linkerscript-repsection-va.s =================================================================== --- /dev/null +++ test/ELF/linkerscript/linkerscript-repsection-va.s @@ -1,23 +0,0 @@ -# REQUIRES: x86 -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t - -# RUN: echo "SECTIONS {.foo : {*(.foo.*)} }" > %t.script -# RUN: ld.lld -o %t1 --script %t.script %t -# RUN: llvm-objdump -section-headers %t1 | FileCheck %s -# CHECK: Sections: -# CHECK-NEXT: Idx Name Size Address Type -# CHECK-NEXT: 0 00000000 0000000000000000 -# CHECK-NEXT: 1 .foo 00000008 0000000000000120 DATA -# CHECK-NEXT: 2 .text 00000001 0000000000000128 TEXT DATA - -.global _start -_start: - nop - -.section .foo.1,"a" -foo1: - .long 0 - -.section .foo.2,"aw" -foo2: - .long 0 Index: test/ELF/linkerscript/linkerscript-sections-constraint.s =================================================================== --- /dev/null +++ test/ELF/linkerscript/linkerscript-sections-constraint.s @@ -1,47 +0,0 @@ -# REQUIRES: x86 -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t -# RUN: echo "SECTIONS { \ -# RUN: .writable : ONLY_IF_RW { *(.writable) } \ -# RUN: .readable : ONLY_IF_RO { *(.readable) }}" > %t.script -# RUN: ld.lld -o %t1 --script %t.script %t -# RUN: llvm-objdump -section-headers %t1 | \ -# RUN: FileCheck -check-prefix=BASE %s -# BASE: Sections: -# BASE-NEXT: Idx Name Size Address Type -# BASE-NEXT: 0 00000000 0000000000000000 -# BASE-NEXT: 1 .writable 00000004 0000000000000200 DATA -# BASE-NEXT: 2 .readable 00000004 0000000000000204 DATA - -# RUN: echo "SECTIONS { \ -# RUN: .foo : ONLY_IF_RO { *(.foo.*) } \ -# RUN: .writable : ONLY_IF_RW { *(.writable) } \ -# RUN: .readable : ONLY_IF_RO { *(.readable) }}" > %t2.script -# RUN: ld.lld -o %t2 --script %t2.script %t -# RUN: llvm-objdump -section-headers %t2 | \ -# RUN: FileCheck -check-prefix=NO1 %s -# NO1: Sections: -# NO1-NEXT: Idx Name Size Address Type -# NO1-NEXT: 0 00000000 0000000000000000 -# NO1-NEXT: 1 .writable 00000004 0000000000000200 DATA -# NO1-NEXT: 2 .readable 00000004 0000000000000204 DATA -# NO1-NEXT: 3 .text 00000001 0000000000000208 TEXT DATA -# NO1-NEXT: 4 .foo.2 00000004 0000000000000209 DATA -# NO1-NEXT: 5 .foo.1 00000004 000000000000020d TEXT DATA - -.global _start -_start: - nop - -.section .writable, "aw" -writable: - .long 1 - -.section .readable, "a" -readable: - .long 2 - -.section .foo.1, "awx" - .long 0 - -.section .foo.2, "aw" - .long 0 Index: test/ELF/linkerscript/linkerscript-sections-keep.s =================================================================== --- /dev/null +++ test/ELF/linkerscript/linkerscript-sections-keep.s @@ -1,80 +0,0 @@ -# REQUIRES: x86 -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t - -## First check that section "keep" is garbage collected without using KEEP -# RUN: echo "SECTIONS { \ -# RUN: .text : { *(.text) } \ -# RUN: .keep : { *(.keep) } \ -# RUN: .temp : { *(.temp) }}" > %t.script -# RUN: ld.lld --gc-sections -o %t1 --script %t.script %t -# RUN: llvm-objdump -section-headers %t1 | \ -# RUN: FileCheck -check-prefix=SECGC %s -# SECGC: Sections: -# SECGC-NEXT: Idx Name Size Address Type -# SECGC-NEXT: 0 00000000 0000000000000000 -# SECGC-NEXT: 1 .text 00000007 0000000000000158 TEXT DATA -# SECGC-NEXT: 2 .temp 00000004 000000000000015f DATA - -## Now apply KEEP command to preserve the section. -# RUN: echo "SECTIONS { \ -# RUN: .text : { *(.text) } \ -# RUN: .keep : { KEEP(*(.keep)) } \ -# RUN: .temp : { *(.temp) }}" > %t.script -# RUN: ld.lld --gc-sections -o %t1 --script %t.script %t -# RUN: llvm-objdump -section-headers %t1 | \ -# RUN: FileCheck -check-prefix=SECNOGC %s -# SECNOGC: Sections: -# SECNOGC-NEXT: Idx Name Size Address Type -# SECNOGC-NEXT: 0 00000000 0000000000000000 -# SECNOGC-NEXT: 1 .text 00000007 0000000000000158 TEXT DATA -# SECNOGC-NEXT: 2 .keep 00000004 000000000000015f DATA -# SECNOGC-NEXT: 3 .temp 00000004 0000000000000163 DATA - -## A section name matches two entries in the SECTIONS directive. The -## first one doesn't have KEEP, the second one does. If section that have -## KEEP is the first in order then section is NOT collected. -# RUN: echo "SECTIONS { \ -# RUN: .keep : { KEEP(*(.keep)) } \ -# RUN: .nokeep : { *(.keep) }}" > %t.script -# RUN: ld.lld --gc-sections -o %t1 --script %t.script %t -# RUN: llvm-objdump -section-headers %t1 | FileCheck -check-prefix=MIXED1 %s -# MIXED1: Sections: -# MIXED1-NEXT: Idx Name Size Address Type -# MIXED1-NEXT: 0 00000000 0000000000000000 -# MIXED1-NEXT: 1 .keep 00000004 0000000000000120 DATA -# MIXED1-NEXT: 2 .temp 00000004 0000000000000124 DATA -# MIXED1-NEXT: 3 .text 00000007 0000000000000128 TEXT DATA -# MIXED1-NEXT: 4 .symtab 00000060 0000000000000000 -# MIXED1-NEXT: 5 .shstrtab 0000002d 0000000000000000 -# MIXED1-NEXT: 6 .strtab 00000012 0000000000000000 - -## The same, but now section without KEEP is at first place. -## gold and bfd linkers disagree here. gold collects .keep while -## bfd keeps it. Our current behavior is compatible with bfd although -## we can choose either way. -# RUN: echo "SECTIONS { \ -# RUN: .nokeep : { *(.keep) } \ -# RUN: .keep : { KEEP(*(.keep)) }}" > %t.script -# RUN: ld.lld --gc-sections -o %t1 --script %t.script %t -# RUN: llvm-objdump -section-headers %t1 | FileCheck -check-prefix=MIXED2 %s -# MIXED2: Sections: -# MIXED2-NEXT: Idx Name Size Address Type -# MIXED2-NEXT: 0 00000000 0000000000000000 -# MIXED2-NEXT: 1 .nokeep 00000004 0000000000000120 DATA -# MIXED2-NEXT: 2 .temp 00000004 0000000000000124 DATA -# MIXED2-NEXT: 3 .text 00000007 0000000000000128 TEXT DATA -# MIXED2-NEXT: 4 .symtab 00000060 0000000000000000 -# MIXED2-NEXT: 5 .shstrtab 0000002f 0000000000000000 -# MIXED2-NEXT: 6 .strtab 00000012 0000000000000000 - -.global _start -_start: - mov temp, %eax - -.section .keep, "a" -keep: - .long 1 - -.section .temp, "a" -temp: - .long 2 Index: test/ELF/linkerscript/linkerscript-sections-padding.s =================================================================== --- /dev/null +++ test/ELF/linkerscript/linkerscript-sections-padding.s @@ -1,44 +0,0 @@ -# REQUIRES: x86 -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t - -## Check that padding value works: -# RUN: echo "SECTIONS { .mysec : { *(.mysec*) } =0x1122 }" > %t.script -# RUN: ld.lld -o %t.out --script %t.script %t -# RUN: llvm-objdump -s %t.out | FileCheck -check-prefix=YES %s -# YES: 0120 66001122 00001122 00001122 00001122 - -## Confirming that address was correct: -# RUN: echo "SECTIONS { .mysec : { *(.mysec*) } =0x99887766 }" > %t.script -# RUN: ld.lld -o %t.out --script %t.script %t -# RUN: llvm-objdump -s %t.out | FileCheck -check-prefix=YES2 %s -# YES2: 0120 66887766 99887766 99887766 99887766 - -## Default padding value is 0x00: -# RUN: echo "SECTIONS { .mysec : { *(.mysec*) } }" > %t.script -# RUN: ld.lld -o %t.out --script %t.script %t -# RUN: llvm-objdump -s %t.out | FileCheck -check-prefix=NO %s -# NO: 0120 66000000 00000000 00000000 00000000 - -## Decimal value. -# RUN: echo "SECTIONS { .mysec : { *(.mysec*) } =777 }" > %t.script -# RUN: ld.lld -o %t.out --script %t.script %t -# RUN: llvm-objdump -s %t.out | FileCheck -check-prefix=DEC %s -# DEC: 0120 66000309 00000309 00000309 00000309 - -## Invalid hex value: -# RUN: echo "SECTIONS { .mysec : { *(.mysec*) } =0x99XX }" > %t.script -# RUN: not ld.lld -o %t.out --script %t.script %t 2>&1 \ -# RUN: | FileCheck --check-prefix=ERR2 %s -# ERR2: invalid filler expression: =0x99XX - -.section .mysec.1,"a" -.align 16 -.byte 0x66 - -.section .mysec.2,"a" -.align 16 -.byte 0x66 - -.globl _start -_start: - nop Index: test/ELF/linkerscript/linkerscript-sections.s =================================================================== --- /dev/null +++ test/ELF/linkerscript/linkerscript-sections.s @@ -1,119 +0,0 @@ -# REQUIRES: x86 -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t - -# Empty SECTIONS command. -# RUN: echo "SECTIONS {}" > %t.script -# RUN: ld.lld -o %t1 --script %t.script %t -# RUN: llvm-objdump -section-headers %t1 | \ -# RUN: FileCheck -check-prefix=SEC-DEFAULT %s - -# SECTIONS command with the same order as default. -# RUN: echo "SECTIONS { \ -# RUN: .text : { *(.text) } \ -# RUN: .data : { *(.data) } }" > %t.script -# RUN: ld.lld -o %t2 --script %t.script %t -# RUN: llvm-objdump -section-headers %t2 | \ -# RUN: FileCheck -check-prefix=SEC-DEFAULT %s - -# Idx Name Size -# SEC-DEFAULT: 1 .text 0000000e {{[0-9a-f]*}} TEXT DATA -# 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 .symtab 00000030 {{[0-9a-f]*}} -# SEC-DEFAULT: 7 .shstrtab 00000032 {{[0-9a-f]*}} -# SEC-DEFAULT: 8 .strtab 00000008 {{[0-9a-f]*}} - -# Sections are put in order specified in linker script. -# RUN: echo "SECTIONS { \ -# RUN: .bss : { *(.bss) } \ -# RUN: other : { *(other) } \ -# RUN: .shstrtab : { *(.shstrtab) } \ -# RUN: .symtab : { *(.symtab) } \ -# RUN: .strtab : { *(.strtab) } \ -# RUN: .data : { *(.data) } \ -# RUN: .text : { *(.text) } }" > %t.script -# RUN: ld.lld -o %t3 --script %t.script %t -# RUN: llvm-objdump -section-headers %t3 | \ -# RUN: FileCheck -check-prefix=SEC-ORDER %s - -# 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 00000032 {{[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 - -# .text and .data have swapped names but proper sizes and types. -# RUN: echo "SECTIONS { \ -# RUN: .data : { *(.text) } \ -# RUN: .text : { *(.data) } }" > %t.script -# RUN: ld.lld -o %t4 --script %t.script %t -# RUN: llvm-objdump -section-headers %t4 | \ -# RUN: FileCheck -check-prefix=SEC-SWAP-NAMES %s - -# Idx Name Size -# SEC-SWAP-NAMES: 1 .data 0000000e {{[0-9a-f]*}} TEXT DATA -# 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 .symtab 00000030 {{[0-9a-f]*}} -# SEC-SWAP-NAMES: 7 .shstrtab 00000032 {{[0-9a-f]*}} -# SEC-SWAP-NAMES: 8 .strtab 00000008 {{[0-9a-f]*}} - -# .shstrtab from the input object file is discarded. -# RUN: echo "SECTIONS { \ -# RUN: /DISCARD/ : { *(.shstrtab) } }" > %t.script -# RUN: ld.lld -o %t5 --script %t.script %t -# RUN: llvm-objdump -section-headers %t5 | \ -# RUN: FileCheck -check-prefix=SEC-DISCARD %s - -# Idx Name Size -# SEC-DISCARD: 1 .text 0000000e {{[0-9a-f]*}} TEXT DATA -# SEC-DISCARD: 2 .data 00000020 {{[0-9a-f]*}} DATA -# SEC-DISCARD: 3 other 00000003 {{[0-9a-f]*}} DATA -# SEC-DISCARD: 4 .bss 00000002 {{[0-9a-f]*}} BSS -# SEC-DISCARD: 5 .symtab 00000030 {{[0-9a-f]*}} -# SEC-DISCARD: 6 .shstrtab 00000032 {{[0-9a-f]*}} -# SEC-DISCARD: 7 .strtab 00000008 {{[0-9a-f]*}} - -# Multiple SECTIONS command specifying additional input section descriptions -# for the same output section description - input sections are merged into -# one output section. -# RUN: echo "SECTIONS { \ -# RUN: .text : { *(.text) } \ -# RUN: .data : { *(.data) } } \ -# RUN: SECTIONS { \ -# RUN: .data : { *(other) } }" > %t.script -# RUN: ld.lld -o %t6 --script %t.script %t -# RUN: llvm-objdump -section-headers %t6 | \ -# RUN: FileCheck -check-prefix=SEC-MULTI %s - -# Idx Name Size -# 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 .symtab 00000030 {{[0-9a-f]*}} -# SEC-MULTI: 6 .shstrtab 0000002c {{[0-9a-f]*}} -# SEC-MULTI: 7 .strtab 00000008 {{[0-9a-f]*}} - -.globl _start -_start: - mov $60, %rax - mov $42, %rdi - -.section .data,"aw" -.quad 10, 10, 20, 20 -.section other,"aw" -.short 10 -.byte 20 -.section .shstrtab,"" -.short 20 -.section .bss,"",@nobits -.short 0 Index: test/ELF/linkerscript/linkerscript-sizeof.s =================================================================== --- /dev/null +++ test/ELF/linkerscript/linkerscript-sizeof.s @@ -1,53 +0,0 @@ -# REQUIRES: x86 -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t - -# RUN: echo "SECTIONS { \ -# RUN: .aaa : { *(.aaa) } \ -# RUN: .bbb : { *(.bbb) } \ -# RUN: .ccc : { *(.ccc) } \ -# RUN: _aaa = SIZEOF(.aaa); \ -# RUN: _bbb = SIZEOF(.bbb); \ -# RUN: _ccc = SIZEOF(.ccc); \ -# RUN: }" > %t.script -# RUN: ld.lld -o %t1 --script %t.script %t -# RUN: llvm-objdump -t -section-headers %t1 | FileCheck %s -# CHECK: Sections: -# CHECK-NEXT: Idx Name Size Address Type -# CHECK-NEXT: 0 00000000 0000000000000000 -# CHECK-NEXT: 1 .aaa 00000008 0000000000000120 DATA -# CHECK-NEXT: 2 .bbb 00000010 0000000000000128 DATA -# CHECK-NEXT: 3 .ccc 00000018 0000000000000138 DATA -# CHECK: SYMBOL TABLE: -# CHECK-NEXT: 0000000000000000 *UND* 00000000 -# CHECK-NEXT: 0000000000000150 .text 00000000 _start -# CHECK-NEXT: 0000000000000008 *ABS* 00000000 _aaa -# CHECK-NEXT: 0000000000000010 *ABS* 00000000 _bbb -# CHECK-NEXT: 0000000000000018 *ABS* 00000000 _ccc - -## Check that we error out if trying to get size of -## section that does not exist. -# RUN: echo "SECTIONS { \ -# RUN: .aaa : { *(.aaa) } \ -# RUN: .bbb : { *(.bbb) } \ -# RUN: .ccc : { *(.ccc) } \ -# RUN: _aaa = SIZEOF(.foo); \ -# RUN: }" > %t.script -# RUN: not ld.lld -o %t1 --script %t.script %t 2>&1 \ -# RUN: | FileCheck -check-prefix=ERR %s -# ERR: undefined section .foo - -.global _start -_start: - nop - -.section .aaa,"a" - .quad 0 - -.section .bbb,"a" - .quad 0 - .quad 0 - -.section .ccc,"a" - .quad 0 - .quad 0 - .quad 0 Index: test/ELF/linkerscript/linkerscript-sizeofheaders.s =================================================================== --- /dev/null +++ test/ELF/linkerscript/linkerscript-sizeofheaders.s @@ -1,18 +0,0 @@ -# REQUIRES: x86 -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t -# RUN: echo " SECTIONS { \ -# RUN: . = SIZEOF_HEADERS; \ -# RUN: _size = SIZEOF_HEADERS; \ -# RUN: .text : {*(.text*)} \ -# RUN: }" > %t.script -# RUN: ld.lld -o %t1 --script %t.script %t -# RUN: llvm-objdump -t %t1 | FileCheck %s - -#CHECK: SYMBOL TABLE: -#CHECK-NEXT: 0000000000000000 *UND* 00000000 -#CHECK-NEXT: 0000000000000120 .text 00000000 _start -#CHECK-NEXT: 0000000000000120 *ABS* 00000000 _size - -.global _start -_start: - nop Index: test/ELF/linkerscript/linkerscript-sort-constructors.s =================================================================== --- /dev/null +++ test/ELF/linkerscript/linkerscript-sort-constructors.s @@ -1,5 +0,0 @@ -# REQUIRES: x86 -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1.o -# RUN: echo "SECTIONS { .aaa : { SORT(CONSTRUCTORS) } }" > %t1.script -# RUN: ld.lld -shared -o %t1 --script %t1.script %t1.o -# RUN: llvm-readobj %t1 > /dev/null Index: test/ELF/linkerscript/linkerscript-start-end.s =================================================================== --- /dev/null +++ test/ELF/linkerscript/linkerscript-start-end.s @@ -1,16 +0,0 @@ -# REQUIRES: x86 -# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o -# RUN: echo "SECTIONS { \ -# RUN: .init_array : { \ -# RUN: __init_array_start = .; \ -# RUN: *(.init_array) \ -# RUN: __init_array_end = .; } }" > %t.script -# RUN: ld.lld %t.o -script %t.script -o %t 2>&1 - -.globl _start -.text -_start: - nop - -.section .init_array, "aw" - .quad 0 Index: test/ELF/linkerscript/linkerscript-subalign.s =================================================================== --- /dev/null +++ test/ELF/linkerscript/linkerscript-subalign.s @@ -1,43 +0,0 @@ -# REQUIRES: x86 -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1.o - -# RUN: echo "SECTIONS { .aaa : { *(.aaa.*) } }" > %t1.script -# RUN: ld.lld -o %t1 --script %t1.script %t1.o -# RUN: llvm-objdump -s %t1 | FileCheck -check-prefix=NOALIGN %s -# NOALIGN: Contents of section .aaa: -# NOALIGN-NEXT: 01000000 00000000 00000000 00000000 -# NOALIGN-NEXT: 00000000 00000000 00000000 00000000 -# NOALIGN-NEXT: 02000000 00000000 00000000 00000000 -# NOALIGN-NEXT: 00000000 00000000 00000000 00000000 -# NOALIGN-NEXT: 03000000 00000000 00000000 00000000 -# NOALIGN-NEXT: 00000000 00000000 00000000 00000000 -# NOALIGN-NEXT: 00000000 00000000 00000000 00000000 -# NOALIGN-NEXT: 00000000 00000000 00000000 00000000 -# NOALIGN-NEXT: 04000000 00000000 - -# RUN: echo "SECTIONS { .aaa : SUBALIGN(1) { *(.aaa.*) } }" > %t2.script -# RUN: ld.lld -o %t2 --script %t2.script %t1.o -# RUN: llvm-objdump -s %t2 | FileCheck -check-prefix=SUBALIGN %s -# SUBALIGN: Contents of section .aaa: -# SUBALIGN: 01000000 00000000 02000000 00000000 -# SUBALIGN: 03000000 00000000 04000000 00000000 - -.global _start -_start: - nop - -.section .aaa.1, "a" -.align 16 -.quad 1 - -.section .aaa.2, "a" -.align 32 -.quad 2 - -.section .aaa.3, "a" -.align 64 -.quad 3 - -.section .aaa.4, "a" -.align 128 -.quad 4 Index: test/ELF/linkerscript/linkerscript-symbol-assignexpr.s =================================================================== --- /dev/null +++ test/ELF/linkerscript/linkerscript-symbol-assignexpr.s @@ -1,32 +0,0 @@ -# REQUIRES: x86 -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t - -# RUN: echo "SECTIONS { \ -# RUN: symbol = CONSTANT(MAXPAGESIZE); \ -# RUN: symbol2 = symbol + 0x1234; \ -# RUN: symbol3 = symbol2; \ -# RUN: }" > %t.script -# RUN: ld.lld -o %t1 --script %t.script %t -# RUN: llvm-objdump -t %t1 | FileCheck %s - -# CHECK: SYMBOL TABLE: -# CHECK-NEXT: 0000000000000000 *UND* 00000000 -# CHECK-NEXT: 0000000000000120 .text 00000000 _start -# CHECK-NEXT: 0000000000000121 .text 00000000 foo -# CHECK-NEXT: 0000000000200000 *ABS* 00000000 symbol -# CHECK-NEXT: 0000000000201234 *ABS* 00000000 symbol2 -# CHECK-NEXT: 0000000000201234 *ABS* 00000000 symbol3 - -# RUN: echo "SECTIONS { \ -# RUN: symbol2 = symbol; \ -# RUN: }" > %t2.script -# RUN: not ld.lld -o %t2 --script %t2.script %t 2>&1 \ -# RUN: | FileCheck -check-prefix=ERR %s -# ERR: symbol not found: symbol - -.global _start -_start: - nop - -.global foo -foo: Index: test/ELF/linkerscript/linkerscript-symbol-conflict.s =================================================================== --- /dev/null +++ test/ELF/linkerscript/linkerscript-symbol-conflict.s @@ -1,11 +0,0 @@ -# REQUIRES: x86 -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t - -# RUN: echo "SECTIONS {.text : {*(.text.*)} end = .;}" > %t.script -# RUN: ld.lld -o %t1 --script %t.script %t -# RUN: llvm-objdump -t %t1 | FileCheck %s -# CHECK: 0000000000000121 *ABS* 00000000 end - -.global _start -_start: - nop Index: test/ELF/linkerscript/linkerscript-symbolreferenced.s =================================================================== --- /dev/null +++ test/ELF/linkerscript/linkerscript-symbolreferenced.s @@ -1,22 +0,0 @@ -# REQUIRES: x86 -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t - -# Provide new symbol. The value should be 1, like set in PROVIDE() -# RUN: echo "SECTIONS { PROVIDE(newsym = 1);}" > %t.script -# RUN: ld.lld -o %t1 --script %t.script %t -# RUN: llvm-objdump -t %t1 | FileCheck --check-prefix=PROVIDE1 %s -# PROVIDE1: 0000000000000001 *ABS* 00000000 newsym - -# Provide new symbol (hidden). The value should be 1 -# RUN: echo "SECTIONS { PROVIDE_HIDDEN(newsym = 1);}" > %t.script -# RUN: ld.lld -o %t1 --script %t.script %t -# RUN: llvm-objdump -t %t1 | FileCheck --check-prefix=HIDDEN1 %s -# HIDDEN1: 0000000000000001 *ABS* 00000000 .hidden newsym - -.global _start -_start: - nop - -.globl patatino -patatino: - movl newsym, %eax Index: test/ELF/linkerscript/linkerscript-symbols-synthetic.s =================================================================== --- /dev/null +++ test/ELF/linkerscript/linkerscript-symbols-synthetic.s @@ -1,83 +0,0 @@ -# REQUIRES: x86 -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t -# Simple symbol assignment within input section list. The '.' symbol -# is not location counter but offset from the beginning of output -# section .foo -# RUN: echo "SECTIONS { \ -# RUN: .foo : { \ -# RUN: begin_foo = .; \ -# RUN: PROVIDE(_begin_sec = .); \ -# RUN: *(.foo) \ -# RUN: end_foo = .; \ -# RUN: PROVIDE_HIDDEN(_end_sec = .); \ -# RUN: size_foo_1 = SIZEOF(.foo); \ -# RUN: . = ALIGN(0x1000); \ -# RUN: begin_bar = .; \ -# RUN: *(.bar) \ -# RUN: end_bar = .; \ -# RUN: size_foo_2 = SIZEOF(.foo); } \ -# RUN: size_foo_3 = SIZEOF(.foo); \ -# RUN: .eh_frame_hdr : { \ -# RUN: __eh_frame_hdr_start = .; \ -# RUN: __eh_frame_hdr_start2 = ALIGN(0x10); \ -# RUN: *(.eh_frame_hdr) \ -# RUN: __eh_frame_hdr_end = .; \ -# RUN: __eh_frame_hdr_end2 = ALIGN(0x10); } \ -# RUN: }" > %t.script -# RUN: ld.lld -o %t1 --eh-frame-hdr --script %t.script %t -# RUN: llvm-objdump -t %t1 | FileCheck --check-prefix=SIMPLE %s - -# The script below contains symbols in the middle of .eh_frame_hdr section. -# We don't support this. -# RUN: echo "SECTIONS { \ -# RUN: .eh_frame_hdr : { \ -# RUN: PROVIDE_HIDDEN(_begin_sec = .); \ -# RUN: __eh_frame_hdr_start = .; \ -# RUN: *(.eh_frame_hdr) \ -# RUN: __eh_frame_hdr_end = .; \ -# RUN: *(.eh_frame_hdr) } \ -# RUN: PROVIDE_HIDDEN(_end_sec = .); \ -# RUN: }" > %t.script -# RUN: not ld.lld -o %t1 --eh-frame-hdr --script %t.script %t 2>&1 | FileCheck --check-prefix=ERROR %s - -# Check that the following script is processed without errors -# RUN: echo "SECTIONS { \ -# RUN: .eh_frame_hdr : { \ -# RUN: PROVIDE_HIDDEN(_begin_sec = .); \ -# RUN: *(.eh_frame_hdr) \ -# RUN: *(.eh_frame_hdr) \ -# RUN: PROVIDE_HIDDEN(_end_sec = .); } \ -# RUN: }" > %t.script -# RUN: ld.lld -o %t1 --eh-frame-hdr --script %t.script %t - -# SIMPLE: 0000000000000160 .foo 00000000 .hidden _end_sec -# SIMPLE: 0000000000000158 .foo 00000000 _begin_sec -# SIMPLE-NEXT: 0000000000000158 .foo 00000000 begin_foo -# SIMPLE-NEXT: 0000000000000160 .foo 00000000 end_foo -# SIMPLE-NEXT: 0000000000000008 .foo 00000000 size_foo_1 -# SIMPLE-NEXT: 0000000000001000 .foo 00000000 begin_bar -# SIMPLE-NEXT: 0000000000001004 .foo 00000000 end_bar -# SIMPLE-NEXT: 0000000000000eac .foo 00000000 size_foo_2 -# SIMPLE-NEXT: 0000000000000eac *ABS* 00000000 size_foo_3 -# SIMPLE-NEXT: 0000000000001004 .eh_frame_hdr 00000000 __eh_frame_hdr_start -# SIMPLE-NEXT: 0000000000001010 .eh_frame_hdr 00000000 __eh_frame_hdr_start2 -# SIMPLE-NEXT: 0000000000001018 .eh_frame_hdr 00000000 __eh_frame_hdr_end -# SIMPLE-NEXT: 0000000000001020 .eh_frame_hdr 00000000 __eh_frame_hdr_end2 -# ERROR: section '.eh_frame_hdr' supports only start and end symbols - -.global _start -_start: - nop - -.section .foo,"a" - .quad 0 - -.section .bar,"a" - .long 0 - -.section .dah,"ax",@progbits - .cfi_startproc - nop - .cfi_endproc - -.global _begin_sec, _end_sec Index: test/ELF/linkerscript/linkerscript-symbols.s =================================================================== --- /dev/null +++ test/ELF/linkerscript/linkerscript-symbols.s @@ -1,84 +0,0 @@ -# REQUIRES: x86 -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t - -# Simple symbol assignment. Should raise conflict in case we -# have duplicates in any input section, but currently simply -# replaces the value. -# RUN: echo "SECTIONS {.text : {*(.text.*)} text_end = .;}" > %t.script -# RUN: ld.lld -o %t1 --script %t.script %t -# RUN: llvm-objdump -t %t1 | FileCheck --check-prefix=SIMPLE %s -# SIMPLE: 0000000000000121 *ABS* 00000000 text_end - -# The symbol is not referenced. Don't provide it. -# RUN: echo "SECTIONS { PROVIDE(newsym = 1);}" > %t.script -# RUN: ld.lld -o %t1 --script %t.script %t -# RUN: llvm-objdump -t %t1 | FileCheck --check-prefix=PROVIDE1 %s -# PROVIDE1-NOT: 0000000000000001 *ABS* 00000000 newsym - -# The symbol is not referenced. Don't provide it. -# RUN: echo "SECTIONS { PROVIDE_HIDDEN(newsym = 1);}" > %t.script -# RUN: ld.lld -o %t1 --script %t.script %t -# RUN: llvm-objdump -t %t1 | FileCheck --check-prefix=HIDDEN1 %s -# HIDDEN1-NOT: 0000000000000001 *ABS* 00000000 .hidden newsym - -# Provide existing symbol. The value should be 0, even though we -# have value of 1 in PROVIDE() -# RUN: echo "SECTIONS { PROVIDE(somesym = 1);}" > %t.script -# RUN: ld.lld -o %t1 --script %t.script %t -# RUN: llvm-objdump -t %t1 | FileCheck --check-prefix=PROVIDE2 %s -# PROVIDE2: 0000000000000000 *ABS* 00000000 somesym - -# Provide existing symbol. The value should be 0, even though we -# have value of 1 in PROVIDE_HIDDEN(). Visibility should not change -# RUN: echo "SECTIONS { PROVIDE_HIDDEN(somesym = 1);}" > %t.script -# RUN: ld.lld -o %t1 --script %t.script %t -# RUN: llvm-objdump -t %t1 | FileCheck --check-prefix=HIDDEN2 %s -# HIDDEN2: 0000000000000000 *ABS* 00000000 somesym - -# Hidden symbol assignment. -# RUN: echo "SECTIONS { HIDDEN(newsym = 1);}" > %t.script -# RUN: ld.lld -o %t1 --script %t.script %t -# RUN: llvm-objdump -t %t1 | FileCheck --check-prefix=HIDDEN3 %s -# HIDDEN3: 0000000000000001 *ABS* 00000000 .hidden newsym - -# The symbol is not referenced. Don't provide it. -# RUN: echo "PROVIDE(newsym = 1);" > %t.script -# RUN: ld.lld -o %t1 --script %t.script %t -# RUN: llvm-objdump -t %t1 | FileCheck --check-prefix=PROVIDE4 %s -# PROVIDE4-NOT: 0000000000000001 *ABS* 00000000 newsym - -# The symbol is not referenced. Don't provide it. -# RUN: echo "PROVIDE_HIDDEN(newsym = 1);" > %t.script -# RUN: ld.lld -o %t1 --script %t.script %t -# RUN: llvm-objdump -t %t1 | FileCheck --check-prefix=HIDDEN4 %s -# HIDDEN4-NOT: 0000000000000001 *ABS* 00000000 .hidden newsym - -# Provide existing symbol. The value should be 0, even though we -# have value of 1 in PROVIDE() -# RUN: echo "PROVIDE(somesym = 1);" > %t.script -# RUN: ld.lld -o %t1 --script %t.script %t -# RUN: llvm-objdump -t %t1 | FileCheck --check-prefix=PROVIDE5 %s -# PROVIDE5: 0000000000000000 *ABS* 00000000 somesym - -# Provide existing symbol. The value should be 0, even though we -# have value of 1 in PROVIDE_HIDDEN(). Visibility should not change -# RUN: echo "PROVIDE_HIDDEN(somesym = 1);" > %t.script -# RUN: ld.lld -o %t1 --script %t.script %t -# RUN: llvm-objdump -t %t1 | FileCheck --check-prefix=HIDDEN5 %s -# HIDDEN5: 0000000000000000 *ABS* 00000000 somesym - -# Simple symbol assignment. All three symbols should have the -# same value. -# RUN: echo "foo = 0x100; SECTIONS { bar = foo; } baz = bar;" > %t.script -# RUN: ld.lld -o %t1 --script %t.script %t -# RUN: llvm-objdump -t %t1 | FileCheck --check-prefix=SIMPLE2 %s -# SIMPLE2: 0000000000000100 *ABS* 00000000 foo -# SIMPLE2: 0000000000000100 *ABS* 00000000 bar -# SIMPLE2: 0000000000000100 *ABS* 00000000 baz - -.global _start -_start: - nop - -.global somesym -somesym = 0 Index: test/ELF/linkerscript/linkerscript-undef.s =================================================================== --- /dev/null +++ test/ELF/linkerscript/linkerscript-undef.s @@ -1,11 +0,0 @@ -# REQUIRES: x86 -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t - -# RUN: echo "SECTIONS { patatino = 0x1234; }" > %t.script -# RUN: ld.lld -o %t1 --script %t.script %t -# RUN: llvm-objdump -t %t1 | FileCheck %s -# CHECK: 0000000000001234 *ABS* 00000000 patatino - -.global _start -_start: - call patatino Index: test/ELF/linkerscript/linkerscript-va.s =================================================================== --- /dev/null +++ test/ELF/linkerscript/linkerscript-va.s @@ -1,24 +0,0 @@ -# REQUIRES: x86 -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t - -# RUN: echo "SECTIONS {}" > %t.script -# RUN: ld.lld -o %t1 --script %t.script %t -# RUN: llvm-objdump -section-headers %t1 | FileCheck %s -# CHECK: Sections: -# CHECK-NEXT: Idx Name Size Address Type -# CHECK-NEXT: 0 00000000 0000000000000000 -# CHECK-NEXT: 1 .foo 00000004 0000000000000120 DATA -# CHECK-NEXT: 2 .boo 00000004 0000000000000124 DATA -# CHECK-NEXT: 3 .text 00000001 0000000000000128 TEXT DATA - -.global _start -_start: - nop - -.section .foo, "a" -foo: - .long 0 - -.section .boo, "a" -boo: - .long 0 Index: test/ELF/linkerscript/merge-sections-reloc.s =================================================================== --- test/ELF/linkerscript/merge-sections-reloc.s +++ test/ELF/linkerscript/merge-sections-reloc.s @@ -1,5 +1,5 @@ # REQUIRES: x86 -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/linkerscript-merge-sections-reloc.s -o %t1.o +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/merge-sections-reloc.s -o %t1.o # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t2.o # RUN: echo "SECTIONS {}" > %t.script # RUN: ld.lld -o %t --script %t.script %t1.o %t2.o Index: test/ELF/linkerscript/sort-nested.s =================================================================== --- test/ELF/linkerscript/sort-nested.s +++ test/ELF/linkerscript/sort-nested.s @@ -1,7 +1,7 @@ # REQUIRES: x86 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1.o # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux \ -# RUN: %p/Inputs/linkerscript-sort-nested.s -o %t2.o +# RUN: %p/Inputs/sort-nested.s -o %t2.o ## Check sorting first by alignment and then by name. # RUN: echo "SECTIONS { .aaa : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.aaa.*))) } }" > %t1.script Index: test/ELF/linkerscript/sort.s =================================================================== --- test/ELF/linkerscript/sort.s +++ test/ELF/linkerscript/sort.s @@ -1,7 +1,7 @@ # REQUIRES: x86 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1.o # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux \ -# RUN: %p/Inputs/linkerscript-sort.s -o %t2.o +# RUN: %p/Inputs/sort.s -o %t2.o # RUN: echo "SECTIONS { .aaa : { *(.aaa.*) } }" > %t1.script # RUN: ld.lld -o %t1 --script %t1.script %t2.o %t1.o