Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add -export_dynamic flag for AppleDynamicLinker #13291

Merged
merged 1 commit into from
Jun 4, 2024

Conversation

wolfgangwalther
Copy link
Contributor

The apple linker uses -export_dynamic instead of --export-dynamic 1. This should be set when setting export_dynamic: true.

Resolves #13290

The apple linker uses -export_dynamic instead of --export-dynamic [1].
This should be set when setting export_dynamic: true.

Resolves mesonbuild#13290

[1]:
https://opensource.apple.com/source/ld64/ld64-609/doc/man/man1/ld.1.auto.html
@wolfgangwalther wolfgangwalther requested a review from jpakkane as a code owner June 3, 2024 16:16
@wolfgangwalther
Copy link
Contributor Author

I assume the two CI failures are not related - all other PRs seem to have them, too.

@tristan957
Copy link
Contributor

Any idea if this has been the case for every version of the linker? Or has Meson just been wrong the whole time?

@wolfgangwalther
Copy link
Contributor Author

Any idea if this has been the case for every version of the linker? Or has Meson just been wrong the whole time?

There's more on that in the thread here: https://www.postgresql.org/message-id/flat/427c7c25-e8e1-4fc5-a1fb-01ceff185e5b%40technowledgy.de

So essentially:

  • This flag is more important on Linux / GNU / LLVM, because those symbols are not exported by default here. So even without -flto this is required there. This part, meson has been doing.
  • Apple's linker does export them by default already, so many cases are covered - but not anymore with -flto.
  • This was introduced in ld64-224.1 around the year 2011. This is the first man page it appears in.

So yes, meson has not been covering this case for a while.

@tristan957
Copy link
Contributor

Thanks for that awesome write up.

@jpakkane jpakkane merged commit dfd22db into mesonbuild:master Jun 4, 2024
31 of 33 checks passed
@wolfgangwalther wolfgangwalther deleted the export-dynamic-apple branch June 5, 2024 09:44
@barracuda156
Copy link
Contributor

@wolfgangwalther @tristan957 Is it possible to make this conditional on the macOS version being 10.7+? This flag is not supported on 10.6 and below, and adding it breaks the build of anything where it is appended. glib2 is broken now on 10.6, for example: https://trac.macports.org/ticket/70386

@tristan957
Copy link
Contributor

Yes. Please submit a PR

@barracuda156
Copy link
Contributor

@tristan957 Could you say how to check for [build] macOS version?

@tristan957
Copy link
Contributor

The class has a version attribute/function most likely. You can then do a version comparison.

wolfgangwalther added a commit to wolfgangwalther/meson that referenced this pull request Aug 17, 2024
The flag was only introduced in ld 224.1, as mentioned in the initial PR
mesonbuild#13291.

Resolves mesonbuild#13543
wolfgangwalther added a commit to wolfgangwalther/meson that referenced this pull request Aug 17, 2024
The flag was only introduced in ld 224.1, as mentioned in the initial PR
mesonbuild#13291.

Resolves mesonbuild#13543
@wolfgangwalther
Copy link
Contributor Author

This flag is not supported on 10.6 and below

10.7 was released in July 2011, which matches my observation from above:

This was introduced in ld64-224.1 around the year 2011. This is the first man page it appears in.

I opened #13557 to fix it.

dcbaker pushed a commit that referenced this pull request Aug 20, 2024
The flag was only introduced in ld 224.1, as mentioned in the initial PR
#13291.

Resolves #13543
eli-schwartz pushed a commit that referenced this pull request Sep 16, 2024
The flag was only introduced in ld 224.1, as mentioned in the initial PR
#13291.

Resolves #13543

(cherry picked from commit 7280639)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support export_dynamic on macOS
4 participants