This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: i386-pc-nto-qnx patch
- From: "Graeme Peterson" <gp at qnx dot com>
- To: amodra at bigpond dot net dot au (Alan Modra)
- Cc: binutils at sources dot redhat dot com
- Date: Mon, 13 May 2002 11:42:53 -0400 (EDT)
- Subject: Re: i386-pc-nto-qnx patch
Hi, Alan.
I got this from the author of the IS_CONTAINED_BY_FILEPOS stuff.
Hope it helps. He will be looking at this a little more as well.
" If you look at the output of 'objdump -h procnto' you will see:
procnto: file format elf32-i386
Sections:
Idx Name Size VMA LMA File off Algn
0 ___procnto 00026bfb 080480d4 080480d4 000000d4 2**0
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .text 00002024 0806ecd0 0806ecd0 00026cd0 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
2 ___c 0000954a 08070cf4 08070cf4 00028cf4 2**0
CONTENTS, ALLOC, LOAD, READONLY, CODE
3 ___kercalls 00000011 0807a23e 0807a23e 0003223e 2**0
CONTENTS, ALLOC, LOAD, READONLY, CODE
4 .rodata 0000080d 0807a250 0807a250 00032250 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
5 .rodata1 00000e44 0807aa60 0807aa60 00032a60 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
6 .data 00000f24 0807c8a4 0807c8a4 000338a4 2**2
CONTENTS, ALLOC, LOAD, DATA
7 .bss 00001404 0807d7c8 0807d7c8 000347c8 2**2
ALLOC
8 .segrel 000031f8 00000000 00000000 000347c8 2**0
CONTENTS, READONLY
9 .segrel 000000fc 00000000 00000000 000379c0 2**0
CONTENTS, READONLY
10 .note 00000038 00000000 00000000 00037abc 2**2
CONTENTS, READONLY
The LMA for the .segrel sections is 0.
Maybe the gnu stuff internally is setting this field from filepos or
calculating this but I am not sure. I think the Gnu linker should
only calculate LMA for loadable sections. "
So, it seems to me that since the PT_SEGREL is not loadable, then the
.segrel LMA is 0, so we can't use it, which is why IS_CONTAINED BY_FILEPOS
was written.
Does that sound right? I am on a learning curve here, and quite willing
to be corrected. BTW, has anyone tried the patch to see if it is ok, or
if it breaks stuff? The PT_SEGREL support in the patch works for us, and
I was curious to see if it passed other regressions.
Thanks, as always.
GP
>
> On Thu, May 09, 2002 at 11:20:05AM -0400, Graeme Peterson wrote:
> > I've seen a lot of talk about merging patches, and was wondering
> > if anyone has had time to look at the i386-pc-nto-qnx patch I
> > submitted.
>
> I've looked at it a couple of times, thought "why is he doing that?"
> and put it aside until I could analyse your code a little deeper.
>
> So, why is IS_CONTAINED_BY_FILEPOS necessary? Just because
> _bfd_elf_make_section_from_shdr isn't setting up lma correctly for
> you? Seems to me the right solution is some tweakery to
> _bfd_elf_make_section_from_shdr. You'll probably want this anyway
> as other parts of bfd look at the section lma.
>
> --
> Alan Modra
> IBM OzLabs - Linux Technology Centre
>