From 331b43717229eaad2a95bf420f5100079bd53683 Mon Sep 17 00:00:00 2001 From: Ryan Flux Date: Tue, 4 Oct 2011 10:50:49 +1000 Subject: microblaze mmu/elf/shared lib support microblaze can either be with mmu or without If with, use elf rather than flat, and support shared libs Signed-off-by: Ryan Flux Signed-off-by: Steve Bennett Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/microblaze/bits/uClibc_page.h | 2 ++ libc/sysdeps/linux/microblaze/setjmp.S | 32 +++++++++++++++++++++++- libc/sysdeps/linux/microblaze/vfork.S | 7 ++++++ 3 files changed, 40 insertions(+), 1 deletion(-) (limited to 'libc/sysdeps/linux/microblaze') diff --git a/libc/sysdeps/linux/microblaze/bits/uClibc_page.h b/libc/sysdeps/linux/microblaze/bits/uClibc_page.h index 8fc81ae32..41b042262 100644 --- a/libc/sysdeps/linux/microblaze/bits/uClibc_page.h +++ b/libc/sysdeps/linux/microblaze/bits/uClibc_page.h @@ -31,7 +31,9 @@ #elif defined(CONFIG_MICROBLAZE_4K_PAGES) #define PAGE_SHIFT 12 #else +#if !defined(CONFIG_MMU) #warning Missing CONFIG_MICROBLAZE_nnK_PAGES, assuming 4K +#endif #define PAGE_SHIFT 12 #endif diff --git a/libc/sysdeps/linux/microblaze/setjmp.S b/libc/sysdeps/linux/microblaze/setjmp.S index 7acb9ea5d..d01c74555 100644 --- a/libc/sysdeps/linux/microblaze/setjmp.S +++ b/libc/sysdeps/linux/microblaze/setjmp.S @@ -10,7 +10,24 @@ * directory of this archive for more details. * * Written by Miles Bader - */ + * + * PIC code based on glibc 2.3.6 */ + +/* + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ #define _SETJMP_H #define _ASM @@ -22,7 +39,11 @@ .globl C_SYMBOL_NAME(setjmp) .align 4 C_SYMBOL_NAME(setjmp): +#ifdef __PIC__ + brid 1f +#else braid C_SYMBOL_NAME(__sigsetjmp) +#endif addi r6, r0, 1 /* Save the signal mask. */ .globl C_SYMBOL_NAME(_setjmp) @@ -31,6 +52,7 @@ C_SYMBOL_NAME(_setjmp): .globl C_SYMBOL_NAME(__sigsetjmp) C_SYMBOL_NAME(__sigsetjmp): +1: /* Save registers relative to r5 (arg0)*/ swi r1, r5, 0 /* stack pointer */ swi r15, r5, 4 /* link register */ @@ -52,5 +74,13 @@ C_SYMBOL_NAME(__sigsetjmp): swi r31, r5, 68 /* Make a tail call to __sigjmp_save; it takes the same args. */ +#ifdef __PIC__ + mfs r12,rpc + addik r12,r12,_GLOBAL_OFFSET_TABLE_+8 + lwi r12,r12,__sigjmp_save@GOT + brad r12 + nop +#else braid C_SYMBOL_NAME(__sigjmp_save) nop +#endif diff --git a/libc/sysdeps/linux/microblaze/vfork.S b/libc/sysdeps/linux/microblaze/vfork.S index c4b4dbf2f..57db5e543 100644 --- a/libc/sysdeps/linux/microblaze/vfork.S +++ b/libc/sysdeps/linux/microblaze/vfork.S @@ -36,7 +36,14 @@ __vfork: blti r4, 1f /* is r3 < -125? */ bri 2f /* normal return */ 1: sub r3, r3, r0 /* r3 = -r3 */ +#ifdef __PIC__ + mfs r3,rpc + addik r3,r3,_GLOBAL_OFFSET_TABLE_+8 + lwi r3,r3,C_SYMBOL_NAME(errno)@GOT + sw r3, r0, r3 +#else swi r3, r0, C_SYMBOL_NAME(errno); +#endif /* state restore etc */ 2: rtsd r15, 8 /* error return */ nop -- cgit v1.2.3