Bug 11143
Summary: | [PATCH]unconditional linker option arch/powerpc/lib/crtsavres.o causes external module buildfailure | ||
---|---|---|---|
Product: | Platform Specific/Hardware | Reporter: | Olaf Hering (olh) |
Component: | PPC-32 | Assignee: | platform_ppc-32 |
Status: | REOPENED --- | ||
Severity: | high | CC: | agruen, ahshah, alan, arekm, christophe.leroy, dbutton, mathieu.malaterre, mchehab, mmarek, ncopa, nyushchenko, rep.dot.nop, vmiklos |
Priority: | P1 | ||
Hardware: | All | ||
OS: | Linux | ||
Kernel Version: | 3.17 | Subsystem: | |
Regression: | Yes | Bisected commit-id: | |
Attachments: |
Fix linking modules against crtsavres.o
Fix linking modules against crtsavres.o |
Description
Olaf Hering
2008-07-22 00:28:12 UTC
Also happens on 2.6.26.5 Created attachment 18191 [details]
Fix linking modules against crtsavres.o
Fix linking modules against crtsavres.o
Previously we got
CC drivers/char/hw_random/rng-core.mod.o
LD [M] drivers/char/hw_random/rng-core.ko
/there/src/buildroot.git.ppc/build_powerpc_nofpu/staging_dir/usr/bin/powerpc-linux-uclibc-ld: arch/powerpc/lib/crtsavres.o: No such file: No such file or directory
* Makefile (LDFLAGS_MODULE_PREREQ): New variable to hold prerequisite
files for modules.
* arch/powerpc/Makefile: add crtsavres.o to LDFLAGS_MODULE_PREREQ.
* scripts/Makefile.modpost (cmd_as_o_S): Copy from Makefile.build.
(cmd_ld_ko_o): Also link LDFLAGS_MODULE_PREREQ.
Provide rule to build objects from assembler.
Signed-off-by: Bernhard Reutner-Fischer <see head of patch>
Works For Me (tm). Please apply (or adjust if you dislike some aspect).
HTH && cheers,
Bernhard
CC'ing Sam since it touches kbuild. Please install. This patch is incomplete, the target .o (or .c) file is not exported. The SuSE, and likely any other kernel-source, tree need also arch/powerpc/lib/crtsavres.c exported. ... <built-in>:0: fatal error: opening dependency file arch/powerpc/lib/.crtsavres.o.d: No such file or directory ... Andreas, can you have a look as well, about what we do in kernel-source for kmp packages? I suspect that generally objhdr-$(CONFIG_MODULES) += $(LDFLAGS_MODULE_PREREQ) should be ok since these are all generated. Not sure where to stick the sources of LDFLAGS_MODULE_PREREQ for installation though. Just a thought.. Broken on 2.6.27.4, too. Still broken on 2.6.28.3. The patch above fixes the build in case I have write access to the source tree, but this is a new requirement, in the past only read access was enough. (For example when building as a user and the source tree is installed from a distro package.) Still broken in 2.6.30.5. Created attachment 23154 [details] Fix linking modules against crtsavres.o Should export the target .o file, as suggested in comment# 4 by Olaf Hering. It seems that LDFLAGS_MODULE_PREREQ as provided by these patches should be built from some sort of prepare target (potentially modules_prepare?). This is because, as it stands currently it is not possible to build a kernel's external modules using the provided patches in parallel (i.e using DistCC or make -j) Since each module is now forced to rebuild the LDFALGS_MODULE_PREREQ target, each thread has the potential to trample over another's compilation. If this is still seen on modern kernels then please re-open/update This issue is still there in 3.14 and 3.15-rc4. arch/powerpc/lib/crtsavres.o is needed to build external modules, but is not created by 'make modules_prepare' That still happens on 3.17. The module doesn't even need to be external. Compiling with M=<some module> also causes the compilation breakage: $ LANG=C PATH=/opt/gcc-4.9.1-nolibc/powerpc64-linux/bin:$PATH CROSS_COMPILE=powerpc64-linux- make ARCH=powerpc M=drivers/media/ WARNING: Symbol version dump ./Module.symvers is missing; modules will have no dependencies and modversions. Building modules, stage 2. MODPOST 562 modules LD [M] drivers/media//common/b2c2/b2c2-flexcop.ko powerpc64-linux-ld: cannot find arch/powerpc/lib/crtsavres.o: No such file or directory LD [M] drivers/media//common/btcx-risc.ko make[1]: *** [drivers/media//common/b2c2/b2c2-flexcop.ko] Error 1 make[1]: *** Waiting for unfinished jobs.... powerpc64-linux-ld: cannot find arch/powerpc/lib/crtsavres.o: No such file or directory make[1]: *** [drivers/media//common/btcx-risc.ko] Error 1 Still present in 4.5.0 Reference from Debian BTS: https://bugs.debian.org/823224 Still present in 4.9.y Just removing the KBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o make it work on ppc64le. The crtsavres.o seems to be a part of gcc nowdays? Correction, removing it makes it build. I haven't tested if it actually runs. The commit that introduced it is da3de6df33f5f42ff9dc40093fbc884f524c9a49 ([POWERPC] Fix -Os kernel builds with newer gcc versions) Seems like commit efe0160cfd40a99c052a00e174787c1f4158a9cd removes it for binutils >= 2.25 Can you check it works for you now ? I so, maybe the simplest solution is to wait until binutils minimum version is at least 2.25. For the time being the minimum is 2.23 |