Skip to contentSkip to conversation

vmlinux.lds: add missing VMLINUX_SYMBOL macros

PATCH Applied Jessica 2 participants 2 messages Apr 3, 2017 Generic include/asm header files

lore
Share & tools
lore

Jessica

author
#0 lore raw

PATCH 1/1 vmlinux.lds: add missing VMLINUX_SYMBOL macros

From: Jessica Yu <[email protected]>

When __{start,end}_ro_after_init is referenced from C code, we run into the following build errors on blackfin:

kernel/extable.c:169: undefined reference to __start_ro_after_init' kernel/extable.c:169: undefined reference to __end_ro_after_init'

The build error is due to the fact that blackfin is one of the few arches that prepends an underscore '_' to all symbols defined in C. Fix this by wrapping __{start,end}_ro_after_init in vmlinux.lds.h with VMLINUX_SYMBOL(), which adds the necessary prefix for arches that have HAVE_UNDERSCORE_SYMBOL_PREFIX.

---
This patch is based on next-20170403.

 include/asm-generic/vmlinux.lds.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/asm-generic/vmlinux.lds.h +2 -2
index 979b573..54918ae 100644
@@ -261,9 +261,9 @@
  */
 #ifndef RO_AFTER_INIT_DATA
 #define RO_AFTER_INIT_DATA						\
-	__start_ro_after_init = .;					\
+	VMLINUX_SYMBOL(__start_ro_after_init) = .;			\
 	*(.data..ro_after_init)						\
-	__end_ro_after_init = .;
+	VMLINUX_SYMBOL(__end_ro_after_init) = .;
 #endif
 
 /*
Signature · 1 line
2.5.5
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Jessica

From: Jessica Yu <[email protected]>

When __{start,end}_ro_after_init is referenced from C code, we run into the following build errors on blackfin:

kernel/extable.c:169: undefined reference to __start_ro_after_init' kernel/extable.c:169: undefined reference to __end_ro_after_init'

Quoted 6 lines

The build error is due to the fact that blackfin is one of the few arches that prepends an underscore '_' to all symbols defined in C. Fix this by wrapping __{start,end}_ro_after_init in vmlinux.lds.h with VMLINUX_SYMBOL(), which adds the necessary prefix for arches that have HAVE_UNDERSCORE_SYMBOL_PREFIX.

Thanks!

-Kees

Quoted 25 lines

---
This patch is based on next-20170403.

 include/asm-generic/vmlinux.lds.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/asm-generic/vmlinux.lds.h +2 -3
index 979b573..54918ae 100644
@@ -261,9 +261,9 @@
  */
 #ifndef RO_AFTER_INIT_DATA
 #define RO_AFTER_INIT_DATA                                             \
-       __start_ro_after_init = .;                                      \
+       VMLINUX_SYMBOL(__start_ro_after_init) = .;                      \
        *(.data..ro_after_init)                                         \
-       __end_ro_after_init = .;
+       VMLINUX_SYMBOL(__end_ro_after_init) = .;
 #endif
 
 /*
--

2.5.5

Signature · 2 lines
Kees Cook
Pixel Security