kmod: disable --gc-sections ld option when building for xtensa
PATCH 1/1 kmod: disable --gc-sections ld option when building for xtensa
This is a workaround for the following ld issue exhibited by --gc-sections option, until a proper fix for binutils is ready:
ld: BFD (GNU Binutils) 2.22 internal error, aborting at elf32-xtensa.c line 3374 in elf_xtensa_finish_dynamic_sections
--- package/kmod/900-disable-gc-sections.patch.xtensa | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 package/kmod/900-disable-gc-sections.patch.xtensa
package/kmod/900-disable-gc-sections.patch.xtensa new file +12 -0
@@ -0,0 +1,12 @@ +--- kmod-16/configure 2013-12-23 01:31:12.456202872 +0400 ++++ kmod-16.mod/configure 2014-03-04 22:53:37.132241845 +0400 +@@ -14511,8 +14511,7 @@ + + + for flag in \ +- -Wl,--as-needed \ +- -Wl,--gc-sections; do ++ -Wl,--as-needed ; do + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports flag $flag in envvar LDFLAGS" >&5 + $as_echo_n "checking if $CC supports flag $flag in envvar LDFLAGS... " >&6; }
Signature · 1 line
1.8.1.4
PATCH 1/1 kmod: disable --gc-sections ld option when building for xtensa
Dear Max Filippov,
Quoted 8 lines · Max Filippov
This is a workaround for the following ld issue exhibited by --gc-sections option, until a proper fix for binutils is ready:
ld: BFD (GNU Binutils) 2.22 internal error, aborting at
elf32-xtensa.cline 3374 inelf_xtensa_finish_dynamic_sectionsSigned-off-by Max Filippov <[email protected]>--- package/kmod/900-disable-gc-sections.patch.xtensa | 12 ++++++++++++
The patch should be named kmod-01-<description>.patch. We no longer accept architecture-specific patches, so the .xtensa extension has to go, and we have to ensure that the fix is usable on all architectures.
So either we simply remove --gc-sections on all architecture, or the configure.ac test has to be made conditional on xtensa.
package/kmod/900-disable-gc-sections.patch.xtensa
Quoted 8 lines
1 file changed, 12 insertions(+) create mode 100644 package/kmod/900-disable-gc-sections.patch.xtensapackage/kmod/900-disable-gc-sections.patch.xtensa new file +0
-0
The patch lacks a description. See
http://buildroot.org/downloads/manual/manual.html#patch-policy for more details about the format of the patches.
package/kmod/900-disable-gc-sections.patch.xtensa line 3
Quoted 4 lines
package/kmod/900-disable-gc-sections.patch.xtensa new file +3
-0@@ -0,0 +1,12 @@ +--- kmod-16/configure 2013-12-23 01:31:12.456202872 +0400 ++++ kmod-16.mod/configure 2014-03-04 22:53:37.132241845 +0400 +@@ -14511,8 +14511,7 @@
We normally prefer to patch configure.ac, and add KMOD_AUTORECONF = YES.
All that being said, I believe there is a much simpler solution. Don't use any patch at all, and add:
# --gc-sections triggers a bug in the current Xtensa binutils ifeq ($(BR2_xtensa),y)KMOD_CONF_ENV += cc_cv_LDFLAGS__Wl___gc_sections=no endif
to package/kmod/kmod.mk.
Can you test that it works for you, and submit the corresponding patch?
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH 1/1 kmod: disable --gc-sections ld option when building for xtensa
Hi Thomas,
Quoted 9 lines · Thomas Petazzoni
Quoted 8 lines · Max Filippov
This is a workaround for the following ld issue exhibited by --gc-sections option, until a proper fix for binutils is ready:
ld: BFD (GNU Binutils) 2.22 internal error, aborting at
elf32-xtensa.cline 3374 inelf_xtensa_finish_dynamic_sectionsSigned-off-by Max Filippov <[email protected]>--- package/kmod/900-disable-gc-sections.patch.xtensa | 12 ++++++++++++
[...]
Quoted 11 lines
I believe there is a much simpler solution. Don't
use any patch at all, and add:# --gc-sections triggers a bug in the current Xtensa binutils ifeq ($(BR2_xtensa),y)
KMOD_CONF_ENV+= cc_cv_LDFLAGS__Wl___gc_sections=no endifto
package/kmod/kmod.mk.Can you test that it works for you, and submit the corresponding patch?
thank you for the review and for the suggested solution, it works for me and I like it, though it doesn't look obvious. I'll submit v2.
Signature · 2 lines
Thanks. -- Max