| #
20ae0afe |
| 25-Feb-2020 |
Brandon Bergren <[email protected]> |
[PowerPC] Fix LLD10 linking of ofw loader on ppc
Before this change, LLD10 was creating several extra PT_LOAD sections, which OFW does not understand.
Like we do for the kernel already, specify the
[PowerPC] Fix LLD10 linking of ofw loader on ppc
Before this change, LLD10 was creating several extra PT_LOAD sections, which OFW does not understand.
Like we do for the kernel already, specify the program headers manually.
Additionally, to work around a crash in our base ld.bfd, we need to actually assign something to the output section. LLD does not need this.
One side effect of this change is the removal of the GNU_STACK header. This is more correct, since we are using a statically-allocated stack and RWX mappings across the board this early in boot.
Reviewed by: jhibbits, Fangrui Song <[email protected]> Sponsored by: Tag1 Consulting, Inc. Differential Revision: https://reviews.freebsd.org/D23778
show more ...
|
| #
861a0b48 |
| 03-Feb-2018 |
Nathan Whitehorn <[email protected]> |
Fix regression introduced in r328806, preventing boot at least on all PowerPC Apple hardware, and likely all Open Firmware systems.
The loader would allocate memory for its heap at whatever address
Fix regression introduced in r328806, preventing boot at least on all PowerPC Apple hardware, and likely all Open Firmware systems.
The loader would allocate memory for its heap at whatever address Open Firmware gave it, which would in general be the lowest unallocated address, usually starting a page or two above 0. As the kernel is linked at 1 MB, and loader insists on running the kernel at its link address, any heap larger than 1 MB would overlap the kernel, causing loader memory allocations to corrupt the kernel and vice versa.
Although r328806 made this problem much worse by increasing the heap size to 8 MB, causing 88% of the loader heap to overlap with the kernel, the problem has always existed. The old heap size was 1 MB and, unless that started exactly at zero, which would cause other problems, some number of pages of the loader heap still overlapped with the kernel.
This patch solves the issue in two ways and cleans up some related code: - Moves the loader heap inside of the loader. This guarantees that the heap will be contiguous with the loader and simplifies the heap allocation code at no cost, since the heap lives in BSS. - Moves the loader, previously at 28 MB and dangerously close to the kernel it loads, a bit higher to 44 MB. This has the effect of breaking loader on non-embedded PPC machines with < 48 MB of RAM, but we did not support those anyway.
The fundamental problem is that the way loader loads ELF files is incredibly fragile, but that can't be fixed without fundamental architectural changes.
MFC after: 10 days
show more ...
|