public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Luca Boccassi <bluca@debian.org>
To: "binutils@sourceware.org" <binutils@sourceware.org>
Subject: Re: Re: Output section type (READONLY)
Date: Tue, 01 Feb 2022 11:59:23 +0000	[thread overview]
Message-ID: <251473f45c9c4d2fa5edc3265c5ac77e06bb07b2.camel@debian.org> (raw)
In-Reply-To: <c62e6fc5-3464-3598-1353-80e2b3ef3f3f@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1963 bytes --]

> > For READONLY, I am thinking more in line with "whether we need this
> > feature at all"... If no input has SHF_WRITE, the output naturally
> does
> > not have SHF_WRITE; if an input has SHF_WRITE, chancing the output
> to
> > non-SHF_WRITE is weird and error-prone.
> 
> I do not know if this counts as a *justified* use of READONLY, but it
> was
> used recently in an attempt to add a new feature to Fedora rawhide:
> 
>     
> https://fedoraproject.org/wiki/Changes/Package_information_on_ELF_objects#New_system:_.note.package
> 
> The feature used a custom linker script fragment to add a note
> section
> into the executable being created, and this script used the READONLY
> keyword:
> 
>    SECTIONS
>    {
>      .note.package (READONLY) : ALIGN(4) {
>          BYTE(0x04) BYTE(0x00) BYTE(0x00) BYTE(0x00) /* Length of
> Owner including NUL */
>   [...]
>      }
>    }
>    INSERT AFTER .note.gnu.build-id;
> 
> This turned out to be problematic however as gold does not support
> the
> READONLY attribute, nor the INSERT AFTER directive...

Yes, we are aware of the issue with ld.gold, and are thinking about
what to do there. The main problem is that even without those
unsupported attributes, ld.gold generates broken ELFs that crash
immediately. For now, we just suggest to just use bfd whenever
possible, and skip this feature otherwise with a simple flag. It's not
great to lose debuggability and useful information, but it doesn't need
to have 100% coverage to provide utility, it's perfectly ok to miss
some packages.

> Anyway I think that the point here was that was no input section, so
> the author needed another way to tell the linker that the output
> section
> should be readonly.

Yes, this is precisely the use case, and the attribute is working as
intended - not just in Fedora, but in CBL-Mariner too, and other
internal Yocto-based use cases.

-- 
Kind regards,
Luca Boccassi

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2022-02-01 11:59 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-29  7:45 Fangrui Song
2022-01-29 16:46 ` Luca Boccassi
2022-01-29 18:51   ` Fangrui Song
2022-01-31 13:33 ` Nick Clifton
2022-02-01  3:39   ` Fangrui Song
2022-02-01 11:07     ` Nick Clifton
2022-02-01 11:59       ` Luca Boccassi [this message]
2022-02-02  7:29         ` Fangrui Song
2022-02-02 16:54           ` Michael Matz
2022-02-02 18:12             ` Luca Boccassi
2022-02-16 17:38               ` Nick Clifton
2022-02-16 19:03                 ` Luca Boccassi
2022-02-17  2:12                 ` Fangrui Song
2022-02-21 23:04                   ` Alan Modra
2022-02-21 23:30                     ` Fangrui Song

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=251473f45c9c4d2fa5edc3265c5ac77e06bb07b2.camel@debian.org \
    --to=bluca@debian.org \
    --cc=binutils@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).