-
Notifications
You must be signed in to change notification settings - Fork 47
Fix evaluation of non-dot assignments containing forward references #510
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -824,6 +824,28 @@ class GNULDBackend { | |
|
|
||
| const ResolveInfo *findAbsolutePLT(ResolveInfo *I) const; | ||
|
|
||
| /// Returns true if the symbol is partially evaluated. That | ||
| /// is, the symbol assignment expression was partially evaluated. | ||
| bool isPartiallyEvaluated(const ResolveInfo *RI) const { | ||
| return PartiallyEvaluatedSymbols.count(RI); | ||
| } | ||
|
|
||
| void addPartiallyEvaluatedSymbol(const ResolveInfo *RI) { | ||
| PartiallyEvaluatedSymbols.insert(RI); | ||
| } | ||
|
|
||
| void removePartiallyEvaluatedSymbol(const ResolveInfo *RI) { | ||
| PartiallyEvaluatedSymbols.erase(RI); | ||
| } | ||
|
|
||
| void resetPartiallyEvalAssignmentsAndSymbols() { | ||
| PartiallyEvaluatedAssignments.clear(); | ||
| PartiallyEvaluatedSymbols.clear(); | ||
| } | ||
|
|
||
| /// Recursively evaluates the partially evaluated assignments. | ||
| void evaluatePendingAssignments(); | ||
|
|
||
| protected: | ||
| virtual int numReservedSegments() const { return m_NumReservedSegments; } | ||
|
|
||
|
|
@@ -1002,6 +1024,14 @@ class GNULDBackend { | |
| // Setup TLS alignment and check for any layout issues | ||
| bool setupTLS(); | ||
|
|
||
| /// Evaluates the assignment and tracks the partially evaluated assignments. | ||
| /// Partially evaluated assignments can be requested to be (recursively) | ||
| /// reevaluated using evaluatePendingAssignments. | ||
| void evaluateAssignmentAndTrackPartiallyEvalAssignments(Assignment &A, | ||
| const ELFSection *S); | ||
|
|
||
| void resetScriptSymbols(); | ||
|
|
||
| protected: | ||
| Module &m_Module; | ||
|
|
||
|
|
@@ -1132,6 +1162,12 @@ class GNULDBackend { | |
| bool m_NeedEhdr = false; | ||
|
|
||
| bool m_NeedPhdr = false; | ||
|
|
||
| std::unordered_set<const ResolveInfo *> PartiallyEvaluatedSymbols; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shouldn't this be PartiallyEvaluatedAssignments instead ? because everything is an assignment
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need both |
||
|
|
||
| /// Stores the assignments which needs to be reevaluated later. | ||
| std::vector<std::pair<Assignment *, const ELFSection *>> | ||
| PartiallyEvaluatedAssignments; | ||
| }; | ||
|
|
||
| } // namespace eld | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we --trace=layout and add the layout diagnostics in tracing layout iterations ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this sounds good to me. I think a lot of things can be covered under --trace=layout. Can we handle this as a separate task altogether that analysis what all diagnostics should fall under
--trace=layout?