Re: [RFC PATCH 10/10] arm: migrate away from sections.c

Ilias Apalodimas
2023-05-23T06:56:39Z

On Sat, May 20, 2023 at 02:55:47PM -0600, Sam Edwards wrote:
> This patch effectively reverts 3ebd1cbc49f0005092d69cf0d9a6e64d7a1c300b.

Also 47bd65ef057fb71b02b32741d5cfcaf03e2f0918 ?

>
> The approach taken in that commit was to have the section-marking
> symbols generated into empty sections by the compiler, for the linker
> script to include at the correct location. The rationale was that at
> the time, the linker considered linker-assigned symbols to be dynamic
> when they were in PIC (PIEs or shared libraries), which meant they were
> represented at runtime by a R_ARM_ABS32 relocation (by symbol name)
> rather than by M_ARM_RELATIVE.
>
> That commit landed in March 2013, but GNU ld later changed its behavior
> on 2016-02-23 to default linker-assigned symbols to dynamic only in
> shared libraries (not PIE), so this approach is unnecessary.
>
> I am removing it, because:
> 1) It required keeping sections.c in sync with multiple linker scripts.
> 2) It added complexity to the linker scripts, making them less readable.
> 3) It added unnecessary sections to the output, which can't be merged
> because the sections are sometimes of different types.
> 4) The linker may insert sections not explicitly named in the script
> somewhere between explicit sections; having the marker symbols
> outside of the sections they were marking meant the markers could
> end up with an unintended section inserted within that region.
>
> Signed-off-by: Sam Edwards <CFSworks@gmail.com>
> Cc: Albert ARIBAUD <albert.u.boot@aribaud.net>
>

Thanks
/Ilias