82 lines · plain
1# RUN: yaml2obj %s -o %t2## No-op copy.3# RUN: llvm-objcopy %t %t24# RUN: llvm-readobj --sections %t2 | FileCheck %s5## No-op strip.6# RUN: cp %t %t37# RUN: llvm-strip --no-strip-all %t38# RUN: llvm-readobj --sections %t3 | FileCheck %s9## Add symbol.10# RUN: llvm-objcopy --add-symbol=another=.text:0,function %t %t411# RUN: llvm-readobj --sections %t4 | FileCheck %s12 13## A section with sh_link referencing SHT_SYMTAB indicates that its content may14## use the old symbol indices. If the symbol indices change, reset sh_link to 015## to inform tools like linkers that the sh_link has been invalidated.16 17## Strip first symbol.18# RUN: llvm-objcopy --strip-symbol bar %t %t519# RUN: llvm-readobj --sections %t5 | FileCheck %s --check-prefix=LINK-020## Strip last symbol.21# RUN: llvm-objcopy --strip-symbol baz %t %t622# RUN: llvm-readobj --sections %t6 | FileCheck %s --check-prefix=LINK-023## Re-order symbols.24# RUN: llvm-objcopy --localize-symbol baz %t %t725# RUN: llvm-readobj --sections %t7 | FileCheck %s --check-prefix=LINK-026## Remove .text section.27# RUN: llvm-objcopy --remove-section=.text %t %t828# RUN: llvm-readobj --sections %t8 | FileCheck %s --check-prefix=LINK-029 30!ELF31FileHeader:32 Class: ELFCLASS6433 Data: ELFDATA2LSB34 Type: ET_REL35 Machine: EM_X86_6436Sections:37 - Name: .text38 Type: SHT_PROGBITS39 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]40 Address: 0x100041 AddressAlign: 0x000000000000001042 Size: 3243 - Name: .foo44 Link: .symtab45 Type: SHT_PROGBITS46 Flags: [ ]47Symbols:48 - Name: bar49 Type: STT_FUNC50 Size: 851 Section: .text52 Value: 0x100053 Binding: STB_GLOBAL54 - Name: baz55 Type: STT_FUNC56 Size: 857 Section: .text58 Value: 0x101059 Binding: STB_GLOBAL60 61# CHECK: Name: .foo62# CHECK-NEXT: Type:63# CHECK-NEXT: Flags [ (0x0)64# CHECK-NEXT: ]65# CHECK-NEXT: Address:66# CHECK-NEXT: Offset:67# CHECK-NEXT: Size:68# CHECK-NEXT: Link: [[#SYMTABIDX:]]69 70# CHECK: Index: [[#SYMTABIDX]]71# CHECK-NEXT: Name: .symtab72# CHECK-NEXT: Type: SHT_SYMTAB73 74# LINK-0: Name: .foo75# LINK-0-NEXT: Type:76# LINK-0-NEXT: Flags [ (0x0)77# LINK-0-NEXT: ]78# LINK-0-NEXT: Address:79# LINK-0-NEXT: Offset:80# LINK-0-NEXT: Size:81# LINK-0-NEXT: Link: 082