NetBSD Problem Report #43042

From www@NetBSD.org  Tue Mar 23 09:40:39 2010
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id 8535963B873
	for <gnats-bugs@gnats.NetBSD.org>; Tue, 23 Mar 2010 09:40:39 +0000 (UTC)
Message-Id: <20100323094039.06D0B63B11D@www.NetBSD.org>
Date: Tue, 23 Mar 2010 09:40:39 +0000 (UTC)
From: dennis.c.ferguson@gmail.com
Reply-To: dennis.c.ferguson@gmail.com
To: gnats-bugs@NetBSD.org
Subject: frexp(), ldexp() and modf() are missing from powerpc64 libm/libc
X-Send-Pr-Version: www-1.0

>Number:         43042
>Category:       port-powerpc
>Synopsis:       frexp(), ldexp() and modf() are missing from powerpc64 libm/libc
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    mrg
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Mar 23 09:45:00 +0000 2010
>Closed-Date:    Mon May 31 22:31:56 +0000 2010
>Last-Modified:  Mon May 31 22:31:56 +0000 2010
>Originator:     Dennis Ferguson
>Release:        very recent 5.99.24
>Organization:
>Environment:
NetBSD timerxxx.akit-ferguson.com 5.99.24 NetBSD 5.99.24 (GENERIC) #0: Mon Mar 22 15:11:34 HKT 2010  dennis@dennisbigmac.akit-ferguson.com:/Users/dennis/NetBSD/5.0-current/src/sys/arch/amd64/compile/obj/GENERIC amd64

>Description:
The floating point functions frexp(), ldexp() and modf(),
which are advertised as being in the math library libm,
aren't there or anywhere else for powerpc64 builds.  Here's
the link of a program which uses frexp():


#      link  grn/grn
/usr/src/obj/tooldir.NetBSD-5.99.24-amd64/bin/powerpc64--netbsd-gcc  -B/usr/src/obj/destdir.macppc/usr/lib/ -B/usr/src/obj/destdir.macppc/usr/lib/  -Wl,-nostdlib       -o grn  hdb.o hpoint.o hgraph.o main.o /usr/src/gnu/usr.bin/groff/src/libs/libgroff/obj/libgroff.a -lm -lsupc++      -L/usr/src/obj/destdir.macppc/usr/lib   -Wl,-rpath-link,/usr/src/obj/destdir.macppc/lib  -L/usr/src/obj/destdir.macppc/lib -Wl,-rpath-link,/usr/src/obj/destdir.macppc/usr/lib  -L/usr/src/obj/destdir.macppc/usr/lib
hgraph.o: In function `.HGArc(int, int, int, int, int)':
hgraph.cpp:(.text+0xf3c): undefined reference to `.frexp'
collect2: ld returned 1 exit status

*** Failed target:  grn

>How-To-Repeat:
Do a:

    MACHINE=macppc64 ./build.sh distribution
>Fix:
For reasons unknown to me NetBSD compiles these three
functions into libc rather than libm.  The powerpc64
libc configuration forgets to include them, however.

This change to src/lib/libc/compat/arch/powerpc64/gen/Makefile.inc
fixes it:

Index: Makefile.inc
===================================================================
RCS file: /cvsroot/src/lib/libc/compat/arch/powerpc64/gen/Makefile.inc,v
retrieving revision 1.1
diff -u -r1.1 Makefile.inc
--- Makefile.inc	1 Jul 2006 19:17:32 -0000	1.1
+++ Makefile.inc	23 Mar 2010 03:38:06 -0000
@@ -4,4 +4,4 @@
 SRCS+=	

 # objects built from C sources in compat/gen
-SRCS+=
+SRCS+=	compat_frexp_ieee754.c compat_ldexp_ieee754.c compat_modf_ieee754.c


>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: port-powerpc-maintainer->mrg
Responsible-Changed-By: mrg@NetBSD.org
Responsible-Changed-When: Wed, 24 Mar 2010 07:11:54 +0000
Responsible-Changed-Why:
seems reasonable; i'll merge this after some testing.


From: matthew green <mrg@eterna.com.au>
To: gnats-bugs@NetBSD.org
Cc: port-powerpc-maintainer@netbsd.org, gnats-admin@netbsd.org,
    netbsd-bugs@netbsd.org
Subject: re: port-powerpc/43042: frexp(), ldexp() and modf() are missing from powerpc64 libm/libc
Date: Sun, 28 Mar 2010 15:35:13 +1100

 latest about this:  we should not add these to the "compat"
 build, but they need to be solved some how.  dennis says:


 Yes, the other alternative is to add warts for
 machines which don't have the problem to
 the libm Makefile, e.g.

 --- Makefile    2010-01-11 16:28:39.000000000 +0000
 +++ /home/dennis/Makefile       2010-03-25 09:21:12.000000000 +0000
 @@ -140,8 +140,13 @@
         llroundf.c \
         s_fmax.c s_fmaxf.c s_fmaxl.c s_fmin.c s_fminf.c s_fminl.c s_fdim.c

 -# Also in libc.
 -#COMMON_SRCS += s_frexp.c s_ldexp.c s_modf.c
 +#
 +# Add these for machines which don't have compatibility
 +# functions in libc
 +#
 +.if (${MACHINE_ARCH} == "powerpc64")
 +COMMON_SRCS += s_frexp.c s_ldexp.c s_modf.c
 +.endif

  .PATH: ${.CURDIR}/compat
  COMMON_SRCS+= compat_cabs.c compat_cabsf.c

 I'll try that and let you know.

From: matthew green <mrg@eterna.com.au>
To: gnats-bugs@NetBSD.org
Cc: port-powerpc-maintainer@netbsd.org, gnats-admin@netbsd.org,
    netbsd-bugs@netbsd.org
Subject: re: port-powerpc/43042: frexp(), ldexp() and modf() are missing from powerpc64 libm/libc
Date: Sun, 28 Mar 2010 18:06:36 +1100

 this problem doesn't seem to occur anymore, with no patches:

 /var/obj/macppc/usr/src/gnu/usr.bin/groff/src/preproc/grn/grn: ELF 64-bit MSB executable, 64-bit PowerPC or cisco 7500, version 1 (SYSV), dynamically linked (uses shared libs), for NetBSD 5.99.24, not stripped

 and:

 > nm /var/obj/macppc/usr/src/lib/libc/libc.so | grep -w 'modf|ldexp|frexp'
 00000000000b2b2c T .frexp
 00000000000b2a88 T .ldexp
 00000000000b2764 T .modf
 000000000017a298 D frexp
 000000000017a280 D ldexp
 000000000017a238 D modf


 dennis, can you confirm?


 .mrg.

From: Dennis Ferguson <dennis.c.ferguson@gmail.com>
To: gnats-bugs@NetBSD.org
Cc: mrg@NetBSD.org,
 gnats-admin@netbsd.org,
 netbsd-bugs@netbsd.org
Subject: Re: port-powerpc/43042: frexp(), ldexp() and modf() are missing from powerpc64 libm/libc
Date: Sun, 28 Mar 2010 16:02:56 +0800

 > this problem doesn't seem to occur anymore, with no patches:

 Here's what I get with the patch removed from the libc
 Makefile and added to the libm Makefile in a clean tree
 with all object files removed first:

 % powerpc64--netbsd-nm obj/destdir.macppc/lib/libc.so | egrep =
 'modf|ldexp|frexp'
 % powerpc64--netbsd-nm obj/destdir.macppc/lib/libm.so | egrep =
 'modf|ldexp|frexp'
 000000000001eda8 T .__ieee754_fmodf
 000000000000f7dc T .fmodf
 000000000000cf00 T .frexp
 00000000000110cc T .frexpf
 000000000000ce5c T .ldexp
 0000000000010e68 T .ldexpf
 000000000000ccec T .modf
 0000000000010c90 T .modff
 0000000000035fa8 D __ieee754_fmodf
 0000000000035348 D fmodf
 0000000000034e98 D frexp
 00000000000356d8 D frexpf
 0000000000034e80 D ldexp
 0000000000035660 D ldexpf
 0000000000034e68 D modf
 0000000000035618 D modff
 %=20

 Might you have built you libc into an obj directory with
 files left over from a previous build which had the patch?
 I've found that if you remove source files from a library
 Makefile sometimes the old .o's don't disappear unless you
 go in and delete them manually.

 Dennis=

From: matthew green <mrg@eterna.com.au>
To: Dennis Ferguson <dennis.c.ferguson@gmail.com>
Cc: gnats-admin@netbsd.org, netbsd-bugs@netbsd.org,
    gnats-bugs@NetBSD.org
Subject: re: port-powerpc/43042: frexp(), ldexp() and modf() are missing from powerpc64 libm/libc
Date: Mon, 29 Mar 2010 10:06:46 +1100


    Might you have built you libc into an obj directory with
    files left over from a previous build which had the patch?

 this is likely it; i see problem after removing libc objdir and
 rebuilding.... thanks.


 .mrg.

From: matthew green <mrg@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/43042 CVS commit: src/lib/libm
Date: Mon, 29 Mar 2010 06:59:42 +0000

 Module Name:	src
 Committed By:	mrg
 Date:		Mon Mar 29 06:59:42 UTC 2010

 Modified Files:
 	src/lib/libm: Makefile

 Log Message:
 build s_frexp.c, s_ldexp.c and s_modf.c here for new platforms, since they
 don't exist as compat functions in libc.

 current list of new platforms: powerpc64.

 from dennis.c.ferguson@gmail.com in PR#43042.  idea to not put compat
 functions into new platforms from drochner@netbsd.


 To generate a diff of this commit:
 cvs rdiff -u -r1.92 -r1.93 src/lib/libm/Makefile

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: mrg@NetBSD.org
State-Changed-When: Mon, 31 May 2010 22:31:56 +0000
State-Changed-Why:
patch commited a couple of months ago.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.