Q: Weak symbol defaulting to an other symbol?
Georg-Johann Lay
avr@gjlay.de
Sun Nov 23 11:54:27 GMT 2025
In an assembler module, I would like to introduce a weak symbol like in:
.weak my_symbol
my_symbol = __heap_start
;; use my_symbol...
where __heap_start is defined in the linker script as
PROVIDE (__heap_start = .)
The code will be part of a static library.
The generated code when linking against the static lib is as
expected. Though what doesn't work is to let the user adjust
my_symbol when they don't like the default, e.g. by
--defsym my_symbol=0x12324
or by code like
.global my_symbol
my_symbol = 0x12345
in some module.
Binutils version is 2.45. So I already found out that overriding
the default doesn't work, and that's likely on purpose.
In order to get a better understanding, I'd like to ask why this
doesn't work, and what's the thinko in my intended design? Having
a user-adjustable symbol that defaults to some symbol value seems
to be a useful feature.
Johann
More information about the Binutils
mailing list