diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2016-07-23 20:48:50 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2016-07-23 20:48:50 +0000 |
| commit | 1c98619801a5705c688e683be3ef9d70169a0686 (patch) | |
| tree | 8422105cd1a94c368315f2db16b9ac746cf7c000 /test/old-elf/linkerscript | |
| parent | f4f3ce4613680903220815690ad79fc7ba0a2e26 (diff) | |
Notes
Diffstat (limited to 'test/old-elf/linkerscript')
41 files changed, 0 insertions, 1414 deletions
diff --git a/test/old-elf/linkerscript/Inputs/externs.ls b/test/old-elf/linkerscript/Inputs/externs.ls deleted file mode 100644 index 20fdc0c3f980..000000000000 --- a/test/old-elf/linkerscript/Inputs/externs.ls +++ /dev/null @@ -1,3 +0,0 @@ -/* A simple valid linker script used for testing the EXTERN command. - */ -EXTERN(_foo bar __baz) diff --git a/test/old-elf/linkerscript/Inputs/invalid.ls b/test/old-elf/linkerscript/Inputs/invalid.ls deleted file mode 100644 index 894d4bef2732..000000000000 --- a/test/old-elf/linkerscript/Inputs/invalid.ls +++ /dev/null @@ -1 +0,0 @@ -GROUP( diff --git a/test/old-elf/linkerscript/Inputs/prog1.o.yaml b/test/old-elf/linkerscript/Inputs/prog1.o.yaml deleted file mode 100644 index f450048ab37b..000000000000 --- a/test/old-elf/linkerscript/Inputs/prog1.o.yaml +++ /dev/null @@ -1,87 +0,0 @@ ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000010 - Content: 554889E5B000E800000000BF01000000BA0E0000004889C6E80000000031C05DC3 - - Name: .rela.text - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .text - Relocations: - - Offset: 0x0000000000000007 - Symbol: prog2 - Type: R_X86_64_PC32 - Addend: -4 - - Offset: 0x0000000000000019 - Symbol: write - Type: R_X86_64_PC32 - Addend: -4 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - - Name: .comment - Type: SHT_PROGBITS - Flags: [ SHF_MERGE, SHF_STRINGS ] - AddressAlign: 0x0000000000000001 - Content: 00636C616E672076657273696F6E20332E372E302028687474703A2F2F6C6C766D2E6F72672F6769742F636C616E672E6769742036336134646334616430343938646139623934386330383263623735336430353735323938346638292028687474703A2F2F6C6C766D2E6F72672F6769742F6C6C766D2E67697420623838363135326664656538376564653738613565643965616638663664313839343033616266312900 - - Name: .note.GNU-stack - Type: SHT_PROGBITS - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .eh_frame - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC ] - AddressAlign: 0x0000000000000008 - Content: 1400000000000000037A5200017810011B0C0708900100001C0000001C000000000000002100000000410E108602430D0600000000000000 - - Name: .rela.eh_frame - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .eh_frame - Relocations: - - Offset: 0x0000000000000020 - Symbol: .text - Type: R_X86_64_PC32 -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - - Name: .comment - Type: STT_SECTION - Section: .comment - - Name: .note.GNU-stack - Type: STT_SECTION - Section: .note.GNU-stack - - Name: .eh_frame - Type: STT_SECTION - Section: .eh_frame - Global: - - Name: main - Type: STT_FUNC - Section: .text - Size: 0x0000000000000021 - - Name: prog2 - - Name: write -... diff --git a/test/old-elf/linkerscript/Inputs/prog2.o.yaml b/test/old-elf/linkerscript/Inputs/prog2.o.yaml deleted file mode 100644 index 4d1bbd5754ea..000000000000 --- a/test/old-elf/linkerscript/Inputs/prog2.o.yaml +++ /dev/null @@ -1,88 +0,0 @@ ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000010 - Content: 554889E548B800000000000000005DC3 - - Name: .rela.text - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .text - Relocations: - - Offset: 0x0000000000000006 - Symbol: .rodata.str1.1 - Type: R_X86_64_64 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - - Name: .rodata.str1.1 - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_MERGE, SHF_STRINGS ] - AddressAlign: 0x0000000000000001 - Content: 48656C6C6F2C20776F726C64210A00 - - Name: .comment - Type: SHT_PROGBITS - Flags: [ SHF_MERGE, SHF_STRINGS ] - AddressAlign: 0x0000000000000001 - Content: 00636C616E672076657273696F6E20332E372E302028687474703A2F2F6C6C766D2E6F72672F6769742F636C616E672E6769742036336134646334616430343938646139623934386330383263623735336430353735323938346638292028687474703A2F2F6C6C766D2E6F72672F6769742F6C6C766D2E67697420623838363135326664656538376564653738613565643965616638663664313839343033616266312900 - - Name: .note.GNU-stack - Type: SHT_PROGBITS - AddressAlign: 0x0000000000000001 - Content: '' - - Name: .eh_frame - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC ] - AddressAlign: 0x0000000000000008 - Content: 1400000000000000037A5200017810011B0C0708900100001C0000001C000000000000001000000000410E108602430D0600000000000000 - - Name: .rela.eh_frame - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .eh_frame - Relocations: - - Offset: 0x0000000000000020 - Symbol: .text - Type: R_X86_64_PC32 -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - - Name: .rodata.str1.1 - Type: STT_SECTION - Section: .rodata.str1.1 - - Name: .comment - Type: STT_SECTION - Section: .comment - - Name: .note.GNU-stack - Type: STT_SECTION - Section: .note.GNU-stack - - Name: .eh_frame - Type: STT_SECTION - Section: .eh_frame - Global: - - Name: prog2 - Type: STT_FUNC - Section: .text - Size: 0x0000000000000010 -... diff --git a/test/old-elf/linkerscript/Inputs/prog3.o.yaml b/test/old-elf/linkerscript/Inputs/prog3.o.yaml deleted file mode 100644 index 2402be4d42b6..000000000000 --- a/test/old-elf/linkerscript/Inputs/prog3.o.yaml +++ /dev/null @@ -1,51 +0,0 @@ ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: B8010000000F05C3E800000000B83C0000000F05C3 - - Name: .rela.text - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .text - Relocations: - - Offset: 0x0000000000000009 - Symbol: main - Type: R_X86_64_PC32 - Addend: -4 - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 -Symbols: - Local: - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - Global: - - Name: _start - Section: .text - Value: 0x0000000000000008 - - Name: write - Section: .text - - Name: main -... diff --git a/test/old-elf/linkerscript/Inputs/simple-pic.o.yaml b/test/old-elf/linkerscript/Inputs/simple-pic.o.yaml deleted file mode 100644 index f826034053c3..000000000000 --- a/test/old-elf/linkerscript/Inputs/simple-pic.o.yaml +++ /dev/null @@ -1,32 +0,0 @@ -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_X86_64 - -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 4 - Size: 16 - - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 4 - Size: 16 - -Symbols: - Local: - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .text - Type: STT_SECTION - Section: .text - Global: - - Name: foo - Type: STT_FUNC - Section: .text - Size: 16 diff --git a/test/old-elf/linkerscript/Inputs/simple.o.yaml b/test/old-elf/linkerscript/Inputs/simple.o.yaml deleted file mode 100644 index fc9cd4c5f67d..000000000000 --- a/test/old-elf/linkerscript/Inputs/simple.o.yaml +++ /dev/null @@ -1,51 +0,0 @@ ---- -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: B80100000048C7C70100000048C7C60000000048C7C20E0000000F05C3E8DEFFFFFFB83C0000000F05C3 - - Name: .rela.text - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - Info: .text - Relocations: - - Offset: 0x000000000000000F - Symbol: .data - Type: R_X86_64_32S - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: 48656C6C6F2C20576F726C64210A00 - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 -Symbols: - Local: - - Name: main - Section: .text - - Name: msg - Section: .data - - Name: .text - Type: STT_SECTION - Section: .text - - Name: .data - Type: STT_SECTION - Section: .data - - Name: .bss - Type: STT_SECTION - Section: .bss - Global: - - Name: _start - Section: .text - Value: 0x000000000000001D -... diff --git a/test/old-elf/linkerscript/Inputs/valid.ls b/test/old-elf/linkerscript/Inputs/valid.ls deleted file mode 100644 index 43593602d3fb..000000000000 --- a/test/old-elf/linkerscript/Inputs/valid.ls +++ /dev/null @@ -1,6 +0,0 @@ -/* A simple valid linker script used for testing the -T/--script options. - * - * An unresolved symbol named '_entry_point' can be scanned for by the tests - * to determine that the linker script was processed. - */ -ENTRY(_entry_point) diff --git a/test/old-elf/linkerscript/externs.objtxt b/test/old-elf/linkerscript/externs.objtxt deleted file mode 100644 index d79c56a142c9..000000000000 --- a/test/old-elf/linkerscript/externs.objtxt +++ /dev/null @@ -1,21 +0,0 @@ -# Check symbols defined with the EXTERN command are added as undefined -# symbols. - -# RUN: lld -flavor old-gnu -target x86_64 -T %p/Inputs/externs.ls -r %s \ -# RUN: --output-filetype=yaml | FileCheck %s - -defined-atoms: - - name: main - scope: global - content: [ B8, 00, 00, 00, 00, C7, 44, 24, FC, 00, 00, 00, 00, C3 ] - alignment: 16 - section-choice: custom-required - section-name: .text - -# CHECK: undefined-atoms: -# CHECK: - name: _foo -# CHECK: can-be-null: at-buildtime -# CHECK: - name: bar -# CHECK: can-be-null: at-buildtime -# CHECK: - name: __baz -# CHECK: can-be-null: at-buildtime diff --git a/test/old-elf/linkerscript/filename-with-wildcards.test b/test/old-elf/linkerscript/filename-with-wildcards.test deleted file mode 100644 index 9376d5a5cfb4..000000000000 --- a/test/old-elf/linkerscript/filename-with-wildcards.test +++ /dev/null @@ -1,49 +0,0 @@ -/* -Tests a linker script that uses the SECTIONS command with rules containing -wildcards that matching input object files. -*/ - -ENTRY(_start) - -SECTIONS -{ - . = 0x500000; - .foo : { *p1-wc.o(.text .rodata*) } - .bar : { *(.text .rodata*) } -} - -/* -RUN: mkdir -p %T -RUN: yaml2obj -format=elf %p/Inputs/prog1.o.yaml -o=%T/p1-wc.o -RUN: yaml2obj -format=elf %p/Inputs/prog2.o.yaml -o=%T/p2-wc.o -RUN: yaml2obj -format=elf %p/Inputs/prog3.o.yaml -o=%T/p3-wc.o -RUN: cd %T - -RUN: lld -flavor old-gnu -target x86_64 -T %s p1-wc.o p2-wc.o p3-wc.o \ -RUN: -static -o %t1 -RUN: llvm-readobj -s %t1 | FileCheck -check-prefix CHECKSECTIONS %s - -CHECKSECTIONS: Index: 1 -CHECKSECTIONS: Name: .foo -CHECKSECTIONS: Address: 0x500000 -CHECKSECTIONS: Size: 33 - -CHECKSECTIONS: Index: 2 -CHECKSECTIONS: Name: .bar -CHECKSECTIONS: Address: 0x500030 -CHECKSECTIONS: Size: 52 - -RUN: llvm-readobj -symbols %t1 | FileCheck -check-prefix CHECKSYMS %s - -CHECKSYMS: Name: main -CHECKSYMS-NEXT: Value: 0x500000 - -CHECKSYMS: Name: prog2 -CHECKSYMS-NEXT: Value: 0x500030 - -CHECKSYMS: Name: write -CHECKSYMS-NEXT: Value: 0x500040 - -CHECKSYMS: Name: _start -CHECKSYMS-NEXT: Value: 0x500048 -*/ diff --git a/test/old-elf/linkerscript/invalid-script-cli-1.test b/test/old-elf/linkerscript/invalid-script-cli-1.test deleted file mode 100644 index 72d2edebb4d5..000000000000 --- a/test/old-elf/linkerscript/invalid-script-cli-1.test +++ /dev/null @@ -1,10 +0,0 @@ -# Check that the -T/--script options issue an error when passed -# filenames for files that do not exist. - -RUN: not lld -flavor old-gnu -target x86_64 -T idonotexist.ls 2> %t.err -RUN: FileCheck %s < %t.err - -RUN: not lld -flavor old-gnu -target x86_64 --script=idonotexist.ls 2> %t.err -RUN: FileCheck %s < %t.err - -CHECK: {{.*}}lld: cannot find file {{.*}}idonotexist.ls diff --git a/test/old-elf/linkerscript/invalid-script-cli-2.test b/test/old-elf/linkerscript/invalid-script-cli-2.test deleted file mode 100644 index cc76f0e55a81..000000000000 --- a/test/old-elf/linkerscript/invalid-script-cli-2.test +++ /dev/null @@ -1,6 +0,0 @@ -# Check that linker script are *not* picked up with -lscript.ls. - -RUN: not lld -flavor old-gnu -target x86_64 -L%p/Inputs/ -lvalid.ls 2> %t.err -RUN: FileCheck %s < %t.err - -CHECK: {{.*}}: Unable to find library -lvalid.ls diff --git a/test/old-elf/linkerscript/invalid.test b/test/old-elf/linkerscript/invalid.test deleted file mode 100644 index a00a200225dc..000000000000 --- a/test/old-elf/linkerscript/invalid.test +++ /dev/null @@ -1,5 +0,0 @@ -# Check for errors from invalid linker scripts -RUN: not lld -flavor old-gnu -target x86_64 %p/Inputs/invalid.ls 2> %t.err -RUN: FileCheck %s < %t.err - -CHECK: {{.*}}invalid.ls: Error parsing linker script diff --git a/test/old-elf/linkerscript/phdrs-all-none.test b/test/old-elf/linkerscript/phdrs-all-none.test deleted file mode 100644 index 45baf188d8d8..000000000000 --- a/test/old-elf/linkerscript/phdrs-all-none.test +++ /dev/null @@ -1,26 +0,0 @@ -/* -Test when all segments are marked as NONE. - -RUN: yaml2obj -format=elf %p/Inputs/simple.o.yaml -o=%t.o - -RUN: lld -flavor old-gnu -target x86_64 -T %s %t.o -static -o %t1 -RUN: llvm-objdump -section-headers %t1 | FileCheck -check-prefix NONE-ALL-PHDRS %s -*/ - -ENTRY(_start) - -PHDRS -{ - text PT_LOAD; -} - -SECTIONS -{ - .text : { *(.text) } :NONE - .data : { *(.data) } -} - -/* -NONE-ALL-PHDRS: .text {{[0-9a-f]+}} 0000000000000000 -NONE-ALL-PHDRS: .data {{[0-9a-f]+}} 000000000000002c -*/ diff --git a/test/old-elf/linkerscript/phdrs-custom-none.test b/test/old-elf/linkerscript/phdrs-custom-none.test deleted file mode 100644 index e3672cf8fd30..000000000000 --- a/test/old-elf/linkerscript/phdrs-custom-none.test +++ /dev/null @@ -1,36 +0,0 @@ -/* -Test when PHDRS contains custom NONE segment. - -RUN: yaml2obj -format=elf %p/Inputs/simple.o.yaml -o=%t.o - -RUN: lld -flavor old-gnu -target x86_64 -T %s %t.o -static -o %t1 -RUN: llvm-objdump -section-headers %t1 | FileCheck -check-prefix CUSTOM-NONE-SECS %s -RUN: llvm-readobj -program-headers %t1 | FileCheck -check-prefix CUSTOM-NONE-HDRS %s -*/ - -ENTRY(_start) - -PHDRS -{ - NONE PT_LOAD; -} - -SECTIONS -{ - .text : { *(.text) } :NONE - .data : { *(.data) } -} - -/* -CUSTOM-NONE-SECS: .text {{[0-9a-f]+}} 00000000004000b0 -CUSTOM-NONE-SECS: .data {{[0-9a-f]+}} 00000000004000dc - -CUSTOM-NONE-HDRS: ProgramHeader { -CUSTOM-NONE-HDRS: Type: PT_LOAD (0x1) -CUSTOM-NONE-HDRS: VirtualAddress: 0x400000 -CUSTOM-NONE-HDRS: Flags [ (0x5) -CUSTOM-NONE-HDRS: PF_R (0x4) -CUSTOM-NONE-HDRS: PF_X (0x1) -CUSTOM-NONE-HDRS: ] -CUSTOM-NONE-HDRS: } -*/ diff --git a/test/old-elf/linkerscript/phdrs-default.test b/test/old-elf/linkerscript/phdrs-default.test deleted file mode 100644 index 8c493d020504..000000000000 --- a/test/old-elf/linkerscript/phdrs-default.test +++ /dev/null @@ -1,82 +0,0 @@ -/* -This group of tests checks usage of default headers during linking, -when PHDRS command is not defined or defined empty in linker scripts. - -This test uses a single X86-64 input object, simple.o, created with the -following X86-64 assembly code: - -*** simple.S: - -(command line clang -c simple.S -o simple.o) - - .text - main: - mov $1, %eax - movq $1, %rdi - movq $msg, %rsi - movq $14, %rdx - syscall - ret - - .globl _start - _start: - call main - mov $60, %eax - syscall - ret - - .data - msg: .asciz "Hello, World!\n" -*/ - -/* -Prepare the object file to test on. - -RUN: yaml2obj -format=elf %p/Inputs/simple.o.yaml -o=%t.o -*/ - -/* -Test when no linker script passed. - -RUN: lld -flavor old-gnu -target x86_64 %t.o -static -o %t1 -RUN: llvm-objdump -section-headers %t1 | FileCheck -check-prefix SECTIONS %s -RUN: llvm-readobj -program-headers %t1 | FileCheck -check-prefix HEADERS %s - -SECTIONS: .text {{[0-9a-f]+}} 00000000004000b0 -SECTIONS: .data {{[0-9a-f]+}} 0000000000401000 - -HEADERS: ProgramHeader { -HEADERS: Type: PT_LOAD (0x1) -HEADERS: VirtualAddress: 0x400000 -HEADERS: } -HEADERS: ProgramHeader { -HEADERS: Type: PT_LOAD (0x1) -HEADERS: VirtualAddress: 0x401000 -HEADERS: } -*/ - -/* -Test when linker script doesn't contain PHDRS and sections are not assigned to any segments. - -RUN: lld -flavor old-gnu -target x86_64 -T %p/phdrs/sections-no-phdrs.script %t.o -static -o %t2 -RUN: llvm-objdump -section-headers %t2 | FileCheck -check-prefix SECTIONS %s -RUN: llvm-readobj -program-headers %t2 | FileCheck -check-prefix HEADERS %s -*/ - -/* -Test when linker script contains empty PHDRS and sections are not assigned to any segments. - -RUN: lld -flavor old-gnu -target x86_64 -T %p/phdrs/sections-empty-phdrs.script %t.o -static -o %t3 -RUN: llvm-objdump -section-headers %t3 | FileCheck -check-prefix SECTIONS %s -RUN: llvm-readobj -program-headers %t3 | FileCheck -check-prefix HEADERS %s -*/ - -/* -Test when linker script contains empty PHDRS and sections are only assigned to NONE segments -or not assigned at all. -NOTE: Segments with the name NONE are ignored in such a case. - -RUN: lld -flavor old-gnu -target x86_64 -T %p/phdrs/sections-none-phdrs.script %t.o -static -o %t4 -RUN: llvm-objdump -section-headers %t4 | FileCheck -check-prefix SECTIONS %s -RUN: llvm-readobj -program-headers %t4 | FileCheck -check-prefix HEADERS %s -*/ diff --git a/test/old-elf/linkerscript/phdrs-different.test b/test/old-elf/linkerscript/phdrs-different.test deleted file mode 100644 index 7fe14dd543d1..000000000000 --- a/test/old-elf/linkerscript/phdrs-different.test +++ /dev/null @@ -1,45 +0,0 @@ -/* -Test sections put to different segments. - -RUN: yaml2obj -format=elf %p/Inputs/simple.o.yaml -o=%t.o - -RUN: lld -flavor old-gnu -target x86_64 -T %s %t.o -static -o %t1 -RUN: llvm-objdump -section-headers %t1 | FileCheck -check-prefix DIFF-PHDRS-SECS %s -RUN: llvm-readobj -program-headers %t1 | FileCheck -check-prefix DIFF-PHDRS-HDRS %s -*/ - -ENTRY(_start) - -PHDRS -{ - text PT_LOAD; - data PT_LOAD; -} - -SECTIONS -{ - .text : { *(.text) } :text - .data : { *(.data) } :data -} - -/* -DIFF-PHDRS-SECS: .text {{[0-9a-f]+}} 00000000004000e8 -DIFF-PHDRS-SECS: .data {{[0-9a-f]+}} 0000000000401000 - -DIFF-PHDRS-HDRS: ProgramHeader { -DIFF-PHDRS-HDRS: Type: PT_LOAD (0x1) -DIFF-PHDRS-HDRS: VirtualAddress: 0x400000 -DIFF-PHDRS-HDRS: Flags [ (0x5) -DIFF-PHDRS-HDRS: PF_R (0x4) -DIFF-PHDRS-HDRS: PF_X (0x1) -DIFF-PHDRS-HDRS: ] -DIFF-PHDRS-HDRS: } -DIFF-PHDRS-HDRS: ProgramHeader { -DIFF-PHDRS-HDRS: Type: PT_LOAD (0x1) -DIFF-PHDRS-HDRS: VirtualAddress: 0x401000 -DIFF-PHDRS-HDRS: Flags [ (0x6) -DIFF-PHDRS-HDRS: PF_R (0x4) -DIFF-PHDRS-HDRS: PF_W (0x2) -DIFF-PHDRS-HDRS: ] -DIFF-PHDRS-HDRS: } -*/ diff --git a/test/old-elf/linkerscript/phdrs-extra-program.test b/test/old-elf/linkerscript/phdrs-extra-program.test deleted file mode 100644 index 3bf27dcb1f5a..000000000000 --- a/test/old-elf/linkerscript/phdrs-extra-program.test +++ /dev/null @@ -1,27 +0,0 @@ -/* -Test extra program header generates error. - -RUN: yaml2obj -format=elf %p/Inputs/simple.o.yaml -o=%t.o - -RUN: not lld -flavor old-gnu -target x86_64 -T %s %t.o -static -o %t1 &> %t1-error -RUN: FileCheck -check-prefix EXTRA-PROGRAM-PHDR %s < %t1-error -*/ - -ENTRY(_start) - -PHDRS -{ - header PT_PHDR PHDRS; - header2 PT_PHDR PHDRS; - text PT_LOAD; -} - -SECTIONS -{ - .text : { *(.text) } :NONE - .data : { *(.data) } -} - -/* -EXTRA-PROGRAM-PHDR: Extra program header is found -*/ diff --git a/test/old-elf/linkerscript/phdrs-flags.test b/test/old-elf/linkerscript/phdrs-flags.test deleted file mode 100644 index 0fac53e75302..000000000000 --- a/test/old-elf/linkerscript/phdrs-flags.test +++ /dev/null @@ -1,46 +0,0 @@ -/* -Test sections put to different segments with FLAGS attribute set. - -RUN: yaml2obj -format=elf %p/Inputs/simple.o.yaml -o=%t.o - -RUN: lld -flavor old-gnu -target x86_64 -T %s %t.o -static -o %t1 -RUN: llvm-objdump -section-headers %t1 | FileCheck -check-prefix FLAGS-PHDRS-SECS %s -RUN: llvm-readobj -program-headers %t1 | FileCheck -check-prefix FLAGS-PHDRS-HDRS %s -*/ - -ENTRY(_start) - -PHDRS -{ - text PT_LOAD FLAGS(0x5); - data PT_LOAD FLAGS(0x7); -} - -SECTIONS -{ - .text : { *(.text) } :text - .data : { *(.data) } :data -} - -/* -FLAGS-PHDRS-SECS: .text {{[0-9a-f]+}} 0000000000401000 -FLAGS-PHDRS-SECS: .data {{[0-9a-f]+}} 00000000004000e8 - -FLAGS-PHDRS-HDRS: ProgramHeader { -FLAGS-PHDRS-HDRS: Type: PT_LOAD (0x1) -FLAGS-PHDRS-HDRS: VirtualAddress: 0x400000 -FLAGS-PHDRS-HDRS: Flags [ (0x7) -FLAGS-PHDRS-HDRS: PF_R (0x4) -FLAGS-PHDRS-HDRS: PF_W (0x2) -FLAGS-PHDRS-HDRS: PF_X (0x1) -FLAGS-PHDRS-HDRS: ] -FLAGS-PHDRS-HDRS: } -FLAGS-PHDRS-HDRS: ProgramHeader { -FLAGS-PHDRS-HDRS: Type: PT_LOAD (0x1) -FLAGS-PHDRS-HDRS: VirtualAddress: 0x401000 -FLAGS-PHDRS-HDRS: Flags [ (0x5) -FLAGS-PHDRS-HDRS: PF_R (0x4) -FLAGS-PHDRS-HDRS: PF_X (0x1) -FLAGS-PHDRS-HDRS: ] -FLAGS-PHDRS-HDRS: } -*/ diff --git a/test/old-elf/linkerscript/phdrs-has-program.test b/test/old-elf/linkerscript/phdrs-has-program.test deleted file mode 100644 index 83fe94c70614..000000000000 --- a/test/old-elf/linkerscript/phdrs-has-program.test +++ /dev/null @@ -1,33 +0,0 @@ -/* -Test when program segment is set it's generated. - -RUN: yaml2obj -format=elf %p/Inputs/simple.o.yaml -o=%t.o - -RUN: lld -flavor old-gnu -target x86_64 -T %s %t.o -static -o %t1 -RUN: llvm-readobj -program-headers %t1 | FileCheck -check-prefix PROGRAM-PHDR %s -*/ - -ENTRY(_start) - -PHDRS -{ - header PT_PHDR FILEHDR PHDRS; - text PT_LOAD PHDRS; -} - -SECTIONS -{ - .text : { *(.text) } :text - .data : { *(.data) } -} - -/* -PROGRAM-PHDR: ProgramHeader { -PROGRAM-PHDR: Type: PT_PHDR (0x6) -PROGRAM-PHDR: VirtualAddress: 0x400040 -PROGRAM-PHDR: Flags [ (0x5) -PROGRAM-PHDR: PF_R (0x4) -PROGRAM-PHDR: PF_X (0x1) -PROGRAM-PHDR: ] -PROGRAM-PHDR: } -*/ diff --git a/test/old-elf/linkerscript/phdrs-invalid.test b/test/old-elf/linkerscript/phdrs-invalid.test deleted file mode 100644 index c1426e8ffa5f..000000000000 --- a/test/old-elf/linkerscript/phdrs-invalid.test +++ /dev/null @@ -1,63 +0,0 @@ -/* -This group of tests checks invalid cases of defining and using PHDRS -command in linker scripts. - -This test uses a single X86-64 input object, simple.o, created with the -following X86-64 assembly code: - -*** simple.S: - -(command line clang -c simple.S -o simple.o) - - .text - main: - mov $1, %eax - movq $1, %rdi - movq $msg, %rsi - movq $14, %rdx - syscall - ret - - .globl _start - _start: - call main - mov $60, %eax - syscall - ret - - .data - msg: .asciz "Hello, World!\n" -*/ - -/* -Prepare the object file to test on. - -RUN: yaml2obj -format=elf %p/Inputs/simple.o.yaml -o=%t.o -*/ - -/* -Test undefined header used when no PHDRS defined. - -RUN: not lld -flavor old-gnu -target x86_64 -T %p/phdrs/undef-no-phdrs.script %t.o -static -o %t1 &> %t1-error -RUN: FileCheck -check-prefix UNDEF-NO-PHDRS %s < %t1-error - -UNDEF-NO-PHDRS: Unknown header identifiers (missing in PHDRS command) are used -*/ - -/* -Test undefined header used when PHDRS is empty. - -RUN: not lld -flavor old-gnu -target x86_64 -T %p/phdrs/undef-empty-phdrs.script %t.o -static -o %t2 &> %t2-error -RUN: FileCheck -check-prefix UNDEF-EMPTY-PHDRS %s < %t2-error - -UNDEF-EMPTY-PHDRS: Unknown header identifiers (missing in PHDRS command) are used -*/ - -/* -Test undefined header used when PHDRS contains definitions. - -RUN: not lld -flavor old-gnu -target x86_64 -T %p/phdrs/undef-id-phdrs.script %t.o -static -o %t3 &> %t3-error -RUN: FileCheck -check-prefix UNDEF-ID-PHDRS %s < %t3-error - -UNDEF-ID-PHDRS: Unknown header identifiers (missing in PHDRS command) are used -*/ diff --git a/test/old-elf/linkerscript/phdrs-misplaced-program.test b/test/old-elf/linkerscript/phdrs-misplaced-program.test deleted file mode 100644 index 0fb669d818c4..000000000000 --- a/test/old-elf/linkerscript/phdrs-misplaced-program.test +++ /dev/null @@ -1,26 +0,0 @@ -/* -Test misplaced program header generates error. - -RUN: yaml2obj -format=elf %p/Inputs/simple.o.yaml -o=%t.o - -RUN: not lld -flavor old-gnu -target x86_64 -T %s %t.o -static -o %t1 &> %t1-error -RUN: FileCheck -check-prefix MISPLACED-PROGRAM-PHDR %s < %t1-error -*/ - -ENTRY(_start) - -PHDRS -{ - text PT_LOAD; - header PT_PHDR PHDRS; -} - -SECTIONS -{ - .text : { *(.text) } :NONE - .data : { *(.data) } -} - -/* -MISPLACED-PROGRAM-PHDR: Program header must precede load segments -*/ diff --git a/test/old-elf/linkerscript/phdrs-no-program.test b/test/old-elf/linkerscript/phdrs-no-program.test deleted file mode 100644 index e461d5061019..000000000000 --- a/test/old-elf/linkerscript/phdrs-no-program.test +++ /dev/null @@ -1,25 +0,0 @@ -/* -Test when no program segment set it's not generated. - -RUN: yaml2obj -format=elf %p/Inputs/simple.o.yaml -o=%t.o - -RUN: lld -flavor old-gnu -target x86_64 -T %s %t.o -static -o %t1 -RUN: llvm-readobj -program-headers %t1 | FileCheck -check-prefix PROGRAM-PHDR %s -*/ - -ENTRY(_start) - -PHDRS -{ - text PT_LOAD; -} - -SECTIONS -{ - .text : { *(.text) } :text - .data : { *(.data) } -} - -/* -PROGRAM-PHDR-NOT: Type: PT_PHDR (0x6) -*/ diff --git a/test/old-elf/linkerscript/phdrs-one-none.test b/test/old-elf/linkerscript/phdrs-one-none.test deleted file mode 100644 index a1c84e59fc60..000000000000 --- a/test/old-elf/linkerscript/phdrs-one-none.test +++ /dev/null @@ -1,36 +0,0 @@ -/* -Test when one segment is marked as NONE. - -RUN: yaml2obj -format=elf %p/Inputs/simple.o.yaml -o=%t.o - -RUN: lld -flavor old-gnu -target x86_64 -T %s %t.o -static -o %t1 -RUN: llvm-objdump -section-headers %t1 | FileCheck -check-prefix NONE-PHDRS-SECS %s -RUN: llvm-readobj -program-headers %t1 | FileCheck -check-prefix NONE-PHDRS-HDRS %s -*/ - -ENTRY(_start) - -PHDRS -{ - text PT_LOAD; -} - -SECTIONS -{ - .text : { *(.text) } :text - .data : { *(.data) } :NONE -} - -/* -NONE-PHDRS-SECS: .text {{[0-9a-f]+}} 00000000004000b0 -NONE-PHDRS-SECS: .data {{[0-9a-f]+}} 0000000000000000 - -NONE-PHDRS-HDRS: ProgramHeader { -NONE-PHDRS-HDRS: Type: PT_LOAD (0x1) -NONE-PHDRS-HDRS: VirtualAddress: 0x400000 -NONE-PHDRS-HDRS: Flags [ (0x5) -NONE-PHDRS-HDRS: PF_R (0x4) -NONE-PHDRS-HDRS: PF_X (0x1) -NONE-PHDRS-HDRS: ] -NONE-PHDRS-HDRS: } -*/ diff --git a/test/old-elf/linkerscript/phdrs-program-flags.test b/test/old-elf/linkerscript/phdrs-program-flags.test deleted file mode 100644 index 2a719a6cb296..000000000000 --- a/test/old-elf/linkerscript/phdrs-program-flags.test +++ /dev/null @@ -1,33 +0,0 @@ -/* -Test when program segment contains only FLAGS attribute. - -RUN: yaml2obj -format=elf %p/Inputs/simple.o.yaml -o=%t.o - -RUN: lld -flavor old-gnu -target x86_64 -T %s %t.o -static -o %t1 -RUN: llvm-readobj -program-headers %t1 | FileCheck -check-prefix PROGRAM-FLAGS-PHDR %s -*/ - -ENTRY(_start) - -PHDRS -{ - header PT_PHDR PHDRS FLAGS(0x7); - text PT_LOAD FILEHDR PHDRS; -} - -SECTIONS -{ - .text : { *(.text) } :text - .data : { *(.data) } -} - -/* -PROGRAM-FLAGS-PHDR: ProgramHeader { -PROGRAM-FLAGS-PHDR: Type: PT_PHDR (0x6) -PROGRAM-FLAGS-PHDR: Flags [ (0x7) -PROGRAM-FLAGS-PHDR: PF_R (0x4) -PROGRAM-FLAGS-PHDR: PF_W (0x2) -PROGRAM-FLAGS-PHDR: PF_X (0x1) -PROGRAM-FLAGS-PHDR: ] -PROGRAM-FLAGS-PHDR: } -*/ diff --git a/test/old-elf/linkerscript/phdrs-program-good-phdrs.test b/test/old-elf/linkerscript/phdrs-program-good-phdrs.test deleted file mode 100644 index 373facc380ba..000000000000 --- a/test/old-elf/linkerscript/phdrs-program-good-phdrs.test +++ /dev/null @@ -1,34 +0,0 @@ -/* -Test when program segment contains only PHDRS attribute. - -RUN: yaml2obj -format=elf %p/Inputs/simple.o.yaml -o=%t.o - -RUN: lld -flavor old-gnu -target x86_64 -T %s %t.o -static -o %t1 -RUN: llvm-readobj -program-headers %t1 | FileCheck -check-prefix PROGRAM-PHDRS-PHDR %s -*/ - -ENTRY(_start) - -PHDRS -{ - header PT_PHDR PHDRS; - text PT_LOAD PHDRS; -} - -SECTIONS -{ - .text : { *(.text) } :text - .data : { *(.data) } -} - -/* -PROGRAM-PHDRS-PHDR: ProgramHeader { -PROGRAM-PHDRS-PHDR: Type: PT_PHDR (0x6) -PROGRAM-PHDRS-PHDR: VirtualAddress: 0x400040 -PROGRAM-PHDRS-PHDR: MemSize: 168 -PROGRAM-PHDRS-PHDR: Flags [ (0x5) -PROGRAM-PHDRS-PHDR: PF_R (0x4) -PROGRAM-PHDRS-PHDR: PF_X (0x1) -PROGRAM-PHDRS-PHDR: ] -PROGRAM-PHDRS-PHDR: } -*/ diff --git a/test/old-elf/linkerscript/phdrs-program-no-phdrs.test b/test/old-elf/linkerscript/phdrs-program-no-phdrs.test deleted file mode 100644 index 3e639bdb0f43..000000000000 --- a/test/old-elf/linkerscript/phdrs-program-no-phdrs.test +++ /dev/null @@ -1,26 +0,0 @@ -/* -Test when program segment doesn't contain PHDRS attribute. - -RUN: yaml2obj -format=elf %p/Inputs/simple.o.yaml -o=%t.o - -RUN: not lld -flavor old-gnu -target x86_64 -T %s %t.o -static -o %t1 &> %t1-error -RUN: FileCheck -check-prefix PROGRAM-PHDR-NO-PHDRS %s < %t1-error -*/ - -ENTRY(_start) - -PHDRS -{ - header PT_PHDR; - text PT_LOAD; -} - -SECTIONS -{ - .text : { *(.text) } :text - .data : { *(.data) } -} - -/* -PROGRAM-PHDR-NO-PHDRS: Program header has invalid PHDRS attribute -*/ diff --git a/test/old-elf/linkerscript/phdrs-program-wrong-phdrs.test b/test/old-elf/linkerscript/phdrs-program-wrong-phdrs.test deleted file mode 100644 index c27b23d85876..000000000000 --- a/test/old-elf/linkerscript/phdrs-program-wrong-phdrs.test +++ /dev/null @@ -1,26 +0,0 @@ -/* -Test when program segment contains PHDRS attribute not mapped to load segment. - -RUN: yaml2obj -format=elf %p/Inputs/simple.o.yaml -o=%t.o - -RUN: not lld -flavor old-gnu -target x86_64 -T %s %t.o -static -o %t1 &> %t1-error -RUN: FileCheck -check-prefix PROGRAM-PHDR-WRONG-PHDRS %s < %t1-error -*/ - -ENTRY(_start) - -PHDRS -{ - header PT_PHDR PHDRS; - text PT_LOAD; -} - -SECTIONS -{ - .text : { *(.text) } :text - .data : { *(.data) } -} - -/* -PROGRAM-PHDR-WRONG-PHDRS: Program header has invalid PHDRS attribute -*/ diff --git a/test/old-elf/linkerscript/phdrs-same-flags.test b/test/old-elf/linkerscript/phdrs-same-flags.test deleted file mode 100644 index e39f61881033..000000000000 --- a/test/old-elf/linkerscript/phdrs-same-flags.test +++ /dev/null @@ -1,35 +0,0 @@ -/* -Test sections put to same segment with FLAGS attribute set. - -RUN: yaml2obj -format=elf %p/Inputs/simple.o.yaml -o=%t.o - -RUN: lld -flavor old-gnu -target x86_64 -T %s %t.o -static -o %t1 -RUN: llvm-objdump -section-headers %t1 | FileCheck -check-prefix FLAGS-PHDRS-SECS %s -RUN: llvm-readobj -program-headers %t1 | FileCheck -check-prefix FLAGS-PHDRS-HDRS %s -*/ - -ENTRY(_start) - -PHDRS -{ - text PT_LOAD FLAGS(0x4); -} - -SECTIONS -{ - .text : { *(.text) } :text - .data : { *(.data) } -} - -/* -FLAGS-PHDRS-SECS: .text {{[0-9a-f]+}} 00000000004000b0 -FLAGS-PHDRS-SECS: .data {{[0-9a-f]+}} 00000000004000dc - -FLAGS-PHDRS-HDRS: ProgramHeader { -FLAGS-PHDRS-HDRS: Type: PT_LOAD (0x1) -FLAGS-PHDRS-HDRS: VirtualAddress: 0x400000 -FLAGS-PHDRS-HDRS: Flags [ (0x4) -FLAGS-PHDRS-HDRS: PF_R (0x4) -FLAGS-PHDRS-HDRS: ] -FLAGS-PHDRS-HDRS: } -*/ diff --git a/test/old-elf/linkerscript/phdrs-same.test b/test/old-elf/linkerscript/phdrs-same.test deleted file mode 100644 index 92b3ad3909c3..000000000000 --- a/test/old-elf/linkerscript/phdrs-same.test +++ /dev/null @@ -1,36 +0,0 @@ -/* -Test sections put to same segment. - -RUN: yaml2obj -format=elf %p/Inputs/simple.o.yaml -o=%t.o - -RUN: lld -flavor old-gnu -target x86_64 -T %s %t.o -static -o %t1 -RUN: llvm-objdump -section-headers %t1 | FileCheck -check-prefix SAME-PHDRS-SECS %s -RUN: llvm-readobj -program-headers %t1 | FileCheck -check-prefix SAME-PHDRS-HDRS %s -*/ - -ENTRY(_start) - -PHDRS -{ - text PT_LOAD; -} - -SECTIONS -{ - .text : { *(.text) } :text - .data : { *(.data) } -} - -/* -SAME-PHDRS-SECS: .text {{[0-9a-f]+}} 00000000004000b0 -SAME-PHDRS-SECS: .data {{[0-9a-f]+}} 00000000004000dc - -SAME-PHDRS-HDRS: ProgramHeader { -SAME-PHDRS-HDRS: Type: PT_LOAD (0x1) -SAME-PHDRS-HDRS: VirtualAddress: 0x400000 -SAME-PHDRS-HDRS: Flags [ (0x5) -SAME-PHDRS-HDRS: PF_R (0x4) -SAME-PHDRS-HDRS: PF_X (0x1) -SAME-PHDRS-HDRS: ] -SAME-PHDRS-HDRS: } -*/ diff --git a/test/old-elf/linkerscript/phdrs/sections-empty-phdrs.script b/test/old-elf/linkerscript/phdrs/sections-empty-phdrs.script deleted file mode 100644 index ac30df78d5e1..000000000000 --- a/test/old-elf/linkerscript/phdrs/sections-empty-phdrs.script +++ /dev/null @@ -1,11 +0,0 @@ -ENTRY(_start) - -PHDRS -{ -} - -SECTIONS -{ - .text : { *(.text) } - .data : { *(.data) } -} diff --git a/test/old-elf/linkerscript/phdrs/sections-no-phdrs.script b/test/old-elf/linkerscript/phdrs/sections-no-phdrs.script deleted file mode 100644 index b8848cd3ab0d..000000000000 --- a/test/old-elf/linkerscript/phdrs/sections-no-phdrs.script +++ /dev/null @@ -1,7 +0,0 @@ -ENTRY(_start) - -SECTIONS -{ - .text : { *(.text) } - .data : { *(.data) } -} diff --git a/test/old-elf/linkerscript/phdrs/sections-none-phdrs.script b/test/old-elf/linkerscript/phdrs/sections-none-phdrs.script deleted file mode 100644 index 4b240245d2b2..000000000000 --- a/test/old-elf/linkerscript/phdrs/sections-none-phdrs.script +++ /dev/null @@ -1,11 +0,0 @@ -ENTRY(_start) - -PHDRS -{ -} - -SECTIONS -{ - .text : { *(.text) } :NONE - .data : { *(.data) } -} diff --git a/test/old-elf/linkerscript/phdrs/undef-empty-phdrs.script b/test/old-elf/linkerscript/phdrs/undef-empty-phdrs.script deleted file mode 100644 index f92b452d2346..000000000000 --- a/test/old-elf/linkerscript/phdrs/undef-empty-phdrs.script +++ /dev/null @@ -1,11 +0,0 @@ -ENTRY(_start) - -PHDRS -{ -} - -SECTIONS -{ - .text : { *(.text) } - .data : { *(.data) } :phdr -} diff --git a/test/old-elf/linkerscript/phdrs/undef-id-phdrs.script b/test/old-elf/linkerscript/phdrs/undef-id-phdrs.script deleted file mode 100644 index 8ac56695f00a..000000000000 --- a/test/old-elf/linkerscript/phdrs/undef-id-phdrs.script +++ /dev/null @@ -1,12 +0,0 @@ -ENTRY(_start) - -PHDRS -{ - phdr PT_LOAD; -} - -SECTIONS -{ - .text : { *(.text) } :phdr_wrong - .data : { *(.data) } -} diff --git a/test/old-elf/linkerscript/phdrs/undef-no-phdrs.script b/test/old-elf/linkerscript/phdrs/undef-no-phdrs.script deleted file mode 100644 index d3ee5bdebe41..000000000000 --- a/test/old-elf/linkerscript/phdrs/undef-no-phdrs.script +++ /dev/null @@ -1,7 +0,0 @@ -ENTRY(_start) - -SECTIONS -{ - .text : { *(.text) } :phdr - .data : { *(.data) } -} diff --git a/test/old-elf/linkerscript/sections-order.test b/test/old-elf/linkerscript/sections-order.test deleted file mode 100644 index 4d23f5eb9d54..000000000000 --- a/test/old-elf/linkerscript/sections-order.test +++ /dev/null @@ -1,113 +0,0 @@ -/* -Tests a simple linker script that changes the order of output sections and -also changes the address of output sections by using simple expressions. - -This test uses three X86-64 input objects, prog1.o, prog2.o and prog3.o, -which were created with the following C or assembly code: - -*** prog1.o: - -(command line clang -c prog1.c -o prog1.o) - -const char *prog2(); -void write(int, const char *, int); - -int main() { - write(1, prog2(), 14); -} - -*** prog2.o: - -(command line clang -c prog2.c -o prog2.o) - -const char *prog2() { - return "Hello, world!\n"; -} - -*** prog3.o: - -(command line clang -c prog3.S -o prog3.o) - - .globl write -write: - mov $1, %eax - syscall - ret - - .globl _start -_start: - call main - mov $60, %eax - syscall - ret - -We use the following linker script for this test: -*/ - -ENTRY(_start) - -SECTIONS -{ - . = 0x500000; - .text : { prog1.o(.text) } - .mystring : { prog2.o(.rodata.str1.1) } - . = . + 0x6000; - .text.2 : {prog3.o(.text) prog2.o(.text) } -} - -/* -RUN: mkdir -p %T -RUN: yaml2obj -format=elf %p/Inputs/prog1.o.yaml -o=%T/prog1.o -RUN: yaml2obj -format=elf %p/Inputs/prog2.o.yaml -o=%T/prog2.o -RUN: yaml2obj -format=elf %p/Inputs/prog3.o.yaml -o=%T/prog3.o -RUN: cd %T - -RUN: lld -flavor old-gnu -target x86_64 -T %s prog1.o prog2.o prog3.o \ -RUN: -static -o %t1 -RUN: llvm-readobj -s %t1 | FileCheck -check-prefix CHECKSECTIONS %s - -CHECKSECTIONS: Index: 1 -CHECKSECTIONS: Name: .text -CHECKSECTIONS: Address: 0x500000 -CHECKSECTIONS: Size: 33 - -CHECKSECTIONS: Index: 2 -CHECKSECTIONS: Name: .mystring -CHECKSECTIONS: Address: 0x500021 -CHECKSECTIONS: Size: 15 - -CHECKSECTIONS: Index: 3 -CHECKSECTIONS: Name: .text.2 -CHECKSECTIONS: Address: 0x506030 -CHECKSECTIONS: Size: 48 - -RUN: llvm-readobj -symbols %t1 | FileCheck -check-prefix CHECKSYMS %s - -CHECKSYMS: Name: main -CHECKSYMS-NEXT: Value: 0x500000 - -CHECKSYMS: Name: write -CHECKSYMS-NEXT: Value: 0x506030 - -CHECKSYMS: Name: _start -CHECKSYMS-NEXT: Value: 0x506038 - -CHECKSYMS: Name: prog2 -CHECKSYMS-NEXT: Value: 0x506050 - -RUN: llvm-readobj -program-headers %t1 | FileCheck -check-prefix CHECKPHDRS %s - -CHECKPHDRS: Type: PT_LOAD (0x1) -CHECKPHDRS: Offset: 0x1000 -CHECKPHDRS-NEXT: VirtualAddress: 0x500000 -CHECKPHDRS-NEXT: PhysicalAddress: 0x500000 -CHECKPHDRS-NEXT: FileSize: 48 -CHECKPHDRS-NEXT: MemSize: 48 - -CHECKPHDRS: Type: PT_LOAD (0x1) -CHECKPHDRS: Offset: 0x2030 -CHECKPHDRS-NEXT: VirtualAddress: 0x506030 -CHECKPHDRS-NEXT: PhysicalAddress: 0x506030 -CHECKPHDRS-NEXT: FileSize: 168 -CHECKPHDRS-NEXT: MemSize: 168 -*/ diff --git a/test/old-elf/linkerscript/sections-with-wildcards.test b/test/old-elf/linkerscript/sections-with-wildcards.test deleted file mode 100644 index a390a2b2d36a..000000000000 --- a/test/old-elf/linkerscript/sections-with-wildcards.test +++ /dev/null @@ -1,88 +0,0 @@ -/* -Tests a linker script that uses the SECTIONS command with rules containing -wildcards and simple SORT directives. It also tests that the linker script -evaluates the expressions in the same order as the one written in the script -file. - -This test uses three X86-64 input objects, prog1.o, prog2.o and prog3.o, -which were created with the following C or assembly code: - -*** prog1.o: - -(command line clang -c prog1.c -o prog1.o) - -const char *prog2(); -void write(int, const char *, int); - -int main() { - write(1, prog2(), 14); -} - -*** prog2.o: - -(command line clang -c prog2.c -o prog2.o) - -const char *prog2() { - return "Hello, world!\n"; -} - -*** prog3.o: - -(command line clang -c prog3.S -o prog3.o) - - .globl write -write: - mov $1, %eax - syscall - ret - - .globl _start -_start: - call main - mov $60, %eax - syscall - ret - -We use the following linker script for this test: -*/ - -ENTRY(_start) - -SECTIONS -{ - my_start_addr = 0x500000; - my_symbol = my_start_addr; - . = my_symbol; - .foo : { SORT(*)(.text .rodata*) } -} - -/* -RUN: mkdir -p %T -RUN: yaml2obj -format=elf %p/Inputs/prog1.o.yaml -o=%T/p1.o -RUN: yaml2obj -format=elf %p/Inputs/prog2.o.yaml -o=%T/p2.o -RUN: yaml2obj -format=elf %p/Inputs/prog3.o.yaml -o=%T/p3.o -RUN: cd %T - -RUN: lld -flavor old-gnu -target x86_64 -T %s p1.o p2.o p3.o \ -RUN: -static -o %t1 -RUN: llvm-readobj -s %t1 | FileCheck -check-prefix CHECKSECTIONS %s - -CHECKSECTIONS: Index: 1 -CHECKSECTIONS: Name: .foo -CHECKSECTIONS: Address: 0x500000 -CHECKSECTIONS: Size: 101 - -RUN: llvm-readobj -symbols %t1 | FileCheck -check-prefix CHECKSYMS %s - -CHECKSYMS: Name: main -CHECKSYMS-NEXT: Value: 0x500000 - -CHECKSYMS: Name: prog2 -CHECKSYMS-NEXT: Value: 0x500030 - -CHECKSYMS: Name: write -CHECKSYMS-NEXT: Value: 0x500050 - -CHECKSYMS: Name: _start -CHECKSYMS-NEXT: Value: 0x500058 -*/ diff --git a/test/old-elf/linkerscript/symbol-definition-so.test b/test/old-elf/linkerscript/symbol-definition-so.test deleted file mode 100644 index 15b22f6f581f..000000000000 --- a/test/old-elf/linkerscript/symbol-definition-so.test +++ /dev/null @@ -1,32 +0,0 @@ -/* -We test whether we can define symbols in a linker script and have them exported -to the output file symbol table. This test is the same as symbol-definition.test -but make checking in case of shared library linking. - -We use the following linker script for this test: -*/ - -SECTIONS -{ - .text : { *(.text) } - MYSTRING = .; - .data : { *(.data) } -} - -/* -RUN: yaml2obj -format=elf %p/Inputs/simple-pic.o.yaml -o=%t.o - -RUN: lld -flavor old-gnu -target x86_64 -shared -T %s %t.o -o %t.so -RUN: llvm-readobj -s -symbols %t.so | FileCheck -check-prefix CHECKSYMS %s - -CHECKSYMS: Name: .data -CHECKSYMS-NEXT: Type: SHT_PROGBITS -CHECKSYMS-NEXT: Flags [ -CHECKSYMS-NEXT: SHF_ALLOC -CHECKSYMS-NEXT: SHF_WRITE -CHECKSYMS-NEXT: ] -CHECKSYMS-NEXT: Address: 0x401060 - -CHECKSYMS: Name: MYSTRING -CHECKSYMS-NEXT: Value: 0x401060 -*/ diff --git a/test/old-elf/linkerscript/symbol-definition.test b/test/old-elf/linkerscript/symbol-definition.test deleted file mode 100644 index daa3b17e9965..000000000000 --- a/test/old-elf/linkerscript/symbol-definition.test +++ /dev/null @@ -1,54 +0,0 @@ -/* -We test whether we can define symbols in a linker script and have them exported -to the output file symbol table. - -This test uses a single X86-64 input object, simple.o, created with the -following X86-64 assembly code: - -*** simple.S: - -(command line clang -c simple.S -o simple.o) - - .text - main: - mov $1, %eax - movq $1, %rdi - movq $msg, %rsi - movq $14, %rdx - syscall - ret - - .globl _start - _start: - call main - mov $60, %eax - syscall - ret - - .data - msg: .asciz "Hello, World!\n" - - -We use the following linker script for this test: -*/ - -ENTRY(_start) - -SECTIONS -{ - . = 0x500000; - .text : { *(.text) } - MYSTRING = .; - .data : { *(.data) } -} - -/* -RUN: mkdir -p %T -RUN: yaml2obj -format=elf %p/Inputs/simple.o.yaml -o=%T/simple.o - -RUN: lld -flavor old-gnu -target x86_64 -T %s %T/simple.o -static -o %t1 -RUN: llvm-readobj -symbols %t1 | FileCheck -check-prefix CHECKSYMS %s - -CHECKSYMS: Name: MYSTRING -CHECKSYMS-NEXT: Value: 0x501000 -*/ diff --git a/test/old-elf/linkerscript/valid-script-cli.objtxt b/test/old-elf/linkerscript/valid-script-cli.objtxt deleted file mode 100644 index a7342c41f529..000000000000 --- a/test/old-elf/linkerscript/valid-script-cli.objtxt +++ /dev/null @@ -1,23 +0,0 @@ -# Check that the linker script inputs are accepted properly. - -# RUN: lld -flavor old-gnu -target x86_64 %p/Inputs/valid.ls -r %s \ -# RUN: --output-filetype=yaml | FileCheck %s - -# RUN: lld -flavor old-gnu -target x86_64 -T %p/Inputs/valid.ls -r %s \ -# RUN: --output-filetype=yaml | FileCheck %s - -# RUN: lld -flavor old-gnu -target x86_64 --script=%p/Inputs/valid.ls -r %s \ -# RUN: --output-filetype=yaml | FileCheck %s - -# RUN: lld -flavor old-gnu -target x86_64 -L%p/Inputs/ -l:valid.ls -r %s \ -# RUN: --output-filetype=yaml | FileCheck %s - -defined-atoms: - - name: main - scope: global - content: [ B8, 00, 00, 00, 00, C7, 44, 24, FC, 00, 00, 00, 00, C3 ] - alignment: 16 - section-choice: custom-required - section-name: .text - -# CHECK: _entry_point |
