Skip to contentSkip to conversation

dlopen-deps.inc: also parse executables

PATCH New [email protected] 1 participant 1 message Oct 21

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dlopen-deps.inc: also parse executables

From: Luca Boccassi <[email protected]>

The dlopen note is not just applied to shared libraries, but to ELF executables too. This is especially the case in systemd v262, where binaries now each have the precise list of dlopen dependencies they require.
For example, systemd-repart requires libblkid, which is not pulled in otherwise.

---
 meta/recipes-core/systemd/dlopen-deps.inc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
meta/recipes-core/systemd/dlopen-deps.inc +3 -3
index 2d43f2dcb8..37074a9682 100644
@@ -3,7 +3,7 @@ PACKAGEFUNCS =+ "package_generate_dlopen_deps"
 python package_generate_dlopen_deps() {
     # https://systemd.io/ELF_DLOPEN_METADATA/
 
-    import struct, json
+    import os, struct, json
 
     def extract_segment(filename, segment):
         """
@@ -57,11 +57,11 @@ python package_generate_dlopen_deps() {
             continue
 
         for f in files:
-            # Skip symlinks, just look for real libraries
+            # Skip symlinks, inspect executables and shared libraries.
             if cpath.islink(f):
                 continue
 
-            if ".so." in f or f.endswith(".so"):
+            if os.access(f, os.X_OK) or ".so." in f or f.endswith(".so"):
                 try:
                     elf = oe.qa.ELFFile(f)
                     elf.open()
Signature · 1 line
2.47.3