Skip to content

Commit

Permalink
mirror: Fix features detection for building with clang
Browse files Browse the repository at this point in the history
When detecting the features on the machine, clang does not need the
flags for telling the linker what libraries to use. As a consequence, it
prints a warning to let users know that the flag is unused, and this
turns into an error due to the use of -Wall and -Werror:

  clang: error: -: 'linker' input unused [-Werror,-Wunused-command-line-argument]

To address it, we can temporarily add -Wno-unused-command-line-argument
to the $(CFLAGS) when we check the features with clang.

Fixes: #3
Fixes: 28b7ccc ("mirror: Reimplement feature detection and reallocarray()")

Reported-by: @aguaiyoung
Signed-off-by: Quentin Monnet <quentin@isovalent.com>
  • Loading branch information
qmonnet committed Jan 27, 2022
1 parent db4fad3 commit 8a2d7d5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Makefile.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

pound := \#

CFLAGS_BACKUP := $(CFLAGS)
ifneq ($(LLVM),)
CFLAGS += -Wno-unused-command-line-argument
endif

### feature-clang-bpf-co-re

feature-clang-bpf-co-re := \
Expand Down Expand Up @@ -103,3 +108,5 @@ $(call feature_print_status,$(HAS_LIBBFD),libbfd)

$(foreach feature,$(filter-out libbfd,$(FEATURE_DISPLAY)), \
$(call feature_print_status,$(feature-$(feature)),$(feature)))

CFLAGS := $(CFLAGS_BACKUP)

0 comments on commit 8a2d7d5

Please sign in to comment.