* Re: linux-next: build failure after merge of the kbuild tree
[not found] <20110420082514.a9ec4d68.sfr@canb.auug.org.au>
@ 2011-04-20 13:50 ` Michal Marek
0 siblings, 0 replies; 5+ messages in thread
From: Michal Marek @ 2011-04-20 13:50 UTC (permalink / raw)
To: Stephen Rothwell; +Cc: linux-next, linux-kernel, linux-kbuild
On Wed, Apr 20, 2011 at 08:25:14AM +1000, Stephen Rothwell wrote:
> Hi Michal,
>
> After merging the kbuild tree, today's linux-next build (s390 allnoconfig)
> failed like this:
>
> /opt/crosstool/gcc-4.3.2-nolibc/bin/s390x-linux-ar: illegal option -- D
>
> Caused by commit 09ff9fecc039 ("kbuild: Use the deterministic mode of ar").
>
> $ /opt/crosstool/gcc-4.3.2-nolibc/bin/s390x-linux-ar --version
> GNU ar (GNU Binutils) 2.19
>
> I presume that this version of ar is now too old to build the kernel?
> Documentation/Changes only mentions Binutils verion 2.12.
Sorry about that, the following patch should fix it.
Michal
Subject: [PATCH] kbuild: Fix build with binutils <= 2.19
The D option of ar is only available in newer versions.
Signed-off-by: Michal Marek <mmarek@suse.cz>
diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt
index 5d145bb..40e082b 100644
--- a/Documentation/kbuild/makefiles.txt
+++ b/Documentation/kbuild/makefiles.txt
@@ -955,6 +955,11 @@ When kbuild executes, the following steps are followed (roughly):
used when linking modules. This is often a linker script.
From commandline LDFLAGS_MODULE shall be used (see kbuild.txt).
+ KBUILD_ARFLAGS Options for $(AR) when creating archives
+
+ $(KBUILD_ARFLAGS) set by the top level Makefile to "D" (deterministic
+ mode) if this option is supported by $(AR).
+
--- 6.2 Add prerequisites to archprepare:
The archprepare: rule is used to list prerequisites that need to be
diff --git a/Makefile b/Makefile
index c3bd316..d7c4231 100644
--- a/Makefile
+++ b/Makefile
@@ -382,6 +382,7 @@ export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE CFLAGS_GCOV
export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_LDFLAGS_MODULE
export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL
+export KBUILD_ARFLAGS
# When compiling out-of-tree modules, put MODVERDIR in the module
# tree rather than in the kernel tree. The kernel tree might
@@ -612,6 +613,9 @@ KBUILD_CFLAGS += $(call cc-option,-fno-strict-overflow)
# conserve stack if available
KBUILD_CFLAGS += $(call cc-option,-fconserve-stack)
+# use the deterministic mode of AR if available
+KBUILD_ARFLAGS := $(call ar-option,D)
+
# check for 'asm goto'
ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC)), y)
KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index ed2773e..fae2d8d 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -141,6 +141,11 @@ cc-ldoption = $(call try-run,\
ld-option = $(call try-run,\
$(CC) /dev/null -c -o "$$TMPO" ; $(LD) $(1) "$$TMPO" -o "$$TMP",$(1),$(2))
+# ar-option
+# Usage: KBUILD_ARFLAGS := $(call ar-option,D)
+# Important: no spaces around options
+ar-option = $(call try-run, $(AR) rc$(1) "$$TMP",$(1),$(2))
+
######
###
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 5f87d37..e1244ef 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -345,7 +345,7 @@ quiet_cmd_link_o_target = LD $@
cmd_link_o_target = $(if $(strip $(obj-y)),\
$(LD) $(ld_flags) -r -o $@ $(filter $(obj-y), $^) \
$(cmd_secanalysis),\
- rm -f $@; $(AR) rcsD $@)
+ rm -f $@; $(AR) rcs$(KBUILD_ARFLAGS) $@)
$(builtin-target): $(obj-y) FORCE
$(call if_changed,link_o_target)
@@ -371,7 +371,7 @@ $(modorder-target): $(subdir-ym) FORCE
#
ifdef lib-target
quiet_cmd_link_l_target = AR $@
-cmd_link_l_target = rm -f $@; $(AR) rcsD $@ $(lib-y)
+cmd_link_l_target = rm -f $@; $(AR) rcs$(KBUILD_ARFLAGS) $@ $(lib-y)
$(lib-target): $(lib-y) FORCE
$(call if_changed,link_l_target)
^ permalink raw reply related [flat|nested] 5+ messages in thread
* linux-next: build failure after merge of the kbuild tree
@ 2016-09-15 6:08 Stephen Rothwell
2016-09-22 12:52 ` Michal Marek
0 siblings, 1 reply; 5+ messages in thread
From: Stephen Rothwell @ 2016-09-15 6:08 UTC (permalink / raw)
To: Michal Marek
Cc: linux-next, linux-kernel, Al Viro, Nicholas Piggin,
Michael Ellerman, linux-kbuild
Hi all,
After merging the dax-misc tree, today's linux-next build (powerpc
ppc44x_defconfig) failed like this:
arch/powerpc/kernel/built-in.o: In function `__ksymtab_clear_pages':
(___ksymtab+clear_pages+0x0): undefined reference to `clear_pages'
Caused by commit
9445aa1a3062 ("ppc: move exports to definitions")
I applied the following fix patch:
From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Thu, 15 Sep 2016 16:04:12 +1000
Subject: [PATCH] ppc: there is no clear_pages to export
Fixes: 9445aa1a3062 ("ppc: move exports to definitions")
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
arch/powerpc/kernel/misc_32.S | 1 -
1 file changed, 1 deletion(-)
diff --git a/arch/powerpc/kernel/misc_32.S b/arch/powerpc/kernel/misc_32.S
index ea26a9181586..f5156105c5f3 100644
--- a/arch/powerpc/kernel/misc_32.S
+++ b/arch/powerpc/kernel/misc_32.S
@@ -453,7 +453,6 @@ END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE)
stw r7,8(r3); \
stw r8,12(r3); \
stwu r9,16(r3)
-EXPORT_SYMBOL(clear_pages)
_GLOBAL(copy_page)
addi r3,r3,-4
--
2.8.1
--
Cheers,
Stephen Rothwell
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: linux-next: build failure after merge of the kbuild tree
2016-09-15 6:08 Stephen Rothwell
@ 2016-09-22 12:52 ` Michal Marek
0 siblings, 0 replies; 5+ messages in thread
From: Michal Marek @ 2016-09-22 12:52 UTC (permalink / raw)
To: Stephen Rothwell
Cc: linux-next, linux-kernel, Al Viro, Nicholas Piggin,
Michael Ellerman, linux-kbuild
On 2016-09-15 08:08, Stephen Rothwell wrote:
> Hi all,
>
> After merging the dax-misc tree, today's linux-next build (powerpc
> ppc44x_defconfig) failed like this:
>
> arch/powerpc/kernel/built-in.o: In function `__ksymtab_clear_pages':
> (___ksymtab+clear_pages+0x0): undefined reference to `clear_pages'
>
> Caused by commit
>
> 9445aa1a3062 ("ppc: move exports to definitions")
>
> I applied the following fix patch:
>
> From: Stephen Rothwell <sfr@canb.auug.org.au>
> Date: Thu, 15 Sep 2016 16:04:12 +1000
> Subject: [PATCH] ppc: there is no clear_pages to export
>
> Fixes: 9445aa1a3062 ("ppc: move exports to definitions")
> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Applied to kbuild.git#kbuild now.
Thanks,
Michal
^ permalink raw reply [flat|nested] 5+ messages in thread
* linux-next: build failure after merge of the kbuild tree
@ 2025-08-18 4:01 Stephen Rothwell
2025-08-18 4:27 ` Nathan Chancellor
0 siblings, 1 reply; 5+ messages in thread
From: Stephen Rothwell @ 2025-08-18 4:01 UTC (permalink / raw)
To: Nathan Chancellor, Nicolas Schier
Cc: Thomas Weißschuh, KBuild Mailing List,
Linux Kernel Mailing List, Linux Next Mailing List
[-- Attachment #1: Type: text/plain, Size: 991 bytes --]
Hi all,
After merging the kbuild tree, today's linux-next build (powerpc
allyesconfig) failed like this:
/usr/bin/ld: /usr/lib/gcc/powerpc64le-linux-gnu/14/../../../powerpc64le-linux-gnu/libgcc_s.so.1: error adding symbols: file in wrong format
collect2: error: ld returned 1 exit status
make[5]: *** [scripts/Makefile.userprogs:29: samples/pfsm/pfsm-wakeup] Error 1
make[5]: Target 'samples/pfsm/' not remade because of errors.
an so on for lots more ...
Caused by commit
478494044bb4 ("kbuild: userprogs: also inherit byte order and ABI from kernel")
I have reverted that commit for today.
Build was done on ppc64le, POWER9
$ gcc --version
gcc (Debian 14.2.0-19) 14.2.0
$ ld --version
GNU ld (GNU Binutils for Debian) 2.44
CONFIG_VDSO32=y
CONFIG_CPU_BIG_ENDIAN=y
# CONFIG_CPU_LITTLE_ENDIAN is not set
CONFIG_PPC64_ELF_ABI_V2=y
CONFIG_CC_HAS_ELFV2=y
CONFIG_CC_HAS_PREFIXED=y
CONFIG_CC_HAS_PCREL=y
CONFIG_64BIT=y
--
Cheers,
Stephen Rothwell
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: linux-next: build failure after merge of the kbuild tree
2025-08-18 4:01 linux-next: build failure after merge of the kbuild tree Stephen Rothwell
@ 2025-08-18 4:27 ` Nathan Chancellor
0 siblings, 0 replies; 5+ messages in thread
From: Nathan Chancellor @ 2025-08-18 4:27 UTC (permalink / raw)
To: Stephen Rothwell
Cc: Nicolas Schier, Thomas Weißschuh, KBuild Mailing List,
Linux Kernel Mailing List, Linux Next Mailing List
On Mon, Aug 18, 2025 at 02:01:43PM +1000, Stephen Rothwell wrote:
> Hi all,
>
> After merging the kbuild tree, today's linux-next build (powerpc
> allyesconfig) failed like this:
>
> /usr/bin/ld: /usr/lib/gcc/powerpc64le-linux-gnu/14/../../../powerpc64le-linux-gnu/libgcc_s.so.1: error adding symbols: file in wrong format
> collect2: error: ld returned 1 exit status
> make[5]: *** [scripts/Makefile.userprogs:29: samples/pfsm/pfsm-wakeup] Error 1
> make[5]: Target 'samples/pfsm/' not remade because of errors.
>
> an so on for lots more ...
>
> Caused by commit
>
> 478494044bb4 ("kbuild: userprogs: also inherit byte order and ABI from kernel")
>
> I have reverted that commit for today.
>
> Build was done on ppc64le, POWER9
>
> $ gcc --version
> gcc (Debian 14.2.0-19) 14.2.0
> $ ld --version
> GNU ld (GNU Binutils for Debian) 2.44
>
> CONFIG_VDSO32=y
> CONFIG_CPU_BIG_ENDIAN=y
> # CONFIG_CPU_LITTLE_ENDIAN is not set
> CONFIG_PPC64_ELF_ABI_V2=y
> CONFIG_CC_HAS_ELFV2=y
> CONFIG_CC_HAS_PREFIXED=y
> CONFIG_CC_HAS_PCREL=y
> CONFIG_64BIT=y
Thanks a lot for the report. Now that I am looking at the test for
CONFIG_CC_CAN_LINK, I am not sure that change is fully correct because
those additional flags are not accounted for in that test. We would need
something like this but if I understand correctly, the filtering of the
flags would need to happen much earlier that it currently does. I have
dropped that change from kbuild-next for now. Thomas, please investigate
and send me a new patch.
Cheers,
Nathan
diff --git a/init/Kconfig b/init/Kconfig
index 836320251219..ab8aa6ab8aa4 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -84,8 +84,8 @@ config RUSTC_LLVM_VERSION
config CC_CAN_LINK
bool
- default $(success,$(srctree)/scripts/cc-can-link.sh $(CC) $(CLANG_FLAGS) $(USERCFLAGS) $(USERLDFLAGS) $(m64-flag)) if 64BIT
- default $(success,$(srctree)/scripts/cc-can-link.sh $(CC) $(CLANG_FLAGS) $(USERCFLAGS) $(USERLDFLAGS) $(m32-flag))
+ default $(success,$(srctree)/scripts/cc-can-link.sh $(CC) $(CLANG_FLAGS) $(KBUILD_USERCFLAGS) $(KBUILD_USERLDFLAGS) $(m64-flag)) if 64BIT
+ default $(success,$(srctree)/scripts/cc-can-link.sh $(CC) $(CLANG_FLAGS) $(KBUILD_USERCFLAGS) $(KBUILD_USERLDFLAGS) $(m32-flag))
# Fixed in GCC 14, 13.3, 12.4 and 11.5
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113921
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-08-18 4:27 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-18 4:01 linux-next: build failure after merge of the kbuild tree Stephen Rothwell
2025-08-18 4:27 ` Nathan Chancellor
-- strict thread matches above, loose matches on Subject: below --
2016-09-15 6:08 Stephen Rothwell
2016-09-22 12:52 ` Michal Marek
[not found] <20110420082514.a9ec4d68.sfr@canb.auug.org.au>
2011-04-20 13:50 ` Michal Marek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).