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: gold patch committed (Was: Re: Help needed to track down bug: linking Linux kernel with gold creates unbootable kernel)


On Fri, Apr 23, 2010 at 8:49 AM, Ian Lance Taylor <iant@google.com> wrote:
> "H.J. Lu" <hjl.tools@gmail.com> writes:
>
>> On Fri, Apr 23, 2010 at 8:16 AM, Ian Lance Taylor <iant@google.com> wrote:
>>> "H.J. Lu" <hjl.tools@gmail.com> writes:
>>>
>>>> Program Headers:
>>>> ? Type ? ? ? ? ? Offset ? ? ? ? ? ? VirtAddr ? ? ? ? ? PhysAddr
>>>> ? ? ? ? ? ? ? ? ?FileSiz ? ? ? ? ? ?MemSiz ? ? ? ? ? ? ?Flags ?Align
>>>> ? LOAD ? ? ? ? ? 0x0000000000001000 0x0000000000000000 0x0000000000000000
>>>> ? ? ? ? ? ? ? ? ?0x0000000000000001 0x0000000000000001 ?R E ? ?1000
>>>> ? LOAD ? ? ? ? ? 0x0000000000002000 0x0000000000004000 0x0000000000004000
>>>> ? ? ? ? ? ? ? ? ?0x0000000000002001 0x0000000000002001 ?RW ? ? 4000
>>>
>>> This looks right to me.
>>>
>>>
>>>> I am not sure it is a good idea to have different p_align.
>>>
>>> Why not? ?How else can we communicate the information requested by the
>>> programmer? ?A system which cares about p_align needs to look at the
>>> p_align of each PT_LOAD header.
>>
>> You can't load the first segment with 0x1000 alignment. You
>> need to load the first segment with the alignment of the second
>> segment. Why does gold have to make life harder for loader?
>
> The Linux kernel doesn't look at the p_align field, nor should it.
> The p_align field is clearly irrelevant when loading an executable.
> The glibc dynamic linker checks that the p_align field looks
> plausible, but otherwise ignores it other than for a PT_TLS segment;
> that seems appropriate since ld.so is restricted to what mmap does
> anyhow. ?In general, it's hard for me to think of why any loader on a
> virtual memory system would look at the p_align field. ?And it's hard
> for to think of any non-virtual memory system that would support ELF
> style shared libraries.
>
> So I think you are raising a purely hypothetical concern.
>
> On the other hand the p_align field does convey information about the
> sections in that particular segment, and that seems reasonable to me.
>

See:

http://www.sourceware.org/bugzilla/show_bug.cgi?id=11533


-- 
H.J.


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