From patchwork Fri May 19 08:18:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 96260 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1069618vqo; Fri, 19 May 2023 01:19:27 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4ocGmwyomJ5ZR/5n/O7W4o7T2+LG9JjHWrVyosLwV7ZyYRjWpphhK16M/7nzypSN7F7vBJ X-Received: by 2002:a17:907:3d94:b0:96a:7bf7:4ac9 with SMTP id he20-20020a1709073d9400b0096a7bf74ac9mr1146412ejc.44.1684484367179; Fri, 19 May 2023 01:19:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684484367; cv=none; d=google.com; s=arc-20160816; b=egvddARpcLG7rgnpJgM3baRlp5/eDRjArG+CEA4R2mL52fQRxqRgSLsv40FANXEtOk rohcxGi2Y9pK7lNhijr7/lDQXiTHXcCgkCA1B8uld/b3YIxJyf+b0tL1eRzlu6k1JYlp /mlFThteBRqS3tqUZ09a0nEgRuBYDjcuto8Nm7+Q2UwiKLqYCaydnQWfC/mVkAd/n+b3 jWZPGbh0dAZbXV2Ci9MXDyrcoZepAmeLh+hC1LHRx+VxsxN/zjL/7f7IAurdC940zKXH /NmaOndIxCgqclm4XZ5jLyRBAMWlhV9udMx7KbgK1pNb4hn6s9du6JCLZ3Oftapev97S Okgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-disposition:mime-version:message-id:subject:cc:to:date :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=QCrj3t1VswsYWPdDM5KHulwf27HdrNSJSGmeOyqUWXM=; b=WIdDYojkPC76u+1P3ubm95MV5bPTWm8P6LJsxbFmWBdfLNqy3IzugjiZCLwHwhyOyT 0YORNfhfGf+h5XnBpPptT6skRXRpMfpFYg03NoOZTN6g5rI0UWHTJeJAN7RJQkh7R76u fupS5mAEUMN+OtG25/w0scTvaiSdx80OXpEsx3LJskpEyUn5qF31f605EkaNas4cZNbr krn+IrDu5lel0aUGHaF/9m4LcK7SYWAKT1MZE6nggZqB2mH4ORNoUleWogldW0B/FI9B SYmercSCjVYNJKRHMXu2YgCXNZLwk9G/rcZt8eDzOk/fYB7GuJXFCldXYC9377UuFOOb beqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=Bg1dUDyF; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id ml11-20020a170906cc0b00b0094ed126d448si172408ejb.445.2023.05.19.01.19.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 01:19:27 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=Bg1dUDyF; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6285938768BB for ; Fri, 19 May 2023 08:19:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6285938768BB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684484348; bh=QCrj3t1VswsYWPdDM5KHulwf27HdrNSJSGmeOyqUWXM=; h=Date:To:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=Bg1dUDyFNYvKg6uXRz93mwCtgFjIla3nRcgd1nlCXv7Sh85fzxWxNcZH07v7HEyMY 0oTvWvkcycFB6cfa/mWQV+Y/QIKV9fKY7P3fE0pvTj+NUeynWW6K1Eb6AATGyR3knP OvFi8HrjdkLxVwXaw2BFDHqVyZRQXKCJABeA8vmE= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 87C1A3857016 for ; Fri, 19 May 2023 08:18:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 87C1A3857016 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-244-ORRX8zAJNmK1_TUmFa01Yg-1; Fri, 19 May 2023 04:18:22 -0400 X-MC-Unique: ORRX8zAJNmK1_TUmFa01Yg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 51474185A78F; Fri, 19 May 2023 08:18:22 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 00AF42166B27; Fri, 19 May 2023 08:18:21 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 34J8IJLk3569988 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 19 May 2023 10:18:19 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 34J8IIMq3569987; Fri, 19 May 2023 10:18:18 +0200 Date: Fri, 19 May 2023 10:18:17 +0200 To: gcc-patches@gcc.gnu.org Cc: Tobias Burnus Subject: [committed] libgomp: Fix up -static -fopenmp linking [PR109904] Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jakub Jelinek via Gcc-patches From: Jakub Jelinek Reply-To: Jakub Jelinek Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766309879959942061?= X-GMAIL-MSGID: =?utf-8?q?1766309879959942061?= Hi! When an OpenMP program with target regions is linked statically, it fails to link on various arches (doesn't when using recent glibc because it has libdl stuff in libc), because libgomp.a(target.o) uses dlopen/dlsym/dlclose, but we aren't linking against -ldl (unless user asked for that). We already have libgomp.spec so that we can supply extra libraries to link against in the -static case, this patch adds -ldl to that if plugins are supported. Bootstrapped/regtested on x86_64-linux and i686-linux, committed to trunk. 2023-05-19 Jakub Jelinek PR libgomp/109904 * configure.ac (link_gomp): Include also $DL_LIBS. * configure: Regenerated. Jakub --- libgomp/configure.ac.jj 2023-05-15 19:12:35.138624638 +0200 +++ libgomp/configure.ac 2023-05-18 20:41:58.512501769 +0200 @@ -398,9 +398,9 @@ fi # which will force linkage against -lpthread (or equivalent for the system). # That's not 100% ideal, but about the best we can do easily. if test $enable_shared = yes; then - link_gomp="-lgomp %{static: $LIBS}" + link_gomp="-lgomp %{static: $LIBS${DL_LIBS:+ $DL_LIBS}}" else - link_gomp="-lgomp $LIBS" + link_gomp="-lgomp $LIBS${DL_LIBS:+ $DL_LIBS}" fi AC_SUBST(link_gomp) --- libgomp/configure.jj 2023-05-15 19:12:35.138624638 +0200 +++ libgomp/configure 2023-05-18 20:42:12.703299052 +0200 @@ -16788,9 +16788,9 @@ fi # which will force linkage against -lpthread (or equivalent for the system). # That's not 100% ideal, but about the best we can do easily. if test $enable_shared = yes; then - link_gomp="-lgomp %{static: $LIBS}" + link_gomp="-lgomp %{static: $LIBS${DL_LIBS:+ $DL_LIBS}}" else - link_gomp="-lgomp $LIBS" + link_gomp="-lgomp $LIBS${DL_LIBS:+ $DL_LIBS}" fi