[haiku-bugs] Re: [Haiku] #8520: runtime loader should check elf headers for things like architecture.

  • From: "bonefish" <trac@xxxxxxxxxxxx>
  • Date: Fri, 04 May 2012 19:28:38 -0000

#8520: runtime loader should check elf headers for things like architecture.
   Reporter:  kallisti5              |      Owner:  bonefish
       Type:  enhancement            |     Status:  new
   Priority:  normal                 |  Milestone:  R1/alpha4
  Component:  System/runtime_loader  |    Version:  R1/Development
 Resolution:                         |   Keywords:
 Blocked By:                         |   Blocking:
Has a Patch:  0                      |   Platform:  All

Comment (by bonefish):

 Replying to [comment:1 kallisti5]:
 > A side note, parse_elf_header returns a failure if the elf is !=
 32-bits... that may cause issues in our x86_64 (or any non-32-bit) port.

 The runtime loader only supports ELF32 ATM, so it's not this check that
 will cause problems, but the complete absence of ELF64 support. :-)

 Investing any time in pre BeOS R5 x86 or BeOS PPC executables is a waste
 of time IMO.

 Regarding the architecture check, that certainly makes sense. Since we
 only have a single architecture that even supports a userland ATM, the
 need for this check isn't particularly dire, though. But sure, feel free
 to add it. `parse_elf_header()` is the place to do it. The same check can
 be added to `test_executable()` as well (could be extracted to a commonly
 called function).

 @X512: It's one thing to translate machine code from a different
 architecture, it's another thing to do that in an API/ABI compatible way.
 This is probably a big project and not particularly worthwhile IMO. Most
 of Haiku's software is open source anyway, so it can just be recompiled
 for the other architecture. For the remaining closed source projects it's
 easier to provide a cross-compilation environment, so that the vendors can
 build the executables themselves.

Ticket URL: <http://dev.haiku-os.org/ticket/8520#comment:6>
Haiku <http://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: