This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
MinGW objcopy and --add-section
- From: Eli Zaretskii <eliz at gnu dot org>
- To: binutils at sourceware dot org
- Date: Fri, 04 Oct 2013 12:03:53 +0300
- Subject: MinGW objcopy and --add-section
- Authentication-results: sourceware.org; auth=none
- Reply-to: Eli Zaretskii <eliz at gnu dot org>
[Please CC me on replies, as I'm not subscribed to the list. Thanks.]
The GDB manual says, after describing the "save gdb-index" command:
Once you have created an index file you can merge it into your symbol
file, here named `symfile', using `objcopy':
$ objcopy --add-section .gdb_index=symfile.gdb-index \
--set-section-flags .gdb_index=readonly symfile symfile
...
There are currently some limitation on indices. They only work when
for DWARF debugging information, not stabs. And, they do not currently
work for programs using Ada.
So: is this feature supposed to work with MinGW executables as SYMFILE
above? I tried, but the result of the objcopy command is an
executable that Windows refuses to run, saying that it's "not a valid
Win32 application".
The documentation of --add-section says "This option only works on
file formats which can support sections with arbitrary names", but it
doesn't state which formats support that, and I think pe-coff does.
The programs I tried this with were indeed compiled with DWARF2 debug
info.
TIA
P.S. As an aside, --add-section seems to always put the additional
section first, before .text. Is there a way to put it at the end
instead?