feat: use PIC code model for shared libraries, fix shared library bugs
This commit is contained in:
@@ -268,10 +268,11 @@ namespace Sched {
|
||||
uint64_t copyEnd = (pageEnd < targetSegFileEnd) ? pageEnd : targetSegFileEnd;
|
||||
|
||||
if (copyStart < copyEnd) {
|
||||
// Source: file data at (copyStart - targetSegStart) offset from p_offset
|
||||
// Source stays segment-relative, but the destination must be page-relative.
|
||||
// Using a segment-relative destination offset leaves page 2+ zero-filled and
|
||||
// writes past the newly allocated page in the kernel mapping.
|
||||
uint64_t srcOffset = phdr->p_offset + (copyStart - targetSegStart);
|
||||
// Dest: page at (copyStart - targetSegStart) offset, then adjusted for this page
|
||||
uint64_t pageDataOffset = copyStart - targetSegStart;
|
||||
uint64_t pageDataOffset = copyStart - pageStart;
|
||||
uint64_t copySize = copyEnd - copyStart;
|
||||
|
||||
uint8_t* dst = (uint8_t*)Memory::HHDM(physAddr) + pageDataOffset;
|
||||
|
||||
Reference in New Issue
Block a user