public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Maciej W. Rozycki" <macro@wdc.com>
To: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>,
	"dejagnu@gnu.org"	<dejagnu@gnu.org>
Cc: Arnaud Charlet <charlet@adacore.com>,
	Eric Botcazou	<ebotcazou@libertysurf.fr>,
	Pierre-Marie de Rodat <derodat@adacore.com>
Subject: [PATCH 1/3][GCC] gnatmake: Accept the `--sysroot=' GCC driver option
Date: Tue, 14 May 2019 21:47:00 -0000	[thread overview]
Message-ID: <alpine.DEB.2.20.1905141549520.18422@tpp.hgst.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1905132044060.18422@tpp.hgst.com>

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,

 I think treating `--sysroot=' like this makes sense, as otherwise it'd 
have to be specified twice, once with `-largs' and the second time 
optionally with `-cargs'.  It's consistent with how `--param=' is handled.
I'm not sure if this peculiarity should be mentioned in the manual; it 
surely is not for the existing `--param=' switch.

 Unfortunately I have exhausted the limit of changes I can make to GCC 
without my WDC copyright paperwork sorted with FSF.  OK to apply once that 
has been completed?

  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 (Argv'Length >= 10 and then Argv (1 .. 10) = "--sysroot=")
+         then
             Add_Switch (Argv, Compiler);
             Add_Switch (Argv, Linker);
 

  reply	other threads:[~2019-05-14 21:47 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-14 21:46 [PATCH 0/3] GNAT test suite fixes for build sysroot Maciej W. Rozycki
2019-05-14 21:47 ` Maciej W. Rozycki [this message]
2019-05-14 21:48 ` [PATCH 2/3][GCC] GNAT/testsuite: Pass the `ada' option to target compilation Maciej W. Rozycki
2019-05-15 23:12   ` Jacob Bachmeyer
2019-05-16 12:38     ` Maciej W. Rozycki
2019-05-16 22:57       ` Jacob Bachmeyer
2019-05-14 21:49 ` [PATCH 3/3][DejaGNU] target: Wrap linker flags into `-largs'/`-margs' for Ada Maciej W. Rozycki
2019-05-16  0:00   ` Jacob Bachmeyer
2019-05-16 12:58     ` Maciej W. Rozycki
2019-05-16 23:39       ` Jacob Bachmeyer
2019-05-21 21:37         ` Maciej Rozycki
2019-05-22  0:04           ` Jacob Bachmeyer
2019-10-25 17:40             ` [PING^3][PATCH " Maciej W. Rozycki
2019-10-26  1:30               ` Jacob Bachmeyer
2019-06-19 12:16 ` [PING][PATCH 0/3] GNAT test suite fixes for build sysroot Maciej Rozycki
2019-06-19 12:49   ` Arnaud Charlet
2019-06-20 14:51     ` Maciej Rozycki
2019-06-20 15:14       ` Arnaud Charlet
2019-06-20 15:32         ` Maciej Rozycki
2019-09-13 17:56 ` [PING^2][PATCH " Maciej W. Rozycki
2019-09-16  9:12   ` Arnaud Charlet
2019-09-23 23:21     ` Maciej W. Rozycki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.20.1905141549520.18422@tpp.hgst.com \
    --to=macro@wdc.com \
    --cc=charlet@adacore.com \
    --cc=dejagnu@gnu.org \
    --cc=derodat@adacore.com \
    --cc=ebotcazou@libertysurf.fr \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).