Re: Build with LTO / -flto on macOS

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: Wolfgang Walther <walther(at)technowledgy(dot)de>, 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 14:32:01
Message-ID: 299832f7-72d0-4d2f-bc15-2f0fa4982b31@eisentraut.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 03.06.24 16:22, Wolfgang Walther wrote:
> Building with clang and -flto on macOS currently fails with errors
> similar to [1]. This is because the --export-dynamic flag is called
> -export_dynamic [2] instead and we have not been passing this variant to
> the linker, so far.

It's probably worth clarifying that this option is needed on macOS only
if LTO is also enabled. For standard (non-LTO) builds, the
export-dynamic behavior is already the default on macOS (otherwise
nothing in PostgreSQL would work).

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?

I don't mind addressing this in PG18, but I would hesitate with
backpatching. With macOS, it's always hard to figure out whether these
kinds of options work the same way going versions back.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Victor Yegorov 2024-06-03 14:41:38 Unexpected results from CALL and AUTOCOMMIT=off
Previous Message Wolfgang Walther 2024-06-03 14:22:01 Build with LTO / -flto on macOS