Browse Source

Small fixups for powerpc

David Schleef 23 years ago
parent
commit
6e0b24b426
8 changed files with 28 additions and 4 deletions
  1. 2 0
      ldso/ldso/boot1.c
  2. 2 2
      ldso/ldso/hash.h
  3. 2 0
      ldso/ldso/ld-uClibc.c
  4. 2 2
      ldso/ldso/ld_hash.h
  5. 8 0
      ldso/ldso/ld_syscall.h
  6. 2 0
      ldso/ldso/ldso.c
  7. 8 0
      ldso/ldso/syscall.h
  8. 2 0
      ldso/ldso/vsprintf.c

+ 2 - 0
ldso/ldso/boot1.c

@@ -244,6 +244,8 @@ DL_BOOT(unsigned long args)
 	__asm__("\tmov %%l7,%0\n\t" : "=r" (got))
 #elif defined(__arm__)
 	__asm__("\tmov %0, r10\n\t" : "=r"(got));
+#elif defined(__powerpc__)
+	__asm__("\tbl _GLOBAL_OFFSET_TABLE_-4@local\n\t" : "=l"(got));
 #else
 	/* Do things the slow way in C */
 	{

+ 2 - 2
ldso/ldso/hash.h

@@ -86,7 +86,7 @@ extern int _dl_linux_dynamic_link(void);
 #define SEND_ADDRESS_STDERR(X, add_a_newline) { \
     char tmp[13], *tmp1; \
     _dl_memset_inline(tmp, 0, sizeof(tmp)); \
-    tmp1=_dl_simple_ltoahex( tmp, (unsigned long)(X)); \
+    tmp1=_dl_simple_ltoahex_inline( tmp, (unsigned long)(X)); \
     _dl_write(2, tmp1, _dl_strlen_inline(tmp1)); \
     if (add_a_newline) { \
 	tmp[0]='\n'; \
@@ -97,7 +97,7 @@ extern int _dl_linux_dynamic_link(void);
 #define SEND_NUMBER_STDERR(X, add_a_newline) { \
     char tmp[13], *tmp1; \
     _dl_memset_inline(tmp, 0, sizeof(tmp)); \
-    tmp1=_dl_simple_ltoahex( tmp, (unsigned long)(X)); \
+    tmp1=_dl_simple_ltoahex_inline( tmp, (unsigned long)(X)); \
     _dl_write(2, tmp1, _dl_strlen_inline(tmp1)); \
     if (add_a_newline) { \
 	tmp[0]='\n'; \

+ 2 - 0
ldso/ldso/ld-uClibc.c

@@ -244,6 +244,8 @@ DL_BOOT(unsigned long args)
 	__asm__("\tmov %%l7,%0\n\t" : "=r" (got))
 #elif defined(__arm__)
 	__asm__("\tmov %0, r10\n\t" : "=r"(got));
+#elif defined(__powerpc__)
+	__asm__("\tbl _GLOBAL_OFFSET_TABLE_-4@local\n\t" : "=l"(got));
 #else
 	/* Do things the slow way in C */
 	{

+ 2 - 2
ldso/ldso/ld_hash.h

@@ -86,7 +86,7 @@ extern int _dl_linux_dynamic_link(void);
 #define SEND_ADDRESS_STDERR(X, add_a_newline) { \
     char tmp[13], *tmp1; \
     _dl_memset_inline(tmp, 0, sizeof(tmp)); \
-    tmp1=_dl_simple_ltoahex( tmp, (unsigned long)(X)); \
+    tmp1=_dl_simple_ltoahex_inline( tmp, (unsigned long)(X)); \
     _dl_write(2, tmp1, _dl_strlen_inline(tmp1)); \
     if (add_a_newline) { \
 	tmp[0]='\n'; \
@@ -97,7 +97,7 @@ extern int _dl_linux_dynamic_link(void);
 #define SEND_NUMBER_STDERR(X, add_a_newline) { \
     char tmp[13], *tmp1; \
     _dl_memset_inline(tmp, 0, sizeof(tmp)); \
-    tmp1=_dl_simple_ltoahex( tmp, (unsigned long)(X)); \
+    tmp1=_dl_simple_ltoahex_inline( tmp, (unsigned long)(X)); \
     _dl_write(2, tmp1, _dl_strlen_inline(tmp1)); \
     if (add_a_newline) { \
 	tmp[0]='\n'; \

+ 8 - 0
ldso/ldso/ld_syscall.h

@@ -17,6 +17,12 @@ static inline _syscall1(void, _dl_exit, int, status);
 static inline _syscall1(int, _dl_close, int, fd);
 
 
+#ifdef __powerpc__
+/* PowerPC has a different calling convention for mmap(). */
+#define __NR__dl_mmap __NR_mmap
+static inline _syscall6(void *, _dl_mmap, void *, start, size_t, length,
+		int, prot, int, flags, int, fd, off_t, offset);
+#else
 #define __NR__dl_mmap_real __NR_mmap
 static inline _syscall1(void *, _dl_mmap_real, unsigned long *, buffer);
 
@@ -33,6 +39,8 @@ static inline void * _dl_mmap(void * addr, unsigned long size, int prot,
 	buffer[5] = (unsigned long) offset;
 	return (void *) _dl_mmap_real(buffer);
 }
+#endif
+
 #ifndef _dl_MAX_ERRNO
 #define _dl_MAX_ERRNO 4096
 #endif

+ 2 - 0
ldso/ldso/ldso.c

@@ -244,6 +244,8 @@ DL_BOOT(unsigned long args)
 	__asm__("\tmov %%l7,%0\n\t" : "=r" (got))
 #elif defined(__arm__)
 	__asm__("\tmov %0, r10\n\t" : "=r"(got));
+#elif defined(__powerpc__)
+	__asm__("\tbl _GLOBAL_OFFSET_TABLE_-4@local\n\t" : "=l"(got));
 #else
 	/* Do things the slow way in C */
 	{

+ 8 - 0
ldso/ldso/syscall.h

@@ -17,6 +17,12 @@ static inline _syscall1(void, _dl_exit, int, status);
 static inline _syscall1(int, _dl_close, int, fd);
 
 
+#ifdef __powerpc__
+/* PowerPC has a different calling convention for mmap(). */
+#define __NR__dl_mmap __NR_mmap
+static inline _syscall6(void *, _dl_mmap, void *, start, size_t, length,
+		int, prot, int, flags, int, fd, off_t, offset);
+#else
 #define __NR__dl_mmap_real __NR_mmap
 static inline _syscall1(void *, _dl_mmap_real, unsigned long *, buffer);
 
@@ -33,6 +39,8 @@ static inline void * _dl_mmap(void * addr, unsigned long size, int prot,
 	buffer[5] = (unsigned long) offset;
 	return (void *) _dl_mmap_real(buffer);
 }
+#endif
+
 #ifndef _dl_MAX_ERRNO
 #define _dl_MAX_ERRNO 4096
 #endif

+ 2 - 0
ldso/ldso/vsprintf.c

@@ -271,11 +271,13 @@ int _dl_fdprintf(int fd, const char *fmt, ...)
 		}
 		if (qualifier == 'l')
 			num = va_arg(args, unsigned long);
+#ifndef __powerpc__
 		else if (qualifier == 'h')
 			if (flags & SIGN)
 				num = va_arg(args, short);
 			else
 				num = va_arg(args, unsigned short);
+#endif
 		else if (flags & SIGN)
 			num = va_arg(args, int);
 		else