[llvm] 137078d - [llvm-objcopy] Fix strip-all-gnu test

Anton Sidorenko via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 3 02:09:12 PST 2023


Author: Anton Sidorenko
Date: 2023-02-03T13:08:17+03:00
New Revision: 137078de13584f467bf48b4fca41e34781211773

URL: https://github.com/llvm/llvm-project/commit/137078de13584f467bf48b4fca41e34781211773
DIFF: https://github.com/llvm/llvm-project/commit/137078de13584f467bf48b4fca41e34781211773.diff

LOG: [llvm-objcopy] Fix strip-all-gnu test

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.

Differential Revision: https://reviews.llvm.org/D143086

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/test/tools/llvm-objcopy/ELF/strip-all-gnu.test b/llvm/test/tools/llvm-objcopy/ELF/strip-all-gnu.test
index 74acdc40ac399..72499fdd40a08 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/strip-all-gnu.test
+++ b/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 @@ Sections:
   - 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 @@ ProgramHeaders:
 # CHECK: SectionHeaderCount: 8
 
 # CHECK:      Name: .dynstr
-# CHECK:      Name: .symtab.dyn
+# CHECK:      Name: .symtab
 # CHECK:      Name: .text
 # CHECK:      Name: .debug_loc
 # CHECK:      Name: .comment


        


More information about the llvm-commits mailing list