Re: [PATCH 1/3] librust: Add libproc_macro and build system
On Wed, Sep 20, 2023 at 2:04 PM Arthur Cohen wrote: > > From: Pierre-Emmanuel Patry > > This patch series adds the build system changes to allow the Rust > frontend to develop and distribute its own libraries. The first library > we have been working on is the `proc_macro` library, comprised of a C++ > library as well as a user-facing Rust library. > > Follow up commits containing the actual library code will be committed. > Should I submit patches to the MAINTAINERS file to allow Philip and I to > commit to this folder without first approval? I think the Rust language frontend maintainership implicitly includes the rust runtime libraries. > This first commit adds a simple `libgrust` folder with on top of which the > full library will be built. OK. > All the best, > > Arthur > > - > > Add some dummy files in libproc_macro along with it's build system. > > ChangeLog: > > * libgrust/Makefile.am: New file. > * libgrust/configure.ac: New file. > * libgrust/libproc_macro/Makefile.am: New file. > * libgrust/libproc_macro/proc_macro.cc: New file. > * libgrust/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 000..8e5274922c5 > --- /dev/null > +++ b/libgrust/Makefile.am > @@ -0,0 +1,68 @@ > +AUTOMAKE_OPTIONS = 1.8 foreign > + > +SUFFIXES = .c .rs .def .o .lo .a > + > +ACLOCAL_AMFLAGS = -I . -I .. -I ../config > + > +AM_CFLAGS = -I $(srcdir)/../libgcc -I $(MULTIBUILDTOP)../../gcc/include > + > +TOP_GCCDIR := $(shell cd $(top_srcdir) && cd .. && pwd) > + > +GCC_DIR = $(TOP_GCCDIR)/gcc > +RUST_SRC = $(GCC_DIR)/rust > + > +toolexeclibdir=@toolexeclibdir@ > +toolexecdir=@toolexecdir@ > + > +SUBDIRS = libproc_macro > + > +RUST_BUILDDIR := $(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 = \ > +"GCC_DIR=$(GCC_DIR)" \ > +"RUST_SRC=$(RUST_SRC)" \ > + "AR_FLAGS=$(AR_FLAGS)" \ > + "CC_FOR_BUILD=$(CC_FOR_BUILD)" \ > + "CC_FOR_TARGET=$(CC_FOR_TARGET)" \ > + "RUST_FOR_TARGET=$(RUST_FOR_TARGET)" \ > + "CFLAGS=$(CFLAGS)" \ > + "CXXFLAGS=$(CXXFLAGS)" \ > + "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \ > + "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \ > + "INSTALL=$(INSTALL)" \ > + "INSTALL_DATA=$(INSTALL_DATA)" \ > + "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \ > + "INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \ > + "LDFLAGS=$(LDFLAGS)" \ > + "LIBCFLAGS=$(LIBCFLAGS)" \ > + "LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \ > + "MAKE=$(MAKE)" \ > + "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \ > + "PICFLAG=$(PICFLAG)" \ > + "PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \ > + "SHELL=$(SHELL)" \ > + "RUNTESTFLAGS=$(RUNTESTFLAGS)" \ > + "exec_prefix=$(exec_prefix)" \ > + "infodir=$(infodir)" \ > + "libdir=$(libdir)" \ > + "includedir=$(includedir)" \ > + "prefix=$(prefix)" \ > + "tooldir=$(tooldir)" \ > + "gxx_include_dir=$(gxx_include_dir)" \ > + "AR=$(AR)" \ > + "AS=$(AS)" \ > + "LD=$(LD)" \ > + "RANLIB=$(RANLIB)" \ > + "NM=$(NM)" \ > + "NM_FOR_BUILD=$(NM_FOR_BUILD)" \ > + "NM_FOR_TARGET=$(NM_FOR_TARGET)" \ > + "DESTDIR=$(DESTDIR)" \ > + "WERROR=$(WERROR)" \ > +"TARGET_LIB_PATH=$(TARGET_LIB_PATH)" \ > +"TARGET_LIB_PATH_librust=$(TARGET_LIB_PATH_librust)" \ > + "LIBTOOL=$(RUST_BUILDDIR)/libtool" > + > +include $(top_srcdir)/../multilib.am > diff --git a/libgrust/configure.ac b/libgrust/configure.ac > new file mode 100644 > index 000..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=${target_alias-$host_alias} > +AC_SUBST(target_alias) > + > +# Automake should never attempt to rebuild configure > +AM_MAINTAINER_MODE
Re: [PATCH 2/3] build: Add libgrust as compilation modules
On Wed, Sep 20, 2023 at 2:04 PM Arthur Cohen wrote: > > From: Pierre-Emmanuel Patry > > Define the libgrust directory as a host compilation module as well as > for targets. OK if you tested this doesn't break build when rust is enabled on trunk (and doesn't build libgrust if not). Richard. > ChangeLog: > > * Makefile.def: Add libgrust as host & target module. > * configure.ac: Add libgrust to host tools list. > > gcc/rust/ChangeLog: > > * config-lang.in: Add libgrust as a target module for the rust > language. > > Signed-off-by: Pierre-Emmanuel Patry > --- > Makefile.def| 2 ++ > configure.ac| 3 ++- > gcc/rust/config-lang.in | 2 ++ > 3 files changed, 6 insertions(+), 1 deletion(-) > > diff --git a/Makefile.def b/Makefile.def > index 870150183b9..3df3fc18d14 100644 > --- a/Makefile.def > +++ b/Makefile.def > @@ -149,6 +149,7 @@ host_modules= { module= libcc1; > extra_configure_flags=--enable-shared; }; > host_modules= { module= gotools; }; > host_modules= { module= libctf; bootstrap=true; }; > host_modules= { module= libsframe; bootstrap=true; }; > +host_modules= { module= libgrust; }; > > target_modules = { module= libstdc++-v3; >bootstrap=true; > @@ -192,6 +193,7 @@ target_modules = { module= libgm2; lib_path=.libs; }; > target_modules = { module= libgomp; bootstrap= true; lib_path=.libs; }; > target_modules = { module= libitm; lib_path=.libs; }; > target_modules = { module= libatomic; bootstrap=true; lib_path=.libs; }; > +target_modules = { module= libgrust; }; > > // These are (some of) the make targets to be done in each subdirectory. > // Not all; these are the ones which don't have special options. > diff --git a/configure.ac b/configure.ac > index 1d16530140a..036e5945905 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -133,7 +133,7 @@ build_tools="build-texinfo build-flex build-bison > build-m4 build-fixincludes" > > # these libraries are used by various programs built for the host environment > #f > -host_libs="intl libiberty opcodes bfd readline tcl tk itcl libgui zlib > libbacktrace libcpp libcody libdecnumber gmp mpfr mpc isl libiconv libctf > libsframe" > +host_libs="intl libiberty opcodes bfd readline tcl tk itcl libgui zlib > libbacktrace libcpp libcody libdecnumber gmp mpfr mpc isl libiconv libctf > libsframe libgrust " > > # these tools are built for the host environment > # Note, the powerpc-eabi build depends on sim occurring before gdb in order > to > @@ -164,6 +164,7 @@ target_libraries="target-libgcc \ > target-libada \ > target-libgm2 \ > target-libgo \ > + target-libgrust \ > target-libphobos \ > target-zlib" > > diff --git a/gcc/rust/config-lang.in b/gcc/rust/config-lang.in > index aac66c9b962..8f071dcb0bf 100644 > --- a/gcc/rust/config-lang.in > +++ b/gcc/rust/config-lang.in > @@ -29,4 +29,6 @@ compilers="rust1\$(exeext)" > > build_by_default="no" > > +target_libs="target-libffi target-libbacktrace target-libgrust" > + > gtfiles="\$(srcdir)/rust/rust-lang.cc" > -- > 2.42.0 > -- Gcc-rust mailing list Gcc-rust@gcc.gnu.org https://gcc.gnu.org/mailman/listinfo/gcc-rust
Re: [PATCH 2/3] build: Add libgrust as compilation modules
Hi! On 2023-09-20T13:59:53+0200, Arthur Cohen wrote: > From: Pierre-Emmanuel Patry > > Define the libgrust directory as a host compilation module as well as > for targets. > --- a/Makefile.def > +++ b/Makefile.def > @@ -149,6 +149,7 @@ host_modules= { module= libcc1; > extra_configure_flags=--enable-shared; }; > host_modules= { module= gotools; }; > host_modules= { module= libctf; bootstrap=true; }; > host_modules= { module= libsframe; bootstrap=true; }; > +host_modules= { module= libgrust; }; > > target_modules = { module= libstdc++-v3; > bootstrap=true; > @@ -192,6 +193,7 @@ target_modules = { module= libgm2; lib_path=.libs; }; > target_modules = { module= libgomp; bootstrap= true; lib_path=.libs; }; > target_modules = { module= libitm; lib_path=.libs; }; > target_modules = { module= libatomic; bootstrap=true; lib_path=.libs; }; > +target_modules = { module= libgrust; }; > > // These are (some of) the make targets to be done in each subdirectory. > // Not all; these are the ones which don't have special options. Maybe just I am confused, but to make sure that the build doesn't break for different GCC configurations, don't we also directly need to incorporate here a few GCC/Rust master branch follow-on commits, like: - commit 171ea4e2b3e202067c50f9c206974fbe1da691c0 "fixup: Fix bootstrap build" - commit 61cbe201029658c32e5c360823b9a1a17d21b03c "fixup: Fix missing build dependency" - commit 6a8b207b9ef7f9038e0cae7766117428783825d8 "libgrust: Add dependency to libstdc++" (Not sure if all of these are necessary and/or if that's the complete list; haven't looked up the corresponding GCC/Rust GitHub PRs.) > --- a/gcc/rust/config-lang.in > +++ b/gcc/rust/config-lang.in > +target_libs="target-libffi target-libbacktrace target-libgrust" Please don't add back 'target-libffi' and 'target-libbacktrace' here; just 'target-libgrust'. (As is present in GCC/Rust master branch, and per commit 7411eca498beb13729cc2acec77e68250940aa81 "Rust: Don't depend on unused 'target-libffi', 'target-libbacktrace'".) Grüße Thomas - Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955 -- Gcc-rust mailing list Gcc-rust@gcc.gnu.org https://gcc.gnu.org/mailman/listinfo/gcc-rust
Re: [PATCH 1/3] librust: Add libproc_macro and build system
Hi! On 2023-09-26T13:40:40+0200, Richard Biener wrote: > On Wed, Sep 20, 2023 at 2:04 PM Arthur Cohen > wrote: >> >> From: Pierre-Emmanuel Patry >> >> This patch series adds the build system changes to allow the Rust >> frontend to develop and distribute its own libraries. The first library >> we have been working on is the `proc_macro` library, comprised of a C++ >> library as well as a user-facing Rust library. >> >> Follow up commits containing the actual library code will be committed. >> Should I submit patches to the MAINTAINERS file to allow Philip and I to >> commit to this folder without first approval? > > I think the Rust language frontend maintainership implicitly includes > the rust runtime libraries. Would seem reasonable -- but to make things explicit, may also add in 'MAINTAINERS', 'Various Maintainers' an entry like: libgrustAll Rust front end maintainers ..., or similar? Or, explicitly duplicate for all Rust front end maintainers. (We don't seem to be consistent with respect to that.) >> This first commit adds a simple `libgrust` folder with on top of which the >> full library will be built. > > OK. Before pushing this, don't you first have to set up an empty 'libgrust/ChangeLog', like commit 24ff0b3e0c41e3997fb4c11736b8a412afbaadf3 "Add stub 'gcc/rust/ChangeLog'", for example? ..., and adjust 'contrib/gcc-changelog/git_commit.py:default_changelog_locations', like commit 325529e21e81fbc3561d2568cb7e8a26296e5b2f "Prepare 'contrib/gcc-changelog/git_commit.py' for GCC/Rust", for example? ..., and then replace your 'libgrust/[...]' Git commit log entries: >> Add some dummy files in libproc_macro along with it's build system. >> >> ChangeLog: >> >> * libgrust/Makefile.am: New file. >> * libgrust/configure.ac: New file. >> * libgrust/libproc_macro/Makefile.am: New file. >> * libgrust/libproc_macro/proc_macro.cc: New file. >> * libgrust/libproc_macro/proc_macro.h: New file. >> >> Signed-off-by: Pierre-Emmanuel Patry ... with: libgrust/ * Makefile.am: New file. [...] (Or similar syntax.) That way, the "nightly" auto-updater will use 'libgrust/ChangeLog' instead of the top-level 'ChangeLog'. (I hope I got all that right.) Please also update 'contrib/gcc_update:files_and_dependencies' for all 'libgrust/' generated files' dependencies. Grüße Thomas >> --- >> 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 000..8e5274922c5 >> --- /dev/null >> +++ b/libgrust/Makefile.am >> @@ -0,0 +1,68 @@ >> +AUTOMAKE_OPTIONS = 1.8 foreign >> + >> +SUFFIXES = .c .rs .def .o .lo .a >> + >> +ACLOCAL_AMFLAGS = -I . -I .. -I ../config >> + >> +AM_CFLAGS = -I $(srcdir)/../libgcc -I $(MULTIBUILDTOP)../../gcc/include >> + >> +TOP_GCCDIR := $(shell cd $(top_srcdir) && cd .. && pwd) >> + >> +GCC_DIR = $(TOP_GCCDIR)/gcc >> +RUST_SRC = $(GCC_DIR)/rust >> + >> +toolexeclibdir=@toolexeclibdir@ >> +toolexecdir=@toolexecdir@ >> + >> +SUBDIRS = libproc_macro >> + >> +RUST_BUILDDIR := $(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 = \ >> +"GCC_DIR=$(GCC_DIR)" \ >> +"RUST_SRC=$(RUST_SRC)" \ >> + "AR_FLAGS=$(AR_FLAGS)" \ >> + "CC_FOR_BUILD=$(CC_FOR_BUILD)" \ >> + "CC_FOR_TARGET=$(CC_FOR_TARGET)" \ >> + "RUST_FOR_TARGET=$(RUST_FOR_TARGET)" \ >> + "CFLAGS=$(CFLAGS)" \ >> + "CXXFLAGS=$(CXXFLAGS)" \ >> + "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \ >> + "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \ >> + "INSTALL=$(INSTALL)" \ >> + "INSTALL_DATA=$(INSTALL_DATA)" \ >> + "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \ >> + "INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \ >> + "LDFLAGS=$(LDFLAGS)" \ >> + "LIBCFLAGS=$(LIBCFLAGS)" \ >> + "LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \ >> + "MAKE=$(MAKE)" \ >> + "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \ >> + "PICFLAG=$(PICFLAG)" \ >> + "PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \ >> + "SHELL=$(SHELL)" \ >> + "RUNTESTFLAGS=$(RUNTESTFLAGS)" \ >> + "exec_prefix=$(exec_prefix)" \ >> + "infodir=$(infodir)" \ >> + "libdir=$(libdir)" \ >> +