Skip to content

Fix evaluation order of (before/in/after)-SECTIONS assignments#1203

Open
parth-07 wants to merge 1 commit into
qualcomm:mainfrom
parth-07:AssignmentEvaluationOrder
Open

Fix evaluation order of (before/in/after)-SECTIONS assignments#1203
parth-07 wants to merge 1 commit into
qualcomm:mainfrom
parth-07:AssignmentEvaluationOrder

Conversation

@parth-07
Copy link
Copy Markdown
Contributor

Until now, eld used to incorrectly evaluate before SECTIONS and after SECTIONS assignments both before and after the in-SECTIONS assignments. This results in incorrect liner script symbol values and incorrect layout.

This patch fixes this linker script assignment evaluation order. Now, we evaluate the assignments after the SECTIONS command as part of the layout re-iteration loop in create(Script)ProgramHeaders.

One of the key design change in this patch is to store AfterSections assignments with the last output section. It is required to properly evaluate the assignments when the link contains multiple SECTIONS commands.

Resolves #430

Until now, eld used to incorrectly evaluate before SECTIONS and after
SECTIONS assignments both before and after the in-SECTIONS assignments.
This results in incorrect liner script symbol values and incorrect
layout.

This patch fixes this linker script assignment evaluation order. Now, we
evaluate the assignments after the SECTIONS command as part of the
layout re-iteration loop in create(Script)ProgramHeaders.

One of the key design change in this patch is to store AfterSections
assignments with the last output section. It is required to properly
evaluate the assignments when the link contains multiple SECTIONS
commands.

Resolves qualcomm#430

Signed-off-by: Parth Arora <partaror@qti.qualcomm.com>
Copy link
Copy Markdown
Contributor

@Steven6798 Steven6798 left a comment

Choose a reason for hiding this comment

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

Looks good.

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.

Assignments after SECTIONS command should be evaluated after evaluating assignments in SECTIONS command

3 participants