bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug binutils/26356] New: FAIL: objcopy --reverse-bytes


From: danglin at gcc dot gnu.org
Subject: [Bug binutils/26356] New: FAIL: objcopy --reverse-bytes
Date: Sat, 08 Aug 2020 15:23:28 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=26356

            Bug ID: 26356
           Summary: FAIL: objcopy --reverse-bytes
           Product: binutils
           Version: 2.35
            Status: NEW
          Severity: normal
          Priority: P2
         Component: binutils
          Assignee: unassigned at sourceware dot org
          Reporter: danglin at gcc dot gnu.org
  Target Milestone: ---
              Host: hppa2.0w-hp-hpux11.11
            Target: hppa2.0w-hp-hpux11.11
             Build: hppa2.0w-hp-hpux11.11

/mnt/gnu/binutils/objdir/binutils/objcopy  -j \$DATA\$ --reverse-bytes=4
tmpdir/
bintest.o tmpdir/bintest.o-reversed
Executing on host: /mnt/gnu/binutils/objdir/binutils/objcopy  -j \\$DATA\\$
--re
verse-bytes=4 tmpdir/bintest.o tmpdir/bintest.o-reversed   (timeout = 300)
spawn failed

Program causes segmentation fault.

-bash-4.4$ ./objcopy -j \$DATA\$ --reverse-bytes objcopy.o xxx.o
./objcopy: number of bytes to reverse must be positive and even
-bash-4.4$ ./objcopy -j \$DATA\$ --reverse-bytes=4 objcopy.o xxx.o
Segmentation fault (core dumped)
-bash-4.4$ gdb -c core objcopy
GNU gdb (GDB) 7.9.1
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "hppa2.0w-hp-hpux11.11".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from objcopy...done.
[New process 6052895]

warning: Private mapping of shared library text was not specified
by the executable; setting a breakpoint in a shared library which
is not privately mapped will not work.  See the HP-UX 11i v3 chatr
manpage for methods to privately map shared library text.
Unable to write __dld_flags.
(gdb) bt
#0  som_prep_headers (abfd=0x40014108) at ../../src/bfd/som.c:2678
#1  0x00047fd8 in som_set_section_contents (abfd=0x40014108, section=0x0,
    location=0x40027150, offset=0, count=2320) at ../../src/bfd/som.c:5711
#2  0x00036c58 in bfd_set_section_contents (abfd=0x40014108,
    section=0x40023fd0, location=0x40027150, offset=0, count=2320)
    at ../../src/bfd/section.c:1520
#3  0x00010ca4 in copy_section (ibfd=0xffffffff, isection=0x40020e08,
    obfdarg=0x40014108) at ../../src/binutils/objcopy.c:4430
#4  0x00036a4c in bfd_map_over_sections (abfd=0x40013048,
    operation=@0x400093ca: 0x109c8 <copy_section>, user_storage=0x40014108)
    at ../../src/bfd/section.c:1379
#5  0x00012a24 in copy_object (ibfd=0x40013048, obfd=0x40014108,
    input_arch=0x4002ff00) at ../../src/binutils/objcopy.c:3266
#6  0x000141fc in copy_file (input_filename=0x7eff0026 "objcopy.o",
    output_filename=0x7eff0030 "xxx.o", input_target=0x40014108 "@\002/\240@",
    output_target=0x89384 <__PRETTY_FUNCTION__.10416+24> "som", input_arch=0x0)
    at ../../src/binutils/objcopy.c:3831
#7  0x00016d5c in main (argc=1818324583, argv=0x6f70742f)
    at ../../src/binutils/objcopy.c:5892
(gdb) disass $pc-16,$pc+16
Dump of assembler code from 0x464bc to 0x464dc:
   0x000464bc <som_prep_headers+148>:   cmpib,=,n 0,ret0,0x465a4
<som_prep_headers+380>
   0x000464c0 <som_prep_headers+152>:   ldw 4(ret0),ret0
   0x000464c4 <som_prep_headers+156>:   cmpb,= r3,ret0,0x465bc
<som_prep_headers+404>
   0x000464c8 <som_prep_headers+160>:   ldo 40(ret0),ret0
=> 0x000464cc <som_prep_headers+164>:   ldw 0(ret0),ret0
   0x000464d0 <som_prep_headers+168>:   cmpb,= r3,ret0,0x465bc
<som_prep_headers+404>
   0x000464d4 <som_prep_headers+172>:   copy r8,r25
   0x000464d8 <som_prep_headers+176>:   b,l 0x353d8 <bfd_zalloc>,rp
End of assembler dump.
(gdb) p/x $ret0
$1 = 0x40

static bfd_boolean
som_is_space (asection *section)
{
  /* If no copy data is available, then it's neither a space nor a
     subspace.  */
  if (som_section_data (section)->copy_data == NULL)
    return FALSE;

  /* If the containing space isn't the same as the given section,
     then this isn't a space.  */
  if (som_section_data (section)->copy_data->container != section
      && (som_section_data (section)->copy_data->container->output_section
          != section))
    return FALSE;

  /* OK.  Must be a space.  */
  return TRUE;
}

Looks like som_section_data (section)->copy_data->container is NULL.

This bug has been around for some time.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]