Re: Build with LTO / -flto on macOS

Christoph Berg <myon@debian.org>

From: Christoph Berg <myon@debian.org>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Aleksander Alekseev <aleksander@timescale.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Wolfgang Walther <walther@technowledgy.de>, Peter Eisentraut <peter@eisentraut.org>, Andres Freund <andres@anarazel.de>
Date: 2024-07-19T15:21:05Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Make building with LTO work on macOS

  2. Require memory barrier support.

  3. Require compiler barrier support.

  4. autoconf: Move export_dynamic determination to configure

Re: Tom Lane
> I fear that #2 is actually a pretty serious concern.  I think there
> are a lot of places where we've assumed semi-implicitly that
> compilation file boundaries are optimization barriers, particularly
> around stuff like LWLocks and semaphores.  I don't really want to
> spend time chasing obscure, irreproducible bugs that may appear when
> that assumption gets broken.  I especially don't want to do it just
> because some packager has randomly decided to inject random build
> switches.

Ubuntu enabled -ftlo=auto by default in 22.04, so it has been around
for some time already.

$ dpkg-buildflags
CFLAGS=-g -O2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -ffile-prefix-map=... -flto=auto -ffat-lto-objects -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -fdebug-prefix-map=...

Christoph