93 lines · plain
1# RUN: yaml2obj -DMACHINE=AARCH64 %s -o %t.o2# RUN: ld.lld --gc-sections %t.o -o %t3# RUN: llvm-readelf -S -r %t | FileCheck %s4 5## Test that we discard R_*_NONE, but respect the references it creates6## among sections.7 8# CHECK: .data9# CHECK: There are no relocations in this file.10 11# RUN: ld.lld -r %t.o -o %t12# RUN: llvm-readobj -r %t | FileCheck --check-prefix=RELOC %s13 14# RUN: yaml2obj -DBITS=32 -DMACHINE=ARM %s -o %t.o15# RUN: ld.lld -r %t.o -o %t16# RUN: llvm-readobj -r %t | FileCheck --check-prefix=RELOC %s17 18# RUN: yaml2obj -DBITS=32 -DMACHINE=PPC %s -o %t.o19# RUN: ld.lld -r %t.o -o %t20# RUN: llvm-readobj -r %t | FileCheck --check-prefix=RELOC %s21 22# RUN: yaml2obj -DMACHINE=PPC64 %s -o %t.o23# RUN: ld.lld -r %t.o -o %t24# RUN: llvm-readobj -r %t | FileCheck --check-prefix=RELOC %s25 26# RUN: yaml2obj -DMACHINE=RISCV %s -o %t.o27# RUN: ld.lld -r %t.o -o %t28# RUN: llvm-readobj -r %t | FileCheck --check-prefix=RELOC %s29 30# RUN: yaml2obj -DBITS=32 -DMACHINE=386 %s -o %t.o31# RUN: ld.lld -r %t.o -o %t32# RUN: llvm-readobj -r %t | FileCheck --check-prefix=RELOC %s33 34# RUN: yaml2obj -DMACHINE=X86_64 %s -o %t.o35# RUN: ld.lld -r %t.o -o %t36# RUN: llvm-readobj -r %t | FileCheck --check-prefix=RELOC %s37 38## Both REL and RELA are supported. .rel.llvm.call-graph-profile uses REL even39## if the prevailing format is RELA.40# RELOC: Section ({{.*}}) .rela.text {41# RELOC-NEXT: 0x0 R_{{.*}}_NONE .data 0x042# RELOC-NEXT: }43# RELOC: Section ({{.*}}) .rel.nonalloc1 {44# RELOC-NEXT: 0x0 R_{{.*}}_NONE .data45# RELOC-NEXT: }46# RELOC: Section ({{.*}}) .rela.nonalloc2 {47# RELOC-NEXT: 0x0 R_{{.*}}_NONE .data 0x048# RELOC-NEXT: }49 50--- !ELF51FileHeader:52 Class: ELFCLASS[[BITS=64]]53 Data: ELFDATA2LSB54 Type: ET_REL55 Machine: EM_[[MACHINE]]56Sections:57 - Name: .text58 Type: SHT_PROGBITS59 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]60 - Name: .data61 Type: SHT_PROGBITS62 Flags: [ SHF_WRITE, SHF_ALLOC ]63 - Name: .nonalloc164 Type: SHT_PROGBITS65 - Name: .nonalloc266 Type: SHT_PROGBITS67 - Name: .rela.text68 Type: SHT_RELA69 Info: .text70 Relocations:71 - Symbol: .data72 Type: R_[[MACHINE]]_NONE73 - Name: .rel.nonalloc174 Type: SHT_REL75 Info: .nonalloc176 Relocations:77 - Symbol: .data78 Type: R_[[MACHINE]]_NONE79 - Name: .rela.nonalloc280 Type: SHT_RELA81 Info: .nonalloc282 Relocations:83 - Symbol: .data84 Type: R_[[MACHINE]]_NONE85Symbols:86 - Name: .data87 Type: STT_SECTION88 Section: .data89 - Name: _start90 Section: .text91 Binding: STB_GLOBAL92...93