[sw/crt] Ensure Small Read-Only Data is Linked
We're not using a small data threshold yet, but this avoids any
potential problems when we start to.
GNU ld by default puts these sections into the `.data` output section
for faster access using `gp`. In our case, it seems prudent to put them
into ROM, so they remain read-only.
Signed-off-by: Sam Elliott <selliott@lowrisc.org>
diff --git a/sw/device/boot_rom/rom_link.ld b/sw/device/boot_rom/rom_link.ld
index dfb328c..b44c923 100644
--- a/sw/device/boot_rom/rom_link.ld
+++ b/sw/device/boot_rom/rom_link.ld
@@ -82,6 +82,10 @@
* strings.
*/
.rodata : ALIGN(4) {
+ /* Small read-only data comes before regular read-only data for the same
+ * reasons as in the data section */
+ *(.srodata)
+ *(.srodata.*)
*(.rodata)
*(.rodata.*)
} > rom
diff --git a/sw/device/exts/common/flash_link.ld b/sw/device/exts/common/flash_link.ld
index 49c09f3..2500b07 100644
--- a/sw/device/exts/common/flash_link.ld
+++ b/sw/device/exts/common/flash_link.ld
@@ -74,6 +74,10 @@
* strings.
*/
.rodata : ALIGN(4) {
+ /* Small read-only data comes before regular read-only data for the same
+ * reasons as in the data section */
+ *(.srodata)
+ *(.srodata.*)
*(.rodata)
*(.rodata.*)
} > flash