Recent CURRENT (12.0-CURRENT #58 r317830: Fri May 5 16:57:40 CEST 2017 amd64) miscompiles port audio/openal-soft with the error shown below. CURRENT is built with option set WITH_LLD_IS_LD=yes. [...] [ 98%] Linking C executable openal-info /usr/local/bin/cmake -E cmake_link_script CMakeFiles/openal-info.dir/link.txt --verbose=1 /usr/bin/cc -std=c11 -O2 -pipe -O3 -fstack-protector -fno-strict-aliasing -O2 -pipe -O3 -fstack-protector -fno-strict-aliasing -fstack-protector CMakeFiles/openal-info.dir/utils/openal-info.c.o -o openal-info -Wl,-rpath,/usr/ports/audio/openal-soft/work/openal-soft-1.17.2: libopenal.so.1.17.2 libcommon.a -lpthread -lm -pthread /usr/bin/ld: error: /usr/ports/audio/openal-soft/work/openal-soft-1.17.2/utils/openal-info.c:(function main): cannot preempt symbol 'alcIsExtensionPresent' defined in libopenal.so.1.17.2
Liking against openal-soft linked with ld.bfd doesn't work with LLD either. For example, games/tome4 is one of the things that won't link.
(In reply to Nikolai Lifanov from comment #1) Can show the error log? games/tome4 seems to build fine against audio/openal-soft built with LDFLAGS += -fuse-ld=bfd, at least after base 321369.
This is another case of ports trying to preempt symbols with protected visibility - see comment 5 on PR 219524 (https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=219524#c5) for some more details.
I haven't tried this with llvm/clang/lld 5.0.0 yet. Hold on and I'll see if I can reproduce this on latest head...
This is still a problem on latest head: /usr/bin/ld.lld: error: cannot preempt symbol: alcIsExtensionPresent >>> defined in ../../../../../../local/lib/libopenal.so >>> referenced by ../src/music.c >>> ../obj/Release/TEngine/music.o:(openal_get_devices) /usr/bin/ld.lld: error: cannot preempt symbol: alcGetString >>> defined in ../../../../../../local/lib/libopenal.so >>> referenced by ../src/music.c >>> ../obj/Release/TEngine/music.o:(openal_get_devices) /usr/bin/ld.lld: error: cannot preempt symbol: alcGetString >>> defined in ../../../../../../local/lib/libopenal.so >>> referenced by ../src/music.c >>> ../obj/Release/TEngine/music.o:(openal_get_devices) /usr/bin/ld.lld: error: cannot preempt symbol: alcOpenDevice >>> defined in ../../../../../../local/lib/libopenal.so >>> referenced by ../src/music.c >>> ../obj/Release/TEngine/music.o:(init_openal) /usr/bin/ld.lld: error: cannot preempt symbol: alcCreateContext >>> defined in ../../../../../../local/lib/libopenal.so >>> referenced by ../src/music.c >>> ../obj/Release/TEngine/music.o:(init_openal) /usr/bin/ld.lld: error: cannot preempt symbol: alcMakeContextCurrent >>> defined in ../../../../../../local/lib/libopenal.so >>> referenced by ../src/music.c >>> ../obj/Release/TEngine/music.o:(init_openal) /usr/bin/ld.lld: error: cannot preempt symbol: alDistanceModel >>> defined in ../../../../../../local/lib/libopenal.so >>> referenced by ../src/music.c >>> ../obj/Release/TEngine/music.o:(init_openal) /usr/bin/ld.lld: error: cannot preempt symbol: alcCloseDevice >>> defined in ../../../../../../local/lib/libopenal.so >>> referenced by ../src/music.c >>> ../obj/Release/TEngine/music.o:(init_openal) /usr/bin/ld.lld: error: cannot preempt symbol: alcMakeContextCurrent >>> defined in ../../../../../../local/lib/libopenal.so >>> referenced by ../src/music.c >>> ../obj/Release/TEngine/music.o:(deinit_openal) /usr/bin/ld.lld: error: cannot preempt symbol: alcDestroyContext >>> defined in ../../../../../../local/lib/libopenal.so >>> referenced by ../src/music.c >>> ../obj/Release/TEngine/music.o:(deinit_openal) /usr/bin/ld.lld: error: cannot preempt symbol: alcCloseDevice >>> defined in ../../../../../../local/lib/libopenal.so >>> referenced by ../src/music.c >>> ../obj/Release/TEngine/music.o:(deinit_openal) /usr/bin/ld.lld: error: cannot preempt symbol: alGenBuffers >>> defined in ../../../../../../local/lib/libopenal.so >>> referenced by ../src/music.c >>> ../obj/Release/TEngine/music.o:(loadsoundLua) /usr/bin/ld.lld: error: cannot preempt symbol: alGenSources >>> defined in ../../../../../../local/lib/libopenal.so >>> referenced by ../src/music.c >>> ../obj/Release/TEngine/music.o:(loadsoundLua) /usr/bin/ld.lld: error: cannot preempt symbol: alBufferData >>> defined in ../../../../../../local/lib/libopenal.so >>> referenced by ../src/music.c >>> ../obj/Release/TEngine/music.o:(loadsoundLua) /usr/bin/ld.lld: error: cannot preempt symbol: alListenerf >>> defined in ../../../../../../local/lib/libopenal.so >>> referenced by ../src/music.c >>> ../obj/Release/TEngine/music.o:(audio_enable) /usr/bin/ld.lld: error: cannot preempt symbol: alListener3f >>> defined in ../../../../../../local/lib/libopenal.so >>> referenced by ../src/music.c >>> ../obj/Release/TEngine/music.o:(audio_enable) /usr/bin/ld.lld: error: cannot preempt symbol: alDistanceModel >>> defined in ../../../../../../local/lib/libopenal.so >>> referenced by ../src/music.c >>> ../obj/Release/TEngine/music.o:(audio_enable) /usr/bin/ld.lld: error: cannot preempt symbol: alDeleteBuffers >>> defined in ../../../../../../local/lib/libopenal.so >>> referenced by ../src/music.c >>> ../obj/Release/TEngine/music.o:(soundCollectLua) /usr/bin/ld.lld: error: cannot preempt symbol: alGenSources >>> defined in ../../../../../../local/lib/libopenal.so >>> referenced by ../src/music.c >>> ../obj/Release/TEngine/music.o:(soundNewSource) /usr/bin/ld.lld: error: cannot preempt symbol: alSourcei >>> defined in ../../../../../../local/lib/libopenal.so >>> referenced by ../src/music.c >>> ../obj/Release/TEngine/music.o:(soundNewSource) /usr/bin/ld.lld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors) cc: error: linker command failed with exit code 1 (use -v to see invocation) gmake[1]: *** [TEngine.make:111: ../bin/Release/t-engine] Error 1 gmake: *** [Makefile:17: TEngine] Error 2
Created attachment 185676 [details] lang/openal-soft: set LLD_UNSAFE
A commit references this bug: Author: emaste Date: Wed Aug 30 19:40:15 UTC 2017 New revision: 448999 URL: https://svnweb.freebsd.org/changeset/ports/448999 Log: audio/openal-soft: set LLD_UNSAFE Linking with LLD currently fails due to preemption of symbols with protected visibility in a shared object: /usr/bin/ld: error: cannot preempt symbol: alIsExtensionPresent >>> defined in libopenal.so.1.18.0 >>> referenced by examples/altonegen.c >>> CMakeFiles/altonegen.dir/examples/altonegen.c.o:(main) /usr/bin/ld: error: cannot preempt symbol: alcGetCurrentContext >>> defined in libopenal.so.1.18.0 >>> referenced by examples/altonegen.c >>> CMakeFiles/altonegen.dir/examples/altonegen.c.o:(main) /usr/bin/ld: error: cannot preempt symbol: alcGetContextsDevice >>> defined in libopenal.so.1.18.0 >>> referenced by examples/altonegen.c >>> CMakeFiles/altonegen.dir/examples/altonegen.c.o:(main) ... (Ports that depend on audio/openal-soft may also need to be tagged with LLD_UNSAFE.) PR: 219089 Approved by: kwm Sponsored by: The FreeBSD Foundation Changes: head/audio/openal-soft/Makefile
A commit references this bug: Author: emaste Date: Fri Dec 29 16:24:16 UTC 2017 New revision: 457512 URL: https://svnweb.freebsd.org/changeset/ports/457512 Log: audio/alure: set LLD_UNSAFE Linking with LLD currently fails due to preemption of symbols with protected visibility in a shared object: /usr/bin/ld: error: cannot preempt symbol: alureInitDevice >>> defined in libalure.so.1.2.0 >>> referenced by examples/alurestream.c >>> CMakeFiles/alurestream.dir/examples/alurestream.o:(main) For now set LLD_UNSAFE=yes so that the port will continue to link with ld.bfd if /usr/bin/ld is lld, until the issue can be addressed (with a change in openal-soft or in lld). PR: 214864, 219089 Approved by: portmgr (LLD_UNSAFE blanket) Sponsored by: The FreeBSD Foundation Changes: head/audio/alure/Makefile
Workaround committed in r448999
I can't reproduce on /branches/clang700-import, see https://ptpb.pw/_Fp7 (amd64) and https://ptpb.pw/LGjr (i386). In other words, consumers may need to convert LLD_UNSAFE= yes into USES= compiler .include <bsd.port.pre.mk> .if ${COMPILER_VERSION} < 70 && ${CC} == cc && ${CXX} == c++ && ${/usr/bin/ld:L:tA} == /usr/bin/ld.lld LLD_UNSAFE= yes .endif
Oops, after explicitly passing -fuse-ld=lld i386 appears to be still affected but amd64 is not. I'm not sure what this means yet other than the proposed conditional is going to be even more ugly.