Fix "--only-keep-debug for ELF relocatables" binutils test for compilers which add...
authorNick Clifton <nickc@redhat.com>
Tue, 1 Aug 2023 13:37:04 +0000 (14:37 +0100)
committerNick Clifton <nickc@redhat.com>
Tue, 1 Aug 2023 13:40:08 +0000 (14:40 +0100)
  PR 30699
  * binutils/testsuite/binutils-all/objcopy.exp (keep_debug_symbols_for_elf_relocatable): Do not add sections containing the string "debug_" to the list of non-debug sections.

binutils/testsuite/binutils-all/objcopy.exp

index 1145835d8b75ee78301a8ad2572ca455e7fe352a..41070c3e0dec7065fa7752d22178912072bbeed0 100644 (file)
@@ -1028,7 +1028,11 @@ proc keep_debug_symbols_for_elf_relocatable { prog flags test } {
            {[^a-zA-Z]+([a-zA-Z0-9_\.]+)[ \t]+([A-Z]+)[ \t]+[0-9a-f]+ [0-9a-f]+ [0-9a-f]+ [0-9]+[ \t]+([A-Z]*)[ \t]+[0-9]+(.*)} \
            $got all name type flag rest] } {
        if { $type != "NOTE" && [regexp {[AG]} $flag] } {
-           lappend non_debug_sections $name
+           # PR 30699: Some debug sections can be in a group, so
+           # exclude sections whose name includes "debug_"
+           if { ! [regexp {debug_} $name] } {
+               lappend non_debug_sections $name
+           }
        }
        set got $rest
     }
@@ -1086,6 +1090,7 @@ switch [copy_setup] {
        untested $test5
        if [is_elf_format] {
            untested $test6
+           untested $test7
        }
     }
     "3" {