Skip to contentSkip to conversation

kbuild fixes

PATCH In review Sam Ravnborg 2 participants 7 messages Jan 19, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kbuild fixes

Hi Linus.

Please pull from:

ssh://master.kernel.org/pub/linux/kernel/git/sam/kbuild.git

This will fix the issue that executing make menuconfig and make mrproper will change permissions on /dev/null and sometimes convert it to a regular file.
gcc ... -o /dev/null was causing the trouble so we avoid it now.

Two other fixes included:

Al Viro:
cris: asm-offsets related build failure

Sam Ravnborg:
kconfig: fix /dev/null breakage
kbuild: fix build with O=..

diffstat:

 Makefile                                   |   12 ++++++------
 arch/cris/Makefile                         |    6 ++----
 scripts/kconfig/lxdialog/Makefile          |    7 +++++--
 scripts/kconfig/lxdialog/check-lxdialog.sh |   15 +++++++++------
 4 files changed, 22 insertions(+), 18 deletions(-)
#1 lore raw

PATCH 1/3 kconfig: fix /dev/null breakage

Subject: [PATCH 1/3] kconfig: fix /dev/null breakage

While running "make menuconfig" and "make mrproper" some people experienced that /dev/null suddenly changed permissions or suddenly became a regular file. The main reason was that /dev/null was used as output to gcc in the check-lxdialog.sh script and gcc did some strange things with the output file; in this case /dev/null when it errorred out.

Following patch implements a suggestion
from Bryan O'Sullivan <[email protected]> to use gcc -print-file-name=libxxx.so.

Also the Makefile is adjusted to not resolve value of HOST_EXTRACFLAGS and HOST_LOADLIBES until they are actually used. This prevents us from calling gcc when running make *clean/mrproper

Thanks to Eyal Lebedinsky <[email protected]> and Jean Delvare <[email protected]> for the first error reports.

---

 scripts/kconfig/lxdialog/Makefile          |    7 +++++--
 scripts/kconfig/lxdialog/check-lxdialog.sh |   14 +++++++++-----
 2 files changed, 14 insertions(+), 7 deletions(-)

ec29b10f689f292accf9af0bc1c00e7815f6be7b

scripts/kconfig/lxdialog/Makefile +5 -2
index fae3e29..bbf4887 100644
@@ -2,8 +2,11 @@
 #
 
 check-lxdialog  := $(srctree)/$(src)/check-lxdialog.sh
-HOST_EXTRACFLAGS:= $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags)
-HOST_LOADLIBES  := $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))
+
+# Use reursively expanded variables so we do not call gcc unless
+# we really need to do so. (Do not call gcc as part of make mrproper)
+HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags)
+HOST_LOADLIBES   = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))
  
 HOST_EXTRACFLAGS += -DLOCALE 
 
scripts/kconfig/lxdialog/check-lxdialog.sh +9 -5
index 448e353..120d624 100644
@@ -4,17 +4,17 @@
 # What library to link
 ldflags()
 {
-	echo "main() {}" | $cc -lncursesw -xc - -o /dev/null 2> /dev/null
+	$cc -print-file-name=libncursesw.so | grep -q /
 	if [ $? -eq 0 ]; then
 		echo '-lncursesw'
 		exit
 	fi
-	echo "main() {}" | $cc -lncurses -xc - -o /dev/null 2> /dev/null
+	$cc -print-file-name=libncurses.so | grep -q /
 	if [ $? -eq 0 ]; then
 		echo '-lncurses'
 		exit
 	fi
-	echo "main() {}" | $cc -lcurses -xc - -o /dev/null 2> /dev/null
+	$cc -print-file-name=libcurses.so | grep -q /
 	if [ $? -eq 0 ]; then
 		echo '-lcurses'
 		exit
@@ -36,10 +36,13 @@ ccflags()
 	fi
 }
 
-compiler=""
+# Temp file, try to clean up after us
+tmp=.lxdialog.tmp
+trap "rm -f $tmp" 0 1 2 3 15
+
 # Check if we can link to ncurses
 check() {
-	echo "main() {}" | $cc -xc - -o /dev/null 2> /dev/null
+	echo "main() {}" | $cc -xc - -o $tmp 2> /dev/null
 	if [ $? != 0 ]; then
 		echo " *** Unable to find the ncurses libraries."          1>&2
 		echo " *** make menuconfig require the ncurses libraries"  1>&2
@@ -59,6 +62,7 @@ if [ $# == 0 ]; then
 	exit 1
 fi
 
+cc=""
 case "$1" in
 	"-check")
 		shift
Signature · 1 line
1.0.GIT
#2 lore raw

Re: [PATCH 1/3] kconfig: fix /dev/null breakage

Quoted 4 lines

Following patch implements a suggestion
from Bryan O'Sullivan <[email protected]> to
use gcc -print-file-name=libxxx.so.

Just for completeness: Does it work with all gccs supported?

Jan Engelhardt

#3 lore raw

Re: [PATCH 1/3] kconfig: fix /dev/null breakage

Quoted 6 lines · Jan Engelhardt
Quoted 4 lines

Following patch implements a suggestion
from Bryan O'Sullivan <[email protected]> to
use gcc -print-file-name=libxxx.so.

Just for completeness: Does it work with all gccs supported?

It has been used like this:
NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)

for a few months in the main Makefile.
So I assume yes.

Sam

#4 lore raw

PATCH 2/3 cris: asm-offsets related build failure

In reply to Sam Ravnborg

Subject: [PATCH 2/3] cris: asm-offsets related build failure
From: Al Viro <[email protected]>
Date: 1137697395 +0000

fallout from "kbuild: cris use generic asm-offsets.h support" - symlink target was wrong

---

 arch/cris/Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

6dd84484328cf9a0d7b8d100f506333a80033db5

arch/cris/Makefile +1 -1
index ea65d58..ee11469 100644
@@ -119,7 +119,7 @@ $(SRC_ARCH)/.links:
 	@ln -sfn $(SRC_ARCH)/$(SARCH)/lib $(SRC_ARCH)/lib
 	@ln -sfn $(SRC_ARCH)/$(SARCH) $(SRC_ARCH)/arch
 	@ln -sfn $(SRC_ARCH)/$(SARCH)/vmlinux.lds.S $(SRC_ARCH)/kernel/vmlinux.lds.S
-	@ln -sfn $(SRC_ARCH)/$(SARCH)/asm-offsets.c $(SRC_ARCH)/kernel/asm-offsets.c
+	@ln -sfn $(SRC_ARCH)/$(SARCH)/kernel/asm-offsets.c $(SRC_ARCH)/kernel/asm-offsets.c
 	@touch $@
 
 # Create link to sub arch includes
Signature · 1 line
1.0.GIT
#5 lore raw

PATCH 3/3 kbuild: fix build with O=..

In reply to Sam Ravnborg

Subject: [PATCH 3/3] kbuild: fix build with O=..

.kernelrelease was saved in same directory as kernel source also with make O=...
Make sure we kick in the normal logic to shift to the output directory when we build .kernelrelease after executing *config.

---

 Makefile |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

f73b6ff2f3e7981c0b9cd34a70c491dfa98fd396

Makefile +3 -2
index 37a4b67..671e6da 100644
@@ -435,7 +435,7 @@ export KBUILD_DEFCONFIG
 config %config: scripts_basic outputmakefile FORCE
 	$(Q)mkdir -p include/linux
 	$(Q)$(MAKE) $(build)=scripts/kconfig $@
-	$(Q)$(MAKE) .kernelrelease
+	$(Q)$(MAKE) -C $(srctree) KBUILD_SRC= .kernelrelease
 
 else
 # ===========================================================================
@@ -1265,7 +1265,8 @@ define cmd_tags
 	CTAGSF=`ctags --version | grep -i exuberant >/dev/null &&     \
                 echo "-I __initdata,__exitdata,__acquires,__releases  \
                       -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL              \
-                      --extra=+f --c-kinds=+px"`;                     \
+                      --extra=+f --c-kinds=+px                        \
+		      --regex-asm=/ENTRY\(([^)]*)\).*/\1/"`;          \
                 $(all-sources) | xargs ctags $$CTAGSF -a
 endef
 
Signature · 1 line
1.0.GIT
#6 lore raw
In reply to Sam Ravnborg
Quoted 5 lines · Sam Ravnborg

Hi Linus.

Please pull from:

ssh://master.kernel.org/pub/linux/kernel/git/sam/kbuild.git

Make that:
ssh://master.kernel.org/pub/scm/linux/kernel/git/sam/kbuild.git

Sam