Bug 452779 - Valgrind fails to build on FreeBSD 13.0 with llvm-devel (15.0.0)
Summary: Valgrind fails to build on FreeBSD 13.0 with llvm-devel (15.0.0)
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (show other bugs)
Version: unspecified
Platform: Other FreeBSD
: NOR normal
Target Milestone: ---
Assignee: Paul Floyd
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-04-19 18:59 UTC by Paul Floyd
Modified: 2022-09-14 04:44 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Floyd 2022-04-19 18:59:16 UTC
Valgrind fails to build on FreeBSD 13.0 with llvm-devel (15.0.0)

paulf> /usr/local/bin/clang-devel --version
clang version 15.0.0
Target: x86_64-portbld-freebsd13.0
Thread model: posix
InstalledDir: /usr/local/llvm-devel/bin

../coregrind/link_tool_exe_freebsd 0x38000000 clang-devel     -o memcheck-x86-freebsd  -B/usr/lib32 -m32 -O2 -g -Wall -Wmissing-prototypes -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations -Wcast-align -Wcast-qual -Wwrite-strings -Wempty-body -Wformat -Wformat-security -Wignored-qualifiers -Wenum-conversion -finline-functions -fno-stack-protector -fno-strict-aliasing -fno-builtin -Wno-cast-align -Wno-self-assign -Wno-tautological-compare -Wno-expansion-to-defined -fomit-frame-pointer -O2 -static -nodefaultlibs -nostartfiles -Wl,-u,_start  -B/usr/lib32 -m32 memcheck_x86_freebsd-mc_leakcheck.o memcheck_x86_freebsd-mc_malloc_wrappers.o memcheck_x86_freebsd-mc_main.o memcheck_x86_freebsd-mc_main_asm.o memcheck_x86_freebsd-mc_translate.o memcheck_x86_freebsd-mc_machine.o memcheck_x86_freebsd-mc_errors.o ../coregrind/libcoregrind-x86-freebsd.a ../VEX/libvex-x86-freebsd.a -lgcc ../coregrind/libgcc-sup-amd64-freebsd.a 

If I change the last library to the x86 version and link manually it works
Comment 1 Paul Floyd 2022-04-19 20:07:14 UTC
I've pushed a change that fixes building.

I'll probably make a second change to add libgcc-sup and -lgcc when the compiler is not clang.
Comment 2 Paul Floyd 2022-04-24 08:04:55 UTC
Removing -lgcc breaks things on FreeBSD with clang. It looks like it contains a few primitives that aren't available elsewhere.
Comment 3 Paul Floyd 2022-04-27 19:12:14 UTC
To ssh://sourceware.org/git/valgrind.git
   8b2cf214a..6af21da95  master -> master
Comment 4 Sam James 2022-09-13 23:58:34 UTC
(In reply to Paul Floyd from comment #1)
> I've pushed a change that fixes building.
> 
> I'll probably make a second change to add libgcc-sup and -lgcc when the
> compiler is not clang.

Did you have a chance to do this? It looks like Chimera Linux (a pure LLVM Linux distro) is doing it at the moment: https://github.com/chimera-linux/cports/blob/382e497f40f80e5528d714e6075a00b225459dfa/experimental/valgrind/patches/rtlib.patch.

(Ended up hitting the same issue in Gentoo just now: https://bugs.gentoo.org/870028).
Comment 5 Paul Floyd 2022-09-14 04:44:28 UTC
(In reply to Sam James from comment #4)
> (In reply to Paul Floyd from comment #1)
> > I've pushed a change that fixes building.
> > 
> > I'll probably make a second change to add libgcc-sup and -lgcc when the
> > compiler is not clang.
> 
> Did you have a chance to do this? It looks like Chimera Linux (a pure LLVM
> Linux distro) is doing it at the moment:
> https://github.com/chimera-linux/cports/blob/
> 382e497f40f80e5528d714e6075a00b225459dfa/experimental/valgrind/patches/rtlib.
> patch.
> 
> (Ended up hitting the same issue in Gentoo just now:
> https://bugs.gentoo.org/870028).

No. As I said in comment 2 removing -lgcc breaks things. I'll check on the missing primitives.