Re: Build with LTO / -flto on macOS - Mailing list pgsql-hackers

From walther@technowledgy.de
Subject Re: Build with LTO / -flto on macOS
Date
Msg-id eb249761-56e2-4e42-a2c5-b9ae18c1ca1f@technowledgy.de
Whole thread Raw
In response to Re: Build with LTO / -flto on macOS  (Wolfgang Walther <walther@technowledgy.de>)
List 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



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: pltcl crashes due to a syntax error
Next
From: Nathan Bossart
Date:
Subject: Re: problems with "Shared Memory and Semaphores" section of docs