From 19a227ee354eee259f8a61ae537e8bc3f4c72a92 Mon Sep 17 00:00:00 2001
From: Ruslan Bukin
Date: Mon, 18 Feb 2019 13:14:53 +0000
Subject: [PATCH] Avoid orphan sections between __bss_start and .(s)bss.
Ensure __bss_start is associated with the next section
in case orphan sections are placed directly after .sdata,
as has been seen to happen with LLD.
Submitted by: "J.R.T. Clarke"
Differential Revision: https://reviews.freebsd.org/D18429
---
sys/conf/ldscript.riscv | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/sys/conf/ldscript.riscv b/sys/conf/ldscript.riscv
index 5fe32aea178..3665b105827 100644
--- a/sys/conf/ldscript.riscv
+++ b/sys/conf/ldscript.riscv
@@ -87,6 +87,10 @@ SECTIONS
.sdata : { *(.sdata) }
_edata = .;
PROVIDE (edata = .);
+ /* Ensure __bss_start is associated with the next section in case orphan
+ sections are placed directly after .sdata, as has been seen to happen with
+ LLD. */
+ . = .;
__bss_start = .;
.sbss : { *(.sbss) *(.scommon) }
.bss :