Bug 2417601
| Summary: | glibc-2.42.9000-13.fc44: -Werror=discarded-qualifiers breaks libbpf build (tools/bpf/resolve_btfids) | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Mikhail <mikhail.v.gavrilov> | ||||||
| Component: | glibc | Assignee: | Carlos O'Donell <codonell> | ||||||
| Status: | CLOSED NOTABUG | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | ||||||
| Severity: | unspecified | Docs Contact: | |||||||
| Priority: | unspecified | ||||||||
| Version: | rawhide | CC: | arjun, codonell, dj, fberat, fweimer, jlaw, josmyers, mcermak, mcoufal, mfabian, pfrankli, sipoyare, skolosov, suraj.ghimire7 | ||||||
| Target Milestone: | --- | ||||||||
| Target Release: | --- | ||||||||
| Hardware: | Unspecified | ||||||||
| OS: | Unspecified | ||||||||
| Whiteboard: | |||||||||
| Fixed In Version: | Doc Type: | --- | |||||||
| Doc Text: | Story Points: | --- | |||||||
| Clone Of: | Environment: | ||||||||
| Last Closed: | 2025-11-27 20:49:46 UTC | Type: | Bug | ||||||
| Regression: | --- | Mount Type: | --- | ||||||
| Documentation: | --- | CRM: | |||||||
| Verified Versions: | Category: | --- | |||||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||||
| Embargoed: | |||||||||
| Attachments: |
|
||||||||
Created attachment 2116412 [details]
bad - build.log
Sorry, the build log is not very informative because it does not show the actual compiler flags being used. Furthermore, the -O flag is not specified on the make invocation, so the compiler diagnostics are reported at random places in the build log:
CC /home/mikhail/packaging-work/git/linux/tools/bpf/resolve_btfids/libbpf/staticobjs/ringbuf.o
HDRINST usr/include/linux/affs_hardblocks.h
HDRINST usr/include/linux/agpgart.h
libbpf.c: In function ‘kallsyms_cb’:
libbpf.c:8250:13: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
8250 | res = strstr(sym_name, ".llvm.");
| ^
HDRINST usr/include/linux/aio_abi.h
CC /home/mikhail/packaging-work/git/linux/tools/bpf/resolve_btfids/libbpf/staticobjs/strset.o
libbpf.c: In function ‘avail_kallsyms_cb’:
libbpf.c:11579:31: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
11579 | if (!(sym_sfx = strstr(sym_name, ".llvm.")))
| ^
HDRINST usr/include/linux/amt.h
libbpf.c: In function ‘resolve_full_path’:
libbpf.c:12167:35: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
12167 | next_path = strchr(s, ':');
| ^
HDRINST usr/include/linux/am437x-vpfe.h
AR /home/mikhail/packaging-work/git/linux/tools/objtool/libsubcmd/libsubcmd.a
If you use the GCC 15 default, you build with -std=gnu23, which means C23. Based on the errors above, your code does not follow the C23 standard. That the code was previously accepted without a diagnostic by GCC/glibc was a toolchain bug.
I acknowledge that C23 does not meet developer expectations regarding source level compatibility. I am going to start a discussion with the GCC and GNU C Library developers on this topic.
Upstream discussion: Refining _DEFAULT_SOURCE and _GNU_SOURCE <https://inbox.sourceware.org/libc-alpha/lhuo6on8aav.fsf@oldenburg.str.redhat.com/> |
Created attachment 2116411 [details] good - build.log The kernel fails to build with glibc-2.42.9000-13.fc44: libbpf.c:8250:13: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers] libbpf.c:11579:31: error: ... libbpf.c:12167:35: error: ... Regression window: glibc-2.42.9000-12.fc44 → builds fine (good-build.log attached) glibc-2.42.9000-13.fc44 → fails (bad-build.log attached) Reproduction: make clean make -j32 bzImage The new warning was added as part of hardening changes in glibc-2.42.9000-13. These assignments from strstr()/strchr() return values to non-const pointers are intentional and safe in libbpf. Possible quick fixes: • Disable -Werror=discarded-qualifiers in glibc spec for rawhide • Add HOSTCFLAGS_libbpf.o += -Wno-error=discarded-qualifiers in kernel Makefile • Fix libbpf upstream (long-term) This blocks all kernel builds on rawhide at the moment.