[PATCH] D143086: [llvm-objcopy] Fix strip-all-gnu test

Anton Sidorenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 1 08:55:38 PST 2023


asi-sc created this revision.
Herald added subscribers: abrachet, emaste.
Herald added a reviewer: alexander-shaposhnikov.
Herald added a reviewer: jhenderson.
Herald added a project: All.
asi-sc requested review of this revision.
Herald added subscribers: llvm-commits, MaskRay.
Herald added a project: LLVM.

Originally the test has a bug: in the input YAML `.symtab.dyn` section has a type
repeated twice with different values (SHT_SYMTAB and SHT_NOBITS). YAML parser
took SHT_NOBITS as a type of the section, so the test wasn't checking the desired
case.

This patch changes the test to verify that a section with SHT_SYMTAB type and
SHF_ALLOC flag is not removed when --strip-all-gnu flag present.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D143086

Files:
  llvm/test/tools/llvm-objcopy/ELF/strip-all-gnu.test


Index: llvm/test/tools/llvm-objcopy/ELF/strip-all-gnu.test
===================================================================
--- llvm/test/tools/llvm-objcopy/ELF/strip-all-gnu.test
+++ llvm/test/tools/llvm-objcopy/ELF/strip-all-gnu.test
@@ -1,6 +1,6 @@
 # RUN: yaml2obj %s -o %t
-# RUN: llvm-objcopy --strip-all-gnu %t %t2
-# RUN: llvm-strip --strip-all-gnu %t -o %t3
+# RUN: llvm-objcopy --strip-all-gnu --allow-broken-links %t %t2
+# RUN: llvm-strip --strip-all-gnu --allow-broken-links %t -o %t3
 # RUN: llvm-readobj --file-headers --sections %t2 | FileCheck %s
 # RUN: cmp %t2 %t3
 
@@ -24,10 +24,9 @@
   - Name:            .dynstr
     Type:            SHT_STRTAB
     Flags:           [ SHF_ALLOC ]
-  - Name:            .symtab.dyn
+  - Name:            .symtab
     Type:            SHT_SYMTAB
     Flags:           [ SHF_ALLOC ]
-    Type:            SHT_NOBITS
   - Name:            .text
     Type:            SHT_PROGBITS
     Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
@@ -63,7 +62,7 @@
 # CHECK: SectionHeaderCount: 8
 
 # CHECK:      Name: .dynstr
-# CHECK:      Name: .symtab.dyn
+# CHECK:      Name: .symtab
 # CHECK:      Name: .text
 # CHECK:      Name: .debug_loc
 # CHECK:      Name: .comment


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D143086.493977.patch
Type: text/x-patch
Size: 1219 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230201/eafbd022/attachment.bin>


More information about the llvm-commits mailing list