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

consider rejecting negative lengths #67

Open
japaric opened this issue Mar 22, 2022 · 2 comments
Open

consider rejecting negative lengths #67

japaric opened this issue Mar 22, 2022 · 2 comments
Labels
status: needs design This feature needs design work to move forward

Comments

@japaric
Copy link
Member

japaric commented Mar 22, 2022

rust-lld will happily link memory.x files that contain lines like these

RAM : ORIGIN = 0x20020000, LENGTH = 1K - 2K

or even

RAM : ORIGIN = 0x20020000, LENGTH = -1K

it seems the behavior is that the value overflows because linking works even if .bss is 1MiB in size.

we could either reject these indicating that there may be a problem in the linker script or that negative lengths are not supported.

if we want to support them then I'm not sure what flip-link behavior should be. transforming either of the above to

RAM : ORIGIN = 0x20020000 - 1K, LENGTH = 1K

does not produce the same binary with a single linker pass

@japaric japaric added the status: needs design This feature needs design work to move forward label Mar 22, 2022
@jonathanpallant
Copy link
Contributor

I agree we should reject these with a clear warning.

@Dajamante
Copy link
Contributor

I can try to do that, since I am on the subtraction issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs design This feature needs design work to move forward
Projects
None yet
Development

No branches or pull requests

3 participants