Build with LTO / -flto on macOS

From: Wolfgang Walther <walther(at)technowledgy(dot)de>
To: 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: Build with LTO / -flto on macOS
Date: 2024-06-03 14:22:01
Message-ID: 427c7c25-e8e1-4fc5-a1fb-01ceff185e5b@technowledgy.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.

Attached patch fixes that for configure/make.

CC: Tom, who hit the same in [3] and Andres who last touched
--export-dynamic in 9db49fc5bfdc0126be03f4b8986013e59d93b91d.

Will also create an issue upstream for meson, because the logic is
built-in there.

Would be great if this could be back-patched, since this is the same in
all live versions.

Best,

Wolfgang

[1]: https://postgr.es/m/1581936537572-0.post%40n3.nabble.com
[2]:
https://opensource.apple.com/source/ld64/ld64-609/doc/man/man1/ld.1.auto.html
(grep for export_dynamic)
[3]: https://postgr.es/m/21800.1499270547%40sss.pgh.pa.us

Attachment Content-Type Size
v1-0001-Make-building-with-clang-s-LTO-work-on-macOS.patch text/x-patch 3.9 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2024-06-03 14:32:01 Re: Build with LTO / -flto on macOS
Previous Message Andy Fan 2024-06-03 14:20:05 differential test coverage when working on a patch