git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Josh Steadmon <steadmon@google.com>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: [PATCH 2/2] fuzz: link fuzz programs with `make all` on Linux
Date: Wed, 10 Apr 2024 17:11:00 -0400	[thread overview]
Message-ID: <20240410211100.GA2276041@coredump.intra.peff.net> (raw)
In-Reply-To: <ZhW6BM9V-Rto_CW4@google.com>

On Tue, Apr 09, 2024 at 02:58:28PM -0700, Josh Steadmon wrote:

> > It would have been easier on the eyes if we had the fuzz things
> > together, perhaps like this simplified version?  We build FUZZ_OBJS
> > either way, and when the LINK_FUZZ_PROGRAMS is requested, we follow
> > the fuzz-all recipe, too.
> 
> We need the LINK_FUZZ_PROGRAMS conditional to happen after we import
> config.mak.uname (line 1434 in my V1). We also need to define FUZZ_OBJS
> prior to adding it to OBJECTS (line 2698 in V1). I can move all of the
> fuzz-definition within that range, keeping everything in one place at
> the cost of a larger diff. I'll do that for V2, but if you prefer
> otherwise please let me know.
> 
> Although I'm not 100% sure that we even need to add FUZZ_OBJS to
> OBJECTS, so let me check that tomorrow. If not, then I can move
> everything to the bottom of the Makefile where we also define fuzz-all
> and the build rules for FUZZ_PROGRAMS.

The conditional has to be read handled while reading the Makefile, but
as a "simple" variable, OBJECTS isn't expanded until the whole Makefile
has been read. So for example this out-of-order definition works:

diff --git a/Makefile b/Makefile
index 533eaae612..5dbf1935a1 100644
--- a/Makefile
+++ b/Makefile
@@ -755,6 +755,7 @@ ETAGS_TARGET = TAGS
 # If you add a new fuzzer, please also make sure to run it in
 # ci/run-build-and-minimal-fuzzers.sh so that we make sure it still links and
 # runs in the future.
+OBJECTS += $(FUZZ_OBJS)
 FUZZ_OBJS += oss-fuzz/dummy-cmd-main.o
 FUZZ_OBJS += oss-fuzz/fuzz-commit-graph.o
 FUZZ_OBJS += oss-fuzz/fuzz-config.o
@@ -2695,7 +2696,6 @@ OBJECTS += $(SCALAR_OBJS)
 OBJECTS += $(PROGRAM_OBJS)
 OBJECTS += $(TEST_OBJS)
 OBJECTS += $(XDIFF_OBJS)
-OBJECTS += $(FUZZ_OBJS)
 OBJECTS += $(REFTABLE_OBJS) $(REFTABLE_TEST_OBJS)
 OBJECTS += $(UNIT_TEST_OBJS)
 

Now whether that is useful for organizing the Makefile, I don't know,
but I thought I'd throw it out there in case it helps you.

-Peff


  parent reply	other threads:[~2024-04-10 21:11 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-05 21:11 [PATCH 0/2] fuzz: build fuzzers by default on Linux Josh Steadmon
2024-03-05 21:11 ` [PATCH 1/2] ci: also define CXX environment variable Josh Steadmon
2024-03-05 21:37   ` Junio C Hamano
2024-04-09 21:32     ` Josh Steadmon
2024-03-06  0:50   ` Jeff King
2024-03-06  1:00     ` Jeff King
2024-04-10 20:58       ` Josh Steadmon
2024-03-05 21:12 ` [PATCH 2/2] fuzz: link fuzz programs with `make all` on Linux Josh Steadmon
2024-03-05 21:44   ` Junio C Hamano
2024-04-09 21:58     ` Josh Steadmon
2024-04-10 20:49       ` Josh Steadmon
2024-04-10 20:57         ` Junio C Hamano
2024-04-10 21:11       ` Jeff King [this message]
2024-03-26 21:51 ` [PATCH 0/2] fuzz: build fuzzers by default " Junio C Hamano
2024-04-09 21:34   ` Josh Steadmon
2024-04-11 18:14 ` [PATCH v2 " Josh Steadmon
2024-04-11 18:14   ` [PATCH v2 1/2] ci: also define CXX environment variable Josh Steadmon
2024-04-12  4:22     ` Jeff King
2024-04-24 18:15       ` Josh Steadmon
2024-04-11 18:14   ` [PATCH v2 2/2] fuzz: link fuzz programs with `make all` on Linux Josh Steadmon
2024-04-11 21:39     ` Junio C Hamano
2024-04-24 18:14 ` [PATCH v3] " Josh Steadmon
2024-04-24 19:07   ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240410211100.GA2276041@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=steadmon@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).