-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[ELF] Respect orders of symbol assignments and DEFINED #65866
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
Conversation
LGTM. Would it be better to add a link to the GNU-ld's AVR default linker script, in your commit message ? https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=ld/scripttempl/avr.sc;hb=HEAD |
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.
I took a (very) quick look at GNU, it appears to have a statement counter that is used for a similar purpose.
Only got a couple of small comments so marking approved.
b249b87
to
36dc233
Compare
Thanks for the review. Improved comments. |
36dc233
to
591aa46
Compare
591aa46
to
764e66b
Compare
Fix llvm#64600: the currently implementation is minimal (see https://reviews.llvm.org/D83758), and an assignment like `__TEXT_REGION_ORIGIN__ = DEFINED(__TEXT_REGION_ORIGIN__) ? __TEXT_REGION_ORIGIN__ : 0;` (used by avr-ld[1]) leads to a value of zero (default value in `declareSymbol`), which is unexpected. Assign orders to symbol assignments and references so that for a script-defined symbol, the `DEFINED` results match users' expectation. I am unclear about GNU ld's exact behavior, but this hopefully matches its behavior in the majority of cases. [1]: https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=ld/scripttempl/avr.sc
764e66b
to
65a15a5
Compare
Fix llvm#64600: the currently implementation is minimal (see https://reviews.llvm.org/D83758), and an assignment like `__TEXT_REGION_ORIGIN__ = DEFINED(__TEXT_REGION_ORIGIN__) ? __TEXT_REGION_ORIGIN__ : 0;` (used by avr-ld[1]) leads to a value of zero (default value in `declareSymbol`), which is unexpected. Assign orders to symbol assignments and references so that for a script-defined symbol, the `DEFINED` results match users' expectation. I am unclear about GNU ld's exact behavior, but this hopefully matches its behavior in the majority of cases. [1]: https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=ld/scripttempl/avr.sc
Fix #64600: the currently implementation is minimal (see
https://reviews.llvm.org/D83758), and an assignment like
__TEXT_REGION_ORIGIN__ = DEFINED(__TEXT_REGION_ORIGIN__) ? __TEXT_REGION_ORIGIN__ : 0;
(used by avr-ld1) leads to a value of zero (default value in
declareSymbol
),which is unexpected.
Assign orders to symbol assignments and references so that
for a script-defined symbol, the
DEFINED
results match users'expectation. I am unclear about GNU ld's exact behavior, but this hopefully
matches its behavior in the majority of cases.