-
Notifications
You must be signed in to change notification settings - Fork 83
Open
Labels
Description
The current data segment address determination is as follows.
/* page_size is an unnecessary 0x8000byte elf header */
/* 0x10000 is from here : https://github.com/vitasdk/buildscripts/blob/master/patches/binutils/0001-vita.patch#L9 */
data_seg_addr = ((((text_seg_addr + text_seg_size + (page_size - 1)) & ~(page_size - 1)) + (text_seg_addr & (page_size - 1))) + (page_size - 1) + (0x10000 - 1)) & ~(0x10000 - 1)
And we have a simple example.
0x81010000 = ((((0x81000000 + 0x7FF0 + (0x8000 - 1)) & ~(0x8000 - 1)) + (0x81000000 & (0x8000 - 1))) + (0x8000 - 1) + (0x10000 - 1)) & ~(0x10000 - 1)
This example should determine the address of the data segment as 0x81010000, but the actual text segment exceeds 0x81010000 because text_seg_size does not take into account the size of the information needed for sce_self.
This causes duplication of text and data segments, causing the compiler to throw an error.