From 56400d627e21fda180c399134f4e5e6fa717f06a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bence=20Sz=C3=A9pk=C3=BAti?= Date: Wed, 22 Oct 2025 03:19:49 +0200 Subject: [PATCH] Detect soname clashes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The same library may be present in the same build tree, eg. libtfpsacrypto.so, which gets copied from the tf-psa-crypto/core/ to library/ during an Mbed TLS build. Make sure that the duplicated libraries are byte-for-byte identical, otherwise abort the test. Signed-off-by: Bence Szépkúti --- scripts/mbedtls_framework/abi_check.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/mbedtls_framework/abi_check.py b/scripts/mbedtls_framework/abi_check.py index 15f8d1906..207e29b38 100755 --- a/scripts/mbedtls_framework/abi_check.py +++ b/scripts/mbedtls_framework/abi_check.py @@ -96,6 +96,7 @@ import subprocess import argparse import logging import tempfile +import filecmp import fnmatch from types import SimpleNamespace @@ -251,9 +252,10 @@ class AbiChecker: self.log.debug(build_output.decode("utf-8")) for root, _dirs, files in os.walk(build_dir): for file in fnmatch.filter(files, "*.so"): - version.modules[os.path.splitext(file)[0]] = ( - os.path.join(root, file) - ) + new_path = os.path.join(root, file) + path = version.modules.setdefault(os.path.splitext(file)[0], new_path) + if path != new_path and not filecmp.cmp(path, new_path, False): + raise Exception(f"The following libraries differ, but have the same soname:\n{path}\n{new_path}") @staticmethod def _pretty_revision(version):