Re: Bug fix for glibc broke freebsd build in REL_11_STABLE

From: Andres Freund <andres(at)anarazel(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>, Victor Wagner <vitus(at)wagner(dot)pp(dot)ru>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Bug fix for glibc broke freebsd build in REL_11_STABLE
Date: 2018-09-04 23:18:48
Message-ID: 20180904231848.bxflc34zzhtzqrr2@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2018-09-04 19:02:02 -0400, Tom Lane wrote:
> Andres Freund <andres(at)anarazel(dot)de> writes:
> > ... Note that we've previously encountered similar issues
> > on gcc, which is why we've tried to force gcc's hand with
> > -fexcess-precision=standard.
>
> Right. Annoying that clang doesn't have that. We can't realistically
> program around an issue that might or might not show up depending on the
> whims of the compiler's register allocation.

Right.

> > I kinda wonder if we should add -mno-x87 or such in configure when we
> > detect clang, obviously it doesn't deal correctly with this.
>
> Seems worth looking into, but what happens if someone tries to compile
> for x87 hardware? Or do we care anymore?

It generates linker errors:

clang-8 -std=gnu99 -march=i386 -O2 -m32 -mno-x87 ~/tmp/flttst.c -o ~/tmp/flttst && ~/tmp/flttst
/usr/bin/ld: /tmp/flttst-ba93f5.o: in function `main':
flttst.c:(.text+0x37): undefined reference to `__muldf3'
/usr/bin/ld: flttst.c:(.text+0x67): undefined reference to `__gedf2'
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I think we only should add the flag when detecting clang, so a user with
just a < pentium-4 could resort to gcc. Although honestly, I don't
think that's really something usefully to cater for.

The one hangup I have with this is that clang on *bsd defaults to i486
(and thus x87) when compiling 32bit binaries. That's obviously
*terrible* for performance, but it'd still be annoying for some users.
While I don't immediately know how, that seems like an argument for
doing this in configure, and suggesting a better compiler flag.

Greetings,

Andres Freund

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2018-09-04 23:34:36 Re: Prevent concurrent DROP SCHEMA when certain objects are being initially created in the namespace
Previous Message Michael Paquier 2018-09-04 23:14:15 Re: test_pg_dump missing cleanup actions