guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/07: gremlin: 'elf-dynamic-info' returns a file name rathern than a dy


From: guix-commits
Subject: 01/07: gremlin: 'elf-dynamic-info' returns a file name rathern than a dynamic entry.
Date: Thu, 22 Apr 2021 08:04:59 -0400 (EDT)

civodul pushed a commit to branch core-updates
in repository guix.

commit 1010171280cb34c8dc361644b66fdd1a041d297a
Author: Dion Mendel <guix@dm9.info>
AuthorDate: Thu Apr 22 10:32:35 2021 +0800

    gremlin: 'elf-dynamic-info' returns a file name rathern than a dynamic 
entry.
    
    * guix/build/gremlin.scm (elf-dynamic-info): Return the dynamic entry
    value, not the dynamic entry.
    * tests/gremlin.scm ("elf-dynamic-info-soname"): New test.
    
    Signed-off-by: Ludovic Courtès <ludo@gnu.org>
---
 guix/build/gremlin.scm |  4 +++-
 tests/gremlin.scm      | 18 ++++++++++++++++++
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/guix/build/gremlin.scm b/guix/build/gremlin.scm
index a2d2169..2a74d51 100644
--- a/guix/build/gremlin.scm
+++ b/guix/build/gremlin.scm
@@ -226,7 +226,9 @@ string table if the type is a string."
     (#f #f)
     ((? elf-segment? dynamic)
      (let ((entries (dynamic-entries elf dynamic)))
-       (%elf-dynamic-info (find (matching-entry DT_SONAME) entries)
+       (%elf-dynamic-info (and=> (find (matching-entry DT_SONAME)
+                                       entries)
+                                 dynamic-entry-value)
                           (filter-map (lambda (entry)
                                         (and (= (dynamic-entry-type entry)
                                                 DT_NEEDED)
diff --git a/tests/gremlin.scm b/tests/gremlin.scm
index 9ddac14..f20a79f 100644
--- a/tests/gremlin.scm
+++ b/tests/gremlin.scm
@@ -160,4 +160,22 @@
                 (close-pipe pipe)
                 str)))))))
 
+(unless c-compiler
+  (test-skip 1))
+(test-equal "elf-dynamic-info-soname"
+  "libfoo.so.2"
+  (call-with-temporary-directory
+   (lambda (directory)
+     (with-directory-excursion directory
+       (call-with-output-file "t.c"
+         (lambda (port)
+           (display "// empty file" port)))
+       (invoke c-compiler "t.c"
+               "-shared" "-Wl,-soname,libfoo.so.2")
+       (let* ((dyninfo (elf-dynamic-info
+                       (parse-elf (call-with-input-file "a.out"
+                                    get-bytevector-all))))
+              (soname  (elf-dynamic-info-soname dyninfo)))
+        soname)))))
+
 (test-end "gremlin")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]