[PATCH] ld: Account for .tbss size on ARM EABI targets
Hans-Peter Nilsson
hp@bitrange.com
Wed Aug 19 03:57:20 GMT 2026
Drive-by reviewing:
On Tue, 18 Aug 2026, Torbjörn SVENSSON wrote:
> Ok for master?
>
> --
>
> Bare-metal ARM EABI programs allocate TLS storage directly, so if .tdata
> consumses VMA, then .tbss must also do so. Otherwise, a following
> section such as .bss can overlap it.
>
> Keep the existing behavior for non-EABI targets, and add tests for
> static, executable, PIE, and dynamic links.
>
> This change aligns with LLVM lld behavior for .tbss.
> +++ b/ld/emultempl/armelf.em
> @@ -58,6 +58,7 @@ gld${EMULATION_NAME}_before_parse (void)
> #endif /* not TARGET_ */
> input_flags.dynamic = ${DYNAMIC_LINK-true};
> config.has_shared = `if test -n "$GENERATE_SHLIB_SCRIPT" ; then echo true ; else echo false ; fi`;
> + config.tls_nobits_occupies_vma = `case ${target} in arm*-*-eabi*) echo true ;; *) echo false ;; esac`;
Can $target be "thumb" here, so it'd make sense to have the
pattern instead be "*-*-eabi*"?
(Not a rhetorical question, if $target is somehow canonicalized
to "arm" and a lone "*-*-eabi*" would look out of place here
rather than obviously safe.)
brgds, H-P
More information about the Binutils
mailing list