| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 |
|
| 36 | (define-module (gnu packages elf)
|
| 37 | #:use-module (guix gexp)
|
| 38 | #:use-module (guix utils)
|
| 39 | #:use-module (guix packages)
|
| 40 | #:use-module (guix download)
|
| 41 | #:use-module (guix git-download)
|
| 42 | #:use-module (guix build-system meson)
|
| 43 | #:use-module (guix build-system gnu)
|
| 44 | #:use-module ((guix licenses) #:prefix license:)
|
| 45 | #:use-module (gnu packages)
|
| 46 | #:use-module (gnu packages autotools)
|
| 47 | #:use-module (gnu packages compression)
|
| 48 | #:use-module (gnu packages base)
|
| 49 | #:use-module (gnu packages bash)
|
| 50 | #:use-module (gnu packages digest)
|
| 51 | #:use-module (gnu packages docbook)
|
| 52 | #:use-module (gnu packages documentation)
|
| 53 | #:use-module (gnu packages gawk)
|
| 54 | #:use-module (gnu packages gcc)
|
| 55 | #:use-module (gnu packages m4)
|
| 56 | #:use-module (gnu packages pkg-config)
|
| 57 | #:use-module (gnu packages python)
|
| 58 | #:use-module (gnu packages sphinx)
|
| 59 | #:use-module (gnu packages texinfo)
|
| 60 | #:use-module (gnu packages xml)
|
| 61 | #:use-module (srfi srfi-1)
|
| 62 | #:use-module (srfi srfi-26))
|
| 63 |
|
| 64 | (define-public chrpath
|
| 65 | (package
|
| 66 | (name "chrpath")
|
| 67 | (version "0.18")
|
| 68 | (source (origin
|
| 69 | (method git-fetch)
|
| 70 | (uri (git-reference
|
| 71 | (url "https://codeberg.org/pere/chrpath")
|
| 72 | (commit (string-append "release_" version))))
|
| 73 | (file-name (git-file-name name version))
|
| 74 | (sha256
|
| 75 | (base32
|
| 76 | "0n7fp6xm660m8inaadlblh7zr8izyc3x39bfdqi6rj1kn0vmzra6"))))
|
| 77 | (build-system gnu-build-system)
|
| 78 | (native-inputs (list automake autoconf))
|
| 79 | (home-page "https://codeberg.org/pere/chrpath")
|
| 80 | (synopsis "Utility for editing the RPATH or RUNPATH of ELF binaries")
|
| 81 | (description "@code{chrpath} allows listing, changing or removing the
|
| 82 | dynamic library load path (RPATH and RUNPATH) of compiled programs and
|
| 83 | libraries.")
|
| 84 | (license license:gpl2+)))
|
| 85 |
|
| 86 | (define-public elfutils
|
| 87 | (package
|
| 88 | (name "elfutils")
|
| 89 | (version "0.192")
|
| 90 | (source (origin
|
| 91 | (method url-fetch)
|
| 92 | (uri (string-append "https://sourceware.org/elfutils/ftp/"
|
| 93 | version "/elfutils-" version ".tar.bz2"))
|
| 94 | (sha256
|
| 95 | (base32
|
| 96 | "1d0nnkm59pwi9hrr28w0ifb6smldrjk6rn33kcgs3ar4msz9jq31"))
|
| 97 | (patches (search-patches "elfutils-tests-ptrace.patch"))))
|
| 98 | (build-system gnu-build-system)
|
| 99 |
|
| 100 | |
| 101 | |
| 102 | |
| 103 | (outputs '("out" |
| 104 | "bin")) |
| 105 |
|
| 106 | (arguments
|
| 107 | |
| 108 | |
| 109 | `(#:configure-flags (list (string-append "LDFLAGS=-Wl,-rpath="
|
| 110 | (assoc-ref %outputs "out")
|
| 111 | "/lib")
|
| 112 | "--disable-static"
|
| 113 | |
| 114 | |
| 115 | |
| 116 | |
| 117 | |
| 118 | |
| 119 | |
| 120 | "--disable-libdebuginfod"
|
| 121 | "--disable-debuginfod")
|
| 122 |
|
| 123 | ,@(if (target-hurd64?)
|
| 124 | '(#:make-flags '("core-file_no_Werror=yes"))
|
| 125 | '())
|
| 126 |
|
| 127 | |
| 128 | |
| 129 | ,@(if (any (cute string-prefix? <> (or (%current-target-system)
|
| 130 | (%current-system)))
|
| 131 | '("mips" "powerpc"))
|
| 132 | '(#:tests? #f)
|
| 133 | '())
|
| 134 |
|
| 135 | #:phases
|
| 136 | ,#~(modify-phases %standard-phases
|
| 137 | |
| 138 | (add-after 'unpack 'disable-failing-aarch64-tests
|
| 139 | (lambda _
|
| 140 | (substitute* "tests/Makefile.in"
|
| 141 | (("run-backtrace-native.sh") ""))
|
| 142 | #t))
|
| 143 | #$@(if (target-riscv64?)
|
| 144 | #~((add-after 'unpack 'disable-failing-riscv64-test
|
| 145 | (lambda _
|
| 146 | (substitute* "tests/Makefile.in"
|
| 147 | |
| 148 | (("run-backtrace-dwarf.sh") "")
|
| 149 | |
| 150 | |
| 151 | |
| 152 | (("run-reverse-sections-self.sh") "")
|
| 153 | (("run-strip-strmerge.sh") "")
|
| 154 | (("run-elflint-self.sh") "")))))
|
| 155 | #~())
|
| 156 | #$@(if (system-hurd?)
|
| 157 | #~((add-after 'unpack 'skip-tests
|
| 158 | (lambda _
|
| 159 | (substitute* '("tests/elfstrtab.c"
|
| 160 | "tests/emptyfile.c")
|
| 161 | (("elf_version \\(EV_CURRENT\\);" all)
|
| 162 | "exit (77);"))
|
| 163 | (substitute* '("tests/run-all-dwarf-ranges.sh"
|
| 164 | "tests/run-allfcts-multi.sh"
|
| 165 | "tests/run-attr-integrate-skel.sh"
|
| 166 | "tests/run-bug1-test.sh"
|
| 167 | "tests/run-copyadd-sections.sh"
|
| 168 | "tests/run-declfiles.sh"
|
| 169 | "tests/run-deleted.sh"
|
| 170 | "tests/run-dwarf-getmacros.sh"
|
| 171 | "tests/run-get-units-split.sh"
|
| 172 | "tests/run-native-test.sh"
|
| 173 | "tests/run-readelf-loc.sh"
|
| 174 | "tests/run-readelf-ranges.sh"
|
| 175 | "tests/run-unit-info.sh"
|
| 176 | "tests/run-varlocs.sh")
|
| 177 | (("^#!.*" all)
|
| 178 | (string-append all "exit 77;\n"))))))
|
| 179 | #~()))))
|
| 180 |
|
| 181 | (native-inputs (list m4))
|
| 182 | (inputs (list xz zlib))
|
| 183 | (home-page "https://sourceware.org/elfutils/")
|
| 184 | (synopsis "Collection of utilities and libraries to handle ELF files and
|
| 185 | DWARF data")
|
| 186 | (description
|
| 187 | "Elfutils is a collection of utilities and libraries to read, create and
|
| 188 | modify Executable and Linkable Format (@dfn{ELF}) binary files, find and
|
| 189 | handle Debugging With Arbitrary Record Formats (@dfn{DWARF}) debug data,
|
| 190 | symbols, thread state and stacktraces for processes and core files on
|
| 191 | GNU/Linux. Elfutils includes @file{libelf} for manipulating ELF files,
|
| 192 | @file{libdw} for inspecting DWARF data and process state and utilities like
|
| 193 | @command{eu-stack} (to show backtraces), @command{eu-nm} (for listing symbols
|
| 194 | from object files), @command{eu-size} (for listing the section sizes of an
|
| 195 | object or archive file), @command{eu-strip} (for discarding symbols),
|
| 196 | @command{eu-readelf} (to see the raw ELF file structures),
|
| 197 | @command{eu-elflint} (to check for well-formed ELF files),
|
| 198 | @command{eu-elfcompress} (to compress or decompress ELF sections), and more.")
|
| 199 |
|
| 200 | |
| 201 | (license license:lgpl3+)))
|
| 202 |
|
| 203 | (define-public libabigail
|
| 204 | (package
|
| 205 | (name "libabigail")
|
| 206 | (home-page "https://sourceware.org/libabigail/")
|
| 207 | (version "2.9")
|
| 208 | (source (origin
|
| 209 | (method url-fetch)
|
| 210 | (uri (string-append "https://sourceware.org/pub/libabigail/"
|
| 211 | "libabigail-" version ".tar.xz"))
|
| 212 | (sha256
|
| 213 | (base32
|
| 214 | "0f6p86ispkiaxsqlqp9xdmhn0yjyagq1w7q94pd8m8h566m6pf5l"))))
|
| 215 | (build-system gnu-build-system)
|
| 216 | (arguments
|
| 217 | (list #:configure-flags #~(list "--disable-static"
|
| 218 | "--enable-bash-completion"
|
| 219 | "--enable-manual")
|
| 220 | #:make-flags #~(list "V=1")
|
| 221 | #:phases #~(modify-phases %standard-phases
|
| 222 | (add-after 'unpack 'patch-source
|
| 223 | (lambda _
|
| 224 | (substitute* "build-aux/ltmain.sh"
|
| 225 | |
| 226 | |
| 227 | (("compiler_flags=\"-specs=.*")
|
| 228 | "compiler_flags=\n"))))
|
| 229 | (add-after 'build 'build-documentation
|
| 230 | (lambda _
|
| 231 | (invoke "make" "-C" "doc/manuals" "html-doc" "man" "info")))
|
| 232 | (add-before 'check 'set-test-environment
|
| 233 | (lambda _
|
| 234 | (setenv "XDG_CACHE_HOME" "/tmp")))
|
| 235 | (add-after 'install 'install-documentation
|
| 236 | (lambda _
|
| 237 | (invoke "make" "-C" "doc/manuals"
|
| 238 | "install-man-and-info-doc")))
|
| 239 | (add-after 'install-documentation 'install-bash-completion
|
| 240 | (lambda _
|
| 241 | (for-each (lambda (file)
|
| 242 | (install-file
|
| 243 | file (string-append #$output
|
| 244 | "/share/bash-completion"
|
| 245 | "/completions")))
|
| 246 | (find-files "bash-completion" ".*abi.*")))))))
|
| 247 | (native-inputs
|
| 248 | (list pkg-config texinfo python-sphinx python))
|
| 249 | (propagated-inputs
|
| 250 | (list elfutils |
| 251 | libxml2 |
| 252 | xxhash))
|
| 253 | (synopsis "Analyze application binary interfaces (ABIs)")
|
| 254 | (description
|
| 255 | "@dfn{ABIGAIL} stands for the Application Binary Interface Generic
|
| 256 | Analysis and Instrumentation Library. It is a framework which aims at
|
| 257 | helping developers and software distributors to spot ABI-related issues
|
| 258 | like interface incompatibility in ELF shared libraries by performing a
|
| 259 | static analysis of the ELF binaries at hand.")
|
| 260 | (license license:lgpl3+)))
|
| 261 |
|
| 262 | (define-public libelf
|
| 263 | (package
|
| 264 | (name "libelf")
|
| 265 | (version "0.8.13")
|
| 266 | (source
|
| 267 | (origin
|
| 268 | (method url-fetch)
|
| 269 | (uri (list
|
| 270 | |
| 271 | |
| 272 | (string-append "https://fossies.org/linux/misc/old/"
|
| 273 | "libelf-" version ".tar.gz")
|
| 274 | (string-append "https://ftp.osuosl.org/pub/blfs/conglomeration/"
|
| 275 | "libelf/libelf-" version ".tar.gz")))
|
| 276 | (sha256
|
| 277 | (base32
|
| 278 | "0vf7s9dwk2xkmhb79aigqm0x0yfbw1j0b9ksm51207qwr179n6jr"))))
|
| 279 | (build-system gnu-build-system)
|
| 280 | (arguments
|
| 281 | `(#:phases
|
| 282 | (modify-phases %standard-phases
|
| 283 | |
| 284 | |
| 285 | |
| 286 | |
| 287 | |
| 288 | |
| 289 | |
| 290 | |
| 291 | |
| 292 | (add-before 'bootstrap 'delete-configure
|
| 293 | (lambda* (#:key native-inputs inputs #:allow-other-keys)
|
| 294 | (delete-file "configure")
|
| 295 | (delete-file "config.sub")
|
| 296 | (delete-file "config.guess")
|
| 297 | (for-each (lambda (file)
|
| 298 | (install-file
|
| 299 | (string-append
|
| 300 | (assoc-ref (or native-inputs inputs) "automake")
|
| 301 | "/share/automake-"
|
| 302 | ,(version-major+minor (package-version automake))
|
| 303 | "/" file) "."))
|
| 304 | '("config.sub" "config.guess")))))))
|
| 305 | (native-inputs
|
| 306 | (list autoconf
|
| 307 | |
| 308 | automake))
|
| 309 | (home-page (string-append "https://web.archive.org/web/20181111033959/"
|
| 310 | "http://www.mr511.de/software/english.html"))
|
| 311 | (synopsis "ELF object file access library")
|
| 312 | (description "Libelf is a C library to access ELF object files.")
|
| 313 | (license license:lgpl2.0+)))
|
| 314 |
|
| 315 |
|
| 316 | |
| 317 | |
| 318 | (define-public libelf-shared
|
| 319 | (package
|
| 320 | (inherit libelf)
|
| 321 | (arguments
|
| 322 | (substitute-keyword-arguments arguments
|
| 323 | ((#:make-flags flags #~'())
|
| 324 | #~(append #$flags '("CFLAGS=-fPIC")))))
|
| 325 | (properties `((hidden? . #t) ,@(package-properties libelf)))))
|
| 326 |
|
| 327 | (define-public patchelf
|
| 328 | (package
|
| 329 | (name "patchelf")
|
| 330 | (version "0.18.0")
|
| 331 | (source (origin
|
| 332 | (method url-fetch)
|
| 333 | (uri (string-append
|
| 334 | "https://github.com/NixOS/patchelf/releases/download/"
|
| 335 | version
|
| 336 | "/patchelf-" version ".tar.bz2"))
|
| 337 | (sha256
|
| 338 | (base32
|
| 339 | "02s7ap86rx6yagfh9xwp96sgsj0p6hp99vhiq9wn4mxshakv4lhr"))))
|
| 340 | (build-system gnu-build-system)
|
| 341 | (arguments
|
| 342 | '(#:phases
|
| 343 | (modify-phases %standard-phases
|
| 344 | (add-after 'unpack 'fix-tests
|
| 345 | |
| 346 | |
| 347 | (lambda* (#:key inputs #:allow-other-keys)
|
| 348 | (substitute* "tests/no-rpath.sh"
|
| 349 | |
| 350 | (("^if test.*") "")
|
| 351 | |
| 352 | (("/xxxxxxxxxxxxxxx") (string-append (assoc-ref inputs "gcc:lib")
|
| 353 | "/lib")))
|
| 354 | (substitute* "tests/replace-needed.sh"
|
| 355 | |
| 356 | |
| 357 | (("grep -v 'foo\\\\.so'") "grep -E 'libc.*\\.so'"))
|
| 358 | (substitute* "tests/set-empty-rpath.sh"
|
| 359 | |
| 360 | |
| 361 | (("^\"\\$\\{SCRATCH\\}\"\\/simple.$") ""))
|
| 362 | |
| 363 | (substitute* "tests/Makefile.in"
|
| 364 | ((".*shared-rpath\\.sh \\.*") "")))))))
|
| 365 | (native-inputs
|
| 366 | `(("gcc:lib" ,gcc "lib")))
|
| 367 | (home-page "https://nixos.org/patchelf.html")
|
| 368 | (synopsis "Modify the dynamic linker and RPATH of ELF executables")
|
| 369 | (description
|
| 370 | "PatchELF allows the ELF \"interpreter\" and RPATH of an ELF binary to be
|
| 371 | changed.")
|
| 372 | (license license:gpl3+)))
|
| 373 |
|
| 374 | |
| 375 | |
| 376 | |
| 377 | (define-public patchelf-0.16
|
| 378 | (package
|
| 379 | (inherit patchelf)
|
| 380 | (name "patchelf")
|
| 381 | (version "0.16.1")
|
| 382 | (source (origin
|
| 383 | (method url-fetch)
|
| 384 | (uri (string-append
|
| 385 | "https://github.com/NixOS/patchelf/releases/download/"
|
| 386 | version
|
| 387 | "/patchelf-" version ".tar.bz2"))
|
| 388 | (sha256
|
| 389 | (base32
|
| 390 | "0zdby3gpmm8q4735pviaq92zj41i2rdnhwhyrsb3sinc9hzmz4db"))))
|
| 391 | (arguments
|
| 392 | (substitute-keyword-arguments arguments
|
| 393 | ((#:phases phases '%standard-phases)
|
| 394 | #~(modify-phases #$phases
|
| 395 | (add-after 'fix-tests 'skip-empty-rpath-test
|
| 396 | (lambda _
|
| 397 | (substitute* "tests/set-empty-rpath.sh"
|
| 398 | (("^\\$\\{SCRATCH\\}\\/simple.$") ""))))))))))
|
| 399 |
|
| 400 | (define-public pax-utils
|
| 401 | (package
|
| 402 | (name "pax-utils")
|
| 403 | (version "1.3.9")
|
| 404 | (source (origin
|
| 405 | (method git-fetch)
|
| 406 | (uri (git-reference
|
| 407 | (url "https://anongit.gentoo.org/git/proj/pax-utils.git")
|
| 408 | (commit (string-append "v" version))))
|
| 409 | (file-name (git-file-name name version))
|
| 410 | (sha256
|
| 411 | (base32
|
| 412 | "1ds0bjlivvqpm3kr8y9blawrkhn134zwng2zq6cdbh5xw87vqwg4"))))
|
| 413 | (build-system meson-build-system)
|
| 414 | (arguments
|
| 415 | (list
|
| 416 | #:modules '((guix build meson-build-system)
|
| 417 | (guix build utils)
|
| 418 | (srfi srfi-26))
|
| 419 | #:configure-flags #~(list "-Dlddtree_implementation=sh")
|
| 420 | #:phases
|
| 421 | #~(modify-phases %standard-phases
|
| 422 | (add-after 'install 'wrap-lddtree
|
| 423 | (lambda* (#:key inputs outputs #:allow-other-keys)
|
| 424 | (let* ((needed-bin
|
| 425 | (map (cut string-append <> "/bin")
|
| 426 | (list #$(this-package-input "coreutils-minimal")
|
| 427 | #$(this-package-input "gawk")
|
| 428 | #$(this-package-input "sed")
|
| 429 | #$output)))
|
| 430 | (PATH `("PATH" = (,@needed-bin))))
|
| 431 | (for-each (lambda (p)
|
| 432 | (wrap-program
|
| 433 | (search-input-file outputs
|
| 434 | (string-append "bin/" p))
|
| 435 | PATH))
|
| 436 | (list "lddtree" "symtree"))))))))
|
| 437 | (native-inputs (list docbook-xsl xmlto))
|
| 438 | (inputs (list bash-minimal coreutils-minimal gawk sed))
|
| 439 | (home-page "https://wiki.gentoo.org/wiki/Hardened/PaX_Utilities")
|
| 440 | (synopsis "ELF integrity and security-focused utils")
|
| 441 | (description "The pax-utils package contains a small set of utilities
|
| 442 | for performing mostly security checks on systems. It is focused on the ELF
|
| 443 | format. The included utilities are:
|
| 444 | @table @command
|
| 445 | @item pspax List ELF/PaX information about running processes
|
| 446 | @item scanelf Scan ELF binaries
|
| 447 | @item dumpelf Dump internal ELF structure
|
| 448 | @item scanmacho Scan Mach-O binaries
|
| 449 | @item symtree Display libraries that satisfy undefined symbols, as a tree
|
| 450 | @item lddtree Display ELF dependencies as a tree.
|
| 451 | @end table")
|
| 452 | (license license:gpl2+)))
|
| 453 |
|
| 454 | (define-public libdwarf
|
| 455 | (package
|
| 456 | (name "libdwarf")
|
| 457 | (version "0.11.0")
|
| 458 | (source (origin
|
| 459 | (method git-fetch)
|
| 460 | |
| 461 | |
| 462 | |
| 463 | (uri (git-reference
|
| 464 | (url "https://github.com/davea42/libdwarf-code")
|
| 465 | (commit (string-append "v" version))))
|
| 466 | (file-name (git-file-name name version))
|
| 467 | (sha256
|
| 468 | (base32
|
| 469 | "0j4r6558rsgx7fhwa46mqix4jlxyf6m4h8i2nsxcq8j30siq5b85"))))
|
| 470 | (build-system gnu-build-system)
|
| 471 | (arguments
|
| 472 | '(#:configure-flags '("--enable-shared")))
|
| 473 | (native-inputs (list autoconf automake libtool pkg-config python))
|
| 474 | (inputs (list elfutils))
|
| 475 | (home-page "https://www.prevanders.net/dwarf.html")
|
| 476 | (synopsis "Handle DWARF debugging information")
|
| 477 | (description "@code{libdwarf} is a library that handles the DWARF
|
| 478 | debugging information format.")
|
| 479 | |
| 480 | (license (list license:lgpl2.1 license:gpl2 license:bsd-2))))
|