Commit Graph
942159 Commits
Author SHA1 Message Date
Sam James fad8ff8a45 net-analyzer/wireshark: fix runtime with LTO
Qt's qcompilerdetection.h currently checks for whether -fPIE is being used
along with QT_USE_PROTECTED_VISIBILITY ("reduce relocations", which Qt
automatically uses if supported). It bails out if -fPIE is used, as -fPIC
is required instead.

If LTO is used, when one does something like:
(1) g++ -c -flto -fPIC qtlto.cc
(2) g++     -pie -fPIE qtlto.o -o qtlto

At point (1), the Qt check in the headers fires, and everything is fine,
because we're indeed using -fPIC, and GCC doesn't automatically add -fPIE
when built with --enable-default-pie if -fPIC is present on the command line.

GCC may apply optimisations at this point given Qt is using -mno-direct-extern-access
and it was built with -fPIC not -fPIE.

Later, at point (2), -fPIE is passed. This happens in Wireshark because
`CMAKE_POSITION_INDEPENDENT_CODE` gets set in CMakeLists.txt. With LTO,
there's no opportunity for the Qt sanity check in headers to fire again,
as everything is already long-preprocessed and GCC will have applied some
optimisations already assuming the -fPIC code model in (1). But as slyfox
says at https://bugs.gentoo.org/754021#c12, GCC merges -fPIC -fPIE to -fPIE
at LTO-time (-fPIC coming from the earlier LTO object in (1), and -fPIE
was just-passed on the command line).

qtlto (or Wireshark) then crashes. For Wireshark, this looks like:
```
 #0  0x00007ff40e529cf0 in QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> >::get (this=<optimized out>)
     at /usr/src/debug/dev-qt/qtbase-6.8.3/qtbase-everywhere-src-6.8.3/src/corelib/tools/qscopedpointer.h:112
 #1  qGetPtrHelper<QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> > > (ptr=<optimized out>)
     at /usr/src/debug/dev-qt/qtbase-6.8.3/qtbase-everywhere-src-6.8.3/src/corelib/global/qtclasshelpermacros.h:128
 #2  QObject::d_func (this=<optimized out>) at /usr/src/debug/dev-qt/qtbase-6.8.3/qtbase-everywhere-src-6.8.3/src/corelib/kernel/qobject.h:108
 #3  QObjectPrivate::get (o=<optimized out>) at /usr/src/debug/dev-qt/qtbase-6.8.3/qtbase-everywhere-src-6.8.3/src/corelib/kernel/qobject_p.h:150
 #4  doActivate<false> (sender=0x0, signal_index=9, argv=argv@entry=0x7ffe59a73c30) at /usr/src/debug/dev-qt/qtbase-6.8.3/qtbase-everywhere-src-6.8.3/src/corelib/kernel/qobject.cpp:4003
 #5  0x00007ff40e4d2809 in QMetaObject::activate
     (sender=<optimized out>, m=m@entry=0x7ff40f44f6c0 <QGuiApplication::staticMetaObject>, local_signal_index=local_signal_index@entry=1, argv=argv@entry=0x7ffe59a73c30)
     at /usr/src/debug/dev-qt/qtbase-6.8.3/qtbase-everywhere-src-6.8.3/src/corelib/kernel/qobject.cpp:4183
 #6  0x00007ff40ead5676 in QGuiApplication::screenAdded (this=<optimized out>, _t1=<optimized out>)
[...]
```

We need to drop -fPIE somehow at link-time accordingly. There's a few
ways of doing this but I've gone for not calling `check_pie_supported()`
(see (7) below).

(Analysis on fixing this in other packages may depend on whether any static
libraries *installed* by CMake where -fPIC was no longer passed for those,
we would have a problem. I'd tried to use POSITION_INDEPENDENT_CODE at first
but then -fPIC gets dropped as well everywhere, and setting the target
property to false for just the Wireshark executable also doesn't work
because it'll pass -no-pie which isn't what we want.)

There are some questions:
(3) Why doesn't this happen with Clang, given that Clang has -fno-direct-access-external-data
    (equivalent to GCC's -mno-direct-extern-access), even when Qt is built
    with bfd (not lld)?

    The answer seems to be that Clang doesn't implement the optimisation
    yet to avoid copy-relocations where possible. GCC implemented that in
    5.x in r5-5573-g77ad54d911dd7c.

(4) Why doesn't this (seem to) happen in other distributions?

    nextcloud-client suffers from the same issue analysed here, see
    https://bugs.gentoo.org/933110. The upstream bug at https://github.com/nextcloud/desktop/issues/2790
    was reported by a Debian developer (cgzones), so it's a reasonable assumption
    that it can happen on Debian.

    Debian is one of few distributions (we're another) to use --enable-default-pie
    in GCC rather than just passing it to all package builds in the package manager:
    it's possible that some distros are just disabling -fPIE or adding a workaround
    like we did for https://bugs.gentoo.org/552440. Not many distros build
    with LTO either.

    Debian also stopped building Wireshark with LTO because of a bug in Wireshark
    itself (https://bugs.gentoo.org/941890), so I guess they disabled LTO
    and didn't notice this crash.

    (This is enough for me to be more confident in my analysis, anyway.)

(5) Could Qt communicate this somehow automatically?

    I think it might be able to if statically linking Qt and Qt was built
    with LTO.

    Otherwise, I think the only option would be an ELF .note. pkg-config
    could maybe work but you can't assume all Qt consumers use that...

    See the discussion around <https://bugreports.qt.io/browse/QTBUG-45755?focusedId=282483&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-282483>:
    > Thiago Macieira added a comment - 22 May '15 17:11
    > There aren't that many autoconf-based Qt5 builds and we've never exported the flag anyway.

    (It might be worth bringing this .note idea up to Thiago and/or H.J. but
    I'm not sure yet if it'll work.)

    On the Qt side, -fPIC gets passed in to various places before because
    Qt's CMake config files have INTERFACE_COMPILE_OPTIONS w/ -fPIC. Maybe
    the answer is for Qt packages to never use CMAKE_POSITION_INDEPENDENT_CODE
    instead. This came up in https://gitlab.kitware.com/cmake/cmake/-/issues/15570.

(6) Could we just disable "reduce relocations" in Qt itself, given that
    the workaround here will need to be applied in various Qt consumers?

    This would significantly impact startup times of applications using Qt
    and there don't seem to be too many applications doing this (only 2
    known so far in Gentoo: Wireshark and nextcloud-client).

(7) Is the mechanism used to fix this brittle?

    Yes, we're relying on a CMake bug/feature for now at https://gitlab.kitware.com/cmake/cmake/-/issues/25588
    so it doesn't try to enable *or* disable PIE at link-time and we can
    just rely on our toolchain defaults.

Thanks to Arusekk for producing a minimal example and reporting it upstream
to Wireshark, thanks to slyfox for analysing the interaction with LTO, thanks
to Holger for the discussion around it and testing, and thanks to Eli for
reviewing the commit message.

Bug: https://bugs.gentoo.org/552440
Bug: https://bugs.gentoo.org/754021
Bug: https://bugs.gentoo.org/933110
Bug: https://bugs.gentoo.org/941890
Bug: https://gitlab.kitware.com/cmake/cmake/-/issues/15570
Bug: https://gitlab.kitware.com/cmake/cmake/-/issues/25588
Bug: https://gitlab.kitware.com/cmake/cmake/-/issues/23980
Bug: https://gitlab.com/wireshark/wireshark/-/issues/17040
Bug: https://bugreports.qt.io/browse/QTBUG-45755
Bug: https://bugreports.qt.io/browse/QTBUG-47942
Bug: https://gcc.gnu.org/PR65248
Bug: https://gcc.gnu.org/PR65886
Thanks-to: Arusekk <arek_koz@o2.pl>
Thanks-to: Sergei Trofimovich <slyfox@gentoo.org>
Thanks-to: Holger Hoffstätte <holger@applied-asynchrony.com>
Thanks-to: Eli Schwartz <eschwartz@gentoo.org>
Signed-off-by: Sam James <sam@gentoo.org>
2025-04-18 05:23:01 +01:00
Michael Orlitzky c97c57985d sci-mathematics/lcalc: try elibtoolize to fix bug 953363
Bug: https://bugs.gentoo.org/953363
Signed-off-by: Michael Orlitzky <mjo@gentoo.org>
2025-04-18 00:15:52 -04:00
Michał Górny 367e3523ed media-libs/glycin-loaders: Bump to 1.2.1
Signed-off-by: Michał Górny <mgorny@gentoo.org>
2025-04-18 05:28:05 +02:00
Michał Górny 7b5cc9054c dev-python/elasticsearch: Bump to 9.0.0
Signed-off-by: Michał Górny <mgorny@gentoo.org>
2025-04-18 05:11:14 +02:00
Michał Górny e3b7478d7a dev-python/xlsxwriter: Bump to 3.2.3
Signed-off-by: Michał Górny <mgorny@gentoo.org>
2025-04-18 05:11:13 +02:00
Michał Górny 189f8e6de6 dev-python/mkdocs-material: Bump to 9.6.12
Signed-off-by: Michał Górny <mgorny@gentoo.org>
2025-04-18 05:11:12 +02:00
Michał Górny a94aa668f0 dev-python/fixtures: Bump to 4.2.5
Signed-off-by: Michał Górny <mgorny@gentoo.org>
2025-04-18 05:11:11 +02:00
Michał Górny 1d55f0f816 dev-python/calver: Bump to 2025.4.17
Signed-off-by: Michał Górny <mgorny@gentoo.org>
2025-04-18 05:11:11 +02:00
Michał Górny 2973b5f54a dev-python/calver: Remove old
Signed-off-by: Michał Górny <mgorny@gentoo.org>
2025-04-18 05:11:10 +02:00
Michał Górny ecf3cd3730 dev-python/reportlab: Remove old
Signed-off-by: Michał Górny <mgorny@gentoo.org>
2025-04-18 05:11:09 +02:00
Michał Górny 1786f7c60d dev-python/sqlglot: Bump to 26.15.0
Signed-off-by: Michał Górny <mgorny@gentoo.org>
2025-04-18 05:11:08 +02:00
Michał Górny 787ad35653 dev-python/pydantic-core: Bump to 2.34.1
Signed-off-by: Michał Górny <mgorny@gentoo.org>
2025-04-18 05:11:07 +02:00
Michał Górny 1e8e52386d dev-python/frozenlist: Bump to 1.6.0
Signed-off-by: Michał Górny <mgorny@gentoo.org>
2025-04-18 05:11:06 +02:00
Michał Górny 187d3579b9 dev-python/nanobind: Bump to 2.7.0
Signed-off-by: Michał Górny <mgorny@gentoo.org>
2025-04-18 05:11:05 +02:00
Michał Górny d21c204666 dev-python/hypothesis: Bump to 6.131.2
Signed-off-by: Michał Górny <mgorny@gentoo.org>
2025-04-18 05:11:05 +02:00
Michał Górny 208744218c dev-python/s3transfer: Bump to 0.11.5
Signed-off-by: Michał Górny <mgorny@gentoo.org>
2025-04-18 05:11:04 +02:00
Michał Górny 5aa9f9628b app-admin/awscli: Bump to 1.38.36
Signed-off-by: Michał Górny <mgorny@gentoo.org>
2025-04-18 05:11:03 +02:00
Michał Górny dcc364b4ff dev-python/boto3: Bump to 1.37.36
Signed-off-by: Michał Górny <mgorny@gentoo.org>
2025-04-18 05:11:02 +02:00
Michał Górny f95bd3f109 dev-python/botocore: Bump to 1.37.36
Signed-off-by: Michał Górny <mgorny@gentoo.org>
2025-04-18 05:11:01 +02:00
Michael Orlitzky aa08c6df4b net-analyzer/nagios-plugins: add USE=nls, work around NLS build fail
You're never going to guess who reported the new build failure
from bug 953411 in September of 2024:

  https://github.com/nagios-plugins/nagios-plugins/issues/786

Closes: https://bugs.gentoo.org/953411
Signed-off-by: Michael Orlitzky <mjo@gentoo.org>
2025-04-17 22:58:13 -04:00
Ionen Wolkens dadbd3b98f sys-auth/elogind: enable py3.13 in old version
The latest is still masked on musl profiles, so need to do this
one as well. Seems fine with 3.13 at a glance, not that going to
test much for this old version.

Revbump is due to python-any-r1 PYTHON_USEDEP deps and needing
to ensure that users' VDB is updated to avoid conflicts.

Signed-off-by: Ionen Wolkens <ionen@gentoo.org>
2025-04-17 21:34:10 -04:00
Patrick McLean e5db8d5eb1 app-misc/zellij: add 0.42.2
Signed-off-by: Patrick McLean <chutzpah@gentoo.org>
2025-04-17 16:52:41 -07:00
James Le Cuirot 59f8405ed2 games-util/acc: Patch to fix build with CMake 4
Thanks to NHOrus for their help with this.

Closes: https://bugs.gentoo.org/951932
Closes: https://github.com/gentoo/gentoo/pull/41267
Signed-off-by: James Le Cuirot <chewi@gentoo.org>
2025-04-17 23:06:42 +01:00
James Le Cuirot eb87fe67d8 www-client/vivaldi: Drop old 7.3.3635.7
Signed-off-by: James Le Cuirot <chewi@gentoo.org>
2025-04-17 22:59:45 +01:00
James Le Cuirot 88447c99e5 www-client/vivaldi: Stabilise 7.3.3635.9 on amd64
Signed-off-by: James Le Cuirot <chewi@gentoo.org>
2025-04-17 22:59:33 +01:00
James Le Cuirot 793634f748 www-client/vivaldi: Add version 7.3.3635.11
Signed-off-by: James Le Cuirot <chewi@gentoo.org>
2025-04-17 22:58:48 +01:00
James Le Cuirot 0a8a167e7c www-client/vivaldi-snapshot: Drop old 7.4.3653.3
Signed-off-by: James Le Cuirot <chewi@gentoo.org>
2025-04-17 22:58:14 +01:00
James Le Cuirot 23bdbdcb40 www-client/vivaldi-snapshot: Add version 7.4.3664.3
Signed-off-by: James Le Cuirot <chewi@gentoo.org>
2025-04-17 22:56:58 +01:00
Patrick McLean 1db6b77c17 dev-util/ruff: drop 0.11.5
Signed-off-by: Patrick McLean <chutzpah@gentoo.org>
2025-04-17 14:43:12 -07:00
Sam James d1fc90d7c9 dev-libs/elfutils: Stabilize 0.192-r1 arm, #953967
Signed-off-by: Sam James <sam@gentoo.org>
2025-04-17 22:42:07 +01:00
Sam James d5a8787e81 dev-libs/elfutils: Stabilize 0.192-r1 arm64, #953967
Signed-off-by: Sam James <sam@gentoo.org>
2025-04-17 22:42:05 +01:00
Sam James c82266e7f0 dev-libs/elfutils: Stabilize 0.192-r1 ppc64, #953967
Signed-off-by: Sam James <sam@gentoo.org>
2025-04-17 22:42:04 +01:00
Andreas Sturmlechner 1822940747 dev-db/sqlitestudio: drop 3.4.4-r1
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2025-04-17 23:31:02 +02:00
Patrick McLean 130946276e dev-util/ruff: add 0.11.6
Signed-off-by: Patrick McLean <chutzpah@gentoo.org>
2025-04-17 14:17:17 -07:00
Andreas Sturmlechner 5ab165af15 sys-libs/kpmcore: 25.04.0 version bump
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2025-04-17 23:00:54 +02:00
Andreas Sturmlechner dad192f271 sys-block/partitionmanager: 25.04.0 version bump
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2025-04-17 23:00:54 +02:00
Andreas Sturmlechner c31ae55ad7 kde-misc/markdownpart: 25.04.0 version bump
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2025-04-17 23:00:54 +02:00
Andreas Sturmlechner a78a00b9ee kde-misc/kweather: 25.04.0 version bump
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2025-04-17 23:00:54 +02:00
Andreas Sturmlechner b1facd2fdf kde-misc/kclock: 25.04.0 version bump
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2025-04-17 23:00:53 +02:00
Andreas Sturmlechner 8075868a14 kde-apps/yakuake: 25.04.0 version bump
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2025-04-17 23:00:53 +02:00
Andreas Sturmlechner 0dd8125bca kde-apps/sweeper: 25.04.0 version bump
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2025-04-17 23:00:53 +02:00
Andreas Sturmlechner 94b9cffc50 kde-apps/kwalletmanager: 25.04.0 version bump
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2025-04-17 23:00:53 +02:00
Andreas Sturmlechner 7a3463db26 kde-apps/ktimer: 25.04.0 version bump
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2025-04-17 23:00:53 +02:00
Andreas Sturmlechner 2a4a118487 kde-apps/kteatime: 25.04.0 version bump
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2025-04-17 23:00:52 +02:00
Andreas Sturmlechner d35c2d5af9 kde-apps/kimagemapeditor: 25.04.0 version bump
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2025-04-17 23:00:52 +02:00
Andreas Sturmlechner feed62e64b kde-apps/kgpg: 25.04.0 version bump
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2025-04-17 23:00:52 +02:00
Andreas Sturmlechner ecda434a5f kde-apps/kdf: 25.04.0 version bump
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2025-04-17 23:00:52 +02:00
Andreas Sturmlechner f5b6adf2ad kde-apps/kdeutils-meta: 25.04.0 version bump
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2025-04-17 23:00:51 +02:00
Andreas Sturmlechner d326636978 kde-apps/kdebugsettings: 25.04.0 version bump
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2025-04-17 23:00:51 +02:00
Andreas Sturmlechner fdd2b47079 kde-apps/kcharselect: 25.04.0 version bump
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2025-04-17 23:00:51 +02:00