public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Martin Liska <marxin@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc(refs/users/marxin/heads/lto-plugin-cleanup)] Port to CPP.
Date: Thu,  6 Jan 2022 11:22:43 +0000 (GMT)	[thread overview]
Message-ID: <20220106112243.954333858436@sourceware.org> (raw)

https://gcc.gnu.org/g:c9dbe065a6c11f5d101e62c7f55eaad43c1aa0f7

commit c9dbe065a6c11f5d101e62c7f55eaad43c1aa0f7
Author: Martin Liska <mliska@suse.cz>
Date:   Wed Jan 5 14:06:08 2022 +0100

    Port to CPP.

Diff:
---
 lto-plugin/Makefile.am                     |  8 ++++----
 lto-plugin/configure.ac                    |  1 +
 lto-plugin/{lto-plugin.c => lto-plugin.cc} | 12 ++++++++++++
 3 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/lto-plugin/Makefile.am b/lto-plugin/Makefile.am
index 988d7a78294..d0c980a2024 100644
--- a/lto-plugin/Makefile.am
+++ b/lto-plugin/Makefile.am
@@ -11,14 +11,14 @@ AM_CPPFLAGS = -I$(top_srcdir)/../include $(DEFS)
 AM_CFLAGS = @ac_lto_plugin_warn_cflags@ $(CET_HOST_FLAGS)
 AM_LDFLAGS = @ac_lto_plugin_ldflags@
 AM_LIBTOOLFLAGS = --tag=disable-static
-override CFLAGS := $(filter-out -fsanitize=address -fsanitize=hwaddress,$(CFLAGS))
-override LDFLAGS := $(filter-out -fsanitize=address -fsanitize=hwaddress,$(LDFLAGS))
+override CXXFLAGS := $(filter-out -fsanitize=address -fsanitize=hwaddress,$(CXXFLAGS))
+override LDFLAGS := $(filter-out -fsanitize=address -fsanitize=hwaddress,$(LDFLAGS)) -lstdc++
 
 libexecsub_LTLIBRARIES = liblto_plugin.la
 gcc_build_dir = @gcc_build_dir@
 in_gcc_libs = $(foreach lib, $(libexecsub_LTLIBRARIES), $(gcc_build_dir)/$(lib))
 
-liblto_plugin_la_SOURCES = lto-plugin.c
+liblto_plugin_la_SOURCES = lto-plugin.cc
 # Note that we intentionally override the bindir supplied by ACX_LT_HOST_FLAGS.
 liblto_plugin_la_LDFLAGS = $(AM_LDFLAGS) \
 	$(lt_host_flags) -module -avoid-version -bindir $(libexecsubdir) \
@@ -39,7 +39,7 @@ liblto_plugin_la_DEPENDENCIES = \
 	$(if $(wildcard $(libiberty_pic)),$(libiberty_pic),))
 LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
 liblto_plugin_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
-	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CFLAGS) $(CFLAGS) \
 	$(liblto_plugin_la_LDFLAGS) $(LTLDFLAGS) -o $@
 
 all-local: $(in_gcc_libs)
diff --git a/lto-plugin/configure.ac b/lto-plugin/configure.ac
index 7e6f729e9dc..9aa6cfd5794 100644
--- a/lto-plugin/configure.ac
+++ b/lto-plugin/configure.ac
@@ -10,6 +10,7 @@ AC_ARG_WITH(libiberty,
 AC_SUBST(with_libiberty)
 AC_USE_SYSTEM_EXTENSIONS
 AC_PROG_CC
+AC_PROG_CXX
 AC_SYS_LARGEFILE
 ACX_PROG_CC_WARNING_OPTS([-Wall], [ac_lto_plugin_warn_cflags])
 
diff --git a/lto-plugin/lto-plugin.c b/lto-plugin/lto-plugin.cc
similarity index 99%
rename from lto-plugin/lto-plugin.c
rename to lto-plugin/lto-plugin.cc
index 51e0b4ded43..f80d69d0725 100644
--- a/lto-plugin/lto-plugin.c
+++ b/lto-plugin/lto-plugin.cc
@@ -64,7 +64,11 @@ along with this program; see the file COPYING3.  If not see
 #ifndef WEXITSTATUS
 #define WEXITSTATUS(S) (((S) & 0xff00) >> 8)
 #endif
+
+/* Defined in string.h */
+#define HAVE_DECL_BASENAME 1
 #include <libiberty.h>
+
 #include <hashtab.h>
 #include "../gcc/lto/common.h"
 #include "simple-object.h"
@@ -1368,6 +1372,10 @@ process_option (const char *option)
   verbose = verbose || debug;
 }
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* Called by gold after loading the plugin. TV is the transfer vector. */
 
 enum ld_plugin_status
@@ -1540,3 +1548,7 @@ onload (struct ld_plugin_tv *tv)
 
   return LDPS_OK;
 }
+
+#ifdef __cplusplus
+}
+#endif


                 reply	other threads:[~2022-01-06 11:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220106112243.954333858436@sourceware.org \
    --to=marxin@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).