[PATCH] - objcopy --extract-symbol clears e_flags ELF header field
Alan Modra
amodra@gmail.com
Wed Oct 14 00:21:00 GMT 2015
On Tue, Oct 13, 2015 at 07:51:56PM +0200, Ronald Hoogenboom wrote:
> @@ -2624,11 +2623,13 @@
> finalization work for private section headers. Do that here. */
>
> static void
> -setup_bfd_headers (bfd *ibfd, bfd *obfd)
> +setup_bfd_headers (bfd *ibfd, bfd *obfd, int data)
> {
> /* Allow the BFD backend to copy any private data it understands
> from the input section to the output section. */
> - if (! bfd_copy_private_header_data (ibfd, obfd))
> +
> + if (! (data?bfd_copy_private_header_data (ibfd, obfd):
> + bfd_copy_private_bfd_data(ibfd, obfd)))
> {
> status = 1;
> bfd_nonfatal_message (NULL, ibfd, NULL,
I'll guess that you haven't tested this on targets other than ARM ELF,
and when/if you do you'll find that it regresses other targets. For
binutils changes like this I test on a large number of targets to get
some coverage for the various machine and object format combinations.
One complication in this case is that the existing --extract-symbol
test is in ld/testsuite/ld-elf/ meaning that it only runs for ELF
targets, which is stupid. So you'd need to write a test to live in
binutils/testsuite/binutils-all/ or run tests by hand.
I suspect the correct patch is to delete these lines in objcopy.c
copy_object
/* Do not copy backend data if --extract-symbol is passed; anything
that needs to look at the section contents will fail. */
if (extract_symbol)
return TRUE;
and deal with the fallout in all the target bfd_copy_private_bfd_data
functions.
--
Alan Modra
Australia Development Lab, IBM
More information about the Binutils
mailing list