From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1851) id 954333858436; Thu, 6 Jan 2022 11:22:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 954333858436 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Martin Liska To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/marxin/heads/lto-plugin-cleanup)] Port to CPP. X-Act-Checkin: gcc X-Git-Author: Martin Liska X-Git-Refname: refs/users/marxin/heads/lto-plugin-cleanup X-Git-Oldrev: 61e9768a902922cd1fa136670e11dac92ae428d7 X-Git-Newrev: c9dbe065a6c11f5d101e62c7f55eaad43c1aa0f7 Message-Id: <20220106112243.954333858436@sourceware.org> Date: Thu, 6 Jan 2022 11:22:43 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jan 2022 11:22:43 -0000 https://gcc.gnu.org/g:c9dbe065a6c11f5d101e62c7f55eaad43c1aa0f7 commit c9dbe065a6c11f5d101e62c7f55eaad43c1aa0f7 Author: Martin Liska 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 + #include #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