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 3/3][DejaGNU] target: Wrap linker flags into `-largs'/`-margs' for Ada
Date: Tue, 14 May 2019 21:49:00 -0000 [thread overview]
Message-ID: <alpine.DEB.2.20.1905142145350.18422@tpp.hgst.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1905132044060.18422@tpp.hgst.com>
Unrecognized `gnatmake' switches are not implicitly passed on to the
linker, so just pasting board `ldflags' and any other linker flags
verbatim into `add_flags' to use for the invocation line of `gnatmake'
will make them ignored at best.
For example in a GCC test environment that has:
set_board_info ldflags "-Wl,-dynamic-linker,.../sysroot/lib/ld-linux-riscv64-lp64d.so.1 -Wl,-rpath,.../sysroot/lib64/lp64d -Wl,-rpath,.../sysroot/usr/lib64/lp64d"
so that sysroot paths are correctly embedded with the binaries linked
for use with the dynamic loader and shared library dependencies, the
setting will be ignored for the GNAT test suite making all the execution
tests fail, e.g.:
PASS: gnat.dg/abstract_with_anonymous_result.adb (test for excess errors)
spawn qemu-riscv64 ./abstract_with_anonymous_result.exe
/lib/ld-linux-riscv64-lp64d.so.1: No such file or directory
FAIL: gnat.dg/abstract_with_anonymous_result.adb execution test
For `gnatmake' to pass switches on to the linker the `-largs' switch has
to be used, which affects all the switches that follow until a switch is
seen that changes the selection, like `-margs', which resets to the
initial state of the switch interpretation machine.
Wrap linker flags into `-largs'/`-margs' for Ada then, carefully
preserving the place these flags are placed within `add_flags', as
surely someone will have depended on that, correcting test failures like
above:
PASS: gnat.dg/abstract_with_anonymous_result.adb (test for excess errors)
spawn qemu-riscv64 ./abstract_with_anonymous_result.exe
PASS: gnat.dg/abstract_with_anonymous_result.adb execution test
* lib/target.exp (default_target_compile): Wrap linker flags into
`-largs'/`-margs' for Ada.
Signed-off-by: Maciej W. Rozycki <macro@wdc.com>
---
Hi,
My WDC copyright paperwork has not been sorted with FSF yet, however I
have not contributed to DejaGNU on behalf of WDC so far and I believe this
change falls within the limit of roughly 15 lines to be considered legally
insignificant given that:
"A regular series of repeated changes, such as renaming a symbol, is not
legally significant even if the symbol has to be renamed in many places."
Please apply then; this does not rely on 2/3 in any way, as we ought to
handle Ada compilations correctly regardless of whether our caller does
the right thing there.
Maciej
---
lib/target.exp | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
dejagnu-target-ada-ldflags.diff
Index: dejagnu/lib/target.exp
===================================================================
--- dejagnu.orig/lib/target.exp
+++ dejagnu/lib/target.exp
@@ -518,11 +518,12 @@ proc default_target_compile {source dest
}
if { $type eq "executable" } {
+ set extra_ldflags ""
if {[board_info $dest exists ldflags]} {
- append add_flags " [board_info $dest ldflags]"
+ append extra_ldflags " [board_info $dest ldflags]"
}
if { $compiler_type eq "c++" } {
- append add_flags " [g++_link_flags]"
+ append extra_ldflags " [g++_link_flags]"
}
if {[isnative]} {
# This is a lose.
@@ -530,16 +531,23 @@ proc default_target_compile {source dest
if { $tmp ne "" } {
if {[regexp ".*solaris2.*" $target_triplet]} {
# Solaris 2
- append add_flags " -R$tool_root_dir/libstdc++"
+ append extra_ldflags " -R$tool_root_dir/libstdc++"
} elseif {[regexp ".*(osf|irix5|linux).*" $target_triplet]} {
# OSF/1 or IRIX 5
- append add_flags " -Wl,-rpath,$tool_root_dir/libstdc++"
+ append extra_ldflags " -Wl,-rpath,$tool_root_dir/libstdc++"
} elseif {[regexp ".*hppa.*" $target_triplet]} {
# HP-UX
- append add_flags " -Wl,-a,shared_archive"
+ append extra_ldflags " -Wl,-a,shared_archive"
}
}
}
+ if { $extra_ldflags ne "" } {
+ if { $compiler_type eq "ada" } {
+ append add_flags " -largs $extra_ldflags -margs"
+ } else {
+ append add_flags " $extra_ldflags"
+ }
+ }
}
if {![info exists ldscript]} {
@@ -561,7 +569,11 @@ proc default_target_compile {source dest
}
if { $type eq "executable" } {
- append add_flags " $ldflags"
+ if { $compiler_type eq "ada" } {
+ append add_flags " -largs $ldflags -margs"
+ } else {
+ append add_flags " $ldflags"
+ }
foreach x $libs {
if {[file exists $x]} {
append source " $x"
next prev parent reply other threads:[~2019-05-14 21:49 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 ` [PATCH 1/3][GCC] gnatmake: Accept the `--sysroot=' GCC driver option Maciej W. Rozycki
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 ` Maciej W. Rozycki [this message]
2019-05-16 0:00 ` [PATCH 3/3][DejaGNU] target: Wrap linker flags into `-largs'/`-margs' for Ada 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.1905142145350.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).