1# RUN: yaml2obj -DMACHINE=AARCH64 %s -o %t.o 2# RUN: ld.lld --gc-sections %t.o -o %t 3# RUN: llvm-readelf -S -r %t | FileCheck %s 4 5## Test that we discard R_*_NONE, but respect the references it creates 6## among sections. 7 8# CHECK: .data 9# CHECK: There are no relocations in this file. 10 11# RUN: ld.lld -r %t.o -o %t 12# RUN: llvm-readobj -r %t | FileCheck --check-prefix=RELOC %s 13 14# RUN: yaml2obj -DBITS=32 -DMACHINE=ARM %s -o %t.o 15# RUN: ld.lld -r %t.o -o %t 16# RUN: llvm-readobj -r %t | FileCheck --check-prefix=RELOC %s 17 18# RUN: yaml2obj -DBITS=32 -DMACHINE=PPC %s -o %t.o 19# RUN: ld.lld -r %t.o -o %t 20# RUN: llvm-readobj -r %t | FileCheck --check-prefix=RELOC %s 21 22# RUN: yaml2obj -DMACHINE=PPC64 %s -o %t.o 23# RUN: ld.lld -r %t.o -o %t 24# RUN: llvm-readobj -r %t | FileCheck --check-prefix=RELOC %s 25 26# RUN: yaml2obj -DMACHINE=RISCV %s -o %t.o 27# RUN: ld.lld -r %t.o -o %t 28# RUN: llvm-readobj -r %t | FileCheck --check-prefix=RELOC %s 29 30# RUN: yaml2obj -DBITS=32 -DMACHINE=386 %s -o %t.o 31# RUN: ld.lld -r %t.o -o %t 32# RUN: llvm-readobj -r %t | FileCheck --check-prefix=RELOC %s 33 34# RUN: yaml2obj -DMACHINE=X86_64 %s -o %t.o 35# RUN: ld.lld -r %t.o -o %t 36# RUN: llvm-readobj -r %t | FileCheck --check-prefix=RELOC %s 37 38## Both REL and RELA are supported. .rel.llvm.call-graph-profile uses REL even 39## if the prevailing format is RELA. 40# RELOC: Section ({{.*}}) .rela.text { 41# RELOC-NEXT: 0x0 R_{{.*}}_NONE .data 0x0 42# RELOC-NEXT: } 43# RELOC: Section ({{.*}}) .rel.nonalloc1 { 44# RELOC-NEXT: 0x0 R_{{.*}}_NONE .data 45# RELOC-NEXT: } 46# RELOC: Section ({{.*}}) .rela.nonalloc2 { 47# RELOC-NEXT: 0x0 R_{{.*}}_NONE .data 0x0 48# RELOC-NEXT: } 49 50--- !ELF 51FileHeader: 52 Class: ELFCLASS[[BITS=64]] 53 Data: ELFDATA2LSB 54 Type: ET_REL 55 Machine: EM_[[MACHINE]] 56Sections: 57 - Name: .text 58 Type: SHT_PROGBITS 59 Flags: [ SHF_ALLOC, SHF_EXECINSTR ] 60 - Name: .data 61 Type: SHT_PROGBITS 62 Flags: [ SHF_WRITE, SHF_ALLOC ] 63 - Name: .nonalloc1 64 Type: SHT_PROGBITS 65 - Name: .nonalloc2 66 Type: SHT_PROGBITS 67 - Name: .rela.text 68 Type: SHT_RELA 69 Info: .text 70 Relocations: 71 - Symbol: .data 72 Type: R_[[MACHINE]]_NONE 73 - Name: .rel.nonalloc1 74 Type: SHT_REL 75 Info: .nonalloc1 76 Relocations: 77 - Symbol: .data 78 Type: R_[[MACHINE]]_NONE 79 - Name: .rela.nonalloc2 80 Type: SHT_RELA 81 Info: .nonalloc2 82 Relocations: 83 - Symbol: .data 84 Type: R_[[MACHINE]]_NONE 85Symbols: 86 - Name: .data 87 Type: STT_SECTION 88 Section: .data 89 - Name: _start 90 Section: .text 91 Binding: STB_GLOBAL 92... 93