2020-01-17 16:55:14

by Daniel Díaz

[permalink] [raw]
Subject: [PATCH 1/3] selftests/x86: Build with LDFLAGS and LDLIBS

During cross-compilation, it was discovered that LDFLAGS and
LDLIBS were not being used while building binaries, leading
to defaults which were not necessarily correct.

OpenEmbedded reported this kind of problem:
ERROR: QA Issue: No GNU_HASH in the ELF binary [...], didn't pass LDFLAGS?

Signed-off-by: Daniel Díaz <[email protected]>
---
tools/testing/selftests/x86/Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/x86/Makefile b/tools/testing/selftests/x86/Makefile
index 5d49bfec1e9a..f8360454eafd 100644
--- a/tools/testing/selftests/x86/Makefile
+++ b/tools/testing/selftests/x86/Makefile
@@ -71,10 +71,10 @@ all_64: $(BINARIES_64)
EXTRA_CLEAN := $(BINARIES_32) $(BINARIES_64)

$(BINARIES_32): $(OUTPUT)/%_32: %.c
- $(CC) -m32 -o $@ $(CFLAGS) $(EXTRA_CFLAGS) $^ -lrt -ldl -lm
+ $(CC) -m32 -o $@ $(CFLAGS) $(EXTRA_CFLAGS) $(LDFLAGS) $^ $(LDLIBS) -lrt -ldl -lm

$(BINARIES_64): $(OUTPUT)/%_64: %.c
- $(CC) -m64 -o $@ $(CFLAGS) $(EXTRA_CFLAGS) $^ -lrt -ldl
+ $(CC) -m64 -o $@ $(CFLAGS) $(EXTRA_CFLAGS) $(LDFLAGS) $^ $(LDLIBS) -lrt -ldl

# x86_64 users should be encouraged to install 32-bit libraries
ifeq ($(CAN_BUILD_I386)$(CAN_BUILD_X86_64),01)
--
2.20.1


2020-01-17 16:57:00

by Daniel Díaz

[permalink] [raw]
Subject: [PATCH 3/3] selftests/bpf: Build urandom_read with LDFLAGS and LDLIBS

During cross-compilation, it was discovered that LDFLAGS and
LDLIBS were not being used while building binaries, leading
to defaults which were not necessarily correct.

OpenEmbedded reported this kind of problem:
ERROR: QA Issue: No GNU_HASH in the ELF binary [...], didn't pass LDFLAGS?

Signed-off-by: Daniel Díaz <[email protected]>
---
tools/testing/selftests/bpf/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index e2fd6f8d579c..f1740113d5dc 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -88,7 +88,7 @@ $(notdir $(TEST_GEN_PROGS) \
$(TEST_CUSTOM_PROGS)): %: $(OUTPUT)/% ;

$(OUTPUT)/urandom_read: urandom_read.c
- $(CC) -o $@ $< -Wl,--build-id
+ $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS) -Wl,--build-id

$(OUTPUT)/test_stub.o: test_stub.c
$(CC) -c $(CFLAGS) -o $@ $<
--
2.20.1

2020-01-17 17:15:39

by Thomas Gleixner

[permalink] [raw]
Subject: Re: [PATCH 1/3] selftests/x86: Build with LDFLAGS and LDLIBS

Daniel Díaz <[email protected]> writes:

> During cross-compilation, it was discovered that LDFLAGS and
> LDLIBS were not being used while building binaries, leading
> to defaults which were not necessarily correct.
>
> OpenEmbedded reported this kind of problem:
> ERROR: QA Issue: No GNU_HASH in the ELF binary [...], didn't pass LDFLAGS?
>
> Signed-off-by: Daniel Díaz <[email protected]>

Acked-by: Thomas Gleixner <[email protected]>

2020-01-17 19:05:23

by Andrii Nakryiko

[permalink] [raw]
Subject: Re: [PATCH 3/3] selftests/bpf: Build urandom_read with LDFLAGS and LDLIBS

On Fri, Jan 17, 2020 at 8:55 AM Daniel Díaz <[email protected]> wrote:
>
> During cross-compilation, it was discovered that LDFLAGS and
> LDLIBS were not being used while building binaries, leading
> to defaults which were not necessarily correct.
>
> OpenEmbedded reported this kind of problem:
> ERROR: QA Issue: No GNU_HASH in the ELF binary [...], didn't pass LDFLAGS?
>
> Signed-off-by: Daniel Díaz <[email protected]>
> ---

Acked-by: Andrii Nakryiko <[email protected]>

> tools/testing/selftests/bpf/Makefile | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> index e2fd6f8d579c..f1740113d5dc 100644
> --- a/tools/testing/selftests/bpf/Makefile
> +++ b/tools/testing/selftests/bpf/Makefile
> @@ -88,7 +88,7 @@ $(notdir $(TEST_GEN_PROGS) \
> $(TEST_CUSTOM_PROGS)): %: $(OUTPUT)/% ;
>
> $(OUTPUT)/urandom_read: urandom_read.c
> - $(CC) -o $@ $< -Wl,--build-id
> + $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS) -Wl,--build-id
>
> $(OUTPUT)/test_stub.o: test_stub.c
> $(CC) -c $(CFLAGS) -o $@ $<
> --
> 2.20.1
>

2020-01-20 05:10:06

by John Fastabend

[permalink] [raw]
Subject: Re: [PATCH 3/3] selftests/bpf: Build urandom_read with LDFLAGS and LDLIBS

Andrii Nakryiko wrote:
> On Fri, Jan 17, 2020 at 8:55 AM Daniel Díaz <[email protected]> wrote:
> >
> > During cross-compilation, it was discovered that LDFLAGS and
> > LDLIBS were not being used while building binaries, leading
> > to defaults which were not necessarily correct.
> >
> > OpenEmbedded reported this kind of problem:
> > ERROR: QA Issue: No GNU_HASH in the ELF binary [...], didn't pass LDFLAGS?
> >
> > Signed-off-by: Daniel Díaz <[email protected]>
> > ---
>
> Acked-by: Andrii Nakryiko <[email protected]>
Acked-by: John Fastabend <[email protected]>

2020-01-22 17:24:33

by Daniel Borkmann

[permalink] [raw]
Subject: Re: [PATCH 3/3] selftests/bpf: Build urandom_read with LDFLAGS and LDLIBS

On 1/17/20 5:53 PM, Daniel Díaz wrote:
> During cross-compilation, it was discovered that LDFLAGS and
> LDLIBS were not being used while building binaries, leading
> to defaults which were not necessarily correct.
>
> OpenEmbedded reported this kind of problem:
> ERROR: QA Issue: No GNU_HASH in the ELF binary [...], didn't pass LDFLAGS?
>
> Signed-off-by: Daniel Díaz <[email protected]>

Applied, thanks!