Patchwork D8637: fuzz: add config knob for PYTHON_CONFIG_FLAGS

login
register
mail settings
Submitter phabricator
Date June 15, 2020, 7:30 p.m.
Message ID <differential-rev-PHID-DREV-wuxymkgiytivxguq3qo6-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/46508/
State Superseded
Headers show

Comments

phabricator - June 15, 2020, 7:30 p.m.
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  I'll clean this up once we get oss-fuzz to use Python 3.8 instead of
  2.7, but for now we need a way to evolve the flags passed to
  python-config in lockstep with the Python version. Yuck.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D8637

AFFECTED FILES
  contrib/fuzz/Makefile

CHANGE DETAILS




To: durin42, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/contrib/fuzz/Makefile b/contrib/fuzz/Makefile
--- a/contrib/fuzz/Makefile
+++ b/contrib/fuzz/Makefile
@@ -11,6 +11,7 @@ 
 LIB_FUZZING_ENGINE ?= standalone_fuzz_target_runner.o
 
 PYTHON_CONFIG ?= $$OUT/sanpy/bin/python-config
+PYTHON_CONFIG_FLAGS ?= --ldflags
 
 CXXFLAGS += -Wno-deprecated-register
 
@@ -67,7 +68,7 @@ 
 	  -Wno-register -Wno-macro-redefined \
 	  -I../../mercurial dirs.cc \
 	  pyutil.o $(PARSERS_OBJS) \
-	  $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) --ldflags` \
+	  $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) $(PYTHON_CONFIG_FLAGS)` \
 	  -o $$OUT/dirs_fuzzer
 
 fncache_fuzzer: fncache.cc 
@@ -75,7 +76,7 @@ 
 	  -Wno-register -Wno-macro-redefined \
 	  -I../../mercurial fncache.cc \
 	  pyutil.o $(PARSERS_OBJS) \
-	  $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) --ldflags` \
+	  $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) $(PYTHON_CONFIG_FLAGS)` \
 	  -o $$OUT/fncache_fuzzer
 
 jsonescapeu8fast_fuzzer: jsonescapeu8fast.cc pyutil.o $(PARSERS_OBJS)
@@ -83,7 +84,7 @@ 
 	  -Wno-register -Wno-macro-redefined \
 	  -I../../mercurial jsonescapeu8fast.cc \
 	  pyutil.o $(PARSERS_OBJS) \
-	  $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) --ldflags` \
+	  $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) $(PYTHON_CONFIG_FLAGS)` \
 	  -o $$OUT/jsonescapeu8fast_fuzzer
 
 manifest_fuzzer: manifest.cc pyutil.o $(PARSERS_OBJS) $$OUT/manifest_fuzzer_seed_corpus.zip
@@ -91,7 +92,7 @@ 
 	  -Wno-register -Wno-macro-redefined \
 	  -I../../mercurial manifest.cc \
 	  pyutil.o $(PARSERS_OBJS) \
-	  $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) --ldflags` \
+	  $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) $(PYTHON_CONFIG_FLAGS)` \
 	  -o $$OUT/manifest_fuzzer
 
 revlog_fuzzer: revlog.cc pyutil.o $(PARSERS_OBJS) $$OUT/revlog_fuzzer_seed_corpus.zip
@@ -99,7 +100,7 @@ 
 	  -Wno-register -Wno-macro-redefined \
 	  -I../../mercurial revlog.cc \
 	  pyutil.o $(PARSERS_OBJS) \
-	  $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) --ldflags` \
+	  $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) $(PYTHON_CONFIG_FLAGS)` \
 	  -o $$OUT/revlog_fuzzer
 
 dirstate_fuzzer: dirstate.cc pyutil.o $(PARSERS_OBJS) $$OUT/dirstate_fuzzer_seed_corpus.zip
@@ -107,7 +108,7 @@ 
 	  -Wno-register -Wno-macro-redefined \
 	  -I../../mercurial dirstate.cc \
 	  pyutil.o $(PARSERS_OBJS) \
-	  $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) --ldflags` \
+	  $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) $(PYTHON_CONFIG_FLAGS)` \
 	  -o $$OUT/dirstate_fuzzer
 
 fm1readmarkers_fuzzer: fm1readmarkers.cc pyutil.o $(PARSERS_OBJS) $$OUT/fm1readmarkers_fuzzer_seed_corpus.zip
@@ -115,7 +116,7 @@ 
 	  -Wno-register -Wno-macro-redefined \
 	  -I../../mercurial fm1readmarkers.cc \
 	  pyutil.o $(PARSERS_OBJS) \
-	  $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) --ldflags` \
+	  $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) $(PYTHON_CONFIG_FLAGS)` \
 	  -o $$OUT/fm1readmarkers_fuzzer
 
 clean: