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 <b...@optusnet.com.au> 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.)

svn-src-all@freebsd.org mailing list
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to