-
Notifications
You must be signed in to change notification settings - Fork 340
Conversation
On my 3.5 GHz CPU, using your numbers, this would save us about 0.001 seconds. I've said no to this before and I'm going to say no to it again. |
Part of it is also not accidentally exporting functions or running into symbol collisions. Another example is os_create_anonymous_file. Our examples are reaching into the library internals, and using a function that we don't have in our headers. This creates a much more explicit and clean separation for the library. There is a good reason that like 99% of libraries do this. |
Propose it for standardization. Until then, no. |
It's part of the ELF standard. |
Halfway there! |
Do you have an actual technical reason for rejecting this? Yes, non-standard shit isn't good, but it's hidden behind a feature test macro, and we've already have a __GNUC__ test in log.h since basically the very beginning. |
I don't use nonstandard features. That test in log.h really bothers me, I shouldn't have agreed to it. |
The benefits outweigh the consequences. The only tangible downside is a "bad feeling". The log.h one gives us extra warnings, which prevents a whole bunch of pointless bugs. |
No, the tangible downside is encourange the use of and proliferation of nonstandard features, which I am staunchly against and always have been. You know how this PR was going to go down. Why did you even bother? Just to create animosity? |
I think we need to remove the pretence that our code is portable and standards conforming. There is all sorts of VERY Linux-specific shit we're doing, but you're not complaining because instead of being behind __GNUC__, they're being disabled by __FreeBSD__. I just don't think this "absolutely portable" argument holds any weight. We're even using other non-standard shit like ## comma deletion and empty variadic macros. Maybe it'll be more relevant when -Wpedantic comes up clean. I'm not saying that we should go around making everything non-portable; our effort to make things more portable made it even possible for this to run on FreeBSD. I just think there are certain exceptions which are justified, because they provide extremely useful features. Especially things as benign as this and __attribute__((printf)). |
There are several kinds of portability. There's OS portability, libc portability, and compiler portability, to name a few important ones. The nature of this beast is that we aren't gonna get OS portability simply because the whole point is to leverage OS-specific features. But I'll be damned if we're gonna give up on libc or compiler portability, too.
Let's file tickets and get this fixed. |
That is going to break probably 50% of our calls to wlr_log, and make it way harder to use. |
We don't need to change wlr_log right away. The value-add of that one is much higher than of ELF visibility, so it's easier for me to look the other way. |
That's why feature test macros exist.
Sure, this isn't the most significant of improvements, but preventing Funnily enough, you can't even hide ## behind macros, but you can for this. It's quite the double standard. |
I was willing to consider dropping warnings for wlr_log, but we need to use ## for the filename and line number which is a really damn compelling feature. If we're going to let it slide a little, then we might as well do this too. But let the record state that I think this sucks. |
What about using a symbols file here instead: ftp://ftp.gnu.org/old-gnu/Manuals/ld-2.9.1/html_node/ld_25.html or in actual use: https://github.com/libvirt/libvirt/blob/master/src/libvirt_admin_private.syms This prevents cluttering the C file and is supported by GNUs ld as well as lld. https://releases.llvm.org/3.9.0/tools/lld/docs/ReleaseNotes.html#symbol-versioning We could simply make wlr_* public and everything else private and at a later point introduce actual versions if needed. |
I wonder if |
That sounds better to me, agx. |
This explicitly exports API functions, and sets the default visibility to hidden.
It's a pretty typical and recommended thing for libraries to do.
Yes, it requires a GNU extension (appropriately hidden behind a feature test macro), but I believe this is a justified exception.
Compiled with
-Dbuildtype=minsize -Db_lto=true
and opening rootstonWith patch:
436K libwlroots.so.0.0.0
Without patch:
460K libwlroots.so.0.0.0
As you can see, it makes loading libwlroots a fair bit faster, and makes the final binary a little bit smaller.
It may also be faster, because the LTO can do more, but I have not benchmarked this.