[all-commits] [llvm/llvm-project] 65a15a: [ELF] Respect orders of symbol assignments and DEF...
Fangrui Song via All-commits
all-commits at lists.llvm.org
Mon Sep 11 10:55:15 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 65a15a56d5ca0d26ca6d34c31a617f5b26e3cfee
https://github.com/llvm/llvm-project/commit/65a15a56d5ca0d26ca6d34c31a617f5b26e3cfee
Author: Fangrui Song <i at maskray.me>
Date: 2023-09-11 (Mon, 11 Sep 2023)
Changed paths:
M lld/ELF/Config.h
M lld/ELF/Driver.cpp
M lld/ELF/LinkerScript.cpp
M lld/ELF/LinkerScript.h
M lld/ELF/ScriptParser.cpp
R lld/test/ELF/linkerscript/define.test
A lld/test/ELF/linkerscript/defined.test
Log Message:
-----------
[ELF] Respect orders of symbol assignments and DEFINED (#65866)
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-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
More information about the All-commits
mailing list