From patchwork Fri Dec 6 14:17:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kwok Cheung Yeung X-Patchwork-Id: 1205120 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-515342-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="jOYBoo/W"; 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 47Tvnj6xCKz9sP6 for ; Sat, 7 Dec 2019 01:18:16 +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:from :subject:to:message-id:date:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=UHpBrSJ5DoPRmdzC ZljhSGImkoE5Jlif2e1g3pMrAOrsa4FKvHM6FKtuurn4Zv7jcV9rmy4XjQkVFfOT jfuktaUbClogQ8xLyIyQeXACYh8F0jfTdZ4Od3TQ3x8pIbihCTIiUheS5SDVpeKx appCpJQNmX3yROTMuNv4NI/lg98= 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:from :subject:to:message-id:date:mime-version:content-type :content-transfer-encoding; s=default; bh=f1FiQGolFUlzkP5WVnimeQ hmaEk=; b=jOYBoo/WRvnBSjWXOxjjemQzLY0HMOipSSueTDvB+KRPCRKBgtw/HL xHTmF8kyVWG1kuJnI4R65ASR2+iSi4vgAbRN0cAkbvP4QJioWGTH6RWAUF1xGX76 lyEfly64+mRBVR3E0F1VGl/yGhRxFMarkxqjGzAr3MdSOF3OFRH1g= Received: (qmail 87914 invoked by alias); 6 Dec 2019 14:18:08 -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 87829 invoked by uid 89); 6 Dec 2019 14:18:07 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-20.1 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=amdgcn, nvptx, offloading, card X-HELO: esa2.mentor.iphmx.com Received: from esa2.mentor.iphmx.com (HELO esa2.mentor.iphmx.com) (68.232.141.98) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 06 Dec 2019 14:18:05 +0000 IronPort-SDR: 8vJ9ef6YWhioiq5cxjERpx7L0gxYHt/gI54ZxFPi7X8lIj8+skLCHLNLXVoQ8/QNBtB++vWstG fw7IsMA/KVCsg74AWeCpQYkmxoRzg2hgERGMZJ9bSfk0/h76fjg/s5HB2FA4GW1snxKl8xJe0O 5QtO6RP+y1yN8ly42wGCdfStPBP5MA3HOyCZzZIwNsxQ54VOzRnl/+dKaBk43v0a3NRu774ei2 Vb1uFcSzgiLWQRYGdLYr7HGwrMUg1KgleeozxG4B0PWVbPW959Ftg3pJV5EVPOHPdBjayd+qm1 kI8= Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa2.mentor.iphmx.com with ESMTP; 06 Dec 2019 06:18:03 -0800 IronPort-SDR: 0lnwQk5CBbonJ8NT35YkexIfc6fmvvfZ3LaU9V5JB+nYv5h5r5lGSipYOwjZqXhu/WsAjIzQnz ewk/K/RfK9YokJfq85jERhuv5sTDPN3c7jepxkbWKsk3aSn+bZUbwRnnL3V5xN8zIBowKCEl0u sYGS4cuIbBb88grmYe8ix9AjRs1O8aOmYhdDx+V/Y6O7OYqY7mHuutNpl9GNNUb4PzLtMSp8LX fVtIb2Swmcd5rycYcTWt3wthK4/KkrZD09OEA4wHo7KhdqXQhh1/tTCcnlISz9VafFbnduqbHJ hqU= From: Kwok Cheung Yeung Subject: [PATCH] [libgomp, amdgcn] Fix Fortran linker errors on AMD GCN To: , Andrew Stubbs , Julian Brown , Thomas Schwinge Message-ID: Date: Fri, 6 Dec 2019 14:17:47 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 Hello While running the libgomp testsuite with an AMD GCN card configured as as the offload accelerator, I often see these errors with the Fortran testcases: ld: error: undefined symbol: gomp_ialias_omp_get_num_procs >>> referenced by fortran.c:330 (/scratch/ci-cs/amdtest/upstream-offload/src/gcc-mainline/libgompg/fortran.c:330) >>> fortran.o:(omp_get_num_procs_) in archive /scratch/ci-cs/amdtest/upstream-offload/obj/test-mainline-0-x86_64-none-linux-gnu/host-x86_64-linux-gnu/fsf-mainline/bin/../lib/gcc/x86_64-none-linux-gnu/10.0.0/accel/amdgcn-unknown-amdhsa/../../../../../../amdgcn-unknown-amdhsa/lib/gfx906/libgomp.a omp_get_num_procs_ in fortran.c calls omp_get_num_procs, but the declaration of omp_get_num_procs is processed using the ialias_redirect macro so that it is aliased to a function named gomp_ialias_omp_get_num_procs. The definition of omp_get_num_procs is in libgomp/config/accel/proc.c, but it is not aliased to gomp_ialias_omp_get_num_procs, so the linker fails to satisfy the reference. This patch applies the corresponding ialias macro to the definition of gomp_omp_get_num_procs in libgomp/config/accel/proc.c. This is already done with the alternative definitions in the mingw32, bsd, linux, posix and rtems subdirectories of libgomp/config/. Tested on an x86_64 host with both NVPTX and GCN offloading. Okay to commit to trunk? Kwok 2019-12-06 Kwok Cheung Yeung libgomp/ * config/accel/proc.c (omp_get_num_procs): Apply ialias macro. --- libgomp/config/accel/proc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libgomp/config/accel/proc.c b/libgomp/config/accel/proc.c index 8ca0b0a..be4cb30 100644 --- a/libgomp/config/accel/proc.c +++ b/libgomp/config/accel/proc.c @@ -39,3 +39,5 @@ omp_get_num_procs (void) { return gomp_icv (false)->nthreads_var; } + +ialias (omp_get_num_procs)