Skip to content

Commit 1ecf872

Browse files
committed
Detect soname clashes
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 <[email protected]>
1 parent ec8c6f8 commit 1ecf872

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

scripts/mbedtls_framework/abi_check.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
import argparse
9797
import logging
9898
import tempfile
99+
import filecmp
99100
import fnmatch
100101
from types import SimpleNamespace
101102

@@ -237,9 +238,10 @@ def _build_shared_libraries(self, git_worktree_path, version):
237238
self.log.debug(build_output.decode("utf-8"))
238239
for root, _dirs, files in os.walk(build_dir):
239240
for file in fnmatch.filter(files, "*.so"):
240-
version.modules[os.path.splitext(file)[0]] = (
241-
os.path.join(root, file)
242-
)
241+
new_path = os.path.join(root, file)
242+
path = version.modules.setdefault(os.path.splitext(file)[0], new_path)
243+
if path != new_path and not filecmp.cmp(path, new_path, False):
244+
raise Exception(f"The following libraries differ, but have the same soname:\n{path}\n{new_path}")
243245

244246
@staticmethod
245247
def _pretty_revision(version):

0 commit comments

Comments
 (0)