Skip to contentSkip to conversation

matchbox-keyboard: Fix build failure with ld-is-gold

PATCH In review Carlos Alberto Lopez Perez 3 participants 8 messages Sep 11, 2015 – Jan 17, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 matchbox-keyboard: Fix build failure with ld-is-gold

* When ld-is-gold is enabled in DISTRO_FEATURES, matchbox-keyboard will fail to build with this error:

ld: error: matchbox-keyboard-image.o: requires unsupported dynamic
reloc R_ARM_MOVW_ABS_NC; recompile with -fPIC

---
 meta/recipes-sato/matchbox-keyboard/matchbox-keyboard_git.bb | 2 ++
 1 file changed, 2 insertions(+)
meta/recipes-sato/matchbox-keyboard/matchbox-keyboard_git.bb +2 -0
index 0d321d3..cde1c49 100644
@@ -25,6 +25,8 @@ inherit autotools pkgconfig gettext gtk-immodules-cache distro_features_check
 # The libxft, libfakekey and matchbox-panel-2 requires x11 in DISTRO_FEATURES
 REQUIRED_DISTRO_FEATURES = "x11"
 
+CFLAGS_append = "${@base_contains('DISTRO_FEATURES', 'ld-is-gold', ' -fPIC ', '', d)}"
+
 EXTRA_OECONF = "--disable-cairo --enable-gtk-im --enable-applet"
 
 PACKAGES += "${PN}-im ${PN}-applet"
Signature · 1 line
2.1.4
#1 lore raw
Quoted 5 lines · Carlos Alberto Lopez Perez

* When ld-is-gold is enabled in DISTRO_FEATURES, matchbox-keyboard will fail to build with this error:

ld: error: matchbox-keyboard-image.o: requires unsupported dynamic
reloc R_ARM_MOVW_ABS_NC; recompile with -fPIC

This is only an issue for ARM (and only for Thumb2 at that). I don't think it's necessarily appropriate to force -fPIC on all targets.

Also, before adding this sort of hack it would be worth verifying whether this is in fact a toolchain bug and, if it is, fixing it there.

p.

#2 lore raw
Quoted 7 lines · Phil Blundell
Quoted 5 lines · Carlos Alberto Lopez Perez

* When ld-is-gold is enabled in DISTRO_FEATURES, matchbox-keyboard will fail to build with this error:

ld: error: matchbox-keyboard-image.o: requires unsupported dynamic
reloc R_ARM_MOVW_ABS_NC; recompile with -fPIC

Quoted 10 lines

This is only an issue for ARM (and only for Thumb2 at that). I don't think it's necessarily appropriate to force -fPIC on all targets.

Also, before adding this sort of hack it would be worth verifying whether this is in fact a toolchain bug and, if it is, fixing it there.

p.

If you (or somebody else) want to investigate whether this is a bug on the toolchain or not, I can give you more data:

* I forced GCC 4.9 (GCC 5.X was failing to build the kernel, and I don't bothered with it).

$ grep GCCVERSION conf/local.conf
GCCVERSION = "4.9%"

* The target machine is a Freescale imx6qsabresd board, so I also used the meta-freescale layer (master)

If you need more details, let me know.

I'm not bothering more with this, as the above patch is good enough for me. Feel free to take it or not, or to contribute a better one if you wish.

Regards.

#3 lore raw
In reply to Phil Blundell
Quoted 7 lines · Phil Blundell
Quoted 3 lines · Carlos Alberto Lopez Perez

* When ld-is-gold is enabled in DISTRO_FEATURES, matchbox-keyboard will fail to build with this error:

Quoted 9 lines
Quoted 2 lines

ld: error: matchbox-keyboard-image.o: requires unsupported dynamic
reloc R_ARM_MOVW_ABS_NC; recompile with -fPIC

This is only an issue for ARM (and only for Thumb2 at that). I don't think it's necessarily appropriate to force -fPIC on all targets.

Also, before adding this sort of hack it would be worth verifying whether this is in fact a toolchain bug and, if it is, fixing it there.

This may not be a toolchain bug if there is a MOVW_ABS relocation being emitted
into an object that is eventually linked into shared library. Using -fPIC seems to be right fix I know bfd linker silently ignored these relocations and generated bad .so files but that was fixed several years ago. So I think what needs to be looked at is why does same .o links ok with bfd linker is it some linker trampoline code thats in question here which may be different between gold and ld

Carlos

Can you check the linker cmdline of failing link step and see if its generating a shared object there ? if thats the case and I assume gcc is generating this relocation into both

#4 lore raw
Quoted 23 lines · Khem Raj
Quoted 7 lines · Phil Blundell
Quoted 3 lines · Carlos Alberto Lopez Perez

* When ld-is-gold is enabled in DISTRO_FEATURES, matchbox-keyboard will fail to build with this error:

Quoted 9 lines
Quoted 2 lines

ld: error: matchbox-keyboard-image.o: requires unsupported dynamic
reloc R_ARM_MOVW_ABS_NC; recompile with -fPIC

This is only an issue for ARM (and only for Thumb2 at that). I don't think it's necessarily appropriate to force -fPIC on all targets.

Also, before adding this sort of hack it would be worth verifying whether this is in fact a toolchain bug and, if it is, fixing it there.

This may not be a toolchain bug if there is a MOVW_ABS relocation being emitted
into an object that is eventually linked into shared library. Using -fPIC seems to be right fix I know bfd linker silently ignored these relocations and generated bad .so files but that was fixed several years ago. So I think what needs to be looked at is why does same .o links ok with bfd linker is it some linker trampoline code thats in question here which may be different between gold and ld

Quoted 5 lines

Carlos

Can you check the linker cmdline of failing link step and see if its generating a shared object there ? if thats the case and I assume gcc is generating this relocation into both

It looks is generating an executable (matchbox-keyboard).

Full log: http://sprunge.us/VPIN

#5 lore raw

Carlos

Can you try this fix

https://github.com/kraj/openembedded-core/commit/0e35ad5a35262cfb7a6249ce158f76d1399d6cb4

This should help with this issue.

Quoted 36 lines · Carlos Alberto Lopez Perez
Quoted 23 lines · Khem Raj
Quoted 7 lines · Phil Blundell
Quoted 3 lines · Carlos Alberto Lopez Perez

* When ld-is-gold is enabled in DISTRO_FEATURES, matchbox-keyboard will fail to build with this error:

Quoted 9 lines
Quoted 2 lines

ld: error: matchbox-keyboard-image.o: requires unsupported dynamic
reloc R_ARM_MOVW_ABS_NC; recompile with -fPIC

This is only an issue for ARM (and only for Thumb2 at that). I don't think it's necessarily appropriate to force -fPIC on all targets.

Also, before adding this sort of hack it would be worth verifying whether this is in fact a toolchain bug and, if it is, fixing it there.

This may not be a toolchain bug if there is a MOVW_ABS relocation being emitted
into an object that is eventually linked into shared library. Using -fPIC seems to be right fix I know bfd linker silently ignored these relocations and generated bad .so files but that was fixed several years ago. So I think what needs to be looked at is why does same .o links ok with bfd linker is it some linker trampoline code thats in question here which may be different between gold and ld

Quoted 5 lines

Carlos

Can you check the linker cmdline of failing link step and see if its generating a shared object there ? if thats the case and I assume gcc is generating this relocation into both

It looks is generating an executable (matchbox-keyboard).

Full log: http://sprunge.us/VPIN

#6 lore raw

How does that patch help with this issue? It seems to be adding ifunc support which isn't obviously related to the problem at hand.

p.

Quoted 47 lines · Khem Raj

Carlos

Can you try this fix

https://github.com/kraj/openembedded-core/commit/0e35ad5a35262cfb7a6249ce158f76d1399d6cb4

This should help with this issue.

Quoted 36 lines · Carlos Alberto Lopez Perez
Quoted 23 lines · Khem Raj
Quoted 7 lines · Phil Blundell
Quoted 3 lines · Carlos Alberto Lopez Perez

* When ld-is-gold is enabled in DISTRO_FEATURES, matchbox-keyboard will fail to build with this error:

Quoted 9 lines
Quoted 2 lines

ld: error: matchbox-keyboard-image.o: requires unsupported dynamic
reloc R_ARM_MOVW_ABS_NC; recompile with -fPIC

This is only an issue for ARM (and only for Thumb2 at that). I don't think it's necessarily appropriate to force -fPIC on all targets.

Also, before adding this sort of hack it would be worth verifying whether this is in fact a toolchain bug and, if it is, fixing it there.

This may not be a toolchain bug if there is a MOVW_ABS relocation being emitted
into an object that is eventually linked into shared library. Using -fPIC seems to be right fix I know bfd linker silently ignored these relocations and generated bad .so files but that was fixed several years ago. So I think what needs to be looked at is why does same .o links ok with bfd linker is it some linker trampoline code thats in question here which may be different between gold and ld

Quoted 5 lines

Carlos

Can you check the linker cmdline of failing link step and see if its generating a shared object there ? if thats the case and I assume gcc is generating this relocation into both

It looks is generating an executable (matchbox-keyboard).

Full log: http://sprunge.us/VPIN

#7 lore raw
Quoted 5 lines · Phil Blundell

How does that patch help with this issue? It seems to be adding ifunc support which isn't obviously related to the problem at hand.

Its not obvious but its related because now that ifunc support is available to gold, it marks ‘longjmp’ as STT_GNU_IFUNC and is able to add a runtime RELATIVE relocation for this symbol.

Quoted 53 lines

p.

Quoted 47 lines · Khem Raj

Carlos

Can you try this fix

https://github.com/kraj/openembedded-core/commit/0e35ad5a35262cfb7a6249ce158f76d1399d6cb4

This should help with this issue.

Quoted 36 lines · Carlos Alberto Lopez Perez
Quoted 23 lines · Khem Raj
Quoted 7 lines · Phil Blundell
Quoted 3 lines · Carlos Alberto Lopez Perez

* When ld-is-gold is enabled in DISTRO_FEATURES, matchbox-keyboard will fail to build with this error:

Quoted 9 lines
Quoted 2 lines

ld: error: matchbox-keyboard-image.o: requires unsupported dynamic
reloc R_ARM_MOVW_ABS_NC; recompile with -fPIC

This is only an issue for ARM (and only for Thumb2 at that). I don't think it's necessarily appropriate to force -fPIC on all targets.

Also, before adding this sort of hack it would be worth verifying whether this is in fact a toolchain bug and, if it is, fixing it there.

This may not be a toolchain bug if there is a MOVW_ABS relocation being emitted
into an object that is eventually linked into shared library. Using -fPIC seems to be right fix I know bfd linker silently ignored these relocations and generated bad .so files but that was fixed several years ago. So I think what needs to be looked at is why does same .o links ok with bfd linker is it some linker trampoline code thats in question here which may be different between gold and ld

Quoted 5 lines

Carlos

Can you check the linker cmdline of failing link step and see if its generating a shared object there ? if thats the case and I assume gcc is generating this relocation into both

It looks is generating an executable (matchbox-keyboard).

Full log: http://sprunge.us/VPIN