From bfc69ea726e0f5c1955e629e92af377ffb90c2c5 Mon Sep 17 00:00:00 2001
From: Dion Mendel <guix@dm9.info>
Date: Thu, 22 Apr 2021 10:32:35 +0800
Subject: [PATCH] * guix/build/gremlin.scm (elf-dynamic-info): Correctly set
the value of soname in <elf-dynamic-info>.
---
guix/build/gremlin.scm | 4 +++-
tests/gremlin.scm | 18 ++++++++++++++++++
2 files changed, 21 insertions(+), 1 deletion(-)
@@ -215,7 +215,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)
@@ -96,4 +96,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")
--
2.31.0
Thanks for your explanations. It's cleared up my understanding. I've tried to retitled to target core-updates, but I'm not sure if it applied. I've updated the patch to include a unit test. I am currently testing by rebuilding as you suggest. ./pre-inst-env guix build hello Yes this is building the world so I will report back when it completes. >The record is <elf-dynamic-info>. <elf-dynamic-info> != elf-dynamic-info. Thank you. Yes I was confused regarding this. I've updated the commit changelog accordingly.