brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.5 KiB · 1039574 Raw
95 lines · plain
1## Show that llvm-objcopy/llvm-strip removes all symbols and debug sections.2 3# RUN: yaml2obj %p/Inputs/strip-all.yaml -o %t.exec4# RUN: yaml2obj %p/Inputs/strip-all-with-dwarf.yaml -o %t.dwarf5# RUN: yaml2obj %p/Inputs/strip-chained-fixups.yaml -o %t.fixups6# RUN: yaml2obj %p/Inputs/strip-all-with-codesignature.yaml -o %t.codesignature7 8## Check that the symbol list satisfies the order: local / defined external /9## undefined external, otherwise llvm-objcopy will fail.10# RUN: llvm-objcopy %t.exec /dev/null11 12# RUN: llvm-objcopy --strip-all %t.exec %t.exec.stripped13# RUN: llvm-readobj --sections --relocations --symbols %t.exec.stripped \14# RUN:   | FileCheck --check-prefix=COMMON %s15 16# RUN: llvm-objcopy --strip-all %t.dwarf %t.dwarf.stripped17# RUN: llvm-readobj --sections --relocations --symbols %t.dwarf.stripped \18# RUN:   | FileCheck --check-prefixes=COMMON,DWARF %s19 20# RUN: llvm-objcopy --strip-all %t.fixups %t.fixups.stripped21# RUN: llvm-readobj --sections --relocations --symbols %t.fixups.stripped \22# RUN:   | FileCheck --check-prefix=COMMON %s23 24## The output of "llvm-strip" should be identical with that of25## "llvm-strip --strip-all" and "llvm-objcopy --strip-all".26# RUN: llvm-strip %t.exec -o %t227# RUN: llvm-strip --strip-all %t.exec -o %t328# RUN: cmp %t2 %t.exec.stripped29# RUN: cmp %t3 %t.exec.stripped30 31# RUN: llvm-strip %t.dwarf -o %t432# RUN: llvm-strip --strip-all %t.dwarf -o %t533# RUN: cmp %t4 %t.dwarf.stripped34# RUN: cmp %t5 %t.dwarf.stripped35 36# RUN: llvm-lipo %t.dwarf -create -output %t.dwarf.universal37# RUN: llvm-strip %t.dwarf.universal -o %t.dwarf.universal.stripped38# RUN: llvm-lipo %t.dwarf.universal.stripped -thin x86_64 -output %t639# RUN: cmp %t6 %t.dwarf.stripped40 41# RUN: llvm-strip %t.fixups -o %t742# RUN: llvm-strip --strip-all %t.fixups -o %t843# RUN: cmp %t7 %t.fixups.stripped44# RUN: cmp %t8 %t.fixups.stripped45 46# RUN: llvm-objcopy --strip-all %t.codesignature %t947# RUN: llvm-otool -l %t9 | FileCheck --check-prefix=CODESIGNATURE %s48# RUN: llvm-strip %t.codesignature -o %t1049# RUN: llvm-otool -l %t10 | FileCheck --check-prefix=CODESIGNATURE %s50# RUN: llvm-strip --strip-all %t.codesignature -o %t1151# RUN: llvm-otool -l %t11 | FileCheck --check-prefix=CODESIGNATURE %s52 53## Make sure that code signatures are preserved54 55# CODESIGNATURE:      cmd LC_DYLIB_CODE_SIGN_DRS56# CODESIGNATURE-NEXT: cmdsize 1657# CODESIGNATURE-NEXT: dataoff 840858# CODESIGNATURE-NEXT: datasize 6459# CODESIGNATURE-NEXT: Load command60# CODESIGNATURE-NEXT: cmd LC_CODE_SIGNATURE61# CODESIGNATURE-NEXT: cmdsize 1662# CODESIGNATURE-NEXT: dataoff 848063# CODESIGNATURE-NEXT: datasize 24064 65## Make sure that debug sections are removed.66# DWARF:       Sections [67# DWARF-NOT:     Name: __debug_str68# DWARF-NOT:     Name: __debug_abbrev69# DWARF-NOT:     Name: __debug_info70# DWARF-NOT:     Name: __debug_macinfo71# DWARF-NOT:     Name: __apple_names72# DWARF-NOT:     Name: __apple_objc73# DWARF-NOT:     Name: __apple_namespac74# DWARF-NOT:     Name: __apple_types75# DWARF-NOT:     Name: __debug_line76# DWARF:       ]77 78## Make sure that all relocations and symbols79## (except those which have the flag ReferencedDynamically set) are removed.80# COMMON:      Relocations [81# COMMON-NEXT: ]82# COMMON-NEXT: Symbols [83# COMMON-NEXT:    Symbol {84# COMMON-NEXT:      Name: __mh_execute_header85# COMMON-NEXT:      Extern86# COMMON-NEXT:      Type: Section87# COMMON-NEXT:      Section: __text88# COMMON-NEXT:      RefType: UndefinedNonLazy89# COMMON-NEXT:      Flags [ (0x10)90# COMMON-NEXT:        ReferencedDynamically (0x10)91# COMMON-NEXT:      ]92# COMMON-NEXT:      Value:93# COMMON-NEXT:    }94# COMMON-NEXT: ]95