|
@@ -330,7 +330,7 @@ if (ehdr.e_ident[EI_MAG0] != ELFMAG0 ||
|
|
}
|
|
}
|
|
```
|
|
```
|
|
|
|
|
|
-and if it's not valid, it prints an error message and halts. If we got a valid `ELF` file, we go through all program headers from the given `ELF` file and copy all loadable segments with correct address to the output buffer:
|
|
|
|
|
|
+and if it's not valid, it prints an error message and halts. If we got a valid `ELF` file, we go through all program headers from the given `ELF` file and copy all loadable segments with correct 2 megabytes aligned address to the output buffer:
|
|
|
|
|
|
```C
|
|
```C
|
|
for (i = 0; i < ehdr.e_phnum; i++) {
|
|
for (i = 0; i < ehdr.e_phnum; i++) {
|
|
@@ -338,6 +338,10 @@ and if it's not valid, it prints an error message and halts. If we got a valid `
|
|
|
|
|
|
switch (phdr->p_type) {
|
|
switch (phdr->p_type) {
|
|
case PT_LOAD:
|
|
case PT_LOAD:
|
|
|
|
+#ifdef CONFIG_X86_64
|
|
|
|
+ if ((phdr->p_align % 0x200000) != 0)
|
|
|
|
+ error("Alignment of LOAD segment isn't multiple of 2MB");
|
|
|
|
++#endif
|
|
#ifdef CONFIG_RELOCATABLE
|
|
#ifdef CONFIG_RELOCATABLE
|
|
dest = output;
|
|
dest = output;
|
|
dest += (phdr->p_paddr - LOAD_PHYSICAL_ADDR);
|
|
dest += (phdr->p_paddr - LOAD_PHYSICAL_ADDR);
|