public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Fangrui Song <i@maskray.me>
To: Nick Clifton <nickc@redhat.com>
Cc: Alan Modra <amodra@gmail.com>,
	binutils@sourceware.org,
	Luca Boccassi <luca.boccassi@microsoft.com>
Subject: Re: Output section type (READONLY)
Date: Mon, 31 Jan 2022 19:39:30 -0800	[thread overview]
Message-ID: <20220201033930.ssqtsoha6jaqzsfs@gmail.com> (raw)
In-Reply-To: <653b3fdf-61ed-2c41-5db2-de40bb51e8a0@redhat.com>

On 2022-01-31, Nick Clifton wrote:
>Hi Fangrui,
>
>>Well, READONLY has another behavior that it forces non-SHF_WRITE output
>>even if an input section has the SHF_WRITE flag.
>
>>I find this quite dangerous if an input section has the SHF_WRITE flag.
>>I do not see in what circumstances a user may want this behavior.
>>This just seems very dangerous to use in general.
>
>So basically what you are saying is that if a input section is assigned
>to an output sections with incompatible attributes (presumably because of a
>linker script declaration) then the linker should issue a warning message,
>yes ?
>
>By extension then, this feature should cover not just the readonly section
>attribute, but the NOLOAD attribute as well.

For NOLOAD, .noload (NOLOAD) : { *(.noload) } makes the output .noload
SHT_NOBITS even if there is a non-empty SHT_PROGBITS .noload section.
I don't know whether the linker should issue a warning.

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.

>This sounds like it might be an interesting feature to implement for someone
>looking to gain experience with the binutils.

Ah, sure:)

>Cheers
>  Nick
>
>
>
>

  reply	other threads:[~2022-02-01  3:39 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 [this message]
2022-02-01 11:07     ` Nick Clifton
2022-02-01 11:59       ` Luca Boccassi
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=20220201033930.ssqtsoha6jaqzsfs@gmail.com \
    --to=i@maskray.me \
    --cc=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=luca.boccassi@microsoft.com \
    --cc=nickc@redhat.com \
    /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).