Re: [PATCH v2 2/4] libgrust: Add libproc_macro and build system

2024-01-16 Thread Jason Merrill

On 12/15/23 04:53, Thomas Schwinge wrote:

Hi Jason!

I think you usually deal with these kind of GCC Git things?  If not,
please let me know.


I just took care of this; I didn't notice it until now because the 
subject line didn't seem relevant to me.



On 2023-10-26T10:21:18+0200, I wrote:

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.  [...]


Please now delete the GCC Git 'devel/rust/libgrust-v2' branch, which was
only used temporarily, and is now obsolete.

 $ git push upstream :devel/rust/libgrust-v2
 remote: *** Deleting branch 'devel/rust/libgrust-v2' is not allowed.
 remote: ***
 remote: *** This repository currently only allow the deletion of references
 remote: *** whose name matches the following:
 remote: ***
 remote: *** refs/users/[^/]*/heads/.*
 remote: *** refs/vendors/[^/]*/heads/.*
 remote: ***
 remote: *** Branch deletion is only allowed for user and vendor branches.  
If another branch was created by mistake, contact an administrator to delete it 
on the server with git update-ref.  If a development branch is dead, also 
contact an administrator to move it under refs/dead/heads/ rather than deleting 
it.
 remote: error: hook declined to update refs/heads/devel/rust/libgrust-v2
 To git+ssh://gcc.gnu.org/git/gcc.git
  ! [remote rejected]   devel/rust/libgrust-v2 (hook declined)
 error: failed to push some refs to 'git+ssh://gcc.gnu.org/git/gcc.git'


Grüße
  Thomas





libgrust: 'AM_ENABLE_MULTILIB' only for target builds [PR113056] (was: [PATCH v2 2/4] libgrust: Add libproc_macro and build system)

2023-12-18 Thread Thomas Schwinge
Hi!

> --- a/libgrust/configure.ac
> +++ b/libgrust/configure.ac

> -# AM_ENABLE_MULTILIB(, ..)
> +AM_ENABLE_MULTILIB(, ..)

Such a change was applied eventually, and is necessary for target builds
-- but potentially harmful for host builds.  OK to push the attached
"libgrust: 'AM_ENABLE_MULTILIB' only for target builds [PR113056]"?


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
>From 71e00b191bd630aa3be66e38069c707ae76a91d3 Mon Sep 17 00:00:00 2001
From: Thomas Schwinge 
Date: Mon, 18 Dec 2023 16:27:39 +0100
Subject: [PATCH] libgrust: 'AM_ENABLE_MULTILIB' only for target builds
 [PR113056]

..., but not for host builds, which don't need it, and it may cause the build
to fail.

Use what appears to be the standard pattern for that (see
'libbacktrace/configure.ac', 'zlib/configure.ac').

	PR rust/113056
	libgrust/
	* configure.ac: 'AM_ENABLE_MULTILIB' only for target builds.
	* configure: Regenerate.
---
 libgrust/configure| 8 +---
 libgrust/configure.ac | 4 +++-
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/libgrust/configure b/libgrust/configure
index 5388a0e22a6..e778a253915 100755
--- a/libgrust/configure
+++ b/libgrust/configure
@@ -2387,7 +2387,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 ac_config_files="$ac_config_files Makefile"
 
 
-# Default to --enable-multilib
+if test -n "${with_target_subdir}"; then
+  # Default to --enable-multilib
 # Check whether --enable-multilib was given.
 if test "${enable_multilib+set}" = set; then :
   enableval=$enable_multilib; case "$enableval" in
@@ -2424,6 +2425,7 @@ fi
 
 ac_config_commands="$ac_config_commands default-1"
 
+fi
 
 # Do not delete or change the following two lines.  For why, see
 # http://gcc.gnu.org/ml/libstdc++/2003-07/msg00451.html
@@ -12653,7 +12655,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12656 "configure"
+#line 12658 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12759,7 +12761,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12762 "configure"
+#line 12764 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/libgrust/configure.ac b/libgrust/configure.ac
index 226c42ba649..adfb3500fb3 100644
--- a/libgrust/configure.ac
+++ b/libgrust/configure.ac
@@ -2,7 +2,9 @@ AC_INIT([libgrust], version-unused,,libgrust)
 AC_CONFIG_SRCDIR(Makefile.am)
 AC_CONFIG_FILES([Makefile])
 
-AM_ENABLE_MULTILIB(, ..)
+if test -n "${with_target_subdir}"; then
+  AM_ENABLE_MULTILIB(, ..)
+fi
 
 # Do not delete or change the following two lines.  For why, see
 # http://gcc.gnu.org/ml/libstdc++/2003-07/msg00451.html
-- 
2.34.1



Re: [PATCH v2 2/4] libgrust: Add libproc_macro and build system

2023-12-15 Thread Thomas Schwinge
Hi Jason!

I think you usually deal with these kind of GCC Git things?  If not,
please let me know.

On 2023-10-26T10:21:18+0200, I wrote:
> 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.  [...]

Please now delete the GCC Git 'devel/rust/libgrust-v2' branch, which was
only used temporarily, and is now obsolete.

$ git push upstream :devel/rust/libgrust-v2
remote: *** Deleting branch 'devel/rust/libgrust-v2' is not allowed.
remote: *** 
remote: *** This repository currently only allow the deletion of references
remote: *** whose name matches the following:
remote: *** 
remote: *** refs/users/[^/]*/heads/.*
remote: *** refs/vendors/[^/]*/heads/.*
remote: *** 
remote: *** Branch deletion is only allowed for user and vendor branches.  
If another branch was created by mistake, contact an administrator to delete it 
on the server with git update-ref.  If a development branch is dead, also 
contact an administrator to move it under refs/dead/heads/ rather than deleting 
it.
remote: error: hook declined to update refs/heads/devel/rust/libgrust-v2
To git+ssh://gcc.gnu.org/git/gcc.git
 ! [remote rejected]   devel/rust/libgrust-v2 (hook declined)
error: failed to push some refs to 'git+ssh://gcc.gnu.org/git/gcc.git'


Grüße
 Thomas


Disable target libgrust if we're not building target libstdc++ (was: [PATCH v2 2/4] libgrust: Add libproc_macro and build system)

2023-10-27 Thread Thomas Schwinge
Hi!

Short Friday evening status update:

On 2023-10-27T16:20:34+0200, I wrote:
> Short Friday afternoon status update:
>
> On 2023-10-27T08:51:12+0100, Iain Sandoe  wrote:
>>> On 26 Oct 2023, at 09:21, Thomas Schwinge  wrote:
>>> 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)
>
> Indeed, this currently fails to build:
>
> [...]
> make[3]: Entering directory 
> `[...]/build-gcc/amdgcn-amdhsa/libgrust/libproc_macro'
> [...]
> libtool: compile:  [...]/build-gcc/./gcc/xg++ -B[...]/build-gcc/./gcc/ 
> -nostdinc++ -funconfigured-libstdc++-v3 [...] -c 
> [...]/source-gcc/libgrust/libproc_macro/proc_macro.cc
> xg++: error: unrecognized command-line option 
> ‘-funconfigured-libstdc++-v3’
> make[3]: *** [proc_macro.lo] Error 1
> make[3]: Leaving directory 
> `[...]/build-gcc/amdgcn-amdhsa/libgrust/libproc_macro'
> make[2]: *** [all-recursive] Error 1
> make[2]: Leaving directory `[...]/build-gcc/amdgcn-amdhsa/libgrust'
> make[1]: *** [all-target-libgrust] Error 2
> make[1]: Leaving directory `[...]/build-gcc'
> make: *** [all] Error 2
>
> ("error: unrecognized command-line option ‘-funconfigured-libstdc++-v3’"
> indeed is the expected outcome if libstdc++ is not available, as I
> understand.)
>
> Same for nvptx-none target.
>
> We need two things: (a) make sure that target libgrust build depends on
> target libstdc++, and (b) disable target libgrust if target libstdc++ is
> not available (and, later, gracefully handle that situation in the Rust
> front end).
>
> As far as I remember, patches exist for (a), and Arthur is going to
> integrate/re-submit those.

In fact, for (a), it seem that we just this one
GCC/Rust commit 6a8b207b9ef7f9038e0cae7766117428783825d8
"libgrust: Add dependency to libstdc++"; see

"Add libstdc++ dependency to libgrust".

> Arthur, before re-submission, feel free to
> first cherr-pick and push'these into the GCC upstream Git branch
> devel/rust/libgrust-v2, so that I can re-test.

> I'm not sure about (b),
> whether that fell out of the (a) changes, too?  I can otherwise look into
> that later.

..., which I've now done.  Indeed that is still broken.  We need, if I
understand this correctly, the attached
"Disable target libgrust if we're not building target libstdc++" to
address that issue.

Pierre-Emmanuel: In this case (that is we cannot build target libgrust
because we're not building target libstdc++), do we also disable host
libgrust, or do we still build that one?  (This can be settled later.)


>>> and in my hacky WIP
>>> trees where C++ (standard library) is supported to some extent.
>
> This does built

..., but only if target libstdc++ already happens to have been built.  If
not, you'll run into funny libtool errors like:

[...]
libtool: compile: unrecognized option 
`-B[...]/build-gcc/amdgcn-amdhsa/libstdc++-v3/src/.libs'
libtool: compile: Try `libtool --help' for more information.
make[3]: *** [proc_macro.lo] Error 1
make[3]: Leaving directory 
`[...]/build-gcc/amdgcn-amdhsa/libgrust/libproc_macro'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `[...]/build-gcc/amdgcn-amdhsa/libgrust'
make[1]: *** [all-target-libgrust] Error 2
[...]

(This translates into: target libstdc++ has not (yet) been built;
'[...]/build-gcc/amdgcn-amdhsa/libstdc++-v3/src/.libs' is not (yet)
available.)

Need "libgrust: Add dependency to libstdc++" (see above) to make this
work reliably.


Grüße
 Thomas


> -- but the default multilib only, as Iain already
> reported:
>
>>> (This
>>> should, roughly, match C++ functionality (not) provided by a number of
>>> other GCC "embedded" targets.)
>>
>> on Darwin, it works for later systems without multilibs, but fails to build 
>> multilibs.
>
> I see that, too.
>
>> —— so….
>>
>> With the patch below bootstrap suceeded on x86_64-darwin17 and produced a 
>> correct
>> architecture multilib.
>
> Confirmed, thanks!
>
>> Of course, there is no way to test this at the moment - I’d suggest
>> that the next step might be something small in functionality that can allow 
>> at least one
>> test to be wired up.
>
> ACK.
>
>> ^^^ this is “lightly tested” of course, as I cycle through other versions of 
>> the OS will see
>> how it pans out.
>>
>> Do you want me to make a PR with this change against upstream?
>
> Yes, please.  (But no hurry.)
>
>
> Grüße
>  Thomas
>
>
>> From 027bc2c5255a6f1b75592e896dd99fac55bfb9b8 Mon Sep 17 00:00:00 2001
>> From: Iain Sandoe 
>> Date: Thu, 26 Oct 2023 23:19:36 +0100
>> Subject: [PATCH] libgrust: enable multilib
>>
>> Most of this change is the regenerated files, the multilib config macro
>> was already 

Re: [PATCH v2 2/4] libgrust: Add libproc_macro and build system

2023-10-27 Thread Thomas Schwinge
Hi!

Short Friday afternoon status update:

On 2023-10-27T08:51:12+0100, Iain Sandoe  wrote:
>> On 26 Oct 2023, at 09:21, Thomas Schwinge  wrote:
>> 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)

Indeed, this currently fails to build:

[...]
make[3]: Entering directory 
`[...]/build-gcc/amdgcn-amdhsa/libgrust/libproc_macro'
[...]
libtool: compile:  [...]/build-gcc/./gcc/xg++ -B[...]/build-gcc/./gcc/ 
-nostdinc++ -funconfigured-libstdc++-v3 [...] -c 
[...]/source-gcc/libgrust/libproc_macro/proc_macro.cc
xg++: error: unrecognized command-line option ‘-funconfigured-libstdc++-v3’
make[3]: *** [proc_macro.lo] Error 1
make[3]: Leaving directory 
`[...]/build-gcc/amdgcn-amdhsa/libgrust/libproc_macro'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `[...]/build-gcc/amdgcn-amdhsa/libgrust'
make[1]: *** [all-target-libgrust] Error 2
make[1]: Leaving directory `[...]/build-gcc'
make: *** [all] Error 2

("error: unrecognized command-line option ‘-funconfigured-libstdc++-v3’"
indeed is the expected outcome if libstdc++ is not available, as I
understand.)

Same for nvptx-none target.

We need two things: (a) make sure that target libgrust build depends on
target libstdc++, and (b) disable target libgrust if target libstdc++ is
not available (and, later, gracefully handle that situation in the Rust
front end).

As far as I remember, patches exist for (a), and Arthur is going to
integrate/re-submit those.  Arthur, before re-submission, feel free to
first cherr-pick and push'these into the GCC upstream Git branch
devel/rust/libgrust-v2, so that I can re-test.  I'm not sure about (b),
whether that fell out of the (a) changes, too?  I can otherwise look into
that later.

>> and in my hacky WIP
>> trees where C++ (standard library) is supported to some extent.

This does built -- but the default multilib only, as Iain already
reported:

>> (This
>> should, roughly, match C++ functionality (not) provided by a number of
>> other GCC "embedded" targets.)
>
> on Darwin, it works for later systems without multilibs, but fails to build 
> multilibs.

I see that, too.

> —— so….
>
> With the patch below bootstrap suceeded on x86_64-darwin17 and produced a 
> correct
> architecture multilib.

Confirmed, thanks!

> Of course, there is no way to test this at the moment - I’d suggest
> that the next step might be something small in functionality that can allow 
> at least one
> test to be wired up.

ACK.

> ^^^ this is “lightly tested” of course, as I cycle through other versions of 
> the OS will see
> how it pans out.
>
> Do you want me to make a PR with this change against upstream?

Yes, please.  (But no hurry.)


Grüße
 Thomas


> From 027bc2c5255a6f1b75592e896dd99fac55bfb9b8 Mon Sep 17 00:00:00 2001
> From: Iain Sandoe 
> Date: Thu, 26 Oct 2023 23:19:36 +0100
> Subject: [PATCH] libgrust: enable multilib
>
> Most of this change is the regenerated files, the multilib config macro
> was already present, but commented out.
>
> libgrust/ChangeLog:
>
>   * Makefile.in:
>   * aclocal.m4: Regenerate.
>   * configure: Regenerate.
>   * configure.ac: Uncomment AM_ENABLE_MULTILIB.
>   * libproc_macro/Makefile.in:
>
> Signed-off-by: Iain Sandoe 
> ---
>  libgrust/Makefile.in   |  2 +
>  libgrust/aclocal.m4|  1 +
>  libgrust/configure | 68 --
>  libgrust/configure.ac  |  2 +-
>  libgrust/libproc_macro/Makefile.in |  2 +
>  5 files changed, 71 insertions(+), 4 deletions(-)
>
> diff --git a/libgrust/Makefile.in b/libgrust/Makefile.in
> index bc9b6cc227a..2dc39adff24 100644
> --- a/libgrust/Makefile.in
> +++ b/libgrust/Makefile.in
> @@ -93,6 +93,7 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
>  am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
>   $(top_srcdir)/../config/depstand.m4 \
>   $(top_srcdir)/../config/lead-dot.m4 \
> + $(top_srcdir)/../config/multi.m4 \
>   $(top_srcdir)/../config/no-executables.m4 \
>   $(top_srcdir)/../config/override.m4 \
>   $(top_srcdir)/../config/toolexeclibdir.m4 \
> @@ -275,6 +276,7 @@ localedir = @localedir@
>  localstatedir = @localstatedir@
>  mandir = @mandir@
>  mkdir_p = @mkdir_p@
> +multi_basedir = @multi_basedir@
>  oldincludedir = @oldincludedir@
>  pdfdir = @pdfdir@
>  prefix = @prefix@
> diff --git a/libgrust/aclocal.m4 b/libgrust/aclocal.m4
> index 1bd42c34d74..5d808f05afa 100644
> --- a/libgrust/aclocal.m4
> +++ b/libgrust/aclocal.m4
> @@ -1250,6 +1250,7 @@ AC_SUBST([am__untar])
>  m4_include([../config/acx.m4])
>  m4_include([../config/depstand.m4])
>  m4_include([../config/lead-dot.m4])
> 

Re: [PATCH v2 2/4] libgrust: Add libproc_macro and build system

2023-10-27 Thread Iain Sandoe


> On 26 Oct 2023, at 09:21, Thomas Schwinge  wrote:
> 
> 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.)

on Darwin, it works for later systems without multilibs, but fails to build 
multilibs.

—— so….

With the patch below bootstrap suceeded on x86_64-darwin17 and produced a 
correct
architecture multilib.  Of course, there is no way to test this at the moment - 
I’d suggest
that the next step might be something small in functionality that can allow at 
least one
test to be wired up.

^^^ this is “lightly tested” of course, as I cycle through other versions of 
the OS will see
how it pans out.

Do you want me to make a PR with this change against upstream?

Iain



0001-libgrust-enable-multilib.patch
Description: Binary data

> 
> 
> 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=$(TARGET_LIB_PATH_librust)" \
> 
> 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-werrordisable building with -Werror
> 
>  --enable-symvers=STYLE  enables symbol versioning of the shared library
>  [default=yes]
> 
>  --enable-cetenable Intel CET in target libraries 
> [default=auto]
> 
>  --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 
> 6a6d3817afa02bbcd2388c8e005da6faf88932f1 "Config,Darwin: Allow for 
> configuring Darwin to use embedded runpath"'.
> 
> 
> Grüße
> 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 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)" \
>> + 

Re: [PATCH v2 2/4] libgrust: Add libproc_macro and build system

2023-10-26 Thread Thomas Schwinge
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=$(TARGET_LIB_PATH_librust)" \

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-werrordisable building with -Werror

  --enable-symvers=STYLE  enables symbol versioning of the shared library
  [default=yes]

  --enable-cetenable Intel CET in target libraries 
[default=auto]

  --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 
6a6d3817afa02bbcd2388c8e005da6faf88932f1 "Config,Darwin: Allow for configuring 
Darwin to use embedded runpath"'.


Grüße
 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 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)" \
> + 

[PATCH v2 2/4] libgrust: Add libproc_macro and build system

2023-10-25 Thread Arthur Cohen
From: Pierre-Emmanuel Patry 

Add some dummy files in libproc_macro along with its build system.

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 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
+
+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-libsSpecify that runtime libraries 
should be installed in a compiler-specific directory ],
+[case "$enableval" in
+ yes) version_specific_libs=yes ;;
+ no)