overlay/dev-libs/dietlibc/files/0020-fixes-for-ARMv7.diff

979 lines
22 KiB
Diff

Description: Upstream changes introduced in version 0.33~cvs20110710-1
This patch has been created by dpkg-source during the package build.
Here's the last changelog entry, hopefully it gives details on why
those changes were made:
.
dietlibc (0.33~cvs20110710-1) experimental; urgency=low
.
* New upstream pre-release
* Bump Standards-Version
* Use DEP5 as copyright format
* Don't build arm* with DEBUG flag
* Use debian source format 3.0 (quilt)
* Move tc523086.c into debian/test directory
* Add local-options file
* Refresh debian patchset
* parisc/strstr.S: remove local removal
* strip elftrunc and dnsd resulting binaries
.
The person named in the Author field signed this changelog entry.
Author: Hector Oron <zumbi@debian.org>
---
Index: pkg-dietlibc/syscalls.s/fadvise64.S
===================================================================
--- pkg-dietlibc.orig/syscalls.s/fadvise64.S 2012-03-25 15:11:10.000000000 +0000
+++ pkg-dietlibc/syscalls.s/fadvise64.S 2012-03-25 15:12:55.000000000 +0000
@@ -3,15 +3,14 @@
#include "syscalls.h"
+#ifdef __NR_fadvise64
+syscall(fadvise64,fadvise64)
+
#ifndef __NR_fadvise64_64
+.set posix_fadvise, fadvise64
.globl posix_fadvise
-.type posix_fadvise,@function
-posix_fadvise:
#endif
-#ifdef __NR_fadvise64
-syscall(fadvise64,fadvise64)
-
#endif
#endif
Index: pkg-dietlibc/arm/__aeabi_unwind_cpp.S
===================================================================
--- pkg-dietlibc.orig/arm/__aeabi_unwind_cpp.S 2012-03-25 15:07:28.000000000 +0000
+++ pkg-dietlibc/arm/__aeabi_unwind_cpp.S 2012-03-25 15:12:55.000000000 +0000
@@ -1,21 +1,14 @@
-.text
-.global __aeabi_unwind_cpp_pr0
-.hidden __aeabi_unwind_cpp_pr0
-.type __aeabi_unwind_cpp_pr0, %function
+#include "arm-features.h"
-.global __aeabi_unwind_cpp_pr1
+FUNC_START __aeabi_unwind_cpp_pr0
+FUNC_START __aeabi_unwind_cpp_pr1
+FUNC_START __aeabi_unwind_cpp_pr2
+.hidden __aeabi_unwind_cpp_pr0
.hidden __aeabi_unwind_cpp_pr1
-.type __aeabi_unwind_cpp_pr1, %function
-
-.global __aeabi_unwind_cpp_pr2
.hidden __aeabi_unwind_cpp_pr2
-.type __aeabi_unwind_cpp_pr2, %function
-__aeabi_unwind_cpp_pr0:
-__aeabi_unwind_cpp_pr1:
-__aeabi_unwind_cpp_pr2:
- mov pc, lr @ return from subroutine
+ RET
-.size __aeabi_unwind_cpp_pr0,.-__aeabi_unwind_cpp_pr0
-.size __aeabi_unwind_cpp_pr1,.-__aeabi_unwind_cpp_pr1
-.size __aeabi_unwind_cpp_pr2,.-__aeabi_unwind_cpp_pr2
+FUNC_END __aeabi_unwind_cpp_pr2
+FUNC_END __aeabi_unwind_cpp_pr1
+FUNC_END __aeabi_unwind_cpp_pr0
Index: pkg-dietlibc/arm/__fadvise.c
===================================================================
--- pkg-dietlibc.orig/arm/__fadvise.c 2012-03-25 15:07:28.000000000 +0000
+++ pkg-dietlibc/arm/__fadvise.c 2012-03-25 15:12:55.000000000 +0000
@@ -1,7 +1,10 @@
-#include <fcntl.h>
#include "syscalls.h"
#ifndef __NR_fadvise64
+#define _LINUX_SOURCE
+#include <fcntl.h>
+#include <unistd.h>
+
long fadvise64_64(int fd, off64_t offset, off64_t len, int advice)
{
extern long __arm_fadvise64_64(int fd, int advice, off64_t offset, off64_t len);
Index: pkg-dietlibc/arm/__guard.S
===================================================================
--- pkg-dietlibc.orig/arm/__guard.S 2012-03-25 15:07:28.000000000 +0000
+++ pkg-dietlibc/arm/__guard.S 2012-03-25 15:12:55.000000000 +0000
@@ -1,4 +1,5 @@
.data
+.align 2
.type __guard,#object
.global __guard
.type __stack_chk_guard,#object
@@ -7,3 +8,5 @@
__stack_chk_guard:
.long 0xaff00
+.size __guard, . - __guard
+.size __stack_chk_guard, . - __stack_chk_guard
Index: pkg-dietlibc/arm/__longjmp.S
===================================================================
--- pkg-dietlibc.orig/arm/__longjmp.S 2012-03-25 15:07:28.000000000 +0000
+++ pkg-dietlibc/arm/__longjmp.S 2012-03-25 15:12:55.000000000 +0000
@@ -1,11 +1,24 @@
-.text
-.global __longjmp
-.type __longjmp,function
-__longjmp:
+#include "arm-features.h"
+
+FUNC_START __longjmp
mov ip, r0
movs r0, r1
moveq r0, #1
-#ifndef __SOFTFP__
- lfm f4, 4, [ip], #48
+
+#ifndef __SOFTFP__
+# if __ARM_ARCH__ >= 6
+ vldm ip!, {d0-d15}
+# ifdef __ARM_NEON__
+ vldm ip!, {d16-d31}
+# endif
+# else
+ lfm f4, 4, [ip]!
+# endif
#endif
- ldmia ip, {r4-r11, sp, pc}
+
+#ifdef __IWMMXT__
+# warning "sigjmp will not restore iwmmxt coprocessor registers"
+#endif
+
+ ldmia ip!, {r4-r11, sp, pc}
+FUNC_END __longjmp
Index: pkg-dietlibc/arm/__testandset.S
===================================================================
--- pkg-dietlibc.orig/arm/__testandset.S 2012-03-25 15:07:28.000000000 +0000
+++ pkg-dietlibc/arm/__testandset.S 2012-03-25 15:12:55.000000000 +0000
@@ -1,7 +1,15 @@
-.text
-.global __testandset
-__testandset:
+#include "arm-features.h"
+
+FUNC_START __testandset
mov r2, r0
mov r1, #1
+# if __ARM_ARCH__ < 6
swp r0, r1, [r2]
- mov pc, lr
+# else
+1: ldrex r0, [r2]
+ strex r3, r1, [r2]
+ cmp r3, #0
+ bne 1b
+# endif
+ RET
+FUNC_END __testandset
Index: pkg-dietlibc/arm/arm-features.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ pkg-dietlibc/arm/arm-features.h 2012-03-25 15:12:55.000000000 +0000
@@ -0,0 +1,110 @@
+/* --*- asm -*-- */
+
+#ifndef H_DIETLIBC_ARM_FEATURES_H
+#define H_DIETLIBC_ARM_FEATURES_H
+
+/* Stolen from gcc (gcc/config/arm/lib1funcs.asm) */
+#if defined(__ARM_ARCH_2__)
+# define __ARM_ARCH__ 2
+#endif
+
+#if defined(__ARM_ARCH_3__)
+# define __ARM_ARCH__ 3
+#endif
+
+#if defined(__ARM_ARCH_3M__) || defined(__ARM_ARCH_4__) \
+ || defined(__ARM_ARCH_4T__)
+# define __ARM_ARCH__ 4
+#endif
+
+#if defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5T__) \
+ || defined(__ARM_ARCH_5E__) || defined(__ARM_ARCH_5TE__) \
+ || defined(__ARM_ARCH_5TEJ__)
+# define __ARM_ARCH__ 5
+#endif
+
+#if defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \
+ || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) \
+ || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) \
+ || defined(__ARM_ARCH_6M__)
+# define __ARM_ARCH__ 6
+#endif
+
+#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) \
+ || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__)
+# define __ARM_ARCH__ 7
+#endif
+
+#ifndef __ARM_ARCH__
+#error Unable to determine architecture.
+#endif
+
+#define DIET_JMPBUFSZ_REGS_REGULAR 10*32/8 /* r4-r11, sp, pc */
+#define DIET_JMPBUFSZ_REGS_FPv4 16*64/8 /* d0-d15 */
+
+#if !defined(__SOFTFP__) || defined(__IWMMXT__)
+# define DIET_HAVE_COPROC_REGS 1
+#else
+# undef DIET_HAVE_COPROC_REGS
+#endif
+
+#ifdef __ASSEMBLER__
+
+.macro FUNC_START name
+ .text
+ .align 0
+ .global \name
+ .type \name, %function
+\name:
+.endm
+
+.macro FUNC_START_WEAK name
+ .text
+ .align 0
+ .weak \name
+ .type \name, %function
+\name:
+.endm
+
+.macro FUNC_END name
+ .size \name, . - \name
+.endm
+
+.macro RET
+#if (__ARM_ARCH__ > 4) || defined(__ARM_ARCH_4T__)
+ bx lr
+#else
+ mov pc, lr
+#endif
+.endm
+
+.macro SWI_UNIFIED name
+#ifdef __ARM_EABI__
+ b __unified_syscall_swi
+#else
+ swi \name
+ b __unified_syscall
+#endif
+.endm
+
+.macro SWI_UNIFIED4
+#ifdef __ARM_EABI__
+ b __unified_syscall_swi
+#else
+ swi \name
+ b __unified_syscall4
+#endif
+.endm
+
+.macro LOAD_ARG4_5
+#if defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__) || defined(__ARM_ARCH_5T__)
+ ldr r4, [sp,#16]
+ ldr r5, [sp,#20]
+#else
+ ldrd r4, [sp,#16]
+#endif
+.endm
+
+#endif /* __ASSEMBLER__ */
+
+#endif /* H_DIETLIBC_ARM_FEATURES_H */
Index: pkg-dietlibc/arm/clone.S
===================================================================
--- pkg-dietlibc.orig/arm/clone.S 2012-03-25 15:07:28.000000000 +0000
+++ pkg-dietlibc/arm/clone.S 2012-03-25 15:12:55.000000000 +0000
@@ -1,11 +1,8 @@
#include <errno.h>
#include "syscalls.h"
+#include "arm-features.h"
- .text
- .weak clone
- .global __clone
-
@
@ Some slightly tricky stuff here... edit with care :-)
@
@@ -19,9 +16,8 @@
@ ; don't do this yet
@#define RESET_PID
-
-clone:
-__clone:
+FUNC_START_WEAK clone
+FUNC_START __clone
@ ; start with a sanity check
cmp r0, #0
cmpne r1, #0
@@ -51,7 +47,8 @@
beq 1f
ldmfd sp!, {r4, r7}
blt __unified_syscall @ (return code < 0): handle as an error
- bx lr
+ RET
+
1:
#ifdef RESET_PID
tst ip, #CLONE_THREAD
@@ -76,12 +73,13 @@
@ ; and we're done, passing return value through r0
b _exit @ branch to _exit (PIC safe)
+FUNC_END __clone
+FUNC_END clone
-
#else
-clone:
-__clone:
+FUNC_START_WEAK clone
+FUNC_START __clone
movs r12, r0 @ check function pointer
cmpne r1, #0 @ if function check for stack pointer
moveq r0, #-EINVAL @ if one is not available set errno value
@@ -101,5 +99,7 @@
ldmia sp!, { r0, pc } @ load function param and jump to thread function
1: b _exit @ branch to _exit (PIC safe)
+FUNC_END __clone
+FUNC_END clone
#endif
Index: pkg-dietlibc/arm/dyn_syscalls.S
===================================================================
--- pkg-dietlibc.orig/arm/dyn_syscalls.S 2012-03-25 15:07:28.000000000 +0000
+++ pkg-dietlibc/arm/dyn_syscalls.S 2012-03-25 15:12:55.000000000 +0000
@@ -8,11 +8,15 @@
#include <dietfeatures.h>
#include "syscalls.h"
+#include "arm-features.h"
-.text
-__unified_syscall4:
+#ifdef __ARM_EABI__
+# error "dyn_syscall.S not ported for EABI yet"
+#endif
+
+FUNC_START __unified_syscall4
ldmfd sp!, {r4, r5, r6}
-__unified_syscall:
+FUNC_START __unified_syscall
cmn r0, #4096
movcc pc, lr
rsb r1, r0, #0
@@ -25,7 +29,9 @@
mvn r0, #0
#include "dietuglyweaks.h"
- mov pc, lr
+ RET
+FUNC_END __unified_syscall
+FUNC_END __unified_syscall4
/* ok now include all syscalls.s (*.S) and sysdep *.S */
#include "mmap.S"
@@ -104,7 +110,6 @@
#include "../syscalls.s/n_sigprocmask.S"
#include "../syscalls.s/n_sigsuspend.S"
#include "../syscalls.s/nanosleep.S"
-#include "../syscalls.s/nice.S"
#include "../syscalls.s/open.S"
#include "../syscalls.s/pause.S"
#include "../syscalls.s/personality.S"
@@ -280,9 +285,11 @@
#include "../syscalls.s/fgetxattr.S"
/* other asm-files w.o. changes ... */
-__exit:
+FUNC_START __exit
swi $__NR_exit
eor pc,lr,lr
+FUNC_END __exit
+
#define _exit __exit
#include "clone.S"
#undef _exit
Index: pkg-dietlibc/arm/mcount.S
===================================================================
--- pkg-dietlibc.orig/arm/mcount.S 2012-03-25 15:07:28.000000000 +0000
+++ pkg-dietlibc/arm/mcount.S 2012-03-25 15:12:55.000000000 +0000
@@ -1,4 +1,4 @@
-
+#include "arm-features.h"
@
@ mcount.S: ARM assembler implementation of mcount
@
@@ -27,11 +27,7 @@
@
@
-.text
-
-.global mcount
-
-mcount:
+FUNC_START mcount
mov ip, sp
stmdb sp!, { r0 - r3, fp, ip, lr, pc } @ build stack frame
sub fp, ip, #4 @ setup new fp
@@ -43,4 +39,4 @@
bl __mcount @ call __mcount
ldmdb fp, { r0 - r3, fp, sp, pc } @ restore context from stack frame and return.
-
+FUNC_END mcount
Index: pkg-dietlibc/arm/md5asm.S
===================================================================
--- pkg-dietlibc.orig/arm/md5asm.S 2012-03-25 15:07:28.000000000 +0000
+++ pkg-dietlibc/arm/md5asm.S 2012-03-25 15:12:55.000000000 +0000
@@ -50,45 +50,35 @@
*****************************************************************************/
#include <endian.h>
+#include "arm-features.h"
#if (__BYTE_ORDER == __LITTLE_ENDIAN)
- .global MD5Init
- .global MD5Update
-
- .text
-#ifdef __ARM_EABI__
- .align 4
-#else
- .align 2
-#endif
-
@ --
@ void MD5Init (MD5_CTX* context);
@ --
-MD5Init:
-
+FUNC_START MD5Init
adr r1, 1f @ r1 = base address of MD5InitData array
ldmia r1, { r1 - r3, r12 } @ load 4 elements from MD5InitData array
stmia r0, { r1 - r3, r12 } @ store into MD5 context->state[0..3]
mov r1, #0
str r1, [r0, #0x10] @ initial count[0] = 0
str r1, [r0, #0x14] @ initial count[1] = 0
- mov pc, lr @ return
+ RET
+ .align 3
1: .word 0x67452301 @ initial MD5 context->state[0]
.word 0xefcdab89 @ initial MD5 context->state[1]
.word 0x98badcfe @ initial MD5 context->state[2]
.word 0x10325476 @ initial MD5 context->state[3]
-
+FUNC_END MD5Init
@ --
@ void MD5Update (MD5_CTX* context, const uint8_t* buf, signed int len);
@ --
-MD5Update:
-
+FUNC_START MD5Update
stmdb sp!, { r4 - r8, lr }
add r4, r0, #(6 * 4) @ r4 = &context->buffer[0]
ldmdb r4, { r0, r3 } @ r0 = count[0], r3 = count[1]
@@ -122,12 +112,13 @@
sub r2, r8, r2
2: ldmia sp!, { r4 - r8, lr }
b memcpy @ classic tail-call optimisation...
-
+FUNC_END MD5Update
@ --
@ static void __MD5Transform (uint32_t *buf, const uint32_t *in, int repeat);
@ --
+ .align 3
MD5MagicData:
1: .word 0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee
@@ -148,6 +139,7 @@
.word 0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391, (17f-19f-4)
.word 0x6e4120A9, 0x20657264, 0x7543634d, 0x00796472, (19f-19f-4)
+ .align 2
__MD5Transform:
cmp r2, #0
Index: pkg-dietlibc/arm/setjmp.S
===================================================================
--- pkg-dietlibc.orig/arm/setjmp.S 2012-03-25 15:07:28.000000000 +0000
+++ pkg-dietlibc/arm/setjmp.S 2012-03-25 15:12:55.000000000 +0000
@@ -1,17 +1,40 @@
-.text
-.weak setjmp
-setjmp:
-.global __setjmp
-__setjmp:
+#include "arm-features.h"
+
+FUNC_START_WEAK setjmp
+FUNC_START __setjmp
mov r1, #0
-.global __sigsetjmp
-__sigsetjmp:
-.weak sigsetjmp
-sigsetjmp:
-#ifndef __SOFTFP__
- sfm f4, 4, [r0], #48
+FUNC_END __setjmp
+FUNC_END setjmp
+
+FUNC_START_WEAK sigsetjmp
+FUNC_START __sigsetjmp
+
+#ifdef DIET_HAVE_COPROC_REGS
+ /* we have to work on a copy of 'r0' (jmpbuf *) */
+ mov ip, r0
#endif
+
+#ifndef __SOFTFP__
+# if __ARM_ARCH__ >= 6
+ vstmia ip!, {d0-d15}
+# ifdef __ARM_NEON__
+ vstmia ip!, {d16-d31}
+# endif
+# else
+ sfm f4, 4, [ip]!
+# endif
+#endif
+
+#ifdef __IWMMXT__
+# warning "setjmp will not save iwmmxt coprocessor registers"
+#endif
+
+#ifndef DIET_HAVE_COPROC_REGS
stmia r0, {r4-r11, sp, lr}
- sub r0, r0, #48
- b __sigjmp_save
+#else
+ stmia ip!, {r4-r11, sp, lr}
+#endif
+ b __sigjmp_save
+FUNC_END __sigsetjmp
+FUNC_END sigsetjmp
Index: pkg-dietlibc/arm/start.S
===================================================================
--- pkg-dietlibc.orig/arm/start.S 2012-03-25 15:07:28.000000000 +0000
+++ pkg-dietlibc/arm/start.S 2012-03-25 15:12:55.000000000 +0000
@@ -1,23 +1,11 @@
#include "dietfeatures.h"
#include "syscalls.h"
+#include "arm-features.h"
- .text
#ifdef __ARM_EABI__
- .align 4
-#else
- .align 2
-#endif
-
- .global _start
- .weak exit
- .global _exit
-
-
-#ifdef __ARM_EABI__
-
-_start:
+FUNC_START _start
mov fp, #0 @ clear the frame pointer
ldr a1, [sp] @ argc
add a2, sp, #4 @ argv
@@ -25,6 +13,17 @@
add a3, a2, a1, lsl #2 @ &argv[argc]
add a3, a3, #4 @ envp
str a3, [ip, #0] @ environ = envp
+
+#ifdef WANT_ELFINFO
+ mov r6, a3 @ work on a copy of a3 so that common
+ @ 'main(argc, argv, envp)' function
+ @ stays valid
+1: ldr r5, [r6], #4 @ load *envp and increment it
+ cmp r5, #0 @ read value==0?
+ bne 1b
+ str r6, [ip, #4] @ __elfinfo = envp
+#endif
+
bl main
@
@@ -32,21 +31,22 @@
@ We need to branch to 'exit' in case we have linked with 'atexit'.
@
bl exit
+FUNC_END _start
-exit:
-_exit:
-
+FUNC_START _exit
+FUNC_START_WEAK exit
mov r7, #__NR_exit
swi 0 @ never returns.
+ .align 2
.L3: .word environ
-
+FUNC_END exit
+FUNC_END _exit
#else
-_start:
-
+FUNC_START _start
#ifdef WANT_DYNAMIC
mov a4, a1 @ save dynamic ld.so _fini
#endif
@@ -59,11 +59,25 @@
#ifdef __DYN_LIB
ldr sl, .L4
1: add sl, pc, sl
- str a3, [sl, ip] @ environ = envp
+ str a3, [ip, sl]! @ environ = envp; ip = GOT(environ)
#else
str a3, [ip, #0] @ environ = envp
#endif
+#ifdef WANT_ELFINFO
+ mov r6, a3 @ work on a copy of a3 so that common
+ @ 'main(argc, argv, envp)' function
+ @ stays valid
+1: ldr r5, [r6], #4 @ load *envp and increment it
+ cmp r5, #0 @ read value==0?
+ bne 1b
+#ifdef __DYN_LIB
+ str r6, [ip, sl] @ __elfinfo = envp
+#else
+ str r6, [ip, #4] @ __elfinfo = envp
+#endif
+#endif
+
#ifdef PROFILING
stmdb sp!, { r0 - r3 }
ldr r0, .L5
@@ -83,18 +97,21 @@
@ We need to branch to 'exit' in case we have linked with 'atexit'.
@
bl exit
+FUNC_END _start
-exit:
-_exit:
-
+FUNC_START _exit
+FUNC_START_WEAK exit
#ifdef PROFILING
mov r4, r0 @ save a copy of exit status
bl _stop_monitor
mov r0, r4
#endif
swi $__NR_exit @ never returns.
+FUNC_END exit
+FUNC_END _exit
+ .align 2
#ifdef __DYN_LIB
.L3: .word environ(GOT)
.L4: .word _GLOBAL_OFFSET_TABLE_-(1b+8)
Index: pkg-dietlibc/arm/strcpy.S
===================================================================
--- pkg-dietlibc.orig/arm/strcpy.S 2012-03-25 15:07:28.000000000 +0000
+++ pkg-dietlibc/arm/strcpy.S 2012-03-25 15:12:55.000000000 +0000
@@ -1,10 +1,7 @@
#include "dietfeatures.h"
+#include "arm-features.h"
-.text
- .align 2
- .global strcpy
-
-strcpy:
+FUNC_START strcpy
#ifndef WANT_SMALL_STRING_ROUTINES
mov ip, r0
ands r2, r1, #3
@@ -61,6 +58,5 @@
ldrneb r2, [r1], #1
#endif
bne .Lloop
- mov pc, lr
-.Lfe1:
- .size strcpy,.Lfe1-strcpy
+ RET
+FUNC_END strcpy
Index: pkg-dietlibc/arm/strlen.S
===================================================================
--- pkg-dietlibc.orig/arm/strlen.S 2012-03-25 15:07:28.000000000 +0000
+++ pkg-dietlibc/arm/strlen.S 2012-03-25 15:12:55.000000000 +0000
@@ -1,12 +1,7 @@
#include "dietfeatures.h"
+#include "arm-features.h"
- .text
- .align 2
-
- .global strlen
-
-strlen:
-
+FUNC_START strlen
#if 0
teq a1, #0 @ is string pointer NULL ??
moveq pc, lr @ if so, return 0
@@ -61,12 +56,10 @@
sub a1, a1, a2
#endif
- mov pc, lr
+ RET
#ifndef WANT_SMALL_STRING_ROUTINES
.Lmagic:
.word 0x01010101
#endif
-
-.Lstrlen:
- .size strlen,.Lstrlen-strlen
+FUNC_END strlen
Index: pkg-dietlibc/arm/syscalls.h
===================================================================
--- pkg-dietlibc.orig/arm/syscalls.h 2012-03-25 15:07:28.000000000 +0000
+++ pkg-dietlibc/arm/syscalls.h 2012-03-25 15:12:55.000000000 +0000
@@ -700,9 +700,9 @@
#define __ARGS_getpeername 0
#define __ARGS_socketpair 0
#define __ARGS_send 0
-#define __ARGS_sendto 0
+#define __ARGS_sendto 6
#define __ARGS_recv 0
-#define __ARGS_recvfrom 0
+#define __ARGS_recvfrom 6
#define __ARGS_shutdown 0
#define __ARGS_setsockopt 0
#define __ARGS_getsockopt 0
@@ -771,70 +771,30 @@
#ifdef __ASSEMBLER__
-#ifdef __ARM_EABI__
+#include "arm-features.h"
#define syscall_weak(name,wsym,sym) __syscall_weak __NR_##name, wsym, sym, __ARGS_##name
.macro __syscall_weak name wsym sym typ
-.text
-.type \wsym,function
-.weak \wsym
-\wsym:
-.type \sym,function
-.global \sym
-\sym:
- stmfd sp!,{r4,r5,r7,lr}
- ldr r4, [sp,#16]
- ldr r5, [sp,#20]
- ldr r7, =\name
- swi 0
- b __unified_syscall
+FUNC_START_WEAK \wsym
+__syscall \name, \sym, \typ
+FUNC_END \wsym
.endm
+#ifdef __ARM_EABI__
#define syscall(name,sym) __syscall __NR_##name, sym, __ARGS_##name
.macro __syscall name sym typ
-.text
-.type \sym,function
-.global \sym
-\sym:
- stmfd sp!,{r4,r5,r7,lr}
- ldr r4, [sp,#16]
- ldr r5, [sp,#20]
- ldr r7, =\name
- swi 0
- b __unified_syscall
+FUNC_START \sym
+ ldr ip, =\name
+ b __unified_syscall_swi
+FUNC_END \sym
.endm
#else
-#define syscall_weak(name,wsym,sym) __syscall_weak $__NR_##name, wsym, sym, __ARGS_##name
-.macro __syscall_weak name wsym sym typ
-.text
-.type \wsym,function
-.weak \wsym
-\wsym:
-.type \sym,function
-.global \sym
-\sym:
-.ifgt \typ
- mov ip, sp
- stmfd sp!,{r4, r5, r6}
- ldmia ip, {r4, r5, r6}
-.endif
- swi \name
-.ifgt \typ
- b __unified_syscall4
-.else
- b __unified_syscall
-.endif
-.endm
-
#define syscall(name,sym) __syscall $__NR_##name, sym, __ARGS_##name
.macro __syscall name sym typ
-.text
-.type \sym,function
-.global \sym
-\sym:
+FUNC_START \sym
.ifgt \typ
mov ip, sp
stmfd sp!,{r4, r5, r6}
@@ -846,6 +806,7 @@
.else
b __unified_syscall
.endif
+FUNC_END \sym
.endm
#endif
Index: pkg-dietlibc/arm/unified.S
===================================================================
--- pkg-dietlibc.orig/arm/unified.S 2012-03-25 15:07:28.000000000 +0000
+++ pkg-dietlibc/arm/unified.S 2012-03-25 15:12:55.000000000 +0000
@@ -1,21 +1,28 @@
#include <dietfeatures.h>
-
- .text
-#ifdef __ARM_EABI__
- .align 4
-#else
- .align 2
-#endif
- .global __unified_syscall
- .global __unified_syscall4
-
+#include "arm-features.h"
#ifdef __ARM_EABI__
-__unified_syscall4:
-__unified_syscall:
-
+/* expects:
+ * r0-r3 ... syscall arguments 0-3
+ * ip ... syscall number
+ */
+FUNC_START __unified_syscall_swi
+ .hidden __unified_syscall_swi
+ stmfd sp!,{r4,r5,r7,lr}
+ mov r7, ip
+ LOAD_ARG4_5
+ swi 0
+ /* fallthrough to __unified4_syscall */
+FUNC_END __unified_syscall_swi
+
+/* expects:
+ * r0 ... syscall return value
+ * original r4-r7 + lr on stack
+ */
+FUNC_START __unified_syscall
+ .hidden __unified_syscall
cmn r0, #4096
rsbcs r2, r0, #0
ldrcs r3, 1f
@@ -25,17 +32,18 @@
.balign 4
1:
.word errno
+FUNC_END __unified_syscall
-/* here we go and "reuse" the return for weak-void functions */
#include "dietuglyweaks.h"
- mov pc, lr @ return
+ RET
#else
-__unified_syscall4:
+FUNC_START __unified_syscall4
ldmia sp!, {r4, r5, r6}
-__unified_syscall:
+
+FUNC_START __unified_syscall
cmn r0, #4096
movcc pc, lr @ return value comes direct from kernel.
@@ -53,10 +61,13 @@
/* here we go and "reuse" the return for weak-void functions */
#include "dietuglyweaks.h"
- mov pc, lr @ return
+ RET
#ifndef WANT_THREAD_SAFE
+ .align 2
.L0: .long errno
#endif
+FUNC_END __unified_syscall
+FUNC_END __unified_syscall4
#endif
Index: pkg-dietlibc/arm/waitpid.S
===================================================================
--- pkg-dietlibc.orig/arm/waitpid.S 2012-03-25 15:07:28.000000000 +0000
+++ pkg-dietlibc/arm/waitpid.S 2012-03-25 15:12:55.000000000 +0000
@@ -1,15 +1,8 @@
-.text
-#ifdef __ARM_EABI__
-.align 4
-#else
-.align 2
-#endif
-.weak waitpid
-.type waitpid, %function
-waitpid:
-.global __libc_waitpid
-.type __libc_waitpid, %function
-__libc_waitpid:
+#include "arm-features.h"
+
+FUNC_START_WEAK waitpid
+FUNC_START __libc_waitpid
mov r3, #0
b wait4
- .size waitpid, .-waitpid
+FUNC_END __libc_waitpid
+FUNC_END waitpid