guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#62666] [PATCH v2 3/3] gnu: aflplusplus: Build afl-gcc/g++-fast


From: Denis 'GNUtoo' Carikli
Subject: [bug#62666] [PATCH v2 3/3] gnu: aflplusplus: Build afl-gcc/g++-fast
Date: Fri, 15 Sep 2023 05:27:54 +0200

* gnu/packages/debug.scm (aflplusplus): [inputs]: Add gcc, gmp.
---
ChangeLog: New patch
---
 gnu/packages/debug.scm | 32 +++++++++++++++++++++++++++++++-
 1 file changed, 31 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/debug.scm b/gnu/packages/debug.scm
index 04458d0220..c9fdca8c8b 100644
--- a/gnu/packages/debug.scm
+++ b/gnu/packages/debug.scm
@@ -50,6 +50,7 @@ (define-module (gnu packages debug)
   #:use-module (gnu packages code)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages flex)
+  #:use-module (gnu packages gcc)
   #:use-module (gnu packages gdb)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages gtk)
@@ -59,6 +60,7 @@ (define-module (gnu packages debug)
   #:use-module (gnu packages libusb)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages llvm)
+  #:use-module (gnu packages multiprecision)
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages ninja)
   #:use-module (gnu packages perl)
@@ -473,7 +475,35 @@ (define-public aflplusplus
               (sha256
                (base32
                 "01hxj65if6rkjrj1fqcgq0jl95dirhkn00mi2k65mff6bckaamxg"))))
-    (inputs (list python qemu))
+    (arguments
+     (substitute-keyword-arguments (package-arguments american-fuzzy-lop)
+       ((#:phases phases)
+        `(modify-phases ,phases
+           ;; TODO: Enable to cross compile aflplusplus by also enabling qemu
+           ;; to be cross compiled and by fixing the use-build-gcc phase below.
+           (add-before 'build 'use-build-gcc
+             (lambda _
+               ;; We need to patch it to select the build-time gcc else we get
+               ;; something like that:
+               ;; $ afl-gcc-fast main.c
+               ;; afl-cc++4.08c by [...] - mode: GCC_PLUGIN-DEFAULT
+               ;; cc1: error: cannot load plugin
+               ;; /gnu/[...]-aflplusplus-4.08c/bin/../lib/afl//afl-gcc-pass.so:
+               ;; /gnu/[...]-aflplusplus-4.08c/bin/../lib/afl//afl-gcc-pass.so:
+               ;; undefined symbol:
+               ;; 
_Z30gimple_build_call_internal_vec11internal_fn3vecIP9tree_node7va_heap6vl_ptrE
+               (substitute* "src/afl-cc.c"
+                 (("alt_cc = \"gcc\";")
+                  (string-append "alt_cc = \""
+                                 (which "gcc") "\";"))
+                 (("alt_cxx = \"g\\+\\+\";")
+                  (string-append "alt_cxx = \""
+                                 (which "g++") "\";")))))))))
+    ;; afl-gcc and g++-fast require gcc and gmp. The gcc-11 input is used
+    ;; instead of gcc because in the Dockerfile inside aflplusplus source code
+    ;; has the following comment: "GCC 12 is producing compile errors for some
+    ;; targets so we stay at GCC 11".
+    (inputs (list gcc-11 gmp python qemu))
     (home-page "https://aflplus.plus";)
     (description
      "AFLplusplus is a security-oriented fuzzer that employs a novel type of
-- 
2.41.0






reply via email to

[Prev in Thread] Current Thread [Next in Thread]