]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix PR binutils/26356 on hppa*-*-hpux*.
authorJohn David Anglin <danglin@gcc.gnu.org>
Thu, 27 Aug 2020 15:25:03 +0000 (15:25 +0000)
committerJohn David Anglin <danglin@gcc.gnu.org>
Thu, 27 Aug 2020 15:25:03 +0000 (15:25 +0000)
PR 26356
* som.c (som_bfd_copy_private_section_data): Issue error when a
subspace is specified without its containing space.
* testsuite/binutils-all/objcopy.exp (objcopy --reverse-bytes): Add
"-j $PRIVATE$" to command on hppa*-*-hpux*.
* testsuite/lib/utils-lib.exp (default_binutils_run): Remove existing
dollar-sign quotes before quoting.  Do this prior to generating log
output.

bfd/ChangeLog
bfd/som.c
binutils/ChangeLog
binutils/testsuite/binutils-all/objcopy.exp
binutils/testsuite/lib/utils-lib.exp

index 1d783f73830a0079e5d5ca574e3c96814a781e2a..7700973bf966fda5f9e4534a4163e1b7338a4f38 100644 (file)
@@ -1,3 +1,9 @@
+2020-08-27  John David Anglin  <danglin@gcc.gnu.org>
+
+       PR 26356
+       * som.c (som_bfd_copy_private_section_data): Issue error when a
+       subspace is specified without its containing space.
+
 2020-08-27  Alan Modra  <amodra@gmail.com>
 
        PR 26469
index 93a0ad89d52f7257ed2d78d5173ff1222ad89cf5..d3865f0ef6ecc4e9fabeb42314086954c1d9ca13 100644 (file)
--- a/bfd/som.c
+++ b/bfd/som.c
@@ -5455,8 +5455,18 @@ som_bfd_copy_private_section_data (bfd *ibfd,
 
   /* Reparent if necessary.  */
   if (som_section_data (osection)->copy_data->container)
-    som_section_data (osection)->copy_data->container =
-      som_section_data (osection)->copy_data->container->output_section;
+    {
+      if (som_section_data (osection)->copy_data->container->output_section)
+       som_section_data (osection)->copy_data->container =
+         som_section_data (osection)->copy_data->container->output_section;
+      else
+       {
+         /* User has specified a subspace without its containing space.  */
+         _bfd_error_handler (_("%pB[%pA]: no output section for space %pA"),
+           obfd, osection, som_section_data (osection)->copy_data->container);
+         return FALSE;
+       }
+    }
 
   return TRUE;
 }
index 6ad05addb69d403f288680b83a90a1132b376572..e5e33867200dcb6105827076067af35a52b2fdc6 100644 (file)
@@ -1,3 +1,12 @@
+2020-08-27  John David Anglin  <danglin@gcc.gnu.org>
+
+       PR 26356
+       * testsuite/binutils-all/objcopy.exp (objcopy --reverse-bytes): Add
+       "-j $PRIVATE$" to command on hppa*-*-hpux*.
+       * testsuite/lib/utils-lib.exp (default_binutils_run): Remove existing
+       dollar-sign quotes before quoting.  Do this prior to generating log
+       output.
+
 2020-08-27  Ralf Habacker  <ralf.habacker@freenet.de>
 
        PR 26088
index f857003e33e27df03b43781ea78e75947763e01b..9877f3d3107fd7b1f6c34a896f8b1d81744dd621 100644 (file)
@@ -170,7 +170,11 @@ if { [file exists $tempfile] } {
     set reversed ${tempfile}-reversed
     set sect_names [get_standard_section_names]
     if { $sect_names != "" } {
-       set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -j [lindex $sect_names 1] --reverse-bytes=4 $tempfile $reversed"]
+       if { [istarget hppa*-*-hpux*] } {
+           set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -j \$PRIVATE\$ -j [lindex $sect_names 1] --reverse-bytes=4 $tempfile $reversed"]
+       } else {
+           set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -j [lindex $sect_names 1] --reverse-bytes=4 $tempfile $reversed"]
+       }
     } else {
        set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -j .data --reverse-bytes=4 $tempfile $reversed"]
     }
@@ -191,10 +195,6 @@ if { [file exists $tempfile] } {
        set found_rev [regexp -lineanchor $want $revdata -> revdata]
 
        if {$found_orig == 0 || $found_rev == 0} then {
-           # som doesn't have a .data section
-           setup_xfail "hppa*-*-hpux*"
-           clear_xfail "hppa*64*-*-hpux*"
-
            fail "objcopy --reverse-bytes"
        } else {
            scan $origdata "%2x%2x%2x%2x" b1 b2 b3 b4
index 1bb5e616e4b5682bf3b6335591c5678a9e7bb905..56ac0cda320da3822790539cdf1ea5d7c7c387d2 100644 (file)
@@ -80,13 +80,16 @@ proc default_binutils_run { prog progargs } {
         regsub -- "-j \\.bss"  $progargs "-j [lindex $sect_names 2]" progargs
     }
 
+    # Gotta quote dollar-signs because they get mangled by the
+    # shell otherwise.  Since get_standard_section_names returns
+    # quoted section names, we first remove the original quote
+    # and then requote.
+    regsub -all {\\\$} "$progargs" {$} progargs
+    regsub -all {\$} "$progargs" {\$} progargs
+
     send_log "$prog $progargs\n"
     verbose "$prog $progargs"
 
-    # Gotta quote dollar-signs because they get mangled by the
-    # shell otherwise.
-    regsub -all "\\$" "$progargs" "\\$" progargs
-
     set state [remote_exec host $prog $progargs]
     set binutils_run_status [lindex $state 0]
     set exec_output [prune_warnings [lindex $state 1]]