Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/compiler_rt Fix broken printf(3) %d output for numb...



details:   https://anonhg.NetBSD.org/src/rev/d6ac7cef5ce8
branches:  trunk
changeset: 745626:d6ac7cef5ce8
user:      rin <rin%NetBSD.org@localhost>
date:      Sun Mar 08 06:30:06 2020 +0000

description:
Fix broken printf(3) %d output for numbers more than two digits, e.g.,

  printf("%d\n", 42) ---> "::" instead of "42"

Our __{,u}modsi3 codes assume that __udivsi3 returns remainder to
%d1 (volatile register). __udivsi3 in libgcc does not, and therefore
mixing them up results in mess.

diffstat:

 lib/libc/compiler_rt/Makefile.inc |  11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diffs (27 lines):

diff -r a1693d8ec951 -r d6ac7cef5ce8 lib/libc/compiler_rt/Makefile.inc
--- a/lib/libc/compiler_rt/Makefile.inc Sun Mar 08 06:25:10 2020 +0000
+++ b/lib/libc/compiler_rt/Makefile.inc Sun Mar 08 06:30:06 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.36 2019/10/29 16:08:50 joerg Exp $
+# $NetBSD: Makefile.inc,v 1.37 2020/03/08 06:30:06 rin Exp $
 
 COMPILER_RT_SRCDIR=    ${NETBSDSRCDIR}/sys/external/bsd/compiler_rt/dist
 
@@ -170,9 +170,16 @@
 GENERIC_SRCS+= \
        divmodsi4.c \
        divsi3.c \
+       udivmodsi4.c \
+
+. if ${LIBC_MACHINE_ARCH} != "m68000"
+# Our __{,u}modsi3 codes assume that __udivsi3 returns remainder to
+# %d1 (volatile register). __udivsi3 in libgcc does not, and therefore
+# mixing them up results in mess.
+GENERIC_SRCS+= \
        modsi3.c \
-       udivmodsi4.c \
        umodsi3.c
+. endif
 
 . if ${LIBC_MACHINE_CPU} != "sh3"
 # On sh3 __udivsi3 is gcc "millicode" with special calling convention



Home | Main Index | Thread Index | Old Index