package/pkg-golang: use external linking on ARM Thumb
On ARMv5, runtime/cgo calls __sync_synchronize, which comes from
libgcc.a. When cgo objects have unresolved symbols, the Go internal
linker loads libgcc.a itself to resolve them. With
BR2_ARM_INSTRUCTIONS_THUMB=y, gcc is built with --with-mode=thumb, so
libgcc.a contains Thumb code, which the internal linker rejects:
link: R_ARM_THM_CALL, are you using -marm?
Go already passes -marm when it compiles the cgo C sources, so adding
-marm to CGO_CFLAGS does not help. The call from ARM code into Thumb
code must switch the processor to the other instruction set, which the
internal linker cannot do. Force external linking instead: GNU ld can,
by rewriting the call to BLX or routing it through a small stub.
Fixes: https://autobuild.buildroot.org/results/7534211959577546c3777939d11e411d8a417baa
Signed-off-by: Christian Stewart <christian@aperture.us>
Reviewed-by: Yann E. MORIN <yann.morin@orange.com>
Tested-by: Yann E. MORIN <yann.morin@orange.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
1 file changed