* [Fwd: Re: ELF bugfixes]
@ 2009-03-12 13:22 phcoder
0 siblings, 0 replies; 2+ messages in thread
From: phcoder @ 2009-03-12 13:22 UTC (permalink / raw)
To: The development of GRUB 2
[-- Attachment #1: Type: text/plain, Size: 44 bytes --]
--
Regards
Vladimir 'phcoder' Serbinenko
[-- Attachment #2: Re: ELF bugfixes.eml --]
[-- Type: message/rfc822, Size: 2597 bytes --]
From: phcoder <phcoder@gmail.com>
To: David Miller <davem@davemloft.net>
Subject: Re: ELF bugfixes
Date: Thu, 12 Mar 2009 14:21:45 +0100
Message-ID: <49B90C69.60703@gmail.com>
David Miller wrote:
> From: phcoder <phcoder@gmail.com>
> Date: Thu, 12 Mar 2009 12:22:15 +0100
>
>> David Miller wrote:
>>> From: phcoder <phcoder@gmail.com>
>>> Date: Thu, 12 Mar 2009 09:23:34 +0100
>>>
>>>> Index: include/grub/elf.h
>>>> ===================================================================
>>>> --- include/grub/elf.h (revision 2036)
>>>> +++ include/grub/elf.h (working copy)
>>>> @@ -77,7 +77,7 @@
>>>> Elf32_Half e_shentsize; /* Section header table entry size */
>>>> Elf32_Half e_shnum; /* Section header table entry count */
>>>> Elf32_Half e_shstrndx; /* Section header string table index */
>>>> -} Elf32_Ehdr;
>>>> +} __attribute__ ((packed)) Elf32_Ehdr;
>>>>
>>> There is no reason why you should need the packed attribute here.
>>> I can't think of any cpu where this could even remotely be necessary.
>>> And if it's not necessary, all it does it emit terribly suboptimal
>>> code on RISC cpus.
>> If it doesn't make a difference in the structure why does the compiler generate different code?
>
> Because packed also means that the alignment of the structure
> can't be assumed to be naturally word aligned. So the compiler
> has to use byte loads and stores to load a word, for example,
> on RISC machines.
>
> This is because the packed attribute influences how the structure is
> embedded into other structures.
>
> This attribute controls two different things, not just local packing.
I knew it but normally when you parse files normally offsets aren't
guaranteed to be aligned. But now it seems that elf parser is written in
a way to guarantee at least some alignments. Then this part of patch
probably is to be dropped or changed to proper aligned attribute
--
Regards
Vladimir 'phcoder' Serbinenko
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Fwd: Re: ELF bugfixes]
@ 2009-03-13 20:54 phcoder
0 siblings, 0 replies; 2+ messages in thread
From: phcoder @ 2009-03-13 20:54 UTC (permalink / raw)
To: The development of GRUB 2
[-- Attachment #1: Type: text/plain, Size: 44 bytes --]
--
Regards
Vladimir 'phcoder' Serbinenko
[-- Attachment #2: Re: ELF bugfixes.eml --]
[-- Type: message/rfc822, Size: 2155 bytes --]
From: David Miller <davem@davemloft.net>
To: phcoder@gmail.com
Subject: Re: ELF bugfixes
Date: Fri, 13 Mar 2009 13:53:14 -0700 (PDT)
Message-ID: <20090313.135314.142627200.davem@davemloft.net>
From: phcoder <phcoder@gmail.com>
Date: Fri, 13 Mar 2009 21:49:39 +0100
> David Miller wrote:
> > From: phcoder <phcoder@gmail.com>
> > Date: Fri, 13 Mar 2009 21:41:42 +0100
> >
> >> Actually our segment table is also our table for transforming
> >> between virtual and physical address. I don't see why entry point
> >> would be defined against virtual address of lowest physical segement
> > I would suggest simply looping over the phdrs and remembering
> > which one the e_entry falls into.
> > Won't that make things work in the case you're describing?
> >
> I thought I have attached new patch. Sorry forgot to do so
This patch looks good to me, FWIW.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-03-13 20:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-13 20:54 [Fwd: Re: ELF bugfixes] phcoder
-- strict thread matches above, loose matches on Subject: below --
2009-03-12 13:22 phcoder
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.