diff mbox series

[v2,bpf] runqslower: fix Makefile

Message ID da8c16011df5628cfc9ddfeaeca2aa5d90be920b.1580373028.git.hex@fb.com
State Changes Requested
Delegated to: BPF Maintainers
Headers show
Series [v2,bpf] runqslower: fix Makefile | expand

Commit Message

Yulia Kartseva Jan. 30, 2020, 8:38 a.m. UTC
From: Julia Kartseva <hex@fb.com>

Fixes: 9c01546d26d2 ("tools/bpf: Add runqslower tool to tools/bpf")
Signed-off-by: Julia Kartseva <hex@fb.com>
Acked-by: Andrii Nakryiko <andriin@fb.com>

Fix undefined reference linker errors when building runqslower with
gcc 7.4.0 on Ubuntu 18.04.
The issue is with misplaced -lelf, -lz options in Makefile:
$(Q)$(CC) $(CFLAGS) -lelf -lz $^ -o $@

-lelf, -lz options should follow the list of target dependencies:
$(Q)$(CC) $(CFLAGS) $^ -lelf -lz -o $@
or after substitution
cc -g -Wall runqslower.o libbpf.a -lelf -lz -o runqslower

The current order of gcc params causes failure in libelf symbols resolution,
e.g. undefined reference to `elf_memory'
---
 tools/bpf/runqslower/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Maciej Fijalkowski Jan. 30, 2020, 4:19 a.m. UTC | #1
On Thu, Jan 30, 2020 at 12:38:32AM -0800, Yulia Kartseva wrote:
> From: Julia Kartseva <hex@fb.com>

I don't think you need the 'From: ' line if you are the sender of patch.

> 
> Fixes: 9c01546d26d2 ("tools/bpf: Add runqslower tool to tools/bpf")
> Signed-off-by: Julia Kartseva <hex@fb.com>
> Acked-by: Andrii Nakryiko <andriin@fb.com>

These tags should be placed after the commit message.

> 
> Fix undefined reference linker errors when building runqslower with
> gcc 7.4.0 on Ubuntu 18.04.
> The issue is with misplaced -lelf, -lz options in Makefile:
> $(Q)$(CC) $(CFLAGS) -lelf -lz $^ -o $@
> 
> -lelf, -lz options should follow the list of target dependencies:
> $(Q)$(CC) $(CFLAGS) $^ -lelf -lz -o $@
> or after substitution
> cc -g -Wall runqslower.o libbpf.a -lelf -lz -o runqslower
> 
> The current order of gcc params causes failure in libelf symbols resolution,
> e.g. undefined reference to `elf_memory'
> ---
>  tools/bpf/runqslower/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/bpf/runqslower/Makefile b/tools/bpf/runqslower/Makefile
> index 0c021352b..87eae5be9 100644
> --- a/tools/bpf/runqslower/Makefile
> +++ b/tools/bpf/runqslower/Makefile
> @@ -41,7 +41,7 @@ clean:
>  
>  $(OUTPUT)/runqslower: $(OUTPUT)/runqslower.o $(BPFOBJ)
>  	$(call msg,BINARY,$@)
> -	$(Q)$(CC) $(CFLAGS) -lelf -lz $^ -o $@
> +	$(Q)$(CC) $(CFLAGS) $^ -lelf -lz -o $@
>  
>  $(OUTPUT)/runqslower.o: runqslower.h $(OUTPUT)/runqslower.skel.h	      \
>  			$(OUTPUT)/runqslower.bpf.o
> -- 
> 2.17.1
>
diff mbox series

Patch

diff --git a/tools/bpf/runqslower/Makefile b/tools/bpf/runqslower/Makefile
index 0c021352b..87eae5be9 100644
--- a/tools/bpf/runqslower/Makefile
+++ b/tools/bpf/runqslower/Makefile
@@ -41,7 +41,7 @@  clean:
 
 $(OUTPUT)/runqslower: $(OUTPUT)/runqslower.o $(BPFOBJ)
 	$(call msg,BINARY,$@)
-	$(Q)$(CC) $(CFLAGS) -lelf -lz $^ -o $@
+	$(Q)$(CC) $(CFLAGS) $^ -lelf -lz -o $@
 
 $(OUTPUT)/runqslower.o: runqslower.h $(OUTPUT)/runqslower.skel.h	      \
 			$(OUTPUT)/runqslower.bpf.o