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:
@@ -132,19 +132,21 @@
|
|||||||
/*** program header ***/
|
/*** program header ***/
|
||||||
|
|
||||||
// program header segment types
|
// program header segment types
|
||||||
#define PT_NULL 0
|
#define PT_NULL 0
|
||||||
#define PT_LOAD 1
|
#define PT_LOAD 1
|
||||||
#define PT_DYNAMIC 2
|
#define PT_DYNAMIC 2
|
||||||
#define PT_INTERP 3
|
#define PT_INTERP 3
|
||||||
#define PT_NOTE 4
|
#define PT_NOTE 4
|
||||||
#define PT_SHLIB 5
|
#define PT_SHLIB 5
|
||||||
#define PT_PHDR 6
|
#define PT_PHDR 6
|
||||||
#define PT_TLS 7
|
#define PT_TLS 7
|
||||||
#define PT_STACK 0x6474e551
|
#define PT_STACK 0x6474e551
|
||||||
#define PT_RELRO 0x6474e552
|
#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
|
// program header segment flags
|
||||||
#define PF_EXECUTE 0x1
|
#define PF_EXECUTE 0x1
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#include <driver_settings.h>
|
#include <driver_settings.h>
|
||||||
#include <elf32.h>
|
#include <elf32.h>
|
||||||
#include <kernel.h>
|
#include <kernel.h>
|
||||||
|
#include <SupportDefs.h>
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@@ -220,6 +221,7 @@ ELFLoader<Class>::Load(int fd, preloaded_image* _image)
|
|||||||
continue;
|
continue;
|
||||||
case PT_INTERP:
|
case PT_INTERP:
|
||||||
case PT_PHDR:
|
case PT_PHDR:
|
||||||
|
case PT_ARM_UNWIND:
|
||||||
// known but unused type
|
// known but unused type
|
||||||
continue;
|
continue;
|
||||||
default:
|
default:
|
||||||
@@ -275,7 +277,8 @@ ELFLoader<Class>::Load(int fd, preloaded_image* _image)
|
|||||||
// inbetween.
|
// inbetween.
|
||||||
totalSize = secondRegion->start + secondRegion->size - firstRegion->start;
|
totalSize = secondRegion->start + secondRegion->size - firstRegion->start;
|
||||||
if (totalSize > image->text_region.size + image->data_region.size
|
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;
|
status = B_BAD_DATA;
|
||||||
goto error1;
|
goto error1;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user