[PATCH] D41124: [llvm-objcopy] Add symlink for llvm-strip

Jake Ehrlich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 12 11:02:32 PST 2017


jakehehrlich created this revision.
jakehehrlich added a reviewer: phosek.
Herald added a subscriber: mgorny.

Many build systems need a drop in replacement for strip as well as objcopy. This change adds a symlink to llvm-strip for llvm-objcopy. The plan is for llvm-objcopy to detect when it was invoked as llvm-strip/strip and to change it's behavoir correspondingly.  See https://reviews.llvm.org/D41100 for details on the whole plan.


Repository:
  rL LLVM

https://reviews.llvm.org/D41124

Files:
  test/tools/llvm-objcopy/basic-strip.test
  tools/llvm-objcopy/CMakeLists.txt


Index: tools/llvm-objcopy/CMakeLists.txt
===================================================================
--- tools/llvm-objcopy/CMakeLists.txt
+++ tools/llvm-objcopy/CMakeLists.txt
@@ -8,6 +8,9 @@
   Object.cpp
   )
 
+add_llvm_tool_symlink(llvm-strip llvm-objcopy)
+
 if(LLVM_INSTALL_BINUTILS_SYMLINKS)
   add_llvm_tool_symlink(objcopy llvm-objcopy)
+  add_llvm_tool_symlink(strip llvm-objcopy)
 endif()
Index: test/tools/llvm-objcopy/basic-strip.test
===================================================================
--- /dev/null
+++ test/tools/llvm-objcopy/basic-strip.test
@@ -0,0 +1,32 @@
+# RUN: yaml2obj %s > %t
+# RUN: llvm-strip %t %t2
+# RUN: llvm-readobj -file-headers -sections %t2 | FileCheck %s
+
+!ELF
+FileHeader:
+  Class:           ELFCLASS64
+  Data:            ELFDATA2LSB
+  Type:            ET_REL
+  Machine:         EM_X86_64
+Sections:
+  - Name:            .bss
+    Type:            SHT_NOBITS
+    Flags:           [ SHF_ALLOC ]
+  - Name:            .text
+    Type:            SHT_PROGBITS
+    Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
+  - Name:            .blarg
+    Type:            SHT_PROGBITS
+    Flags:           [ ]
+  - Name:            .gnu.warning.foo
+    Type:            SHT_PROGBITS
+
+# CHECK: SectionHeaderCount: 8
+
+# CHECK: Name: .bss
+# CHECK: Name: .text
+# CHECK: Name: .blarg
+# CHECK: Name: .gnu.warning.foo
+# CHECK: Name: .symtab
+# CHECK: Name: .strtab
+# CHECK: Name: .shstrtab


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41124.126586.patch
Type: text/x-patch
Size: 1451 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171212/55ff8e57/attachment.bin>


More information about the llvm-commits mailing list