flip-link icon indicating copy to clipboard operation
flip-link copied to clipboard

consider rejecting negative lengths

Open japaric opened this issue 3 years ago • 2 comments

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 avatar Mar 22 '22 18:03 japaric

I agree we should reject these with a clear warning.

jonathanpallant avatar Mar 23 '22 09:03 jonathanpallant

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

Dajamante avatar Mar 23 '22 10:03 Dajamante