Re: [OS-BUILD PATCH] Fix binutils breakage
From: nick clifton on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2749#note_1626555205 BZ 2245296 should now be fixed by binutuls-2.41-9.fc40 ___ kernel mailing list -- kernel@lists.fedoraproject.org To unsubscribe send an email to kernel-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kernel@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue
Re: [OS-BUILD PATCH] Fix binutils breakage
From: Viktor Malik on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2749#note_1621698879 Applied upstream, patches are here: https://lore.kernel.org/bpf/169832762501.4440.5459269955038255670.git- patchwork-not...@kernel.org/ Feel free to pick them up as fit. ___ kernel mailing list -- kernel@lists.fedoraproject.org To unsubscribe send an email to kernel-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kernel@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue
Re: [OS-BUILD PATCH] Fix binutils breakage
From: Carlos O'Donell (Red Hat) on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2749#note_1619241995 @dzickusrh We are definitely triggering some odd issues with the flags we're passing down at this point. You've managed to get clang's bpf backend to emit `R_BPF_64_NODYLD32` (type 0x4) which binutils does not support. The relocation itself does nothing at runtime, but it's a marker for section merging support in lld (I don't know why they need it). Either earlier binutils ignored it, and now doesn't, which could be seen as a regression (since it doesn't have to do anything AFAICT). ___ kernel mailing list -- kernel@lists.fedoraproject.org To unsubscribe send an email to kernel-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kernel@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue
Re: [OS-BUILD PATCH] Fix binutils breakage
From: Don Zickus on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2749#note_1619009596 @codonell-rh - throwing the ball back into your court for above issue ^^ ___ kernel mailing list -- kernel@lists.fedoraproject.org To unsubscribe send an email to kernel-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kernel@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue
Re: [OS-BUILD PATCH] Fix binutils breakage
From: Viktor Malik on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2749#note_1618369263 So the `strip` problem is really a bug which @tohojo also noticed. He opened a bugzilla for that: https://bugzilla.redhat.com/show_bug.cgi?id=2245296 ___ kernel mailing list -- kernel@lists.fedoraproject.org To unsubscribe send an email to kernel-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kernel@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue
Re: [OS-BUILD PATCH] Fix binutils breakage
From: Viktor Malik on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2749#note_1617635466 Patches sent, added you to cc. I'd still wait a couple of days, if possible, to see if upstream doesn't propose a different approach, to avoid carrying non-upstream patches in ARK. But that's up to you. ___ kernel mailing list -- kernel@lists.fedoraproject.org To unsubscribe send an email to kernel-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kernel@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue
Re: [OS-BUILD PATCH] Fix binutils breakage
From: Viktor Malik on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2749#note_1617583855 Not yet, I wanted to resolve all the `-fPIE` problems first b/c we'll eventually need to build `samples/bpf` in RHEL. Anyways, I think that we're on a good path (see my last comment above), so I'm going to post all three changes upstream (quoting `TPROGS_LDFLAGS`, introducing `TPROGS_USER_CFLAGS/LDFLAGS`, and using custom bpftool for samples) and will get back to you. ___ kernel mailing list -- kernel@lists.fedoraproject.org To unsubscribe send an email to kernel-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kernel@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue
Re: [OS-BUILD PATCH] Fix binutils breakage
From: Viktor Malik on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2749#note_1617578830 Argh, compiler/linker arguments in BPF Makefiles are sometimes a mess. But, since the error occurs when linking `libbpf.a` for `samples/bpf/bpftool`, let's take the same approach as we do for selftests and reuse the bpftool that we've already built. This will require one more patch to `samples/bpf/Makefile`: ```diff diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 4ccf4236031c..ce9c2eea82d4 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -253,8 +253,9 @@ $(LIBBPF): $(wildcard $(LIBBPF_SRC)/*.[ch] $(LIBBPF_SRC)/Makefile) | $(LIBBPF_OU BPFTOOLDIR := $(TOOLS_PATH)/bpf/bpftool BPFTOOL_OUTPUT := $(abspath $(BPF_SAMPLES_PATH))/bpftool -BPFTOOL := $(BPFTOOL_OUTPUT)/bootstrap/bpftool -$(BPFTOOL): $(wildcard $(BPFTOOLDIR)/*.[ch] $(BPFTOOLDIR)/Makefile) | $(BPFTOOL_OUTPUT) +DEFAULT_BPFTOOL := $(BPFTOOL_OUTPUT)/bootstrap/bpftool +BPFTOOL ?= $(DEFAULT_BPFTOOL) +$(DEFAULT_BPFTOOL): $(wildcard $(BPFTOOLDIR)/*.[ch] $(BPFTOOLDIR)/Makefile) | $(BPFTOOL_OUTPUT) $(MAKE) -C $(BPFTOOLDIR) srctree=$(BPF_SAMPLES_PATH)/../../ \ OUTPUT=$(BPFTOOL_OUTPUT)/ bootstrap ``` and the specfile change: ```suggestion:-0+0 %{make} %{?_smp_mflags} TPROGS_USER_CFLAGS="%{?build_hostcflags}" TPROGS_USER_LDFLAGS="%{?build_ldflags}" BPFTOOL="$(pwd)/tools/bpf/bpftool/bpftool" ARCH=$Arch V=1 M=samples/bpf/ VMLINUX_H="${RPM_VMLINUX_H}" || true ``` This way, the samples successfully build for me. Unfortunately, rpmbuild fails later when stripping the BPF programs `samples/bpf/*_kern.o` (another binutils problem?), but we should be able to resolve that by just not stripping them. ___ kernel mailing list -- kernel@lists.fedoraproject.org To unsubscribe send an email to kernel-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kernel@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue
Re: [OS-BUILD PATCH] Fix binutils breakage
From: Don Zickus on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2749#note_1617007832 @vmalikrh - were you able to push patches upstream? we were looking to bring them in prematurely for ARK until upstream merges them. This helps move binutils forward. ___ kernel mailing list -- kernel@lists.fedoraproject.org To unsubscribe send an email to kernel-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kernel@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue
Re: [OS-BUILD PATCH] Fix binutils breakage
From: Don Zickus on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2749#note_1612950237 @vmalikrh thanks for the fixes! I tried your suggestions and got this new error: ```plaintext + /usr/bin/make -s 'HOSTCFLAGS=-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Werror=implicit-function-declaration -Werror=implicit-int -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS - specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64-v3 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf- protection ' 'HOSTLDF LAGS=-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes ' -j8 'TPROGS_USER_CFLAGS=-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Werror=implicit-function-declaration -Werror=implicit-int -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-har dened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin- cc1 -m64 -march=x86-64-v3 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection ' 'TPROGS_USER_LDFLAGS=-Wl,-z,relro -Wl,--as-n eeded -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes ' 'EXTRA_CFLAGS=-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Werror=implicit-function-declaration -Werror=implicit-int -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -sp ecs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64-v3 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf- protection ' 'EXTRA_LDFLAGS=-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat /redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,-- build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes ' ARCH=x86_64 V=1 M=samples/bpf/ VMLINUX_H= CLANG-bpf samples/bpf/sockex1_kern.o cc1: error: code model kernel does not support PIC mode make[2]: *** [scripts/Makefile.build:116: samples/bpf/syscall_nrs.s] Error 1 make[2]: *** Waiting for unfinished jobs ``` Removing the EXTRA\_\* removes that error and reverts back to the previous missing -fPIE warning. I also somehow messed up my env such that I can't even build an rpm any more. I will have to poke at that. ___ kernel mailing list -- kernel@lists.fedoraproject.org To unsubscribe send an email to kernel-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kernel@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue
Re: [OS-BUILD PATCH] Fix binutils breakage
From: Viktor Malik on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2749#note_1612448872 @dzickusrh @hertonrk-rh I'd suggest applying one more patch (in addition to the above quoting change) to `samples/bpf/Makefile`: ```diff diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 4ccf4236031c..140c58959b07 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -150,6 +150,9 @@ always-y += ibumad_kern.o always-y += hbm_out_kern.o always-y += hbm_edt_kern.o +TPROGS_CFLAGS += $(TPROGS_USER_CFLAGS) +TPROGS_LDFLAGS += $(TPROGS_USER_LDFLAGS) + ifeq ($(ARCH), arm) # Strip all except -D__LINUX_ARM_ARCH__ option needed to handle linux # headers when arm instruction set identification is requested. @@ -312,7 +315,7 @@ XDP_SAMPLE_CFLAGS += -Wall -O2 \ -I$(LIBBPF_INCLUDE) \ -I$(src)/../../tools/testing/selftests/bpf -$(obj)/$(XDP_SAMPLE): TPROGS_CFLAGS = $(XDP_SAMPLE_CFLAGS) +$(obj)/$(XDP_SAMPLE): TPROGS_CFLAGS = $(XDP_SAMPLE_CFLAGS) $(TPROGS_USER_CFLAGS) $(obj)/$(XDP_SAMPLE): $(src)/xdp_sample_user.h $(src)/xdp_sample_shared.h -include $(BPF_SAMPLES_PATH)/Makefile.target ``` and then updating this specfile change to: ```suggestion:-0+0 %{make} %{?_smp_mflags} TPROGS_USER_CFLAGS="%{?build_hostcflags}" TPROGS_USER_LDFLAGS="%{?build_hostldflags}" EXTRA_CFLAGS="%{?build_hostcflags}" EXTRA_LDFLAGS="%{?build_hostldflags}" ARCH=$Arch V=1 M=samples/bpf/ VMLINUX_H="${RPM_VMLINUX_H}" || true ``` The `EXTRA_CFLAGS`/`EXTRA_LDFLAGS` setting should resolve the remaining -fPIE error for libbpf.a. @dzickusrh could you give this a try? ___ kernel mailing list -- kernel@lists.fedoraproject.org To unsubscribe send an email to kernel-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kernel@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue
Re: [OS-BUILD PATCH] Fix binutils breakage
From: Don Zickus on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2749#note_1609196658 I guess I spoke too soon, moving the TPROGS_xxx before make still causes rpm to fail. hmm... ___ kernel mailing list -- kernel@lists.fedoraproject.org To unsubscribe send an email to kernel-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kernel@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue
Re: [OS-BUILD PATCH] Fix binutils breakage
From: Don Zickus on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2749#note_1609190998 @hertonrk-rh @vmalikrh - moving TPROGS_xxx to before make resolved my missing includes issue. But I see what @vmalikrh means for that one target. The rpm still builds, so I think we could move forward with this approach independently of when Viktor gets this change upstream. I still need the TPROGS_LDFLAGS change though. ___ kernel mailing list -- kernel@lists.fedoraproject.org To unsubscribe send an email to kernel-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kernel@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue
Re: [OS-BUILD PATCH] Fix binutils breakage
From: Viktor Malik on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2749#note_1609066156 Argh, it won't work b/c [samples/bpf/Makefile:315](https://gitlab.com/cki- project/kernel-ark/-/blob/os-build/samples/bpf/Makefile?ref_type=heads#L315) overrides `TPROGS_CFLAGS` for one target. It looks like we'll need a Makefile patch after all so I'm a bit inclined towards introducing a new variable `TPROGS_EXTRA_CFLAGS` which can be set from CLI and is always appended to `TPROGS_CFLAGS`. ___ kernel mailing list -- kernel@lists.fedoraproject.org To unsubscribe send an email to kernel-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kernel@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue
Re: [OS-BUILD PATCH] Fix binutils breakage
From: Viktor Malik on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2749#note_1609047113 Agreed, I just wasn't sure if this is acceptable for the specfile. Makefile always uses `+=` so it should work without modification (except for the above Don's patch to enable setting `TPROGS_LDFLAGS` the same way). ___ kernel mailing list -- kernel@lists.fedoraproject.org To unsubscribe send an email to kernel-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kernel@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue
Re: [OS-BUILD PATCH] Fix binutils breakage
From: Herton R. Krzesinski on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2749#note_1609004744 The way to do it in this case should be: ```TPROGS_CFLAGS="%{?build_hostcflags}" %{make} %{?_smp_mflags} ARCH=$Arch V=1 M=samples/bpf/ VMLINUX_H="${RPM_VMLINUX_H}" || true``` Pass the variable before the make invocation. So make does not override it and will append. However, that may still Makefile modification if it doesn't use override or doesn't append with ```+=```. ___ kernel mailing list -- kernel@lists.fedoraproject.org To unsubscribe send an email to kernel-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kernel@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue
Re: [OS-BUILD PATCH] Fix binutils breakage
From: Viktor Malik on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2749#note_1608645136 I don't think that setting `TPROGS_CFLAGS` here is correct. The reason is that `samples/bpf/Makefile` appends a couple of options to `TPROGS_CFLAGS`, particularly several include paths ([samples/bpf/Makefile:173-177](https://gitlab.com/cki-project/kernel- ark/-/blob/os-build/samples/bpf/Makefile?ref_type=heads#L173-L177)): ``` TPROGS_CFLAGS += -I$(objtree)/usr/include TPROGS_CFLAGS += -I$(srctree)/tools/testing/selftests/bpf/ TPROGS_CFLAGS += -I$(LIBBPF_INCLUDE) TPROGS_CFLAGS += -I$(srctree)/tools/include TPROGS_CFLAGS += -I$(srctree)/tools/perf ``` Due to the way Make works, these are overridden by setting `TPROGS_CFLAGS` from CLI, resulting in include errors: ``` samples/bpf/test_lru_dist.c:20:10: fatal error: bpf/bpf.h: No such file or directory 20 | #include | ^~~ compilation terminated. ``` I don't have a proper solution for now but will try to think about it. ___ kernel mailing list -- kernel@lists.fedoraproject.org To unsubscribe send an email to kernel-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kernel@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue
Re: [OS-BUILD PATCH] Fix binutils breakage
From: Viktor Malik on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2749#note_1608094306 @dzickusrh I can do that. If you don't mind, I'll add you to CC so that you can see when it's merged. ___ kernel mailing list -- kernel@lists.fedoraproject.org To unsubscribe send an email to kernel-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kernel@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue
Re: [OS-BUILD PATCH] Fix binutils breakage
From: Don Zickus on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2749#note_1607846588 @codonell-rh @vmalikrh - patching samples/bpf/Makefile (add quotes around TPROGS_LDFLAGS) allowed me to use TPROGS_LDFLAGS correctly. @vmalikrh - who to send this patch to upstream? I assume they will take it? diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 4ccf4236031c..053f148e4b52 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -247,7 +247,7 @@ clean: $(LIBBPF): $(wildcard $(LIBBPF_SRC)/*.[ch] $(LIBBPF_SRC)/Makefile) | $(LIBBPF_OUTPUT) # Fix up variables inherited from Kbuild that tools/ build system won't like $(MAKE) -C $(LIBBPF_SRC) RM='rm -rf' EXTRA_CFLAGS="$(TPROGS_CFLAGS)" \ - LDFLAGS=$(TPROGS_LDFLAGS) srctree=$(BPF_SAMPLES_PATH)/../../ \ + LDFLAGS="$(TPROGS_LDFLAGS)" srctree=$(BPF_SAMPLES_PATH)/../../ \ O= OUTPUT=$(LIBBPF_OUTPUT)/ DESTDIR=$(LIBBPF_DESTDIR) prefix= \ $@ install_headers ___ kernel mailing list -- kernel@lists.fedoraproject.org To unsubscribe send an email to kernel-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kernel@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue
Re: [OS-BUILD PATCH] Fix binutils breakage
From: Don Zickus on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2749#note_1607668819 @codonell-rh Sure. Just struggling to figure out how to workaround that. ___ kernel mailing list -- kernel@lists.fedoraproject.org To unsubscribe send an email to kernel-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kernel@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue
Re: [OS-BUILD PATCH] Fix binutils breakage
From: Carlos O'Donell (Red Hat) on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2749#note_1607368686 This indicates incorrect shell quoting for the intended usage with options being expanded directly into Make's command line instead of the eventual expansion for the compiler. ___ kernel mailing list -- kernel@lists.fedoraproject.org To unsubscribe send an email to kernel-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kernel@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue
Re: [OS-BUILD PATCH] Fix binutils breakage
From: Don Zickus on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2749#note_1605950727 For some reason adding the TPRROGS_LDFLAGS creates an ld usage failure. + /usr/bin/make -s 'HOSTCFLAGS=-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Werror=implicit-function-declaration -Werror=implicit-int -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS - specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64-v3 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf- protection ' 'HOSTLDF LAGS=-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes ' -j8 'TPROGS_CFLAGS=-O2 -fexc eptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Werror=implicit-function-declaration -Werror=implicit-int -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened -cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64-v3 -mtune=generic -fasynchronous-unwind-tables -fstack- clash-protection -fcf-protection ' 'TPROGS_LDFLAGS=-Wl,-z,relro -Wl,--as- needed -Wl ,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes ' ARCH=x86_64 V=1 M=samples/bpf/ VMLINUX_H= /usr/bin/make: invalid option -- 'c' /usr/bin/make: invalid option -- '=' /usr/bin/make: invalid option -- '/' /usr/bin/make: invalid option -- 'u' /usr/bin/make: invalid option -- '/' /usr/bin/make: invalid option -- 'c' /usr/bin/make: invalid option -- '=' /usr/bin/make: invalid option -- '/' /usr/bin/make: invalid option -- 'u' /usr/bin/make: invalid option -- '/' /usr/bin/make: invalid option -- 'c' /usr/bin/make: invalid option -- '=' /usr/bin/make: invalid option -- '/' /usr/bin/make: invalid option -- 'u' /usr/bin/make: invalid option -- '/' Usage: make [options] [target] ... Options: -b, -m Ignored for compatibility. -B, --always-make Unconditionally make all targets. -C DIRECTORY, --directory=DIRECTORY Change to DIRECTORY before doing anything. -d Print lots of debugging information. --debug[=FLAGS] Print various types of debugging information. -e, --environment-overrides Environment variables override makefiles. -E STRING, --eval=STRINGEvaluate STRING as a makefile statement. -f FILE, --file=FILE, --makefile=FILE Read FILE as a makefile. -h, --help Print this message and exit. -i, --ignore-errors Ignore errors from recipes. -I DIRECTORY, --include-dir=DIRECTORY ___ kernel mailing list -- kernel@lists.fedoraproject.org To unsubscribe send an email to kernel-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kernel@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue
Re: [OS-BUILD PATCH] Fix binutils breakage
From: Carlos O'Donell (Red Hat) on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2749#note_1602841029 Any reason not to pass TPROGS_LDFLAGS for consistency for test programs? Otherwise looks good. ___ kernel mailing list -- kernel@lists.fedoraproject.org To unsubscribe send an email to kernel-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kernel@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue
Re: [OS-BUILD PATCH] Fix binutils breakage
From: Carlos O'Donell (Red Hat) on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2749#note_1602841038 OK. LGTM. Set USERCFLAGS and USERLDFLAGS. ___ kernel mailing list -- kernel@lists.fedoraproject.org To unsubscribe send an email to kernel-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kernel@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue
Re: [OS-BUILD PATCH] Fix binutils breakage
From: Don Zickus on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2749#note_1602503582 @vmalikrh - FYI as the approval rules won't automatically add you. ___ kernel mailing list -- kernel@lists.fedoraproject.org To unsubscribe send an email to kernel-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kernel@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue
[OS-BUILD PATCH] Fix binutils breakage
From: Don Zickus Fix binutils breakage The binutils package in Rawhide has stricter checks about PIE/PIC code and will start reporting errors if it detects mixing and matching no-PIE with PIE binaries (especially around bpf binaries). Example errors look like: /usr/bin/ld: /tmp/ccL7dkfR.o: relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE /usr/bin/ld: failed to set dynamic section sizes: bad value collect2: error: ld returned 1 exit status Fix this by adding more CFLAGS to force PIE/PIC generated binaries to bpf releated selftests, tools and samples. This patch was provided by Carlos O'Donell and understands how it works. I am just the middle man. All -fPIE errors are resolved except for one about libbpf.a. The static version of the library doesn't take CFLAGS so it can't be forced to build with PIE/PIC. This error is ignored by the spec file, so it is ignored by this patch too. Signed-off-by: Don Zickus diff --git a/redhat/kernel.spec.template b/redhat/kernel.spec.template index blahblah..blahblah 100644 --- a/redhat/kernel.spec.template +++ b/redhat/kernel.spec.template @@ -2769,7 +2769,7 @@ if [ ! -f include/generated/autoconf.h ]; then %{make} %{?_smp_mflags} modules_prepare fi -%{make} %{?_smp_mflags} ARCH=$Arch V=1 M=samples/bpf/ VMLINUX_H="${RPM_VMLINUX_H}" || true +%{make} %{?_smp_mflags} TPROGS_CFLAGS="%{?build_hostcflags}" ARCH=$Arch V=1 M=samples/bpf/ VMLINUX_H="${RPM_VMLINUX_H}" || true # Prevent bpf selftests to build bpftool repeatedly: export BPFTOOL=$(pwd)/tools/bpf/bpftool/bpftool @@ -2783,7 +2783,7 @@ pushd tools/testing/selftests force_targets="" %endif -%{make} %{?_smp_mflags} ARCH=$Arch V=1 TARGETS="bpf mm livepatch net net/forwarding net/mptcp netfilter tc-testing memfd drivers/net/bonding" SKIP_TARGETS="" $force_targets INSTALL_PATH=%{buildroot}%{_libexecdir}/kselftests VMLINUX_H="${RPM_VMLINUX_H}" install +%{make} %{?_smp_mflags} USERCFLAGS="%{?build_hostcflags}" USERLDFLAGS="%{?build_hostldflags}" ARCH=$Arch V=1 TARGETS="bpf mm livepatch net net/forwarding net/mptcp netfilter tc-testing memfd drivers/net/bonding" SKIP_TARGETS="" $force_targets INSTALL_PATH=%{buildroot}%{_libexecdir}/kselftests VMLINUX_H="${RPM_VMLINUX_H}" install # 'make install' for bpf is broken and upstream refuses to fix it. # Install the needed files manually. -- https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2749 ___ kernel mailing list -- kernel@lists.fedoraproject.org To unsubscribe send an email to kernel-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kernel@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue