This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH GCC5.0: conditionally skip gcc_version in plugin-version.h
- From: Basile Starynkevitch <basile at starynkevitch dot net>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 13 Nov 2014 07:52:27 +0100
- Subject: Re: PATCH GCC5.0: conditionally skip gcc_version in plugin-version.h
- Authentication-results: sourceware.org; auth=none
- References: <20141112125512 dot GA26644 at ovh dot starynkevitch dot net> <20141112131207 dot GY5026 at tucnak dot redhat dot com> <20141112132022 dot GA26839 at ovh dot starynkevitch dot net> <20141112132913 dot GB5026 at tucnak dot redhat dot com> <20141112133646 dot GA26947 at ovh dot starynkevitch dot net>
On Wed, 2014-11-12 at 14:36 +0100, Basile Starynkevitch wrote:
> On Wed, Nov 12, 2014 at 02:29:13PM +0100, Jakub Jelinek wrote:
> > On Wed, Nov 12, 2014 at 02:20:22PM +0100, Basile Starynkevitch wrote:
> > > Most plugin don't need any configure, because they are installed in
> > > a version specific directory (like /usr/lib/gcc/x86_64-linux-gnu/4.9/plugin
> > > for example). I don't think it is wise to require plugin to be
> > > autoconf-configurable. Their Makefile simply uses
> > > $(shell gcc -print-file-name=plugin), there is no need to complex
> > > autoconf machinery.
> >
> > If you use $(shell gcc -print-file-name=plugin), there is no point
> > to include plugin-version.h, just use __GNUC__/__GNUC_MINOR__ ?
>
>
> I could compile a plugin (notably for a GCC cross-compiler) with a GCC version
> different of the GCC targetting the plugin. I could also compile a
> plugin with Clang or some other non-GCC compiler. In both cases
> plugin-version.h is needed with its GCCPLUGIN_VERSION.
I'm trying to patch GCC to get a plugin-version.c file generated, but I
can't get that work. Here is attached a buggy patch against trunk svn
r217460 which does not work. Could any one help me to catch my mistake
please?
Regards.
--
Basile STARYNKEVITCH http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mine, sont seulement les miennes} ***
Index: fixincludes/fixincl.x
===================================================================
--- fixincludes/fixincl.x (revision 217460)
+++ fixincludes/fixincl.x (working copy)
@@ -1,12 +1,12 @@
/* -*- buffer-read-only: t -*- vi: set ro:
- *
+ *
* DO NOT EDIT THIS FILE (fixincl.x)
- *
- * It has been AutoGen-ed October 21, 2014 at 10:18:16 AM by AutoGen 5.16.2
+ *
+ * It has been AutoGen-ed
* From the definitions inclhack.def
* and the template file fixincl
*/
-/* DO NOT SVN-MERGE THIS FILE, EITHER Tue Oct 21 10:18:17 CEST 2014
+/* DO NOT SVN-MERGE THIS FILE, EITHER Thu Nov 13 07:50:38 MET 2014
*
* You must regenerate it. Use the ./genfixes script.
*
Index: gcc/Makefile.in
===================================================================
--- gcc/Makefile.in (revision 217460)
+++ gcc/Makefile.in (working copy)
@@ -1324,6 +1324,7 @@
opts-global.o \
passes.o \
plugin.o \
+ plugin-version.o \
postreload-gcse.o \
postreload.o \
predict.o \
Index: gcc/configure.ac
===================================================================
--- gcc/configure.ac (revision 217460)
+++ gcc/configure.ac (working copy)
@@ -1656,7 +1656,25 @@
else
gcc_REVISION=""
fi
+
+cat > plugin-version.c <<EOF
+/* generated file plugin-version.c for GCC */
+#include "plugin-version.h"
+static const char basever[] = "$gcc_BASEVER";
+static const char datestamp[] = "$gcc_DATESTAMP";
+static const char devphase[] = "$gcc_DEVPHASE";
+static const char revision[] = "$gcc_REVISION";
+
+/* FIXME plugins: We should make the version information more precise.
+ One way to do is to add a checksum. */
+
+const struct plugin_gcc_version gcc_version = {basever, datestamp,
+ devphase, revision,
+ configuration_arguments};
+EOF
+
cat > plugin-version.h <<EOF
+/* generated header plugin-version.h for GCC */
#include "configargs.h"
#define GCCPLUGIN_VERSION_MAJOR `echo $gcc_BASEVER | sed -e 's/^\([0-9]*\).*$/\1/'`
@@ -1664,18 +1682,9 @@
#define GCCPLUGIN_VERSION_PATCHLEVEL `echo $gcc_BASEVER | sed -e 's/^[0-9]*\.[0-9]*\.\([0-9]*\)$/\1/'`
#define GCCPLUGIN_VERSION (GCCPLUGIN_VERSION_MAJOR*1000 + GCCPLUGIN_VERSION_MINOR)
-static char basever[] = "$gcc_BASEVER";
-static char datestamp[] = "$gcc_DATESTAMP";
-static char devphase[] = "$gcc_DEVPHASE";
-static char revision[] = "$gcc_REVISION";
+extern const struct plugin_gcc_version gcc_version;
+EOF
-/* FIXME plugins: We should make the version information more precise.
- One way to do is to add a checksum. */
-
-static struct plugin_gcc_version gcc_version = {basever, datestamp,
- devphase, revision,
- configuration_arguments};
-EOF
changequote([,])dnl
# Internationalization