This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC: Assign regions to orphan sections


On Fri, 26 Mar 2010, Daniel Jacobowitz wrote:

> On Thu, Mar 25, 2010 at 05:55:16PM -0700, Ian Lance Taylor wrote:
> > Daniel Jacobowitz <dan@codesourcery.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[0]->lma < phdr_size
>               || sections[0]->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
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]