-
Notifications
You must be signed in to change notification settings - Fork 43
Reiterate layout step until section addresses converge #688
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,7 @@ | |
| #include "eld/Input/ELFDynObjectFile.h" | ||
| #endif | ||
| #include "eld/Object/ObjectBuilder.h" | ||
| #include "eld/Object/OutputSectionEntry.h" | ||
| #include "eld/Readers/CommonELFSection.h" | ||
| #include "eld/Readers/ELFExecObjParser.h" | ||
| #include "eld/Readers/ELFSection.h" | ||
|
|
@@ -1046,6 +1047,10 @@ class GNULDBackend { | |
| } | ||
| #endif | ||
|
|
||
| void setVMA(ELFSection &S, uint64_t vma, bool ignoreChangedSection); | ||
|
|
||
| void setLMA(ELFSection &S, uint64_t lma); | ||
|
|
||
| protected: | ||
| Module &m_Module; | ||
|
|
||
|
|
@@ -1184,6 +1189,8 @@ class GNULDBackend { | |
| GNUVerDefFragment *GNUVerDefFrag = nullptr; | ||
| std::unordered_map<const ResolveInfo *, uint16_t> OutputVersionIDs; | ||
| #endif | ||
| OutputSectionEntry * changedOutputSection = nullptr; | ||
|
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. Layout iterations only continue when section addresses change, but what about symbol-only forward references? cat > 1.c << \!
int foo() {return 0;}
!
cat > cycle.t << \!
SECTIONS {
. = 0x1000;
.text : {*(.text*)}
a = b + 4;
b = a + 4;
}
!
cat > sym.t << \!
PHDRS {TEXT PT_LOAD;}
SECTIONS {
. = 0x1000;
.text : {*(.text*)} : TEXT
a = b + 4;
b = c + 4;
c = 0x2000;
}
!
clang -c 1.c
ld.eld 1.o -T sym.t # a,b,c = 0x8, 0x2004, 0x2000
ld.lld 1.o -T sym.t # a,b,c = 0x2008, 0x2004, 0x2000
ld.lld 1.o -T cycle.t # error: assignment to symbol a does not converge
ld.eld 1.o -T cycle.t # a = 0x14; b=0x18
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.
I plan to handle symbol address convergence in the next patch. The subsequent patches will add support for symbol address convergence, improved diagnostics related to layout iterations and convergence, and some heuristics to reduce the number of iterations wherever possible. |
||
| const int maxPreRelaxationPasses = 4; | ||
| }; | ||
|
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. It looks like lld's max passes is 5. Is there any reason we picked a different number? |
||
|
|
||
| } // 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.
should this be a warning instead?