[PATCH RFC 26/43] x86/pie: Add .data.rel.* sections into link script

Hou Wenlong posted 43 patches 2 years, 9 months ago
[PATCH RFC 26/43] x86/pie: Add .data.rel.* sections into link script
Posted by Hou Wenlong 2 years, 9 months ago
The .data.rel.local and .data.rel.ro.local sections are generated when
PIE is enabled, merge them into .data section, since no dynamic loader
is used.

Signed-off-by: Hou Wenlong <houwenlong.hwl@antgroup.com>
Cc: Thomas Garnier <thgarnie@chromium.org>
Cc: Lai Jiangshan <jiangshan.ljs@antgroup.com>
Cc: Kees Cook <keescook@chromium.org>
---
 arch/x86/kernel/vmlinux.lds.S | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
index fa4c6582663f..71e0769d2b52 100644
--- a/arch/x86/kernel/vmlinux.lds.S
+++ b/arch/x86/kernel/vmlinux.lds.S
@@ -177,6 +177,10 @@ SECTIONS
 		/* rarely changed data like cpu maps */
 		READ_MOSTLY_DATA(INTERNODE_CACHE_BYTES)
 
+#ifdef CONFIG_X86_PIE
+		*(.data.rel)
+		*(.data.rel.*)
+#endif
 		/* End of data section */
 		_edata = .;
 	} :data
-- 
2.31.1