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:15:50 +02:00
parent 83f5e2a258
commit 5de8dca2e4
2 changed files with 18 additions and 13 deletions
+2
View File
@@ -144,8 +144,10 @@
#define PT_RELRO 0x6474e552 #define PT_RELRO 0x6474e552
#define PT_LOPROC 0x70000000 #define PT_LOPROC 0x70000000
#define PT_ARM_UNWIND 0x70000001
#define PT_HIPROC 0x7fffffff #define PT_HIPROC 0x7fffffff
// program header segment flags // program header segment flags
#define PF_EXECUTE 0x1 #define PF_EXECUTE 0x1
#define PF_WRITE 0x2 #define PF_WRITE 0x2
+4 -1
View File
@@ -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;
} }