[Midnightbsd-cvs] [MidnightBSD/mports] 06f9a7: AGENTS.md: document ELF symbol versioning behaviou...
Lucas Holt
noreply at github.com
Wed Sep 23 23:19:35 EDT 2026
Branch: refs/heads/master
Home: https://github.com/MidnightBSD/mports
Commit: 06f9a7d1dc19441dd2a451a0ddb828d93149ddee
https://github.com/MidnightBSD/mports/commit/06f9a7d1dc19441dd2a451a0ddb828d93149ddee
Author: Lucas Holt <luke at foolishgames.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
M AGENTS.md
Log Message:
-----------
AGENTS.md: document ELF symbol versioning behaviour and port-side guard (#1612)
Refs #1380. Documentation only; no port changes, per the issue's
instruction.
## Findings
**Framework and toolchain default:** `Mk/bsd.mport.mk` and the
extensions never add or remove `-Wl,--version-script`. Nothing is
enabled or disabled by default; only upstream build systems pass maps.
LLD 19.1.7 and GNU ld both honour version scripts on shared objects.
**Stripping:** `/usr/bin/strip`, binutils `strip`, `meson --strip`,
`cmake install/strip` all preserve `.gnu.version`, `.gnu.version_d`,
`.gnu.version_r` (allocated sections). Verified on a test library.
**Root causes of missing version nodes (both also apply to FreeBSD):**
1. Upstream probe links an *executable* with a `local: *` map. `crt1.o`
defines `environ`/`__progname` and `libc.so.7` imports them, so the link
is invalid (`non-exported symbol 'environ' in '/usr/lib/crt1.o' is
referenced by DSO`). Meson `cc.links()` pattern in libxkbcommon (fixed
in #1611) and mesa (FreeBSD ships mesa unversioned too).
2. Probe map names a symbol the test program never defines. LLD 16+
defaults to `--no-undefined-version`, so gnulib's `gl_LD_VERSION_SCRIPT`
reports no. FreeBSD works around it with `--enable-ld-version-script` +
`-Wl,--undefined-version`.
**Comparison against FreeBSD 13 amd64 packages:**
| Library | MidnightBSD | FreeBSD | Verdict |
|---|---|---|---|
| libidn2 | none | IDN2_0.0.0 .. IDN2_2.3.5 | divergence, cause 2,
`dns/libidn2` lacks FreeBSD's two flags |
| libxkbcommon 1.13.2 | none before #1611 | V_0.5.0 .. V_1.12.0 | fixed
|
| mesa libEGL/libgbm/libGLX | none | none | parity (cause 1, unpatched
upstream) |
| libgpg-error, libunistring, libpsl | none | none | parity (upstream
Linux-only or no map) |
| libksba | KSBA_0.9 | KSBA_0.9 | parity |
**Regression mechanism:** `HAS_SYMBOL_VERSION` already exists and
`Mk/scripts/check_have_symbols.sh` was verified to pass on a versioned
library and fail on both an unversioned library and one with only libc
`FBSD_*` needs. It is used by 7 ports here; FreeBSD uses it on the same
set.
## Change
Adds an "ELF symbol versioning in shared libraries" section to AGENTS.md
covering the two failure modes, the fixes, the `HAS_SYMBOL_VERSION`
guard, and readelf inspection commands.
## Suggested follow-up (separate PR, not done here)
`dns/libidn2`: add `--enable-ld-version-script` and `LDFLAGS+=
-Wl,--undefined-version` with `HAS_SYMBOL_VERSION`, matching FreeBSD.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
## Summary by Sourcery
Document ELF symbol versioning expectations and safeguards for port
maintainers.
Enhancements:
- Document ELF symbol versioning behavior, common upstream probe
failures, and appropriate fixes for MidnightBSD ports.
- Document the HAS_SYMBOL_VERSION build guard and commands for
inspecting symbol-version sections.
Documentation:
- Add AGENTS.md guidance on shared-library ELF symbol versioning, linker
behavior, stripping, and alignment with FreeBSD packaging practices.
---------
Signed-off-by: Lucas Holt <luke at foolishgames.com>
Co-authored-by: Claude Fable 5.1 <noreply at anthropic.com>
To unsubscribe from these emails, change your notification settings at https://github.com/MidnightBSD/mports/settings/notifications
More information about the Midnightbsd-cvs
mailing list