-
Notifications
You must be signed in to change notification settings - Fork 341
meson: Make private static library symbols local #2969
Conversation
c3b7f1e
to
84ee02d
Compare
Let's expose all of our prefixed symbols. Instead of trying to have fine-grained rules and only expose our public API, let's just expose all symbols that won't cause a conflict. Users won't be able to use the symbols without a proper header declaration anyways. If they go through the process of re-defining wlr_ symbols manually, that's on them if their build breaks. This aligns the rules with [1]. [1]: swaywm#2969
84ee02d
to
6b57c09
Compare
6b57c09
to
58922b3
Compare
Static libraries are not affected by our symbol file, so private symbols are globally visible by default. Use objcopy to make symbols that we do not want to expose local. Closes: swaywm#1892 Closes: swaywm#2952
114106f
to
1ebd785
Compare
Meson lacks support for prelinking on clang. See mesonbuild/meson#8883. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with static libs disabled on Clang on BSD and Arch (waiting for the Meson patch to get in)
Do you want to conditionally disable the feature so that existing static linking workarounds remain possible? |
As you prefer. I don't really like hardcoding specific compilers and Meson versions, but making all Clang builds fail when static libs are enabled isn't nice, especially if we're going to recommend static libs. If we don't set |
What would the idea be here? Prelinking adds an additional linker step which links all objects into a single object, which runs before packing the final I'll make the new feature gcc-only for now, while I look at fixing meson. |
Hrm, indeed. The linker doesn't get invoked when building a static lib. It doesn't seem like Let's just get the CI green for now then, just need to disable |
This allows us to validate the objcopy trick in CI. It's basically free to build both static and shared libraries anyway. We only enable this for GCC builds right now, as Meson currently lacks support for prelinking with other compilers.
1ebd785
to
12ed8c2
Compare
Static linking is now only enabled for GCC in CI. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
Maybe we should add static linking to one of the Sway CI jobs? |
Let's expose all of our prefixed symbols. Instead of trying to have fine-grained rules and only expose our public API, let's just expose all symbols that won't cause a conflict. Users won't be able to use the symbols without a proper header declaration anyways. If they go through the process of re-defining wlr_ symbols manually, that's on them if their build breaks. This aligns the rules with [1]. [1]: #2969
Static libraries are not affected by our symbol file, so private symbols
are globally visible by default.
Use objcopy to make symbols that we do not want to expose local.
Closes: #1892
Closes: #2952