Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong segment address alignment(SCE info missing) #150

Open
Princess-of-Sleeping opened this issue Sep 26, 2020 · 0 comments
Open

Wrong segment address alignment(SCE info missing) #150

Princess-of-Sleeping opened this issue Sep 26, 2020 · 0 comments
Labels

Comments

@Princess-of-Sleeping
Copy link
Contributor

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.

frangarcj pushed a commit to vitasdk/buildscripts that referenced this issue Jan 4, 2021
* Create 0003-fix-elf-vaddr.patch

* Fixed temporary elf size for vita.

Related to this issue : vitasdk/vita-toolchain#150

* Add 0003-fix-elf-vaddr.patch for binutils

* Remove comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant