Skip to contentSkip to conversation

sparc: Create a new file lib/ksyms.c and add export

PATCH Applied Julian Calaby 2 participants 3 messages Jan 8, 2009 SPARC + UltraSPARC (sparc/sparc64)

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/5 sparc: Create a new file lib/ksyms.c and add export

From: Sam Ravnborg <[email protected]>

sparc: Create a new file lib/ksyms.c and add export of all symbols defined in assembler in lib/ to this file.

Remove the duplicate entries from kernel/sparc_ksyms_*.c

The rationale behind this is that the EXPORT_SYMBOL() should be close to their definition and we cannot add designate a symbol to be exported in assembler so at least put it in a file in the same directory.

Additions by Julian Calaby:
* Rebased over sparc-2.6.git HEAD

---
 arch/sparc/kernel/sparc_ksyms_32.c |   86 -----------------
 arch/sparc/kernel/sparc_ksyms_64.c |  100 --------------------
 arch/sparc/lib/Makefile            |    1 +
 arch/sparc/lib/ksyms.c             |  180 ++++++++++++++++++++++++++++++++++++
 4 files changed, 181 insertions(+), 186 deletions(-)
 create mode 100644 arch/sparc/lib/ksyms.c
arch/sparc/kernel/sparc_ksyms_32.c +0 -86
index e1e9763..f4ee14d 100644
@@ -5,15 +5,12 @@
  * Copyright (C) 1996 Eddie C. Dost ([email protected])
  */
 
-/* Tell string.h we don't want memcpy etc. as cpp defines */
-#define EXPORT_SYMTAB_STROPS
 #define PROMLIB_INTERNAL
 
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/smp.h>
 #include <linux/types.h>
-#include <linux/string.h>
 #include <linux/sched.h>
 #include <linux/interrupt.h>
 #include <linux/in6.h>
@@ -55,57 +52,14 @@ struct poll {
 	short revents;
 };
 
-extern void (*__copy_1page)(void *, const void *);
-extern void __memmove(void *, const void *, __kernel_size_t);
-extern void (*bzero_1page)(void *);
-extern void *__bzero(void *, size_t);
-extern void *__memscan_zero(void *, size_t);
-extern void *__memscan_generic(void *, int, size_t);
-extern int __strncmp(const char *, const char *, __kernel_size_t);
-
-extern int __ashrdi3(int, int);
-extern int __ashldi3(int, int);
-extern int __lshrdi3(int, int);
-extern int __muldi3(int, int);
-extern int __divdi3(int, int);
-
-/* Private functions with odd calling conventions. */
-extern void ___atomic24_add(void);
-extern void ___atomic24_sub(void);
-extern void ___rw_read_enter(void);
-extern void ___rw_read_try(void);
-extern void ___rw_read_exit(void);
-extern void ___rw_write_enter(void);
-
-/* Alias functions whose names begin with "." and export the aliases.
- * The module references will be fixed up by module_frob_arch_sections.
- */
-extern int _Div(int, int);
-extern int _Mul(int, int);
-extern int _Rem(int, int);
-extern unsigned _Udiv(unsigned, unsigned);
-extern unsigned _Umul(unsigned, unsigned);
-extern unsigned _Urem(unsigned, unsigned);
-
 /* used by various drivers */
 EXPORT_SYMBOL(sparc_cpu_model);
 EXPORT_SYMBOL(kernel_thread);
-#ifdef CONFIG_SMP
-// XXX find what uses (or used) these.   AV: see asm/spinlock.h
-EXPORT_SYMBOL(___rw_read_enter);
-EXPORT_SYMBOL(___rw_read_try);
-EXPORT_SYMBOL(___rw_read_exit);
-EXPORT_SYMBOL(___rw_write_enter);
-#endif
 
 EXPORT_SYMBOL(sparc_valid_addr_bitmap);
 EXPORT_SYMBOL(phys_base);
 EXPORT_SYMBOL(pfn_base);
 
-/* Atomic operations. */
-EXPORT_SYMBOL(___atomic24_add);
-EXPORT_SYMBOL(___atomic24_sub);
-
 /* Per-CPU information table */
 EXPORT_PER_CPU_SYMBOL(__cpu_data);
 
@@ -193,31 +147,8 @@ EXPORT_SYMBOL(__prom_getchild);
 EXPORT_SYMBOL(__prom_getsibling);
 
 /* sparc library symbols */
-EXPORT_SYMBOL(memscan);
-EXPORT_SYMBOL(strlen);
-EXPORT_SYMBOL(strncmp);
 EXPORT_SYMBOL(page_kernel);
 
-/* Special internal versions of library functions. */
-EXPORT_SYMBOL(__copy_1page);
-EXPORT_SYMBOL(__memcpy);
-EXPORT_SYMBOL(__memset);
-EXPORT_SYMBOL(bzero_1page);
-EXPORT_SYMBOL(__bzero);
-EXPORT_SYMBOL(__memscan_zero);
-EXPORT_SYMBOL(__memscan_generic);
-EXPORT_SYMBOL(__strncmp);
-EXPORT_SYMBOL(__memmove);
-
-/* Moving data to/from userspace. */
-EXPORT_SYMBOL(__copy_user);
-EXPORT_SYMBOL(__strncpy_from_user);
-EXPORT_SYMBOL(__strnlen_user);
-
-/* Networking helper routines. */
-EXPORT_SYMBOL(__csum_partial_copy_sparc_generic);
-EXPORT_SYMBOL(csum_partial);
-
 /* Cache flushing.  */
 EXPORT_SYMBOL(sparc_flush_page_to_ram);
 
@@ -226,23 +157,6 @@ EXPORT_SYMBOL(sun_do_break);
 
 EXPORT_SYMBOL(__ret_efault);
 
-EXPORT_SYMBOL(memcmp);
-EXPORT_SYMBOL(memcpy);
-EXPORT_SYMBOL(memset);
-EXPORT_SYMBOL(memmove);
-EXPORT_SYMBOL(__ashrdi3);
-EXPORT_SYMBOL(__ashldi3);
-EXPORT_SYMBOL(__lshrdi3);
-EXPORT_SYMBOL(__muldi3);
-EXPORT_SYMBOL(__divdi3);
-
-EXPORT_SYMBOL(_Rem);
-EXPORT_SYMBOL(_Urem);
-EXPORT_SYMBOL(_Mul);
-EXPORT_SYMBOL(_Umul);
-EXPORT_SYMBOL(_Div);
-EXPORT_SYMBOL(_Udiv);
-
 #ifdef CONFIG_DEBUG_BUGVERBOSE
 EXPORT_SYMBOL(do_BUG);
 #endif
arch/sparc/kernel/sparc_ksyms_64.c +0 -100

150 lines not on this page · raw message

arch/sparc/lib/Makefile +1 -0
index 375016e..273fc85 100644
@@ -42,3 +42,4 @@ lib-$(CONFIG_SPARC64) += mcount.o ipcsum.o xor.o
 
 obj-y                 += iomap.o
 obj-$(CONFIG_SPARC32) += atomic32.o
+obj-y                 += ksyms.o
arch/sparc/lib/ksyms.c new file +180 -0

180 lines not on this page · raw message

#1 lore raw

Re: [PATCH v2 1/5] sparc: Create a new file lib/ksyms.c and add export of all symbols defined in ass

Quoted 11 lines · Julian Calaby

From: Sam Ravnborg <[email protected]>

sparc: Create a new file lib/ksyms.c and add export of all symbols defined in assembler in lib/ to this file.

Remove the duplicate entries from kernel/sparc_ksyms_*.c

The rationale behind this is that the EXPORT_SYMBOL() should be close to their definition and we cannot add designate a symbol to be exported in assembler so at least put it in a file in the same directory.

Quoted 6 lines

Additions by Julian Calaby:
* Rebased over sparc-2.6.git HEAD

Hi Julian.

This patch fails a allmodconfig build on sparc64 in lib/ksysm.c

CC arch/sparc/lib/ksyms.o
arch/sparc/lib/ksyms.c:43: error: _mcount' undeclared here (not in a function) arch/sparc/lib/ksyms.c:43: warning: type defaults to int' in declaration of _mcount' arch/sparc/lib/ksyms.c:171: error: xor_vis_2' undeclared here (not in a function) arch/sparc/lib/ksyms.c:171: warning: type defaults to int' in declaration of xor_vis_2' arch/sparc/lib/ksyms.c:172: error: xor_vis_3' undeclared here (not in a function) arch/sparc/lib/ksyms.c:172: warning: type defaults to int' in declaration of xor_vis_3' arch/sparc/lib/ksyms.c:173: error: xor_vis_4' undeclared here (not in a function) arch/sparc/lib/ksyms.c:173: warning: type defaults to int' in declaration of xor_vis_4' arch/sparc/lib/ksyms.c:174: error: xor_vis_5' undeclared here (not in a function) arch/sparc/lib/ksyms.c:174: warning: type defaults to int' in declaration of xor_vis_5' arch/sparc/lib/ksyms.c:176: error: xor_niagara_2' undeclared here (not in a function) arch/sparc/lib/ksyms.c:176: warning: type defaults to int' in declaration of xor_niagara_2' arch/sparc/lib/ksyms.c:177: error: xor_niagara_3' undeclared here (not in a function) arch/sparc/lib/ksyms.c:177: warning: type defaults to int' in declaration of xor_niagara_3' arch/sparc/lib/ksyms.c:178: error: xor_niagara_4' undeclared here (not in a function) arch/sparc/lib/ksyms.c:178: warning: type defaults to int' in declaration of xor_niagara_4' arch/sparc/lib/ksyms.c:179: error: xor_niagara_5' undeclared here (not in a function) arch/sparc/lib/ksyms.c:179: warning: type defaults to int' in declaration of `xor_niagara_5' make[1]: *** [arch/sparc/lib/ksyms.o] Error 1
make: *** [arch/sparc/lib/ksyms.o] Error 2

Originally I thought that I could use asm/xor.h to pick up the prototypes for the above functions.
But it turns out that xor.h _define_ two variables.

So my workaround was to add the prototypes in ksyms.c as we originally did in sparc_ksyms_64.c.

To fix _mcount you need to include <asm/ftrace.h> - including <linux/ftrace.h> does not work. See my earlier postings to sparclinux where you can see how I fixed this.

Please - keep on going and get these trivialities fixed.

Thanks,
Sam

#2 lore raw

Re: [PATCH v2 1/5] sparc: Create a new file lib/ksyms.c and add export of all symbols defined in ass

In reply to Julian Calaby
Quoted 53 lines · Sam Ravnborg
Quoted 11 lines · Julian Calaby

From: Sam Ravnborg <[email protected]>

sparc: Create a new file lib/ksyms.c and add export of all symbols defined in assembler in lib/ to this file.

Remove the duplicate entries from kernel/sparc_ksyms_*.c

The rationale behind this is that the EXPORT_SYMBOL() should be close to their definition and we cannot add designate a symbol to be exported in assembler so at least put it in a file in the same directory.

Quoted 6 lines

Additions by Julian Calaby:
* Rebased over sparc-2.6.git HEAD

Hi Julian.

This patch fails a allmodconfig build on sparc64 in lib/ksysm.c

CC arch/sparc/lib/ksyms.o
arch/sparc/lib/ksyms.c:43: error: _mcount' undeclared here (not in a function) arch/sparc/lib/ksyms.c:43: warning: type defaults to int' in declaration of _mcount' arch/sparc/lib/ksyms.c:171: error: xor_vis_2' undeclared here (not in a function) arch/sparc/lib/ksyms.c:171: warning: type defaults to int' in declaration of xor_vis_2' arch/sparc/lib/ksyms.c:172: error: xor_vis_3' undeclared here (not in a function) arch/sparc/lib/ksyms.c:172: warning: type defaults to int' in declaration of xor_vis_3' arch/sparc/lib/ksyms.c:173: error: xor_vis_4' undeclared here (not in a function) arch/sparc/lib/ksyms.c:173: warning: type defaults to int' in declaration of xor_vis_4' arch/sparc/lib/ksyms.c:174: error: xor_vis_5' undeclared here (not in a function) arch/sparc/lib/ksyms.c:174: warning: type defaults to int' in declaration of xor_vis_5' arch/sparc/lib/ksyms.c:176: error: xor_niagara_2' undeclared here (not in a function) arch/sparc/lib/ksyms.c:176: warning: type defaults to int' in declaration of xor_niagara_2' arch/sparc/lib/ksyms.c:177: error: xor_niagara_3' undeclared here (not in a function) arch/sparc/lib/ksyms.c:177: warning: type defaults to int' in declaration of xor_niagara_3' arch/sparc/lib/ksyms.c:178: error: xor_niagara_4' undeclared here (not in a function) arch/sparc/lib/ksyms.c:178: warning: type defaults to int' in declaration of xor_niagara_4' arch/sparc/lib/ksyms.c:179: error: xor_niagara_5' undeclared here (not in a function) arch/sparc/lib/ksyms.c:179: warning: type defaults to int' in declaration of `xor_niagara_5' make[1]: *** [arch/sparc/lib/ksyms.o] Error 1
make: *** [arch/sparc/lib/ksyms.o] Error 2

Originally I thought that I could use asm/xor.h to pick up the prototypes for the above functions.
But it turns out that xor.h _define_ two variables.

So my workaround was to add the prototypes in ksyms.c as we originally did in sparc_ksyms_64.c.

Quoted 8 lines

To fix _mcount you need to include <asm/ftrace.h> - including <linux/ftrace.h> does not work. See my earlier postings to sparclinux where you can see how I fixed this.

Please - keep on going and get these trivialities fixed.

Thanks,
Sam

I could have sworn this worked.

Ah well, I'll post an update in a moment.

Thanks for testing!

Signature · 3 lines
Julian Calaby

Email: [email protected]