From patchwork Tue Oct 8 18:33:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 1173487 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-510488-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="SPfflVK8"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46nmFH6pdnz9s7T for ; Wed, 9 Oct 2019 05:33:22 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=lZtCxXSV31LoJS71mJ62ayQI3kCRm/e0ca1H/JC/weJLLKa/es 9RCgzH2cadCtGrMxrMngHZITqODs3VbmK3SNM4x6u7lucpsiuwwU/wPfV1kJgamt a20KTzavt3nrmVq3z8oq6uhS67BrSTEKvNfES1HgrDH1MeKc2Dr+kjof0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; s= default; bh=ov7QchiVDEreXvJt2xzoMDoozqw=; b=SPfflVK8yqltA3RFvRXk WmLpabUm5gir1kxOH6GOdrAsZusF6p8kp24pUlUDfGqOuIMAqOp5/2jb6p5DFAYM BXm92+45sBa5cBKCXiUhMf0xBnKH5aXtPSjbJSwJSOmlkm9GvTlMA1Y4FB0/JA6M /w1RY7kKiyqeZ/VP4DR/HBM= Received: (qmail 6923 invoked by alias); 8 Oct 2019 18:33:14 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 6909 invoked by uid 89); 8 Oct 2019 18:33:14 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.1 spammy=mis X-HELO: esa4.mentor.iphmx.com Received: from esa4.mentor.iphmx.com (HELO esa4.mentor.iphmx.com) (68.232.137.252) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 08 Oct 2019 18:33:12 +0000 IronPort-SDR: MQatjU+kc6EDmFVpP1SOcFaKvHPjDgEwn3tHYw87S6fx7w4NM1bCgS8B2Hi3bFJBgfNq+oG0ag tnTS929ujmjlSNUGZCfefzx4kfZvYW0JyIa1tUgqI8zHzjZ/Kt3zQUVYj1D6Jz56u0gn45Vgbc rIBsLvSrWzRrPNQ0UXkPkdymV/v/13QwyT7mMw/Zf/ZgmaWq4gFEtdtwDhp5qJTi+BJz41Mhkf 5ojo8AGjiZncno8tlE4EXOR3y6r0u9eGM5sYuG0FhMlrV++gXs1q60q56QHdbxvIJgdPJTU8mY DK4= Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa4.mentor.iphmx.com with ESMTP; 08 Oct 2019 10:33:10 -0800 IronPort-SDR: zT9RvfPEx4VWFdicgi52POGytmpkIgii5IAiHZ1mAeG3rilybTBVkZhBzTn5rd97r5W2+/LDCY 2WSl2iYJhgIJAht1GOjapJ96D19z9xXoBYCMlZl9WPNEHaQV0zwkmz6Jwkgu1Fi+5MNcWEvjMV kUvx2V3M35qhAlTSgwsuhND5k9ZJPeLPnGx/KF2n9xdu2QzaVoPdkz1wx1YHJbqKhsf7kP0lJs U1Fu0J3I3Pf5E8iudICXrJ/gg+dmmUq9tKBnqfdh+6ZRLRe+RmhQlvX1Gtj4y0M+ClKCrpIF31 oYs= To: gcc-patches , Jakub Jelinek , Thomas Schwinge , Mike Stump , Rainer Orth CC: Joseph Myers From: Tobias Burnus Subject: [libgomp][testsuite] PR testsuite/91884 Add -lquadmath if available Message-ID: Date: Tue, 8 Oct 2019 20:33:03 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.0 MIME-Version: 1.0 X-IsSubscribed: yes The test cases in GCC's libraries run via DejaGNU's "[find_gcc]" – unless the compiler has been explicitly provided. [1] That means that by default everything runs with "/gcc/xgcc" – at least for an in-build-dir test run. As that's the C driver, specific libraries such as "-lgfortran" or "-lstdc++" have to added explicitly. The problem with Fortran is: gfortran is built with libquadmath support on several platforms – in that case, libgfortran depends on libquadmath. But libquadmath support can be disabled or is not present at all on a given platform. – With the "gfortran" driver, that's solved by using a .spec file. But for xgcc … For build-tree test runs, it's simple: As we check for the libquadmath libraries explicitly, we know an .a or .so file exists and can add "-lquadmath" – but for out-of-tree runs, we cannot. – Hence, I propose a link test. What do you think of the attached patch? (Lightly tested on x86_64.) Background (see also PR): On x86_64 the issue is not visible. As Joseph pointed out internally (half a year ago): The ELF linker has a (mis)feature where it automatically looks for libraries named in DT_NEEDED, emulating how the dynamic linker searches and using directories specified in -rpath-link if necessary. See ld/emultempl/elf32.em. But on systems like PowerPC, the linker explicitly requires "-lquadmath" in order that the linking succeeds. Tobias [1] By contrast, those tests under gcc/testsuite/ call functions like "gfortran_init" of "./lib/gfortran.exp" instead to get the proper driver  (gfortran, g++ etc.). But this function assume that the compiler is relative to current working directly (base_dir) at $base_dir/../../. That's the case for the tests under gcc/testsuite but not for the testsuite in the libraries. PS: In principle, the same issue occurs with offloading – and has to be fixed there as well. However, nvptx and AMD GCN unsurprisingly don't have a libquadmath; though, Intel MIC might … libgomp/ * testsuite/libgomp.fortran/fortran.exp: Add -lquadmath if available. * testsuite/libgomp.oacc-fortran/fortran.exp: Ditto. diff --git a/libgomp/testsuite/libgomp.fortran/fortran.exp b/libgomp/testsuite/libgomp.fortran/fortran.exp index d848ed4d47f..caffbfe0346 100644 --- a/libgomp/testsuite/libgomp.fortran/fortran.exp +++ b/libgomp/testsuite/libgomp.fortran/fortran.exp @@ -54,11 +54,15 @@ if { $lang_test_file_found } { # Allow for spec subsitution. lappend ALWAYS_CFLAGS "additional_flags=-B${blddir}/${quadmath_library_path}/" set ld_library_path "$always_ld_library_path:${blddir}/${lang_library_path}:${blddir}/${quadmath_library_path}" + append lang_link_flags " -lquadmath" } else { set ld_library_path "$always_ld_library_path:${blddir}/${lang_library_path}" } } else { set ld_library_path "$always_ld_library_path" + if { [check_no_compiler_messages has_libquadmath executable {int main() {return 0;}} "-lgfortran -lquadmath"] } then { + append lang_link_flags " -lquadmath" + } } append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST] set_ld_library_path_env_vars diff --git a/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp b/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp index af25a22a522..393518d53f9 100644 --- a/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp +++ b/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp @@ -56,11 +56,15 @@ if { $lang_test_file_found } { # Allow for spec subsitution. lappend ALWAYS_CFLAGS "additional_flags=-B${blddir}/${quadmath_library_path}/" set ld_library_path "$always_ld_library_path:${blddir}/${lang_library_path}:${blddir}/${quadmath_library_path}" + append lang_link_flags " -lquadmath" } else { set ld_library_path "$always_ld_library_path:${blddir}/${lang_library_path}" } } else { set ld_library_path "$always_ld_library_path" + if { [check_no_compiler_messages has_libquadmath executable {int main() {return 0;}} "-lgfortran -lquadmath"] } then { + append lang_link_flags " -lquadmath" + } } append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST] set_ld_library_path_env_vars