tools/resolve_btfids: Pass HOSTCFLAGS as EXTRA_CFLAGS to prepare targets
authorJiri Olsa <jolsa@kernel.org>
Thu, 9 Feb 2023 14:37:35 +0000 (15:37 +0100)
committerAndrii Nakryiko <andrii@kernel.org>
Thu, 9 Feb 2023 19:44:56 +0000 (11:44 -0800)
commit2531ba0e4ae67d6d0219400af27805fe52cd28e8
tree1fd1c6ea24aa5eb37cba46d83b4134f7c77354a7
parent06744f24696e1e7598412c3df61a538b57ebec22
tools/resolve_btfids: Pass HOSTCFLAGS as EXTRA_CFLAGS to prepare targets

Thorsten reported build issue with command line that defined extra
HOSTCFLAGS that were not passed into 'prepare' targets, but were
used to build resolve_btfids objects.

This results in build fail when these objects are linked together:

  /usr/bin/ld: /build.../tools/bpf/resolve_btfids//libbpf/libbpf.a(libbpf-in.o):
  relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE \
  object; recompile with -fPIE

Fixing this by passing HOSTCFLAGS in EXTRA_CFLAGS as part of
HOST_OVERRIDES variable for prepare targets.

[1] https://lore.kernel.org/bpf/f7922132-6645-6316-5675-0ece4197bfff@leemhuis.info/

Fixes: 56a2df7615fa ("tools/resolve_btfids: Compile resolve_btfids as host program")
Reported-by: Thorsten Leemhuis <linux@leemhuis.info>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Tested-by: Thorsten Leemhuis <linux@leemhuis.info>
Acked-by: Ian Rogers <irogers@google.com>
Link: https://lore.kernel.org/bpf/20230209143735.4112845-1-jolsa@kernel.org
tools/bpf/resolve_btfids/Makefile