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>master
parent
a24562af52
commit
1010171280
|
@ -226,7 +226,9 @@ string table if the type is a string."
|
||||||
(#f #f)
|
(#f #f)
|
||||||
((? elf-segment? dynamic)
|
((? elf-segment? dynamic)
|
||||||
(let ((entries (dynamic-entries elf 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)
|
(filter-map (lambda (entry)
|
||||||
(and (= (dynamic-entry-type entry)
|
(and (= (dynamic-entry-type entry)
|
||||||
DT_NEEDED)
|
DT_NEEDED)
|
||||||
|
|
|
@ -160,4 +160,22 @@
|
||||||
(close-pipe pipe)
|
(close-pipe pipe)
|
||||||
str)))))))
|
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")
|
(test-end "gremlin")
|
||||||
|
|
Reference in New Issue