BUG W/PATCH - libgloss/arm/linux-syscalls0.S - wrongly assumes thumb mode.
Duane Ellis
duane-newlib@duaneellis.com
Tue Mar 20 17:41:00 GMT 2007
Duane Ellis wrote:
> Below is a patch to fix a build problem with Newlib 1.15.0.
Whoops - I the diff is backwards
(ie: diff OLD NEW vrs diff NEW OLD)
Here's the fixed version.
-Duane.
-------------
diff -Naur newlib-1.15.0/libgloss/arm/linux-syscalls0.S
newlib-1.15.0-ARM-LINUX-SYSCALLFIX/libgloss/arm/linux-syscalls0.S
--- newlib-1.15.0/libgloss/arm/linux-syscalls0.S 2006-10-03
12:33:50.000000000 -0400
+++ newlib-1.15.0-ARM-LINUX-SYSCALLFIX/libgloss/arm/linux-syscalls0.S
2007-03-20 12:50:13.000000000 -0400
@@ -68,11 +68,11 @@
# define SYSCALL6(name) \
GLOBAL(_ ## name); \
- push { r4 - r5 }; \
+ stmfd sp!,{ r4 - r5 }; \
ldr r4, [sp, #8]; \
ldr r5, [sp, #12]; \
swi #SYS_ ## name; \
- pop { r4 - r5 }; \
+ ldmfd sp!,{ r4 - r5 }; \
b _set_errno; \
SIZE(_ ## name)
@@ -190,19 +190,37 @@
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/libgloss/ChangeLog
newlib-1.15.0-ARM-LINUX-SYSCALLFIX/libgloss/ChangeLog
--- newlib-1.15.0/libgloss/ChangeLog 2006-12-18 16:48:18.000000000 -0500
+++ newlib-1.15.0-ARM-LINUX-SYSCALLFIX/libgloss/ChangeLog 2007-03-20
13:22:43.000000000 -0400
@@ -1,3 +1,8 @@
+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:
More information about the Newlib
mailing list