patches/glibc/2.3.3/glibc-2.3.2-arm-fix-strlen.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sat Feb 24 11:00:05 2007 +0000 (2007-02-24)
changeset 1 eeea35fbf182
permissions -rw-r--r--
Add the full crosstool-NG sources to the new repository of its own.
You might just say: 'Yeah! crosstool-NG's got its own repo!".
Unfortunately, that's because the previous repo got damaged beyond repair and I had no backup.
That means I'm putting backups in place in the afternoon.
That also means we've lost history... :-(
yann@1
     1
See also
yann@1
     2
http://lists.gnu.org/archive/html/bug-glibc/2002-12/msg00056.html
yann@1
     3
http://lists.arm.linux.org.uk/pipermail/linux-arm-toolchain/2004-June/000016.html
yann@1
     4
yann@1
     5
2002-12-12  Andreas Schwab  <schwab@suse.de>
yann@1
     6
        * sysdeps/arm/strlen.S: Fix last word check for big endian.
yann@1
     7
yann@1
     8
To: libc-alpha at sources dot redhat dot com
yann@1
     9
Subject: [PATCH] REPOST: ARM big-endian strlen() fix
yann@1
    10
References: <m3brjy27mo.fsf@defiant.pm.waw.pl>
yann@1
    11
From: Krzysztof Halasa <khc at pm dot waw dot pl>
yann@1
    12
Date: Thu, 10 Jun 2004 13:41:44 +0200
yann@1
    13
Message-ID: <m3r7sn8wsn.fsf@defiant.pm.waw.pl>
yann@1
    14
MIME-Version: 1.0
yann@1
    15
Content-Type: multipart/mixed; boundary="=-=-="
yann@1
    16
yann@1
    17
--=-=-=
yann@1
    18
yann@1
    19
The attached patch fixes strlen() on big-endian ARM. Please apply.
yann@1
    20
Thanks.
yann@1
    21
-- 
yann@1
    22
Krzysztof Halasa, B*FH
yann@1
    23
yann@1
    24
--=-=-=
yann@1
    25
Content-Type: text/x-patch
yann@1
    26
Content-Disposition: inline; filename=glibc-strlen.patch
yann@1
    27
yann@1
    28
--- glibc-2.3.3.old/sysdeps/arm/strlen.S	2003-04-30 00:47:20.000000000 +0200
yann@1
    29
+++ glibc-2.3.3/sysdeps/arm/strlen.S	2004-06-06 03:21:48.351931240 +0200
yann@1
    30
@@ -53,12 +53,21 @@
yann@1
    31
 	ldrne   r2, [r1], $4            @ and we continue to the next word
yann@1
    32
 	bne     Laligned                @
yann@1
    33
 Llastword:				@ drop through to here once we find a
yann@1
    34
+#ifdef __ARMEB__
yann@1
    35
+	tst     r2, $0xff000000         @ word that has a zero byte in it
yann@1
    36
+	addne   r0, r0, $1              @
yann@1
    37
+	tstne   r2, $0x00ff0000         @ and add up to 3 bytes on to it
yann@1
    38
+	addne   r0, r0, $1              @
yann@1
    39
+	tstne   r2, $0x0000ff00         @ (if first three all non-zero, 4th
yann@1
    40
+	addne   r0, r0, $1              @  must be zero)
yann@1
    41
+#else
yann@1
    42
 	tst     r2, $0x000000ff         @ word that has a zero byte in it
yann@1
    43
 	addne   r0, r0, $1              @
yann@1
    44
 	tstne   r2, $0x0000ff00         @ and add up to 3 bytes on to it
yann@1
    45
 	addne   r0, r0, $1              @
yann@1
    46
 	tstne   r2, $0x00ff0000         @ (if first three all non-zero, 4th
yann@1
    47
 	addne   r0, r0, $1              @  must be zero)
yann@1
    48
+#endif
yann@1
    49
 	RETINSTR(mov,pc,lr)
yann@1
    50
 END(strlen)
yann@1
    51
 libc_hidden_builtin_def (strlen)
yann@1
    52
yann@1
    53
--=-=-=--
yann@1
    54