This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] - objcopy --extract-symbol clears e_flags ELF header field
- From: Alan Modra <amodra at gmail dot com>
- To: Ronald Hoogenboom <hoogenboom30 at zonnet dot nl>
- Cc: binutils at sourceware dot org
- Date: Wed, 14 Oct 2015 10:51:20 +1030
- Subject: Re: [PATCH] - objcopy --extract-symbol clears e_flags ELF header field
- Authentication-results: sourceware.org; auth=none
- References: <561D44BC dot 9080307 at atom dot grundel>
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