From patchwork Sat Oct 29 07:41:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iain Buclaw X-Patchwork-Id: 12658 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1234061wru; Sat, 29 Oct 2022 00:43:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM78T5ofsNb9KTWmzGJd6MSre8DyLcG/GL522gZAm8j861J/bBU22ouG0SsGelalMabtp9nd X-Received: by 2002:aa7:da03:0:b0:461:4fc2:3e0f with SMTP id r3-20020aa7da03000000b004614fc23e0fmr3148901eds.321.1667029394671; Sat, 29 Oct 2022 00:43:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667029394; cv=none; d=google.com; s=arc-20160816; b=riNkLqjLn67l227Uuqg+BPfwsThX53I5XQE/gBmPWHjWo/5petE1n96p34RYrxpwr/ 5VYGxOhqIzyjlp6tY+K/wOPYR96QA5avvv8oSUhDiip69lBXNsraVNTReRkopkJPpcrT uWuOZa1XVcV3ebOXT/0vI7r9rGezabAFO4KHcNfJ9OCi/z/AFRH88TVKwBydaY9btIrq rl9oB4Dja09irwZzvXounfQMx6jplFlYJ4jE9G67CgwR8nP3Y16bzSJ4JaqIoATpY9Hg Pf69GN9GI1mMW74NPl0eHSZgqRie2Q2e9u4bi5v/RQN2188Pr0hSj0PK1Nykwn8T92wM 0pnQ== 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-transfer-encoding:mime-version:message-id:date:subject:to :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=2xu1F/Gmc7QS+NRicjaLgkCe7IxIOhj7S0gGN9MaU1g=; b=DSCSpk4HbC3fWbArtZdUBrKJVMt2+99JVjO25lt6Qabwi4IJkwd/4s8qB9SVTx9mHD ytwiuvwtCYIyrf+bBKdsxMVAZVN6ixq0X5q6tTQb5BYKI6CZCaj3WWLFs1plF2bU+ZE0 n/ln/S5hVZNCb5Ha0lDVYoyEG74yNT7i6IjiXMJcLPFaccBm+P9JSuepMFqxB4u7i9jc NNhudbLq7bmUpwaLu0IHpNlZGqlwPiDsDEAVl5xJKE81qKcoV2W4jtfVKQd3jGBojKsB l6KhIgVeTWgrEmIharCLPZFaQ1weIAqi31QOHfqKO0HbjZ3rfJRn4x6JtTGNaC9xdeqb /TOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=Ih5zp4N8; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id go20-20020a1709070d9400b007708400bee5si1084510ejc.1003.2022.10.29.00.43.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Oct 2022 00:43:14 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=Ih5zp4N8; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 7908C3858431 for ; Sat, 29 Oct 2022 07:43:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7908C3858431 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1667029393; bh=2xu1F/Gmc7QS+NRicjaLgkCe7IxIOhj7S0gGN9MaU1g=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=Ih5zp4N8ZOhhx6Rh7ftWOBWVnyBfRlhjR8EK9h3fiIv6CUqkkd+2YaP08ScKe30C1 YQngM3bo8YDRDHfdzSykABoU5Ws6BGmCySKd2wEDx5pU07wbhyPG5avSO5BWD0LGE5 6hzccPOYbhSvxVSLGOR1Sn0cUqQP01d+zDc8Johg= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mout-p-102.mailbox.org (mout-p-102.mailbox.org [80.241.56.152]) by sourceware.org (Postfix) with ESMTPS id 4277B3858427 for ; Sat, 29 Oct 2022 07:41:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4277B3858427 Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:b231:465::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-102.mailbox.org (Postfix) with ESMTPS id 4Mzrvg61tQz9sdW; Sat, 29 Oct 2022 09:41:35 +0200 (CEST) To: gcc-patches@gcc.gnu.org Subject: [committed] d: Make TARGET_D_MINFO_SECTION hooks in elfos.h the language default. Date: Sat, 29 Oct 2022 09:41:31 +0200 Message-Id: <20221029074131.1654166-1-ibuclaw@gdcproject.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 4Mzrvg61tQz9sdW X-Spam-Status: No, score=-13.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, 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 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: Iain Buclaw via Gcc-patches From: Iain Buclaw Reply-To: Iain Buclaw 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?1748007014759698756?= X-GMAIL-MSGID: =?utf-8?q?1748007014759698756?= Hi, This patch makes the TARGET_D_MINFO_SECTION hooks defined in elfos.h the langauge default, removing the last of all TARGET_D_* macro definitions in common target headers. Now everything is either defined in the D language front-end, or D-specific target headers. The target macros TARGET_D_MINFO_START_NAME and TARGET_D_MINFO_END_NAME have also been renamed to TARGET_D_MINFO_SECTION_START and TARGET_D_MINFO_SECTION_END respectively to reflect their relation to the hook TARGET_D_MINFO_SECTION - the documentation of which has been revised to clarify these changes. Bootstrapped and regression tested on x86_64-linux-gnu, committed to mainline. Regards, Iain. --- gcc/ChangeLog: * config/darwin-d.cc (TARGET_D_MINFO_START_NAME): Rename to ... (TARGET_D_MINFO_SECTION_START): ...this. (TARGET_D_MINFO_END_NAME): Rename to ... (TARGET_D_MINFO_SECTION_END): ... this. * config/elfos.h (TARGET_D_MINFO_SECTION): Remove. (TARGET_D_MINFO_START_NAME): Remove. (TARGET_D_MINFO_END_NAME): Remove. * config/i386/cygwin-d.cc (TARGET_D_MINFO_SECTION): Remove. (TARGET_D_MINFO_START_NAME): Remove. (TARGET_D_MINFO_END_NAME): Remove. * config/i386/winnt-d.cc (TARGET_D_MINFO_SECTION): Remove. (TARGET_D_MINFO_START_NAME): Remove. (TARGET_D_MINFO_END_NAME): Remove. * doc/tm.texi: Regenerate. * doc/tm.texi.in (TARGET_D_MINFO_START_NAME): Rename to ... (TARGET_D_MINFO_SECTION_START): ...this. (TARGET_D_MINFO_END_NAME): Rename to ... (TARGET_D_MINFO_SECTION_END): ...this. gcc/d/ChangeLog: * d-target.def (d_minfo_section): Expand documentation of hook. Default initialize to "minfo". (d_minfo_start_name): Rename to ... (d_minfo_section_start): ... this. Default initialize to "__start_minfo". (d_minfo_end_name): Rename to ... (d_minfo_section_end): ... this. Default initialize to "__stop_minfo". * modules.cc (register_moduleinfo): Use new targetdm hook names. --- gcc/config/darwin-d.cc | 8 ++++---- gcc/config/elfos.h | 6 ------ gcc/config/i386/cygwin-d.cc | 11 ----------- gcc/config/i386/winnt-d.cc | 11 ----------- gcc/d/d-target.def | 23 +++++++++++++---------- gcc/d/modules.cc | 4 ++-- gcc/doc/tm.texi | 16 ++++++++++------ gcc/doc/tm.texi.in | 4 ++-- 8 files changed, 31 insertions(+), 52 deletions(-) diff --git a/gcc/config/darwin-d.cc b/gcc/config/darwin-d.cc index 2ceebc49851..97304947c0a 100644 --- a/gcc/config/darwin-d.cc +++ b/gcc/config/darwin-d.cc @@ -67,10 +67,10 @@ darwin_d_register_target_info (void) #undef TARGET_D_MINFO_SECTION #define TARGET_D_MINFO_SECTION "__DATA,__minfodata" -#undef TARGET_D_MINFO_START_NAME -#define TARGET_D_MINFO_START_NAME "*section$start$__DATA$__minfodata" +#undef TARGET_D_MINFO_SECTION_START +#define TARGET_D_MINFO_SECTION_START "*section$start$__DATA$__minfodata" -#undef TARGET_D_MINFO_END_NAME -#define TARGET_D_MINFO_END_NAME "*section$end$__DATA$__minfodata" +#undef TARGET_D_MINFO_SECTION_END +#define TARGET_D_MINFO_SECTION_END "*section$end$__DATA$__minfodata" struct gcc_targetdm targetdm = TARGETDM_INITIALIZER; diff --git a/gcc/config/elfos.h b/gcc/config/elfos.h index acb376283cf..f8b3be4358a 100644 --- a/gcc/config/elfos.h +++ b/gcc/config/elfos.h @@ -482,9 +482,3 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #undef TARGET_LIBC_HAS_FUNCTION #define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function - -/* ELF support needed only by D front-end. */ - -#define TARGET_D_MINFO_SECTION "minfo" -#define TARGET_D_MINFO_START_NAME "__start_minfo" -#define TARGET_D_MINFO_END_NAME "__stop_minfo" diff --git a/gcc/config/i386/cygwin-d.cc b/gcc/config/i386/cygwin-d.cc index 619930b4ff4..6d70d499eef 100644 --- a/gcc/config/i386/cygwin-d.cc +++ b/gcc/config/i386/cygwin-d.cc @@ -64,17 +64,6 @@ cygwin_d_register_target_info (void) #undef TARGET_D_REGISTER_OS_TARGET_INFO #define TARGET_D_REGISTER_OS_TARGET_INFO cygwin_d_register_target_info -/* Define TARGET_D_MINFO_SECTION for Cygwin targets. */ - -#undef TARGET_D_MINFO_SECTION -#define TARGET_D_MINFO_SECTION "minfo" - -#undef TARGET_D_MINFO_START_NAME -#define TARGET_D_MINFO_START_NAME "__start_minfo" - -#undef TARGET_D_MINFO_END_NAME -#define TARGET_D_MINFO_END_NAME "__stop_minfo" - /* Define TARGET_D_TEMPLATES_ALWAYS_COMDAT for Cygwin targets. */ #undef TARGET_D_TEMPLATES_ALWAYS_COMDAT diff --git a/gcc/config/i386/winnt-d.cc b/gcc/config/i386/winnt-d.cc index a1fd3fa1fbe..843c7139cb2 100644 --- a/gcc/config/i386/winnt-d.cc +++ b/gcc/config/i386/winnt-d.cc @@ -69,17 +69,6 @@ winnt_d_register_target_info (void) #undef TARGET_D_REGISTER_OS_TARGET_INFO #define TARGET_D_REGISTER_OS_TARGET_INFO winnt_d_register_target_info -/* Define TARGET_D_MINFO_SECTION for Windows targets. */ - -#undef TARGET_D_MINFO_SECTION -#define TARGET_D_MINFO_SECTION "minfo" - -#undef TARGET_D_MINFO_START_NAME -#define TARGET_D_MINFO_START_NAME "__start_minfo" - -#undef TARGET_D_MINFO_END_NAME -#define TARGET_D_MINFO_END_NAME "__stop_minfo" - /* Define TARGET_D_TEMPLATES_ALWAYS_COMDAT for Windows targets. */ #undef TARGET_D_TEMPLATES_ALWAYS_COMDAT diff --git a/gcc/d/d-target.def b/gcc/d/d-target.def index 7805942b91e..7d999d0be0b 100644 --- a/gcc/d/d-target.def +++ b/gcc/d/d-target.def @@ -70,26 +70,29 @@ the target operating system.", DEFHOOKPOD (d_minfo_section, "Contains the name of the section in which module info references should be\n\ -placed. This section is expected to be bracketed by two symbols to indicate\n\ -the start and end address of the section, so that the runtime library can\n\ -collect all modules for each loaded shared library and executable. The\n\ -default value of @code{NULL} disables the use of sections altogether.", - const char *, NULL) +placed. By default, the compiler puts all module info symbols in the\n\ +@code{\"minfo\"} section. Define this macro to override the string if a\n\ +different section name should be used. This section is expected to be\n\ +bracketed by two symbols @code{TARGET_D_MINFO_SECTION_START} and \n\ +@code{TARGET_D_MINFO_SECTION_END} to indicate the start and end address of\n\ +the section, so that the runtime library can collect all modules for each\n\ +loaded shared library and executable. Setting the value to @code{NULL}\n\ +disables the use of sections for storing module info altogether.", + const char *, "minfo") DEFHOOKPOD -(d_minfo_start_name, +(d_minfo_section_start, "If @code{TARGET_D_MINFO_SECTION} is defined, then this must also be defined\n\ as the name of the symbol indicating the start address of the module info\n\ section", - const char *, NULL) + const char *, "__start_minfo") -/* The name of the ModuleInfo section. */ DEFHOOKPOD -(d_minfo_end_name, +(d_minfo_section_end, "If @code{TARGET_D_MINFO_SECTION} is defined, then this must also be defined\n\ as the name of the symbol indicating the end address of the module info\n\ section", - const char *, NULL) + const char *, "__stop_minfo") /* The "stdcall" convention is really supported on 32-bit x86/Windows only. The following hook is a helper to determine whether to apply the attribute diff --git a/gcc/d/modules.cc b/gcc/d/modules.cc index 0aac8fe3545..4f918536b82 100644 --- a/gcc/d/modules.cc +++ b/gcc/d/modules.cc @@ -438,11 +438,11 @@ register_moduleinfo (Module *decl, tree minfo) if (!first_module) return; - start_minfo_node = build_dso_registry_var (targetdm.d_minfo_start_name, + start_minfo_node = build_dso_registry_var (targetdm.d_minfo_section_start, ptr_type_node); rest_of_decl_compilation (start_minfo_node, 1, 0); - stop_minfo_node = build_dso_registry_var (targetdm.d_minfo_end_name, + stop_minfo_node = build_dso_registry_var (targetdm.d_minfo_section_end, ptr_type_node); rest_of_decl_compilation (stop_minfo_node, 1, 0); diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 63c8a3177ee..8572313b308 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -10850,19 +10850,23 @@ the target operating system. @deftypevr {D Target Hook} {const char *} TARGET_D_MINFO_SECTION Contains the name of the section in which module info references should be -placed. This section is expected to be bracketed by two symbols to indicate -the start and end address of the section, so that the runtime library can -collect all modules for each loaded shared library and executable. The -default value of @code{NULL} disables the use of sections altogether. +placed. By default, the compiler puts all module info symbols in the +@code{"minfo"} section. Define this macro to override the string if a +different section name should be used. This section is expected to be +bracketed by two symbols @code{TARGET_D_MINFO_SECTION_START} and +@code{TARGET_D_MINFO_SECTION_END} to indicate the start and end address of +the section, so that the runtime library can collect all modules for each +loaded shared library and executable. Setting the value to @code{NULL} +disables the use of sections for storing module info altogether. @end deftypevr -@deftypevr {D Target Hook} {const char *} TARGET_D_MINFO_START_NAME +@deftypevr {D Target Hook} {const char *} TARGET_D_MINFO_SECTION_START If @code{TARGET_D_MINFO_SECTION} is defined, then this must also be defined as the name of the symbol indicating the start address of the module info section @end deftypevr -@deftypevr {D Target Hook} {const char *} TARGET_D_MINFO_END_NAME +@deftypevr {D Target Hook} {const char *} TARGET_D_MINFO_SECTION_END If @code{TARGET_D_MINFO_SECTION} is defined, then this must also be defined as the name of the symbol indicating the end address of the module info section diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in index 501ddf147e4..986e8f0da09 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -7117,9 +7117,9 @@ floating-point support; they are not included in this mechanism. @hook TARGET_D_MINFO_SECTION -@hook TARGET_D_MINFO_START_NAME +@hook TARGET_D_MINFO_SECTION_START -@hook TARGET_D_MINFO_END_NAME +@hook TARGET_D_MINFO_SECTION_END @hook TARGET_D_HAS_STDCALL_CONVENTION