aboutsummaryrefslogtreecommitdiff
path: root/ld/ldlang.c
diff options
context:
space:
mode:
authorLuca Boccassi <luca.boccassi@microsoft.com>2021-07-21 14:32:03 +0100
committerNick Clifton <nickc@redhat.com>2021-07-21 14:36:02 +0100
commit6b86da53d5ee2022b9065f445d23356190380746 (patch)
tree30672413b66483f04b1d54399cae642ae651eccc /ld/ldlang.c
parent8f5d31b8d1f80fd9fff4cef4acc4491a0d83fbed (diff)
downloadgdb-6b86da53d5ee2022b9065f445d23356190380746.zip
gdb-6b86da53d5ee2022b9065f445d23356190380746.tar.gz
gdb-6b86da53d5ee2022b9065f445d23356190380746.tar.bz2
Allows linker scripts to set the SEC_READONLY flag.
* ld.texi: Document new output section type. * ldgram.y: Add new token. * ldlang.c: Handle the new flag. * ldlang.h: Add readonly_section to list of section types. * ldlex.l: Add a new identifier. * testsuite/ld-scripts/output-section-types.t: New example linker script. * testsuite/ld-scripts/output-section-types.d: Test driver. * testsyute/ld-scripts/script.exp: Run the new test.
Diffstat (limited to 'ld/ldlang.c')
-rw-r--r--ld/ldlang.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/ld/ldlang.c b/ld/ldlang.c
index 37b64c8..2610be9 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -2639,6 +2639,9 @@ lang_add_section (lang_statement_list_type *ptr,
case noalloc_section:
flags &= ~SEC_ALLOC;
break;
+ case readonly_section:
+ flags |= SEC_READONLY;
+ break;
case noload_section:
flags &= ~SEC_LOAD;
flags |= SEC_NEVER_LOAD;
@@ -4232,6 +4235,9 @@ map_input_to_output_sections
case noalloc_section:
flags = SEC_HAS_CONTENTS;
break;
+ case readonly_section:
+ flags |= SEC_READONLY;
+ break;
case noload_section:
if (bfd_get_flavour (link_info.output_bfd)
== bfd_target_elf_flavour)