From 71180a9eed367667e7b2c3f6aea1ee1bba15e9b3 Mon Sep 17 00:00:00 2001 From: Pierre-Emmanuel Patry Date: Wed, 26 Apr 2023 10:31:35 +0200 Subject: [PATCH] gccrs: libproc_macro: Build statically We do not need dynamic linking, all use case of this library cover can be done statically hence the change. gcc/rust/ChangeLog: * Make-lang.in: Link against the static libproc_macro. libgrust/ChangeLog: * Makefile.am: Remove libtool forwarding. * Makefile.in: Regenerate. * libproc_macro/Makefile.am: Creates an archive instead of using libtool. * libproc_macro/Makefile.in: Regenerate. Signed-off-by: Pierre-Emmanuel Patry --- gcc/rust/Make-lang.in | 12 ++++++++---- libgrust/Makefile.am | 6 +----- libgrust/Makefile.in | 3 +-- libgrust/libproc_macro/Makefile.am | 7 ++----- libgrust/libproc_macro/Makefile.in | 2 +- 5 files changed, 13 insertions(+), 17 deletions(-) diff --git a/gcc/rust/Make-lang.in b/gcc/rust/Make-lang.in index 74e8886e6a0..8ef50b24594 100644 --- a/gcc/rust/Make-lang.in +++ b/gcc/rust/Make-lang.in @@ -182,11 +182,14 @@ RUST_ALL_OBJS = $(GRS_OBJS) $(RUST_TARGET_OBJS) rust_OBJS = $(RUST_ALL_OBJS) rust/rustspec.o +RUST_LDFLAGS = $(LDFLAGS) -L./../libgrust/libproc_macro +RUST_LIBDEPS = $(LIBDEPS) ../libgrust/libproc_macro/libproc_macro.a + # The compiler itself is called crab1 -crab1$(exeext): $(RUST_ALL_OBJS) attribs.o $(BACKEND) $(LIBDEPS) $(rust.prev) +crab1$(exeext): $(RUST_ALL_OBJS) attribs.o $(BACKEND) $(RUST_LIBDEPS) $(rust.prev) @$(call LINK_PROGRESS,$(INDEX.rust),start) - +$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \ - $(RUST_ALL_OBJS) attribs.o $(BACKEND) $(LIBS) $(BACKENDLIBS) + +$(LLINKER) $(ALL_LINKERFLAGS) $(RUST_LDFLAGS) -o $@ \ + $(RUST_ALL_OBJS) attribs.o $(BACKEND) $(LIBS) ../libgrust/libproc_macro/libproc_macro.a $(BACKENDLIBS) @$(call LINK_PROGRESS,$(INDEX.rust),end) # Build hooks. @@ -355,7 +358,8 @@ RUST_INCLUDES = -I $(srcdir)/rust \ -I $(srcdir)/rust/checks/errors \ -I $(srcdir)/rust/checks/errors/privacy \ -I $(srcdir)/rust/util \ - -I $(srcdir)/rust/metadata + -I $(srcdir)/rust/metadata \ + -I $(srcdir)/../libgrust # add files that require cross-folder includes - currently rust-lang.o, rust-lex.o CFLAGS-rust/rust-lang.o += $(RUST_INCLUDES) diff --git a/libgrust/Makefile.am b/libgrust/Makefile.am index e13686327ec..38ee48a8003 100644 --- a/libgrust/Makefile.am +++ b/libgrust/Makefile.am @@ -11,9 +11,6 @@ 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) @@ -62,7 +59,6 @@ AM_MAKEFLAGS = \ "DESTDIR=$(DESTDIR)" \ "WERROR=$(WERROR)" \ "TARGET_LIB_PATH=$(TARGET_LIB_PATH)" \ - "TARGET_LIB_PATH_libgrust=$(TARGET_LIB_PATH_libgrust)" \ - "LIBTOOL=$(RUST_BUILDDIR)/libtool" + "TARGET_LIB_PATH_librust=$(TARGET_LIB_PATH_librust)" include $(top_srcdir)/../multilib.am diff --git a/libgrust/Makefile.in b/libgrust/Makefile.in index bcf0aa07077..e9a410b9009 100644 --- a/libgrust/Makefile.in +++ b/libgrust/Makefile.in @@ -355,8 +355,7 @@ AM_MAKEFLAGS = \ "DESTDIR=$(DESTDIR)" \ "WERROR=$(WERROR)" \ "TARGET_LIB_PATH=$(TARGET_LIB_PATH)" \ - "TARGET_LIB_PATH_libgrust=$(TARGET_LIB_PATH_libgrust)" \ - "LIBTOOL=$(RUST_BUILDDIR)/libtool" + "TARGET_LIB_PATH_librust=$(TARGET_LIB_PATH_librust)" MULTISRCTOP = MULTIBUILDTOP = diff --git a/libgrust/libproc_macro/Makefile.am b/libgrust/libproc_macro/Makefile.am index e714362e1e2..0fe22114248 100644 --- a/libgrust/libproc_macro/Makefile.am +++ b/libgrust/libproc_macro/Makefile.am @@ -2,7 +2,7 @@ SUFFIXES = .cc .o .a .lo .la ACLOCAL_AMFLAGS = -I .. -I ../../config -AR=@AR@ +AR = @AR@ AR_FLAGS = rc # Work around what appears to be a GNU make bug handling MAKEFLAGS @@ -48,13 +48,11 @@ AM_MAKEFLAGS = \ "TARGET_LIB_PATH=$(TARGET_LIB_PATH)" TARGETLIB = ./libproc_macro.a - LIBOBJS = @LIBOBJS@ - objext = @OBJEXT@ REQUIRED_OFILES = \ - ./proc_macro.$(objext) + ./proc_macro.$(objext) ./literal.$(objext) ./group.$(objext) ./ident.$(objext) ./punct.$(objext) ./tokenstream.$(objext) ./tokentree.$(objext) all: $(TARGETLIB) @@ -62,4 +60,3 @@ $(TARGETLIB): $(REQUIRED_OFILES) $(LIBOBJS) -rm -f $(TARGETLIB) $(AR) $(AR_FLAGS) $(TARGETLIB) \ $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS) - diff --git a/libgrust/libproc_macro/Makefile.in b/libgrust/libproc_macro/Makefile.in index 9ff1dd69cc3..6eb5365d1ac 100644 --- a/libgrust/libproc_macro/Makefile.in +++ b/libgrust/libproc_macro/Makefile.in @@ -311,7 +311,7 @@ AM_MAKEFLAGS = \ TARGETLIB = ./libproc_macro.a objext = @OBJEXT@ REQUIRED_OFILES = \ - ./proc_macro.$(objext) + ./proc_macro.$(objext) ./literal.$(objext) ./group.$(objext) ./ident.$(objext) ./punct.$(objext) ./tokenstream.$(objext) ./tokentree.$(objext) all: all-am