[PATCH] D118491: [lld][ELF] support READONLY in linker script section

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 28 15:29:56 PST 2022


MaskRay added a comment.

In D118491#3280965 <https://reviews.llvm.org/D118491#3280965>, @bluca wrote:

> In D118491#3280927 <https://reviews.llvm.org/D118491#3280927>, @MaskRay wrote:
>
>>> bfd recently added a READONLY attribute for sections, as they are created writable by default.
>>
>> I think saying it writable is incorrect (see https://sourceware.org/bugzilla/show_bug.cgi?id=26378). See https://sourceware.org/pipermail/binutils/2021-May/116579.html
>>
>> I mentioned that `READONLY` is not needed but it seems that my comment has been ignored.
>
> There might be cases/combination where that is not the case, but with the provided linker script, before that patch, the note section was definitely created as writable by bfd, and there was no way to mark it read-only from the script.

Sorry, I do not follow. `.note.package : ALIGN(4) { ... }` does not produce a writable output section in GNU ld.
That's the bug fixed by https://sourceware.org/bugzilla/show_bug.cgi?id=26378 (2020-09), before `READONLY` was added.

If we want to customize both `sh_type` and `sh_flags`, I think the proper way is to add syntax to specify both.

(I know that ld.lld does not set any flag if you don't have a regular input section. There are quite a few cases in GNU ld. It's just overwhelming to support every one.)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118491/new/

https://reviews.llvm.org/D118491



More information about the llvm-commits mailing list