re PR testsuite/79867 ([cygwin] LD_LIBRARY_PATH ignored, contaminating (nearly?)...
authorDaniel Santos <daniel.santos@pobox.com>
Mon, 10 Apr 2017 17:45:35 +0000 (17:45 +0000)
committerMike Stump <mrs@gcc.gnu.org>
Mon, 10 Apr 2017 17:45:35 +0000 (17:45 +0000)
2017-04-10  Daniel Santos <daniel.santos@pobox.com>

PR testsuite/79867
* lib/target-libpath.exp: Merge in cygwin fix from libffi.

From-SVN: r246813

gcc/testsuite/ChangeLog
gcc/testsuite/lib/target-libpath.exp

index 8df659e25e1dfda579cc604a4fe091914ab4a2fd..b87d0eeeddee369bd61c76b4008849091f1b164b 100644 (file)
@@ -1,3 +1,8 @@
+2017-04-10  Daniel Santos <daniel.santos@pobox.com>
+
+       PR testsuite/79867
+       * lib/target-libpath.exp: Merge in cygwin fix from libffi.
+
 2017-04-10  Marek Polacek  <polacek@redhat.com>
 
        PR sanitizer/80348
index 9b3e201ed68ee4c8ae00dc2660507214f570e613..b6d01b310164df58d285ce39b17c9c150885adbd 100644 (file)
@@ -23,6 +23,7 @@ set orig_shlib_path_saved 0
 set orig_ld_library_path_32_saved 0
 set orig_ld_library_path_64_saved 0
 set orig_dyld_library_path_saved 0
+set orig_path_saved 0
 set orig_gcc_exec_prefix_saved 0
 set orig_gcc_exec_prefix_checked 0
 
@@ -55,6 +56,7 @@ proc set_ld_library_path_env_vars { } {
   global orig_ld_library_path_32_saved
   global orig_ld_library_path_64_saved
   global orig_dyld_library_path_saved
+  global orig_path_saved
   global orig_gcc_exec_prefix_saved
   global orig_gcc_exec_prefix_checked
   global orig_ld_library_path
@@ -63,6 +65,7 @@ proc set_ld_library_path_env_vars { } {
   global orig_ld_library_path_32
   global orig_ld_library_path_64
   global orig_dyld_library_path
+  global orig_path
   global orig_gcc_exec_prefix
   global env
 
@@ -110,6 +113,10 @@ proc set_ld_library_path_env_vars { } {
       set orig_dyld_library_path "$env(DYLD_LIBRARY_PATH)"
       set orig_dyld_library_path_saved 1
     }
+    if [info exists env(PATH)] {
+      set orig_path "$env(PATH)"
+      set orig_path_saved 1
+    }
   }
 
   # We need to set ld library path in the environment.  Currently,
@@ -164,6 +171,13 @@ proc set_ld_library_path_env_vars { } {
   } else {
     setenv DYLD_LIBRARY_PATH "$ld_library_path"
   }
+  if { [istarget *-*-cygwin*] || [istarget *-*-mingw*] } {
+    if { $orig_path_saved } {
+      setenv PATH "$ld_library_path:$orig_path"
+    } else {
+      setenv PATH "$ld_library_path"
+    }
+  }
 
   verbose -log "LD_LIBRARY_PATH=[getenv LD_LIBRARY_PATH]"
   verbose -log "LD_RUN_PATH=[getenv LD_RUN_PATH]"
@@ -201,12 +215,14 @@ proc restore_ld_library_path_env_vars { } {
   global orig_ld_library_path_32_saved
   global orig_ld_library_path_64_saved
   global orig_dyld_library_path_saved
+  global orig_path_saved
   global orig_ld_library_path
   global orig_ld_run_path
   global orig_shlib_path
   global orig_ld_library_path_32
   global orig_ld_library_path_64
   global orig_dyld_library_path
+  global orig_path
   global env
 
   restore_gcc_exec_prefix_env_var
@@ -245,6 +261,11 @@ proc restore_ld_library_path_env_vars { } {
   } elseif [info exists env(DYLD_LIBRARY_PATH)] {
     unsetenv DYLD_LIBRARY_PATH
   }
+  if { $orig_path_saved } {
+    setenv PATH "$orig_path"
+  } elseif [info exists env(PATH)] {
+    unsetenv PATH
+  }
 }
 
 #######################################