Build error when using LTO on 6.4
Hi,
I notice a build regression on Bugzilla [1]. Quoting from it:
Quoted 40 lines
Starting with Kernel 6.4, I see a build error when using "-flto" to build perf. This used to work fine with earlier Kernels when using either bfd or mold as linker when using GCC 13.1.1.
This is the PKGBUILD I use as my build recipe: https://github.com/ms178/archpkgbuilds/blob/main/packages/bpf/PKGBUILD
This is the konsole output I get now with Kernel 6.4.5:
[CODE]
CFLAGS='-Wno-error=bad-function-cast -Wno-error=declaration-after-statement -Wno-error=switch-enum -Wbad-function-cast -Wdeclaration-after-statement -Wformat-security -Wformat-y2k -Winit-self -Wmissing-declarations -Wmissing-prototypes -Wno-system-headers -Wold-style-definition -Wpacked -Wredundant-decls -Wstrict-prototypes -Wswitch-default -Wswitch-enum -Wundef -Wwrite-strings -Wformat -Wno-type-limits -Wstrict-aliasing=3 -Wshadow -DHAVE_SYSCALL_TABLE_SUPPORT -DHAVE_ARCH_X86_64_SUPPORT -Iarch/x86/include/generated -DHAVE_PERF_REGS_SUPPORT -DHAVE_ARCH_REGS_QUERY_REGISTER_OFFSET -Werror -DNDEBUG=1 -O6 -fno-omit-frame-pointer -ggdb3 -funwind-tables -Wall -Wextra -std=gnu11 -fstack-protector-all -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -I/tmp/makepkg/linux-tools/src/linux/tools/perf/util/include -I/tmp/makepkg/linux-tools/src/linux/tools/perf/arch/x86/include -I/tmp/makepkg/linux-tools/src/linux/tools/include/ -I/tmp/makepkg/linux-tools/src/linux/tools/arch/x86/include/uapi -I/tmp/makepkg/linux-tools/src/linux/tools/include/uapi -I/tmp/makepkg/linux-tools/src/linux/tools/arch/x86/include/ -I/tmp/makepkg/linux-tools/src/linux/tools/arch/x86/ -I/tmp/makepkg/linux-tools/src/linux/tools/perf/util -I/tmp/makepkg/linux-tools/src/linux/tools/perf -DHAVE_PTHREAD_ATTR_SETAFFINITY_NP -DHAVE_PTHREAD_BARRIER -DHAVE_EVENTFD_SUPPORT -DHAVE_GET_CURRENT_DIR_NAME -DHAVE_GETTID -DHAVE_FILE_HANDLE -DHAVE_DWARF_GETLOCATIONS_SUPPORT -DHAVE_AIO_SUPPORT -DHAVE_SCANDIRAT_SUPPORT -DHAVE_SCHED_GETCPU_SUPPORT -DHAVE_SETNS_SUPPORT -DHAVE_LIBELF_SUPPORT -DHAVE_ELF_GETPHDRNUM_SUPPORT -DHAVE_GELF_GETNOTE_SUPPORT -DHAVE_ELF_GETSHDRSTRNDX_SUPPORT -DHAVE_DEBUGINFOD_SUPPORT -DHAVE_DWARF_SUPPORT -DHAVE_LIBBPF_SUPPORT -DHAVE_BPF_PROLOGUE -DHAVE_JITDUMP -DHAVE_DWARF_UNWIND_SUPPORT -DNO_LIBUNWIND_DEBUG_FRAME -DHAVE_LIBUNWIND_SUPPORT -DHAVE_LIBCRYPTO_SUPPORT -DHAVE_SLANG_SUPPORT -DNO_LIBPERL -DHAVE_TIMERFD_SUPPORT -DHAVE_LIBPYTHON_SUPPORT -DHAVE_CXA_DEMANGLE_SUPPORT -DHAVE_ZLIB_SUPPORT -DHAVE_LZMA_SUPPORT -DHAVE_ZSTD_SUPPORT -DHAVE_LIBCAP_SUPPORT -DHAVE_BACKTRACE_SUPPORT -DHAVE_LIBNUMA_SUPPORT -DHAVE_KVM_STAT_SUPPORT -DDISASM_FOUR_ARGS_SIGNATURE -DDISASM_INIT_STYLED -DHAVE_PERF_READ_VDSO32 -DHAVE_AUXTRACE_SUPPORT -DHAVE_LIBTRACEEVENT -DLIBTRACEEVENT_VERSION=66813 -I/tmp/makepkg/linux-tools/src/linux/tools/perf/libapi/include -I/tmp/makepkg/linux-tools/src/linux/tools/perf/libbpf/include -I/tmp/makepkg/linux-tools/src/linux/tools/perf/libsubcmd/include -I/tmp/makepkg/linux-tools/src/linux/tools/perf/libsymbol/include -I/tmp/makepkg/linux-tools/src/linux/tools/perf/libperf/include' LDFLAGS='-Wl,-O3,--as-needed,-Bsymbolic-functions,--sort-common,-flto=auto -fopenmp -fuse-ld=mold -march=native -mtune=native -maes -mbmi2 -mpclmul -Wl,-zmax-page-size=0x200000 -Wl,-z,noexecstack -lunwind-x86_64 -lunwind -llzma -L/usr/lib ' \
'/usr/bin/python'util/setup.py\
--quietbuild_ext; \
cp python_ext_build/lib/perf*.so python/
rm -f -f/tmp/makepkg/linux-tools/src/linux/tools/perf/libbpf/libbpf.a; ar rcs/tmp/makepkg/linux-tools/src/linux/tools/perf/libbpf/libbpf.a/tmp/makepkg/linux-tools/src/linux/tools/perf/libbpf/staticobjs/libbpf-in.o
[snip]
gcc -Wno-error=bad-function-cast -Wno-error=declaration-after-statement -Wno-error=switch-enum -Wbad-function-cast -Wdeclaration-after-statement -Wformat-security -Wformat-y2k -Winit-self -Wmissing-declarations -Wmissing-prototypes -Wno-system-headers -Wold-style-definition -Wpacked -Wredundant-decls -Wstrict-prototypes -Wswitch-default -Wswitch-enum -Wundef -Wwrite-strings -Wformat -Wno-type-limits -Wstrict-aliasing=3 -Wshadow -DHAVE_SYSCALL_TABLE_SUPPORT -DHAVE_ARCH_X86_64_SUPPORT -Iarch/x86/include/generated -DHAVE_PERF_REGS_SUPPORT -DHAVE_ARCH_REGS_QUERY_REGISTER_OFFSET -Werror -DNDEBUG=1 -O6 -fno-omit-frame-pointer -ggdb3 -funwind-tables -Wall -Wextra -std=gnu11 -fstack-protector-all -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -I/tmp/makepkg/linux-tools/src/linux/tools/perf/util/include -I/tmp/makepkg/linux-tools/src/linux/tools/perf/arch/x86/include -I/tmp/makepkg/linux-tools/src/linux/tools/include/ -I/tmp/makepkg/linux-tools/src/linux/tools/arch/x86/include/uapi -I/tmp/makepkg/linux-tools/src/linux/tools/include/uapi -I/tmp/makepkg/linux-tools/src/linux/tools/arch/x86/include/ -I/tmp/makepkg/linux-tools/src/linux/tools/arch/x86/ -I/tmp/makepkg/linux-tools/src/linux/tools/perf/util -I/tmp/makepkg/linux-tools/src/linux/tools/perf -DHAVE_PTHREAD_ATTR_SETAFFINITY_NP -DHAVE_PTHREAD_BARRIER -DHAVE_EVENTFD_SUPPORT -DHAVE_GET_CURRENT_DIR_NAME -DHAVE_GETTID -DHAVE_FILE_HANDLE -DHAVE_DWARF_GETLOCATIONS_SUPPORT -DHAVE_AIO_SUPPORT -DHAVE_SCANDIRAT_SUPPORT -DHAVE_SCHED_GETCPU_SUPPORT -DHAVE_SETNS_SUPPORT -DHAVE_LIBELF_SUPPORT -DHAVE_ELF_GETPHDRNUM_SUPPORT -DHAVE_GELF_GETNOTE_SUPPORT -DHAVE_ELF_GETSHDRSTRNDX_SUPPORT -DHAVE_DEBUGINFOD_SUPPORT -DHAVE_DWARF_SUPPORT -DHAVE_LIBBPF_SUPPORT -DHAVE_BPF_PROLOGUE -DHAVE_JITDUMP -DHAVE_DWARF_UNWIND_SUPPORT -DNO_LIBUNWIND_DEBUG_FRAME -DHAVE_LIBUNWIND_SUPPORT -DHAVE_LIBCRYPTO_SUPPORT -DHAVE_SLANG_SUPPORT -DNO_LIBPERL -DHAVE_TIMERFD_SUPPORT -DHAVE_LIBPYTHON_SUPPORT -DHAVE_CXA_DEMANGLE_SUPPORT -DHAVE_ZLIB_SUPPORT -DHAVE_LZMA_SUPPORT -DHAVE_ZSTD_SUPPORT -DHAVE_LIBCAP_SUPPORT -DHAVE_BACKTRACE_SUPPORT -DHAVE_LIBNUMA_SUPPORT -DHAVE_KVM_STAT_SUPPORT -DDISASM_FOUR_ARGS_SIGNATURE -DDISASM_INIT_STYLED -DHAVE_PERF_READ_VDSO32 -DHAVE_AUXTRACE_SUPPORT -DHAVE_LIBTRACEEVENT -DLIBTRACEEVENT_VERSION=66813 -I/tmp/makepkg/linux-tools/src/linux/tools/perf/libapi/include -I/tmp/makepkg/linux-tools/src/linux/tools/perf/libbpf/include -I/tmp/makepkg/linux-tools/src/linux/tools/perf/libsubcmd/include -I/tmp/makepkg/linux-tools/src/linux/tools/perf/libsymbol/include -I/tmp/makepkg/linux-tools/src/linux/tools/perf/libperf/include -Wl,-O3,--as-needed,-Bsymbolic-functions,--sort-common,-flto=auto -fopenmp -fuse-ld=mold -march=native -mtune=native -maes -mbmi2 -mpclmul -Wl,-zmax-page-size=0x200000 -Wl,-z,noexecstack -lunwind-x86_64 -lunwind -llzma -L/usr/lib \
perf-in.opmu-events/pmu-events-in.o-Wl,--whole-archive/tmp/makepkg/linux-tools/src/linux/tools/perf/libapi/libapi.a/tmp/makepkg/linux-tools/src/linux/tools/perf/libperf/libperf.a/tmp/makepkg/linux-tools/src/linux/tools/perf/libsubcmd/libsubcmd.a/tmp/makepkg/linux-tools/src/linux/tools/perf/libsymbol/libsymbol.a/tmp/makepkg/linux-tools/src/linux/tools/perf/libbpf/libbpf.a-Wl,--no-whole-archive -Wl,--start-group -lpthread -lrt -lm -ldl -lelf -ldebuginfod -ldw -lunwind-x86_64 -lunwind -llzma -lcrypto -lslang -lpython3.11 -ldl -lm -lutil -lstdc++ -lz -llzma -lzstd -lcap -lnuma -ltraceevent -Wl,--end-group -o perf
mold: error: undefined symbol: mainQuoted 2 lines
Quoted 2 lines
Quoted 2 lines
referenced by /usr/lib/Scrt1.o:(.text)
/usr/lib/Scrt1.o:(_start)mold: error: undefined symbol:
perf_pmu__getcpuidQuoted 4 lines
Quoted 4 lines
Quoted 4 lines
referenced by
pmu-events.c
pmu-events/pmu-events-in.o:(perf_pmu__find_events_table)>>> referenced bypmu-events.cpmu-events/pmu-events-in.o:(perf_pmu__find_metrics_table)mold: error: undefined symbol:
strcmp_cpuid_strQuoted 7 lines
Quoted 7 lines
Quoted 7 lines
referenced by
pmu-events.c
pmu-events/pmu-events-in.o:(perf_pmu__find_events_table)>>> referenced bypmu-events.cpmu-events/pmu-events-in.o:(perf_pmu__find_metrics_table)>>> referenced bypmu-events.cpmu-events/pmu-events-in.o:(find_core_events_table)>>> referenced 1 more timesmold: error: undefined symbol:
_ctypeQuoted 6 lines
Quoted 6 lines
Quoted 6 lines
referenced by
kallsyms.c/tmp/makepkg/linux-tools/src/linux/tools/perf/libsymbol/libsymbol.a(libsymbol-in.o):(__tolower)>>> referenced by
kallsyms.c/tmp/makepkg/linux-tools/src/linux/tools/perf/libsymbol/libsymbol.a(libsymbol-in.o):(__toupper)
mold: error: undefined symbol: strlcpy
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
referenced by
exec-cmd.c/tmp/makepkg/linux-tools/src/linux/tools/perf/libsubcmd/libsubcmd.a(libsubcmd-in.o):(get_pwd_cwd)
[/CODE]
I have noticed a patch series of Ian Rodgers that might adress this issue, but his reported errors were different to mine, see: https://www.spinics.net/lists/kernel/msg4872566.html
Compiler: gcc-version 13.1.1 20230714 (GCC)
See Bugzilla for the full thread.
Anyway, I'm adding this regression to regzbot:
#regzbot introduced: v6.3..v6.4.5 https://bugzilla.kernel.org/show_bug.cgi?id=217706
Thanks.
[1]: https://bugzilla.kernel.org/show_bug.cgi?id=217706
Signature · 1 line
An old man doll... just what I always wanted! - Clara
Quoted 6 lines · Bagas Sanjaya
Hi,
I notice a build regression on Bugzilla [1]. Quoting from it:
Quoted 1 line
Starting with Kernel 6.4, I see a build error when using "-flto" to build perf. This used to work fine with earlier Kernels when using either bfd or mold as linker when using GCC 13.1.1.
Hmm.. strange I've never seen this work with GCC.
Quoted 2 lines
Quoted 2 lines
This is the PKGBUILD I use as my build recipe: https://github.com/ms178/archpkgbuilds/blob/main/packages/bpf/PKGBUILD
If this binary is for distribution BUILD_BPF_SKEL=1 should be set. We need to make this an opt-out rather than opt-in. The last time we did this there was some friction:
https://lore.kernel.org/lkml/CAHk-=wjY_3cBELRSLMpqCt6Eb71Qei2agfKSNsrr5KcpdEQCaA@mail.gmail.com/
Quoted 45 lines
Quoted 45 lines
This is the konsole output I get now with Kernel 6.4.5:
[CODE]
CFLAGS='-Wno-error=bad-function-cast -Wno-error=declaration-after-statement -Wno-error=switch-enum -Wbad-function-cast -Wdeclaration-after-statement -Wformat-security -Wformat-y2k -Winit-self -Wmissing-declarations -Wmissing-prototypes -Wno-system-headers -Wold-style-definition -Wpacked -Wredundant-decls -Wstrict-prototypes -Wswitch-default -Wswitch-enum -Wundef -Wwrite-strings -Wformat -Wno-type-limits -Wstrict-aliasing=3 -Wshadow -DHAVE_SYSCALL_TABLE_SUPPORT -DHAVE_ARCH_X86_64_SUPPORT -Iarch/x86/include/generated -DHAVE_PERF_REGS_SUPPORT -DHAVE_ARCH_REGS_QUERY_REGISTER_OFFSET -Werror -DNDEBUG=1 -O6 -fno-omit-frame-pointer -ggdb3 -funwind-tables -Wall -Wextra -std=gnu11 -fstack-protector-all -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -I/tmp/makepkg/linux-tools/src/linux/tools/perf/util/include -I/tmp/makepkg/linux-tools/src/linux/tools/perf/arch/x86/include -I/tmp/makepkg/linux-tools/src/linux/tools/include/ -I/tmp/makepkg/linux-tools/src/linux/tools/arch/x86/include/uapi -I/tmp/makepkg/linux-tools/src/linux/tools/include/uapi -I/tmp/makepkg/linux-tools/src/linux/tools/arch/x86/include/ -I/tmp/makepkg/linux-tools/src/linux/tools/arch/x86/ -I/tmp/makepkg/linux-tools/src/linux/tools/perf/util -I/tmp/makepkg/linux-tools/src/linux/tools/perf -DHAVE_PTHREAD_ATTR_SETAFFINITY_NP -DHAVE_PTHREAD_BARRIER -DHAVE_EVENTFD_SUPPORT -DHAVE_GET_CURRENT_DIR_NAME -DHAVE_GETTID -DHAVE_FILE_HANDLE -DHAVE_DWARF_GETLOCATIONS_SUPPORT -DHAVE_AIO_SUPPORT -DHAVE_SCANDIRAT_SUPPORT -DHAVE_SCHED_GETCPU_SUPPORT -DHAVE_SETNS_SUPPORT -DHAVE_LIBELF_SUPPORT -DHAVE_ELF_GETPHDRNUM_SUPPORT -DHAVE_GELF_GETNOTE_SUPPORT -DHAVE_ELF_GETSHDRSTRNDX_SUPPORT -DHAVE_DEBUGINFOD_SUPPORT -DHAVE_DWARF_SUPPORT -DHAVE_LIBBPF_SUPPORT -DHAVE_BPF_PROLOGUE -DHAVE_JITDUMP -DHAVE_DWARF_UNWIND_SUPPORT -DNO_LIBUNWIND_DEBUG_FRAME -DHAVE_LIBUNWIND_SUPPORT -DHAVE_LIBCRYPTO_SUPPORT -DHAVE_SLANG_SUPPORT -DNO_LIBPERL -DHAVE_TIMERFD_SUPPORT -DHAVE_LIBPYTHON_SUPPORT -DHAVE_CXA_DEMANGLE_SUPPORT -DHAVE_ZLIB_SUPPORT -DHAVE_LZMA_SUPPORT -DHAVE_ZSTD_SUPPORT -DHAVE_LIBCAP_SUPPORT -DHAVE_BACKTRACE_SUPPORT -DHAVE_LIBNUMA_SUPPORT -DHAVE_KVM_STAT_SUPPORT -DDISASM_FOUR_ARGS_SIGNATURE -DDISASM_INIT_STYLED -DHAVE_PERF_READ_VDSO32 -DHAVE_AUXTRACE_SUPPORT -DHAVE_LIBTRACEEVENT -DLIBTRACEEVENT_VERSION=66813 -I/tmp/makepkg/linux-tools/src/linux/tools/perf/libapi/include -I/tmp/makepkg/linux-tools/src/linux/tools/perf/libbpf/include -I/tmp/makepkg/linux-tools/src/linux/tools/perf/libsubcmd/include -I/tmp/makepkg/linux-tools/src/linux/tools/perf/libsymbol/include -I/tmp/makepkg/linux-tools/src/linux/tools/perf/libperf/include' LDFLAGS='-Wl,-O3,--as-needed,-Bsymbolic-functions,--sort-common,-flto=auto -fopenmp -fuse-ld=mold -march=native -mtune=native -maes -mbmi2 -mpclmul -Wl,-zmax-page-size=0x200000 -Wl,-z,noexecstack -lunwind-x86_64 -lunwind -llzma -L/usr/lib ' \
'/usr/bin/python'util/setup.py\
--quietbuild_ext; \
cp python_ext_build/lib/perf*.so python/
rm -f -f/tmp/makepkg/linux-tools/src/linux/tools/perf/libbpf/libbpf.a; ar rcs/tmp/makepkg/linux-tools/src/linux/tools/perf/libbpf/libbpf.a/tmp/makepkg/linux-tools/src/linux/tools/perf/libbpf/staticobjs/libbpf-in.o
[snip]
gcc -Wno-error=bad-function-cast -Wno-error=declaration-after-statement -Wno-error=switch-enum -Wbad-function-cast -Wdeclaration-after-statement -Wformat-security -Wformat-y2k -Winit-self -Wmissing-declarations -Wmissing-prototypes -Wno-system-headers -Wold-style-definition -Wpacked -Wredundant-decls -Wstrict-prototypes -Wswitch-default -Wswitch-enum -Wundef -Wwrite-strings -Wformat -Wno-type-limits -Wstrict-aliasing=3 -Wshadow -DHAVE_SYSCALL_TABLE_SUPPORT -DHAVE_ARCH_X86_64_SUPPORT -Iarch/x86/include/generated -DHAVE_PERF_REGS_SUPPORT -DHAVE_ARCH_REGS_QUERY_REGISTER_OFFSET -Werror -DNDEBUG=1 -O6 -fno-omit-frame-pointer -ggdb3 -funwind-tables -Wall -Wextra -std=gnu11 -fstack-protector-all -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -I/tmp/makepkg/linux-tools/src/linux/tools/perf/util/include -I/tmp/makepkg/linux-tools/src/linux/tools/perf/arch/x86/include -I/tmp/makepkg/linux-tools/src/linux/tools/include/ -I/tmp/makepkg/linux-tools/src/linux/tools/arch/x86/include/uapi -I/tmp/makepkg/linux-tools/src/linux/tools/include/uapi -I/tmp/makepkg/linux-tools/src/linux/tools/arch/x86/include/ -I/tmp/makepkg/linux-tools/src/linux/tools/arch/x86/ -I/tmp/makepkg/linux-tools/src/linux/tools/perf/util -I/tmp/makepkg/linux-tools/src/linux/tools/perf -DHAVE_PTHREAD_ATTR_SETAFFINITY_NP -DHAVE_PTHREAD_BARRIER -DHAVE_EVENTFD_SUPPORT -DHAVE_GET_CURRENT_DIR_NAME -DHAVE_GETTID -DHAVE_FILE_HANDLE -DHAVE_DWARF_GETLOCATIONS_SUPPORT -DHAVE_AIO_SUPPORT -DHAVE_SCANDIRAT_SUPPORT -DHAVE_SCHED_GETCPU_SUPPORT -DHAVE_SETNS_SUPPORT -DHAVE_LIBELF_SUPPORT -DHAVE_ELF_GETPHDRNUM_SUPPORT -DHAVE_GELF_GETNOTE_SUPPORT -DHAVE_ELF_GETSHDRSTRNDX_SUPPORT -DHAVE_DEBUGINFOD_SUPPORT -DHAVE_DWARF_SUPPORT -DHAVE_LIBBPF_SUPPORT -DHAVE_BPF_PROLOGUE -DHAVE_JITDUMP -DHAVE_DWARF_UNWIND_SUPPORT -DNO_LIBUNWIND_DEBUG_FRAME -DHAVE_LIBUNWIND_SUPPORT -DHAVE_LIBCRYPTO_SUPPORT -DHAVE_SLANG_SUPPORT -DNO_LIBPERL -DHAVE_TIMERFD_SUPPORT -DHAVE_LIBPYTHON_SUPPORT -DHAVE_CXA_DEMANGLE_SUPPORT -DHAVE_ZLIB_SUPPORT -DHAVE_LZMA_SUPPORT -DHAVE_ZSTD_SUPPORT -DHAVE_LIBCAP_SUPPORT -DHAVE_BACKTRACE_SUPPORT -DHAVE_LIBNUMA_SUPPORT -DHAVE_KVM_STAT_SUPPORT -DDISASM_FOUR_ARGS_SIGNATURE -DDISASM_INIT_STYLED -DHAVE_PERF_READ_VDSO32 -DHAVE_AUXTRACE_SUPPORT -DHAVE_LIBTRACEEVENT -DLIBTRACEEVENT_VERSION=66813 -I/tmp/makepkg/linux-tools/src/linux/tools/perf/libapi/include -I/tmp/makepkg/linux-tools/src/linux/tools/perf/libbpf/include -I/tmp/makepkg/linux-tools/src/linux/tools/perf/libsubcmd/include -I/tmp/makepkg/linux-tools/src/linux/tools/perf/libsymbol/include -I/tmp/makepkg/linux-tools/src/linux/tools/perf/libperf/include -Wl,-O3,--as-needed,-Bsymbolic-functions,--sort-common,-flto=auto -fopenmp -fuse-ld=mold -march=native -mtune=native -maes -mbmi2 -mpclmul -Wl,-zmax-page-size=0x200000 -Wl,-z,noexecstack -lunwind-x86_64 -lunwind -llzma -L/usr/lib \
perf-in.opmu-events/pmu-events-in.o-Wl,--whole-archive/tmp/makepkg/linux-tools/src/linux/tools/perf/libapi/libapi.a/tmp/makepkg/linux-tools/src/linux/tools/perf/libperf/libperf.a/tmp/makepkg/linux-tools/src/linux/tools/perf/libsubcmd/libsubcmd.a/tmp/makepkg/linux-tools/src/linux/tools/perf/libsymbol/libsymbol.a/tmp/makepkg/linux-tools/src/linux/tools/perf/libbpf/libbpf.a-Wl,--no-whole-archive -Wl,--start-group -lpthread -lrt -lm -ldl -lelf -ldebuginfod -ldw -lunwind-x86_64 -lunwind -llzma -lcrypto -lslang -lpython3.11 -ldl -lm -lutil -lstdc++ -lz -llzma -lzstd -lcap -lnuma -ltraceevent -Wl,--end-group -o perf
mold: error: undefined symbol: mainQuoted 2 lines
Quoted 2 lines
Quoted 2 lines
referenced by /usr/lib/Scrt1.o:(.text)
/usr/lib/Scrt1.o:(_start)mold: error: undefined symbol:
perf_pmu__getcpuidQuoted 4 lines
Quoted 4 lines
Quoted 4 lines
referenced by
pmu-events.c
pmu-events/pmu-events-in.o:(perf_pmu__find_events_table)>>> referenced bypmu-events.cpmu-events/pmu-events-in.o:(perf_pmu__find_metrics_table)mold: error: undefined symbol:
strcmp_cpuid_strQuoted 7 lines
Quoted 7 lines
Quoted 7 lines
referenced by
pmu-events.c
pmu-events/pmu-events-in.o:(perf_pmu__find_events_table)>>> referenced bypmu-events.cpmu-events/pmu-events-in.o:(perf_pmu__find_metrics_table)>>> referenced bypmu-events.cpmu-events/pmu-events-in.o:(find_core_events_table)>>> referenced 1 more timesmold: error: undefined symbol:
_ctypeQuoted 6 lines
Quoted 6 lines
Quoted 6 lines
referenced by
kallsyms.c/tmp/makepkg/linux-tools/src/linux/tools/perf/libsymbol/libsymbol.a(libsymbol-in.o):(__tolower)>>> referenced by
kallsyms.c/tmp/makepkg/linux-tools/src/linux/tools/perf/libsymbol/libsymbol.a(libsymbol-in.o):(__toupper)
mold: error: undefined symbol: strlcpy
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
referenced by
exec-cmd.c/tmp/makepkg/linux-tools/src/linux/tools/perf/libsubcmd/libsubcmd.a(libsubcmd-in.o):(get_pwd_cwd)
[/CODE]
I have noticed a patch series of Ian Rodgers that might adress this issue, but his reported errors were different to mine, see: https://www.spinics.net/lists/kernel/msg4872566.html
Quoted 7 lines
Quoted 1 line
Compiler: gcc-version 13.1.1 20230714 (GCC)
See Bugzilla for the full thread.
Anyway, I'm adding this regression to regzbot:
#regzbot introduced: v6.3..v6.4.5 https://bugzilla.kernel.org/show_bug.cgi?id=217706
Thanks, I'm not sure there is anything actionable for the bug. clang/llvm has always worked with LTO at Google. With my changes gcc works for me with some non-zero effort.
Thanks,
Ian
Quoted 6 lines
Thanks.
[1]: https://bugzilla.kernel.org/show_bug.cgi?id=217706
--
An old man doll... just what I always wanted! - Clara
Quoted 11 lines · Ian Rogers
Quoted 6 lines · Bagas Sanjaya
Hi,
I notice a build regression on Bugzilla [1]. Quoting from it:
Quoted 1 line
Starting with Kernel 6.4, I see a build error when using "-flto" to build perf. This used to work fine with earlier Kernels when using either bfd or mold as linker when using GCC 13.1.1.
Hmm.. strange I've never seen this work with GCC.
Quoted 1 line
Quoted 1 line
Quoted 6 lines
Quoted 1 line
Quoted 1 line
This is the PKGBUILD I use as my build recipe: https://github.com/ms178/archpkgbuilds/blob/main/packages/bpf/PKGBUILD
If this binary is for distribution BUILD_BPF_SKEL=1 should be set. We need to make this an opt-out rather than opt-in. The last time we did this there was some friction:
https://lore.kernel.org/lkml/CAHk-=wjY_3cBELRSLMpqCt6Eb71Qei2agfKSNsrr5KcpdEQCaA@mail.gmail.com/
The reporter runs Arch Linux. PKGBUILD is a build script to create packages, though. See the distro doc [1] for details.
[1]: https://wiki.archlinux.org/title/PKGBUILD
Signature · 1 line
An old man doll... just what I always wanted! - Clara