This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[arm-8-branch] Add Linaro version string and macros
- From: Yvan Roux <yvan dot roux at linaro dot org>
- To: gcc-patches at gcc dot gnu dot org, Ramana Radhakrishnan <ramana dot gcc at googlemail dot com>
- Date: Fri, 10 Aug 2018 12:09:12 +0200
- Subject: [arm-8-branch] Add Linaro version string and macros
Hi,
This patch adds Linaro version string and release macros to ARM GCC 8
vendor branch.
Ok to commit?
Thanks
Yvan
gcc/ChangeLog
2018-08-10 Yvan Roux <yvan.roux@linaro.org>
* LINARO-VERSION: New file.
* configure.ac: Add Linaro version string.
* configure: Regenerate.
* Makefile.in (LINAROVER, LINAROVER_C, LINAROVER_S): Define.
(CFLAGS-cppbuiltin.o): Add LINAROVER macro definition.
(cppbuiltin.o): Depend on $(LINAROVER).
* cppbuiltin.c (parse_linarover): New.
(define_GNUC__): Define __LINARO_RELEASE__ and __LINARO_SPIN__ macros.
Index: gcc/LINARO-VERSION
===================================================================
--- gcc/LINARO-VERSION (nonexistent)
+++ gcc/LINARO-VERSION (working copy)
@@ -0,0 +1 @@
+8.2-2018.08~dev
Index: gcc/Makefile.in
===================================================================
--- gcc/Makefile.in (revision 263464)
+++ gcc/Makefile.in (working copy)
@@ -854,10 +854,12 @@
DEVPHASE := $(srcdir)/DEV-PHASE # experimental, prerelease, ""
DATESTAMP := $(srcdir)/DATESTAMP # YYYYMMDD or empty
REVISION := $(srcdir)/REVISION # [BRANCH revision XXXXXX]
+LINAROVER := $(srcdir)/LINARO-VERSION # M.x-YYYY.MM[-S][~dev]
BASEVER_c := $(shell cat $(BASEVER))
DEVPHASE_c := $(shell cat $(DEVPHASE))
DATESTAMP_c := $(shell cat $(DATESTAMP))
+LINAROVER_c := $(shell cat $(LINAROVER))
ifeq (,$(wildcard $(REVISION)))
REVISION_c :=
@@ -884,6 +886,7 @@
"\"$(if $(DEVPHASE_c)$(filter-out 0,$(PATCHLEVEL_c)), $(DATESTAMP_c))\""
PKGVERSION_s:= "\"@PKGVERSION@\""
BUGURL_s := "\"@REPORT_BUGS_TO@\""
+LINAROVER_s := "\"$(LINAROVER_c)\""
PKGVERSION := @PKGVERSION@
BUGURL_TEXI := @REPORT_BUGS_TEXI@
@@ -2883,8 +2886,9 @@
-DSTANDARD_EXEC_PREFIX=\"$(libdir)/gcc/\" \
@TARGET_SYSTEM_ROOT_DEFINE@
-CFLAGS-cppbuiltin.o += $(PREPROCESSOR_DEFINES) -DBASEVER=$(BASEVER_s)
-cppbuiltin.o: $(BASEVER)
+CFLAGS-cppbuiltin.o += $(PREPROCESSOR_DEFINES) -DBASEVER=$(BASEVER_s) \
+ -DLINAROVER=$(LINAROVER_s)
+cppbuiltin.o: $(BASEVER) $(LINAROVER)
CFLAGS-cppdefault.o += $(PREPROCESSOR_DEFINES)
Index: gcc/configure
===================================================================
--- gcc/configure (revision 263464)
+++ gcc/configure (working copy)
@@ -1726,7 +1726,8 @@
--with-stabs arrange to use stabs instead of host debug format
--with-dwarf2 force the default debug format to be DWARF 2
--with-specs=SPECS add SPECS to driver command-line processing
- --with-pkgversion=PKG Use PKG in the version string in place of "GCC"
+ --with-pkgversion=PKG Use PKG in the version string in place of "Linaro
+ GCC `cat $srcdir/LINARO-VERSION`"
--with-bugurl=URL Direct users to URL to report a bug
--with-multilib-list select multilibs (AArch64, SH and x86-64 only)
--with-gnu-ld assume the C compiler uses GNU ld default=no
@@ -7649,7 +7650,7 @@
*) PKGVERSION="($withval) " ;;
esac
else
- PKGVERSION="(GCC) "
+ PKGVERSION="(Linaro GCC `cat $srcdir/LINARO-VERSION`) "
fi
@@ -18448,7 +18449,7 @@
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 18451 "configure"
+#line 18452 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -18554,7 +18555,7 @@
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 18557 "configure"
+#line 18558 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
Index: gcc/configure.ac
===================================================================
--- gcc/configure.ac (revision 263464)
+++ gcc/configure.ac (working copy)
@@ -929,7 +929,7 @@
)
AC_SUBST(CONFIGURE_SPECS)
-ACX_PKGVERSION([GCC])
+ACX_PKGVERSION([Linaro GCC `cat $srcdir/LINARO-VERSION`])
ACX_BUGURL([https://gcc.gnu.org/bugs/])
# Sanity check enable_languages in case someone does not run the toplevel
Index: gcc/cppbuiltin.c
===================================================================
--- gcc/cppbuiltin.c (revision 263464)
+++ gcc/cppbuiltin.c (working copy)
@@ -53,18 +53,41 @@
*patchlevel = s_patchlevel;
}
+/* Parse a LINAROVER version string of the format "M.m-year.month[-spin][~dev]"
+ to create Linaro release number YYYYMM and spin version. */
+static void
+parse_linarover (int *release, int *spin)
+{
+ static int s_year = -1, s_month, s_spin;
+ if (s_year == -1)
+ if (sscanf (LINAROVER, "%*[^-]-%d.%d-%d", &s_year, &s_month, &s_spin) != 3)
+ {
+ sscanf (LINAROVER, "%*[^-]-%d.%d", &s_year, &s_month);
+ s_spin = 0;
+ }
+
+ if (release)
+ *release = s_year * 100 + s_month;
+
+ if (spin)
+ *spin = s_spin;
+}
+
/* Define __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__ and __VERSION__. */
static void
define__GNUC__ (cpp_reader *pfile)
{
- int major, minor, patchlevel;
+ int major, minor, patchlevel, linaro_release, linaro_spin;
parse_basever (&major, &minor, &patchlevel);
+ parse_linarover (&linaro_release, &linaro_spin);
cpp_define_formatted (pfile, "__GNUC__=%d", major);
cpp_define_formatted (pfile, "__GNUC_MINOR__=%d", minor);
cpp_define_formatted (pfile, "__GNUC_PATCHLEVEL__=%d", patchlevel);
cpp_define_formatted (pfile, "__VERSION__=\"%s\"", version_string);
+ cpp_define_formatted (pfile, "__LINARO_RELEASE__=%d", linaro_release);
+ cpp_define_formatted (pfile, "__LINARO_SPIN__=%d", linaro_spin);
cpp_define_formatted (pfile, "__ATOMIC_RELAXED=%d", MEMMODEL_RELAXED);
cpp_define_formatted (pfile, "__ATOMIC_SEQ_CST=%d", MEMMODEL_SEQ_CST);
cpp_define_formatted (pfile, "__ATOMIC_ACQUIRE=%d", MEMMODEL_ACQUIRE);