This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [testsuite] clean up GCC_EXEC_PREFIX use for PR38526
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: janis187 at us dot ibm dot com
- Cc: Hans-Peter Nilsson <hp at bitrange dot com>, John David Anglin <dave at hiauly1 dot hia dot nrc dot ca>, gcc-patches at gcc dot gnu dot org
- Date: Tue, 31 Mar 2009 18:05:38 -0700
- Subject: Re: [testsuite] clean up GCC_EXEC_PREFIX use for PR38526
- References: <20090330232948.AC5A1431A@hiauly1.hia.nrc.ca> <20090330222445.O94548@dair.pair.com> <1238516142.6367.3.camel@janis-laptop> <6dc9ffc80903311640i453a8f39k6aee47e6d632c892@mail.gmail.com> <1238544267.6367.24.camel@janis-laptop>
On Tue, Mar 31, 2009 at 5:04 PM, Janis Johnson <janis187@us.ibm.com> wrote:
> On Tue, 2009-03-31 at 16:40 -0700, H.J. Lu wrote:
>> Why do we have to set GCC_EXEC_PREFIX for HOSTCC? I have
>
> When switching to HOSTCC to build the generator it's supposed to
> switch GCC_EXEC_PREFIX to its original value, if there was one, or
> else unset it. ?Unsetting it is a problem on Darwin, so I thought
> that perhaps if if that doesn't work then we could set it to "".
> I'll take a closer look.
>
The bug is in
set_ld_library_path_env_vars
...
... # Set GCC_EXEC_PREFIX for the compiler under test to pick up files not in
# the build tree from a specified location (normally the install tree).
if [info exists TEST_GCC_EXEC_PREFIX] {
setenv GCC_EXEC_PREFIX "$TEST_GCC_EXEC_PREFIX"
}
# Setting the ld library path causes trouble when testing cross-compilers.
if { [is_remote target] } {
return
}
if { $orig_environment_saved == 0 } {
set orig_environment_saved 1
--
restore_ld_library_path_env_vars
...
if { $orig_environment_saved == 0 } {
return
}
if { $orig_gcc_exec_prefix_saved } {
setenv GCC_EXEC_PREFIX "$orig_gcc_exec_prefix"
} elseif [info exists env(GCC_EXEC_PREFIX)] {
unsetenv GCC_EXEC_PREFIX
}
...
You check orig_environment_saved before unsetting
GCC_EXEC_PREFIX. But orig_environment_saved may
not always be set. Move
if { $orig_environment_saved == 0 } {
return
}
after
if { $orig_gcc_exec_prefix_saved } {
setenv GCC_EXEC_PREFIX "$orig_gcc_exec_prefix"
} elseif [info exists env(GCC_EXEC_PREFIX)] {
unsetenv GCC_EXEC_PREFIX
}
fixed it for me. OK for trunk with a ChangeLog entry?
Thanks.
---
H.J.
---
--- ./target-libpath.exp.foo 2009-03-28 08:39:46.000000000 -0700
+++ ./target-libpath.exp 2009-03-31 18:05:01.000000000 -0700
@@ -213,16 +213,16 @@ proc restore_ld_library_path_env_vars {
global orig_gcc_exec_prefix
global env
- if { $orig_environment_saved == 0 } {
- return
- }
-
if { $orig_gcc_exec_prefix_saved } {
setenv GCC_EXEC_PREFIX "$orig_gcc_exec_prefix"
} elseif [info exists env(GCC_EXEC_PREFIX)] {
unsetenv GCC_EXEC_PREFIX
}
+ if { $orig_environment_saved == 0 } {
+ return
+ }
+
if { $orig_ld_library_path_saved } {
setenv LD_LIBRARY_PATH "$orig_ld_library_path"
} elseif [info exists env(LD_LIBRARY_PATH)] {