[Bug 273959] devel/llvm10 devel/llvm11 devel/llvm12 devel/llvm13 devel/llvm14 devel/llvm15: fix build with lld 17

From: <bugzilla-noreply_at_freebsd.org>
Date: Wed, 20 Sep 2023 07:26:17 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=273959

            Bug ID: 273959
           Summary: devel/llvm10 devel/llvm11 devel/llvm12 devel/llvm13
                    devel/llvm14 devel/llvm15: fix build with lld 17
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: Individual Port(s)
          Assignee: brooks@FreeBSD.org
          Reporter: dim@FreeBSD.org
          Assignee: brooks@FreeBSD.org
             Flags: maintainer-feedback?(brooks@FreeBSD.org)

After lld 17 made undefined symbols or versions in linker version scripts an
error, several of the older llvm ports get such errors, when the base system
linker is lld 17. For example, devel/llvm15 fails with:

... linking libomp.so ...
ld: error: projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_csupport.cpp.o:
symbol ompc_set_affinity_format@@VERSION has undefined version VERSION
ld: error: projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_csupport.cpp.o:
symbol omp_set_affinity_format@OMP_5.0 has undefined version OMP_5.0
ld: error: projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_csupport.cpp.o:
symbol ompc_get_affinity_format@@VERSION has undefined version VERSION
ld: error: projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_csupport.cpp.o:
symbol omp_get_affinity_format@OMP_5.0 has undefined version OMP_5.0
... many more of these...

And there are a few other of these issues. To fix them all, I had to backport
the following upstream changes:

https://github.com/llvm/llvm-project/commit/e801e8f3e703 [Libomptarget] Remove
undefined 'omp_get_interop_rc_desc' symbol from exports list
https://github.com/llvm/llvm-project/commit/619dced0fc5d [Libomptarget] Don't
use full names for exported plugin symbols
https://github.com/llvm/llvm-project/commit/1af754174142 [Libomptarget] Fix
missing semicolon in exports
https://github.com/llvm/llvm-project/commit/432a7e284440 [libomp] Add
-Wl,--undefined-version workaround
https://github.com/llvm/llvm-project/commit/cae1942297ef [CMake][OpenMP] Remove
-Wl,--warn-shared-textrel
https://github.com/llvm/llvm-project/commit/fef73b81e9a7 [OpenMP][libomp]
Cleanup version script and exported symbols
https://github.com/llvm/llvm-project/commit/c6e6231e2f46 [OpenMP][libomp] Fix
version scripts after undefined version script changes
https://github.com/llvm/llvm-project/commit/61311f3c9363 Use different export
file when linking with dylib
https://github.com/llvm/llvm-project/commit/263962545dae [OpenMP] Solve
potential VERSION script error w/ OMPT symbols
https://github.com/llvm/llvm-project/commit/c294bdd64768 libLTO.{so,dylib}:
remove unused non-LTO symbols

For llvm15 these changes apply without fuzz, but as you get to 14, 13 and lower
versions, they need some hand-tweaking, so I added them as a
patch-backport-version-fixes file.

In case of llvm11 and llvm10, those files have been split up in llvm-specific
and openmp-specific parts, as the ports still make use of the split source
tarballs.

-- 
You are receiving this mail because:
You are the assignee for the bug.