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 ;; Disable tests on MIPS (without changing
61 ;; the arguments list on other systems).
62 ,@(if (string-prefix? "mips" (or (%current-target-system)
68 (modify-phases %standard-phases
69 ;; No reason has been found for this test to reliably fail on aarch64-linux.
70 (add-after 'unpack 'disable-failing-aarch64-tests
72 (substitute* "tests/Makefile.in"
73 (("run-backtrace-native.sh") ""))
76 (native-inputs `(("m4" ,m4)))
77 (inputs `(("zlib" ,zlib)))
78 (home-page "https://sourceware.org/elfutils/")
79 (synopsis "Linker and ELF manipulation tools")
81 "This package provides command-line tools to manipulate binaries in the
82 Executable and Linkable Format (@dfn{ELF}). This includes @command{ld},
83 @command{ar}, @command{objdump}, @command{addr2line}, and more.")
85 ;; Libraries are dual-licensed LGPLv3.0+ | GPLv2, and programs are GPLv3+.
94 (uri (string-append "http://www.mr511.de/software/libelf-"
98 "0vf7s9dwk2xkmhb79aigqm0x0yfbw1j0b9ksm51207qwr179n6jr"))))
99 (build-system gnu-build-system)
102 (modify-phases %standard-phases
104 (lambda* (#:key outputs #:allow-other-keys)
105 ;; This old `configure' script doesn't support
106 ;; variables passed as arguments.
107 (let ((out (assoc-ref outputs "out")))
108 (setenv "CONFIG_SHELL" (which "bash"))
109 (invoke "./configure"
110 (string-append "--prefix=" out)
111 ,@(if (string=? "aarch64-linux"
113 '("--host=aarch64-unknown-linux-gnu")
115 (home-page "http://www.mr511.de/software/english.html")
116 (synopsis "ELF object file access library")
117 (description "Libelf is a C library to access ELF object files.")
120 (define-public patchelf
127 "https://nixos.org/releases/patchelf/patchelf-"
129 "/patchelf-" version ".tar.bz2"))
132 "1rqpg84wrd3fa16wa9vqdvasnc05yz49w207cz1l0wrl4k8q97y9"))
133 (patches (search-patches "patchelf-page-size.patch"))))
134 (build-system gnu-build-system)
136 ;; XXX: The upstream 'patchelf' doesn't support ARM. The only available
137 ;; patch makes significant changes to the algorithm, possibly
138 ;; introducing bugs. So, we apply the patch only on ARM systems.
141 `(("patch/rework-for-arm" ,(search-patch
142 "patchelf-rework-for-arm.patch")))
147 (modify-phases %standard-phases
148 (add-after 'unpack 'patch/rework-for-arm
149 (lambda* (#:key inputs #:allow-other-keys)
150 (let ((patch-file (assoc-ref inputs "patch/rework-for-arm")))
151 (invoke "patch" "--force" "-p1" "--input" patch-file))))))
154 (home-page "https://nixos.org/patchelf.html")
155 (synopsis "Modify the dynamic linker and RPATH of ELF executables")
157 "PatchELF allows the ELF \"interpreter\" and RPATH of an ELF binary to be