I see more and more people that use hacked kde eclass to add this mystique “kdenewldflags” useflag. What that is supposed to do is quite obvious, the —enable-new-ldflags option that KDE’s configure accepts. Still this is stupid.
Now, I’m not the kind of person to say that something is stupid just because I don’t like it, or I think it’s a bad idea. This is stupid simply because people enabling that have no damn clue of what is supposed to happen, and the same applies for the people adding that hack.
Let’s try to analyse that flag:
dnl Check if the linker supports --enable-new-dtags and --as-needed AC_DEFUN([KDE_CHECK_NEW_LDFLAGS], [ AC_ARG_ENABLE(new_ldflags, AC_HELP_STRING([--enable-new-ldflags], [enable the new linker flags]), kde_use_new_ldflags=$enableval, kde_use_new_ldflags=no) LDFLAGS_AS_NEEDED="" LDFLAGS_NEW_DTAGS="" if test "x$kde_use_new_ldflags" = "xyes"; then LDFLAGS_NEW_DTAGS="" KDE_CHECK_COMPILER_FLAG([Wl,--enable-new-dtags], [LDFLAGS_NEW_DTAGS="-Wl,--enable-new-dtags"],) KDE_CHECK_COMPILER_FLAG([Wl,--as-needed], [LDFLAGS_AS_NEEDED="-Wl,--as-needed"],) fi AC_SUBST(LDFLAGS_AS_NEEDED) AC_SUBST(LDFLAGS_NEW_DTAGS) ])
this is the code triggered by ./configure -enable-new-ldflags that is what kdenewldflags useflag passes.
Do you see something familiar? Yes: the -as-needed flag I wrote so many times about, and that I’m trying to make acceptable for public consumption since a few months now.
So half of what the useflag do is to enable asneeded support, but in a way that is not understandable by ebuild/eclass code, so that filtering and eventually needed fixes aren’t triggered, which is bad.
And what about -eanble-new-dtags? Which immense performance improvements can it give you? None. Niet. Nada. That flag has nothing to do with the generated code, so it does not change performances. What it does is related to the internal structure of ELF files. From the man page:
> This linker can create the new dynamic tags in ELF. But the older ELF systems may not understand them. If you specify enable-new-dtags, the dynamic tags will be created as needed. If you specify dis-able-new-dtags, no new dynamic tags will be created. By default, the new dynamic tags are not created.
> Note that those options are only available for ELF systems.
So one might say that they want the new ELF features, even if they probably have no idea what they are used for (in fact, they are only internal symbols used by the linker and the loader, nothing more, nothing less). This will categorise those people together with people adding enable-new-dtags to their LDFLAGS.
But here enters the part that make the whole thing completely stupid: Gentoo’s binutils are patched to force the new dtags generation! Unless you pass the disable-new-dtags flag, binaries created with our binutils will always use the new dtags.
So to summarise: -Wl,–as-needed is better passed via LDFLAGS, as that way we can handle it in ebuilds. -Wl,–enable-new-dtags is pointless, useless and a stupid idea do pass (makes you look like a moron to developers’ and power users’ eyes). kdenewldflags is the pointless hack ever, and anybody using it should be ashamed of himself (half-joking, just half, really).
So please, do me a favour, stop using that stuff, don’t think that we in KDE herd are silly developers that tries to hinder innovation. We know when it’s time for something, and it will never be time for kdenewldflags.