[PATCH} H8/300 update (2/9) ldscripts fix
- symbol prefix (use h8300 and v850) support
- include headers
Signature · 86 lines
Yoshinori Sato <[email protected]> diff -Nru linux-2.6.6/arch/h8300/kernel/vmlinux.lds.S linux-2.6.6-h8300/arch/h8300/kernel/vmlinux.lds.S --- linux-2.6.6/arch/h8300/kernel/vmlinux.lds.S 2004-05-11 14:30:44.000000000 +0900 +++ linux-2.6.6-h8300/arch/h8300/kernel/vmlinux.lds.S 2004-05-11 21:04:14.000000000 +0900 @@ -1,3 +1,5 @@ +#include <asm-generic/vmlinux.lds.h> +#include <asm/thread_info.h> #include <linux/config.h> #ifdef CONFIG_H8300H_GENERIC diff -Nru linux-2.6.6/include/asm-generic/vmlinux.lds.h linux-2.6.6-h8300/include/asm-generic/vmlinux.lds.h --- linux-2.6.6/include/asm-generic/vmlinux.lds.h 2004-05-11 14:30:47.000000000 +0900 +++ linux-2.6.6-h8300/include/asm-generic/vmlinux.lds.h 2004-05-11 23:03:42.000000000 +0900 @@ -1,7 +1,15 @@ +#include <linux/config.h> + #ifndef LOAD_OFFSET #define LOAD_OFFSET 0 #endif +#if defined(CONFIG_H8300) || defined(CONFIG_V850) +#define SYMBOL(_sym_) _##_sym_ +#else +#define SYMBOL(_sym_) _sym_ +#endif + #define RODATA \ .rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \ *(.rodata) *(.rodata.*) \ @@ -14,30 +22,30 @@ \ /* Kernel symbol table: Normal symbols */ \ __ksymtab : AT(ADDR(__ksymtab) - LOAD_OFFSET) { \ - __start___ksymtab = .; \ + SYMBOL(__start___ksymtab) = .; \ *(__ksymtab) \ - __stop___ksymtab = .; \ + SYMBOL(__stop___ksymtab) = .; \ } \ \ /* Kernel symbol table: GPL-only symbols */ \ __ksymtab_gpl : AT(ADDR(__ksymtab_gpl) - LOAD_OFFSET) { \ - __start___ksymtab_gpl = .; \ + SYMBOL(__start___ksymtab_gpl) = .; \ *(__ksymtab_gpl) \ - __stop___ksymtab_gpl = .; \ + SYMBOL(__stop___ksymtab_gpl) = .; \ } \ \ /* Kernel symbol table: Normal symbols */ \ __kcrctab : AT(ADDR(__kcrctab) - LOAD_OFFSET) { \ - __start___kcrctab = .; \ + SYMBOL(__start___kcrctab) = .; \ *(__kcrctab) \ - __stop___kcrctab = .; \ + SYMBOL(__stop___kcrctab) = .; \ } \ \ /* Kernel symbol table: GPL-only symbols */ \ __kcrctab_gpl : AT(ADDR(__kcrctab_gpl) - LOAD_OFFSET) { \ - __start___kcrctab_gpl = .; \ + SYMBOL(__start___kcrctab_gpl) = .; \ *(__kcrctab_gpl) \ - __stop___kcrctab_gpl = .; \ + SYMBOL(__stop___kcrctab_gpl) = .; \ } \ \ /* Kernel symbol table: strings */ \ @@ -47,12 +55,12 @@ #define SECURITY_INIT \ .security_initcall.init : { \ - __security_initcall_start = .; \ + SYMBOL(__security_initcall_start) = .; \ *(.security_initcall.init) \ __security_initcall_end = .; \ } #define SCHED_TEXT \ - __scheduling_functions_start_here = .; \ + SYMBOL(__scheduling_functions_start_here) = .; \ *(.sched.text) \ - __scheduling_functions_end_here = .; + SYMBOL(__scheduling_functions_end_here) = .;
Quoted 3 lines · Yoshinori Sato
- symbol prefix (use h8300 and v850) support
- include headers
This generates a reject agaisnt Linus's current include/asm-generic/vmlinux.lds.h due to post-2.6.6 changes.
I fixed it up as below.
But I am wondering about this:
#define SECURITY_INIT \
.security_initcall.init : { \
+ SYMBOL(__security_initcall_start) = .; \
*(.security_initcall.init) \
__security_initcall_end = .; \
}
Shouldn't __security_initcall_end also have a SYMBOL() wrapper?
From: Yoshinori Sato <[email protected]>
- symbol prefix (use h8300 and v850) support
- include headers
---
25-akpm/arch/h8300/kernel/vmlinux.lds.S | 2 ++ 25-akpm/include/asm-generic/vmlinux.lds.h | 30 +++++++++++++++++++----------- 2 files changed, 21 insertions(+), 11 deletions(-)
arch/h8300/kernel/vmlinux.lds.S renamed from arch/h8300/kernel/vmlinux.lds.S~h8-300-update-2-9-ldscripts-fix +2 -0
@@ -1,3 +1,5 @@ +#include <asm-generic/vmlinux.lds.h> +#include <asm/thread_info.h> #include <linux/config.h> #ifdef CONFIG_H8300H_GENERIC
include/asm-generic/vmlinux.lds.h renamed from include/asm-generic/vmlinux.lds.h~h8-300-update-2-9-ldscripts-fix +19 -11
@@ -1,7 +1,15 @@ +#include <linux/config.h> +#ifndef LOAD_OFFSET #define LOAD_OFFSET 0#endif +#if defined(CONFIG_H8300 ) || defined(CONFIG_V850 ) +#define SYMBOL (_sym_) _##_sym_ +#else +#define SYMBOL (_sym_) _sym_ +#endif +#define RODATA \ .rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \ *(.rodata) *(.rodata.*) \
@@ -14,30 +22,30 @@ \/* Kernel symbol table: Normal symbols */ \ __ksymtab : AT(ADDR(__ksymtab) - LOAD_OFFSET) { \ - __start___ksymtab = .; \ + SYMBOL(__start___ksymtab) = .; \ *(__ksymtab ) \ - __stop___ksymtab = .; \ + SYMBOL(__stop___ksymtab) = .; \ } \ \/* Kernel symbol table: GPL-only symbols */ \ __ksymtab_gpl : AT(ADDR(__ksymtab_gpl) - LOAD_OFFSET) { \ - __start___ksymtab_gpl = .; \ + SYMBOL(__start___ksymtab_gpl) = .; \ *(__ksymtab_gpl ) \ - __stop___ksymtab_gpl = .; \ + SYMBOL(__stop___ksymtab_gpl) = .; \ } \ \/* Kernel symbol table: Normal symbols */ \ __kcrctab : AT(ADDR(__kcrctab) - LOAD_OFFSET) { \ - __start___kcrctab = .; \ + SYMBOL(__start___kcrctab) = .; \ *(__kcrctab ) \ - __stop___kcrctab = .; \ + SYMBOL(__stop___kcrctab) = .; \ } \ \/* Kernel symbol table: GPL-only symbols */ \ __kcrctab_gpl : AT(ADDR(__kcrctab_gpl) - LOAD_OFFSET) { \ - __start___kcrctab_gpl = .; \ + SYMBOL(__start___kcrctab_gpl) = .; \ *(__kcrctab_gpl ) \ - __stop___kcrctab_gpl = .; \ + SYMBOL(__stop___kcrctab_gpl) = .; \ } \ \/* Kernel symbol table: strings */ \
@@ -47,12 +55,12 @@#define SECURITY_INIT \ .security_initcall.init : { \ - __security_initcall_start = .; \ + SYMBOL(__security_initcall_start) = .; \ *(.security_initcall.init) \ __security_initcall_end = .; \ }#define SCHED_TEXT \ - __sched_text_start = .; \ + SYMBOL(__sched_text_start) = .; \ *(.sched.text) \ - __sched_text_end = .; + SYMBOL(__sched_text_end) = .;
_
Review
Quoted 7 lines · Yoshinori Sato
(quoted diff) +6
-0+#if defined(CONFIG_H8300) || defined(CONFIG_V850) +#define SYMBOL(_sym_) _##_sym_ +#else +#define SYMBOL(_sym_) _sym_ +#endif +
Adding arch-specific stuff to an include/asm-generic/ header file is not nice.
However, having to create an arch-specific version of the header just becasue you need this wrapper is also not nice.
And "SYMBOL" is a too generic identifier: it may clash with other things.
Could I suggest that you change asm-generic/vmlinux.lds.h to do:
#ifndef VMLINUX_SYMBOL
#define VMLINUX_SYMBOL(_sym_) _sym_
#endif
...
- __start___ksymtab = .; \
+ VMLINUX_SYMBOL(__start___ksymtab) = .; \
Then, in some h8300-specific file, do:
#define VMLINUX_SYMBOL(_sym_) _##_sym_ #include <asm-generic/vmlinux.lds.h>
and include that file instead of asm-generic/vmlinux.lds.h?
(I am unable to find where h8300 actually includes vmlinux.lds.h. Confused).
I corrected it.
Signature · 94 lines
Yoshinori Sato <[email protected]> diff -Nru linux-2.6.6/arch/h8300/kernel/vmlinux.lds.S linux-2.6.6-h8300/arch/h8300/kernel/vmlinux.lds.S --- linux-2.6.6/arch/h8300/kernel/vmlinux.lds.S 11 May 2004 02:16:05 -0000 +++ linux-2.6.6-h8300/arch/h8300/kernel/vmlinux.lds.S 12 May 2004 12:30:04 -0000 @@ -1,3 +1,6 @@ +#define VMLINUX_SYMBOL(_sym_) _##_sym_ +#include <asm-generic/vmlinux.lds.h> +#include <asm/thread_info.h> #include <linux/config.h> #ifdef CONFIG_H8300H_GENERIC diff -Nru linux-2.6.6/arch/v850/kernel/vmlinux.lds.S linux-2.6.6-h8300/arch/v850/kernel/vmlinux.lds.S --- linux-2.6.6/arch/v850/kernel/vmlinux.lds.S 11 May 2004 02:16:06 -0000 +++ linux-2.6.6-h8300/arch/v850/kernel/vmlinux.lds.S 12 May 2004 12:30:15 -0000 @@ -12,6 +12,7 @@ */ #include <linux/config.h> +#define VMLINUX_SYMBOL(_sym_) _##_sym_ #include <asm-generic/vmlinux.lds.h> /* For most platforms, this will define useful things like RAM addr/size. */ diff -Nru linux-2.6.6/include/asm-generic/vmlinux.lds.h linux-2.6.6-h8300/include/asm-generic/vmlinux.lds.h --- linux-2.6.6/include/asm-generic/vmlinux.lds.h 11 May 2004 02:16:29 -0000 +++ linux-2.6.6-h8300/include/asm-generic/vmlinux.lds.h 12 May 2004 12:29:44 -0000 @@ -2,6 +2,10 @@ #define LOAD_OFFSET 0 #endif +#ifndef VMLINUX_SYMBOL +#define VMLINUX_SYMBOL(_sym_) _sym_ +#endif + #define RODATA \ .rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \ *(.rodata) *(.rodata.*) \ @@ -14,30 +18,30 @@ \ /* Kernel symbol table: Normal symbols */ \ __ksymtab : AT(ADDR(__ksymtab) - LOAD_OFFSET) { \ - __start___ksymtab = .; \ + VMLINUX_SYMBOL(__start___ksymtab) = .; \ *(__ksymtab) \ - __stop___ksymtab = .; \ + VMLINUX_SYMBOL(__stop___ksymtab) = .; \ } \ \ /* Kernel symbol table: GPL-only symbols */ \ __ksymtab_gpl : AT(ADDR(__ksymtab_gpl) - LOAD_OFFSET) { \ - __start___ksymtab_gpl = .; \ + VMLINUX_SYMBOL(__start___ksymtab_gpl) = .; \ *(__ksymtab_gpl) \ - __stop___ksymtab_gpl = .; \ + VMLINUX_SYMBOL(__stop___ksymtab_gpl) = .; \ } \ \ /* Kernel symbol table: Normal symbols */ \ __kcrctab : AT(ADDR(__kcrctab) - LOAD_OFFSET) { \ - __start___kcrctab = .; \ + VMLINUX_SYMBOL(__start___kcrctab) = .; \ *(__kcrctab) \ - __stop___kcrctab = .; \ + VMLINUX_SYMBOL(__stop___kcrctab) = .; \ } \ \ /* Kernel symbol table: GPL-only symbols */ \ __kcrctab_gpl : AT(ADDR(__kcrctab_gpl) - LOAD_OFFSET) { \ - __start___kcrctab_gpl = .; \ + VMLINUX_SYMBOL(__start___kcrctab_gpl) = .; \ *(__kcrctab_gpl) \ - __stop___kcrctab_gpl = .; \ + VMLINUX_SYMBOL(__stop___kcrctab_gpl) = .; \ } \ \ /* Kernel symbol table: strings */ \ @@ -47,12 +51,12 @@ #define SECURITY_INIT \ .security_initcall.init : { \ - __security_initcall_start = .; \ + VMLINUX_SYMBOL(__security_initcall_start) = .; \ *(.security_initcall.init) \ - __security_initcall_end = .; \ + VMLINUX_SYMBOL(__security_initcall_end) = .; \ } #define SCHED_TEXT \ - __sched_text_start = .; \ + VMLINUX_SYMBOL(__sched_text_start) = .; \ *(.sched.text) \ - __sched_text_end = .; + VMLINUX_SYMBOL(__sched_text_end) = .;