Hi! On 2024-01-16T17:43:10+0000, Arthur Cohen via Gcc-cvs <gcc-...@gcc.gnu.org> wrote: > https://gcc.gnu.org/g:71180a9eed367667e7b2c3f6aea1ee1bba15e9b3 > > commit r14-7544-g71180a9eed367667e7b2c3f6aea1ee1bba15e9b3 > Author: Pierre-Emmanuel Patry <pierre-emmanuel.pa...@embecosm.com> > Date: Wed Apr 26 10:31:35 2023 +0200 > > 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.
> --- 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) The 'crab1' compiler is (at least potentially) just one of several executables that 'gcc/rust/Make-lang.in' may build, which may all have different library dependencies, etc. Instead of via generic 'RUST_[...]' variables, those dependencies etc. should therefore be specified as they are individually necessary. I've pushed to trunk branch the following clean-up commits, see attached: - commit cb70a49b30f0a22ec7a1b7df29c3ab370d603f90 "Remove 'libgrust/libproc_macro_internal' from 'gcc/rust/Make-lang.in:RUST_LDFLAGS'" - commit f7c8fa7280c85cbdea45be9c09f36123ff16a78a "Inline 'gcc/rust/Make-lang.in:RUST_LDFLAGS' into single user" - commit 24d92f65f9ed9b3c730c59f700ce2f5c038c8207 "Add 'gcc/rust/Make-lang.in:LIBPROC_MACRO_INTERNAL'" - commit e3fda76af4f342ad1ba8bd901a72d811e8357e99 "Inline 'gcc/rust/Make-lang.in:RUST_LIBDEPS' into single user" Grüße Thomas
>From cb70a49b30f0a22ec7a1b7df29c3ab370d603f90 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge <tschwi...@baylibre.com> Date: Wed, 28 Feb 2024 22:41:42 +0100 Subject: [PATCH 1/4] Remove 'libgrust/libproc_macro_internal' from 'gcc/rust/Make-lang.in:RUST_LDFLAGS' This isn't necessary, as the full path to 'libproc_macro_internal.a' is specified elsewhere. gcc/rust/ * Make-lang.in (RUST_LDFLAGS): Remove 'libgrust/libproc_macro_internal'. --- gcc/rust/Make-lang.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/rust/Make-lang.in b/gcc/rust/Make-lang.in index 4d73412739d..e901668b93d 100644 --- a/gcc/rust/Make-lang.in +++ b/gcc/rust/Make-lang.in @@ -208,7 +208,7 @@ RUST_ALL_OBJS = $(GRS_OBJS) $(RUST_TARGET_OBJS) rust_OBJS = $(RUST_ALL_OBJS) rust/rustspec.o -RUST_LDFLAGS = $(LDFLAGS) -L./../libgrust/libproc_macro_internal +RUST_LDFLAGS = $(LDFLAGS) RUST_LIBDEPS = $(LIBDEPS) ../libgrust/libproc_macro_internal/libproc_macro_internal.a # The compiler itself is called crab1 -- 2.34.1
>From f7c8fa7280c85cbdea45be9c09f36123ff16a78a Mon Sep 17 00:00:00 2001 From: Thomas Schwinge <tschwi...@baylibre.com> Date: Wed, 28 Feb 2024 22:45:18 +0100 Subject: [PATCH 2/4] Inline 'gcc/rust/Make-lang.in:RUST_LDFLAGS' into single user gcc/rust/ * Make-lang.in (RUST_LDFLAGS): Inline into single user. --- gcc/rust/Make-lang.in | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gcc/rust/Make-lang.in b/gcc/rust/Make-lang.in index e901668b93d..ffeb325d6ce 100644 --- a/gcc/rust/Make-lang.in +++ b/gcc/rust/Make-lang.in @@ -208,13 +208,12 @@ RUST_ALL_OBJS = $(GRS_OBJS) $(RUST_TARGET_OBJS) rust_OBJS = $(RUST_ALL_OBJS) rust/rustspec.o -RUST_LDFLAGS = $(LDFLAGS) RUST_LIBDEPS = $(LIBDEPS) ../libgrust/libproc_macro_internal/libproc_macro_internal.a # The compiler itself is called crab1 crab1$(exeext): $(RUST_ALL_OBJS) attribs.o $(BACKEND) $(RUST_LIBDEPS) $(rust.prev) @$(call LINK_PROGRESS,$(INDEX.rust),start) - +$(LLINKER) $(ALL_LINKERFLAGS) $(RUST_LDFLAGS) -o $@ \ + +$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \ $(RUST_ALL_OBJS) attribs.o $(BACKEND) $(LIBS) ../libgrust/libproc_macro_internal/libproc_macro_internal.a $(BACKENDLIBS) @$(call LINK_PROGRESS,$(INDEX.rust),end) -- 2.34.1
>From 24d92f65f9ed9b3c730c59f700ce2f5c038c8207 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge <tschwi...@baylibre.com> Date: Wed, 28 Feb 2024 22:51:24 +0100 Subject: [PATCH 3/4] Add 'gcc/rust/Make-lang.in:LIBPROC_MACRO_INTERNAL' ... to avoid verbatim repetition. gcc/rust/ * Make-lang.in (LIBPROC_MACRO_INTERNAL): New. (RUST_LIBDEPS, crab1$(exeext)): Use it. --- gcc/rust/Make-lang.in | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gcc/rust/Make-lang.in b/gcc/rust/Make-lang.in index ffeb325d6ce..b8bfe01ce59 100644 --- a/gcc/rust/Make-lang.in +++ b/gcc/rust/Make-lang.in @@ -208,13 +208,15 @@ RUST_ALL_OBJS = $(GRS_OBJS) $(RUST_TARGET_OBJS) rust_OBJS = $(RUST_ALL_OBJS) rust/rustspec.o -RUST_LIBDEPS = $(LIBDEPS) ../libgrust/libproc_macro_internal/libproc_macro_internal.a +LIBPROC_MACRO_INTERNAL = ../libgrust/libproc_macro_internal/libproc_macro_internal.a + +RUST_LIBDEPS = $(LIBDEPS) $(LIBPROC_MACRO_INTERNAL) # The compiler itself is called crab1 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) ../libgrust/libproc_macro_internal/libproc_macro_internal.a $(BACKENDLIBS) + $(RUST_ALL_OBJS) attribs.o $(BACKEND) $(LIBS) $(LIBPROC_MACRO_INTERNAL) $(BACKENDLIBS) @$(call LINK_PROGRESS,$(INDEX.rust),end) # Build hooks. -- 2.34.1
>From e3fda76af4f342ad1ba8bd901a72d811e8357e99 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge <tschwi...@baylibre.com> Date: Wed, 28 Feb 2024 23:06:25 +0100 Subject: [PATCH 4/4] Inline 'gcc/rust/Make-lang.in:RUST_LIBDEPS' into single user gcc/rust/ * Make-lang.in (RUST_LIBDEPS): Inline into single user. --- gcc/rust/Make-lang.in | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/gcc/rust/Make-lang.in b/gcc/rust/Make-lang.in index b8bfe01ce59..8db04163618 100644 --- a/gcc/rust/Make-lang.in +++ b/gcc/rust/Make-lang.in @@ -210,10 +210,8 @@ rust_OBJS = $(RUST_ALL_OBJS) rust/rustspec.o LIBPROC_MACRO_INTERNAL = ../libgrust/libproc_macro_internal/libproc_macro_internal.a -RUST_LIBDEPS = $(LIBDEPS) $(LIBPROC_MACRO_INTERNAL) - # The compiler itself is called crab1 -crab1$(exeext): $(RUST_ALL_OBJS) attribs.o $(BACKEND) $(RUST_LIBDEPS) $(rust.prev) +crab1$(exeext): $(RUST_ALL_OBJS) attribs.o $(BACKEND) $(LIBDEPS) $(LIBPROC_MACRO_INTERNAL) $(rust.prev) @$(call LINK_PROGRESS,$(INDEX.rust),start) +$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \ $(RUST_ALL_OBJS) attribs.o $(BACKEND) $(LIBS) $(LIBPROC_MACRO_INTERNAL) $(BACKENDLIBS) -- 2.34.1