* [PATCH bpf-next] tools/resolve_btfids: Pass HOSTCFLAGS as EXTRA_CFLAGS to prepare targets
@ 2023-02-09 14:37 Jiri Olsa
2023-02-09 19:31 ` Ian Rogers
2023-02-10 23:00 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Jiri Olsa @ 2023-02-09 14:37 UTC (permalink / raw)
To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko
Cc: Thorsten Leemhuis, bpf, Martin KaFai Lau, Song Liu, Yonghong Song,
John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Ian Rogers
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>
Tested-by: Thorsten Leemhuis <linux@leemhuis.info>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/bpf/resolve_btfids/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/bpf/resolve_btfids/Makefile b/tools/bpf/resolve_btfids/Makefile
index 2abdd85b4a08..ac548a7baa73 100644
--- a/tools/bpf/resolve_btfids/Makefile
+++ b/tools/bpf/resolve_btfids/Makefile
@@ -19,7 +19,7 @@ endif
# Overrides for the prepare step libraries.
HOST_OVERRIDES := AR="$(HOSTAR)" CC="$(HOSTCC)" LD="$(HOSTLD)" ARCH="$(HOSTARCH)" \
- CROSS_COMPILE=""
+ CROSS_COMPILE="" EXTRA_CFLAGS="$(HOSTCFLAGS)"
RM ?= rm
HOSTCC ?= gcc
--
2.39.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH bpf-next] tools/resolve_btfids: Pass HOSTCFLAGS as EXTRA_CFLAGS to prepare targets
2023-02-09 14:37 [PATCH bpf-next] tools/resolve_btfids: Pass HOSTCFLAGS as EXTRA_CFLAGS to prepare targets Jiri Olsa
@ 2023-02-09 19:31 ` Ian Rogers
2023-02-10 23:00 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Ian Rogers @ 2023-02-09 19:31 UTC (permalink / raw)
To: Jiri Olsa
Cc: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
Thorsten Leemhuis, bpf, Martin KaFai Lau, Song Liu, Yonghong Song,
John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo
On Thu, Feb 9, 2023 at 6:37 AM Jiri Olsa <jolsa@kernel.org> wrote:
>
> 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>
> Tested-by: Thorsten Leemhuis <linux@leemhuis.info>
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Acked-by: Ian Rogers <irogers@google.com>
Thanks,
Ian
> ---
> tools/bpf/resolve_btfids/Makefile | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/bpf/resolve_btfids/Makefile b/tools/bpf/resolve_btfids/Makefile
> index 2abdd85b4a08..ac548a7baa73 100644
> --- a/tools/bpf/resolve_btfids/Makefile
> +++ b/tools/bpf/resolve_btfids/Makefile
> @@ -19,7 +19,7 @@ endif
>
> # Overrides for the prepare step libraries.
> HOST_OVERRIDES := AR="$(HOSTAR)" CC="$(HOSTCC)" LD="$(HOSTLD)" ARCH="$(HOSTARCH)" \
> - CROSS_COMPILE=""
> + CROSS_COMPILE="" EXTRA_CFLAGS="$(HOSTCFLAGS)"
>
> RM ?= rm
> HOSTCC ?= gcc
> --
> 2.39.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH bpf-next] tools/resolve_btfids: Pass HOSTCFLAGS as EXTRA_CFLAGS to prepare targets
2023-02-09 14:37 [PATCH bpf-next] tools/resolve_btfids: Pass HOSTCFLAGS as EXTRA_CFLAGS to prepare targets Jiri Olsa
2023-02-09 19:31 ` Ian Rogers
@ 2023-02-10 23:00 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-02-10 23:00 UTC (permalink / raw)
To: Jiri Olsa
Cc: ast, daniel, andrii, linux, bpf, kafai, songliubraving, yhs,
john.fastabend, kpsingh, sdf, haoluo, irogers
Hello:
This patch was applied to bpf/bpf-next.git (master)
by Andrii Nakryiko <andrii@kernel.org>:
On Thu, 9 Feb 2023 15:37:35 +0100 you wrote:
> 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
>
> [...]
Here is the summary with links:
- [bpf-next] tools/resolve_btfids: Pass HOSTCFLAGS as EXTRA_CFLAGS to prepare targets
https://git.kernel.org/bpf/bpf-next/c/2531ba0e4ae6
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-02-10 23:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-09 14:37 [PATCH bpf-next] tools/resolve_btfids: Pass HOSTCFLAGS as EXTRA_CFLAGS to prepare targets Jiri Olsa
2023-02-09 19:31 ` Ian Rogers
2023-02-10 23:00 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox