From 3d6f1c7cc896e4f3e6e627d315bc5fcb12cf2921 Mon Sep 17 00:00:00 2001
From: Khang Nguyen <khang.nguyen.xw@renesas.com>
Date: Thu, 4 Feb 2021 12:25:12 +0900
Subject: [PATCH] scripts: Add module.lds to fix out-of-tree modules build
 error

See https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1906131 for
detail information.

Upstream-Status: Inappropriate [bugfix (https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1906131)]

Signed-off-by: Khang Nguyen <khang.nguyen.xw@renesas.com>
---
 scripts/module.lds | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100644 scripts/module.lds

diff --git a/scripts/module.lds b/scripts/module.lds
new file mode 100644
index 0000000..2a97eb8
--- /dev/null
+++ b/scripts/module.lds
@@ -0,0 +1,28 @@
+/*
+ * Common module linker script, always used when linking a module.
+ * Archs are free to supply their own linker scripts.  ld will
+ * combine them automatically.
+ */
+SECTIONS {
+	/DISCARD/ : {
+		*(.discard)
+		*(.discard.*)
+	}
+
+	__ksymtab		0 : { *(SORT(___ksymtab+*)) }
+	__ksymtab_gpl		0 : { *(SORT(___ksymtab_gpl+*)) }
+	__ksymtab_unused	0 : { *(SORT(___ksymtab_unused+*)) }
+	__ksymtab_unused_gpl	0 : { *(SORT(___ksymtab_unused_gpl+*)) }
+	__ksymtab_gpl_future	0 : { *(SORT(___ksymtab_gpl_future+*)) }
+	__kcrctab		0 : { *(SORT(___kcrctab+*)) }
+	__kcrctab_gpl		0 : { *(SORT(___kcrctab_gpl+*)) }
+	__kcrctab_unused	0 : { *(SORT(___kcrctab_unused+*)) }
+	__kcrctab_unused_gpl	0 : { *(SORT(___kcrctab_unused_gpl+*)) }
+	__kcrctab_gpl_future	0 : { *(SORT(___kcrctab_gpl_future+*)) }
+
+	.init_array		0 : ALIGN(8) { *(SORT(.init_array.*)) *(.init_array) }
+
+	__jump_table		0 : ALIGN(8) { KEEP(*(__jump_table)) }
+}
+
+/* bring in arch-specific sections */
-- 
2.7.4

