1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
4 ;;; Copyright © 2015 Andreas Enge <andreas@enge.fr>
5 ;;; Copyright © 2017, 2018 Efraim Flashner <efraim@flashner.co.il>
6 ;;; Copyright © 2017 Leo Famulari <leo@famulari.name>
7 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
9 ;;; This file is part of GNU Guix.
11 ;;; GNU Guix is free software; you can redistribute it and/or modify it
12 ;;; under the terms of the GNU General Public License as published by
13 ;;; the Free Software Foundation; either version 3 of the License, or (at
14 ;;; your option) any later version.
16 ;;; GNU Guix is distributed in the hope that it will be useful, but
17 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;;; GNU General Public License for more details.
21 ;;; You should have received a copy of the GNU General Public License
22 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
24 (define-module (gnu packages elf)
25 #:use-module (guix utils)
26 #:use-module (guix packages)
27 #:use-module (guix download)
28 #:use-module (guix build-system gnu)
29 #:use-module ((guix licenses) #:select (gpl3+ lgpl3+ lgpl2.0+))
30 #:use-module (gnu packages)
31 #:use-module (gnu packages m4)
32 #:use-module (gnu packages compression))
34 (define-public elfutils
40 (uri (string-append "https://sourceware.org/elfutils/ftp/"
41 version "/elfutils-" version ".tar.bz2"))
44 "0rp0r54z44is49c594qy7hr211nhb00aa5y7z74vsybbaxslg10z"))
45 (patches (search-patches "elfutils-tests-ptrace.patch"))))
46 (build-system gnu-build-system)
48 ;; Separate programs because that's usually not what elfutils users want,
49 ;; and because they duplicate what Binutils provides.
50 (outputs '("out" ; libelf.so, elfutils/*.h, etc.
51 "bin")) ; ld, nm, objdump, etc.
54 ;; Programs don't have libelf.so in their RUNPATH and libraries don't
55 ;; know where to find each other.
56 `(#:configure-flags (list (string-append "LDFLAGS=-Wl,-rpath="
57 (assoc-ref %outputs "out")
60 (modify-phases %standard-phases
61 ;; No reason has been found for this test to reliably fail on aarch64-linux.
62 (add-after 'unpack 'disable-failing-aarch64-tests
64 (substitute* "tests/Makefile.in"
65 (("run-backtrace-native.sh") ""))
68 (native-inputs `(("m4" ,m4)))
69 (inputs `(("zlib" ,zlib)))
70 (home-page "https://sourceware.org/elfutils/")
71 (synopsis "Linker and ELF manipulation tools")
73 "This package provides command-line tools to manipulate binaries in the
74 Executable and Linkable Format (@dfn{ELF}). This includes @command{ld},
75 @command{ar}, @command{objdump}, @command{addr2line}, and more.")
77 ;; Libraries are dual-licensed LGPLv3.0+ | GPLv2, and programs are GPLv3+.
86 (uri (string-append "http://www.mr511.de/software/libelf-"
90 "0vf7s9dwk2xkmhb79aigqm0x0yfbw1j0b9ksm51207qwr179n6jr"))))
91 (build-system gnu-build-system)
94 (modify-phases %standard-phases
96 (lambda* (#:key outputs #:allow-other-keys)
97 ;; This old `configure' script doesn't support
98 ;; variables passed as arguments.
99 (let ((out (assoc-ref outputs "out")))
100 (setenv "CONFIG_SHELL" (which "bash"))
101 (invoke "./configure"
102 (string-append "--prefix=" out)
103 ,@(if (string=? "aarch64-linux"
105 '("--host=aarch64-unknown-linux-gnu")
107 (home-page "http://www.mr511.de/software/english.html")
108 (synopsis "ELF object file access library")
109 (description "Libelf is a C library to access ELF object files.")
112 (define-public patchelf
119 "https://nixos.org/releases/patchelf/patchelf-"
121 "/patchelf-" version ".tar.bz2"))
124 "1rqpg84wrd3fa16wa9vqdvasnc05yz49w207cz1l0wrl4k8q97y9"))
125 (patches (search-patches "patchelf-page-size.patch"))))
126 (build-system gnu-build-system)
128 ;; XXX: The upstream 'patchelf' doesn't support ARM. The only available
129 ;; patch makes significant changes to the algorithm, possibly
130 ;; introducing bugs. So, we apply the patch only on ARM systems.
133 `(("patch/rework-for-arm" ,(search-patch
134 "patchelf-rework-for-arm.patch")))
139 (modify-phases %standard-phases
140 (add-after 'unpack 'patch/rework-for-arm
141 (lambda* (#:key inputs #:allow-other-keys)
142 (let ((patch-file (assoc-ref inputs "patch/rework-for-arm")))
143 (invoke "patch" "--force" "-p1" "--input" patch-file))))))
146 (home-page "https://nixos.org/patchelf.html")
147 (synopsis "Modify the dynamic linker and RPATH of ELF executables")
149 "PatchELF allows the ELF \"interpreter\" and RPATH of an ELF binary to be