* [PATCH] remove check for ELF offset in powerpc bootimage
@ 2006-01-30 13:28 Olaf Hering
2006-01-30 13:43 ` Simon Richter
0 siblings, 1 reply; 2+ messages in thread
From: Olaf Hering @ 2006-01-30 13:28 UTC (permalink / raw)
To: Alan Modra, Paul Mackeras, linuxppc-dev
Is this check really needed, are there PT_LOAD sections with offset
zero (either zImage or vmlinux)? I see an offset which is always 64k.
Do not check for offset, it is always set.
Signed-off-by: Olaf Hering <olh@suse.de>
arch/powerpc/boot/main.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
Index: linux-2.6.16-rc1-olh/arch/powerpc/boot/main.c
===================================================================
--- linux-2.6.16-rc1-olh.orig/arch/powerpc/boot/main.c
+++ linux-2.6.16-rc1-olh/arch/powerpc/boot/main.c
@@ -152,7 +152,7 @@ static int is_elf64(void *hdr)
elf64ph = (Elf64_Phdr *)((unsigned long)elf64 +
(unsigned long)elf64->e_phoff);
for (i = 0; i < (unsigned int)elf64->e_phnum; i++, elf64ph++)
- if (elf64ph->p_type == PT_LOAD && elf64ph->p_offset != 0)
+ if (elf64ph->p_type == PT_LOAD)
break;
if (i >= (unsigned int)elf64->e_phnum)
return 0;
@@ -193,7 +193,7 @@ static int is_elf32(void *hdr)
elf32 = (Elf32_Ehdr *)elfheader;
elf32ph = (Elf32_Phdr *) ((unsigned long)elf32 + elf32->e_phoff);
for (i = 0; i < elf32->e_phnum; i++, elf32ph++)
- if (elf32ph->p_type == PT_LOAD && elf32ph->p_offset != 0)
+ if (elf32ph->p_type == PT_LOAD)
break;
if (i >= elf32->e_phnum)
return 0;
--
short story of a lazy sysadmin:
alias appserv=wotan
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] remove check for ELF offset in powerpc bootimage
2006-01-30 13:28 [PATCH] remove check for ELF offset in powerpc bootimage Olaf Hering
@ 2006-01-30 13:43 ` Simon Richter
0 siblings, 0 replies; 2+ messages in thread
From: Simon Richter @ 2006-01-30 13:43 UTC (permalink / raw)
To: Olaf Hering; +Cc: linuxppc-dev, Alan Modra
[-- Attachment #1: Type: text/plain, Size: 1107 bytes --]
Hi,
Olaf Hering wrote:
> Is this check really needed, are there PT_LOAD sections with offset
> zero (either zImage or vmlinux)? I see an offset which is always 64k.
Sure, an offset of zero is completely legal (obviously, the start
address would then be different from the load address of that segment).
Without context, I would say this loop is used to find some loadable
segment that does not include the ELF header. I cannot think of any
application for that, as it is certainly acceptable to merge LOAD
segments, and the segment it is looking for could have been merged with
the segment that includes the header.
If the current linker scripts specify that loading the header is
unneeded, this means that all LOAD headers will have nonzero offsets.
But I wouldn't count on that forever.[1]
Simon
[1] the Amiga bootloader, for example, assumes that all segments are to
be loaded, so things broke badly on APUS when the ldscript did not
remove the .note.gnu-stack section, which has a VMA of zero as it is
never loaded anyway. So depending on things being a particular way is
bad. :-)
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 307 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-01-30 14:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-30 13:28 [PATCH] remove check for ELF offset in powerpc bootimage Olaf Hering
2006-01-30 13:43 ` Simon Richter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).