[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug binutils/23947] objcopy refuses to copy !(SEC_LOAD|SEC_ALLOC) secti
From: |
nickc at redhat dot com |
Subject: |
[Bug binutils/23947] objcopy refuses to copy !(SEC_LOAD|SEC_ALLOC) sections |
Date: |
Tue, 19 Feb 2019 16:30:37 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=23947
Nick Clifton <nickc at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |nickc at redhat dot com
--- Comment #1 from Nick Clifton <nickc at redhat dot com> ---
(In reply to Paul Pluzhnikov from comment #0)
Hi Paul,
> On Fedora, /usr/bin/ls has a mini-symbols .gnu_debugdata section:
> I wanted to examine the contents of this section, so I did the usual:
>
> objcopy -O binary -j.gnu_debuglink /usr/bin/ls /tmp/ls.mini.xz
Did you know that you can dump the contents of the .gnu.debuglink section
using readelf ? For example:
% readelf --debug-dump=links /usr/bin/ls
Contents of the .gnu_debuglink section:
Separate debug info file: ls-8.30-6.fc29.x86_64.debug
CRC value: 0x98ccdd5c
> but that produced an empty file.
> AFAICT, this is happening because of the following check in bfd/binary.c:
>
> 284 /* We don't want to output anything for a section that is neither
> 285 loaded nor allocated. The contents of such a section are not
> 286 meaningful in the binary format. */
> 287 if ((sec->flags & (SEC_LOAD | SEC_ALLOC)) == 0)
> 288 return TRUE;
> The statement that "contents is not meaningful in binary format" seems to be
> patently false (or rather, assumes that "binary" is going to be used for a
> specific purpose different from mine).
>
> This appears to have been broken since forever:
Yeah - it has been this way for a very long time. You can work around the
problem however, by adding a section flag. For example:
% objcopy -j.gnu_debuglink --set-section-flags .gnu_debuglink=A /usr/bin/ls
fred
% od fred
0000000 071554 034055 031456 026460 027066 061546 034462 074056
0000020 033070 033137 027064 062544 072542 000147 156534 114314
0000040
Cheers
Nick
--
You are receiving this mail because:
You are on the CC list for the bug.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Bug binutils/23947] objcopy refuses to copy !(SEC_LOAD|SEC_ALLOC) sections,
nickc at redhat dot com <=