Skip to content

treewide: rework libatomic dependencies with ATOMIC64_DEPENDS - #30517

Merged
dangowrt merged 18 commits into
openwrt:masterfrom
dangowrt:atomic64-depends
Sep 16, 2026
Merged

dangowrt merged 18 commits into
openwrt:masterfrom
dangowrt:atomic64-depends

Conversation

@dangowrt

@dangowrt dangowrt commented Sep 13, 2026

Copy link
Copy Markdown
Member

📦 Package Details

Maintainers: @nmeyerhans , @dangowrt , @nmav, @flyn-org , @salzmdan , @mhei , @luizluca , @val-kulkov , @commodo, @neheb and others:

Description:
Follow-up to openwrt/openwrt#25112, which added HAS_ATOMIC64 and ATOMIC64_DEPENDS:=+!HAS_ATOMIC64:libatomic: the compiler calls libatomic for 64-bit atomics only on mips, mipsel, powerpc and ARM below ARMv6K, so a package needs the dependency exactly there and nowhere else. This PR reworks every package in this feed that depends on libatomic, one commit per package, according to what its built binaries actually import (checked with readelf -DWs on the packaged files):

  • imports 64-bit atomics on mips (bind, gnunet, gstreamer1, nanomq, netatalk, nfdump, python3, rtorrent, ruby, srt, sysrepo, ustreamer): +libatomic or an open-coded architecture list becomes $(ATOMIC64_DEPENDS). nanomq, sysrepo and ustreamer additionally link with --as-needed because their build systems link libatomic on every architecture, which would otherwise leave a NEEDED libatomic.so.1 without a dependency on x86_64 and fail the packaging check.
  • links libatomic without using it (openal-soft, php8): the dependency is dropped and the build links with --as-needed. php8's +riscv64:libatomic came from PHP's own configure probe, which references __atomic_exchange_1 as a plain function and therefore always resolves to -latomic on riscv64.
  • never links libatomic (gnutls, knot, libopen62541, udpspeeder): the dependency is dropped.

The old lists also named the removed arc architecture (ruby) and missed ARMv5 (comrade, not touched here since its current upstream version has no libatomic dependency).


🧪 Run Testing Details

  • OpenWrt Version: main at openwrt/openwrt@80aff35 (snapshot SDK r36222 with the merged core change applied)
  • OpenWrt Target/Subtarget: ramips/mt7621 (no HAS_ATOMIC64) and x86/64 (HAS_ATOMIC64), SDK builds of every package: on mt7621 the packages that import 64-bit atomics depend on and link libatomic1, the others carry no NEEDED libatomic.so.1 any more; on x86/64 no package links libatomic and every package passes the packaging dependency check
  • OpenWrt Device: none, build and packaging tests only

✅ Formalities

  • I have reviewed the CONTRIBUTING.md file for detailed contributing guidelines.

If your PR contains a patch:

  • It can be applied using git am
  • It has been refreshed to avoid offsets, fuzzes, etc., using
    make package/<your-package>/refresh V=s
  • It is structured in a way that it is potentially upstreamable
    (e.g., subject line, commit description, etc.)
    We must try to upstream patches to reduce maintenance burden.

@openwrt

openwrt Bot commented Sep 13, 2026

Copy link
Copy Markdown

Formality Check: Suggestions Available

We checked this pull request against the contribution guidelines. Here is what needs your attention:

⚠️ STYLISTIC WARNINGS & SUGGESTIONS

Package Release Audit:

  • ⚠️ Package release bump audit skipped: PR modifies 18 packages. Batch updates of >15 packages are not automatically audited to prevent hitting API rate/subrequest limits.

Package Hash Audit:

  • ⚠️ Package hash audit skipped: PR modifies 18 Makefiles. Batch updates of >15 Makefiles are not automatically audited to prevent hitting API rate/subrequest limits.

Something broken? Consider reporting an issue.
Running version 059e3de deployed on 2026-09-09 11:53:18 CEST

@dangowrt

dangowrt commented Sep 13, 2026

Copy link
Copy Markdown
Member Author

CI note: the failing build jobs on the 32-bit targets (mips, mipsel, powerpc, ARMv5) are expected until the snapshot SDKs include openwrt/openwrt@e23f575. The current SDKs (r36237 and older) predate that commit, so ATOMIC64_DEPENDS expands to nothing there, the packages lose their libatomic dependency and the packaging check rejects the NEEDED libatomic.so.1, exactly the failure mode this change is meant to make impossible once the core side is in. The jobs will be re-run when the next snapshots are out.

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit checks

  • 6009e7f "ustreamer: use ATOMIC64_DEPENDS" — also re-indents the whole Package/ustreamer block from tabs to two spaces; the message mentions only the dependency change.

Generated by Claude Code

Comment thread net/rtorrent/Makefile
TITLE:=BitTorrent client for ncurses
URL:=https://github.com/rakshasa/rtorrent
DEPENDS:=+libcurl +libncurses +libatomic +libopenssl +libstdcpp +zlib
DEPENDS:=+libcurl +libncurses $(ATOMIC64_DEPENDS) +libopenssl +libstdcpp +zlib

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Package rtorrent is missing dependencies for the following libraries:
libatomic.so.1
make[2]: *** [Makefile:99: .../i386_pentium-mmx/packages_ci/rtorrent-0.15.5-r2.apk] Error 1
    ERROR: package/feeds/packages_ci/rtorrent failed to build (build variant: norpc).

i386_pentium-mmx and riscv64_generic (which also stops at package/rtorrent/compile) both select HAS_ATOMIC64, so $(ATOMIC64_DEPENDS) expands to nothing there with or without the core commit — the stale-SDK explanation in the PR comment does not cover these two jobs. rtorrent's link still records DT_NEEDED libatomic.so.1, and the packaging check keys on DT_NEEDED in gen-dependencies.sh:24 rather than on imported symbols, so this package needs the same TARGET_LDFLAGS += -Wl,--as-needed as nanomq/sysrepo/ustreamer. Both jobs aborted here, so the packages built after rtorrent (srt, libopen62541, gnutls, openal-soft, php8, ruby, python3, ustreamer, gstreamer1) were never checked on those two architectures.


Generated by Claude Code

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, thanks — solved by the rebase onto d2a2e7b8 rather than by --as-needed: i386_pentium-mmx now gets past package/rtorrent/compile and through packaging.


Generated by Claude Code

$(call Package/gstreamer1/Default)
TITLE+= library (core)
DEPENDS+= +glib2 +libpthread +libxml2 +(armeb||arm||powerpc||mips||mipsel):libatomic
DEPENDS+= +glib2 +libpthread +libxml2 $(ATOMIC64_DEPENDS)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: the PR body says this reworks every package in this feed that depends on libatomic, but roughly 30 Makefiles still carry a plain +libatomic, and net/samba4/Makefile:66 still has the identical open-coded architecture list being replaced here. Worth narrowing the claim or calling the remainder out as follow-up.


Generated by Claude Code

@BKPepe

BKPepe commented Sep 14, 2026

Copy link
Copy Markdown
Member

CI note: the failing build jobs on the 32-bit targets (mips, mipsel, powerpc, ARMv5) are expected until the snapshot SDKs include openwrt/openwrt@e23f575.

Btw this link does not work.

@dangowrt

Copy link
Copy Markdown
Member Author

Fixed. The full hash in the note was wrong; the commit is openwrt/openwrt@e23f575. The same note on the video and telephony PRs is corrected too.

@nmeyerhans

Copy link
Copy Markdown
Contributor

bind changes look good to me. :shipit:

libatomic is only needed where the compiler does not inline 64-bit
atomics, but the package depends on it on every target.
ATOMIC64_DEPENDS restricts the dependency to those targets.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
libatomic is only needed where the compiler does not inline 64-bit
atomics, but the package depends on it on every target.
ATOMIC64_DEPENDS restricts the dependency to those targets.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
The libraries link nothing from libatomic on any architecture, so the
dependency is unnecessary.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
The open-coded architecture list pulls libatomic onto ARMv6K and ARMv7
targets although they inline 64-bit atomics. ATOMIC64_DEPENDS covers
exactly the targets that need it.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
None of the binaries links libatomic on any architecture, so the
dependency is unnecessary.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
The library links nothing from libatomic on any architecture, so the
dependency is unnecessary.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
The daemon imports 64-bit atomics from libatomic where the compiler
cannot inline them, but the CMake build links the library on every
architecture. ATOMIC64_DEPENDS restricts the dependency to the targets
that need it; --as-needed drops the unused library elsewhere.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
libatomic is only needed where the compiler does not inline 64-bit
atomics, but the package depends on it on every target.
ATOMIC64_DEPENDS restricts the dependency to those targets.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
libatomic is only needed where the compiler does not inline 64-bit
atomics, but the package depends on it on every target.
ATOMIC64_DEPENDS restricts the dependency to those targets.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
The CMake build links libatomic on targets without inline 64-bit
atomics, but libopenal imports no symbol from it. Link with --as-needed
so the unused library is dropped and remove the dependency.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
PHP's configure script probes __atomic_exchange_1 as an external
function on riscv64, which only resolves against libatomic, and so
links the library although no binary references an atomic symbol.
The riscv64-only dependency and linker flag paper over that. Link
with --as-needed so the unused library is dropped and remove both;
mips and riscv64 builds import no atomic symbols.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
libatomic is only needed where the compiler does not inline 64-bit
atomics, but the package depends on it on every target.
ATOMIC64_DEPENDS restricts the dependency to those targets.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
libatomic is only needed where the compiler does not inline 64-bit
atomics, but the package depends on it on every target.
ATOMIC64_DEPENDS restricts the dependency to those targets.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
The open-coded architecture list pulls libatomic onto ARMv6K and ARMv7
targets although they inline 64-bit atomics, and still names the
removed arc architecture. ATOMIC64_DEPENDS covers exactly the targets
that need it.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
libatomic is only needed where the compiler does not inline 64-bit
atomics, but the package depends on it on every target.
ATOMIC64_DEPENDS restricts the dependency to those targets.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
sysrepo-plugind imports 64-bit atomics from libatomic where the
compiler cannot inline them, but the CMake build links the library on
every architecture. ATOMIC64_DEPENDS restricts the dependency to the
targets that need it; --as-needed drops the unused library elsewhere.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
The binary links nothing from libatomic on any architecture, so the
dependency is unnecessary.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
ustreamer and ustreamer-dump import 64-bit atomics from libatomic where
the compiler cannot inline them, but the build links the library on
every architecture. ATOMIC64_DEPENDS restricts the dependency to the
targets that need it; --as-needed drops the unused library elsewhere.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generated by Claude Code


Generated by Claude Code

Comment thread net/rtorrent/Makefile
TITLE:=BitTorrent client for ncurses
URL:=https://github.com/rakshasa/rtorrent
DEPENDS:=+libcurl +libncurses +libatomic +libopenssl +libstdcpp +zlib
DEPENDS:=+libcurl +libncurses $(ATOMIC64_DEPENDS) +libopenssl +libstdcpp +zlib

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PKG_RELEASE stays at 2: the rebase dropped this commit's bump, and master already shipped r2 with d2a2e7b8. A DEPENDS change on top of that needs PKG_RELEASE:=3 — it is the only commit in the series without a bump.


Generated by Claude Code

@dangowrt

Copy link
Copy Markdown
Member Author

CI will never complete this, I'll merge and take care of the fallout once it surfaces on buildbot.

@dangowrt
dangowrt merged commit 763e45c into openwrt:master Sep 16, 2026
6 of 14 checks passed
@dangowrt
dangowrt deleted the atomic64-depends branch September 16, 2026 15:35
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.

6 participants