Hi,
if you run a test for a bareboard port, e.g. arm-eabi or visium-elf, you'll
see in gcc.log:
Running /home/eric/svn/gcc/gcc/testsuite/gcc.dg/dg.exp ...
Executing on host: /home/eric/build/gcc/arm-eabi/gcc/xgcc -
B/home/eric/build/gcc/arm-eabi/gcc/ linker_plugin14260.c -fno-diagnostics-
show-caret -fdiagnostics-color=never -flto -fuse-linker-plugin -lm -o
linker_plugin14260.exe (timeout = 300)
spawn /home/eric/build/gcc/arm-eabi/gcc/xgcc -B/home/eric/build/gcc/arm-
eabi/gcc/ linker_plugin14260.c -fno-diagnostics-show-caret -fdiagnostics-
color=never -flto -fuse-linker-plugin -lm -o linker_plugin14260.exe
/home/eric/install/gcc/arm-eabi/bin/ld: cannot find crt0.o: No such file or
directory
collect2: error: ld returned 1 exit status
compiler exited with status 1
Failure of the plugin test will in turn cause gcc.c-torture/compile/pr61848.c
to fail in LTO mode:
FAIL: gcc.c-torture/compile/pr61848.c -O2 -flto scan-assembler mysection
FAIL: gcc.c-torture/compile/pr61848.c -O2 -flto -flto-partition=none scan-
assembler mysection
because of the fat/thin LTO object mismatch.
The attached patch fixes it by ensuring that LTO_TORTURE_OPTIONS is computed
after set_ld_library_path_env_vars is invoked (this procedure invokes in turn
set_gcc_exec_prefix_env_var), both in c-torture.exp and in gcc-dg.exp.
Tested on x86_64-suse-linux and visium-elf, OK for the mainline?
2015-01-15 Eric Botcazou <ebotca...@adacore.com>
* lib/c-torture.exp: Compute LTO_TORTURE_OPTIONS after the environment
is set up.
* lib/gcc-dg.exp: Likewise.
--
Eric Botcazou
Index: lib/gcc-dg.exp
===================================================================
--- lib/gcc-dg.exp (revision 219578)
+++ lib/gcc-dg.exp (working copy)
@@ -72,7 +72,14 @@ if [info exists ADDITIONAL_TORTURE_OPTIO
[concat $DG_TORTURE_OPTIONS $ADDITIONAL_TORTURE_OPTIONS]
}
-set LTO_TORTURE_OPTIONS ""
+global orig_environment_saved
+
+# This file may be sourced, so don't override environment settings
+# that have been previously setup.
+if { $orig_environment_saved == 0 } {
+ append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
+ set_ld_library_path_env_vars
+}
# Some torture-options cause intermediate code output, unusable for
# testing using e.g. scan-assembler. In this variable are the options
@@ -80,6 +87,7 @@ set LTO_TORTURE_OPTIONS ""
global gcc_force_conventional_output
set gcc_force_conventional_output ""
+set LTO_TORTURE_OPTIONS ""
if [check_effective_target_lto] {
# When having plugin test both slim and fat LTO and plugin/nonplugin
# path.
@@ -97,15 +105,6 @@ if [check_effective_target_lto] {
}
}
-global orig_environment_saved
-
-# This file may be sourced, so don't override environment settings
-# that have been previously setup.
-if { $orig_environment_saved == 0 } {
- append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
- set_ld_library_path_env_vars
-}
-
# Define gcc callbacks for dg.exp.
proc gcc-dg-test-1 { target_compile prog do_what extra_tool_flags } {
Index: lib/c-torture.exp
===================================================================
--- lib/c-torture.exp (revision 219578)
+++ lib/c-torture.exp (working copy)
@@ -51,6 +51,20 @@ if [info exists ADDITIONAL_TORTURE_OPTIO
[concat $C_TORTURE_OPTIONS $ADDITIONAL_TORTURE_OPTIONS]
}
+global GCC_UNDER_TEST
+if ![info exists GCC_UNDER_TEST] {
+ set GCC_UNDER_TEST "[find_gcc]"
+}
+
+global orig_environment_saved
+
+# This file may be sourced, so don't override environment settings
+# that have been previously setup.
+if { $orig_environment_saved == 0 } {
+ append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
+ set_ld_library_path_env_vars
+}
+
set LTO_TORTURE_OPTIONS ""
if [check_effective_target_lto] {
# When having plugin test both slim and fat LTO and plugin/nonplugin
@@ -68,20 +82,6 @@ if [check_effective_target_lto] {
}
}
-global GCC_UNDER_TEST
-if ![info exists GCC_UNDER_TEST] {
- set GCC_UNDER_TEST "[find_gcc]"
-}
-
-global orig_environment_saved
-
-# This file may be sourced, so don't override environment settings
-# that have been previously setup.
-if { $orig_environment_saved == 0 } {
- append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
- set_ld_library_path_env_vars
-}
-
#
# c-torture-compile -- runs the Tege C-torture test
#