public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 3/5] libcc1: set debug compile: Display GCC driver filename
  2015-04-21 21:41 [PATCH 1/5] libcc1: Make libcc1.so->libcc1.so.0 Jan Kratochvil
                   ` (2 preceding siblings ...)
  2015-04-21 21:41 ` [PATCH 2/5] libcc1: Use libcc1.so.0->libcc1.so.1 Jan Kratochvil
@ 2015-04-21 21:41 ` Jan Kratochvil
  2015-04-22 13:12   ` Jeff Law
  2015-04-22 13:13 ` [PATCH 1/5] libcc1: Make libcc1.so->libcc1.so.0 Jeff Law
  4 siblings, 1 reply; 10+ messages in thread
From: Jan Kratochvil @ 2015-04-21 21:41 UTC (permalink / raw)
  To: gcc-patches; +Cc: Phil Muldoon

Hi,

as discussed in
	How to use compile & execute function in GDB
	https://sourceware.org/ml/gdb/2015-04/msg00026.html

GDB currently searches for /usr/bin/ARCH-OS-gcc and chooses one but it does not
display which one.  It cannot, GCC method set_arguments() does not yet know
whether 'set debug compile' is enabled or not.

Unfortunately this changes libcc1 API in an incompatible way.  There is
a possibility of a hack to keep the API the same - one could pass "-v" option
explicitly to set_arguments(), set_arguments() could compare the "-v" string
and print the GCC filename accordingly.  Then the 'verbose' parameter of
compile() would lose its meaning.  What do you think?

GDB counterpart:
	[PATCH 3/4] compile: set debug compile: Display GCC driver filename
	https://sourceware.org/ml/gdb-patches/2015-04/msg00807.html
	Message-ID: <20150421213649.14147.79719.stgit@host1.jankratochvil.net>


Jan


include/ChangeLog
2015-04-21  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gcc-interface.h (enum gcc_base_api_version): Add comment to
	GCC_FE_VERSION_1.
	(struct gcc_base_vtable): Move parameter verbose from compile to
	set_arguments.

libcc1/ChangeLog
2015-04-21  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* libcc1.cc: Include intl.h.
	(struct libcc1): Add field verbose.
	(libcc1::libcc1): Initialize it.
	(libcc1_set_arguments): Add parameter verbose, implement it.
	(libcc1_compile): Remove parameter verbose, use self's field instead.
---
 include/gcc-interface.h |   14 +++++++-------
 libcc1/libcc1.cc        |   22 +++++++++++++++++-----
 2 files changed, 24 insertions(+), 12 deletions(-)

diff --git a/include/gcc-interface.h b/include/gcc-interface.h
index dcfa6ce..dd9fd50 100644
--- a/include/gcc-interface.h
+++ b/include/gcc-interface.h
@@ -45,6 +45,8 @@ struct gcc_base_context;
 enum gcc_base_api_version
 {
   GCC_FE_VERSION_0 = 0,
+
+  /* Parameter verbose has been moved from compile to set_arguments.  */
   GCC_FE_VERSION_1 = 1,
 };
 
@@ -71,14 +73,15 @@ struct gcc_base_vtable
      The arguments are copied by GCC.  ARGV need not be
      NULL-terminated.  The arguments must be set separately for each
      compilation; that is, after a compile is requested, the
-     previously-set arguments cannot be reused.
+     previously-set arguments cannot be reused.  VERBOSE can be set
+     to cause GCC to print some information as it works.  
 
      This returns NULL on success.  On failure, returns a malloc()d
      error message.  The caller is responsible for freeing it.  */
 
   char *(*set_arguments) (struct gcc_base_context *self,
 			  const char *triplet_regexp,
-			  int argc, char **argv);
+			  int argc, char **argv, int /* bool */ verbose);
 
   /* Set the file name of the program to compile.  The string is
      copied by the method implementation, but the caller must
@@ -95,13 +98,10 @@ struct gcc_base_vtable
 			      void *datum);
 
   /* Perform the compilation.  FILENAME is the name of the resulting
-     object file.  VERBOSE can be set to cause GCC to print some
-     information as it works.  Returns true on success, false on
-     error.  */
+     object file.  Returns true on success, false on error.  */
 
   int /* bool */ (*compile) (struct gcc_base_context *self,
-			     const char *filename,
-			     int /* bool */ verbose);
+			     const char *filename);
 
   /* Destroy this object.  */
 
diff --git a/libcc1/libcc1.cc b/libcc1/libcc1.cc
index afda023..d36073d 100644
--- a/libcc1/libcc1.cc
+++ b/libcc1/libcc1.cc
@@ -38,6 +38,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "xregex.h"
 #include "findcomp.hh"
 #include "compiler-name.h"
+#include "intl.h"
 
 struct libcc1;
 
@@ -66,6 +67,9 @@ struct libcc1 : public gcc_c_context
 
   std::vector<std::string> args;
   std::string source_file;
+
+  /* Non-zero as an equivalent to gcc driver option "-v".  */
+  bool verbose;
 };
 
 // A local subclass of connection that holds a back-pointer to the
@@ -97,7 +101,8 @@ libcc1::libcc1 (const gcc_base_vtable *v,
     print_function (NULL),
     print_datum (NULL),
     args (),
-    source_file ()
+    source_file (),
+    verbose (false)
 {
   base.ops = v;
   c_ops = cv;
@@ -309,13 +314,19 @@ make_regexp (const char *triplet_regexp, const char *compiler)
 static char *
 libcc1_set_arguments (struct gcc_base_context *s,
 		      const char *triplet_regexp,
-		      int argc, char **argv)
+		      int argc, char **argv, int verbose)
 {
   libcc1 *self = (libcc1 *) s;
   regex_t triplet;
   int code;
 
+  self->verbose = verbose != 0;
+
   std::string rx = make_regexp (triplet_regexp, COMPILER_NAME);
+  // Simulate fnotice by fprintf.
+  if (self->verbose)
+    fprintf (stderr, _("searching for compiler matching regex %s\n"),
+	     rx.c_str());
   code = regcomp (&triplet, rx.c_str (), REG_EXTENDED | REG_NOSUB);
   if (code != 0)
     {
@@ -341,6 +352,8 @@ libcc1_set_arguments (struct gcc_base_context *s,
 		     (char *) NULL);
     }
   regfree (&triplet);
+  if (self->verbose)
+    fprintf (stderr, _("found compiler %s\n"), compiler.c_str());
 
   self->args.push_back (compiler);
 
@@ -434,8 +447,7 @@ fork_exec (libcc1 *self, char **argv, int spair_fds[2], int stderr_fds[2])
 
 static int
 libcc1_compile (struct gcc_base_context *s,
-		const char *filename,
-		int verbose)
+		const char *filename)
 {
   libcc1 *self = (libcc1 *) s;
 
@@ -466,7 +478,7 @@ libcc1_compile (struct gcc_base_context *s,
   self->args.push_back ("-c");
   self->args.push_back ("-o");
   self->args.push_back (filename);
-  if (verbose)
+  if (self->verbose)
     self->args.push_back ("-v");
 
   self->connection = new libcc1_connection (fds[0], stderr_fds[0], self);

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 4/5] libcc1: Add 'set compile-gcc'
  2015-04-21 21:41 [PATCH 1/5] libcc1: Make libcc1.so->libcc1.so.0 Jan Kratochvil
  2015-04-21 21:41 ` [PATCH 5/5] libcc1: 'set debug compile': Display absolute GCC driver filename Jan Kratochvil
@ 2015-04-21 21:41 ` Jan Kratochvil
  2015-04-22 13:10   ` Jeff Law
  2015-04-21 21:41 ` [PATCH 2/5] libcc1: Use libcc1.so.0->libcc1.so.1 Jan Kratochvil
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Jan Kratochvil @ 2015-04-21 21:41 UTC (permalink / raw)
  To: gcc-patches; +Cc: Phil Muldoon

as discussed in
	How to use compile & execute function in GDB
	https://sourceware.org/ml/gdb/2015-04/msg00026.html

GDB currently searches for /usr/bin/ARCH-OS-gcc and chooses one but one cannot
override which one.  GDB would provide new option 'set compile-gcc'.

This patch does not change the libcc1 API as it overloads the triplet_regexp
parameter of GCC's set_arguments according to:

+  if (access (triplet_regexp, X_OK) == 0)

GDB counterpart:
	[PATCH 4/4] compile: Add 'set compile-gcc'
	https://sourceware.org/ml/gdb-patches/2015-04/msg00808.html
	Message-ID: <20150421213657.14147.60506.stgit@host1.jankratochvil.net>


Jan


include/ChangeLog
2015-04-21  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gcc-interface.h (enum gcc_base_api_version): Add comment to
	GCC_FE_VERSION_1.
	(struct gcc_base_vtable): Describe triplet_regexp parameter overload
	for set_arguments.

libcc1/ChangeLog
2015-04-21  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* libcc1.cc (libcc1_set_arguments): Implement filenames for
	triplet_regexp.
---
 include/gcc-interface.h |    7 ++++-
 libcc1/libcc1.cc        |   62 +++++++++++++++++++++++++++--------------------
 2 files changed, 41 insertions(+), 28 deletions(-)

diff --git a/include/gcc-interface.h b/include/gcc-interface.h
index dd9fd50..a15edf7 100644
--- a/include/gcc-interface.h
+++ b/include/gcc-interface.h
@@ -46,7 +46,9 @@ enum gcc_base_api_version
 {
   GCC_FE_VERSION_0 = 0,
 
-  /* Parameter verbose has been moved from compile to set_arguments.  */
+  /* Parameter verbose has been moved from compile to set_arguments.
+     Parameter triplet_regexp of set_arguments can be also gcc driver
+     executable.  */
   GCC_FE_VERSION_1 = 1,
 };
 
@@ -69,7 +71,8 @@ struct gcc_base_vtable
 
   /* Set the compiler's command-line options for the next compilation.
      TRIPLET_REGEXP is a regular expression that is used to match the
-     configury triplet prefix to the compiler.
+     configury triplet prefix to the compiler; TRIPLET_REGEXP can be
+     also absolute filename  to the computer.
      The arguments are copied by GCC.  ARGV need not be
      NULL-terminated.  The arguments must be set separately for each
      compilation; that is, after a compile is requested, the
diff --git a/libcc1/libcc1.cc b/libcc1/libcc1.cc
index d36073d..e2718b0 100644
--- a/libcc1/libcc1.cc
+++ b/libcc1/libcc1.cc
@@ -322,38 +322,48 @@ libcc1_set_arguments (struct gcc_base_context *s,
 
   self->verbose = verbose != 0;
 
-  std::string rx = make_regexp (triplet_regexp, COMPILER_NAME);
-  // Simulate fnotice by fprintf.
-  if (self->verbose)
-    fprintf (stderr, _("searching for compiler matching regex %s\n"),
-	     rx.c_str());
-  code = regcomp (&triplet, rx.c_str (), REG_EXTENDED | REG_NOSUB);
-  if (code != 0)
+  std::string compiler;
+  if (access (triplet_regexp, X_OK) == 0)
     {
-      size_t len = regerror (code, &triplet, NULL, 0);
-      char err[len];
+      compiler = triplet_regexp;
+      // Simulate fnotice by fprintf.
+      if (self->verbose)
+	fprintf (stderr, _("using explicit compiler filename %s\n"),
+		 compiler.c_str());
+    }
+  else
+    {
+      std::string rx = make_regexp (triplet_regexp, COMPILER_NAME);
+      if (self->verbose)
+	fprintf (stderr, _("searching for compiler matching regex %s\n"),
+		 rx.c_str());
+      code = regcomp (&triplet, rx.c_str (), REG_EXTENDED | REG_NOSUB);
+      if (code != 0)
+	{
+	  size_t len = regerror (code, &triplet, NULL, 0);
+	  char err[len];
 
-      regerror (code, &triplet, err, len);
+	  regerror (code, &triplet, err, len);
 
-      return concat ("Could not compile regexp \"",
-		     rx.c_str (),
-		     "\": ",
-		     err,
-		     (char *) NULL);
-    }
+	  return concat ("Could not compile regexp \"",
+			 rx.c_str (),
+			 "\": ",
+			 err,
+			 (char *) NULL);
+	}
 
-  std::string compiler;
-  if (!find_compiler (triplet, &compiler))
-    {
+      if (!find_compiler (triplet, &compiler))
+	{
+	  regfree (&triplet);
+	  return concat ("Could not find a compiler matching \"",
+			 rx.c_str (),
+			 "\"",
+			 (char *) NULL);
+	}
       regfree (&triplet);
-      return concat ("Could not find a compiler matching \"",
-		     rx.c_str (),
-		     "\"",
-		     (char *) NULL);
+      if (self->verbose)
+	fprintf (stderr, _("found compiler %s\n"), compiler.c_str());
     }
-  regfree (&triplet);
-  if (self->verbose)
-    fprintf (stderr, _("found compiler %s\n"), compiler.c_str());
 
   self->args.push_back (compiler);
 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/5] libcc1: Make libcc1.so->libcc1.so.0
@ 2015-04-21 21:41 Jan Kratochvil
  2015-04-21 21:41 ` [PATCH 5/5] libcc1: 'set debug compile': Display absolute GCC driver filename Jan Kratochvil
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Jan Kratochvil @ 2015-04-21 21:41 UTC (permalink / raw)
  To: gcc-patches; +Cc: Phil Muldoon

Hi,

the next [patch 3/5] will change the libcc1.so API.  I am not sure if the API
change gets approved that way but for such case:
(1) We really need to change GCC_FE_VERSION_0 -> GCC_FE_VERSION_1, this
    feature is there for this purpose.  That is [patch 2/5].
(2) Currently GDB does only dlopen("libcc1.so") and then depending on which
    libcc1.so version it would find first it would succeed/fail.
    I guess it is more convenient to do dlopen("libcc1.so.1") instead
    (where ".1"=".x" corresponds to GCC_FE_VERSION_x).
    That is this patch (with x=0).
    GCC_C_FE_LIBCC is used only by GDB.
(3) Currently there is no backward or forward compatibility although there
    could be one implemented.  Personally I think the 'compile' feature is
    still in experimental stage so that it is OK to require last releases.
    At least in Fedora we can keep GDB<->GCC in sync.

GDB counterpart:
	[PATCH 1/4] compile: Use libcc1.so->libcc1.so.0
	https://sourceware.org/ml/gdb-patches/2015-04/msg00805.html
	Message-ID: <20150421213635.14147.15653.stgit@host1.jankratochvil.net>


Jan


include/ChangeLog
2015-04-21  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gcc-c-interface.h (GCC_C_FE_LIBCC): Quote it.  Append
	GCC_FE_VERSION_0.
---
 include/gcc-c-interface.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/gcc-c-interface.h b/include/gcc-c-interface.h
index 25ef62f..1b73e32 100644
--- a/include/gcc-c-interface.h
+++ b/include/gcc-c-interface.h
@@ -197,7 +197,7 @@ struct gcc_c_context
 /* The name of the .so that the compiler builds.  We dlopen this
    later.  */
 
-#define GCC_C_FE_LIBCC libcc1.so
+#define GCC_C_FE_LIBCC "libcc1.so." STRINGIFY (GCC_FE_VERSION_0)
 
 /* The compiler exports a single initialization function.  This macro
    holds its name as a symbol.  */

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 5/5] libcc1: 'set debug compile': Display absolute GCC driver filename
  2015-04-21 21:41 [PATCH 1/5] libcc1: Make libcc1.so->libcc1.so.0 Jan Kratochvil
@ 2015-04-21 21:41 ` Jan Kratochvil
  2015-04-22 13:09   ` Jeff Law
  2015-04-21 21:41 ` [PATCH 4/5] libcc1: Add 'set compile-gcc' Jan Kratochvil
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Jan Kratochvil @ 2015-04-21 21:41 UTC (permalink / raw)
  To: gcc-patches; +Cc: Phil Muldoon

Hi,

with the patches so far after
	(gdb) set debug compile 1
one would get:
	searching for compiler matching regex ^(x86_64|i.86)(-[^-]*)?-linux(-gnu)?-gcc$
	found compiler x86_64-unknown-linux-gnu-gcc
But I believe it is more readable to see:
	searching for compiler matching regex ^(x86_64|i.86)(-[^-]*)?-linux(-gnu)?-gcc$
	found compiler /usr/bin/x86_64-unknown-linux-gnu-gcc

I do not think the change will have functionality impact, although the filename
gets used even for executing the command.


Jan


libcc1/ChangeLog
2015-04-21  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* findcomp.cc: Include system.h.
	(search_dir): Return absolute filename.
---
 libcc1/findcomp.cc |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libcc1/findcomp.cc b/libcc1/findcomp.cc
index f02b1df..5d49e29 100644
--- a/libcc1/findcomp.cc
+++ b/libcc1/findcomp.cc
@@ -25,6 +25,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "libiberty.h"
 #include "xregex.h"
 #include "findcomp.hh"
+#include "system.h"
 
 class scanner
 {
@@ -68,7 +69,7 @@ search_dir (const regex_t &regexp, const std::string &dir, std::string *result)
     {
       if (regexec (&regexp, filename, 0, NULL, 0) == 0)
 	{
-	  *result = filename;
+	  *result = dir + DIR_SEPARATOR + filename;
 	  return true;
 	}
     }

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 2/5] libcc1: Use libcc1.so.0->libcc1.so.1
  2015-04-21 21:41 [PATCH 1/5] libcc1: Make libcc1.so->libcc1.so.0 Jan Kratochvil
  2015-04-21 21:41 ` [PATCH 5/5] libcc1: 'set debug compile': Display absolute GCC driver filename Jan Kratochvil
  2015-04-21 21:41 ` [PATCH 4/5] libcc1: Add 'set compile-gcc' Jan Kratochvil
@ 2015-04-21 21:41 ` Jan Kratochvil
  2015-04-22 13:12   ` Jeff Law
  2015-04-21 21:41 ` [PATCH 3/5] libcc1: set debug compile: Display GCC driver filename Jan Kratochvil
  2015-04-22 13:13 ` [PATCH 1/5] libcc1: Make libcc1.so->libcc1.so.0 Jeff Law
  4 siblings, 1 reply; 10+ messages in thread
From: Jan Kratochvil @ 2015-04-21 21:41 UTC (permalink / raw)
  To: gcc-patches; +Cc: Phil Muldoon

Hi,

see [patch 1/5], particularly:
(3) Currently there is no backward or forward compatibility although there
    could be one implemented.  Personally I think the 'compile' feature is
    still in experimental stage so that it is OK to require last releases.
    At least in Fedora we can keep GDB<->GCC in sync.

GDB counterpart:
	[PATCH 2/4] compile: Use libcc1.so.0->libcc1.so.1
	https://sourceware.org/ml/gdb-patches/2015-04/msg00806.html
	Message-ID: <20150421213642.14147.93210.stgit@host1.jankratochvil.net>


Jan


include/ChangeLog
2015-04-21  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gcc-c-interface.h (GCC_C_FE_LIBCC): Update it to GCC_FE_VERSION_1.
	* gcc-interface.h (enum gcc_base_api_version): Add GCC_FE_VERSION_1.

libcc1/ChangeLog
2015-04-21  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* Makefile.am (libcc1_la_LDFLAGS): Add version-info 1.
	* Makefile.in: Regenerate.
	* libcc1.cc (vtable, gcc_c_fe_context): Update it to GCC_FE_VERSION_1.
---
 include/gcc-c-interface.h |    2 +-
 include/gcc-interface.h   |    3 ++-
 libcc1/Makefile.am        |    3 ++-
 libcc1/Makefile.in        |    4 +++-
 libcc1/libcc1.cc          |    4 ++--
 5 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/include/gcc-c-interface.h b/include/gcc-c-interface.h
index 1b73e32..285c9c7 100644
--- a/include/gcc-c-interface.h
+++ b/include/gcc-c-interface.h
@@ -197,7 +197,7 @@ struct gcc_c_context
 /* The name of the .so that the compiler builds.  We dlopen this
    later.  */
 
-#define GCC_C_FE_LIBCC "libcc1.so." STRINGIFY (GCC_FE_VERSION_0)
+#define GCC_C_FE_LIBCC "libcc1.so." STRINGIFY (GCC_FE_VERSION_1)
 
 /* The compiler exports a single initialization function.  This macro
    holds its name as a symbol.  */
diff --git a/include/gcc-interface.h b/include/gcc-interface.h
index 34010f2..dcfa6ce 100644
--- a/include/gcc-interface.h
+++ b/include/gcc-interface.h
@@ -44,7 +44,8 @@ struct gcc_base_context;
 
 enum gcc_base_api_version
 {
-  GCC_FE_VERSION_0 = 0
+  GCC_FE_VERSION_0 = 0,
+  GCC_FE_VERSION_1 = 1,
 };
 
 /* The operations defined by the GCC base API.  This is the vtable for
diff --git a/libcc1/Makefile.am b/libcc1/Makefile.am
index 7a274b3..e6a94e2 100644
--- a/libcc1/Makefile.am
+++ b/libcc1/Makefile.am
@@ -63,7 +63,8 @@ libcc1plugin_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
 	$(CXXFLAGS) $(libcc1plugin_la_LDFLAGS) $(LTLDFLAGS) -o $@
 
 LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
-libcc1_la_LDFLAGS = -module -export-symbols $(srcdir)/libcc1.sym
+libcc1_la_LDFLAGS = -module -export-symbols $(srcdir)/libcc1.sym \
+	-version-info 1:0:0
 libcc1_la_SOURCES = findcomp.cc libcc1.cc names.cc names.hh $(shared_source)
 libcc1_la_LIBADD = $(libiberty)
 libcc1_la_DEPENDENCIES = $(libiberty_dep)
diff --git a/libcc1/Makefile.in b/libcc1/Makefile.in
index 1916134..ebec54c 100644
--- a/libcc1/Makefile.in
+++ b/libcc1/Makefile.in
@@ -279,7 +279,9 @@ libcc1plugin_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
 	$(CXXFLAGS) $(libcc1plugin_la_LDFLAGS) $(LTLDFLAGS) -o $@
 
 LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
-libcc1_la_LDFLAGS = -module -export-symbols $(srcdir)/libcc1.sym
+libcc1_la_LDFLAGS = -module -export-symbols $(srcdir)/libcc1.sym \
+	-version-info 1:0:0
+
 libcc1_la_SOURCES = findcomp.cc libcc1.cc names.cc names.hh $(shared_source)
 libcc1_la_LIBADD = $(libiberty)
 libcc1_la_DEPENDENCIES = $(libiberty_dep)
diff --git a/libcc1/libcc1.cc b/libcc1/libcc1.cc
index 7d7d2c1..afda023 100644
--- a/libcc1/libcc1.cc
+++ b/libcc1/libcc1.cc
@@ -504,7 +504,7 @@ libcc1_destroy (struct gcc_base_context *s)
 
 static const struct gcc_base_vtable vtable =
 {
-  GCC_FE_VERSION_0,
+  GCC_FE_VERSION_1,
   libcc1_set_arguments,
   libcc1_set_source_file,
   libcc1_set_print_callback,
@@ -523,7 +523,7 @@ struct gcc_c_context *
 gcc_c_fe_context (enum gcc_base_api_version base_version,
 		  enum gcc_c_api_version c_version)
 {
-  if (base_version != GCC_FE_VERSION_0 || c_version != GCC_C_FE_VERSION_0)
+  if (base_version != GCC_FE_VERSION_1 || c_version != GCC_C_FE_VERSION_0)
     return NULL;
 
   return new libcc1 (&vtable, &c_vtable);

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 5/5] libcc1: 'set debug compile': Display absolute GCC driver filename
  2015-04-21 21:41 ` [PATCH 5/5] libcc1: 'set debug compile': Display absolute GCC driver filename Jan Kratochvil
@ 2015-04-22 13:09   ` Jeff Law
  0 siblings, 0 replies; 10+ messages in thread
From: Jeff Law @ 2015-04-22 13:09 UTC (permalink / raw)
  To: Jan Kratochvil, gcc-patches; +Cc: Phil Muldoon

On 04/21/2015 03:41 PM, Jan Kratochvil wrote:
> Hi,
>
> with the patches so far after
> 	(gdb) set debug compile 1
> one would get:
> 	searching for compiler matching regex ^(x86_64|i.86)(-[^-]*)?-linux(-gnu)?-gcc$
> 	found compiler x86_64-unknown-linux-gnu-gcc
> But I believe it is more readable to see:
> 	searching for compiler matching regex ^(x86_64|i.86)(-[^-]*)?-linux(-gnu)?-gcc$
> 	found compiler /usr/bin/x86_64-unknown-linux-gnu-gcc
>
> I do not think the change will have functionality impact, although the filename
> gets used even for executing the command.
>
>
> Jan
>
>
> libcc1/ChangeLog
> 2015-04-21  Jan Kratochvil  <jan.kratochvil@redhat.com>
>
> 	* findcomp.cc: Include system.h.
> 	(search_dir): Return absolute filename.
OK.  Please install on the trunk.

Thanks,
Jeff

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 4/5] libcc1: Add 'set compile-gcc'
  2015-04-21 21:41 ` [PATCH 4/5] libcc1: Add 'set compile-gcc' Jan Kratochvil
@ 2015-04-22 13:10   ` Jeff Law
  0 siblings, 0 replies; 10+ messages in thread
From: Jeff Law @ 2015-04-22 13:10 UTC (permalink / raw)
  To: Jan Kratochvil, gcc-patches; +Cc: Phil Muldoon

On 04/21/2015 03:41 PM, Jan Kratochvil wrote:
> as discussed in
> 	How to use compile & execute function in GDB
> 	https://sourceware.org/ml/gdb/2015-04/msg00026.html
>
> GDB currently searches for /usr/bin/ARCH-OS-gcc and chooses one but one cannot
> override which one.  GDB would provide new option 'set compile-gcc'.
>
> This patch does not change the libcc1 API as it overloads the triplet_regexp
> parameter of GCC's set_arguments according to:
>
> +  if (access (triplet_regexp, X_OK) == 0)
>
> GDB counterpart:
> 	[PATCH 4/4] compile: Add 'set compile-gcc'
> 	https://sourceware.org/ml/gdb-patches/2015-04/msg00808.html
> 	Message-ID: <20150421213657.14147.60506.stgit@host1.jankratochvil.net>
>
>
> Jan
>
>
> include/ChangeLog
> 2015-04-21  Jan Kratochvil  <jan.kratochvil@redhat.com>
>
> 	* gcc-interface.h (enum gcc_base_api_version): Add comment to
> 	GCC_FE_VERSION_1.
> 	(struct gcc_base_vtable): Describe triplet_regexp parameter overload
> 	for set_arguments.
>
> libcc1/ChangeLog
> 2015-04-21  Jan Kratochvil  <jan.kratochvil@redhat.com>
>
> 	* libcc1.cc (libcc1_set_arguments): Implement filenames for
> 	triplet_regexp.
OK.  Please install on the trunk.

jeff

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/5] libcc1: set debug compile: Display GCC driver filename
  2015-04-21 21:41 ` [PATCH 3/5] libcc1: set debug compile: Display GCC driver filename Jan Kratochvil
@ 2015-04-22 13:12   ` Jeff Law
  0 siblings, 0 replies; 10+ messages in thread
From: Jeff Law @ 2015-04-22 13:12 UTC (permalink / raw)
  To: Jan Kratochvil, gcc-patches; +Cc: Phil Muldoon

On 04/21/2015 03:41 PM, Jan Kratochvil wrote:
> Hi,
>
> as discussed in
> 	How to use compile & execute function in GDB
> 	https://sourceware.org/ml/gdb/2015-04/msg00026.html
>
> GDB currently searches for /usr/bin/ARCH-OS-gcc and chooses one but it does not
> display which one.  It cannot, GCC method set_arguments() does not yet know
> whether 'set debug compile' is enabled or not.
>
> Unfortunately this changes libcc1 API in an incompatible way.  There is
> a possibility of a hack to keep the API the same - one could pass "-v" option
> explicitly to set_arguments(), set_arguments() could compare the "-v" string
> and print the GCC filename accordingly.  Then the 'verbose' parameter of
> compile() would lose its meaning.  What do you think?
I think we're early enough in the evolution of libcc1 that changing the 
ABI shouldn't be a big deal.  I'd expect gcc & gdb to need to move in 
lock-step for this stuff for a while.

>
> GDB counterpart:
> 	[PATCH 3/4] compile: set debug compile: Display GCC driver filename
> 	https://sourceware.org/ml/gdb-patches/2015-04/msg00807.html
> 	Message-ID: <20150421213649.14147.79719.stgit@host1.jankratochvil.net>
>
>
> Jan
>
>
> include/ChangeLog
> 2015-04-21  Jan Kratochvil  <jan.kratochvil@redhat.com>
>
> 	* gcc-interface.h (enum gcc_base_api_version): Add comment to
> 	GCC_FE_VERSION_1.
> 	(struct gcc_base_vtable): Move parameter verbose from compile to
> 	set_arguments.
>
> libcc1/ChangeLog
> 2015-04-21  Jan Kratochvil  <jan.kratochvil@redhat.com>
>
> 	* libcc1.cc: Include intl.h.
> 	(struct libcc1): Add field verbose.
> 	(libcc1::libcc1): Initialize it.
> 	(libcc1_set_arguments): Add parameter verbose, implement it.
> 	(libcc1_compile): Remove parameter verbose, use self's field instead.
OK.  Please install on the trunk.

jeff


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/5] libcc1: Use libcc1.so.0->libcc1.so.1
  2015-04-21 21:41 ` [PATCH 2/5] libcc1: Use libcc1.so.0->libcc1.so.1 Jan Kratochvil
@ 2015-04-22 13:12   ` Jeff Law
  0 siblings, 0 replies; 10+ messages in thread
From: Jeff Law @ 2015-04-22 13:12 UTC (permalink / raw)
  To: Jan Kratochvil, gcc-patches; +Cc: Phil Muldoon

On 04/21/2015 03:41 PM, Jan Kratochvil wrote:
> Hi,
>
> see [patch 1/5], particularly:
> (3) Currently there is no backward or forward compatibility although there
>      could be one implemented.  Personally I think the 'compile' feature is
>      still in experimental stage so that it is OK to require last releases.
>      At least in Fedora we can keep GDB<->GCC in sync.
>
> GDB counterpart:
> 	[PATCH 2/4] compile: Use libcc1.so.0->libcc1.so.1
> 	https://sourceware.org/ml/gdb-patches/2015-04/msg00806.html
> 	Message-ID: <20150421213642.14147.93210.stgit@host1.jankratochvil.net>
>
>
> Jan
>
>
> include/ChangeLog
> 2015-04-21  Jan Kratochvil  <jan.kratochvil@redhat.com>
>
> 	* gcc-c-interface.h (GCC_C_FE_LIBCC): Update it to GCC_FE_VERSION_1.
> 	* gcc-interface.h (enum gcc_base_api_version): Add GCC_FE_VERSION_1.
>
> libcc1/ChangeLog
> 2015-04-21  Jan Kratochvil  <jan.kratochvil@redhat.com>
>
> 	* Makefile.am (libcc1_la_LDFLAGS): Add version-info 1.
> 	* Makefile.in: Regenerate.
> 	* libcc1.cc (vtable, gcc_c_fe_context): Update it to GCC_FE_VERSION_1.
OK.  Please install on the trunk.

jeff

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/5] libcc1: Make libcc1.so->libcc1.so.0
  2015-04-21 21:41 [PATCH 1/5] libcc1: Make libcc1.so->libcc1.so.0 Jan Kratochvil
                   ` (3 preceding siblings ...)
  2015-04-21 21:41 ` [PATCH 3/5] libcc1: set debug compile: Display GCC driver filename Jan Kratochvil
@ 2015-04-22 13:13 ` Jeff Law
  4 siblings, 0 replies; 10+ messages in thread
From: Jeff Law @ 2015-04-22 13:13 UTC (permalink / raw)
  To: Jan Kratochvil, gcc-patches; +Cc: Phil Muldoon

On 04/21/2015 03:41 PM, Jan Kratochvil wrote:
> Hi,
>
> the next [patch 3/5] will change the libcc1.so API.  I am not sure if the API
> change gets approved that way but for such case:
> (1) We really need to change GCC_FE_VERSION_0 -> GCC_FE_VERSION_1, this
>      feature is there for this purpose.  That is [patch 2/5].
> (2) Currently GDB does only dlopen("libcc1.so") and then depending on which
>      libcc1.so version it would find first it would succeed/fail.
>      I guess it is more convenient to do dlopen("libcc1.so.1") instead
>      (where ".1"=".x" corresponds to GCC_FE_VERSION_x).
>      That is this patch (with x=0).
>      GCC_C_FE_LIBCC is used only by GDB.
> (3) Currently there is no backward or forward compatibility although there
>      could be one implemented.  Personally I think the 'compile' feature is
>      still in experimental stage so that it is OK to require last releases.
>      At least in Fedora we can keep GDB<->GCC in sync.
>
> GDB counterpart:
> 	[PATCH 1/4] compile: Use libcc1.so->libcc1.so.0
> 	https://sourceware.org/ml/gdb-patches/2015-04/msg00805.html
> 	Message-ID: <20150421213635.14147.15653.stgit@host1.jankratochvil.net>
>
>
> Jan
>
>
> include/ChangeLog
> 2015-04-21  Jan Kratochvil  <jan.kratochvil@redhat.com>
>
> 	* gcc-c-interface.h (GCC_C_FE_LIBCC): Quote it.  Append
> 	GCC_FE_VERSION_0.
OK.  Please install on the trunk.
jeff

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2015-04-22 13:13 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-21 21:41 [PATCH 1/5] libcc1: Make libcc1.so->libcc1.so.0 Jan Kratochvil
2015-04-21 21:41 ` [PATCH 5/5] libcc1: 'set debug compile': Display absolute GCC driver filename Jan Kratochvil
2015-04-22 13:09   ` Jeff Law
2015-04-21 21:41 ` [PATCH 4/5] libcc1: Add 'set compile-gcc' Jan Kratochvil
2015-04-22 13:10   ` Jeff Law
2015-04-21 21:41 ` [PATCH 2/5] libcc1: Use libcc1.so.0->libcc1.so.1 Jan Kratochvil
2015-04-22 13:12   ` Jeff Law
2015-04-21 21:41 ` [PATCH 3/5] libcc1: set debug compile: Display GCC driver filename Jan Kratochvil
2015-04-22 13:12   ` Jeff Law
2015-04-22 13:13 ` [PATCH 1/5] libcc1: Make libcc1.so->libcc1.so.0 Jeff Law

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 read-only IMAP folder(s) and NNTP newsgroup(s).