Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Nov 2014 17:51:26 +0100
From:      Jan Beich <jbeich@vfemail.net>
To:        Fabian Keil <freebsd-listen@fabiankeil.de>
Cc:        freebsd-ports@freebsd.org
Subject:   Re: Request for (i386) testing: american fuzzy lop
Message-ID:  <a93l-6cj5-wny@vfemail.net>
In-Reply-To: <3fb914c3.1002708a@fabiankeil.de> (Fabian Keil's message of "Thu,  20 Nov 2014 16:02:10 %2B0100")
References:  <3dc1c153.7b7b9177@fabiankeil.de> <546DF8A5.3060601@gmail.com> <3fb914c3.1002708a@fabiankeil.de>

next in thread | previous in thread | raw e-mail | index | archive | help
Fabian Keil <freebsd-listen@fabiankeil.de> writes:

> Vitaly Magerya <vmagerya@gmail.com> wrote:
>> I don't know what this part is supposed to do:
>> 
>>     # Workaround to make sure clang isn't confused for gcc
>>     CC=${COMPILER_TYPE}
>> 
>> ... but it seems to set CC to empty string on my machine; and I
>> get a whole bunch of this as the result:
>
> Interesting.
>
> It was supposed to set CC for gmake to either clang or gcc,
> otherwise a cc that is clang is treated as gcc.
>
> However clobbering CC directly is obviously wrong and on
> systems where cc is still gcc, the workaround shouldn't
> be necessary anyway.
>
> Does it work for you if you replace the line with:
> MAKE_ARGS+=	CC=${COMPILER_TYPE}
> ?

USE_GCC becomes a nop while setting explicitly fails

  $ uname -rp
  11.0-CURRENT amd64

  $ echo CC=gcc49 >>/etc/.make.conf
  $ make
  ...
  ===>  Building for afl-0.60b
  gmake[2]: Entering directory '/work/afl-0.60b'
  [*] Checking for the ability to compile x86 code...
  [+] All done! Be sure to review README - it's pretty short and useful.
  gcc: not found

Why not patch the vendor Makefile? Here're my changes:

  - use $(CC) --version to detect clang
  - remove -g from CFLAGS (see WITH_DEBUG)
  - strip(1) binaries during install
  - global TESTing with generic option name

while poudriere caught Clang i386 failing

  [*] Testing the CC wrapper and instrumentation output...
  AFL_QUIET=1 AFL_INST_RATIO=100 AFL_PATH=. ./afl-clang -O2 -pipe  -fstack-protector -fno-strict-aliasing -Wall -D_FORTIFY_SOURCE=2 -Wno-pointer-sign -DAFL_PATH=\"/prefix/afl-0.60b/lib/afl\" -DDOC_PATH=\"/prefix/afl-0.60b/share/doc/afl\" -DVERSION=\"0.60b\" -Wno-format test-instr.c -o test-instr
  /tmp/.afl-19244-1416499444.s: Assembler messages:
  /tmp/.afl-19244-1416499444.s:222: Error: unknown pseudo-op: `.cfi_sections'
  clang: error: assembler command failed with exit code 1 (use -v to see invocation)

diff --git security/afl/Makefile security/afl/Makefile
index d7b2c93..bbe2992 100644
--- security/afl/Makefile
+++ security/afl/Makefile
@@ -9,10 +9,9 @@ MASTER_SITES=	http://lcamtuf.coredump.cx/afl/releases/
 MAINTAINER=	fk@fabiankeil.de
 COMMENT=	Fast instrumented fuzzer
 
-USES=		compiler gmake tar:tgz
+USES=		gmake tar:tgz
 
-OPTIONS_DEFINE=			DOCS TEST_INSTRUMENTATION
-TEST_INSTRUMENTATION_DESC=	Execute tests expected to fail in jails
+OPTIONS_DEFINE=			DOCS TEST
 OPTIONS_DEFAULT=		DOCS
 
 ONLY_FOR_ARCHS=		amd64 i386
@@ -20,17 +19,17 @@ ONLY_FOR_ARCHS_REASON=	Uses binary instrumentation
 
 .include <bsd.port.options.mk>
 
-# Workaround to make sure clang isn't confused for gcc
-MAKE_ARGS+=	CC=${COMPILER_TYPE}
-
 post-patch:
-.if ! ${PORT_OPTIONS:MTEST_INSTRUMENTATION}
+.if ! ${PORT_OPTIONS:MTEST}
 # afl needs shmget() which usually isn't available in jails. Disabling
 # the instrumentation tests makes sure building packages in jails works
 # by default anyway.
 	${REINPLACE_CMD} -e 's@^\(all.*\) test_build@\1@' ${WRKSRC}/Makefile
 .endif
-	${REINPLACE_CMD} -e 's@-O3@@' ${WRKSRC}/Makefile
+	${REINPLACE_CMD} -e 's@ -O3@@; s@ -g@@' \
+		-e '/findstring clang/s@$$(CC)@$$(shell & --version)@' \
+		-e 's/install -m 755/${INSTALL_PROGRAM}/' \
+		${WRKSRC}/Makefile
 
 post-install:
 .if ${PORT_OPTIONS:MDOCS}

-------------------------------------------------

VFEmail.net - http://www.vfemail.net
ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out of the NSA's hands!
$24.95 ONETIME Lifetime accounts with Privacy Features!  
15GB disk! No bandwidth quotas!
Commercial and Bulk Mail Options!  



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?a93l-6cj5-wny>