cmake: Fix shared library versioning on OpenBSD
What changed, and why it matters
This commit fixes how the shared library version number is set when building on OpenBSD. It adds an OpenBSD-specific branch in the CMake build logic so the library gets a proper version suffix. There is no direct security vulnerability here; it is a portability/build correctness fix. A wrong version could theoretically cause runtime linker confusion or load an unintended library, but the commit itself is defensive and small.
Treat as a routine build-system fix. Reviewers can merge after normal CI/build checks. No special security response is needed, though downstream packagers on OpenBSD should verify the resulting .so name matches expectations.
Security signals we found
Build-system hardening for OpenBSD shared-library versioning
No memory-safety, cryptographic, or consensus code changed
No input parsing or secret-handling code changed
Evidence from the diff
The change extends cmake/SetLibtoolAbiVersion.cmake to handle OpenBSD like other platforms (GNU/Linux, Apple, Windows/Cygwin). On OpenBSD, libtool’s ‘version_type=sunos’ uses current.revision, and no soname_spec is defined, so the patch sets only VERSION to ${current}.${revision} and leaves SOVERSION unset. This aligns the CMake build with libtool behavior and avoids producing an unversioned or incorrectly versioned shared object on OpenBSD.
Changed components
cmake/SetLibtoolAbiVersion.cmakeInspect captured patch +8 / −0
diff --git a/cmake/SetLibtoolAbiVersion.cmake b/cmake/SetLibtoolAbiVersion.cmake
index 10ef8e1..0e98105 100644
--- a/cmake/SetLibtoolAbiVersion.cmake
+++ b/cmake/SetLibtoolAbiVersion.cmake
@@ -26,6 +26,14 @@ function(set_libtool_abi_version target current revision age)
SOVERSION ${current}
VERSION ${current}.${revision}
)
+ elseif(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
+ # version_type = sunos
+ # major = $current
+ # versuffix = $current.$revision
+ set_target_properties(${target} PROPERTIES
+ # OpenBSD has no `soname_spec` defined in `libtool.m4`.
+ VERSION ${current}.${revision}
+ )
elseif(APPLE)
# version_type = darwin
# major = $current - $age
Why this scored 19/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.