This is the mail archive of the
mailing list for the binutils project.
Re: RFC: Assign regions to orphan sections
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Daniel Jacobowitz <dan at codesourcery dot com>
- Cc: Ian Lance Taylor <iant at google dot com>, binutils at sourceware dot org, Carlos O'Donell <carlos at codesourcery dot com>
- Date: Wed, 28 Apr 2010 15:29:59 +0000 (UTC)
- Subject: Re: RFC: Assign regions to orphan sections
- References: <20100315221743.GQ9310@caradoc.them.org> <Pine.LNX.firstname.lastname@example.org> <20100325221611.GS9310@caradoc.them.org> <Pine.LNX.email@example.com> <20100325223415.GU9310@caradoc.them.org> <firstname.lastname@example.org> <20100326134137.GA9310@caradoc.them.org>
On Fri, 26 Mar 2010, Daniel Jacobowitz wrote:
> On Thu, Mar 25, 2010 at 05:55:16PM -0700, Ian Lance Taylor wrote:
> > Daniel Jacobowitz <email@example.com> writes:
> > > I don't think the file header should be loaded in your case, either.
> > > Anyone know what determines this? It's not triggered by use of
> > > SIZEOF_HEADERS, I don't think.
> > It's done by default if it can be done. Look at phdr_in_segment in
> > _bfd_elf_map_sections_to_segments in bfd/elf.c.
> This bit:
> /* Deal with -Ttext or something similar such that the first section
> is not adjacent to the program headers. This is an
> approximation, since at this point we don't know exactly how many
> program headers we will need. */
> if (count > 0)
> bfd_size_type phdr_size = elf_tdata (abfd)->program_header_size;
> if (phdr_size == (bfd_size_type) -1)
> phdr_size = get_program_header_size (abfd, info);
> if ((abfd->flags & D_PAGED) == 0
> || sections->lma < phdr_size
> || sections->lma % maxpagesize < phdr_size % maxpagesize)
> phdr_in_segment = FALSE;
> It seems to me that if the maximum page size is one byte, then D_PAGED
> should be false. There aren't any pages. But that's really only the
> case for *-elf. Joseph, would tic6x-uclinux also have MAXPAGESIZE==1?
> Anyway, a safe way to fix the test would be to add -z
> max-page-size=256. I think that will do it.
Adding -z max-page-size=256 isn't itself a solution - none of the -z
options are supported by elf32.em unless GENERATE_SHLIB_SCRIPT is set to
"yes". Setting it for C6X (together with adding the -z option to that
test) does fix that failure - while introducing some other failures (the
linker support for shared libraries on this target isn't written, so it's
unsurprising for the linker to segfault if this option is blindly enabled)
- but isn't correct either for C6X at present or for the other targets
without shared library support that might be affected by this issue.
Should some subset of the -z options (or indeed all of them) not be
conditional on shared library support?
Joseph S. Myers