Bootloader: fix loading of ARM ELF files

* Let the loader know about PT_ARM_UNWIND (and ignore it)
 * Allow up to 32K of space between sections of an ELF files as ARM ones
need that.
This commit is contained in:
PulkoMandy 2014-09-02 18:14:27 +02:00
parent 83f5e2a258
commit 5de8dca2e4
2 changed files with 18 additions and 13 deletions

View File

@ -132,19 +132,21 @@
/*** program header ***/
// program header segment types
#define PT_NULL 0
#define PT_LOAD 1
#define PT_DYNAMIC 2
#define PT_INTERP 3
#define PT_NOTE 4
#define PT_SHLIB 5
#define PT_PHDR 6
#define PT_TLS 7
#define PT_STACK 0x6474e551
#define PT_RELRO 0x6474e552
#define PT_NULL 0
#define PT_LOAD 1
#define PT_DYNAMIC 2
#define PT_INTERP 3
#define PT_NOTE 4
#define PT_SHLIB 5
#define PT_PHDR 6
#define PT_TLS 7
#define PT_STACK 0x6474e551
#define PT_RELRO 0x6474e552
#define PT_LOPROC 0x70000000
#define PT_ARM_UNWIND 0x70000001
#define PT_HIPROC 0x7fffffff
#define PT_LOPROC 0x70000000
#define PT_HIPROC 0x7fffffff
// program header segment flags
#define PF_EXECUTE 0x1

View File

@ -13,6 +13,7 @@
#include <driver_settings.h>
#include <elf32.h>
#include <kernel.h>
#include <SupportDefs.h>
#include <errno.h>
#include <unistd.h>
@ -220,6 +221,7 @@ ELFLoader<Class>::Load(int fd, preloaded_image* _image)
continue;
case PT_INTERP:
case PT_PHDR:
case PT_ARM_UNWIND:
// known but unused type
continue;
default:
@ -275,7 +277,8 @@ ELFLoader<Class>::Load(int fd, preloaded_image* _image)
// inbetween.
totalSize = secondRegion->start + secondRegion->size - firstRegion->start;
if (totalSize > image->text_region.size + image->data_region.size
+ 16 * 1024) {
+ 32 * 1024) {
dprintf("Too much space between segments %" B_PRIuSIZE "!\n", totalSize);
status = B_BAD_DATA;
goto error1;
}