Index: lld/trunk/test/ELF/dtrace-r.test =================================================================== --- lld/trunk/test/ELF/dtrace-r.test +++ lld/trunk/test/ELF/dtrace-r.test @@ -1,8 +0,0 @@ -RUN: ld.lld -r -o %t.o %p/Inputs/dtrace-r.o -RUN: llvm-readobj -r %t.o | FileCheck %s - -CHECK: Relocations [ -CHECK-NEXT: Section ({{.*}}) .rela.text { -CHECK-NEXT: 0x0 R_X86_64_NONE - 0x0 -CHECK-NEXT: } -CHECK-NEXT: ] Index: lld/trunk/test/ELF/icf10.s =================================================================== --- lld/trunk/test/ELF/icf10.s +++ lld/trunk/test/ELF/icf10.s @@ -0,0 +1,17 @@ +# REQUIRES: x86 + +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-freebsd %s -o %t.o +# RUN: ld.lld --icf=all %t.o -o /dev/null --print-icf-sections 2>&1 | FileCheck %s + +# Checks that ICF does not merge 2 sections the offset of +# the relocations of which differ. + +# CHECK-NOT: selected + +.section .text.foo,"ax" + .quad -1 + .reloc 0, R_X86_64_NONE, 0 + +.section .text.bar,"ax" + .quad -1 + .reloc 1, R_X86_64_NONE, 0 Index: lld/trunk/test/ELF/icf10.test =================================================================== --- lld/trunk/test/ELF/icf10.test +++ lld/trunk/test/ELF/icf10.test @@ -1,38 +0,0 @@ -# RUN: yaml2obj %s -o %t.o -# RUN: ld.lld --icf=all %t.o -o /dev/null --print-icf-sections 2>&1 | FileCheck %s - -# Checks that ICF does not merge 2 sections the offset of -# the relocations of which differ. - -# CHECK-NOT: selected - -!ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_FREEBSD - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .text.foo - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR] - Content: "FFFFFFFFFFFFFFFF" - - Name: .text.bar - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR] - Content: "FFFFFFFFFFFFFFFF" - - Name: .rela.text.foo - Type: SHT_RELA - Link: .symtab - Info: .text.foo - Relocations: - - Offset: 0x0000000000000000 - Type: R_X86_64_NONE - - Name: .rela.text.bar - Type: SHT_RELA - Link: .symtab - Info: .text.bar - Relocations: - - Offset: 0x0000000000000001 - Type: R_X86_64_NONE Index: lld/trunk/test/ELF/relocation-dtrace.test =================================================================== --- lld/trunk/test/ELF/relocation-dtrace.test +++ lld/trunk/test/ELF/relocation-dtrace.test @@ -1,23 +0,0 @@ -# RUN: yaml2obj %s -o %t.o -# RUN: ld.lld -shared %t.o -o /dev/null - -# Test that we can handle R_X86_64_NONE as produced by dtrace. - -!ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_FREEBSD - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC ] - - Name: .rela.text - Type: SHT_RELA - Link: .symtab - Info: .text - Relocations: - - Offset: 0x0000000000000000 - Type: R_X86_64_NONE Index: lld/trunk/test/ELF/relocation-none-aarch64.s =================================================================== --- lld/trunk/test/ELF/relocation-none-aarch64.s +++ lld/trunk/test/ELF/relocation-none-aarch64.s @@ -0,0 +1,24 @@ +# RUN: llvm-mc -filetype=obj -triple=aarch64-linux-musl %s -o %t.o +# RUN: ld.lld --gc-sections %t.o -o %t +# RUN: llvm-readelf -S -r %t | FileCheck %s + +# Test that we discard R_AARCH64_NONE, but respect the references it creates +# among sections. + +# CHECK: .data +# CHECK: There are no relocations in this file. + +# RUN: ld.lld -r %t.o -o %t +# RUN: llvm-readobj -r %t | FileCheck --check-prefix=RELOC %s + +# RELOC: Section ({{.*}}) .rela.text { +# RELOC-NEXT: 0x0 R_AARCH64_NONE .data 0x0 +# RELOC-NEXT: } + +.globl _start +_start: + ret + .reloc 0, R_AARCH64_NONE, .data + +.data + .long 0 Index: lld/trunk/test/ELF/relocation-none-aarch64.test =================================================================== --- lld/trunk/test/ELF/relocation-none-aarch64.test +++ lld/trunk/test/ELF/relocation-none-aarch64.test @@ -1,23 +0,0 @@ -# REQUIRES: aarch64 - -# RUN: yaml2obj %s -o %t.o -# RUN: ld.lld %t.o -o /dev/null - -!ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_AARCH64 -Sections: - - Type: SHT_PROGBITS - Name: .text - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - Content: "00000000" - - Type: SHT_RELA - Name: .rela.text - Link: .symtab - Info: .text - Relocations: - - Offset: 0 - Type: R_AARCH64_NONE Index: lld/trunk/test/ELF/relocation-none-arm.s =================================================================== --- lld/trunk/test/ELF/relocation-none-arm.s +++ lld/trunk/test/ELF/relocation-none-arm.s @@ -0,0 +1,17 @@ +# RUN: llvm-mc -filetype=obj -triple=armv7-linux-musl %s -o %t.o +# RUN: ld.lld --gc-sections %t.o -o %t +# RUN: llvm-readelf -S -r %t | FileCheck %s + +# Test that we discard R_ARM_NONE, but respect the references it creates among +# sections. + +# CHECK: .data +# CHECK: There are no relocations in this file. + +.globl _start +_start: + nop + .reloc 0, R_ARM_NONE, .data + +.data + .long 0 Index: lld/trunk/test/ELF/relocation-none-i386.s =================================================================== --- lld/trunk/test/ELF/relocation-none-i386.s +++ lld/trunk/test/ELF/relocation-none-i386.s @@ -0,0 +1,17 @@ +# RUN: llvm-mc -filetype=obj -triple=i386-linux-musl %s -o %t.o +# RUN: ld.lld --gc-sections %t.o -o %t +# RUN: llvm-readelf -S -r %t | FileCheck %s + +# Test that we discard R_386_NONE, but respect the +# references it creates among sections. + +# CHECK: .data +# CHECK: There are no relocations in this file. + +.globl _start +_start: + ret + .reloc 0, R_386_NONE, .data + +.data + .long 0 Index: lld/trunk/test/ELF/relocation-none-i686.test =================================================================== --- lld/trunk/test/ELF/relocation-none-i686.test +++ lld/trunk/test/ELF/relocation-none-i686.test @@ -1,22 +0,0 @@ -# RUN: yaml2obj %s -o %t.o -# RUN: ld.lld %t.o -o /dev/null - -# Test that we can handle R_386_NONE. - -!ELF -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_386 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC ] - - Name: .rel.text - Type: SHT_RELA - Link: .symtab - Info: .text - Relocations: - - Offset: 0x0000000000000000 - Type: R_386_NONE Index: lld/trunk/test/ELF/relocation-none-x86-64.s =================================================================== --- lld/trunk/test/ELF/relocation-none-x86-64.s +++ lld/trunk/test/ELF/relocation-none-x86-64.s @@ -0,0 +1,24 @@ +# RUN: llvm-mc -filetype=obj -triple=x86_64-linux-musl %s -o %t.o +# RUN: ld.lld --gc-sections %t.o -o %t +# RUN: llvm-readelf -S -r %t | FileCheck %s + +# Test that we discard R_X86_64_NONE, but respect the +# references it creates among sections. + +# CHECK: .data +# CHECK: There are no relocations in this file. + +# RUN: ld.lld -r %t.o -o %t +# RUN: llvm-readobj -r %t | FileCheck --check-prefix=RELOC %s + +# RELOC: Section ({{.*}}) .rela.text { +# RELOC-NEXT: 0x0 R_X86_64_NONE .data 0x0 +# RELOC-NEXT: } + +.globl _start +_start: + ret + .reloc 0, R_X86_64_NONE, .data + +.data + .long 0