linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* RFC: killing ksyms.c
@ 2008-08-11 14:06 Arnd Bergmann
  2008-08-11 14:17 ` [RFC 2/3] powerpc: export all symbols from the definition file Arnd Bergmann
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Arnd Bergmann @ 2008-08-11 14:06 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-arch, Matthew Wilcox, David Woodhouse, Al Viro,
	Rusty Russell

I saw this conversation on IRC when I came back to my screen, and
managed to dig out an older patch of mine:

[19:03:13] <willy> at some point we really need to forbid that
[19:03:28] <willy> bit hard at this point with things like memcpy()
[19:04:36] <willy> could do it with a script of some kind and
           either a whitelist of filenames (arch/*/kernel/ksyms.c
           can export anything) or of functions (anywhere can
           EXPORT_SYMBOL(memcpy)).
[Sun Aug 10 2008] [19:07:35] <viro> I suspect that we really want
           to teach *.S how to do exports
[Sun Aug 10 2008] [19:07:58] <viro> and kill ksyms.c
[Sun Aug 10 2008] [19:12:47] <dwmw2_gone> if we do the -fwhole-program
           --combine thing we'll make it hard anyway

I compile-tested this on powerpc, 32 and 64 bit, and it should be usable as
an example for other architectures.
The idea is to provide an EXPORT_SYMBOL macro for assembly that
behaves in the same way as the C version, and then export every
symbol from the file that defines it.

I'm not sure if the macro I used is actually correct or portable across
all supported architectures, so I hope to get some insight about this
from linux-arch. It does not do genksyms versioned symbol generation
from assembly, but that should be fine since they tend to be really
stable.

	Arnd <><

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [RFC 2/3] powerpc: export all symbols from the definition file
  2008-08-11 14:06 RFC: killing ksyms.c Arnd Bergmann
@ 2008-08-11 14:17 ` Arnd Bergmann
  2008-08-11 14:53   ` Geert Uytterhoeven
  2008-08-11 14:18 ` [RFC 1/3] add support for exporting symbols from .S files Arnd Bergmann
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 13+ messages in thread
From: Arnd Bergmann @ 2008-08-11 14:17 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-arch, Matthew Wilcox, David Woodhouse, Al Viro,
	Rusty Russell, linuxppc-dev

It's now possible to export symbols from .S files, so move all
exports out of the ppc_ksyms.c file to the definition of the
symbols.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/powerpc/kernel/entry_32.S       |    3 +++
 arch/powerpc/kernel/entry_64.S       |    2 ++
 arch/powerpc/kernel/fpu.S            |    2 ++
 arch/powerpc/kernel/head_32.S        |    6 ++++++
 arch/powerpc/kernel/head_40x.S       |    4 ++++
 arch/powerpc/kernel/head_44x.S       |    5 +++++
 arch/powerpc/kernel/head_64.S        |    2 ++
 arch/powerpc/kernel/head_8xx.S       |    4 ++++
 arch/powerpc/kernel/head_fsl_booke.S |    6 ++++++
 arch/powerpc/kernel/irq.c            |    4 +++-
 arch/powerpc/kernel/misc_32.S        |   12 ++++++++++++
 arch/powerpc/kernel/misc_64.S        |    5 +++++
 arch/powerpc/kernel/pci-common.c     |    2 ++
 arch/powerpc/kernel/pci_32.c         |    3 +++
 arch/powerpc/kernel/process.c        |    2 ++
 arch/powerpc/kernel/setup-common.c   |    1 +
 arch/powerpc/kernel/setup_32.c       |    5 +++++
 arch/powerpc/kernel/signal_32.c      |    2 ++
 arch/powerpc/kernel/smp.c            |    2 ++
 arch/powerpc/kernel/time.c           |    3 +++
 arch/powerpc/kernel/traps.c          |    4 ++++
 arch/powerpc/lib/checksum_32.S       |    6 ++++++
 arch/powerpc/lib/checksum_64.S       |    5 +++++
 arch/powerpc/lib/copy_32.S           |    7 +++++++
 arch/powerpc/lib/copypage_64.S       |    3 +++
 arch/powerpc/lib/copyuser_64.S       |    3 +++
 arch/powerpc/lib/mem_64.S            |    3 +++
 arch/powerpc/lib/memcpy_64.S         |    3 +++
 arch/powerpc/lib/string.S            |   12 ++++++++++++
 arch/powerpc/mm/hash_low_32.S        |    4 ++++
 arch/powerpc/mm/mmu_context_32.c     |    2 ++
 arch/powerpc/mm/tlb_32.c             |    3 +++
 arch/powerpc/sysdev/dcr-low.S        |    3 +++
 drivers/macintosh/adb.c              |    5 +++++
 drivers/macintosh/via-cuda.c         |    3 +++

 35 files changed, 140 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
index 1cbbf70..7716264 100644
--- a/arch/powerpc/kernel/entry_32.S
+++ b/arch/powerpc/kernel/entry_32.S
@@ -22,6 +22,7 @@
 #include <linux/errno.h>
 #include <linux/sys.h>
 #include <linux/threads.h>
+#include <linux/module.h>
 #include <asm/reg.h>
 #include <asm/page.h>
 #include <asm/mmu.h>
@@ -209,6 +210,7 @@ transfer_to_handler_cont:
 	lwz	r12,_LINK(r11)		/* and return to address in LR */
 	b	fast_exception_return
 #endif
+EXPORT_SYMBOL(transfer_to_handler)
 
 /*
  * On kernel stack overflow, load up an initial stack pointer
@@ -1196,6 +1198,7 @@ mcount_call:
 	lwz	r10,40(r1)
 	addi	r1, r1, 48
 	bctr
+EXPORT_SYMBOL(_mcount)
 
 _GLOBAL(ftrace_caller)
 	/* Based off of objdump optput from glibc */
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index 2d802e9..fa65272 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -18,6 +18,7 @@
  *  2 of the License, or (at your option) any later version.
  */
 
+#include <linux/module.h>
 #include <linux/errno.h>
 #include <asm/unistd.h>
 #include <asm/processor.h>
@@ -898,6 +899,7 @@ mcount_call:
 	mtlr	r0
 	addi	r1, r1, 112
 	blr
+EXPORT_SYMBOL(_mcount)
 
 _GLOBAL(ftrace_caller)
 	/* Taken from output of objdump from lib64/glibc */
diff --git a/arch/powerpc/kernel/fpu.S b/arch/powerpc/kernel/fpu.S
index a088c06..6e137b4 100644
--- a/arch/powerpc/kernel/fpu.S
+++ b/arch/powerpc/kernel/fpu.S
@@ -14,6 +14,7 @@
  *
  */
 
+#include <linux/module.h>
 #include <asm/reg.h>
 #include <asm/page.h>
 #include <asm/mmu.h>
@@ -154,6 +155,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_VSX)
 	PPC_STL	r5,ADDROFF(last_task_used_math)(r4)
 #endif /* CONFIG_SMP */
 	blr
+EXPORT_SYMBOL(giveup_fpu)
 
 /*
  * These are used in the alignment trap handler when emulating
diff --git a/arch/powerpc/kernel/head_32.S b/arch/powerpc/kernel/head_32.S
index 99ee2f0..d6c8a03 100644
--- a/arch/powerpc/kernel/head_32.S
+++ b/arch/powerpc/kernel/head_32.S
@@ -21,6 +21,7 @@
  *
  */
 
+#include <linux/module.h>
 #include <asm/reg.h>
 #include <asm/page.h>
 #include <asm/mmu.h>
@@ -690,6 +691,7 @@ DataStoreTLBMiss:
 
 	.globl mol_trampoline
 	.set mol_trampoline, i0x2f00
+EXPORT_SYMBOL(mol_trampoline)
 
 	. = 0x3000
 
@@ -801,6 +803,7 @@ giveup_altivec:
 #endif /* CONFIG_SMP */
 	blr
 #endif /* CONFIG_ALTIVEC */
+EXPORT_SYMBOL(giveup_altivec)
 
 /*
  * This code is jumped to from the startup code to copy
@@ -1092,6 +1095,7 @@ _ENTRY(set_context)
 	sync
 	isync
 	blr
+EXPORT_SYMBOL(set_context)
 
 /*
  * An undocumented "feature" of 604e requires that the v bit
@@ -1294,6 +1298,7 @@ sdata:
 	.globl	empty_zero_page
 empty_zero_page:
 	.space	4096
+EXPORT_SYMBOL(empty_zero_page)
 
 	.globl	swapper_pg_dir
 swapper_pg_dir:
@@ -1307,6 +1312,7 @@ intercept_table:
 	.long 0, 0, 0, 0, 0, 0, 0, 0
 	.long 0, 0, 0, 0, 0, 0, 0, 0
 	.long 0, 0, 0, 0, 0, 0, 0, 0
+EXPORT_SYMBOL(intercept_table)
 
 /* Room for two PTE pointers, usually the kernel and current user pointers
  * to their respective root page table.
diff --git a/arch/powerpc/kernel/head_40x.S b/arch/powerpc/kernel/head_40x.S
index 56d8e5d..717de09 100644
--- a/arch/powerpc/kernel/head_40x.S
+++ b/arch/powerpc/kernel/head_40x.S
@@ -31,6 +31,7 @@
  *
  */
 
+#include <linux/module.h>
 #include <asm/processor.h>
 #include <asm/page.h>
 #include <asm/mmu.h>
@@ -822,6 +823,7 @@ finish_tlb_load:
  */
 _ENTRY(giveup_fpu)
 	blr
+EXPORT_SYMBOL(giveup_fpu)
 
 /* This is where the main kernel code starts.
  */
@@ -987,6 +989,7 @@ _GLOBAL(set_context)
 	isync				/* Need an isync to flush shadow */
 					/* TLBs after changing PID */
 	blr
+EXPORT_SYMBOL(set_context)
 
 /* We put a few things here that have to be page-aligned. This stuff
  * goes at the beginning of the data segment, which is page-aligned.
@@ -998,6 +1001,7 @@ sdata:
 	.globl	empty_zero_page
 empty_zero_page:
 	.space	4096
+EXPORT_SYMBOL(empty_zero_page)
 	.globl	swapper_pg_dir
 swapper_pg_dir:
 	.space	PGD_TABLE_SIZE
diff --git a/arch/powerpc/kernel/head_44x.S b/arch/powerpc/kernel/head_44x.S
index f3a1ea9..703a70c 100644
--- a/arch/powerpc/kernel/head_44x.S
+++ b/arch/powerpc/kernel/head_44x.S
@@ -28,6 +28,7 @@
  * option) any later version.
  */
 
+#include <linux/module.h>
 #include <asm/processor.h>
 #include <asm/page.h>
 #include <asm/mmu.h>
@@ -604,6 +605,7 @@ _GLOBAL(__fixup_440A_mcheck)
  */
 _GLOBAL(giveup_altivec)
 	blr
+EXPORT_SYMBOL(giveup_altivec)
 
 /*
  * extern void giveup_fpu(struct task_struct *prev)
@@ -613,6 +615,7 @@ _GLOBAL(giveup_altivec)
 #ifndef CONFIG_PPC_FPU
 _GLOBAL(giveup_fpu)
 	blr
+EXPORT_SYMBOL(giveup_fpu)
 #endif
 
 _GLOBAL(set_context)
@@ -628,6 +631,7 @@ _GLOBAL(set_context)
 	mtspr	SPRN_PID,r3
 	isync			/* Force context change */
 	blr
+EXPORT_SYMBOL(set_context)
 
 /*
  * We put a few things here that have to be page-aligned. This stuff
@@ -640,6 +644,7 @@ sdata:
 	.globl	empty_zero_page
 empty_zero_page:
 	.space	4096
+EXPORT_SYMBOL(empty_zero_page)
 
 /*
  * To support >32-bit physical addresses, we use an 8KB pgdir.
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index cc8fb47..d807daa 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -21,6 +21,7 @@
  *  2 of the License, or (at your option) any later version.
  */
 
+#include <linux/module.h>
 #include <linux/threads.h>
 #include <asm/reg.h>
 #include <asm/page.h>
@@ -1653,6 +1654,7 @@ END_FW_FTR_SECTION_IFSET(FW_FEATURE_ISERIES)
 	.globl	empty_zero_page
 empty_zero_page:
 	.space	PAGE_SIZE
+EXPORT_SYMBOL(empty_zero_page)
 
 	.globl	swapper_pg_dir
 swapper_pg_dir:
diff --git a/arch/powerpc/kernel/head_8xx.S b/arch/powerpc/kernel/head_8xx.S
index 3c9452d..c3ef451 100644
--- a/arch/powerpc/kernel/head_8xx.S
+++ b/arch/powerpc/kernel/head_8xx.S
@@ -19,6 +19,7 @@
  *
  */
 
+#include <linux/module.h>
 #include <asm/processor.h>
 #include <asm/page.h>
 #include <asm/mmu.h>
@@ -590,6 +591,7 @@ DataTLBError:
 	.globl	giveup_fpu
 giveup_fpu:
 	blr
+EXPORT_SYMBOL(giveup_fpu)
 
 /*
  * This is where the main kernel code starts.
@@ -831,6 +833,7 @@ _GLOBAL(set_context)
 #endif
 	SYNC
 	blr
+EXPORT_SYMBOL(set_context)
 
 #ifdef CONFIG_8xx_CPU6
 /* It's here because it is unique to the 8xx.
@@ -861,6 +864,7 @@ sdata:
 	.globl	empty_zero_page
 empty_zero_page:
 	.space	4096
+EXPORT_SYMBOL(empty_zero_page)
 
 	.globl	swapper_pg_dir
 swapper_pg_dir:
diff --git a/arch/powerpc/kernel/head_fsl_booke.S b/arch/powerpc/kernel/head_fsl_booke.S
index 3cb52fa..7e579fc 100644
--- a/arch/powerpc/kernel/head_fsl_booke.S
+++ b/arch/powerpc/kernel/head_fsl_booke.S
@@ -30,6 +30,7 @@
  * option) any later version.
  */
 
+#include <linux/module.h>
 #include <linux/threads.h>
 #include <asm/processor.h>
 #include <asm/page.h>
@@ -902,6 +903,7 @@ _GLOBAL(loadcam_entry)
  */
 _GLOBAL(giveup_altivec)
 	blr
+EXPORT_SYMBOL(giveup_altivec)
 
 #ifdef CONFIG_SPE
 /*
@@ -938,6 +940,7 @@ _GLOBAL(giveup_spe)
 #endif /* !CONFIG_SMP */
 	blr
 #endif /* CONFIG_SPE */
+EXPORT_SYMBOL(giveup_spe)
 
 /*
  * extern void giveup_fpu(struct task_struct *prev)
@@ -947,6 +950,7 @@ _GLOBAL(giveup_spe)
 #ifndef CONFIG_PPC_FPU
 _GLOBAL(giveup_fpu)
 	blr
+EXPORT_SYMBOL(giveup_fpu)
 #endif
 
 /*
@@ -980,6 +984,7 @@ _GLOBAL(set_context)
 	mtspr	SPRN_PID,r3
 	isync			/* Force context change */
 	blr
+EXPORT_SYMBOL(set_context)
 
 _GLOBAL(flush_dcache_L1)
 	mfspr	r3,SPRN_L1CFG0
@@ -1038,6 +1043,7 @@ sdata:
 	.globl	empty_zero_page
 empty_zero_page:
 	.space	4096
+EXPORT_SYMBOL(empty_zero_page)
 	.globl	swapper_pg_dir
 swapper_pg_dir:
 	.space	PGD_TABLE_SIZE
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index d972dec..e6a9af6 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -83,9 +83,10 @@ extern int tau_interrupts(int);
 #endif
 #endif /* CONFIG_PPC32 */
 
-#ifdef CONFIG_PPC64
 EXPORT_SYMBOL(irq_desc);
 
+#ifdef CONFIG_PPC64
+
 int distribute_irqs = 1;
 
 static inline notrace unsigned long get_hard_enabled(void)
@@ -334,6 +335,7 @@ void do_IRQ(struct pt_regs *regs)
 	}
 #endif
 }
+EXPORT_SYMBOL(do_IRQ);
 
 void __init init_IRQ(void)
 {
diff --git a/arch/powerpc/kernel/misc_32.S b/arch/powerpc/kernel/misc_32.S
index 6321ae3..d8c8b82 100644
--- a/arch/powerpc/kernel/misc_32.S
+++ b/arch/powerpc/kernel/misc_32.S
@@ -16,6 +16,7 @@
  *
  */
 
+#include <linux/module.h>
 #include <linux/sys.h>
 #include <asm/unistd.h>
 #include <asm/errno.h>
@@ -435,6 +436,7 @@ _GLOBAL(_tlbie)
 #endif /* CONFIG_SMP */
 #endif /* ! CONFIG_40x */
 	blr
+EXPORT_SYMBOL(_tlbie)
 
 /*
  * Flush instruction cache.
@@ -481,6 +483,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_UNIFIED_ID_CACHE)
 #endif /* CONFIG_8xx/4xx */
 	isync
 	blr
+EXPORT_SYMBOL(flush_instruction_cache)
 
 /*
  * Write any modified data cache blocks out to memory
@@ -512,6 +515,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE)
 	sync				/* additional sync needed on g4 */
 	isync
 	blr
+EXPORT_SYMBOL(__flush_icache_range)
 /*
  * Write any modified data cache blocks out to memory.
  * Does not invalidate the corresponding cache lines (especially for
@@ -554,6 +558,7 @@ _GLOBAL(flush_dcache_range)
 	bdnz	1b
 	sync				/* wait for dcbst's to get to ram */
 	blr
+EXPORT_SYMBOL(flush_dcache_range)
 
 /*
  * Like above, but invalidate the D-cache.  This is used by the 8xx
@@ -670,6 +675,7 @@ _GLOBAL(clear_pages)
 	addi	r3,r3,L1_CACHE_BYTES
 	bdnz	1b
 	blr
+EXPORT_SYMBOL(clear_pages)
 
 /*
  * Copy a whole page.  We use the dcbz instruction on the destination
@@ -741,6 +747,7 @@ _GLOBAL(copy_page)
 	li	r11,4
 	b	2b
 #endif	/* CONFIG_8xx */
+EXPORT_SYMBOL(copy_page)
 
 /*
  * void atomic_clear_mask(atomic_t mask, atomic_t *addr)
@@ -787,6 +794,7 @@ _GLOBAL(__ashrdi3)
 	sraw	r3,r3,r5	# MSW = MSW >> count
 	or	r4,r4,r7	# LSW |= t2
 	blr
+EXPORT_SYMBOL(__ashrdi3)
 
 _GLOBAL(__ashldi3)
 	subfic	r6,r5,32
@@ -798,6 +806,7 @@ _GLOBAL(__ashldi3)
 	slw	r4,r4,r5	# LSW = LSW << count
 	or	r3,r3,r7	# MSW |= t2
 	blr
+EXPORT_SYMBOL(__ashldi3)
 
 _GLOBAL(__lshrdi3)
 	subfic	r6,r5,32
@@ -809,6 +818,7 @@ _GLOBAL(__lshrdi3)
 	srw	r3,r3,r5	# MSW = MSW >> count
 	or	r4,r4,r7	# LSW |= t2
 	blr
+EXPORT_SYMBOL(__lshrdi3)
 
 /*
  * 64-bit comparison: __ucmpdi2(u64 a, u64 b)
@@ -824,6 +834,7 @@ _GLOBAL(__ucmpdi2)
 	bltlr
 	li	r3,2
 	blr
+EXPORT_SYMBOL(__ucmpdi2);
 
 _GLOBAL(abs)
 	srawi	r4,r3,31
@@ -861,6 +872,7 @@ _GLOBAL(kernel_thread)
 	lwz	r31,12(r1)
 	addi	r1,r1,16
 	blr
+EXPORT_SYMBOL(kernel_thread)
 
 /*
  * This routine is just here to keep GCC happy - sigh...
diff --git a/arch/powerpc/kernel/misc_64.S b/arch/powerpc/kernel/misc_64.S
index 4dd70cf..b1d05c0 100644
--- a/arch/powerpc/kernel/misc_64.S
+++ b/arch/powerpc/kernel/misc_64.S
@@ -14,6 +14,7 @@
  *
  */
 
+#include <linux/module.h>
 #include <linux/sys.h>
 #include <asm/unistd.h>
 #include <asm/errno.h>
@@ -108,6 +109,7 @@ _KPROBE(__flush_icache_range)
 	isync
 	blr
 	.previous .text
+EXPORT_SYMBOL(__flush_icache_range)
 /*
  * Like above, but only do the D-cache.
  *
@@ -137,6 +139,7 @@ _GLOBAL(flush_dcache_range)
 	bdnz	0b
 	sync
 	blr
+EXPORT_SYMBOL(flush_dcache_range)
 
 /*
  * Like above, but works on non-mapped physical addresses.
@@ -442,6 +445,7 @@ _GLOBAL(kernel_thread)
 	ld	r29,-24(r1)
 	ld	r30,-16(r1)
 	blr
+EXPORT_SYMBOL(kernel_thread)
 
 /*
  * disable_kernel_fp()
@@ -503,6 +507,7 @@ _GLOBAL(giveup_altivec)
 	std	r5,0(r4)
 #endif /* CONFIG_SMP */
 	blr
+EXPORT_SYMBOL(giveup_altivec)
 
 #endif /* CONFIG_ALTIVEC */
 
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 224e9a1..3e7b258 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -23,6 +23,7 @@
 #include <linux/string.h>
 #include <linux/init.h>
 #include <linux/bootmem.h>
+#include <linux/module.h>
 #include <linux/mm.h>
 #include <linux/list.h>
 #include <linux/syscalls.h>
@@ -52,6 +53,7 @@ static int global_phb_number;		/* Global phb counter */
 
 /* ISA Memory physical address */
 resource_size_t isa_mem_base;
+EXPORT_SYMBOL(isa_mem_base);
 
 /* Default PCI flags is 0 */
 unsigned int ppc_pci_flags;
diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c
index 88db4ff..329acae 100644
--- a/arch/powerpc/kernel/pci_32.c
+++ b/arch/powerpc/kernel/pci_32.c
@@ -3,6 +3,7 @@
  */
 
 #include <linux/kernel.h>
+#include <linux/module.h>
 #include <linux/pci.h>
 #include <linux/delay.h>
 #include <linux/string.h>
@@ -33,7 +34,9 @@
 #endif
 
 unsigned long isa_io_base     = 0;
+EXPORT_SYMBOL(isa_io_base);
 unsigned long pci_dram_offset = 0;
+EXPORT_SYMBOL(pci_dram_offset);
 int pcibios_assign_bus_offset = 1;
 
 void pcibios_make_OF_bus_map(void);
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 957bded..c832697 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -167,6 +167,7 @@ void giveup_vsx(struct task_struct *tsk)
 	giveup_altivec(tsk);
 	__giveup_vsx(tsk);
 }
+EXPORT_SYMBOL(giveup_vsx);
 
 void flush_vsx_to_thread(struct task_struct *tsk)
 {
@@ -760,6 +761,7 @@ void start_thread(struct pt_regs *regs, unsigned long start, unsigned long sp)
 	current->thread.used_spe = 0;
 #endif /* CONFIG_SPE */
 }
+EXPORT_SYMBOL(start_thread);
 
 #define PR_FP_ALL_EXCEPT (PR_FP_EXC_DIV | PR_FP_EXC_OVF | PR_FP_EXC_UND \
 		| PR_FP_EXC_RES | PR_FP_EXC_INV)
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index 9cc5a52..174614d 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -91,6 +91,7 @@ struct screen_info screen_info = {
 	.orig_video_isVGA = 1,
 	.orig_video_points = 16
 };
+EXPORT_SYMBOL(screen_info);
 
 #ifdef __DO_IRQ_CANON
 /* XXX should go elsewhere eventually */
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index 066e65c..f871152 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -50,8 +50,13 @@ EXPORT_SYMBOL_GPL(boot_cpuid);
 int boot_cpuid_phys;
 
 unsigned long ISA_DMA_THRESHOLD;
+EXPORT_SYMBOL(ISA_DMA_THRESHOLD);
+
 unsigned int DMA_MODE_READ;
+EXPORT_SYMBOL(DMA_MODE_READ);
+
 unsigned int DMA_MODE_WRITE;
+EXPORT_SYMBOL(DMA_MODE_WRITE);
 
 int have_of = 1;
 
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
index 3e80aa3..ca17314 100644
--- a/arch/powerpc/kernel/signal_32.c
+++ b/arch/powerpc/kernel/signal_32.c
@@ -25,6 +25,7 @@
 #include <linux/errno.h>
 #include <linux/elf.h>
 #include <linux/ptrace.h>
+#include <linux/module.h>
 #ifdef CONFIG_PPC64
 #include <linux/syscalls.h>
 #include <linux/compat.h>
@@ -1288,3 +1289,4 @@ badframe:
 	force_sig(SIGSEGV, current);
 	return 0;
 }
+EXPORT_SYMBOL(sys_sigreturn);
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 5337ca7..65f4c3a 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -58,6 +58,8 @@
 #endif
 
 int smp_hw_index[NR_CPUS];
+EXPORT_SYMBOL(smp_hw_index);
+
 struct thread_info *secondary_ti;
 
 cpumask_t cpu_possible_map = CPU_MASK_NONE;
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index e2ee66b..fc4646d 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -142,6 +142,7 @@ static void __init clocksource_init(void);
 #endif
 
 unsigned long tb_ticks_per_jiffy;
+EXPORT_SYMBOL(tb_ticks_per_jiffy);
 unsigned long tb_ticks_per_usec = 100; /* sane default */
 EXPORT_SYMBOL(tb_ticks_per_usec);
 unsigned long tb_ticks_per_sec;
@@ -612,6 +613,7 @@ void timer_interrupt(struct pt_regs * regs)
 	irq_exit();
 	set_irq_regs(old_regs);
 }
+EXPORT_SYMBOL(timer_interrupt);
 
 void wakeup_decrementer(void)
 {
@@ -1091,6 +1093,7 @@ void to_tm(int tim, struct rtc_time * tm)
 	 */
 	GregorianDay(tm);
 }
+EXPORT_SYMBOL(to_tm);
 
 /* Auxiliary function to compute scaling factors */
 /* Actually the choice of a timebase running at 1/4 the of the bus
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 81ccb8d..8d9c77a 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -533,6 +533,7 @@ void machine_check_exception(struct pt_regs *regs)
 	if (!(regs->msr & MSR_RI))
 		panic("Unrecoverable Machine check");
 }
+EXPORT_SYMBOL(machine_check_exception);
 
 void SMIException(struct pt_regs *regs)
 {
@@ -574,6 +575,7 @@ void __kprobes single_step_exception(struct pt_regs *regs)
 
 	_exception(SIGTRAP, regs, TRAP_TRACE, regs->nip);
 }
+EXPORT_SYMBOL(single_step_exception);
 
 /*
  * After we have successfully emulated an instruction, we have to
@@ -893,6 +895,7 @@ void __kprobes program_check_exception(struct pt_regs *regs)
 	else
 		_exception(SIGILL, regs, ILL_ILLOPC, regs->nip);
 }
+EXPORT_SYMBOL(program_check_exception);
 
 void alignment_exception(struct pt_regs *regs)
 {
@@ -921,6 +924,7 @@ void alignment_exception(struct pt_regs *regs)
 	else
 		bad_page_fault(regs, regs->dar, sig);
 }
+EXPORT_SYMBOL(alignment_exception);
 
 void StackOverflow(struct pt_regs *regs)
 {
diff --git a/arch/powerpc/lib/checksum_32.S b/arch/powerpc/lib/checksum_32.S
index 7874e8a..194d9bb 100644
--- a/arch/powerpc/lib/checksum_32.S
+++ b/arch/powerpc/lib/checksum_32.S
@@ -12,6 +12,7 @@
  * Severely hacked about by Paul Mackerras (paulus@cs.anu.edu.au).
  */
 
+#include <linux/module.h>
 #include <linux/sys.h>
 #include <asm/processor.h>
 #include <asm/errno.h>
@@ -39,6 +40,7 @@ _GLOBAL(ip_fast_csum)
 	not	r3,r3
 	srwi	r3,r3,16
 	blr
+EXPORT_SYMBOL(ip_fast_csum)
 
 /*
  * Compute checksum of TCP or UDP pseudo-header:
@@ -55,6 +57,7 @@ _GLOBAL(csum_tcpudp_magic)
 	not	r3,r3
 	srwi	r3,r3,16
 	blr
+EXPORT_SYMBOL(csum_tcpudp_magic)
 
 /*
  * computes the checksum of a memory block at buff, length len,
@@ -93,6 +96,7 @@ _GLOBAL(csum_partial)
 	adde	r0,r0,r5
 5:	addze	r3,r0		/* add in final carry */
 	blr
+EXPORT_SYMBOL(csum_partial)
 
 /*
  * Computes the checksum of a memory block at src, length len,
@@ -203,6 +207,8 @@ dst_error:
 1:	addze	r3,r0
 	blr
 
+EXPORT_SYMBOL(csum_partial_copy_generic)
+
 .section __ex_table,"a"
 	.long	81b,src_error_1
 	.long	91b,dst_error
diff --git a/arch/powerpc/lib/checksum_64.S b/arch/powerpc/lib/checksum_64.S
index ef96c6c..c6a7b67 100644
--- a/arch/powerpc/lib/checksum_64.S
+++ b/arch/powerpc/lib/checksum_64.S
@@ -12,6 +12,7 @@
  * Severely hacked about by Paul Mackerras (paulus@cs.anu.edu.au).
  */
 
+#include <linux/module.h>
 #include <linux/sys.h>
 #include <asm/processor.h>
 #include <asm/errno.h>
@@ -43,6 +44,7 @@ _GLOBAL(ip_fast_csum)
 	not	r3,r3
 	srwi	r3,r3,16
 	blr
+EXPORT_SYMBOL(ip_fast_csum)
 
 /*
  * Compute checksum of TCP or UDP pseudo-header:
@@ -64,6 +66,7 @@ _GLOBAL(csum_tcpudp_magic)
 	not	r3,r3
 	srwi	r3,r3,16
 	blr
+EXPORT_SYMBOL(csum_tcpudp_magic)
 
 /*
  * Computes the checksum of a memory block at buff, length len,
@@ -114,6 +117,7 @@ _GLOBAL(csum_partial)
         add     r3,r4,r5
         srdi    r3,r3,32
         blr
+EXPORT_SYMBOL(csum_partial)
 
 /*
  * Computes the checksum of a memory block at src, length len,
@@ -169,6 +173,7 @@ _GLOBAL(csum_partial_copy_generic)
         add     r3,r4,r3
         srdi    r3,r3,32
 	blr
+EXPORT_SYMBOL(csum_partial_copy_generic)
 
 /* These shouldn't go in the fixup section, since that would
    cause the ex_table addresses to get out of order. */
diff --git a/arch/powerpc/lib/copy_32.S b/arch/powerpc/lib/copy_32.S
index c657de5..aa3645d 100644
--- a/arch/powerpc/lib/copy_32.S
+++ b/arch/powerpc/lib/copy_32.S
@@ -8,6 +8,7 @@
  * as published by the Free Software Foundation; either version
  * 2 of the License, or (at your option) any later version.
  */
+#include <linux/module.h>
 #include <asm/processor.h>
 #include <asm/cache.h>
 #include <asm/errno.h>
@@ -154,6 +155,7 @@ _GLOBAL(memset)
 8:	stbu	r4,1(r6)
 	bdnz	8b
 	blr
+EXPORT_SYMBOL(memset)
 
 /*
  * This version uses dcbz on the complete cache lines in the
@@ -235,6 +237,7 @@ _GLOBAL(cacheable_memcpy)
 	addi	r6,r6,1
 	bdnz	40b
 65:	blr
+EXPORT_SYMBOL(cacheable_memcpy)
 
 _GLOBAL(memmove)
 	cmplw	0,r3,r4
@@ -281,6 +284,8 @@ _GLOBAL(memcpy)
 	beq	2b
 	mtctr	r7
 	b	1b
+EXPORT_SYMBOL(memmove)
+EXPORT_SYMBOL(memcpy)
 
 _GLOBAL(backwards_memcpy)
 	rlwinm.	r7,r5,32-3,3,31		/* r0 = r5 >> 3 */
@@ -540,3 +545,5 @@ _GLOBAL(__copy_tofrom_user)
 	.long	112b,120b
 	.long	114b,120b
 	.text
+
+EXPORT_SYMBOL(__copy_tofrom_user)
diff --git a/arch/powerpc/lib/copypage_64.S b/arch/powerpc/lib/copypage_64.S
index f9837f4..e81ffa2 100644
--- a/arch/powerpc/lib/copypage_64.S
+++ b/arch/powerpc/lib/copypage_64.S
@@ -6,6 +6,7 @@
  * as published by the Free Software Foundation; either version
  * 2 of the License, or (at your option) any later version.
  */
+#include <linux/module.h>
 #include <asm/processor.h>
 #include <asm/ppc_asm.h>
 
@@ -117,3 +118,5 @@ _GLOBAL(copy_4K_page)
 	ld	r30,-16(1)
 	ld	r31,-8(1)
 	blr
+
+EXPORT_SYMBOL(copy_4K_page)
diff --git a/arch/powerpc/lib/copyuser_64.S b/arch/powerpc/lib/copyuser_64.S
index 25ec537..2342fd6 100644
--- a/arch/powerpc/lib/copyuser_64.S
+++ b/arch/powerpc/lib/copyuser_64.S
@@ -6,6 +6,7 @@
  * as published by the Free Software Foundation; either version
  * 2 of the License, or (at your option) any later version.
  */
+#include <linux/module.h>
 #include <asm/processor.h>
 #include <asm/ppc_asm.h>
 
@@ -572,3 +573,5 @@ _GLOBAL(__copy_tofrom_user)
 	.llong	89b,100b
 	.llong	90b,100b
 	.llong	91b,100b
+
+EXPORT_SYMBOL(__copy_tofrom_user)
diff --git a/arch/powerpc/lib/mem_64.S b/arch/powerpc/lib/mem_64.S
index 11ce045..2a18d58 100644
--- a/arch/powerpc/lib/mem_64.S
+++ b/arch/powerpc/lib/mem_64.S
@@ -8,6 +8,7 @@
  * as published by the Free Software Foundation; either version
  * 2 of the License, or (at your option) any later version.
  */
+#include <linux/module.h>
 #include <asm/processor.h>
 #include <asm/errno.h>
 #include <asm/ppc_asm.h>
@@ -76,11 +77,13 @@ _GLOBAL(memset)
 10:	bflr	31
 	stb	r4,0(r6)
 	blr
+EXPORT_SYMBOL(memset)
 
 _GLOBAL(memmove)
 	cmplw	0,r3,r4
 	bgt	.backwards_memcpy
 	b	.memcpy
+EXPORT_SYMBOL(memmove)
 
 _GLOBAL(backwards_memcpy)
 	rlwinm.	r7,r5,32-3,3,31		/* r0 = r5 >> 3 */
diff --git a/arch/powerpc/lib/memcpy_64.S b/arch/powerpc/lib/memcpy_64.S
index 3f13112..839945b 100644
--- a/arch/powerpc/lib/memcpy_64.S
+++ b/arch/powerpc/lib/memcpy_64.S
@@ -6,6 +6,7 @@
  * as published by the Free Software Foundation; either version
  * 2 of the License, or (at your option) any later version.
  */
+#include <linux/module.h>
 #include <asm/processor.h>
 #include <asm/ppc_asm.h>
 
@@ -171,3 +172,5 @@ _GLOBAL(memcpy)
 	stb	r0,0(r3)
 4:	ld	r3,48(r1)	/* return dest pointer */
 	blr
+
+EXPORT_SYMBOL(memcpy)
diff --git a/arch/powerpc/lib/string.S b/arch/powerpc/lib/string.S
index 64e2e49..929100a 100644
--- a/arch/powerpc/lib/string.S
+++ b/arch/powerpc/lib/string.S
@@ -8,6 +8,7 @@
  * as published by the Free Software Foundation; either version
  * 2 of the License, or (at your option) any later version.
  */
+#include <linux/module.h>
 #include <asm/processor.h>
 #include <asm/errno.h>
 #include <asm/ppc_asm.h>
@@ -24,6 +25,7 @@ _GLOBAL(strcpy)
 	stbu	r0,1(r5)
 	bne	1b
 	blr
+EXPORT_SYMBOL(strcpy)
 
 /* This clears out any unused part of the destination buffer,
    just as the libc version does.  -- paulus */
@@ -44,6 +46,7 @@ _GLOBAL(strncpy)
 2:	stbu	r0,1(r6)	/* clear it out if so */
 	bdnz	2b
 	blr
+EXPORT_SYMBOL(strncpy)
 
 _GLOBAL(strcat)
 	addi	r5,r3,-1
@@ -57,6 +60,7 @@ _GLOBAL(strcat)
 	stbu	r0,1(r5)
 	bne	1b
 	blr
+EXPORT_SYMBOL(strcat)
 
 _GLOBAL(strcmp)
 	addi	r5,r3,-1
@@ -68,6 +72,7 @@ _GLOBAL(strcmp)
 	beqlr	1
 	beq	1b
 	blr
+EXPORT_SYMBOL(strcmp)
 
 _GLOBAL(strncmp)
 	PPC_LCMPI r5,0
@@ -82,6 +87,7 @@ _GLOBAL(strncmp)
 	beqlr	1
 	bdnzt	eq,1b
 	blr
+EXPORT_SYMBOL(strncmp)
 
 _GLOBAL(strlen)
 	addi	r4,r3,-1
@@ -90,6 +96,7 @@ _GLOBAL(strlen)
 	bne	1b
 	subf	r3,r3,r4
 	blr
+EXPORT_SYMBOL(strlen)
 
 _GLOBAL(memcmp)
 	cmpwi	0,r5,0
@@ -104,6 +111,7 @@ _GLOBAL(memcmp)
 	blr
 2:	li	r3,0
 	blr
+EXPORT_SYMBOL(memcmp)
 
 _GLOBAL(memchr)
 	cmpwi	0,r5,0
@@ -116,6 +124,7 @@ _GLOBAL(memchr)
 	beqlr
 2:	li	r3,0
 	blr
+EXPORT_SYMBOL(memchr)
 
 _GLOBAL(__clear_user)
 	addi	r6,r3,-4
@@ -158,6 +167,7 @@ _GLOBAL(__clear_user)
 	PPC_LONG	1b,91b
 	PPC_LONG	8b,92b
 	.text
+EXPORT_SYMBOL(__clear_user)
 
 _GLOBAL(__strncpy_from_user)
 	addi	r6,r3,-1
@@ -179,6 +189,7 @@ _GLOBAL(__strncpy_from_user)
 	.section __ex_table,"a"
 	PPC_LONG	1b,99b
 	.text
+EXPORT_SYMBOL(__strncpy_from_user)
 
 /* r3 = str, r4 = len (> 0), r5 = top (highest addr) */
 _GLOBAL(__strnlen_user)
@@ -203,3 +214,4 @@ _GLOBAL(__strnlen_user)
 
 	.section __ex_table,"a"
 	PPC_LONG	1b,99b
+EXPORT_SYMBOL(__strnlen_user)
diff --git a/arch/powerpc/mm/hash_low_32.S b/arch/powerpc/mm/hash_low_32.S
index b9ba7d9..ac9bef1 100644
--- a/arch/powerpc/mm/hash_low_32.S
+++ b/arch/powerpc/mm/hash_low_32.S
@@ -19,6 +19,7 @@
  *
  */
 
+#include <linux/module.h>
 #include <asm/reg.h>
 #include <asm/page.h>
 #include <asm/pgtable.h>
@@ -33,6 +34,7 @@
 	.globl mmu_hash_lock
 mmu_hash_lock:
 	.space	4
+EXPORT_SYMBOL(mmu_hash_lock); /* For MOL */
 #endif /* CONFIG_SMP */
 
 /*
@@ -609,3 +611,5 @@ _GLOBAL(flush_hash_patch_B)
 	SYNC_601
 	isync
 	blr
+
+EXPORT_SYMBOL(flush_hash_pages); /* For MOL */
diff --git a/arch/powerpc/mm/mmu_context_32.c b/arch/powerpc/mm/mmu_context_32.c
index cc32ba4..b990cc4 100644
--- a/arch/powerpc/mm/mmu_context_32.c
+++ b/arch/powerpc/mm/mmu_context_32.c
@@ -23,12 +23,14 @@
  */
 
 #include <linux/mm.h>
+#include <linux/module.h>
 #include <linux/init.h>
 
 #include <asm/mmu_context.h>
 #include <asm/tlbflush.h>
 
 unsigned long next_mmu_context;
+EXPORT_SYMBOL(next_mmu_context);
 unsigned long context_map[LAST_CONTEXT / BITS_PER_LONG + 1];
 #ifdef FEW_CONTEXTS
 atomic_t nr_free_contexts;
diff --git a/arch/powerpc/mm/tlb_32.c b/arch/powerpc/mm/tlb_32.c
index eb4b512..2523d71 100644
--- a/arch/powerpc/mm/tlb_32.c
+++ b/arch/powerpc/mm/tlb_32.c
@@ -24,6 +24,7 @@
 
 #include <linux/kernel.h>
 #include <linux/mm.h>
+#include <linux/module.h>
 #include <linux/init.h>
 #include <linux/highmem.h>
 #include <linux/pagemap.h>
@@ -136,6 +137,7 @@ void flush_tlb_kernel_range(unsigned long start, unsigned long end)
 	flush_range(&init_mm, start, end);
 	FINISH_FLUSH;
 }
+EXPORT_SYMBOL(flush_tlb_kernel_range);
 
 /*
  * Flush all the (user) entries for the address space described by mm.
@@ -175,6 +177,7 @@ void flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr)
 		flush_hash_pages(mm->context.id, vmaddr, pmd_val(*pmd), 1);
 	FINISH_FLUSH;
 }
+EXPORT_SYMBOL(flush_tlb_page);
 
 /*
  * For each address in the range, find the pte for the address
diff --git a/arch/powerpc/sysdev/dcr-low.S b/arch/powerpc/sysdev/dcr-low.S
index 2078f39..27bc06c 100644
--- a/arch/powerpc/sysdev/dcr-low.S
+++ b/arch/powerpc/sysdev/dcr-low.S
@@ -9,6 +9,7 @@
  * option) any later version.
  */
 
+#include <linux/module.h>
 #include <asm/ppc_asm.h>
 #include <asm/processor.h>
 
@@ -22,9 +23,11 @@
 
 _GLOBAL(__mfdcr)
 	DCR_ACCESS_PROLOG(__mfdcr_table)
+EXPORT_SYMBOL(__mfdcr);
 
 _GLOBAL(__mtdcr)
 	DCR_ACCESS_PROLOG(__mtdcr_table)
+EXPORT_SYMBOL(__mtdcr);
 
 __mfdcr_table:
 	mfdcr  r3,0; blr
iff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c
index cae5248..b915cc4 100644
--- a/drivers/macintosh/adb.c
+++ b/drivers/macintosh/adb.c
@@ -390,6 +390,7 @@ adb_poll(void)
 		return;
 	adb_controller->poll();
 }
+EXPORT_SYMBOL(adb_poll);
 
 static void adb_sync_req_done(struct adb_request *req)
 {
@@ -439,6 +440,7 @@ adb_request(struct adb_request *req, void (*done)(struct adb_request *),
 
 	return rc;
 }
+EXPORT_SYMBOL(adb_request);
 
  /* Ultimately this should return the number of devices with
     the given default id.
@@ -474,6 +476,7 @@ adb_register(int default_id, int handler_id, struct adb_ids *ids,
 	mutex_unlock(&adb_handler_mutex);
 	return ids->nids;
 }
+EXPORT_SYMBOL(adb_register);
 
 int
 adb_unregister(int index)
@@ -495,6 +498,7 @@ adb_unregister(int index)
 	mutex_unlock(&adb_handler_mutex);
 	return ret;
 }
+EXPORT_SYMBOL(adb_unregister);
 
 void
 adb_input(unsigned char *buf, int nb, int autopoll)
@@ -561,6 +565,7 @@ adb_try_handler_change(int address, int new_id)
 	mutex_unlock(&adb_handler_mutex);
 	return ret;
 }
+EXPORT_SYMBOL(adb_try_handler_change);
 
 int
 adb_get_infos(int address, int *original_address, int *handler_id)
diff --git a/drivers/macintosh/via-cuda.c b/drivers/macintosh/via-cuda.c
index 741a93a..91dd6bf 100644
--- a/drivers/macintosh/via-cuda.c
+++ b/drivers/macintosh/via-cuda.c
@@ -10,6 +10,7 @@
  */
 #include <stdarg.h>
 #include <linux/types.h>
+#include <linux/module.h>
 #include <linux/errno.h>
 #include <linux/kernel.h>
 #include <linux/delay.h>
@@ -375,6 +376,7 @@ cuda_request(struct adb_request *req, void (*done)(struct adb_request *),
     req->reply_expected = 1;
     return cuda_write(req);
 }
+EXPORT_SYMBOL(cuda_request);
 
 static int
 cuda_write(struct adb_request *req)
@@ -435,6 +437,7 @@ cuda_poll(void)
     cuda_interrupt(0, NULL);
     enable_irq(cuda_irq);
 }
+EXPORT_SYMBOL(cuda_poll);
 
 static irqreturn_t
 cuda_interrupt(int irq, void *arg)

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [RFC 1/3] add support for exporting symbols from .S files
  2008-08-11 14:06 RFC: killing ksyms.c Arnd Bergmann
  2008-08-11 14:17 ` [RFC 2/3] powerpc: export all symbols from the definition file Arnd Bergmann
@ 2008-08-11 14:18 ` Arnd Bergmann
  2008-08-11 14:56   ` David Woodhouse
                     ` (2 more replies)
  2008-08-11 14:25 ` [RFC 3/3] powerpc: remove ppc_ksyms.c Arnd Bergmann
  2008-08-11 15:03 ` RFC: killing ksyms.c Adrian Bunk
  3 siblings, 3 replies; 13+ messages in thread
From: Arnd Bergmann @ 2008-08-11 14:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-arch, Matthew Wilcox, David Woodhouse, Al Viro,
	Rusty Russell, linuxppc-dev

This makes it possible to export symbols from assembly files, instead
of having to export them through an extra ksyms.c file.

I found this nicer to implement using a gas macro than a cpp macro.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>

--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -1,5 +1,7 @@
 #ifndef _LINUX_MODULE_H
 #define _LINUX_MODULE_H
+
+#ifndef __ASSEMBLY__
 /*
  * Dynamic loading of modules into the kernel.
  *
@@ -605,4 +607,54 @@ static inline void module_remove_modinfo_attrs(struct module *mod)
 
 #define __MODULE_STRING(x) __stringify(x)
 
+#else /* __ASSEMBLY__ */
+#include <asm/types.h>
+
+#ifdef CONFIG_MODULES
+.macro __EXPORT_SYMBOL sym section symtab strtab
+	.section \section,"a",@progbits
+	.type \symtab, @object
+	.ifeq BITS_PER_LONG-32
+	.align 3
+\symtab:
+	.long \sym
+	.long \strtab
+	.else
+	.align 4
+\symtab:
+	.quad \sym
+	.quad \strtab
+	.endif
+	.size \symtab,.-\symtab
+	.previous
+
+	.section __ksymtab_strings,"a",@progbits
+	.type \strtab, @object
+\strtab:
+	.string "\sym"
+	.size \strtab,.-\strtab
+	.previous
+	.endm
+
+#define EXPORT_SYMBOL(sym) \
+	 __EXPORT_SYMBOL sym,__ksymtab,__ksymtab_ ## sym,__kstrtab_ ## sym
+#define EXPORT_SYMBOL_GPL(sym) \
+	 __EXPORT_SYMBOL sym,__ksymtab_gpl,__ksymtab_ ## sym,__kstrtab_ ## sym
+#define EXPORT_SYMBOL_GPL_FUTURE(sym) \
+	 __EXPORT_SYMBOL sym,__ksymtab_gpl_future,__ksymtab_ ## sym,__kstrtab_ ## sym
+#define EXPORT_UNUSED_SYMBOL(sym) \
+	 __EXPORT_SYMBOL sym,__ksymtab_unused,__ksymtab_ ## sym,__kstrtab_ ## sym
+#define EXPORT_UNUSED_SYMBOL_GPL(sym) \
+	 __EXPORT_SYMBOL sym,__ksymtab_unused_gpl,__ksymtab_ ## sym,__kstrtab_ ## sym
+
+#else /* CONFIG_MODULES... */
+#define EXPORT_SYMBOL(sym)
+#define EXPORT_SYMBOL_GPL(sym)
+#define EXPORT_SYMBOL_GPL_FUTURE(sym)
+#define EXPORT_UNUSED_SYMBOL(sym)
+#define EXPORT_UNUSED_SYMBOL_GPL(sym)
+#endif /* !CONFIG_MODULES... */
+
+#endif /* __ASSEMBLY__ */
+
 #endif /* _LINUX_MODULE_H */

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [RFC 3/3] powerpc: remove ppc_ksyms.c
  2008-08-11 14:06 RFC: killing ksyms.c Arnd Bergmann
  2008-08-11 14:17 ` [RFC 2/3] powerpc: export all symbols from the definition file Arnd Bergmann
  2008-08-11 14:18 ` [RFC 1/3] add support for exporting symbols from .S files Arnd Bergmann
@ 2008-08-11 14:25 ` Arnd Bergmann
  2008-08-11 15:03 ` RFC: killing ksyms.c Adrian Bunk
  3 siblings, 0 replies; 13+ messages in thread
From: Arnd Bergmann @ 2008-08-11 14:25 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-arch, Matthew Wilcox, David Woodhouse, Al Viro,
	Rusty Russell, linuxppc-dev

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---

 arch/powerpc/kernel/Makefile    |    1 -
 arch/powerpc/kernel/ppc_ksyms.c |  193 ---------------------------------------
 2 files changed, 0 insertions(+), 194 deletions(-)

diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index 64f5948..a0cd670 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -74,7 +74,6 @@ obj-$(CONFIG_PPC32)		+= entry_32.o setup_32.o
 obj-$(CONFIG_PPC64)		+= dma_64.o iommu.o
 obj-$(CONFIG_KGDB)		+= kgdb.o
 obj-$(CONFIG_PPC_MULTIPLATFORM)	+= prom_init.o
-obj-$(CONFIG_MODULES)		+= ppc_ksyms.o
 obj-$(CONFIG_BOOTX_TEXT)	+= btext.o
 obj-$(CONFIG_SMP)		+= smp.o
 obj-$(CONFIG_KPROBES)		+= kprobes.o
diff --git a/arch/powerpc/kernel/ppc_ksyms.c b/arch/powerpc/kernel/ppc_ksyms.c
index e1ea4fe..e69de29 100644
--- a/arch/powerpc/kernel/ppc_ksyms.c
+++ b/arch/powerpc/kernel/ppc_ksyms.c
@@ -1,193 +0,0 @@
-#include <linux/module.h>
-#include <linux/threads.h>
-#include <linux/smp.h>
-#include <linux/sched.h>
-#include <linux/elfcore.h>
-#include <linux/string.h>
-#include <linux/interrupt.h>
-#include <linux/screen_info.h>
-#include <linux/vt_kern.h>
-#include <linux/nvram.h>
-#include <linux/irq.h>
-#include <linux/pci.h>
-#include <linux/delay.h>
-#include <linux/bitops.h>
-
-#include <asm/page.h>
-#include <asm/processor.h>
-#include <asm/cacheflush.h>
-#include <asm/uaccess.h>
-#include <asm/io.h>
-#include <asm/atomic.h>
-#include <asm/checksum.h>
-#include <asm/pgtable.h>
-#include <asm/tlbflush.h>
-#include <linux/adb.h>
-#include <linux/cuda.h>
-#include <linux/pmu.h>
-#include <asm/prom.h>
-#include <asm/system.h>
-#include <asm/pci-bridge.h>
-#include <asm/irq.h>
-#include <asm/pmac_feature.h>
-#include <asm/dma.h>
-#include <asm/machdep.h>
-#include <asm/hw_irq.h>
-#include <asm/nvram.h>
-#include <asm/mmu_context.h>
-#include <asm/backlight.h>
-#include <asm/time.h>
-#include <asm/cputable.h>
-#include <asm/btext.h>
-#include <asm/div64.h>
-#include <asm/signal.h>
-#include <asm/dcr.h>
-#include <asm/ftrace.h>
-
-#ifdef CONFIG_PPC32
-extern void transfer_to_handler(void);
-extern void do_IRQ(struct pt_regs *regs);
-extern void machine_check_exception(struct pt_regs *regs);
-extern void alignment_exception(struct pt_regs *regs);
-extern void program_check_exception(struct pt_regs *regs);
-extern void single_step_exception(struct pt_regs *regs);
-extern int sys_sigreturn(struct pt_regs *regs);
-
-EXPORT_SYMBOL(clear_pages);
-EXPORT_SYMBOL(copy_page);
-EXPORT_SYMBOL(ISA_DMA_THRESHOLD);
-EXPORT_SYMBOL(DMA_MODE_READ);
-EXPORT_SYMBOL(DMA_MODE_WRITE);
-
-EXPORT_SYMBOL(transfer_to_handler);
-EXPORT_SYMBOL(do_IRQ);
-EXPORT_SYMBOL(machine_check_exception);
-EXPORT_SYMBOL(alignment_exception);
-EXPORT_SYMBOL(program_check_exception);
-EXPORT_SYMBOL(single_step_exception);
-EXPORT_SYMBOL(sys_sigreturn);
-#endif
-
-#ifdef CONFIG_FTRACE
-EXPORT_SYMBOL(_mcount);
-#endif
-
-EXPORT_SYMBOL(strcpy);
-EXPORT_SYMBOL(strncpy);
-EXPORT_SYMBOL(strcat);
-EXPORT_SYMBOL(strlen);
-EXPORT_SYMBOL(strcmp);
-EXPORT_SYMBOL(strncmp);
-
-EXPORT_SYMBOL(csum_partial);
-EXPORT_SYMBOL(csum_partial_copy_generic);
-EXPORT_SYMBOL(ip_fast_csum);
-EXPORT_SYMBOL(csum_tcpudp_magic);
-
-EXPORT_SYMBOL(__copy_tofrom_user);
-EXPORT_SYMBOL(__clear_user);
-EXPORT_SYMBOL(__strncpy_from_user);
-EXPORT_SYMBOL(__strnlen_user);
-#ifdef CONFIG_PPC64
-EXPORT_SYMBOL(copy_4K_page);
-#endif
-
-#if defined(CONFIG_PCI) && defined(CONFIG_PPC32)
-EXPORT_SYMBOL(isa_io_base);
-EXPORT_SYMBOL(isa_mem_base);
-EXPORT_SYMBOL(pci_dram_offset);
-EXPORT_SYMBOL(pci_alloc_consistent);
-EXPORT_SYMBOL(pci_free_consistent);
-#endif /* CONFIG_PCI */
-
-EXPORT_SYMBOL(start_thread);
-EXPORT_SYMBOL(kernel_thread);
-
-EXPORT_SYMBOL(giveup_fpu);
-#ifdef CONFIG_ALTIVEC
-EXPORT_SYMBOL(giveup_altivec);
-#endif /* CONFIG_ALTIVEC */
-#ifdef CONFIG_VSX
-EXPORT_SYMBOL(giveup_vsx);
-#endif /* CONFIG_VSX */
-#ifdef CONFIG_SPE
-EXPORT_SYMBOL(giveup_spe);
-#endif /* CONFIG_SPE */
-
-#ifndef CONFIG_PPC64
-EXPORT_SYMBOL(flush_instruction_cache);
-EXPORT_SYMBOL(flush_tlb_kernel_range);
-EXPORT_SYMBOL(flush_tlb_page);
-EXPORT_SYMBOL(_tlbie);
-#endif
-EXPORT_SYMBOL(__flush_icache_range);
-EXPORT_SYMBOL(flush_dcache_range);
-
-#ifdef CONFIG_SMP
-#ifdef CONFIG_PPC32
-EXPORT_SYMBOL(smp_hw_index);
-#endif
-#endif
-
-#ifdef CONFIG_ADB
-EXPORT_SYMBOL(adb_request);
-EXPORT_SYMBOL(adb_register);
-EXPORT_SYMBOL(adb_unregister);
-EXPORT_SYMBOL(adb_poll);
-EXPORT_SYMBOL(adb_try_handler_change);
-#endif /* CONFIG_ADB */
-#ifdef CONFIG_ADB_CUDA
-EXPORT_SYMBOL(cuda_request);
-EXPORT_SYMBOL(cuda_poll);
-#endif /* CONFIG_ADB_CUDA */
-EXPORT_SYMBOL(to_tm);
-
-#ifdef CONFIG_PPC32
-long long __ashrdi3(long long, int);
-long long __ashldi3(long long, int);
-long long __lshrdi3(long long, int);
-EXPORT_SYMBOL(__ashrdi3);
-EXPORT_SYMBOL(__ashldi3);
-EXPORT_SYMBOL(__lshrdi3);
-int __ucmpdi2(unsigned long long, unsigned long long);
-EXPORT_SYMBOL(__ucmpdi2);
-#endif
-
-EXPORT_SYMBOL(memcpy);
-EXPORT_SYMBOL(memset);
-EXPORT_SYMBOL(memmove);
-EXPORT_SYMBOL(memcmp);
-EXPORT_SYMBOL(memchr);
-
-#if defined(CONFIG_FB_VGA16_MODULE)
-EXPORT_SYMBOL(screen_info);
-#endif
-
-#ifdef CONFIG_PPC32
-EXPORT_SYMBOL(timer_interrupt);
-EXPORT_SYMBOL(irq_desc);
-EXPORT_SYMBOL(tb_ticks_per_jiffy);
-EXPORT_SYMBOL(cacheable_memcpy);
-#endif
-
-#ifdef CONFIG_PPC32
-EXPORT_SYMBOL(next_mmu_context);
-EXPORT_SYMBOL(set_context);
-#endif
-
-#ifdef CONFIG_PPC_STD_MMU_32
-extern long mol_trampoline;
-EXPORT_SYMBOL(mol_trampoline); /* For MOL */
-EXPORT_SYMBOL(flush_hash_pages); /* For MOL */
-#ifdef CONFIG_SMP
-extern int mmu_hash_lock;
-EXPORT_SYMBOL(mmu_hash_lock); /* For MOL */
-#endif /* CONFIG_SMP */
-extern long *intercept_table;
-EXPORT_SYMBOL(intercept_table);
-#endif /* CONFIG_PPC_STD_MMU_32 */
-#ifdef CONFIG_PPC_DCR_NATIVE
-EXPORT_SYMBOL(__mtdcr);
-EXPORT_SYMBOL(__mfdcr);
-#endif
-EXPORT_SYMBOL(empty_zero_page);

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [RFC 2/3] powerpc: export all symbols from the definition file
  2008-08-11 14:17 ` [RFC 2/3] powerpc: export all symbols from the definition file Arnd Bergmann
@ 2008-08-11 14:53   ` Geert Uytterhoeven
  2008-08-11 15:27     ` Arnd Bergmann
  0 siblings, 1 reply; 13+ messages in thread
From: Geert Uytterhoeven @ 2008-08-11 14:53 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-kernel, linux-arch, Matthew Wilcox, Rusty Russell,
	linuxppc-dev, Al Viro, David Woodhouse

[-- Attachment #1: Type: TEXT/PLAIN, Size: 737 bytes --]

On Mon, 11 Aug 2008, Arnd Bergmann wrote:
> It's now possible to export symbols from .S files, so move all

Nice!

> exports out of the ppc_ksyms.c file to the definition of the
> symbols.

>  drivers/macintosh/adb.c              |    5 +++++
>  drivers/macintosh/via-cuda.c         |    3 +++

I think these 2 belong to patch 3?

With kind regards,

Geert Uytterhoeven
Software Architect

Sony Techsoft Centre Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium

Phone:    +32 (0)2 700 8453
Fax:      +32 (0)2 700 8622
E-mail:   Geert.Uytterhoeven@sonycom.com
Internet: http://www.sony-europe.com/

A division of Sony Europe (Belgium) N.V.
VAT BE 0413.825.160 · RPR Brussels
Fortis 293-0376800-10 GEBA-BE-BB

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC 1/3] add support for exporting symbols from .S files
  2008-08-11 14:18 ` [RFC 1/3] add support for exporting symbols from .S files Arnd Bergmann
@ 2008-08-11 14:56   ` David Woodhouse
  2008-08-11 14:56     ` David Woodhouse
  2008-08-12  2:03   ` Rusty Russell
  2008-08-12  6:43   ` Stephen Rothwell
  2 siblings, 1 reply; 13+ messages in thread
From: David Woodhouse @ 2008-08-11 14:56 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-kernel, linux-arch, Matthew Wilcox, Al Viro, Rusty Russell,
	linuxppc-dev

On Mon, 2008-08-11 at 16:18 +0200, Arnd Bergmann wrote:
> This makes it possible to export symbols from assembly files, instead
> of having to export them through an extra ksyms.c file.
> 
> I found this nicer to implement using a gas macro than a cpp macro.

Yeah, gas macros can be much nicer. This looks good to me; I don't see
and reason why it can't be used across all architectures, off-hand.

-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse@intel.com                              Intel Corporation

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC 1/3] add support for exporting symbols from .S files
  2008-08-11 14:56   ` David Woodhouse
@ 2008-08-11 14:56     ` David Woodhouse
  0 siblings, 0 replies; 13+ messages in thread
From: David Woodhouse @ 2008-08-11 14:56 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-kernel, linux-arch, Matthew Wilcox, Al Viro, Rusty Russell,
	linuxppc-dev

On Mon, 2008-08-11 at 16:18 +0200, Arnd Bergmann wrote:
> This makes it possible to export symbols from assembly files, instead
> of having to export them through an extra ksyms.c file.
> 
> I found this nicer to implement using a gas macro than a cpp macro.

Yeah, gas macros can be much nicer. This looks good to me; I don't see
and reason why it can't be used across all architectures, off-hand.

-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse@intel.com                              Intel Corporation




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: RFC: killing ksyms.c
  2008-08-11 14:06 RFC: killing ksyms.c Arnd Bergmann
                   ` (2 preceding siblings ...)
  2008-08-11 14:25 ` [RFC 3/3] powerpc: remove ppc_ksyms.c Arnd Bergmann
@ 2008-08-11 15:03 ` Adrian Bunk
  3 siblings, 0 replies; 13+ messages in thread
From: Adrian Bunk @ 2008-08-11 15:03 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-kernel, linux-arch, Matthew Wilcox, David Woodhouse,
	Al Viro, Rusty Russell

On Mon, Aug 11, 2008 at 04:06:43PM +0200, Arnd Bergmann wrote:
> I saw this conversation on IRC when I came back to my screen, and
> managed to dig out an older patch of mine:
> 
> [19:03:13] <willy> at some point we really need to forbid that
> [19:03:28] <willy> bit hard at this point with things like memcpy()
> [19:04:36] <willy> could do it with a script of some kind and
>            either a whitelist of filenames (arch/*/kernel/ksyms.c
>            can export anything) or of functions (anywhere can
>            EXPORT_SYMBOL(memcpy)).
> [Sun Aug 10 2008] [19:07:35] <viro> I suspect that we really want
>            to teach *.S how to do exports
> [Sun Aug 10 2008] [19:07:58] <viro> and kill ksyms.c
> [Sun Aug 10 2008] [19:12:47] <dwmw2_gone> if we do the -fwhole-program
>            --combine thing we'll make it hard anyway
> 
> I compile-tested this on powerpc, 32 and 64 bit, and it should be usable as
> an example for other architectures.
> The idea is to provide an EXPORT_SYMBOL macro for assembly that
> behaves in the same way as the C version, and then export every
> symbol from the file that defines it.
>...

On some architectures the kernel is linked with libgcc and symbols from 
libgcc are EXPORT_SYMBOL'ed.

> 	Arnd <><

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC 2/3] powerpc: export all symbols from the definition file
  2008-08-11 14:53   ` Geert Uytterhoeven
@ 2008-08-11 15:27     ` Arnd Bergmann
  0 siblings, 0 replies; 13+ messages in thread
From: Arnd Bergmann @ 2008-08-11 15:27 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: Geert Uytterhoeven, linux-arch, Matthew Wilcox, Rusty Russell,
	linux-kernel, Al Viro, David Woodhouse

On Monday 11 August 2008, Geert Uytterhoeven wrote:
> >  drivers/macintosh/adb.c              |    5 +++++
> >  drivers/macintosh/via-cuda.c         |    3 +++
> 
> I think these 2 belong to patch 3?

I tried to come up with other ways of splitting up the patch,
but since these come from ppc_ksyms, it makes sense to keep
them with the rest.

Maybe I could split the exports for C functions from those
in assember files that depend on patch 1.

	Arnd <><

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC 1/3] add support for exporting symbols from .S files
  2008-08-11 14:18 ` [RFC 1/3] add support for exporting symbols from .S files Arnd Bergmann
  2008-08-11 14:56   ` David Woodhouse
@ 2008-08-12  2:03   ` Rusty Russell
  2008-08-12  2:03     ` Rusty Russell
  2008-08-12  6:43   ` Stephen Rothwell
  2 siblings, 1 reply; 13+ messages in thread
From: Rusty Russell @ 2008-08-12  2:03 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-kernel, linux-arch, Matthew Wilcox, David Woodhouse,
	Al Viro, linuxppc-dev

On Tuesday 12 August 2008 00:18:07 Arnd Bergmann wrote:
> This makes it possible to export symbols from assembly files, instead
> of having to export them through an extra ksyms.c file.
>
> I found this nicer to implement using a gas macro than a cpp macro.
...
> +	.ifeq BITS_PER_LONG-32
> +	.align 3
> +\symtab:
> +	.long \sym
> +	.long \strtab
> +	.else
> +	.align 4

Good work!   Hmm, you can .balign BITS_PER_LONG/8 outside the ifeq.  
Unfortunately .long doesn't do the Right Thing on 64 bit, so getting rid of 
the if is harder.

Acked-by: Rusty Russell <rusty@rustcorp.com.au>

Cheers,
Rusty.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC 1/3] add support for exporting symbols from .S files
  2008-08-12  2:03   ` Rusty Russell
@ 2008-08-12  2:03     ` Rusty Russell
  0 siblings, 0 replies; 13+ messages in thread
From: Rusty Russell @ 2008-08-12  2:03 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-kernel, linux-arch, Matthew Wilcox, David Woodhouse,
	Al Viro, linuxppc-dev

On Tuesday 12 August 2008 00:18:07 Arnd Bergmann wrote:
> This makes it possible to export symbols from assembly files, instead
> of having to export them through an extra ksyms.c file.
>
> I found this nicer to implement using a gas macro than a cpp macro.
...
> +	.ifeq BITS_PER_LONG-32
> +	.align 3
> +\symtab:
> +	.long \sym
> +	.long \strtab
> +	.else
> +	.align 4

Good work!   Hmm, you can .balign BITS_PER_LONG/8 outside the ifeq.  
Unfortunately .long doesn't do the Right Thing on 64 bit, so getting rid of 
the if is harder.

Acked-by: Rusty Russell <rusty@rustcorp.com.au>

Cheers,
Rusty.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC 1/3] add support for exporting symbols from .S files
  2008-08-11 14:18 ` [RFC 1/3] add support for exporting symbols from .S files Arnd Bergmann
  2008-08-11 14:56   ` David Woodhouse
  2008-08-12  2:03   ` Rusty Russell
@ 2008-08-12  6:43   ` Stephen Rothwell
  2008-08-12 13:58     ` Arnd Bergmann
  2 siblings, 1 reply; 13+ messages in thread
From: Stephen Rothwell @ 2008-08-12  6:43 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-kernel, linux-arch, Matthew Wilcox, David Woodhouse,
	Al Viro, Rusty Russell, linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 626 bytes --]

Hi Arnd,

On Mon, 11 Aug 2008 16:18:07 +0200 Arnd Bergmann <arnd@arndb.de> wrote:
>
> +#ifdef CONFIG_MODULES
> +.macro __EXPORT_SYMBOL sym section symtab strtab
> +	.section \section,"a",@progbits
> +	.type \symtab, @object
> +	.ifeq BITS_PER_LONG-32
> +	.align 3
> +\symtab:
> +	.long \sym
> +	.long \strtab
> +	.else
> +	.align 4

This won't be portable across architectures as .align is sometimes in
bytes and sometimes a power of two.  You can use .balign or .p2align
portably on gas, though. 

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC 1/3] add support for exporting symbols from .S files
  2008-08-12  6:43   ` Stephen Rothwell
@ 2008-08-12 13:58     ` Arnd Bergmann
  0 siblings, 0 replies; 13+ messages in thread
From: Arnd Bergmann @ 2008-08-12 13:58 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: linux-kernel, linux-arch, Matthew Wilcox, David Woodhouse,
	Al Viro, Rusty Russell, linuxppc-dev

This makes it possible to export symbols from assembly files, instead
of having to export them through an extra ksyms.c file.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>

---

On Tuesday 12 August 2008, Stephen Rothwell wrote:
> This won't be portable across architectures as .align is sometimes in
> bytes and sometimes a power of two.  You can use .balign or .p2align
> portably on gas, though.

Ok, this version uses the .balign as suggested by rusty, and also
fixes building with modversions turned on, which did not work in the
first version.

	Arnd <><

--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -1,5 +1,7 @@
 #ifndef _LINUX_MODULE_H
 #define _LINUX_MODULE_H
+
+#ifndef __ASSEMBLY__
 /*
  * Dynamic loading of modules into the kernel.
  *
@@ -605,4 +607,72 @@ static inline void module_remove_modinfo_attrs(struct module *mod)
 
 #define __MODULE_STRING(x) __stringify(x)
 
+#else /* __ASSEMBLY__ */
+#include <asm/types.h>
+
+#ifdef CONFIG_MODULES
+.macro __EXPORT_SYMBOL sym section symtab strtab crctab crc
+	.section \section, "a", @progbits
+	.type \symtab, @object
+	.balign BITS_PER_LONG/8
+\symtab:
+	.ifeq BITS_PER_LONG - 32
+	.long \sym
+	.long \strtab
+	.else
+	.quad \sym
+	.quad \strtab
+	.endif
+	.size \symtab, . - \symtab
+	.previous
+
+	.section __ksymtab_strings, "a", @progbits
+	.type \strtab, @object
+\strtab:
+	.string "\sym"
+	.size \strtab, . - \strtab
+	.previous
+
+#ifdef CONFIG_MODVERSIONS
+	/*
+	 * Modversions doesn't work with assembly files,
+	 * so insert a dummy CRC.
+	 */
+	.section __kcrctab, "a", @progbits
+	.balign 4
+	.type \crctab, @object
+\crctab:
+	.long \crc
+	.size \crctab, . - \crctab
+	.set \crc, 0
+	.previous
+#endif
+	.endm
+
+#define EXPORT_SYMBOL(sym) \
+	 __EXPORT_SYMBOL sym, __ksymtab, __ksymtab_ ## sym, \
+		__kstrtab_ ## sym, __kcrctab_ ## sym, __crc_ ## sym
+#define EXPORT_SYMBOL_GPL(sym) \
+	 __EXPORT_SYMBOL sym, __ksymtab_gpl, __ksymtab_ ## sym, \
+		__kstrtab_ ## sym, __kcrctab_ ## sym, __crc_ ## sym
+#define EXPORT_SYMBOL_GPL_FUTURE(sym) \
+	 __EXPORT_SYMBOL sym, __ksymtab_gpl_future, __ksymtab_ ## sym, \
+		__kstrtab_ ## sym, __kcrctab_ ## sym, __crc_ ## sym
+#define EXPORT_UNUSED_SYMBOL(sym) \
+	 __EXPORT_SYMBOL sym, __ksymtab_unused, __ksymtab_ ## sym, \
+		__kstrtab_ ## sym, __kcrctab_ ## sym, __crc_ ## sym
+#define EXPORT_UNUSED_SYMBOL_GPL(sym) \
+	 __EXPORT_SYMBOL sym, __ksymtab_unused_gpl, __ksymtab_ ## sym, \
+		__kstrtab_ ## sym, __kcrctab_ ## sym, __crc_ ## sym
+
+#else /* CONFIG_MODULES... */
+#define EXPORT_SYMBOL(sym)
+#define EXPORT_SYMBOL_GPL(sym)
+#define EXPORT_SYMBOL_GPL_FUTURE(sym)
+#define EXPORT_UNUSED_SYMBOL(sym)
+#define EXPORT_UNUSED_SYMBOL_GPL(sym)
+#endif /* !CONFIG_MODULES... */
+
+#endif /* __ASSEMBLY__ */
+
 #endif /* _LINUX_MODULE_H */

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2008-08-12 14:00 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-11 14:06 RFC: killing ksyms.c Arnd Bergmann
2008-08-11 14:17 ` [RFC 2/3] powerpc: export all symbols from the definition file Arnd Bergmann
2008-08-11 14:53   ` Geert Uytterhoeven
2008-08-11 15:27     ` Arnd Bergmann
2008-08-11 14:18 ` [RFC 1/3] add support for exporting symbols from .S files Arnd Bergmann
2008-08-11 14:56   ` David Woodhouse
2008-08-11 14:56     ` David Woodhouse
2008-08-12  2:03   ` Rusty Russell
2008-08-12  2:03     ` Rusty Russell
2008-08-12  6:43   ` Stephen Rothwell
2008-08-12 13:58     ` Arnd Bergmann
2008-08-11 14:25 ` [RFC 3/3] powerpc: remove ppc_ksyms.c Arnd Bergmann
2008-08-11 15:03 ` RFC: killing ksyms.c Adrian Bunk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).