[PATCH] arm: Fix main-in-dso with non-BFD linkers (BZ 34098)
Andreas Schwab
schwab@suse.de
Wed Jun 3 09:32:29 GMT 2026
On Jun 02 2026, Adhemerval Zanella wrote:
> Commit c2d6afb4a010 changed the PIC && !SHARED path of start.S (used by
> crt1.o and rcrt1.o) to load main via a R_ARM_REL32 data relocation. When
> main is provided by a shared object, BFD ld synthesizes a canonical PLT
> entry for it, but other linkers (e.g. mold) do not, producing a broken
> binary that crashes at startup.
>
> Follow the aarch64 approach and reference main through a local __wrap_main
> that tail-calls it with a branch relocation, which every linker turns into
> a PLT entry.
Ok.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
More information about the Libc-alpha
mailing list