[ELF] Support the "read-only" memory region attribute
authorIgor Kudrin <ikudrin@accesssoftek.com>
Wed, 24 Nov 2021 05:17:03 +0000 (12:17 +0700)
committerIgor Kudrin <ikudrin@accesssoftek.com>
Wed, 24 Nov 2021 05:17:09 +0000 (12:17 +0700)
commit8cdf1c1edb937b192d162f299127fad8d9dc0faa
tree4eebf432ad6328564af1f12becfc2aa33155f3ca
parent55792b5ac44e4c0d3a8feb8a793d60d58e38cf20
[ELF] Support the "read-only" memory region attribute

The attribute 'r' allows (or disallows for the negative case) read-only
sections, i.e. ones without the SHF_WRITE flag, to be assigned to the
memory region. Before the patch, lld could put a section in the wrong
region or fail with "error: no memory region specified for section".

Differential Revision: https://reviews.llvm.org/D113771
lld/ELF/LinkerScript.cpp
lld/ELF/LinkerScript.h
lld/ELF/ScriptParser.cpp
lld/test/ELF/linkerscript/memory-attr.test [new file with mode: 0644]