107 lines · plain
1# RUN: yaml2obj %s -o %t2# Establish baseline objects for further checks. --discard-locals only discards3# compiler-generated local symbols (starting with .L), --discard-all discards4# all regular local symbols.5# RUN: llvm-objcopy %t %t-discard-none6# RUN: llvm-readobj --symbols %t-discard-none | FileCheck %s --check-prefixes=CHECK,LOCAL,COMPILER-LOCAL7# RUN: llvm-objcopy --discard-all %t %t-discard-all8# RUN: llvm-readobj --symbols %t-discard-all | FileCheck %s9# RUN: llvm-objcopy --discard-locals %t %t-discard-locals10# RUN: llvm-readobj --symbols %t-discard-locals | FileCheck %s --check-prefixes=CHECK,LOCAL11 12# When mixing --discard-all and --discard-locals, the last one wins.13# RUN: llvm-objcopy --discard-all --discard-locals %t %t.1.o14# RUN: cmp %t.1.o %t-discard-locals15# RUN: llvm-objcopy --discard-locals --discard-all %t %t.2.o16# RUN: cmp %t.2.o %t-discard-all17# RUN: llvm-objcopy -x -X %t %t.3.o18# RUN: cmp %t.3.o %t-discard-locals19# RUN: llvm-objcopy -X -x %t %t.4.o20# RUN: cmp %t.4.o %t-discard-all21# RUN: llvm-objcopy -x -X -x -X %t %t.5.o22# RUN: cmp %t.5.o %t-discard-locals23# RUN: llvm-objcopy -X -x -X -x %t %t.6.o24# RUN: cmp %t.6.o %t-discard-all25# RUN: llvm-objcopy -X -x -X -x --discard-locals %t %t.7.o26# RUN: cmp %t.7.o %t-discard-locals27# RUN: llvm-objcopy -X -x -X -x --discard-all %t %t.8.o28# RUN: cmp %t.8.o %t-discard-all29 30# llvm-strip works in the same way.31# RUN: llvm-strip --discard-all --discard-locals %t -o %t.9.o32# RUN: cmp %t.9.o %t-discard-locals33# RUN: llvm-strip --discard-locals --discard-all %t -o %t.10.o34# RUN: cmp %t.10.o %t-discard-all35# RUN: llvm-strip -x -X %t -o %t.11.o36# RUN: cmp %t.11.o %t-discard-locals37# RUN: llvm-strip -X -x %t -o %t.12.o38# RUN: cmp %t.12.o %t-discard-all39# RUN: llvm-strip -x -X -x -X %t -o %t.13.o40# RUN: cmp %t.13.o %t-discard-locals41# RUN: llvm-strip -X -x -X -x %t -o %t.14.o42# RUN: cmp %t.14.o %t-discard-all43# RUN: llvm-strip -X -x -X -x --discard-locals %t -o %t.15.o44# RUN: cmp %t.15.o %t-discard-locals45# RUN: llvm-strip -X -x -X -x --discard-all %t -o %t.16.o46# RUN: cmp %t.16.o %t-discard-all47 48!ELF49FileHeader:50 Class: ELFCLASS6451 Data: ELFDATA2LSB52 Type: ET_REL53 Machine: EM_X86_6454Sections:55 - Name: .text56 Type: SHT_PROGBITS57Symbols:58 - Name: Local59 Type: STT_FUNC60 Section: .text61 - Name: .L.str62 Type: STT_OBJECT63 Section: .text64 - Name: Global65 Type: STT_FUNC66 Section: .text67 Binding: STB_GLOBAL68 69# CHECK: Symbols [70# CHECK-NEXT: Symbol {71# CHECK-NEXT: Name:72# CHECK-NEXT: Value: 0x073# CHECK-NEXT: Size: 074# CHECK-NEXT: Binding: Local75# CHECK-NEXT: Type: None76# CHECK-NEXT: Other: 077# CHECK-NEXT: Section: Undefined78# CHECK-NEXT: }79# LOCAL-NEXT: Symbol {80# LOCAL-NEXT: Name: Local81# LOCAL-NEXT: Value:82# LOCAL-NEXT: Size:83# LOCAL-NEXT: Binding: Local84# LOCAL-NEXT: Type: Function85# LOCAL-NEXT: Other:86# LOCAL-NEXT: Section: .text87# LOCAL-NEXT: }88# COMPILER-LOCAL-NEXT: Symbol {89# COMPILER-LOCAL-NEXT: Name: .L.str90# COMPILER-LOCAL-NEXT: Value:91# COMPILER-LOCAL-NEXT: Size:92# COMPILER-LOCAL-NEXT: Binding: Local93# COMPILER-LOCAL-NEXT: Type: Object94# COMPILER-LOCAL-NEXT: Other:95# COMPILER-LOCAL-NEXT: Section: .text96# COMPILER-LOCAL-NEXT: }97# CHECK-NEXT: Symbol {98# CHECK-NEXT: Name: Global99# CHECK-NEXT: Value:100# CHECK-NEXT: Size:101# CHECK-NEXT: Binding: Global102# CHECK-NEXT: Type: Function103# CHECK-NEXT: Other:104# CHECK-NEXT: Section: .text105# CHECK-NEXT: }106# CHECK-NEXT: ]107