From owner-svn-src-head@freebsd.org Fri Oct 14 03:25:17 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D6EFC10163; Fri, 14 Oct 2016 03:25:17 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by mx1.freebsd.org (Postfix) with ESMTP id 2EE7AA46; Fri, 14 Oct 2016 03:25:16 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c110-21-100-78.carlnfd1.nsw.optusnet.com.au [110.21.100.78]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id 3CE9710425F2; Fri, 14 Oct 2016 14:02:48 +1100 (AEDT) Date: Fri, 14 Oct 2016 14:02:47 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Ed Maste cc: Bruce Evans , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r307231 - head/lib/libgcc_s In-Reply-To: Message-ID: <20161014132243.M1338@besplex.bde.org> References: <201610131918.u9DJI0bX085695@repo.freebsd.org> <20161014113603.F1039@besplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=RIxOZNW+ c=1 sm=1 tr=0 a=uGjuzT6u7JdBDS7kH8taPg==:117 a=uGjuzT6u7JdBDS7kH8taPg==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=nd2t5aUcH_zjbgAxzD4A:9 a=CjuIK1q_8ugA:10 a=Oa0T6EYmKFNB-xRHvYM1:22 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Oct 2016 03:25:17 -0000 On Fri, 14 Oct 2016, Ed Maste wrote: > Hi Bruce, thank you for the detailed response. > > On 14 October 2016 at 01:53, Bruce Evans wrote: >>> compiler-rt's complex division support routines contain calls to >>> compiler builtins such as `__builtin_scalbnl`. Unfortunately Clang >>> turns these back into a call to `scalbnl`. >> >> gcc-4.2 has the same bug. > > Oh, interesting. Do you know off hand if it's resolved in later GCC? Don't know. > It seems particularly unfortunate for the compiler to report (by > whatever mechanism) that a builtin exists, and then just turn that > builtin into a library call. Since there is no documentation, I sometimes use strings -a | grep builtin on the compiler binary to find builtins. This finds that there are too many for clang (4655 lines starting with __builtin for the amd64 binary). Then write some code to see if they are actual builtins. >>> For now link libm's C version of the required support routines. >> >> Even libm doesn't use these in some cases. i386 mostly uses asm >> versions. Hopefully the rt division routines don't need to be efficient >> because they are rarely called. > > Most likely I'll switch to the asm versions across suitable > architectures in a subsequent change, mirroring the choices made in > libm. I just wanted to get a version in, to enable further testing > (ports exp-runs, etc.) of this libunwind / compiler-rt combination. The ifdefs in the makefiles might get complicated sonce it was not designed for this. I usually build libm stand-alone, often with older compilers, and don't like any dependencies on other libraries or includes in it (I use stub libraries and includes). scalbn() is also in libc under the name ldexp(). This causes various messes. It used to have clones of a C implementation in alpha, amd64, arm, i386, ia64, powerpc and sparc64 (where at least the i386 version is in inline asm). This was cleaned up by removing all the MD implementations and using 1 generic C implementation with no inline asm. Then it was uncleaned by adding an extern asm version for mips. But the mips Makefile doesn't use this, except possibly by a magic .c.S suffix translation. The msun Makefiles have the relatively minor magic for suffixes. (They list the .c and .S file and then remove the .c file from the final list.) Bruce