From: "H. J. Lu" <hjl@lucon.org>
To: Andrew STUBBS <andrew.stubbs@st.com>
Cc: binutils@sources.redhat.com
Subject: Re: Problem setting the CONTENTS flag
Date: Sun, 23 Apr 2006 22:13:00 -0000 [thread overview]
Message-ID: <20060421232208.GA16651@lucon.org> (raw)
In-Reply-To: <20060421143558.GA13559@lucon.org>
On Fri, Apr 21, 2006 at 07:35:58AM -0700, H. J. Lu wrote:
> On Fri, Apr 21, 2006 at 01:58:08PM +0100, Andrew STUBBS wrote:
> > Hi all,
> >
> > I have encountered an error setting the CONTENTS and LOAD flags with
> > relatively recent versions of objcopy/bfd.
> >
>
> Could you please open a bug report with a simple testcase? This patch
> should work.
>
> Thanks.
>
>
Here is an updated patch.
H.J.
----
2006-04-21 H.J. Lu <hongjiu.lu@intel.com>
PR binutils/2593
* elf.c (_bfd_elf_new_section_hook): Don't set section ELF type
and flags if its BFD flags has been set.
(_bfd_elf_init_private_section_data): Don't copy the output ELF
section type from input if it has been set to something
different.
--- bfd/elf.c.copy 2006-04-21 07:00:02.000000000 -0700
+++ bfd/elf.c 2006-04-21 16:15:41.000000000 -0700
@@ -2487,10 +2487,11 @@ _bfd_elf_new_section_hook (bfd *abfd, as
bed = get_elf_backend_data (abfd);
sec->use_rela_p = bed->default_use_rela_p;
- /* When we read a file, we don't need section type and flags unless
- it is a linker created section. They will be overridden in
- _bfd_elf_make_section_from_shdr anyway. */
- if (abfd->direction != read_direction
+ /* When we read a file or section BFD flags have been set, we don't
+ need section type and flags unless it is a linker created section.
+ They will be overridden in _bfd_elf_make_section_from_shdr
+ anyway. */
+ if ((!sec->flags && abfd->direction != read_direction)
|| (sec->flags & SEC_LINKER_CREATED) != 0)
{
ssect = (*bed->get_sec_type_attr) (abfd, sec);
@@ -5906,9 +5907,9 @@ _bfd_elf_init_private_section_data (bfd
|| obfd->xvec->flavour != bfd_target_elf_flavour)
return TRUE;
- /* FIXME: What if the output ELF section type has been set to
- something different? */
- if (elf_section_type (osec) == SHT_NULL)
+ /* Don't copy the output ELF section type from input if it has been
+ set to something different. */
+ if (osec->flags == isec->flags || !osec->flags)
elf_section_type (osec) = elf_section_type (isec);
/* Set things up for objcopy and relocatable link. The output
next prev parent reply other threads:[~2006-04-21 23:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-21 18:08 Andrew STUBBS
2006-04-21 22:26 ` H. J. Lu
2006-04-21 23:32 ` Andreas Schwab
2006-04-23 22:13 ` H. J. Lu [this message]
2006-04-24 19:55 ` Andrew STUBBS
2006-04-25 16:37 ` Nick Clifton
2006-04-26 0:21 ` PATCH: binutils/2593: " H. J. Lu
2006-04-26 12:16 ` Nick Clifton
2006-04-26 0:39 ` H. J. Lu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060421232208.GA16651@lucon.org \
--to=hjl@lucon.org \
--cc=andrew.stubbs@st.com \
--cc=binutils@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).