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

Make __heap_start relocatable rather than absolute. #306

Merged
merged 2 commits into from
Feb 17, 2024

Conversation

davidgiven
Copy link
Contributor

In the GNU linker language, ALIGN(alignment) actually produces an absolute value, while ALIGN(address, alignment) produces a relocatable value. See https://sourceware.org/binutils/docs/ld/Builtin-Functions.html#index-ALIGN_0028align_0029 which states that the first is equivalent to ALIGN(ABSOLUTE(address), alignment). Wheee!

This causes __heap_start on CP/M-65 to be an absolute value rather than a relocatable one, even though it's defined in a relocatable segment, which meant the heap address wasn't getting relocated to the right place, causing big chunks of the program to be overwritten --- with different results on each target platform because they each loaded binaries in different places...

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

Successfully merging this pull request may close these issues.

2 participants