This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [testsuite] clean up GCC_EXEC_PREFIX use for PR38526


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)] {


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]