From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 123173 invoked by alias); 5 Apr 2017 21:41:09 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 123153 invoked by uid 89); 5 Apr 2017 21:41:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.6 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_LOW,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=H*M:pobox, 1958 X-HELO: sasl.smtp.pobox.com Received: from pb-smtp1.pobox.com (HELO sasl.smtp.pobox.com) (64.147.108.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 05 Apr 2017 21:41:06 +0000 Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id 831C2838A3; Wed, 5 Apr 2017 17:41:02 -0400 (EDT) Received: from pb-smtp1.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id 7AD42838A1; Wed, 5 Apr 2017 17:41:02 -0400 (EDT) Received: from [192.168.1.4] (unknown [76.215.41.237]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pb-smtp1.pobox.com (Postfix) with ESMTPSA id 965B98389E; Wed, 5 Apr 2017 17:41:01 -0400 (EDT) Subject: Re: [testsuite] Fix loading wrong DLLs on Windows, merge duplicate target-libpath.exp To: Mike Stump References: <20170403231430.17602-1-daniel.santos@pobox.com> <5EC0CA7D-495B-40B4-BCB5-A250112920A4@comcast.net> Cc: gcc-patches , Anthony Green , Richard Henderson , Gerald Pfeifer From: Daniel Santos Message-ID: Date: Wed, 05 Apr 2017 21:41:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <5EC0CA7D-495B-40B4-BCB5-A250112920A4@comcast.net> Content-Type: multipart/mixed; boundary="------------E4FB5D19024CD689625732DF" X-Pobox-Relay-ID: 9054C9CE-1A48-11E7-8B6C-E680B56B9B0B-06139138!pb-smtp1.pobox.com X-IsSubscribed: yes X-SW-Source: 2017-04/txt/msg00256.txt.bz2 This is a multi-part message in MIME format. --------------E4FB5D19024CD689625732DF Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Content-length: 789 On 04/05/2017 12:35 PM, Mike Stump wrote: >> libffi/ChangeLog: >> 2017-04-03 Daniel Santos >> >> PR testsuite/79867 >> * testsuite/lib/target-libpath.exp: Remove. >> * testsuite/Makefile.in: Remove target-libpath.exp. >> * testsuite/Makefile.am: Regenerated. > I don't think the libffi project wants to remove that file. There is little point being different from them in this regard. The dup should not hurt. Hmm. There have been many changes to target-libpath.exp under gcc/testsuite/lib since libffi copied it. I have attached a diff of them. I'm not proposing removing target-libpath.exp from libffi upstream, but from the gcc tree. I'm having trouble seeing how having two different copies evolving independently can be a good thing. Daniel --------------E4FB5D19024CD689625732DF Content-Type: text/x-patch; name="libffi-gcc-target-libpath.exp.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="libffi-gcc-target-libpath.exp.diff" Content-length: 8196 --- target-libpath.exp 2017-04-05 16:39:38.939768810 -0500 +++ gcc/testsuite/lib/target-libpath.exp 2017-04-05 16:39:49.350768260 -0500 @@ -1,4 +1,4 @@ -# Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc. +# Copyright (C) 2004-2017 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -20,12 +20,28 @@ set orig_ld_library_path_saved 0 set orig_ld_run_path_saved 0 set orig_shlib_path_saved 0 -set orig_ld_libraryn32_path_saved 0 -set orig_ld_library64_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 + + +####################################### +# proc set_gcc_exec_prefix_env_var { } +####################################### + +proc set_gcc_exec_prefix_env_var { } { + global TEST_GCC_EXEC_PREFIX + global env + + # 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" + } +} ####################################### # proc set_ld_library_path_env_vars { } @@ -37,36 +53,39 @@ global orig_ld_library_path_saved global orig_ld_run_path_saved global orig_shlib_path_saved - global orig_ld_libraryn32_path_saved - global orig_ld_library64_path_saved 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 global orig_ld_run_path global orig_shlib_path - global orig_ld_libraryn32_path - global orig_ld_library64_path global orig_ld_library_path_32 global orig_ld_library_path_64 global orig_dyld_library_path global orig_path - global GCC_EXEC_PREFIX + global orig_gcc_exec_prefix + global env - # Set the relocated compiler prefix, but only if the user hasn't specified one. - if { [info exists GCC_EXEC_PREFIX] && ![info exists env(GCC_EXEC_PREFIX)] } { - setenv GCC_EXEC_PREFIX "$GCC_EXEC_PREFIX" + # Save the original GCC_EXEC_PREFIX. + if { $orig_gcc_exec_prefix_checked == 0 } { + if [info exists env(GCC_EXEC_PREFIX)] { + set orig_gcc_exec_prefix "$env(GCC_EXEC_PREFIX)" + set orig_gcc_exec_prefix_saved 1 + } + set orig_gcc_exec_prefix_checked 1 } + set_gcc_exec_prefix_env_var + # Setting the ld library path causes trouble when testing cross-compilers. if { [is_remote target] } { return } if { $orig_environment_saved == 0 } { - global env - set orig_environment_saved 1 # Save the original environment. @@ -82,14 +101,6 @@ set orig_shlib_path "$env(SHLIB_PATH)" set orig_shlib_path_saved 1 } - if [info exists env(LD_LIBRARYN32_PATH)] { - set orig_ld_libraryn32_path "$env(LD_LIBRARYN32_PATH)" - set orig_ld_libraryn32_path_saved 1 - } - if [info exists env(LD_LIBRARY64_PATH)] { - set orig_ld_library64_path "$env(LD_LIBRARY64_PATH)" - set orig_ld_library64_path_saved 1 - } if [info exists env(LD_LIBRARY_PATH_32)] { set orig_ld_library_path_32 "$env(LD_LIBRARY_PATH_32)" set orig_ld_library_path_32_saved 1 @@ -113,12 +124,11 @@ # It only sets SHLIB_PATH and LD_LIBRARY_PATH when it executes a # program. We also need the environment set for compilations, etc. # - # On IRIX 6, we have to set variables akin to LD_LIBRARY_PATH, but - # called LD_LIBRARYN32_PATH (for the N32 ABI) and LD_LIBRARY64_PATH - # (for the 64-bit ABI). The same applies to Darwin (DYLD_LIBRARY_PATH), - # Solaris 32 bit (LD_LIBRARY_PATH_32), Solaris 64 bit (LD_LIBRARY_PATH_64), - # and HP-UX (SHLIB_PATH). In some cases, the variables are independent - # of LD_LIBRARY_PATH, and in other cases LD_LIBRARY_PATH is used if the + # On Darwin, we have to set variables akin to LD_LIBRARY_PATH, but called + # DYLD_LIBRARY_PATH. The same applies to Solaris 32 bit + # (LD_LIBRARY_PATH_32), Solaris 64 bit (LD_LIBRARY_PATH_64), and HP-UX + # (SHLIB_PATH). In some cases, the variables are independent of + # LD_LIBRARY_PATH, and in other cases LD_LIBRARY_PATH is used if the # variable is not defined. # # Doing this is somewhat of a hack as ld_library_path gets repeated in @@ -142,20 +152,6 @@ } else { setenv SHLIB_PATH "$ld_library_path" } - if { $orig_ld_libraryn32_path_saved } { - setenv LD_LIBRARYN32_PATH "$ld_library_path:$orig_ld_libraryn32_path" - } elseif { $orig_ld_library_path_saved } { - setenv LD_LIBRARYN32_PATH "$ld_library_path:$orig_ld_library_path" - } else { - setenv LD_LIBRARYN32_PATH "$ld_library_path" - } - if { $orig_ld_library64_path_saved } { - setenv LD_LIBRARY64_PATH "$ld_library_path:$orig_ld_library64_path" - } elseif { $orig_ld_library_path_saved } { - setenv LD_LIBRARY64_PATH "$ld_library_path:$orig_ld_library_path" - } else { - setenv LD_LIBRARY64_PATH "$ld_library_path" - } if { $orig_ld_library_path_32_saved } { setenv LD_LIBRARY_PATH_32 "$ld_library_path:$orig_ld_library_path_32" } elseif { $orig_ld_library_path_saved } { @@ -183,7 +179,28 @@ } } - verbose -log "set_ld_library_path_env_vars: ld_library_path=$ld_library_path" + verbose -log "LD_LIBRARY_PATH=[getenv LD_LIBRARY_PATH]" + verbose -log "LD_RUN_PATH=[getenv LD_RUN_PATH]" + verbose -log "SHLIB_PATH=[getenv SHLIB_PATH]" + verbose -log "LD_LIBRARY_PATH_32=[getenv LD_LIBRARY_PATH_32]" + verbose -log "LD_LIBRARY_PATH_64=[getenv LD_LIBRARY_PATH_64]" + verbose -log "DYLD_LIBRARY_PATH=[getenv DYLD_LIBRARY_PATH]" +} + +####################################### +# proc restore_gcc_exec_prefix_env_var { } +####################################### + +proc restore_gcc_exec_prefix_env_var { } { + global orig_gcc_exec_prefix_saved + global orig_gcc_exec_prefix + global env + + 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 + } } ####################################### @@ -195,8 +212,6 @@ global orig_ld_library_path_saved global orig_ld_run_path_saved global orig_shlib_path_saved - global orig_ld_libraryn32_path_saved - global orig_ld_library64_path_saved global orig_ld_library_path_32_saved global orig_ld_library_path_64_saved global orig_dyld_library_path_saved @@ -204,12 +219,13 @@ global orig_ld_library_path global orig_ld_run_path global orig_shlib_path - global orig_ld_libraryn32_path - global orig_ld_library64_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 if { $orig_environment_saved == 0 } { return @@ -230,16 +246,6 @@ } elseif [info exists env(SHLIB_PATH)] { unsetenv SHLIB_PATH } - if { $orig_ld_libraryn32_path_saved } { - setenv LD_LIBRARYN32_PATH "$orig_ld_libraryn32_path" - } elseif [info exists env(LD_LIBRARYN32_PATH)] { - unsetenv LD_LIBRARYN32_PATH - } - if { $orig_ld_library64_path_saved } { - setenv LD_LIBRARY64_PATH "$orig_ld_library64_path" - } elseif [info exists env(LD_LIBRARY64_PATH)] { - unsetenv LD_LIBRARY64_PATH - } if { $orig_ld_library_path_32_saved } { setenv LD_LIBRARY_PATH_32 "$orig_ld_library_path_32" } elseif [info exists env(LD_LIBRARY_PATH_32)] { @@ -269,11 +275,11 @@ proc get_shlib_extension { } { global shlib_ext - if { [ istarget *-*-darwin* ] } { + if { [istarget *-*-darwin*] } { set shlib_ext "dylib" - } elseif { [ istarget *-*-cygwin* ] || [ istarget *-*-mingw* ] } { + } elseif { [istarget *-*-cygwin*] || [istarget *-*-mingw*] } { set shlib_ext "dll" - } elseif { [ istarget hppa*-*-hpux* ] } { + } elseif { [istarget hppa*-*-hpux*] } { set shlib_ext "sl" } else { set shlib_ext "so" --------------E4FB5D19024CD689625732DF--