This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
BUG W/PATCH - libgloss/arm/linux-syscalls0.S - wrongly assumes thumb mode.
- From: Duane Ellis <duane-newlib at duaneellis dot com>
- To: newlib at sourceware dot org
- Date: Tue, 20 Mar 2007 13:29:16 -0400
- Subject: BUG W/PATCH - libgloss/arm/linux-syscalls0.S - wrongly assumes thumb mode.
- Reply-to: duane-newlib at duaneellis dot com
Below is a patch to fix a build problem with Newlib 1.15.0.
Functionally - the problem is this: The macros that create various Linux
are written for THUMB mode only. Solution was to add some #if __thumb__
around the offending locations.
Caveat: I do not have an ARM-LINUX target to try this on, I can only guess
this was missed because most use glibc on arm-linux and do not use newlib
or perhaps it is because I'm setting up my own toolchain and I stumbled
across it.
Thanks.
-Duane Ellis.
diff -Naur
newlib-1.15.0-ARM-LINUX-SYSCALLFIX/libgloss/arm/linux-syscalls0.S
newlib-1.15.0/libgloss/arm/linux-syscalls0.S
--- newlib-1.15.0-ARM-LINUX-SYSCALLFIX/libgloss/arm/linux-syscalls0.S
2007-03-20 12:50:13.000000000 -0400
+++ newlib-1.15.0/libgloss/arm/linux-syscalls0.S 2006-10-03
12:33:50.000000000 -0400
@@ -68,11 +68,11 @@
# define SYSCALL6(name) \
GLOBAL(_ ## name); \
- stmfd sp!,{ r4 - r5 }; \
+ push { r4 - r5 }; \
ldr r4, [sp, #8]; \
ldr r5, [sp, #12]; \
swi #SYS_ ## name; \
- ldmfd sp!,{ r4 - r5 }; \
+ pop { r4 - r5 }; \
b _set_errno; \
SIZE(_ ## name)
@@ -190,37 +190,19 @@
ALIAS(vfork)
ALIAS(wait4)
-#if __thumb__
# define SOCKETCALL(name, NAME) \
GLOBAL(name); \
push { r0 - r3 }; \
mov r0, #SYS_ ## NAME; \
b _socketcall_tail; \
SIZE(name)
-#else
-# define SOCKETCALL(name, NAME) \
- GLOBAL(name); \
- stmfd sp!,{ r0 - r3 }; \
- mov r0, #SYS_ ## NAME; \
- b _socketcall_tail; \
- SIZE(name)
-#endif
-
+
FUNC(_socketcall_tail)
mov r1, sp
-#if __thumb__
push { lr }
-#else
- stmfd sp!,{lr}
-#endif
bl _socketcall
-#if __thumb__
pop { r3 }
add sp, #16
-#else
- ldmfd sp!,{r3}
- add sp,sp,#16
-#endif
#if defined(__ARM_ARCH_2__) || defined(__ARM_ARCH_3__) \
|| defined(__ARM_ARCH_3M__) || defined(__ARM_ARCH_4__)
mov pc, r3
diff -Naur newlib-1.15.0-ARM-LINUX-SYSCALLFIX/libgloss/ChangeLog
newlib-1.15.0/libgloss/ChangeLog
--- newlib-1.15.0-ARM-LINUX-SYSCALLFIX/libgloss/ChangeLog 2007-03-20
13:22:43.000000000 -0400
+++ newlib-1.15.0/libgloss/ChangeLog 2006-12-18 16:48:18.000000000 -0500
@@ -1,8 +1,3 @@
-2007-03-20 duane ellis <duane-newlib@duaneellis.com>
-
- * arm/linux-syscalls0.S - Fix: Wrongly uses THUMB
- instructions in various macros.
-
2006-12-18 Kazu Hirata <kazu@codesourcery.com>
Merge from newlib-csl-20060320-branch: