diff mbox series

[v3,1/3] dlopen-deps.inc: treat soname list as ordered alternatives

Message ID 20260630115028.4001775-2-daniel.turull@ericsson.com
State Accepted, archived
Commit c7a0274d8f84c234c0bd4fcec086e2bfed28beef
Headers show
Series systemd: update to 261 and be compatible with rhel8 | expand

Commit Message

Daniel Turull June 30, 2026, 11:50 a.m. UTC
From: Daniel Turull <daniel.turull@ericsson.com>

The .note.dlopen format defines the soname array as a list of
alternatives (e.g. ["libcrypt.so.2", "libcrypt.so.1"]). The previous
code warned for every soname that was not found, even when an earlier
entry in the list already satisfied the dependency.

Select the first available provider and only warn when no alternative
can be resolved.

AI-Generated: Claude-opus-4.6
Signed-off-by: Daniel Turull <daniel.turull@ericsson.com>
---
 meta/recipes-core/systemd/dlopen-deps.inc | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/meta/recipes-core/systemd/dlopen-deps.inc b/meta/recipes-core/systemd/dlopen-deps.inc
index e0b333398c..82a2ccd389 100644
--- a/meta/recipes-core/systemd/dlopen-deps.inc
+++ b/meta/recipes-core/systemd/dlopen-deps.inc
@@ -66,15 +66,18 @@  python package_generate_dlopen_deps() {
                     elf = oe.qa.ELFFile(f)
                     elf.open()
                     for dep in parse(extract_segment(f, ".note.dlopen"), elf.isLittleEndian()):
+                        # soname list contains alternatives; find the first available provider
+                        found = False
                         for soname in dep["soname"]:
                             if soname in shlibs:
-                                # TODO assumes the first match is good
                                 package, version = list(shlibs[soname].values())[0]
                                 dependency = dep_map[dep["priority"]]
                                 bb.note(f"{pkg}: adding {dependency} on {package} via .note.dlopen")
                                 d.appendVar(f"{dependency}:{pkg}", f" {package} (>= {version})")
-                            else:
-                                bb.warn(f"cannot find {soname}")
+                                found = True
+                                break
+                        if not found:
+                            bb.warn(f"cannot find any provider for dlopen dependency: {dep['soname']}")
                 except oe.qa.NotELFFileError as e:
                     bb.note(f"Cannot extract ELF notes: {e}")
                     pass