Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: "Jay Carlson" <nop@nop.com>
To: <linux-mips@oss.sgi.com>, <linux-mips@fnet.fr>
Subject: kernel should not reject -mips2 ELF binaries
Date: Mon, 6 Nov 2000 21:20:00 -0500	[thread overview]
Message-ID: <KEEOIBGCMINLAHMMNDJNEEDHCAAA.nop@nop.com> (raw)

include/asm-mips/elf.h contains a macro, elf_check_arch, that decides if an
executable is plausible to run under this kernel.  It currently accepts
binaries flagged as MIPS1 ISA, and rejects all other ISAs.

#define elf_check_arch(hdr)						\
({									\
	int __res = 1;							\
	struct elfhdr *__h = (hdr);					\
									\
	if ((__h->e_machine != EM_MIPS) &&				\
	    (__h->e_machine != EM_MIPS_RS4_BE))				\
		__res = 0;						\
	if (__h->e_flags & EF_MIPS_ARCH)				\
		__res = 0;						\
									\
	__res;								\
})

I think we should make an exception for MIPS2.  Turns out that the two Linux
VR processor families benefit from some of the MIPS II features; most
notably, code density is improved by eliminating load delay slots.  If I
build executables that take advantage of this, they legitimately should be
flagged with E_MIPS_ARCH_2 (since they won't run on my decstation).

So what's the right way to fix this?  Three things come to mind:

1) rip out the EF_MIPS_ARCH check from elf_check_arch.
2) compare the value with E_MIPS_ARCH_1 and E_MIPS_ARCH_2
3) figure out what the capabilities of the current processor are and reject
E_MIPS_ARCH2 on R2/3000s.

I'd just go do #3 except it looks like a bigger pain than it's worth.  No
other linux kernel port goes to that amount of trouble, of course.

(I may do #1 or #2 in the Linux VR CVS as a stopgap.)

Jay

WARNING: multiple messages have this Message-ID (diff)
From: "Jay Carlson" <nop@nop.com>
To: linux-mips@oss.sgi.com, linux-mips@fnet.fr
Subject: kernel should not reject -mips2 ELF binaries
Date: Mon, 6 Nov 2000 21:20:00 -0500	[thread overview]
Message-ID: <KEEOIBGCMINLAHMMNDJNEEDHCAAA.nop@nop.com> (raw)
Message-ID: <20001107022000.CP3t2FqO5zHA-PaaSabqfZoCrIeNNI8mI8wz7FaNPiM@z> (raw)

include/asm-mips/elf.h contains a macro, elf_check_arch, that decides if an
executable is plausible to run under this kernel.  It currently accepts
binaries flagged as MIPS1 ISA, and rejects all other ISAs.

#define elf_check_arch(hdr)						\
({									\
	int __res = 1;							\
	struct elfhdr *__h = (hdr);					\
									\
	if ((__h->e_machine != EM_MIPS) &&				\
	    (__h->e_machine != EM_MIPS_RS4_BE))				\
		__res = 0;						\
	if (__h->e_flags & EF_MIPS_ARCH)				\
		__res = 0;						\
									\
	__res;								\
})

I think we should make an exception for MIPS2.  Turns out that the two Linux
VR processor families benefit from some of the MIPS II features; most
notably, code density is improved by eliminating load delay slots.  If I
build executables that take advantage of this, they legitimately should be
flagged with E_MIPS_ARCH_2 (since they won't run on my decstation).

So what's the right way to fix this?  Three things come to mind:

1) rip out the EF_MIPS_ARCH check from elf_check_arch.
2) compare the value with E_MIPS_ARCH_1 and E_MIPS_ARCH_2
3) figure out what the capabilities of the current processor are and reject
E_MIPS_ARCH2 on R2/3000s.

I'd just go do #3 except it looks like a bigger pain than it's worth.  No
other linux kernel port goes to that amount of trouble, of course.

(I may do #1 or #2 in the Linux VR CVS as a stopgap.)

Jay

             reply	other threads:[~2000-11-07  2:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-11-07  2:20 Jay Carlson [this message]
2000-11-07  2:20 ` kernel should not reject -mips2 ELF binaries Jay Carlson
2000-11-07  2:28 ` Ralf Baechle
2000-11-07  3:00   ` Jay Carlson
2000-11-07  3:00     ` Jay Carlson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=KEEOIBGCMINLAHMMNDJNEEDHCAAA.nop@nop.com \
    --to=nop@nop.com \
    --cc=linux-mips@fnet.fr \
    --cc=linux-mips@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox