Skip to content

[linker-script] Error when dot assignment exceeds UINT32_MAX#1116

Open
deepakshirkem wants to merge 1 commit intoqualcomm:mainfrom
deepakshirkem:fix/dot-assignment-overflow-386-v2
Open

[linker-script] Error when dot assignment exceeds UINT32_MAX#1116
deepakshirkem wants to merge 1 commit intoqualcomm:mainfrom
deepakshirkem:fix/dot-assignment-overflow-386-v2

Conversation

@deepakshirkem
Copy link
Copy Markdown
Contributor

Problem

Fixes #386

ELD assigns incorrect addresses when the padding due to dot assignment is greater than UINT32_MAX. When a linker script uses: . = . + 0x400000000;

Fix

Added validation in Assignment::assign() to error out when dot assignment creates padding that exceeds UINT32_MAX
as such large padding values are not meaningful.

Testing

Added test DotAssignmentOverflow that verifies ELD emits a clear error when dot assignment value exceeds UINT32_MAX.

cc @quic-seaswara @parth-07

ELD was silently truncating dot assignment values greater
than UINT32_MAX causing incorrect section addresses.

Added error when dot assignment creates padding that exceeds
UINT32_MAX as such large padding values are not valid.

Fixes qualcomm#386

Signed-off-by: deepakshirkem <deepakshirke509@gmail.com>
@parth-07
Copy link
Copy Markdown
Contributor

parth-07 commented May 6, 2026

Hi @deepakshirkem,

Thank you for the pull-request. The original issue does not state that we should error-out if the padding due to dot assignment is greater than UINT32_MAX, instead it is about the symbol values being incorrect when there is a huge padding. Erroring out when there is a huge padding is a workaround and not a fix for this issue. The huge padding in the original issue can be replaced by any other huge-content that takes up space in the image layout and we will still see the same issue.

@deepakshirkem
Copy link
Copy Markdown
Contributor Author

Hi @parth-07,
I have implemented the root cause fix in PR #1108 by changing uint32_t → uint64_t for Fragment::UnalignedOffset to correctly handle 64-bit offsets. Could you please confirm if this approach is correct? If so, I can implement that fix into this PR.

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.

Incorrect address when the padding due to dot assignment is greater than UINT_MAX

2 participants