This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[committed v2 1/3][GCC] gnatmake: Accept the `--sysroot=' GCC driver option
- From: "Maciej W. Rozycki" <macro at wdc dot com>
- To: Arnaud Charlet <charlet at adacore dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, "dejagnu at gnu dot org" <dejagnu at gnu dot org>, Eric Botcazou <ebotcazou at libertysurf dot fr>, Pierre-Marie de Rodat <derodat at adacore dot com>
- Date: Fri, 13 Sep 2019 18:44:09 +0100 (BST)
- Subject: [committed v2 1/3][GCC] gnatmake: Accept the `--sysroot=' GCC driver option
- Ironport-sdr: QUCDmGv8ZXtyp20PgkxTrV3bCCL3khf0n0b6u4XZ0io0MLNJbdLctEUYyWq0qo6wxaPU0gyHVc 5XrnybD0Lx+4hHQWvwf7VIlYvvZpknMZHq6N9lY4Tm3BC3gKdVFEYVjPKG6E0PlugFhz3oklv8 lgul/8dqbqRgR73AuAJc5tuO5nDpWCFHjvOiS7z6RwQYlfQ5aFBJ97crn+oP5t/tXhK6H1EDPv NBrrQyH6SBhTvYQnhKhfiJwX2GtfDJ8unh29zjUz5zOfjxHyaGIgeK467isc/9rF6mudBkwpGV fjE=
- Ironport-sdr: hKsvXOw533Jrv5ZsI/DKTTxcT3vKg44Webt5OKUi3XKULcI/xLGbSSzHGSPxQuoXqraa5X7KHk Ymh3tgTTzga7L9g5RJwNsxWuOVB9zTro68FCfBF4jdXWCdbglZAe9KvpAVvXqtqBS2eaHgL/IM dhtArPEr5ebGb4fAE52U+zWuC7LZ/ZhCxIkvY0dcxjByQOtg/xNfnFxDCFM+ufX95mxW6bRGHX 7MWCeZiF8JrhlaHb45Q7kC+RqZ8YfAp+O2nOj0B73shhsBqMLmci1X4yvXeaXT3hgm3NZdobv/ j2BiIoxdp8Ggc/O49yGiBWgV
- Ironport-sdr: NNJtJlRcdOoEH2vv3+3Al99kKkSCSzIL+TJTJDaiIXP0Bu0qqfkDd4NTD0meUklHBvxaaIyPf1 ru5Qrzg/uxd12vFd2Y4jFAYYOan5IfnSkS37yGtdUOJP0O8WuEocAqr8BPy6jE+ooKJelcF8R8 n432eD8y9Bk60zNOhZfOcqOmog+noO8Avq6FwMFr+KuRRyNYdLQhdEEQD8d3uiDP7gU4uEx3ZV +gvs9MQKC3vsE39Nm6iZ4gWEXJh8I9Pjr3oF3dDfZrIxrZNj5YRyxSSDRLooIw6ROGitoEAYlW chI=
- Wdcironportexception: Internal
According to `gnatmake' documentation:
"Any uppercase or multi-character switch that is not a 'gnatmake' switch
is passed to 'gcc' (e.g., '-O', '-gnato,' etc.)"
however the `--sysroot=' switch is actually rejected:
gnatmake: invalid switch: --sysroot=...
likely because it is one of the very few GCC driver options that have a
leading double dash and therefore we don't have a blanket fall-through
for such switches that would satisfy what our documentation claims.
The option is actually shared between the compiler and the linker, so
pass the switch to both build stages if requested, removing GNAT
testsuite issues like:
gnatmake: invalid switch: --sysroot=.../sysroot
compiler exited with status 1
Executing on host: .../gcc/gnatclean -c -q -n ./abstract_with_anonymous_result (timeout = 300)
spawn -ignore SIGHUP .../gcc/gnatclean -c -q -n ./abstract_with_anonymous_result
PASS: gnat.dg/abstract_with_anonymous_result.adb (test for excess errors)
UNRESOLVED: gnat.dg/abstract_with_anonymous_result.adb compilation failed to produce executable
in a test environment where `--with-build-sysroot=.../sysroot' has been
used to build a cross-compiler. Passing to the compilation stage only
would lead to errors like:
.../bin/riscv64-linux-gnu-ld: cannot find crt1.o: No such file or directory
.../bin/riscv64-linux-gnu-ld: cannot find -lc
collect2: error: ld returned 1 exit status
gnatlink: error when calling .../gcc/xgcc
gnatmake: *** link failed.
compiler exited with status 1
Executing on host: .../gcc/gnatclean -c -q -n ./abstract_with_anonymous_result (timeout = 300)
spawn -ignore SIGHUP .../gcc/gnatclean -c -q -n ./abstract_with_anonymous_result
./abstract_with_anonymous_result.ali
./abstract_with_anonymous_result.o
FAIL: gnat.dg/abstract_with_anonymous_result.adb (test for excess errors)
Excess errors:
.../bin/riscv64-linux-gnu-ld: cannot find crt1.o: No such file or directory
.../bin/riscv64-linux-gnu-ld: cannot find -lc
gnatlink: error when calling .../gcc/xgcc
UNRESOLVED: gnat.dg/abstract_with_anonymous_result.adb compilation failed to produce executable
instead.
gcc/ada/
* make.adb (Scan_Make_Arg): Also accept `--sysroot=' for the
compiler and the linker.
---
Hi,
On Thu, 20 Jun 2019, Arnaud Charlet wrote:
> > > Have you resolved your copyright assignment issues since then?
> >
> > The ball is now in FSF's court I'm told.
>
> OK
This has now been sorted.
> > > The above patch needs to use "or else" instead of "or". OK with this change
> > > on the above patch.
> >
> > OK, I have updated that in my patch.
> >
> > Technically both variants of the expression achieve the same effect here
> > as there is no problem with evaluating both sides of the OR operation in
> > all cases, but your suggestion might help the readers avoid scratching
> > their heads.
>
> The performance isn't the same, and more importantly, this is the documented
> Ada coding style for GNAT: https://gcc.gnu.org/onlinedocs/gnat-style/Statements.html#Statements
Ack.
This is the version I have committed. Thank you for your review.
Maciej
---
gcc/ada/make.adb | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
gcc-gnatmake-sysroot.diff
Index: gcc/gcc/ada/make.adb
===================================================================
--- gcc.orig/gcc/ada/make.adb
+++ gcc/gcc/ada/make.adb
@@ -4516,7 +4516,9 @@ package body Make is
end;
end if;
- elsif Argv'Length >= 8 and then Argv (1 .. 8) = "--param=" then
+ elsif (Argv'Length >= 8 and then Argv (1 .. 8) = "--param=")
+ or else (Argv'Length >= 10 and then Argv (1 .. 10) = "--sysroot=")
+ then
Add_Switch (Argv, Compiler);
Add_Switch (Argv, Linker);