This is the mail archive of the
newlib-cvs@sourceware.org
mailing list for the newlib project.
[newlib-cygwin] Fix strlen using Thumb-2 with -Os -marm
- From: Jeff Johnston <jjohnstn at sourceware dot org>
- To: newlib-cvs at sourceware dot org
- Date: 11 May 2016 21:20:13 -0000
- Subject: [newlib-cygwin] Fix strlen using Thumb-2 with -Os -marm
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=5c02bcc086a96b174e1b9e1445a4a1770070107a
commit 5c02bcc086a96b174e1b9e1445a4a1770070107a
Author: Jeff Johnston <jjohnstn@redhat.com>
Date: Wed May 11 17:18:48 2016 -0400
Fix strlen using Thumb-2 with -Os -marm
2016-04-18 Thomas Preud'homme <thomas.preudhomme@arm.com>
* libc/machine/arm/strlen-stub.c: Check capabilities of architecture
to decide which Thumb implementation to use and fall back to C
implementation for architecture not supporting Thumb mode.
* libc/machine/arm/strlen.S: Likewise.
Diff:
---
newlib/libc/machine/arm/strlen-stub.c | 7 +++++--
newlib/libc/machine/arm/strlen.S | 7 +++++--
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/newlib/libc/machine/arm/strlen-stub.c b/newlib/libc/machine/arm/strlen-stub.c
index bcd3d2d..ea45a37 100644
--- a/newlib/libc/machine/arm/strlen-stub.c
+++ b/newlib/libc/machine/arm/strlen-stub.c
@@ -32,12 +32,15 @@
#include <limits.h>
#if defined __OPTIMIZE_SIZE__ || defined PREFER_SIZE_OVER_SPEED
-#if defined __thumb__ && !defined __thumb2__
+#if __ARM_ARCH_ISA_THUMB == 2
/* Implemented in strlen.S. */
-#else
+#elif defined (__ARM_ARCH_ISA_THUMB)
/* Implemented in strlen.S. */
+#else
+#include "../../string/strlen.c"
+
#endif
#else /* defined __OPTIMIZE_SIZE__ || defined PREFER_SIZE_OVER_SPEED */
diff --git a/newlib/libc/machine/arm/strlen.S b/newlib/libc/machine/arm/strlen.S
index 5737145..0435fb2 100644
--- a/newlib/libc/machine/arm/strlen.S
+++ b/newlib/libc/machine/arm/strlen.S
@@ -27,11 +27,14 @@
#include "acle-compat.h"
#if defined __OPTIMIZE_SIZE__ || defined PREFER_SIZE_OVER_SPEED
-#if defined __thumb__ && !defined __thumb2__
+#if __ARM_ARCH_ISA_THUMB == 2
+#include "strlen-thumb2-Os.S"
+
+#elif defined (__ARM_ARCH_ISA_THUMB)
#include "strlen-thumb1-Os.S"
#else
-#include "strlen-thumb2-Os.S"
+ /* Implemented in strlen-stub.c. */
#endif