summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSören Tempel <soeren+git@soeren-tempel.net>2025-10-06 07:06:13 +0200
committer宋文武 <iyzsong@member.fsf.org>2025-11-24 18:50:37 +0800
commite11b1787217aa306d2925d3857efd04a8f68b08d (patch)
treeeb24f10d39185bc5bb3f7fdc35d85541df26d06b
parentc3a3858c93b2af163a7fe860149939fdda189ca9 (diff)
gnu: aflplusplus: Enable llvm_mode and afl-clang-lto.
* gnu/packages/debug.scm (aflplusplus) [inputs]: Replace gcc-11 with gcc; add clang. [native-inputs]: Replace gcc-11 with gcc. [arguments]<make-flags>: Set CXX, LLVM_CONFIG, AFL_REAL_LD, CLANG_BIN, CLANGPP_BIN, LLVM_LTO and AFL_CLANG_FLTO. <phases>: Add fatal-llvm-failure and patch-clang-path. Closes: guix/guix#3358 Change-Id: Ia306cc33b07186299c4310619a0b70bc42fea1be Signed-off-by: 宋文武 <iyzsong@member.fsf.org>
-rw-r--r--gnu/packages/debug.scm44
1 files changed, 41 insertions, 3 deletions
diff --git a/gnu/packages/debug.scm b/gnu/packages/debug.scm
index cf00e82cca0..2258e2ff2df 100644
--- a/gnu/packages/debug.scm
+++ b/gnu/packages/debug.scm
@@ -627,9 +627,47 @@ server and embedded PowerPC, and S390 guests.")
627 (string-append "DOC_PATH=" #$output "/share/doc/" 627 (string-append "DOC_PATH=" #$output "/share/doc/"
628 #$(package-name this-package) "-" 628 #$(package-name this-package) "-"
629 #$(package-version this-package)) 629 #$(package-version this-package))
630 (string-append "CC=" #$(cc-for-target)))) 630 (string-append "CC=" #$(cc-for-target))
631 (string-append "CXX=" #$(cxx-for-target))
632 (string-append "LLVM_CONFIG="
633 (search-input-file %build-inputs "/bin/llvm-config"))
634 ;; Need to use LLD with the llvm_mode, because LTO in
635 ;; combination with binutils gold is currently broken.
636 ;;
637 ;; See: https://codeberg.org/guix/guix/issues/3307
638 (string-append "AFL_REAL_LD="
639 (search-input-file %build-inputs "/bin/ld.lld"))
640 (string-append "CLANG_BIN="
641 (search-input-file %build-inputs "/bin/clang"))
642 (string-append "CLANGPP_BIN="
643 (search-input-file %build-inputs "/bin/clang++"))
644 "LLVM_LTO=1"
645 "AFL_CLANG_FLTO=-flto=full"))
631 ((#:phases phases '%standard-phases) 646 ((#:phases phases '%standard-phases)
632 #~(modify-phases #$phases 647 #~(modify-phases #$phases
648 ;; Ensure that the build fails early if LLVM support fails to
649 ;; compile, makes the build log much easier to understand.
650 (add-after 'unpack 'fatal-llvm-failure
651 (lambda* (#:key inputs #:allow-other-keys)
652 (substitute* "GNUmakefile"
653 (("-\\$\\(MAKE\\) ..* -f GNUmakefile.llvm$" all)
654 (substring all 1))))) ; remove the leading '-'
655 ;; GNUmakefile.llvm tries to find clang/clang++ relative to the
656 ;; --bindir reported by llvm-config, but since llvm and clang
657 ;; have different store paths on Guix, this doesn't work here.
658 (add-after 'unpack 'patch-clang-path
659 (lambda* (#:key inputs #:allow-other-keys)
660 (substitute* "GNUmakefile.llvm"
661 (("^CC *= .*$")
662 (string-append
663 "override CC = "
664 (search-input-file inputs "/bin/clang")
665 "\n"))
666 (("^CXX *= .*$")
667 (string-append
668 "override CXX = "
669 (search-input-file inputs "/bin/clang++")
670 "\n")))))
633 ;; For GCC plugins. 671 ;; For GCC plugins.
634 (add-after 'unpack 'patch-gcc-path 672 (add-after 'unpack 'patch-gcc-path
635 (lambda* (#:key inputs #:allow-other-keys) 673 (lambda* (#:key inputs #:allow-other-keys)
@@ -656,8 +694,8 @@ server and embedded PowerPC, and S390 guests.")
656 `("AFL_PATH" = (,(string-append #$output "/lib/afl")))))))))) 694 `("AFL_PATH" = (,(string-append #$output "/lib/afl"))))))))))
657 ;; According to the Dockerfile, GCC 12 is producing compile errors for some 695 ;; According to the Dockerfile, GCC 12 is producing compile errors for some
658 ;; targets, so explicitly use GCC 11 here. 696 ;; targets, so explicitly use GCC 11 here.
659 (inputs (list gcc-11 gmp python qemu-for-aflplusplus)) 697 (inputs (list llvm-20 clang-20 lld-20 gcc gmp python qemu-for-aflplusplus))
660 (native-inputs (list gcc-11)) 698 (native-inputs (list gcc))
661 (home-page "https://aflplus.plus/") 699 (home-page "https://aflplus.plus/")
662 (description 700 (description
663 "AFLplusplus is a security-oriented fuzzer that employs a novel type of 701 "AFLplusplus is a security-oriented fuzzer that employs a novel type of