From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by sourceware.org (Postfix) with ESMTPS id D7B013858429 for ; Mon, 21 Feb 2022 23:04:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D7B013858429 Received: by mail-pj1-x1030.google.com with SMTP id m1-20020a17090a668100b001bc023c6f34so532727pjj.3 for ; Mon, 21 Feb 2022 15:04:08 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=l4MT578vQ8bDcbF6UeEkEl0gHWZysP/kLjQJxNTPC0E=; b=NS5kveN9im7sfhHT70SAoHuEBlnvjjTmaejKoGts6RV12v2mjlMNZnVvboB5qwLfGH klnhs6aHeT+EE07N/xMA92pwIvStEyF+1cj6XICGGMeWL1rGk8miGKDxNA5QrQQXYwNe +IDmC6+IM6KdlHJG78klNfmN/MikMQCrRLm7dvWkq8OXotKmRsTUxg5Lbvks7NuxiHUv m4mJUpiwGGKgFK/RUlulHhuWOtOKVD8SRhiOZLmqYbxX3Y5sMMq7C7gaO6ppt40lbFB0 nUXjQunKHbDX9tXwvzwA5g9yrIHxQeWHRciAsstLJGtlgRBo5a2Lam4Ibj0brJaJ/271 wVyw== X-Gm-Message-State: AOAM532QyRT21e6S34SHJQUqbFyFTob07OTIdrz3K8zJuOHbEzQmtssV XA8JCpbSvjHsmCESclo2fPv+xEC4mnc= X-Google-Smtp-Source: ABdhPJyupw/q4Ac4JY+u1xjMbebdgh4lYWiup0mLLpsJf1zAMgF1XmFnkWXmM2nPSqDo4AoaSGntyw== X-Received: by 2002:a17:902:724a:b0:14f:bb5d:3d72 with SMTP id c10-20020a170902724a00b0014fbb5d3d72mr6515200pll.79.1645484647809; Mon, 21 Feb 2022 15:04:07 -0800 (PST) Received: from squeak.grove.modra.org ([2406:3400:51d:8cc0:e26b:37a9:f717:c7d4]) by smtp.gmail.com with ESMTPSA id ls14sm368695pjb.0.2022.02.21.15.04.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Feb 2022 15:04:07 -0800 (PST) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id 919AD1140295; Tue, 22 Feb 2022 09:34:04 +1030 (ACDT) Date: Tue, 22 Feb 2022 09:34:04 +1030 From: Alan Modra To: Fangrui Song Cc: Nick Clifton , "binutils@sourceware.org" , Luca Boccassi Subject: Re: Output section type (READONLY) Message-ID: References: <251473f45c9c4d2fa5edc3265c5ac77e06bb07b2.camel@debian.org> <740fedd2111e72f785bbe000890193f55a6a1d6d.camel@debian.org> <20220217021219.qqwepnd4yjaq6ogq@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220217021219.qqwepnd4yjaq6ogq@gmail.com> X-Spam-Status: No, score=-3037.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Feb 2022 23:04:10 -0000 On Wed, Feb 16, 2022 at 06:12:19PM -0800, Fangrui Song wrote: > On 2022-02-16, Nick Clifton wrote: > > Hi Guys, > > > > I have gone ahead and applied an update form of Fanguri's patch (attached). > > Thanks, this enables a proper way to set the section type in the future. > Hope someone implements this for gold as well since it does not > recognize .note* as SHT_NOTE, either. "DO NOT EDIT!" says the comment at the top of bfd-in2.h. Move the new type field where it belongs. PR ld/28841 * section.c (struct bfd_section): Add type. Formatting. (BFD_FAKE_SECTION): Formatting. * bfd-in2.h: Regenerate. diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 78a0a1dea42..db41e7eb7fe 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -1166,11 +1166,13 @@ typedef struct bfd_section struct bfd_section *s; const char *linked_to_symbol_name; } map_head, map_tail; - /* Points to the output section this section is already assigned to, if any. - This is used when support for non-contiguous memory regions is enabled. */ - struct bfd_section *already_assigned; - /* Explicitly specified section type, if non-zero. */ + /* Points to the output section this section is already assigned to, + if any. This is used when support for non-contiguous memory + regions is enabled. */ + struct bfd_section *already_assigned; + + /* Explicitly specified section type, if non-zero. */ unsigned int type; } asection; @@ -1356,7 +1358,7 @@ discarded_section (const asection *sec) (struct bfd_symbol *) SYM, &SEC.symbol, \ \ /* map_head, map_tail, already_assigned, type */ \ - { NULL }, { NULL }, NULL, 0 \ + { NULL }, { NULL }, NULL, 0 \ \ } diff --git a/bfd/section.c b/bfd/section.c index 2de7dbf661a..9a1071454f5 100644 --- a/bfd/section.c +++ b/bfd/section.c @@ -551,9 +551,14 @@ CODE_FRAGMENT . struct bfd_section *s; . const char *linked_to_symbol_name; . } map_head, map_tail; -. {* Points to the output section this section is already assigned to, if any. -. This is used when support for non-contiguous memory regions is enabled. *} -. struct bfd_section *already_assigned; +. +. {* Points to the output section this section is already assigned to, +. if any. This is used when support for non-contiguous memory +. regions is enabled. *} +. struct bfd_section *already_assigned; +. +. {* Explicitly specified section type, if non-zero. *} +. unsigned int type; . .} asection; . @@ -738,7 +743,7 @@ CODE_FRAGMENT . (struct bfd_symbol *) SYM, &SEC.symbol, \ . \ . {* map_head, map_tail, already_assigned, type *} \ -. { NULL }, { NULL }, NULL, 0 \ +. { NULL }, { NULL }, NULL, 0 \ . \ . } . -- Alan Modra Australia Development Lab, IBM