Skip to contentSkip to conversation

kbuild: New 'cc-fullversion' macro

PATCH In review Segher Boessenkool 2 participants 5 messages May 19, 2007 – May 29, 2007 2 messages not in the archive

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

PATCH 1/2 kbuild: New 'cc-fullversion' macro

Prints a six-digit string including the GCC patchlevel. Also fix the 'usage' comment for cc-version.

---
 scripts/Kbuild.include |    7 ++++++-
 scripts/gcc-version.sh |   15 ++++++++++++---
 2 files changed, 18 insertions(+), 4 deletions(-)
scripts/Kbuild.include +6 -1
index 06c1a37..677bc6c 100644
@@ -100,9 +100,14 @@ cc-option-align = $(subst -functions=0,,\
 	$(call cc-option,-falign-functions=0,-malign-functions=0))
 
 # cc-version
-# Usage gcc-ver := $(call cc-version,$(CC))
+# Usage gcc-ver := $(call cc-version)
 cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh $(CC))
 
+# cc-fullversion
+# Usage gcc-ver := $(call cc-fullversion)
+cc-fullversion = $(shell $(CONFIG_SHELL) \
+	$(srctree)/scripts/gcc-version.sh -p $(CC))
+
 # cc-ifversion
 # Usage:  EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1)
 cc-ifversion = $(shell [ $(call cc-version, $(CC)) $(1) $(2) ] && echo $(3))
scripts/gcc-version.sh +12 -3
index bb4fbea..8a1d187 100644
@@ -1,14 +1,23 @@
 #!/bin/sh
 #
-# gcc-version gcc-command
+# gcc-version [-p] gcc-command
 #
 # Prints the gcc version of `gcc-command' in a canonical 4-digit form
 # such as `0295' for gcc-2.95, `0303' for gcc-3.3, etc.
 #
+# With the -p option, prints the patchlevel as well, for example `029503' for
+# gcc-2.95.3, `030301' for gcc-3.3.1, etc.
+#
+
+if [ $1 = "-p" ] ; then with_patchlevel=1; shift; fi
 
 compiler="$*"
 
 MAJOR=$(echo __GNUC__ | $compiler -E -xc - | tail -n 1)
 MINOR=$(echo __GNUC_MINOR__ | $compiler -E -xc - | tail -n 1)
-printf "%02d%02d\\n" $MAJOR $MINOR
-
+if [ "x$with_patchlevel" != "x" ] ; then
+	PATCHLEVEL=$(echo __GNUC_PATCHLEVEL__ | $compiler -E -xc - | tail -n 1)
+	printf "%02d%02d%02d\\n" $MAJOR $MINOR $PATCHLEVEL
+else
+	printf "%02d%02d\\n" $MAJOR $MINOR
+fi
Signature · 1 line
1.5.2.rc0.g4342-dirty
#1 lore raw

PATCH 2/2 powerpc: Refuse to build 64-bit with GCC-4.2.0 and CONFIG_MODULES

...since this won't work (compiler bug, see <http://gcc.gnu.org/PR31490>).

---
 arch/powerpc/Makefile |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
arch/powerpc/Makefile +8 -0
index 6238b58..1447c83 100644
@@ -202,6 +202,14 @@ checkbin:
 			false; \
 		fi ; \
 	fi
+	@if test "$(call cc-fullversion)" = "040200" \
+	    && test "x${CONFIG_MODULES}${CONFIG_PPC64}" = "xyy" ; then \
+		echo -n '*** GCC-4.2.0 cannot compile the 64-bit powerpc ' ; \
+		echo 'kernel with modules enabled.' ; \
+		echo -n '*** Please use a different GCC version or ' ; \
+		echo 'disable kernel modules' ; \
+		false ; \
+	fi
 	@if ! /bin/echo dssall | $(AS) -many -o $(TOUT) >/dev/null 2>&1 ; then \
 		echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build ' ; \
 		echo 'correctly with old versions of binutils.' ; \
Signature · 1 line
1.5.2.rc0.g4342-dirty

A message that is not in the archive (sent off-list or not yet received): f7ff5aadda1b2962d6c45123ff944e9af6879306.1179593209.git.segher@kernel.crashing.org

A message that is not in the archive (sent off-list or not yet received): bd3cddd2f3192e3aba4d7c886e38d8d0037c3510.1179593209.git.segher@kernel.crashing.org

#4 lore raw

Re: [PATCH 2/2] powerpc: Refuse to build 64-bit with GCC-4.2.0 and CONFIG_MODULES

Quoted 1 line · Segher Boessenkool

...since this won't work (compiler bug, see <http://gcc.gnu.org/PR31490>).

Applied both and documented cc-fullversion too.

Sam

#5 lore raw

Re: [PATCH 2/2] powerpc: Refuse to build 64-bit with GCC-4.2.0 and CONFIG_MODULES

Quoted 3 lines
Quoted 1 line

...since this won't work (compiler bug, see <http://gcc.gnu.org/PR31490>).

Applied both and documented cc-fullversion too.

Thanks! For reference, where should I have documented this?

Segher

#6 lore raw

Re: [PATCH 2/2] powerpc: Refuse to build 64-bit with GCC-4.2.0 and CONFIG_MODULES

Quoted 6 lines · Segher Boessenkool
Quoted 4 lines
Quoted 2 lines

...since this won't work (compiler bug, see
<http://gcc.gnu.org/PR31490>).

Applied both and documented cc-fullversion too.

Thanks! For reference, where should I have documented this?

Documentation/kbuild/makefiles.txt

Sam