* ELF32 problem in mips64 kernel
@ 2002-09-18 21:29 Kip Walker
2002-09-18 21:32 ` Kip Walker
2002-09-20 12:30 ` Maciej W. Rozycki
0 siblings, 2 replies; 3+ messages in thread
From: Kip Walker @ 2002-09-18 21:29 UTC (permalink / raw)
To: linux-mips
[-- Attachment #1: Type: text/plain, Size: 634 bytes --]
There is a faulty check in include/asm-mips64/elf.h:
in elf_check_arch, the following access to the "e_flags" field is
non-sensical if the binary is ELFCLASS32, because "__h" is typed as an
elf64_hdr (through the elfhdr #define), whose e_flags is in a different
location from an elf32_hdr.
if ((__h->e_ident[EI_CLASS] == ELFCLASS32) && \
((__h->e_flags & EF_MIPS_ABI2) == 0)) \
__res = 0; \
Should the n32 check (is this what the EF_MIPS_ABI2 check is about?) be
punted to another binary format handler? The attached patch removed the
ABI2 check.
Kip
[-- Attachment #2: elf.patch --]
[-- Type: text/plain, Size: 841 bytes --]
Index: include/asm-mips64/elf.h
===================================================================
RCS file: /cvs/linux/include/asm-mips64/elf.h,v
retrieving revision 1.10.2.2
diff -u -r1.10.2.2 elf.h
--- include/asm-mips64/elf.h 2002/08/20 18:42:37 1.10.2.2
+++ include/asm-mips64/elf.h 2002/09/18 21:19:42
@@ -43,8 +43,7 @@
\
if (__h->e_machine != EM_MIPS) \
__res = 0; \
- if ((__h->e_ident[EI_CLASS] == ELFCLASS32) && \
- ((__h->e_flags & EF_MIPS_ABI2) == 0)) \
+ if (__h->e_ident[EI_CLASS] == ELFCLASS32) \
__res = 0; \
\
__res; \
@@ -53,7 +52,8 @@
/*
* These are used to set parameters in the core dumps.
*/
-#define ELF_CLASS ELFCLASS64
+//#define ELF_CLASS ELFCLASS64
+#define ELF_CLASS ELFCLASS32
#ifdef __MIPSEB__
#define ELF_DATA ELFDATA2MSB
#elif __MIPSEL__
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: ELF32 problem in mips64 kernel
2002-09-18 21:29 ELF32 problem in mips64 kernel Kip Walker
@ 2002-09-18 21:32 ` Kip Walker
2002-09-20 12:30 ` Maciej W. Rozycki
1 sibling, 0 replies; 3+ messages in thread
From: Kip Walker @ 2002-09-18 21:32 UTC (permalink / raw)
To: linux-mips
[-- Attachment #1: Type: text/plain, Size: 85 bytes --]
OK, so I didn't mean to include the debugging garbage in that patch :-)
Take 2.
Kip
[-- Attachment #2: elf.patch --]
[-- Type: text/plain, Size: 599 bytes --]
Index: include/asm-mips64/elf.h
===================================================================
RCS file: /cvs/linux/include/asm-mips64/elf.h,v
retrieving revision 1.10.2.2
diff -u -r1.10.2.2 elf.h
--- include/asm-mips64/elf.h 2002/08/20 18:42:37 1.10.2.2
+++ include/asm-mips64/elf.h 2002/09/18 21:19:42
@@ -43,8 +43,7 @@
\
if (__h->e_machine != EM_MIPS) \
__res = 0; \
- if ((__h->e_ident[EI_CLASS] == ELFCLASS32) && \
- ((__h->e_flags & EF_MIPS_ABI2) == 0)) \
+ if (__h->e_ident[EI_CLASS] == ELFCLASS32) \
__res = 0; \
\
__res; \
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: ELF32 problem in mips64 kernel
2002-09-18 21:29 ELF32 problem in mips64 kernel Kip Walker
2002-09-18 21:32 ` Kip Walker
@ 2002-09-20 12:30 ` Maciej W. Rozycki
1 sibling, 0 replies; 3+ messages in thread
From: Maciej W. Rozycki @ 2002-09-20 12:30 UTC (permalink / raw)
To: Kip Walker; +Cc: linux-mips
On Wed, 18 Sep 2002, Kip Walker wrote:
> in elf_check_arch, the following access to the "e_flags" field is
> non-sensical if the binary is ELFCLASS32, because "__h" is typed as an
> elf64_hdr (through the elfhdr #define), whose e_flags is in a different
> location from an elf32_hdr.
Thanks for pointing it out.
> if ((__h->e_ident[EI_CLASS] == ELFCLASS32) && \
> ((__h->e_flags & EF_MIPS_ABI2) == 0)) \
> __res = 0; \
>
> Should the n32 check (is this what the EF_MIPS_ABI2 check is about?) be
> punted to another binary format handler? The attached patch removed the
> ABI2 check.
Since the layout of the ELF32 header much differs from the ELF64 one it
doesn't really make sense to handle both formats together. The change
looks OK.
--
+ Maciej W. Rozycki, Technical University of Gdansk, Poland +
+--------------------------------------------------------------+
+ e-mail: macro@ds2.pg.gda.pl, PGP key available +
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-09-20 12:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-09-18 21:29 ELF32 problem in mips64 kernel Kip Walker
2002-09-18 21:32 ` Kip Walker
2002-09-20 12:30 ` Maciej W. Rozycki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox