Skip to content

Conversation

@Ris-Bali
Copy link
Contributor

@Ris-Bali Ris-Bali commented Aug 30, 2025

Currently eld does not emit any diagnostic when
negative VMA/LMA is specified in the linkerscript. This patch adds an error diagnostic to handle
such cases.

Fixes: #264

@Ris-Bali Ris-Bali force-pushed the Diag_negative_vma_lma branch 4 times, most recently from 75b6234 to 295d211 Compare August 31, 2025 19:39
RUN: %not %link %linkopts %t1.1.o -T %p/Inputs/script.t -o %t2_vma.out 2>&1 | %filecheck %s
RUN: %not %link %linkopts %t1.1.o -T %p/Inputs/script_1.t -o %t2_lma.out 2>&1 | %filecheck %s --check-prefix=LMA

CHECK: VMA is negative
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add the VMA/LMA value in the error message as well.

"%0: modulo by zero in expression %1")
DIAG(error_experimental_not_supported, DiagnosticEngine::Error,
"Linker has only experimental support for handling %0")
DIAG(error_negative_vma, DiagnosticEngine::Fatal,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change the diagnostic severity to error here.

Currently eld does not emit any diagnostic when
negative VMA/LMA is specified in the linkerscript.
This patch adds an error diagnostic to handle
such cases.

Signed-off-by: Rishabh Bali <[email protected]>
@Ris-Bali Ris-Bali force-pushed the Diag_negative_vma_lma branch from 295d211 to 3d82029 Compare September 1, 2025 18:01
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.

eld should warn/error when VMA/LMA is negative

2 participants