diff options
author | Maciej W. Rozycki <macro@wdc.com> | 2020-06-20 01:45:03 +0100 |
---|---|---|
committer | Rob Savoye <rob@senecass.com> | 2020-07-13 21:05:09 -0600 |
commit | 7dd28b93962f25cd42e908f24eee93e1d22de0a8 (patch) | |
tree | afa6710953316fd0715abd4e4d3dc4283b884adb /testsuite | |
parent | 5d954c5ad5f178eb096b93a301f0bd3a08d47ab3 (diff) |
target: Wrap linker flags into `-largs'/`-margs' for Ada
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 at 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
Pass multilib flags both to the compiler and to the linker as both build
stages interpret them.
Update the testsuite accordingly.
* lib/target.exp (default_target_compile): Wrap linker flags into
`-largs'/`-margs' for Ada.
* testsuite/runtest.libs/target.test (compile_test): Update
accordingly.
Signed-off-by: Maciej W. Rozycki <macro@wdc.com>
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/runtest.libs/target.test | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/testsuite/runtest.libs/target.test b/testsuite/runtest.libs/target.test index 11d32ba..9f1ad51 100644 --- a/testsuite/runtest.libs/target.test +++ b/testsuite/runtest.libs/target.test @@ -681,8 +681,8 @@ eval_tests compile_test { "find_gcc" ! {} "find_gnatmake" ! {} "remote_exec host" U - { 2 {m68k-unknown-aout-gnatmake foo.adb -midp -fada - -E -I/usr/gnemul/idp/include} } + { 2 {m68k-unknown-aout-gnatmake foo.adb -midp -largs -midp -margs + -fada -E -I/usr/gnemul/idp/include} } } } { "compile Ada to assembly with target compiler" @@ -691,8 +691,8 @@ eval_tests compile_test { "find_gcc" ! {} "find_gnatmake" ! {} "remote_exec host" U - { 2 {m68k-unknown-aout-gnatmake foo.adb -midp -fada - -S -I/usr/gnemul/idp/include -o foo.s} } + { 2 {m68k-unknown-aout-gnatmake foo.adb -midp -largs -midp -margs + -fada -S -I/usr/gnemul/idp/include -o foo.s} } } } { "compile Ada to object with target compiler" @@ -701,7 +701,7 @@ eval_tests compile_test { "find_gcc" ! {} "find_gnatmake" ! {} "remote_exec host" U - { 2 {m68k-unknown-aout-gnatmake -midp -fada + { 2 {m68k-unknown-aout-gnatmake -midp -largs -midp -margs -fada -c -I/usr/gnemul/idp/include -o foo.o foo.adb} } } @@ -712,9 +712,9 @@ eval_tests compile_test { "find_gcc" ! {} "find_gnatmake" ! {} "remote_exec host" U - { 2 {m68k-unknown-aout-gnatmake foo.adb -midp -fada - -I/usr/gnemul/idp/include -L/usr/gnemul/idp/lib - -lidpsup -lm_idp -Tidp.ld -o foo} } + { 2 {m68k-unknown-aout-gnatmake foo.adb -midp -largs -midp -margs + -fada -I/usr/gnemul/idp/include -largs -L/usr/gnemul/idp/lib + -margs -largs -lidpsup -lm_idp -Tidp.ld -margs -o foo} } } } @@ -727,7 +727,7 @@ eval_tests compile_test { "find_gcc" ! {} "find_gnatmake" ! {} "remote_exec host" U - { 2 {target-gnatmake foo.adb -midp -fada + { 2 {target-gnatmake foo.adb -midp -largs -midp -margs -fada -E -I/usr/gnemul/idp/include} } } } @@ -737,7 +737,7 @@ eval_tests compile_test { "find_gcc" ! {} "find_gnatmake" ! {} "remote_exec host" U - { 2 {target-gnatmake foo.adb -midp -fada + { 2 {target-gnatmake foo.adb -midp -largs -midp -margs -fada -S -I/usr/gnemul/idp/include -o foo.s} } } } @@ -747,7 +747,7 @@ eval_tests compile_test { "find_gcc" ! {} "find_gnatmake" ! {} "remote_exec host" U - { 2 {target-gnatmake -midp -fada + { 2 {target-gnatmake -midp -largs -midp -margs -fada -c -I/usr/gnemul/idp/include -o foo.o foo.adb} } } @@ -758,9 +758,9 @@ eval_tests compile_test { "find_gcc" ! {} "find_gnatmake" ! {} "remote_exec host" U - { 2 {target-gnatmake foo.adb -midp -fada - -I/usr/gnemul/idp/include -L/usr/gnemul/idp/lib - -lidpsup -lm_idp -Tidp.ld -o foo} } + { 2 {target-gnatmake foo.adb -midp -largs -midp -margs -fada + -I/usr/gnemul/idp/include -largs -L/usr/gnemul/idp/lib -margs + -largs -lidpsup -lm_idp -Tidp.ld -margs -o foo} } } } { "clean up GNATMAKE_FOR_TARGET" @@ -773,7 +773,7 @@ eval_tests compile_test { } } check_calls { "remote_exec host" U - { 2 {found-gnatmake foo.adb -lm -Tmvme.ld -o foo} } + { 2 {found-gnatmake foo.adb -largs -lm -Tmvme.ld -margs -o foo} } } } { "override destination to host and compile and link Ada with host-gnatmake" @@ -782,7 +782,7 @@ eval_tests compile_test { } } check_calls { "remote_exec host" U - { 2 {host-gnatmake foo.adb -lm -Tmvme.ld -o foo} } + { 2 {host-gnatmake foo.adb -largs -lm -Tmvme.ld -margs -o foo} } } } |