unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Dion Mendel <guix@dm9.info>
To: 47921@debbugs.gnu.org
Subject: [bug#47921] [PATCH] build: Fix elf-dynamic-info-soname.
Date: Thu, 22 Apr 2021 11:13:50 +0800	[thread overview]
Message-ID: <20210422031350.GB2930@dm9.info> (raw)
In-Reply-To: <92c4f265369735c71c6f358cfee29fb7cc6a38d2.camel@telenet.be>

[-- Attachment #1: Type: text/plain, Size: 530 bytes --]

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.

[-- Attachment #2: 0001-guix-build-gremlin.scm-elf-dynamic-info-Correctly-se.patch --]
[-- Type: text/x-diff, Size: 2031 bytes --]

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(-)

diff --git a/guix/build/gremlin.scm b/guix/build/gremlin.scm
index e8ea66dfb3..4710502426 100644
--- a/guix/build/gremlin.scm
+++ b/guix/build/gremlin.scm
@@ -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)
diff --git a/tests/gremlin.scm b/tests/gremlin.scm
index b0bb7a8e49..50ad0d70f5 100644
--- a/tests/gremlin.scm
+++ b/tests/gremlin.scm
@@ -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


  reply	other threads:[~2021-04-22  3:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-20 19:44 [bug#47921] [PATCH] build: Fix elf-dynamic-info-soname Dion Mendel
2021-04-21  2:46 ` Dion Mendel
2021-04-21 11:49 ` Maxime Devos
2021-04-21 15:46   ` Dion Mendel
2021-04-21 18:33     ` Maxime Devos
2021-04-22  3:13       ` Dion Mendel [this message]
2021-04-22  8:20         ` bug#47921: " Ludovic Courtès
2021-04-22  2:55 ` [bug#47921] retitle Dion Mendel
2021-04-22  3:26 ` [bug#47921] Include correct commit message Dion Mendel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210422031350.GB2930@dm9.info \
    --to=guix@dm9.info \
    --cc=47921@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).