aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/asm-generic/vmlinux.lds.h12
-rw-r--r--include/linux/init.h13
2 files changed, 25 insertions, 0 deletions
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index f3806a74c47..8307b1bb337 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -9,6 +9,11 @@
/* Align . to a 8 byte boundary equals to maximum function alignment. */
#define ALIGN_FUNCTION() . = ALIGN(8)
+/* .data section */
+#define DATA_DATA \
+ *(.data) \
+ *(.data.init.refok)
+
#define RODATA \
. = ALIGN(4096); \
.rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \
@@ -139,6 +144,13 @@
VMLINUX_SYMBOL(__security_initcall_end) = .; \
}
+/* .text section. Map to function alignment to avoid address changes
+ * during second ld run in second ld pass when generating System.map */
+#define TEXT_TEXT \
+ ALIGN_FUNCTION(); \
+ *(.text) \
+ *(.text.init.refok)
+
/* sched.text is aling to function alignment to secure we have same
* address even at second ld pass when generating System.map */
#define SCHED_TEXT \
diff --git a/include/linux/init.h b/include/linux/init.h
index e007ae4dc41..56ec4c62eee 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -45,6 +45,19 @@
#define __exitdata __attribute__ ((__section__(".exit.data")))
#define __exit_call __attribute_used__ __attribute__ ((__section__ (".exitcall.exit")))
+/* modpost check for section mismatches during the kernel build.
+ * A section mismatch happens when there are references from a
+ * code or data section to an init section (both code or data).
+ * The init sections are (for most archs) discarded by the kernel
+ * when early init has completed so all such references are potential bugs.
+ * For exit sections the same issue exists.
+ * The following markers are used for the cases where the reference to
+ * the init/exit section (code or data) is valid and will teach modpost
+ * not to issue a warning.
+ * The markers follow same syntax rules as __init / __initdata. */
+#define __init_refok noinline __attribute__ ((__section__ (".text.init.refok")))
+#define __initdata_refok __attribute__ ((__section__ (".data.init.refok")))
+
#ifdef MODULE
#define __exit __attribute__ ((__section__(".exit.text")))
#else