150 lines
4.6 KiB
Plaintext
150 lines
4.6 KiB
Plaintext
# RUN: yaml2obj %s -o %t
|
|
# RUN: cp %t %t3
|
|
# RUN: llvm-objcopy --strip-debug %t %t2
|
|
# RUN: llvm-readobj --file-headers --sections --symbols %t2 | FileCheck %s
|
|
|
|
# Verify that the previous run of llvm-objcopy has not modified the input.
|
|
# RUN: cmp %t %t3
|
|
|
|
# RUN: llvm-objcopy -g %t %t2g
|
|
# Verify that --strip-debug and -g produce the same output
|
|
# RUN: cmp %t2 %t2g
|
|
|
|
# RUN: llvm-strip --strip-debug %t3
|
|
# RUN: cmp %t2 %t3
|
|
|
|
# RUN: cp %t %t4
|
|
# RUN: llvm-strip -d %t4
|
|
# RUN: cmp %t2 %t4
|
|
|
|
# RUN: cp %t %t5
|
|
# RUN: llvm-strip -g %t5
|
|
# RUN: cmp %t2 %t5
|
|
|
|
# RUN: cp %t %t6
|
|
# RUN: llvm-strip -S %t6
|
|
# RUN: cmp %t2 %t6
|
|
|
|
# RUN: rm -f %t.a
|
|
# RUN: llvm-ar crs %t.a %t
|
|
# RUN: llvm-objcopy --strip-debug %t.a %t.a
|
|
# RUN: llvm-ar p %t.a > %t7
|
|
# RUN: cmp %t2 %t7
|
|
|
|
# Verify that an archive with multiple object files is handled correctly.
|
|
# RUN: cp %t %t.duplicate
|
|
# RUN: cp %t2 %t.duplicate.stripped
|
|
# RUN: rm -f %t.multiple-stripped-obj.a
|
|
# RUN: llvm-ar crs %t.multiple-stripped-obj.a %t2 %t.duplicate.stripped
|
|
# RUN: rm -f %t.multiple-obj.a
|
|
# RUN: llvm-ar crs %t.multiple-obj.a %t %t.duplicate
|
|
# RUN: llvm-objcopy --strip-debug %t.multiple-obj.a %t.multiple-obj.stripped.a
|
|
# RUN: llvm-ar p %t.multiple-stripped-obj.a > %t.multiple-stripped-obj.a.dump
|
|
# RUN: llvm-ar p %t.multiple-obj.stripped.a > %t.multiple-obj.stripped.a.dump
|
|
# RUN: cmp %t.multiple-stripped-obj.a.dump %t.multiple-obj.stripped.a.dump
|
|
|
|
# We can not use %t inside the patterns passed to FileCheck,
|
|
# thus we have to use "recognizable" file names.
|
|
# RUN: cp %t %t1.o
|
|
# RUN: cp %s %t2.txt
|
|
# RUN: cp %t %t3.o
|
|
# RUN: rm -f %t.non-object.a
|
|
# RUN: llvm-ar cr %t.non-object.a %t1.o %t2.txt %t3.o
|
|
# RUN: llvm-ar t %t.non-object.a | FileCheck %s --check-prefix=NON-OBJECT-ARCHIVE-MEMBERS
|
|
|
|
# NON-OBJECT-ARCHIVE-MEMBERS: 1.o
|
|
# NON-OBJECT-ARCHIVE-MEMBERS-NEXT: 2.txt
|
|
# NON-OBJECT-ARCHIVE-MEMBERS-NEXT: 3.o
|
|
|
|
# RUN: cp %t.non-object.a %t.non-object.copy.a
|
|
# RUN: not llvm-objcopy --strip-debug %t.non-object.a %t2.non-object.a 2>&1 | FileCheck %s --check-prefix=BAD-FORMAT
|
|
|
|
# BAD-FORMAT: The file was not recognized as a valid object file
|
|
|
|
# Verify that %t.non-object.a has not been modified.
|
|
# RUN: cmp %t.non-object.a %t.non-object.copy.a
|
|
|
|
# RUN: rm -f %t.thin.a
|
|
# Copy %t to %t.thin.archive.member to avoid changing %t directly.
|
|
# RUN: cp %t %t.thin.archive.member
|
|
# RUN: llvm-ar crsT %t.thin.a %t.thin.archive.member
|
|
# RUN: llvm-objcopy --strip-debug %t.thin.a %t2.thin.a
|
|
# RUN: cat %t.thin.a | FileCheck %s --check-prefix=VERIFY-THIN-ARCHIVE
|
|
# RUN: cat %t2.thin.a | FileCheck %s --check-prefix=VERIFY-THIN-ARCHIVE
|
|
|
|
# VERIFY-THIN-ARCHIVE: !<thin>
|
|
|
|
# Verify that the member of a thin archive was properly modified.
|
|
# RUN: cmp %t2 %t.thin.archive.member
|
|
|
|
# RUN: rm -f %t.non-object.thin.a
|
|
# RUN: llvm-ar crsT %t.non-object.thin.a %t1.o %t2.txt %t3.o
|
|
# RUN: cp %t.non-object.thin.a %t.non-object.thin.copy.a
|
|
# RUN: not llvm-objcopy --strip-debug %t.non-object.thin.a %t.non-object.thin.a 2>&1 | FileCheck %s --check-prefix=BAD-FORMAT
|
|
|
|
# Verify that in the case of error thin archive and its memebers are not getting modified.
|
|
# RUN: cmp %t.non-object.thin.a %t.non-object.thin.copy.a
|
|
# RUN: cmp %t %t1.o
|
|
# RUN: cmp %s %t2.txt
|
|
# RUN: cmp %t %t3.o
|
|
|
|
!ELF
|
|
FileHeader:
|
|
Class: ELFCLASS64
|
|
Data: ELFDATA2LSB
|
|
Type: ET_REL
|
|
Machine: EM_X86_64
|
|
Sections:
|
|
- Name: .debugfoo
|
|
Type: SHT_PROGBITS
|
|
Content: "00000000"
|
|
- Name: .zdebugfoo
|
|
Type: SHT_PROGBITS
|
|
Content: "00000000"
|
|
- Name: .gdb_index
|
|
Type: SHT_PROGBITS
|
|
Content: "00000000"
|
|
- Name: .text
|
|
Type: SHT_PROGBITS
|
|
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
|
|
AddressAlign: 0x0000000000000010
|
|
Content: "00000000"
|
|
Symbols:
|
|
- Name: foo
|
|
Section: .text
|
|
Binding: STB_GLOBAL
|
|
- Name: debugfoo
|
|
Section: .debugfoo
|
|
Binding: STB_GLOBAL
|
|
- Name: filesymbol
|
|
Type: STT_FILE
|
|
|
|
# CHECK: SectionHeaderCount: 5
|
|
|
|
# CHECK: Name: .text
|
|
# CHECK: Name: .symtab
|
|
# CHECK: Name: .strtab
|
|
# CHECK: Name: .shstrtab
|
|
|
|
# Check that *only* foo is copied and not debugfoo or filesymbol.
|
|
# CHECK: Symbols [
|
|
# CHECK-NEXT: Symbol {
|
|
# CHECK-NEXT: Name:
|
|
# CHECK-NEXT: Value:
|
|
# CHECK-NEXT: Size:
|
|
# CHECK-NEXT: Binding:
|
|
# CHECK-NEXT: Type:
|
|
# CHECK-NEXT: Other:
|
|
# CHECK-NEXT: Section: Undefined
|
|
# CHECK-NEXT: }
|
|
# CHECK-NEXT: Symbol {
|
|
# CHECK-NEXT: Name: foo
|
|
# CHECK-NEXT: Value:
|
|
# CHECK-NEXT: Size:
|
|
# CHECK-NEXT: Binding: Global
|
|
# CHECK-NEXT: Type:
|
|
# CHECK-NEXT: Other:
|
|
# CHECK-NEXT: Section: .text
|
|
# CHECK-NEXT: }
|
|
# CHECK-NEXT: ]
|