From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by sourceware.org (Postfix) with ESMTPS id D5183385734D for ; Mon, 7 Nov 2022 08:41:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D5183385734D Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-wm1-x333.google.com with SMTP id t1so6392945wmi.4 for ; Mon, 07 Nov 2022 00:41:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=2HoZ+12VsR2m+v1sy8ckjMUGZRo/YQOaeejAyjDFEaI=; b=LO97Qx2nrCyRhU6+fjX4Lu55T3lZbIIEV3Zz4dafMLt24f2+CiuYHnDf7+A82qEtQN 5pojlflFQc2feI1KNOIU6NB9+4AI0KJsAidUnPxxVm1waW1DytS8x40Lu6boPA3jlH9v wsDlZcYAPS36yOkF44sy7dAyMdthOPYhKKE9BY5d/AZG7U56TmHCazJJwWfy7z30O/yc qC/6ZGK9+8G1vQjOuDsj+eJTolKKOCVmsULTdVsvv6ztuvWkG0YadYdDTskTftDkjwR9 Vxw8Mec4W1Nx3IbVsNcHYBYcgz23A/Yj7O0cpni6eRe76gIfaAe3lpNf2BRArIhnjfjC G70g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=2HoZ+12VsR2m+v1sy8ckjMUGZRo/YQOaeejAyjDFEaI=; b=SJDC3Mi0Ro3zDASzPtQs3S5T0Xgu30YiG0LetclkG/ND/u21aHG6I7PHo/dgrdcnHD qA3FyEexhg5/UyHDPdKf1+AxvZTxvrByJpHl/V21pMgtckvHv043xIXfgIlK+DnISTdo R+g7QANpJHV0mm/7ke7cbiZ3B1naGXTQIOz670+NXG4ht1DGNWxJE/+HBST3x9vU9JRp 6ARhlXWDtz/S8t+VPuoIu0s64hYkrTUoXBX5dB8kPOTPJhKGzb5o9SdLQmZ0OPOxjmq8 pWOop5wa7am/HbsRqMeMEAIPZT2nXhB7cFAglRcq47RjfNnq8aAXtMdfYnfi0BSJTls7 CExg== X-Gm-Message-State: ACrzQf3dDGZnnEaqFSSgXbSf5SZUaBhgHM2MwNR58sGLuyLkUy8Ox5uh QDsykDlM41czp2baSsVg7QLgLUJ7vuO/2Q== X-Google-Smtp-Source: AMsMyM7Qya3NO2o9pEoEAg7dYird2yeqN0aCIFHcw3RtZp2qk3XkgNHjrnqK5OFMnB5wgEmFUq3c9Q== X-Received: by 2002:a1c:f001:0:b0:3cf:a30c:bb5e with SMTP id a1-20020a1cf001000000b003cfa30cbb5emr6633005wmb.149.1667810466701; Mon, 07 Nov 2022 00:41:06 -0800 (PST) Received: from poulhies-Precision-5550.lan (static-176-191-105-132.ftth.abo.bbox.fr. [176.191.105.132]) by smtp.gmail.com with ESMTPSA id m6-20020a1c2606000000b003c6edc05159sm10853642wmm.1.2022.11.07.00.41.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Nov 2022 00:41:06 -0800 (PST) From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Quentin Ochem , Steve Baird Subject: [COMMITTED] ada: Fixed elaboration of CUDA programs. Date: Mon, 7 Nov 2022 09:41:03 +0100 Message-Id: <20221107084103.151630-1-poulhies@adacore.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-13.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: From: Quentin Ochem The names of imported / exported symbols were not consistent between the device and the host when compiling for CUDA. Remove the function Device_Ada_Final_Link_Name as it is no longer referenced. gcc/ada/ * bindgen.adb: fixed the way the device init and final symbols are computed, re-using the normal way these symbols would be computed with a __device_ prefix. Also fixed the "is null;" procedure on the host side which are not Ada 95, replaced with a procedure raising an exception as it should never be called. Remove the unused function Device_Ada_Final_Link_Name. Co-authored-by: Steve Baird Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/bindgen.adb | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/gcc/ada/bindgen.adb b/gcc/ada/bindgen.adb index b942985b2e8..e72cdf81227 100644 --- a/gcc/ada/bindgen.adb +++ b/gcc/ada/bindgen.adb @@ -131,8 +131,6 @@ package body Bindgen is function Device_Ada_Init_Link_Name return String is (Device_Link_Name (Suffix => "init")); - function Device_Ada_Final_Link_Name return String - is (Device_Link_Name (Suffix => "final")); ---------------------------------- -- Interface_State Pragma Table -- @@ -1357,11 +1355,6 @@ package body Bindgen is WBI (" pragma Export (C, " & Device_Ada_Init_Subp_Name & ", Link_Name => """ & Device_Ada_Init_Link_Name & """);"); - -- It would be nice to declare a real body that raises P_E, but - -- generating a subprogram body at the right point is harder - -- than generating a null procedure here. - WBI (" procedure " & Device_Ada_Init_Subp_Name & " is null;"); - -- C-string declaration for adainit WBI (" " & Adainit_String_Obj_Name & " : Interfaces.C.Strings.Chars_Ptr;"); @@ -2673,7 +2666,8 @@ package body Bindgen is WBI (" procedure " & Ada_Init_Name.all & ";"); if Enable_CUDA_Device_Expansion then WBI (" pragma Export (C, " & Ada_Init_Name.all & - ", Link_Name => """ & Device_Ada_Init_Link_Name & """);"); + ", Link_Name => """ & Device_Link_Name_Prefix + & Ada_Init_Name.all & """);"); WBI (" pragma CUDA_Global (" & Ada_Init_Name.all & ");"); else WBI (" pragma Export (C, " & Ada_Init_Name.all & ", """ & @@ -2692,7 +2686,8 @@ package body Bindgen is WBI (" procedure " & Ada_Final_Name.all & ";"); if Enable_CUDA_Device_Expansion then WBI (" pragma Export (C, " & Ada_Final_Name.all & - ", Link_Name => """ & Device_Ada_Final_Link_Name & """);"); + ", Link_Name => """ & Device_Link_Name_Prefix & + Ada_Final_Name.all & """);"); WBI (" pragma CUDA_Global (" & Ada_Final_Name.all & ");"); else WBI (" pragma Export (C, " & Ada_Final_Name.all & ", """ & @@ -2922,6 +2917,13 @@ package body Bindgen is Gen_Adainit (Elab_Order); + if Enable_CUDA_Expansion then + WBI (" procedure " & Device_Ada_Init_Subp_Name & " is"); + WBI (" begin"); + WBI (" raise Program_Error;"); + WBI (" end " & Device_Ada_Init_Subp_Name & ";"); + end if; + if Bind_Main_Program then Gen_Main; end if; -- 2.34.1