Re: Build with LTO / -flto on macOS

From: walther(at)technowledgy(dot)de
To: Peter Eisentraut <peter(at)eisentraut(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andres Freund <andres(at)anarazel(dot)de>
Subject: Re: Build with LTO / -flto on macOS
Date: 2024-06-03 17:11:14
Message-ID: eb249761-56e2-4e42-a2c5-b9ae18c1ca1f@technowledgy.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Wolfgang Walther:
> Peter:
>> I don't think we explicitly offer LTO builds as part of the make build
>> system, so anyone trying this would do it sort of self-service, by
>> passing additional options to configure or make.  In which case they
>> might as well pass the -export_dynamic option along in the same way?
>
> The challenge is that it defeats the purpose of LTO to pass this along
> to everything, e.g. via CFLAGS. The Makefiles set this in LDFLAGS_EX_BE
> only, so it only affects the backend binary. This is not at all obvious
> and took me quite a while to figure out why LTO silently didn't strip
> symbols from other binaries. It does work to explicitly set
> LDFLAGS_EX_BE, though.

Oh, and more importantly: LDFLAGS_EX_BE is not available on all back
branches. It was only introduced in v16 in preparation for meson. So up
to v15, I would have to patch src/makesfiles/Makefile.darwin to set
export_dynamic.

So back-patching a change like this would certainly help to get LTO
across versions seamlessly - which is what I am trying to achieve while
packaging all versions in nixpkgs / NixOS.

Best,

Wolfgang

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2024-06-03 17:18:21 Re: problems with "Shared Memory and Semaphores" section of docs
Previous Message Tom Lane 2024-06-03 16:57:49 Re: pltcl crashes due to a syntax error