[PATCHSET] Fix Rust bootstrap for future libgrust changes

2024-01-11 Thread Arthur Cohen
Hi everyone,

Sorry about this - two simple changes to Makefile.def we had missed
during our first libgrust/ patchset, plus the associated regen of
Makefile.in in each commit.

Let me know if I should squash them together. I'll follow them up
with our entire patchset.

Best,

Arthur




[PATCH 1/2] gccrs: fixup: Fix bootstrap build

2024-01-11 Thread Arthur Cohen
From: Pierre-Emmanuel Patry 

The bootstrap was failing due to a missing target which was not
available during the bootstrap.

ChangeLog:

* Makefile.def: Add libgrust target to bootstrap.
* Makefile.in: Regenerate.

Signed-off-by: Pierre-Emmanuel Patry 
---
 Makefile.def |   2 +-
 Makefile.in  | 816 +--
 2 files changed, 799 insertions(+), 19 deletions(-)

diff --git a/Makefile.def b/Makefile.def
index b889020afc6..1a256db5518 100644
--- a/Makefile.def
+++ b/Makefile.def
@@ -164,7 +164,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; };
+host_modules= { module= libgrust; bootstrap=true; };
 
 target_modules = { module= libstdc++-v3;
   bootstrap=true;
diff --git a/Makefile.in b/Makefile.in
index a1f64a2ab5a..263b979609b 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1318,7 +1318,9 @@ all-host: maybe-all-libctf
 @if libsframe-no-bootstrap
 all-host: maybe-all-libsframe
 @endif libsframe-no-bootstrap
+@if libgrust-no-bootstrap
 all-host: maybe-all-libgrust
+@endif libgrust-no-bootstrap
 
 .PHONY: all-target
 
@@ -43995,7 +43997,6 @@ configure-libgrust: stage_current
 @if libgrust
 maybe-configure-libgrust: configure-libgrust
 configure-libgrust: 
-   @: $(MAKE); $(unstage)
@r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
test ! -f $(HOST_SUBDIR)/libgrust/Makefile || exit 0; \
@@ -44019,6 +44020,304 @@ configure-libgrust:
 
 
 
+.PHONY: configure-stage1-libgrust maybe-configure-stage1-libgrust
+maybe-configure-stage1-libgrust:
+@if libgrust-bootstrap
+maybe-configure-stage1-libgrust: configure-stage1-libgrust
+configure-stage1-libgrust:
+   @[ $(current_stage) = stage1 ] || $(MAKE) stage1-start
+   @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libgrust
+   @r=`${PWD_COMMAND}`; export r; \
+   s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+   TFLAGS="$(STAGE1_TFLAGS)"; \
+   test ! -f $(HOST_SUBDIR)/libgrust/Makefile || exit 0; \
+   $(HOST_EXPORTS) \
+   CFLAGS="$(STAGE1_CFLAGS)"; export CFLAGS; \
+   CXXFLAGS="$(STAGE1_CXXFLAGS)"; export CXXFLAGS; \
+   LIBCFLAGS="$(LIBCFLAGS)"; export LIBCFLAGS;  \
+   echo Configuring stage 1 in $(HOST_SUBDIR)/libgrust; \
+   $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libgrust; \
+   cd $(HOST_SUBDIR)/libgrust || exit 1; \
+   case $(srcdir) in \
+ /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+ *) topdir=`echo $(HOST_SUBDIR)/libgrust/ | \
+   sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
+   esac; \
+   module_srcdir=libgrust; \
+   $(SHELL) $$s/$$module_srcdir/configure \
+ --srcdir=$${topdir}/$$module_srcdir \
+ $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
+ --target=${target_alias} \
+  \
+ $(STAGE1_CONFIGURE_FLAGS)
+@endif libgrust-bootstrap
+
+.PHONY: configure-stage2-libgrust maybe-configure-stage2-libgrust
+maybe-configure-stage2-libgrust:
+@if libgrust-bootstrap
+maybe-configure-stage2-libgrust: configure-stage2-libgrust
+configure-stage2-libgrust:
+   @[ $(current_stage) = stage2 ] || $(MAKE) stage2-start
+   @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libgrust
+   @r=`${PWD_COMMAND}`; export r; \
+   s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+   TFLAGS="$(STAGE2_TFLAGS)"; \
+   test ! -f $(HOST_SUBDIR)/libgrust/Makefile || exit 0; \
+   $(HOST_EXPORTS) \
+   $(POSTSTAGE1_HOST_EXPORTS) \
+   CFLAGS="$(STAGE2_CFLAGS)"; export CFLAGS; \
+   CXXFLAGS="$(STAGE2_CXXFLAGS)"; export CXXFLAGS; \
+   LIBCFLAGS="$(STAGE2_CFLAGS)"; export LIBCFLAGS;  \
+   echo Configuring stage 2 in $(HOST_SUBDIR)/libgrust; \
+   $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libgrust; \
+   cd $(HOST_SUBDIR)/libgrust || exit 1; \
+   case $(srcdir) in \
+ /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+ *) topdir=`echo $(HOST_SUBDIR)/libgrust/ | \
+   sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
+   esac; \
+   module_srcdir=libgrust; \
+   $(SHELL) $$s/$$module_srcdir/configure \
+ --srcdir=$${topdir}/$$module_srcdir \
+ $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
+ --target=${target_alias} \
+ --with-build-libsubdir=$(HOST_SUBDIR) \
+ $(STAGE2_CONFIGURE_FLAGS)
+@endif libgrust-bootstrap
+
+.PHONY: configure-stage3-libgrust maybe-configure-stage3-libgrust
+maybe-configure-stage3-libgrust:
+@if libgrust-bootstrap
+maybe-configure-stage3-libgrust: configure-stage3-libgrust
+configure-stage3-libgrust:
+   @[ $(current_stage) = stage3 ] || $(MAKE) stage3-start
+   @$(SHELL) $(srcdir)/mkinstalldirs $(H

[PATCH 2/2] gccrs: fixup: Fix missing build dependency

2024-01-11 Thread Arthur Cohen
From: Pierre-Emmanuel Patry 

Fix the missing dependency between the gcc and libgrust.

ChangeLog:

* Makefile.def: Add a dependency to libgrust for all-gcc.
* Makefile.in: Regenerate the file.

Signed-off-by: Pierre-Emmanuel Patry 
---
 Makefile.def |  1 +
 Makefile.in  | 10 ++
 2 files changed, 11 insertions(+)

diff --git a/Makefile.def b/Makefile.def
index 1a256db5518..19954e7d731 100644
--- a/Makefile.def
+++ b/Makefile.def
@@ -375,6 +375,7 @@ dependencies = { module=configure-gcc; on=all-ld; };
 dependencies = { module=configure-gcc; on=all-gold; };
 dependencies = { module=configure-gcc; on=all-libiconv; };
 dependencies = { module=all-gcc; on=all-libiberty; hard=true; };
+dependencies = { module=all-gcc; on=all-libgrust; };
 dependencies = { module=all-gcc; on=all-gettext; };
 dependencies = { module=all-gcc; on=all-mpfr; };
 dependencies = { module=all-gcc; on=all-mpc; };
diff --git a/Makefile.in b/Makefile.in
index 263b979609b..edb0c8a9a42 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -67558,6 +67558,16 @@ all-stagetrain-gcc: all-stagetrain-libiberty
 all-stagefeedback-gcc: all-stagefeedback-libiberty
 all-stageautoprofile-gcc: all-stageautoprofile-libiberty
 all-stageautofeedback-gcc: all-stageautofeedback-libiberty
+all-gcc: maybe-all-libgrust
+all-stage1-gcc: maybe-all-stage1-libgrust
+all-stage2-gcc: maybe-all-stage2-libgrust
+all-stage3-gcc: maybe-all-stage3-libgrust
+all-stage4-gcc: maybe-all-stage4-libgrust
+all-stageprofile-gcc: maybe-all-stageprofile-libgrust
+all-stagetrain-gcc: maybe-all-stagetrain-libgrust
+all-stagefeedback-gcc: maybe-all-stagefeedback-libgrust
+all-stageautoprofile-gcc: maybe-all-stageautoprofile-libgrust
+all-stageautofeedback-gcc: maybe-all-stageautofeedback-libgrust
 all-gcc: maybe-all-gettext
 all-stage1-gcc: maybe-all-stage1-gettext
 all-stage2-gcc: maybe-all-stage2-gettext
-- 
2.42.1



Re: [PATCH 2/2] gccrs: fixup: Fix missing build dependency

2024-01-11 Thread Richard Biener
On Thu, 11 Jan 2024, Arthur Cohen wrote:

> From: Pierre-Emmanuel Patry 
> 
> Fix the missing dependency between the gcc and libgrust.
> 
> ChangeLog:
> 
>   * Makefile.def: Add a dependency to libgrust for all-gcc.
>   * Makefile.in: Regenerate the file.
> 
> Signed-off-by: Pierre-Emmanuel Patry 
> ---
>  Makefile.def |  1 +
>  Makefile.in  | 10 ++
>  2 files changed, 11 insertions(+)
> 
> diff --git a/Makefile.def b/Makefile.def
> index 1a256db5518..19954e7d731 100644
> --- a/Makefile.def
> +++ b/Makefile.def
> @@ -375,6 +375,7 @@ dependencies = { module=configure-gcc; on=all-ld; };
>  dependencies = { module=configure-gcc; on=all-gold; };
>  dependencies = { module=configure-gcc; on=all-libiconv; };
>  dependencies = { module=all-gcc; on=all-libiberty; hard=true; };
> +dependencies = { module=all-gcc; on=all-libgrust; };

That looks wrong?  Why is libgrust both a host and a target module?
Is that really necessary?  IIRC the rust frontend isn't written in
rust?

The other patch is OK to push.

>  dependencies = { module=all-gcc; on=all-gettext; };
>  dependencies = { module=all-gcc; on=all-mpfr; };
>  dependencies = { module=all-gcc; on=all-mpc; };
> diff --git a/Makefile.in b/Makefile.in
> index 263b979609b..edb0c8a9a42 100644
> --- a/Makefile.in
> +++ b/Makefile.in
> @@ -67558,6 +67558,16 @@ all-stagetrain-gcc: all-stagetrain-libiberty
>  all-stagefeedback-gcc: all-stagefeedback-libiberty
>  all-stageautoprofile-gcc: all-stageautoprofile-libiberty
>  all-stageautofeedback-gcc: all-stageautofeedback-libiberty
> +all-gcc: maybe-all-libgrust
> +all-stage1-gcc: maybe-all-stage1-libgrust
> +all-stage2-gcc: maybe-all-stage2-libgrust
> +all-stage3-gcc: maybe-all-stage3-libgrust
> +all-stage4-gcc: maybe-all-stage4-libgrust
> +all-stageprofile-gcc: maybe-all-stageprofile-libgrust
> +all-stagetrain-gcc: maybe-all-stagetrain-libgrust
> +all-stagefeedback-gcc: maybe-all-stagefeedback-libgrust
> +all-stageautoprofile-gcc: maybe-all-stageautoprofile-libgrust
> +all-stageautofeedback-gcc: maybe-all-stageautofeedback-libgrust
>  all-gcc: maybe-all-gettext
>  all-stage1-gcc: maybe-all-stage1-gettext
>  all-stage2-gcc: maybe-all-stage2-gettext
> 

-- 
Richard Biener 
SUSE Software Solutions Germany GmbH,
Frankenstrasse 146, 90461 Nuernberg, Germany;
GF: Ivo Totev, Andrew McDonald, Werner Knoblich; (HRB 36809, AG Nuernberg)


Re: [PATCH 2/2] gccrs: fixup: Fix missing build dependency

2024-01-11 Thread Arthur Cohen

Hi Richard,

On 1/11/24 15:23, Richard Biener wrote:

On Thu, 11 Jan 2024, Arthur Cohen wrote:


From: Pierre-Emmanuel Patry 

Fix the missing dependency between the gcc and libgrust.

ChangeLog:

* Makefile.def: Add a dependency to libgrust for all-gcc.
* Makefile.in: Regenerate the file.

Signed-off-by: Pierre-Emmanuel Patry 
---
  Makefile.def |  1 +
  Makefile.in  | 10 ++
  2 files changed, 11 insertions(+)

diff --git a/Makefile.def b/Makefile.def
index 1a256db5518..19954e7d731 100644
--- a/Makefile.def
+++ b/Makefile.def
@@ -375,6 +375,7 @@ dependencies = { module=configure-gcc; on=all-ld; };
  dependencies = { module=configure-gcc; on=all-gold; };
  dependencies = { module=configure-gcc; on=all-libiconv; };
  dependencies = { module=all-gcc; on=all-libiberty; hard=true; };
+dependencies = { module=all-gcc; on=all-libgrust; };


That looks wrong?  Why is libgrust both a host and a target module?
Is that really necessary?  IIRC the rust frontend isn't written in
rust?


libgrust is both a host and target module as it implements some of the 
parser functionality - we had to split it from the frontend so that 
users of the procedural macro library could use it. So both the host and 
target link to that little bit of parser. Does that make sense?


Best,

Arthur



The other patch is OK to push.


  dependencies = { module=all-gcc; on=all-gettext; };
  dependencies = { module=all-gcc; on=all-mpfr; };
  dependencies = { module=all-gcc; on=all-mpc; };
diff --git a/Makefile.in b/Makefile.in
index 263b979609b..edb0c8a9a42 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -67558,6 +67558,16 @@ all-stagetrain-gcc: all-stagetrain-libiberty
  all-stagefeedback-gcc: all-stagefeedback-libiberty
  all-stageautoprofile-gcc: all-stageautoprofile-libiberty
  all-stageautofeedback-gcc: all-stageautofeedback-libiberty
+all-gcc: maybe-all-libgrust
+all-stage1-gcc: maybe-all-stage1-libgrust
+all-stage2-gcc: maybe-all-stage2-libgrust
+all-stage3-gcc: maybe-all-stage3-libgrust
+all-stage4-gcc: maybe-all-stage4-libgrust
+all-stageprofile-gcc: maybe-all-stageprofile-libgrust
+all-stagetrain-gcc: maybe-all-stagetrain-libgrust
+all-stagefeedback-gcc: maybe-all-stagefeedback-libgrust
+all-stageautoprofile-gcc: maybe-all-stageautoprofile-libgrust
+all-stageautofeedback-gcc: maybe-all-stageautofeedback-libgrust
  all-gcc: maybe-all-gettext
  all-stage1-gcc: maybe-all-stage1-gettext
  all-stage2-gcc: maybe-all-stage2-gettext





--
Arthur Cohen 

Toolchain Engineer

Embecosm GmbH

Geschäftsführer: Jeremy Bennett
Niederlassung: Nürnberg
Handelsregister: HR-B 36368
www.embecosm.de

Fürther Str. 27
90429 Nürnberg


Tel.: 091 - 128 707 040
Fax: 091 - 128 707 077


OpenPGP_0x1B3465B044AD9C65.asc
Description: OpenPGP public key


OpenPGP_signature.asc
Description: OpenPGP digital signature


Re: [PATCH 2/2] gccrs: fixup: Fix missing build dependency

2024-01-11 Thread Richard Biener
On Thu, 11 Jan 2024, Arthur Cohen wrote:

> Hi Richard,
> 
> On 1/11/24 15:23, Richard Biener wrote:
> > On Thu, 11 Jan 2024, Arthur Cohen wrote:
> > 
> >> From: Pierre-Emmanuel Patry 
> >>
> >> Fix the missing dependency between the gcc and libgrust.
> >>
> >> ChangeLog:
> >>
> >>  * Makefile.def: Add a dependency to libgrust for all-gcc.
> >>  * Makefile.in: Regenerate the file.
> >>
> >> Signed-off-by: Pierre-Emmanuel Patry 
> >> ---
> >>   Makefile.def |  1 +
> >>   Makefile.in  | 10 ++
> >>   2 files changed, 11 insertions(+)
> >>
> >> diff --git a/Makefile.def b/Makefile.def
> >> index 1a256db5518..19954e7d731 100644
> >> --- a/Makefile.def
> >> +++ b/Makefile.def
> >> @@ -375,6 +375,7 @@ dependencies = { module=configure-gcc; on=all-ld; };
> >>   dependencies = { module=configure-gcc; on=all-gold; };
> >>   dependencies = { module=configure-gcc; on=all-libiconv; };
> >>   dependencies = { module=all-gcc; on=all-libiberty; hard=true; };
> >> +dependencies = { module=all-gcc; on=all-libgrust; };
> > 
> > That looks wrong?  Why is libgrust both a host and a target module?
> > Is that really necessary?  IIRC the rust frontend isn't written in
> > rust?
> 
> libgrust is both a host and target module as it implements some of the parser
> functionality - we had to split it from the frontend so that users of the
> procedural macro library could use it. So both the host and target link to
> that little bit of parser. Does that make sense?

I see.  OK then.

Richard.

> Best,
> 
> Arthur
> 
> > 
> > The other patch is OK to push.
> > 
> >>   dependencies = { module=all-gcc; on=all-gettext; };
> >>   dependencies = { module=all-gcc; on=all-mpfr; };
> >>   dependencies = { module=all-gcc; on=all-mpc; };
> >> diff --git a/Makefile.in b/Makefile.in
> >> index 263b979609b..edb0c8a9a42 100644
> >> --- a/Makefile.in
> >> +++ b/Makefile.in
> >> @@ -67558,6 +67558,16 @@ all-stagetrain-gcc: all-stagetrain-libiberty
> >>   all-stagefeedback-gcc: all-stagefeedback-libiberty
> >>   all-stageautoprofile-gcc: all-stageautoprofile-libiberty
> >>   all-stageautofeedback-gcc: all-stageautofeedback-libiberty
> >> +all-gcc: maybe-all-libgrust
> >> +all-stage1-gcc: maybe-all-stage1-libgrust
> >> +all-stage2-gcc: maybe-all-stage2-libgrust
> >> +all-stage3-gcc: maybe-all-stage3-libgrust
> >> +all-stage4-gcc: maybe-all-stage4-libgrust
> >> +all-stageprofile-gcc: maybe-all-stageprofile-libgrust
> >> +all-stagetrain-gcc: maybe-all-stagetrain-libgrust
> >> +all-stagefeedback-gcc: maybe-all-stagefeedback-libgrust
> >> +all-stageautoprofile-gcc: maybe-all-stageautoprofile-libgrust
> >> +all-stageautofeedback-gcc: maybe-all-stageautofeedback-libgrust
> >>   all-gcc: maybe-all-gettext
> >>   all-stage1-gcc: maybe-all-stage1-gettext
> >>   all-stage2-gcc: maybe-all-stage2-gettext
> >>
> > 
> 
> 

-- 
Richard Biener 
SUSE Software Solutions Germany GmbH,
Frankenstrasse 146, 90461 Nuernberg, Germany;
GF: Ivo Totev, Andrew McDonald, Werner Knoblich; (HRB 36809, AG Nuernberg)


Re: [PATCHSET] Fix Rust bootstrap for future libgrust changes

2024-01-11 Thread Thomas Schwinge
Hi!

On 2024-01-11T15:22:07+0100, Arthur Cohen  wrote:
> Sorry about this - two simple changes to Makefile.def we had missed
> during our first libgrust/ patchset

I don't think those were "missed" but rather "intentionally omitted"?
I'll have to have a more detailed look.

(..., and almost no changes in the top-level build system I'd personally
dare to qualify as "simple"...)  ;-P


Grüße
 Thomas


> plus the associated regen of
> Makefile.in in each commit.
>
> Let me know if I should squash them together. I'll follow them up
> with our entire patchset.
>
> Best,
>
> Arthur