1*55c81d42SFangrui Song# RUN: yaml2obj %s -o %t 2279898b3SGeorge Rimar 3279898b3SGeorge Rimar## Check we are able to strip all symbols and relocatable information at the same time. 4279898b3SGeorge Rimar 5279898b3SGeorge Rimar# RUN: llvm-objcopy -S %t %t2 6279898b3SGeorge Rimar# RUN: llvm-objdump --section-headers %t2 | FileCheck %s 7279898b3SGeorge Rimar 8279898b3SGeorge Rimar# RUN: llvm-objcopy --strip-all-gnu %t %t2 9279898b3SGeorge Rimar# RUN: llvm-objdump --section-headers %t2 | FileCheck %s 10279898b3SGeorge Rimar 11279898b3SGeorge Rimar# CHECK-NOT: .symtab 12279898b3SGeorge Rimar# CHECK-NOT: .rela.text 13279898b3SGeorge Rimar 14279898b3SGeorge Rimar## Check we are able to strip the particular symbol if we 15279898b3SGeorge Rimar## strip the corresponding relocation section at the same time. 16279898b3SGeorge Rimar 17279898b3SGeorge Rimar# RUN: llvm-objcopy --strip-symbol=bar -R .rela.text %t %t2 18279898b3SGeorge Rimar# RUN: llvm-readelf -s -S %t2 | FileCheck %s --check-prefix=STRIPSYM 19279898b3SGeorge Rimar 20279898b3SGeorge Rimar# STRIPSYM-NOT: bar 21279898b3SGeorge Rimar# STRIPSYM-NOT: .rela.text 22279898b3SGeorge Rimar 23ada9d2d8SSeiya Nuta# RUN: not llvm-objcopy --strip-symbol=bar %t %t2 2>&1 | FileCheck %s --check-prefix=ERR -DINPUT=%t 24ada9d2d8SSeiya Nuta# ERR: error: '[[INPUT]]': not stripping symbol 'bar' because it is named in a relocation 25279898b3SGeorge Rimar 26279898b3SGeorge Rimar--- !ELF 27279898b3SGeorge RimarFileHeader: 28279898b3SGeorge Rimar Class: ELFCLASS64 29279898b3SGeorge Rimar Data: ELFDATA2LSB 30279898b3SGeorge Rimar Type: ET_REL 31279898b3SGeorge Rimar Machine: EM_X86_64 32279898b3SGeorge RimarSections: 33279898b3SGeorge Rimar - Name: .text 34279898b3SGeorge Rimar Type: SHT_PROGBITS 35279898b3SGeorge Rimar Flags: [ SHF_ALLOC, SHF_EXECINSTR ] 36279898b3SGeorge Rimar Content: 00000000 37279898b3SGeorge Rimar - Name: .rela.text 38279898b3SGeorge Rimar Type: SHT_RELA 39279898b3SGeorge Rimar Link: .symtab 40279898b3SGeorge Rimar Info: .text 41279898b3SGeorge Rimar Relocations: 42279898b3SGeorge Rimar - Offset: 0x0000000000000000 43279898b3SGeorge Rimar Symbol: bar 44279898b3SGeorge Rimar Type: R_X86_64_32S 45279898b3SGeorge RimarSymbols: 46279898b3SGeorge Rimar - Name: bar 47279898b3SGeorge Rimar Section: .text 486da44ad7SGeorge Rimar Binding: STB_GLOBAL 49