From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by sourceware.org (Postfix) with ESMTPS id 999CE385734A for ; Fri, 4 Nov 2022 13:55:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 999CE385734A 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-x32b.google.com with SMTP id ja4-20020a05600c556400b003cf6e77f89cso5462405wmb.0 for ; Fri, 04 Nov 2022 06:55:57 -0700 (PDT) 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=56c/3z5gtYuBeOACGae/ociXYtIiggOzlPW7eXtKAiQ=; b=cCKC/LYDqGxyZVbdN3t9jk6Kva9AarfHsmXFjBFTyzojToETqV6QdDMwNHBQ0ng417 UY3ce1LQuI9SjsAciXzHzixDsDNSMusnE6P+jSsseIvvQFuTZGM+cXvbF4JXOpydcEzS b8ciSFf6H9yJx6iTE+TFZKLmU8yUy3z8LZ/lSG42AIo4EeBkNl6T5npu2tqBYJ7j5B4u ZxyUNJjcccY4N9CUC5+/6u3xgYq4Q/35IKzeom0CFpdkLDOx1p3csNb6/kq9kaOI8Wwk muGgrCIE/sY51NfSRxM2qRckWqlD4y3oBcMjQhGJ7mUF6BVbbmI8iNcwd+YuMrLm3vsK 7wMg== 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=56c/3z5gtYuBeOACGae/ociXYtIiggOzlPW7eXtKAiQ=; b=hlhRkRi7PVZCRaF3VOj04a7qsOT2lVSXk3DplNJQXz/ooXvzJ6YvJFhmiF+kER4UA2 1UU6S5PTI2xWSYbM61ViV7RFginN7Vp9n/OJYIF7W6V18ZwwGnVr930n5e5T5hQkeNZC hogjUOsG5IZYD8hvpVPIpApFvPXDqmhE7ZWmI4eyP49aSl+F9ppPMy4Fy0zJ59O0vLsr vASw+jEagMxUsJRY+Yf/2gpEp1K9jIRfaYAaXSGBphYnMe20c4CI0Yqnjjoygli9Lq6c gCRDHKtjseR+gtIMKdQllL31OYzHl942f5FsQZd+sH2F+zn0lPO7zpFKvQ2iP4/pyfCH dY8A== X-Gm-Message-State: ACrzQf0t1LeBHsrDCaNcovQwPnkqvenc/CvzndzTF1aQf5rlr6X4kYvf e0qmTGnFL1MO5vIOKjR1OanCd5tnuGipvg== X-Google-Smtp-Source: AMsMyM4SNe4L776l8VUf9NyEfWghdAdkEubGvyZNYT00UuFvDl1wQBYrr2O9FHvmg8zJvQkMWSPnuw== X-Received: by 2002:a05:600c:46c7:b0:3c6:f3e6:1f13 with SMTP id q7-20020a05600c46c700b003c6f3e61f13mr33941678wmo.62.1667570156234; Fri, 04 Nov 2022 06:55:56 -0700 (PDT) Received: from localhost.localdomain (static-176-191-105-132.ftth.abo.bbox.fr. [176.191.105.132]) by smtp.gmail.com with ESMTPSA id k28-20020a05600c1c9c00b003c6d21a19a0sm3505181wms.29.2022.11.04.06.55.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Nov 2022 06:55:55 -0700 (PDT) From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Steve Baird Subject: [COMMITTED] ada: Generate missing object decls for adainit/adafinal registration calls Date: Fri, 4 Nov 2022 14:55:51 +0100 Message-Id: <20221104135551.85648-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.2 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: Steve Baird A previous change on this ticket introduced calls to CUDA_Register_Function for adainit and adafinal, but failed to introduce declarations for the C string variables that are initialized and then passed as actual parameters in this call. Provide the missing declarations (and, incidentally, change the names of the two variables). gcc/ada/ * bindgen.adb: Introduce two new string constants for the names of the C-String variables that are assigned the names for adainit and adafinal. Replace string literals in Gen_CUDA_Init with references to these constants. In Gen_CUDA_Defs, generate C-String variable declarations where these constants are the names of the variables. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/bindgen.adb | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/gcc/ada/bindgen.adb b/gcc/ada/bindgen.adb index 1daa03dd7b8..4e89918b51d 100644 --- a/gcc/ada/bindgen.adb +++ b/gcc/ada/bindgen.adb @@ -114,6 +114,11 @@ package body Bindgen is -- For CodePeer, introduce a wrapper subprogram which calls the -- user-defined main subprogram. + -- Names for local C-String variables + + Adainit_String_Obj_Name : constant String := "Adainit_Name_C_String"; + Adafinal_String_Obj_Name : constant String := "Adafinal_Name_C_String"; + -- Names and link_names for CUDA device adainit/adafinal procs. Device_Subp_Name_Prefix : constant String := "imported_device_"; @@ -131,9 +136,6 @@ package body Bindgen is function Device_Ada_Init_Subp_Name return String is (Device_Subp_Name_Prefix & Ada_Init_Name.all); - -- Text for aspect specifications (if any) given as part of the - -- Adainit and Adafinal spec declarations. - ---------------------------------- -- Interface_State Pragma Table -- ---------------------------------- @@ -1366,6 +1368,13 @@ package body Bindgen is WBI (" pragma Import (C, " & Device_Ada_Final_Subp_Name & ", Link_Name => """ & Device_Ada_Final_Link_Name & """);"); + -- C-string declarations for adainit and adafinal + WBI (" " & Adainit_String_Obj_Name + & " : Interfaces.C.Strings.Chars_Ptr;"); + WBI (" " & Adafinal_String_Obj_Name + & " : Interfaces.C.Strings.Chars_Ptr;"); + WBI (""); + WBI (""); end Gen_CUDA_Defs; @@ -1449,11 +1458,11 @@ package body Bindgen is -- Register device-side Adainit and Adafinal Gen_CUDA_Register_Function_Call (Kernel_Name => Device_Ada_Init_Link_Name, - Kernel_String => "Adainit_Name_String", + Kernel_String => Adainit_String_Obj_Name, Kernel_Proc => Device_Ada_Init_Subp_Name); Gen_CUDA_Register_Function_Call (Kernel_Name => Device_Ada_Final_Link_Name, - Kernel_String => "Adafinal_Name_String", + Kernel_String => Adafinal_String_Obj_Name, Kernel_Proc => Device_Ada_Final_Subp_Name); WBI (" CUDA_Register_Fat_Binary_End (Fat_Binary_Handle);"); -- 2.34.1