This is an automated email from the git hooks/post-receive script.

guix_mirror_bot pushed a commit to branch master
in repository guix.

The following commit(s) were added to refs/heads/master by this push:
     new e11b178721 gnu: aflplusplus: Enable llvm_mode and afl-clang-lto.
e11b178721 is described below

commit e11b1787217aa306d2925d3857efd04a8f68b08d
Author: Sören Tempel <[email protected]>
AuthorDate: Mon Oct 6 07:06:13 2025 +0200

    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: 宋文武 <[email protected]>
---
 gnu/packages/debug.scm | 44 +++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 41 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/debug.scm b/gnu/packages/debug.scm
index cf00e82cca..2258e2ff2d 100644
--- a/gnu/packages/debug.scm
+++ b/gnu/packages/debug.scm
@@ -627,9 +627,47 @@ server and embedded PowerPC, and S390 guests.")
                 (string-append "DOC_PATH=" #$output "/share/doc/"
                                #$(package-name this-package) "-"
                                #$(package-version this-package))
-                (string-append "CC=" #$(cc-for-target))))
+                (string-append "CC=" #$(cc-for-target))
+                (string-append "CXX=" #$(cxx-for-target))
+                (string-append "LLVM_CONFIG="
+                               (search-input-file %build-inputs 
"/bin/llvm-config"))
+                ;; Need to use LLD with the llvm_mode, because LTO in
+                ;; combination with binutils gold is currently broken.
+                ;;
+                ;; See: https://codeberg.org/guix/guix/issues/3307
+                (string-append "AFL_REAL_LD="
+                               (search-input-file %build-inputs "/bin/ld.lld"))
+                (string-append "CLANG_BIN="
+                               (search-input-file %build-inputs "/bin/clang"))
+                (string-append "CLANGPP_BIN="
+                               (search-input-file %build-inputs 
"/bin/clang++"))
+                "LLVM_LTO=1"
+                "AFL_CLANG_FLTO=-flto=full"))
        ((#:phases phases '%standard-phases)
         #~(modify-phases #$phases
+            ;; Ensure that the build fails early if LLVM support fails to
+            ;; compile, makes the build log much easier to understand.
+            (add-after 'unpack 'fatal-llvm-failure
+              (lambda* (#:key inputs #:allow-other-keys)
+                (substitute* "GNUmakefile"
+                  (("-\\$\\(MAKE\\) ..* -f GNUmakefile.llvm$" all)
+                   (substring all 1))))) ; remove the leading '-'
+            ;; GNUmakefile.llvm tries to find clang/clang++ relative to the
+            ;; --bindir reported by llvm-config, but since llvm and clang
+            ;; have different store paths on Guix, this doesn't work here.
+            (add-after 'unpack 'patch-clang-path
+              (lambda* (#:key inputs #:allow-other-keys)
+                (substitute* "GNUmakefile.llvm"
+                  (("^CC *= .*$")
+                   (string-append
+                     "override CC = "
+                     (search-input-file inputs "/bin/clang")
+                     "\n"))
+                  (("^CXX *= .*$")
+                   (string-append
+                     "override CXX = "
+                     (search-input-file inputs "/bin/clang++")
+                     "\n")))))
             ;; For GCC plugins.
             (add-after 'unpack 'patch-gcc-path
               (lambda* (#:key inputs #:allow-other-keys)
@@ -656,8 +694,8 @@ server and embedded PowerPC, and S390 guests.")
                   `("AFL_PATH" = (,(string-append #$output "/lib/afl"))))))))))
     ;; According to the Dockerfile, GCC 12 is producing compile errors for some
     ;; targets, so explicitly use GCC 11 here.
-    (inputs (list gcc-11 gmp python qemu-for-aflplusplus))
-    (native-inputs (list gcc-11))
+    (inputs (list llvm-20 clang-20 lld-20 gcc gmp python qemu-for-aflplusplus))
+    (native-inputs (list gcc))
     (home-page "https://aflplus.plus/";)
     (description
      "AFLplusplus is a security-oriented fuzzer that employs a novel type of

Reply via email to