git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Makefile: use CXXFLAGS for linking fuzzers

From
Stefan Beller <sbeller@google.com>
Date
Nov 12, 2018, 22:47 UTC
Message-ID
<CAGZ79kb68+vxHmwbttvXgaxvPdqAh3vJjZ9+U+BjY7ZeZzOxUA@mail.gmail.com>
In-Reply-To
<1630a93f8270ca090459be8cc7213221cc6250cf.1542060094.git.steadmon@google.com>
On Mon, Nov 12, 2018 at 2:03 PM <steadmon@google.com> wrote:
Show 5 quoted lines
>
> OSS-Fuzz requires C++-specific flags to link fuzzers. Passing these in
> CFLAGS causes lots of build warnings. Using separate CXXFLAGS avoids
> this.
>
That makes sense in this context, ....
>  CFLAGS = -g -O2 -Wall
> +CXXFLAGS ?= $(CFLAGS)

... but out of context, just by reading the relevant part of the Makefile, a user might mistakenly assume we do some C++ trickery for standard compilation of Git. (Is that bad or do we just not care?)

I wonder if setting the CXXFLAGS near or in the fuzz target would be better.

Show 13 quoted lines
>  LDFLAGS =
>  ALL_CFLAGS = $(CPPFLAGS) $(CFLAGS)
>  ALL_LDFLAGS = $(LDFLAGS)
> @@ -3098,14 +3099,14 @@ cover_db_html: cover_db
>  # An example command to build against libFuzzer from LLVM 4.0.0:
>  #
>  # make CC=clang CXX=clang++ \
> -#      CFLAGS="-fsanitize-coverage=trace-pc-guard -fsanitize=address" \
> +#      CXXFLAGS="-fsanitize-coverage=trace-pc-guard -fsanitize=address" \
>  #      LIB_FUZZING_ENGINE=/usr/lib/llvm-4.0/lib/libFuzzer.a \
>  #      fuzz-all
>  #
>  .PHONY: fuzz-all
Maybe here?
Show 5 quoted lines
>
>  $(FUZZ_PROGRAMS): all
> -       $(QUIET_LINK)$(CXX) $(CFLAGS) $(LIB_OBJS) $(BUILTIN_OBJS) \
> +       $(QUIET_LINK)$(CXX) $(CXXFLAGS) $(LIB_OBJS) $(BUILTIN_OBJS) \
>                 $(XDIFF_OBJS) $(EXTLIBS) git.o $@.o $(LIB_FUZZING_ENGINE) -o $@

Thanks, Stefan

Previous: steadmon@google.comNext: Junio C Hamano
Message 2 of 6 in “Makefile: use CXXFLAGS for linking fuzzers”
  1. Makefile: use CXXFLAGS for linking fuzzerssteadmon@google.com, Nov 12, 2018
  2. Stefan BellerNov 12, 2018
  3. Junio C HamanoNov 13, 2018
  4. Josh SteadmonNov 13, 2018
  5. Junio C HamanoNov 14, 2018
  6. Makefile: use FUZZ_CXXFLAGS for linking fuzzersJosh Steadmon, Nov 14, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.