aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-scripts
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/testsuite/ld-scripts
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/testsuite/ld-scripts')
-rw-r--r--ld/testsuite/ld-scripts/output-section-types.d13
-rw-r--r--ld/testsuite/ld-scripts/output-section-types.t7
-rw-r--r--ld/testsuite/ld-scripts/script.exp1
3 files changed, 21 insertions, 0 deletions
diff --git a/ld/testsuite/ld-scripts/output-section-types.d b/ld/testsuite/ld-scripts/output-section-types.d
new file mode 100644
index 0000000..ab124fa
--- /dev/null
+++ b/ld/testsuite/ld-scripts/output-section-types.d
@@ -0,0 +1,13 @@
+#ld: -Toutput-section-types.t
+#source: align2a.s
+#objdump: -h
+#target: [is_elf_format]
+
+#...
+ . \.rom.*
+[ ]+ALLOC, READONLY
+ . \.ro.*
+[ ]+CONTENTS, ALLOC, LOAD, READONLY, DATA
+ . \.over.*
+[ ]+CONTENTS, READONLY
+#pass
diff --git a/ld/testsuite/ld-scripts/output-section-types.t b/ld/testsuite/ld-scripts/output-section-types.t
new file mode 100644
index 0000000..d8fdfda
--- /dev/null
+++ b/ld/testsuite/ld-scripts/output-section-types.t
@@ -0,0 +1,7 @@
+SECTIONS {
+ .rom (NOLOAD) : { LONG(1234); }
+ .ro (READONLY) : { LONG(5678); }
+ .over (OVERLAY) : { LONG(0123); }
+ /DISCARD/ : { *(*) }
+
+}
diff --git a/ld/testsuite/ld-scripts/script.exp b/ld/testsuite/ld-scripts/script.exp
index 961cd08..ff50199 100644
--- a/ld/testsuite/ld-scripts/script.exp
+++ b/ld/testsuite/ld-scripts/script.exp
@@ -229,6 +229,7 @@ foreach test_script $test_script_list {
run_dump_test "align-with-input"
run_dump_test "pr20302"
+run_dump_test "output-section-types"
run_dump_test "segment-start" {{name (default)}}
run_dump_test "segment-start" {{name (overridden)} \