From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa3.mentor.iphmx.com (esa3.mentor.iphmx.com [68.232.137.180]) by sourceware.org (Postfix) with ESMTPS id CD6B8385AC26; Thu, 26 Oct 2023 08:21:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CD6B8385AC26 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org CD6B8385AC26 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=68.232.137.180 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698308493; cv=none; b=JZ5tXFmmgVxkh4J6vEYyHX2ieUg5HvLaM52tdYO3FtdZHciGT+SF5A34/y6o+1A9tKPM7i0bN+/bw3JO+BiYuBLvwLdKqo3a1ZtFzdP3e54iNnPhFl5q9jhCssX0yRf0d/34K8iAkMH5zN+KgotUxuytKMMg+AecFjhvjWsLou4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698308493; c=relaxed/simple; bh=dJ34Dj8V/7HH4E4LEfLP21edHxn5X7sQyU2G0B2Lg74=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=dOljObB8wtq6+pNL4UYIZT85O/uvguwZJxOT+Bzg1Hfxu6WYCgUZ03g9YU8ASqOxbBH72V9aptGLXdZ9x7Ly5Wr66kDMhYm9Xvl1sGLhnmvvGk779Djaco1r3gMmeZbFeyPyMd83kecjC/o2qqaodgmB42A3aaT4LHriL0KDFd8= ARC-Authentication-Results: i=1; server2.sourceware.org X-CSE-ConnectionGUID: ouV7+QXESHKNwOsJSFyLTg== X-CSE-MsgGUID: 2aZxV6ELS5Gu3kLllrmMsA== X-IronPort-AV: E=Sophos;i="6.03,253,1694764800"; d="scan'208";a="20837304" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa3.mentor.iphmx.com with ESMTP; 26 Oct 2023 00:21:26 -0800 IronPort-SDR: 08kG0E0rxpYo/6q5fgQKHD3d1KLRhqK/d6JB3zSwsHSVWBrNgvHl6GQb3orchvFXKPuQURuxI7 5JolZMQ84ZQuG91ujpYGxpnZI/hA8lGnhkbJEsZJYvvoZPIFaxMoG4A3YPEwrNObQGIP3jsbtQ ASymP2Gqezq45rDO241kkJoAnAl8rqQnfdF59jVzlwpzeDib2yyY/+gZWlf37fA2waKyd+BUYJ xNBx2tdl1k0tuxDeyFMLGbIgJKhpV8b8OrhGIM2/X7p1osxWYQ0E1AY4MrWxMpdawlTaRxyW8W oR0= From: Thomas Schwinge To: Arthur Cohen , Pierre-Emmanuel Patry CC: , , Iain Sandoe Subject: Re: [PATCH v2 2/4] libgrust: Add libproc_macro and build system In-Reply-To: <20231025110658.1232737-3-arthur.cohen@embecosm.com> References: <20231025110658.1232737-1-arthur.cohen@embecosm.com> <20231025110658.1232737-3-arthur.cohen@embecosm.com> User-Agent: Notmuch/0.29.3+94~g74c3f1b (https://notmuchmail.org) Emacs/28.2 (x86_64-pc-linux-gnu) Date: Thu, 26 Oct 2023 10:21:18 +0200 Message-ID: <87edhhu741.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-12.mgc.mentorg.com (139.181.222.12) To svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00,GIT_PATCH_0,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,KAM_SHORT,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi! First, I've pushed into GCC upstream Git branch devel/rust/libgrust-v2 the "v2" libgrust changes as posted by Arthur, so that people can easily test this before it getting into Git master branch. I'll myself later try this for GCN and nvptx targets -- in their current form where they don't support C++ (standard library), and in my hacky WIP trees where C++ (standard library) is supported to some extent. (This should, roughly, match C++ functionality (not) provided by a number of other GCC "embedded" targets.) Then: On 2023-10-25T13:06:46+0200, Arthur Cohen wrote= : > From: Pierre-Emmanuel Patry > > Add some dummy files in libproc_macro along with its build system. I've not reviewed the build system in detail, just had a very quick look. Three instances of 'librust'; should be 'libgrust': configure.ac:AC_INIT([libgrust], version-unused,,librust) configure.ac:AC_MSG_NOTICE([librust has been configured.]) Makefile.am: "TARGET_LIB_PATH_librust=3D$(TARGET_LIB_PATH_librus= t)" \ Compared to libgomp (which I'm reasonably familiar with), I found missing in 'libgrust' at 'configure'-level: --enable-multilib build many library versions (default) --disable-werror disable building with -Werror --enable-symvers=3DSTYLE enables symbol versioning of the shared lib= rary [default=3Dyes] --enable-cet enable Intel CET in target libraries [default= =3Dauto] --with-gcc-major-version-only use only GCC major number in filesystem paths I can't tell off-hand whether all these are important, however. Additionally, the new one that's being discussed in 'Update libgrust for upstream GCC commit 6a6d3817afa02bbcd2388c8e005da6faf8= 8932f1 "Config,Darwin: Allow for configuring Darwin to use embedded runpath= "'. Gr=C3=BC=C3=9Fe Thomas > libgrust/Changelog: > > * Makefile.am: New file. > * configure.ac: New file. > * libproc_macro/Makefile.am: New file. > * libproc_macro/proc_macro.cc: New file. > * libproc_macro/proc_macro.h: New file. > > Signed-off-by: Pierre-Emmanuel Patry > --- > libgrust/Makefile.am | 68 ++++++++++++++++ > libgrust/configure.ac | 113 +++++++++++++++++++++++++++ > libgrust/libproc_macro/Makefile.am | 58 ++++++++++++++ > libgrust/libproc_macro/proc_macro.cc | 7 ++ > libgrust/libproc_macro/proc_macro.h | 7 ++ > 5 files changed, 253 insertions(+) > create mode 100644 libgrust/Makefile.am > create mode 100644 libgrust/configure.ac > create mode 100644 libgrust/libproc_macro/Makefile.am > create mode 100644 libgrust/libproc_macro/proc_macro.cc > create mode 100644 libgrust/libproc_macro/proc_macro.h > > diff --git a/libgrust/Makefile.am b/libgrust/Makefile.am > new file mode 100644 > index 00000000000..8e5274922c5 > --- /dev/null > +++ b/libgrust/Makefile.am > @@ -0,0 +1,68 @@ > +AUTOMAKE_OPTIONS =3D 1.8 foreign > + > +SUFFIXES =3D .c .rs .def .o .lo .a > + > +ACLOCAL_AMFLAGS =3D -I . -I .. -I ../config > + > +AM_CFLAGS =3D -I $(srcdir)/../libgcc -I $(MULTIBUILDTOP)../../gcc/includ= e > + > +TOP_GCCDIR :=3D $(shell cd $(top_srcdir) && cd .. && pwd) > + > +GCC_DIR =3D $(TOP_GCCDIR)/gcc > +RUST_SRC =3D $(GCC_DIR)/rust > + > +toolexeclibdir=3D@toolexeclibdir@ > +toolexecdir=3D@toolexecdir@ > + > +SUBDIRS =3D libproc_macro > + > +RUST_BUILDDIR :=3D $(shell pwd) > + > +# Work around what appears to be a GNU make bug handling MAKEFLAGS > +# values defined in terms of make variables, as is the case for CC and > +# friends when we are called from the top level Makefile. > +AM_MAKEFLAGS =3D \ > + "GCC_DIR=3D$(GCC_DIR)" \ > + "RUST_SRC=3D$(RUST_SRC)" \ > + "AR_FLAGS=3D$(AR_FLAGS)" \ > + "CC_FOR_BUILD=3D$(CC_FOR_BUILD)" \ > + "CC_FOR_TARGET=3D$(CC_FOR_TARGET)" \ > + "RUST_FOR_TARGET=3D$(RUST_FOR_TARGET)" \ > + "CFLAGS=3D$(CFLAGS)" \ > + "CXXFLAGS=3D$(CXXFLAGS)" \ > + "CFLAGS_FOR_BUILD=3D$(CFLAGS_FOR_BUILD)" \ > + "CFLAGS_FOR_TARGET=3D$(CFLAGS_FOR_TARGET)" \ > + "INSTALL=3D$(INSTALL)" \ > + "INSTALL_DATA=3D$(INSTALL_DATA)" \ > + "INSTALL_PROGRAM=3D$(INSTALL_PROGRAM)" \ > + "INSTALL_SCRIPT=3D$(INSTALL_SCRIPT)" \ > + "LDFLAGS=3D$(LDFLAGS)" \ > + "LIBCFLAGS=3D$(LIBCFLAGS)" \ > + "LIBCFLAGS_FOR_TARGET=3D$(LIBCFLAGS_FOR_TARGET)" \ > + "MAKE=3D$(MAKE)" \ > + "MAKEINFO=3D$(MAKEINFO) $(MAKEINFOFLAGS)" \ > + "PICFLAG=3D$(PICFLAG)" \ > + "PICFLAG_FOR_TARGET=3D$(PICFLAG_FOR_TARGET)" \ > + "SHELL=3D$(SHELL)" \ > + "RUNTESTFLAGS=3D$(RUNTESTFLAGS)" \ > + "exec_prefix=3D$(exec_prefix)" \ > + "infodir=3D$(infodir)" \ > + "libdir=3D$(libdir)" \ > + "includedir=3D$(includedir)" \ > + "prefix=3D$(prefix)" \ > + "tooldir=3D$(tooldir)" \ > + "gxx_include_dir=3D$(gxx_include_dir)" \ > + "AR=3D$(AR)" \ > + "AS=3D$(AS)" \ > + "LD=3D$(LD)" \ > + "RANLIB=3D$(RANLIB)" \ > + "NM=3D$(NM)" \ > + "NM_FOR_BUILD=3D$(NM_FOR_BUILD)" \ > + "NM_FOR_TARGET=3D$(NM_FOR_TARGET)" \ > + "DESTDIR=3D$(DESTDIR)" \ > + "WERROR=3D$(WERROR)" \ > + "TARGET_LIB_PATH=3D$(TARGET_LIB_PATH)" \ > + "TARGET_LIB_PATH_librust=3D$(TARGET_LIB_PATH_librust)" \ > + "LIBTOOL=3D$(RUST_BUILDDIR)/libtool" > + > +include $(top_srcdir)/../multilib.am > diff --git a/libgrust/configure.ac b/libgrust/configure.ac > new file mode 100644 > index 00000000000..7aed489a643 > --- /dev/null > +++ b/libgrust/configure.ac > @@ -0,0 +1,113 @@ > +AC_INIT([libgrust], version-unused,,librust) > +AC_CONFIG_SRCDIR(Makefile.am) > +AC_CONFIG_FILES([Makefile]) > + > +# AM_ENABLE_MULTILIB(, ..) > + > +# Do not delete or change the following two lines. For why, see > +# http://gcc.gnu.org/ml/libstdc++/2003-07/msg00451.html > +AC_CANONICAL_SYSTEM > +target_alias=3D${target_alias-$host_alias} > +AC_SUBST(target_alias) > + > +# Automake should never attempt to rebuild configure > +AM_MAINTAINER_MODE > + > +AM_INIT_AUTOMAKE([1.15.1 foreign no-dist -Wall]) > + > +# Make sure we don't test executables when making cross-tools. > +GCC_NO_EXECUTABLES > + > + > +# Add the ability to change LIBTOOL directory > +GCC_WITH_TOOLEXECLIBDIR > + > +# Use system specific extensions > +AC_USE_SYSTEM_EXTENSIONS > + > + > +# Checks for header files. > +AC_HEADER_STDC > +AC_HEADER_SYS_WAIT > +AC_CHECK_HEADERS(limits.h stddef.h string.h strings.h stdlib.h \ > + time.h sys/stat.h wchar.h) > + > +# Check for tools > +AM_PROG_AR > +AC_PROG_CC > +AC_PROG_CXX > +AM_PROG_AS > +AC_PROG_MAKE_SET > +AC_PROG_INSTALL > + > +# Enable libtool > +LT_INIT > + > +# target_noncanonical variables... > +AC_CANONICAL_HOST > +ACX_NONCANONICAL_HOST > +ACX_NONCANONICAL_TARGET > +GCC_TOPLEV_SUBDIRS > + > +AC_MSG_CHECKING([for --enable-version-specific-runtime-libs]) > +AC_ARG_ENABLE(version-specific-runtime-libs, > +[ --enable-version-specific-runtime-libs Specify that runtime librar= ies should be installed in a compiler-specific directory ], > +[case "$enableval" in > + yes) version_specific_libs=3Dyes ;; > + no) version_specific_libs=3Dno ;; > + *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific = libs]);; > + esac], > +[version_specific_libs=3Dno]) > +AC_MSG_RESULT($version_specific_libs) > + > +toolexecdir=3Dno > +toolexeclibdir=3Dno > + > +# Calculate toolexeclibdir > +# Also toolexecdir, though it's only used in toolexeclibdir > +case ${version_specific_libs} in > + yes) > + # Need the gcc compiler version to know where to install libraries > + # and header files if --enable-version-specific-runtime-libs option > + # is selected. > + toolexecdir=3D'$(libdir)/gcc/$(target_noncanonical)' > + toolexeclibdir=3D'$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)' > + ;; > + no) > + if test -n "$with_cross_host" && > + test x"$with_cross_host" !=3D x"no"; then > + # Install a library built with a cross compiler in tooldir, not li= bdir. > + toolexecdir=3D'$(exec_prefix)/$(target_noncanonical)' > + toolexeclibdir=3D'$(toolexecdir)/lib' > + else > + toolexecdir=3D'$(libdir)/gcc-lib/$(target_noncanonical)' > + toolexeclibdir=3D'$(libdir)' > + fi > + multi_os_directory=3D`$CC -print-multi-os-directory` > + case $multi_os_directory in > + .) ;; # Avoid trailing /. > + *) toolexeclibdir=3D$toolexeclibdir/$multi_os_directory ;; > + esac > + ;; > +esac > + > +AC_SUBST(toolexecdir) > +AC_SUBST(toolexeclibdir) > + > + > +AC_CONFIG_FILES(AC_FOREACH([DIR], [libproc_macro], [DIR/Makefile ]), > + [ cat > vpsed$$ << \_EOF > +s!`test -f '$<' || echo '$(srcdir)/'`!! > +_EOF > + sed -f vpsed$$ $ac_file > tmp$$ > + mv tmp$$ $ac_file > + rm vpsed$$ > + echo 'MULTISUBDIR =3D' >> $ac_file > + ml_norecursion=3Dyes > + AS_UNSET([ml_norecursion]) > +]) > + > + > +AC_MSG_NOTICE([librust has been configured.]) > + > +AC_OUTPUT > diff --git a/libgrust/libproc_macro/Makefile.am b/libgrust/libproc_macro/= Makefile.am > new file mode 100644 > index 00000000000..1e61d12e506 > --- /dev/null > +++ b/libgrust/libproc_macro/Makefile.am > @@ -0,0 +1,58 @@ > +SUFFIXES =3D .cc .o .a .lo .la > + > +ACLOCAL_AMFLAGS =3D -I .. -I ../../config > + > +toolexeclibdir=3D@toolexeclibdir@ > +toolexecdir=3D@toolexecdir@ > + > +# Work around what appears to be a GNU make bug handling MAKEFLAGS > +# values defined in terms of make variables, as is the case for CC and > +# friends when we are called from the top level Makefile. > +AM_MAKEFLAGS =3D \ > + "AR_FLAGS=3D$(AR_FLAGS)" \ > + "CC_FOR_BUILD=3D$(CC_FOR_BUILD)" \ > + "CC_FOR_TARGET=3D$(CC_FOR_TARGET)" \ > + "CFLAGS=3D$(CFLAGS)" \ > + "CXXFLAGS=3D$(CXXFLAGS)" \ > + "CFLAGS_FOR_BUILD=3D$(CFLAGS_FOR_BUILD)" \ > + "CFLAGS_FOR_TARGET=3D$(CFLAGS_FOR_TARGET)" \ > + "INSTALL=3D$(INSTALL)" \ > + "INSTALL_DATA=3D$(INSTALL_DATA)" \ > + "INSTALL_PROGRAM=3D$(INSTALL_PROGRAM)" \ > + "INSTALL_SCRIPT=3D$(INSTALL_SCRIPT)" \ > + "LDFLAGS=3D$(LDFLAGS)" \ > + "LIBCFLAGS=3D$(LIBCFLAGS)" \ > + "LIBCFLAGS_FOR_TARGET=3D$(LIBCFLAGS_FOR_TARGET)" \ > + "MAKE=3D$(MAKE)" \ > + "MAKEINFO=3D$(MAKEINFO) $(MAKEINFOFLAGS)" \ > + "PICFLAG=3D$(PICFLAG)" \ > + "PICFLAG_FOR_TARGET=3D$(PICFLAG_FOR_TARGET)" \ > + "SHELL=3D$(SHELL)" \ > + "RUNTESTFLAGS=3D$(RUNTESTFLAGS)" \ > + "exec_prefix=3D$(exec_prefix)" \ > + "infodir=3D$(infodir)" \ > + "libdir=3D$(libdir)" \ > + "includedir=3D$(includedir)" \ > + "prefix=3D$(prefix)" \ > + "tooldir=3D$(tooldir)" \ > + "gxx_include_dir=3D$(gxx_include_dir)" \ > + "AR=3D$(AR)" \ > + "AS=3D$(AS)" \ > + "LD=3D$(LD)" \ > + "RANLIB=3D$(RANLIB)" \ > + "NM=3D$(NM)" \ > + "NM_FOR_BUILD=3D$(NM_FOR_BUILD)" \ > + "NM_FOR_TARGET=3D$(NM_FOR_TARGET)" \ > + "DESTDIR=3D$(DESTDIR)" \ > + "WERROR=3D$(WERROR)" \ > + "TARGET_LIB_PATH=3D$(TARGET_LIB_PATH)" \ > + "TARGET_LIB_PATH_libgm2=3D$(TARGET_LIB_PATH_libgm2)" > + > +toolexeclib_LTLIBRARIES =3D libproc_macro.la > + > +libproc_macro_la_SOURCES =3D \ > + proc_macro.cc > + > +include_HEADERS =3D \ > + proc_macro.h > + > diff --git a/libgrust/libproc_macro/proc_macro.cc b/libgrust/libproc_macr= o/proc_macro.cc > new file mode 100644 > index 00000000000..d13276294aa > --- /dev/null > +++ b/libgrust/libproc_macro/proc_macro.cc > @@ -0,0 +1,7 @@ > +#include "proc_macro.h" > + > +int > +test () > +{ > + return 0; > +} > diff --git a/libgrust/libproc_macro/proc_macro.h b/libgrust/libproc_macro= /proc_macro.h > new file mode 100644 > index 00000000000..2c96b3de685 > --- /dev/null > +++ b/libgrust/libproc_macro/proc_macro.h > @@ -0,0 +1,7 @@ > +#ifndef PROC_MACRO_H > +#define PROC_MACRO_H > + > +int > +test (); > + > +#endif /* ! PROC_MACRO_H */ > -- > 2.42.0 ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstra=C3=9Fe 201= , 80634 M=C3=BCnchen; Gesellschaft mit beschr=C3=A4nkter Haftung; Gesch=C3= =A4ftsf=C3=BChrer: Thomas Heurung, Frank Th=C3=BCrauf; Sitz der Gesellschaf= t: M=C3=BCnchen; Registergericht M=C3=BCnchen, HRB 106955