[OpenBIOS] [PATCH] ppc: Create function descriptors for global functions on ppc64

Andreas Färber andreas.faerber at web.de
Sun Nov 28 01:58:55 CET 2010


This should also fix linker errors observed by Blue.

Cc: Blue Swirl <blauwirbel at gmail.com>
Cc: Alexander Graf <agraf at suse.de>
Signed-off-by: Andreas Färber <andreas.faerber at web.de>
---
 arch/ppc/qemu/start.S      |    7 +++----
 include/arch/ppc/asmdefs.h |   18 ++++++++++++++++++
 2 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/arch/ppc/qemu/start.S b/arch/ppc/qemu/start.S
index 4b6df3f..76ef6d6 100644
--- a/arch/ppc/qemu/start.S
+++ b/arch/ppc/qemu/start.S
@@ -285,8 +285,7 @@ call_isi_exception:
 exception_return:
 	EXCEPTION_EPILOGUE
 
-	.globl	__divide_error
-__divide_error:
+GLOBL(__divide_error):
 trap_error:
 	mflr	r3
 	b	BRANCH_LABEL(unexpected_excep)
@@ -473,7 +472,7 @@ saved_stack:
 	.long	0
         .previous
 	/* void call_elf( arg1, arg2, entry ) */
-GLOBL(call_elf):
+_GLOBAL(call_elf):
 	mflr	r0
 	stwu	r1,-16(r1)
 	stw	r0,20(r1)
@@ -633,7 +632,7 @@ GLOBL(of_rtas_end):
 #define LG_CACHE_LINE_SIZE      5
 
 /* flush_icache_range( unsigned long start, unsigned long stop) */
-GLOBL(flush_icache_range):
+_GLOBAL(flush_icache_range):
         li      r5,CACHE_LINE_SIZE-1
         andc    r3,r3,r5
         subf    r4,r3,r4
diff --git a/include/arch/ppc/asmdefs.h b/include/arch/ppc/asmdefs.h
index 9c85ea5..05a89b2 100644
--- a/include/arch/ppc/asmdefs.h
+++ b/include/arch/ppc/asmdefs.h
@@ -118,6 +118,24 @@
 #define EXTERN( name )		_##name
 #endif
 
+#if defined(__powerpc64__) && !defined(__darwin__)
+#define _GLOBAL(name) \
+        .align 2 ; \
+        .section ".opd", "aw" ; \
+        .globl name ; \
+        .globl .##name ; \
+    name: \
+        .quad .##name ; \
+        .quad .TOC. at tocbase ; \
+        .quad 0 ; \
+        .previous ; \
+        .type .##name, @function ; \
+    .##name
+#else
+#define _GLOBAL(name) \
+    GLOBL(name)
+#endif
+
 #define	BIT(n)		(1<<(31-(n)))
 
 #endif   /* _H_ASMDEFS */
-- 
1.7.3




More information about the OpenBIOS mailing list