Bug 273959 - devel/llvm10 devel/llvm11 devel/llvm12 devel/llvm13 devel/llvm14 devel/llvm15: fix build with lld 17
Summary: devel/llvm10 devel/llvm11 devel/llvm12 devel/llvm13 devel/llvm14 devel/llvm15...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Brooks Davis
URL:
Keywords:
Depends on:
Blocks: 273753
  Show dependency treegraph
 
Reported: 2023-09-20 07:26 UTC by Dimitry Andric
Modified: 2024-01-03 00:22 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (brooks)


Attachments
devel/llvm10: fix build with lld 17 (12.04 KB, patch)
2023-09-20 07:27 UTC, Dimitry Andric
no flags Details | Diff
devel/llvm11: fix build with lld 17 (12.91 KB, patch)
2023-09-20 07:27 UTC, Dimitry Andric
no flags Details | Diff
devel/llvm12: fix build with lld 17 (12.02 KB, patch)
2023-09-20 07:27 UTC, Dimitry Andric
no flags Details | Diff
devel/llvm13: fix build with lld 17 (12.20 KB, patch)
2023-09-20 07:27 UTC, Dimitry Andric
no flags Details | Diff
devel/llvm14: fix build with lld 17 (12.84 KB, patch)
2023-09-20 07:28 UTC, Dimitry Andric
no flags Details | Diff
devel/llvm15: fix build with lld 17 (12.97 KB, patch)
2023-09-20 07:28 UTC, Dimitry Andric
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitry Andric freebsd_committer freebsd_triage 2023-09-20 07:26:17 UTC
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.
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2023-09-20 07:27:00 UTC
Created attachment 245039 [details]
devel/llvm10: fix build with lld 17
Comment 2 Dimitry Andric freebsd_committer freebsd_triage 2023-09-20 07:27:16 UTC
Created attachment 245040 [details]
devel/llvm11: fix build with lld 17
Comment 3 Dimitry Andric freebsd_committer freebsd_triage 2023-09-20 07:27:33 UTC
Created attachment 245041 [details]
devel/llvm12: fix build with lld 17
Comment 4 Dimitry Andric freebsd_committer freebsd_triage 2023-09-20 07:27:52 UTC
Created attachment 245042 [details]
devel/llvm13: fix build with lld 17
Comment 5 Dimitry Andric freebsd_committer freebsd_triage 2023-09-20 07:28:09 UTC
Created attachment 245043 [details]
devel/llvm14: fix build with lld 17
Comment 6 Dimitry Andric freebsd_committer freebsd_triage 2023-09-20 07:28:25 UTC
Created attachment 245044 [details]
devel/llvm15: fix build with lld 17
Comment 7 commit-hook freebsd_committer freebsd_triage 2023-09-21 15:29:45 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=266b5f5c37cd92bd0e726ebe1c63afdcce576578

commit 266b5f5c37cd92bd0e726ebe1c63afdcce576578
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2023-09-21 10:35:28 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2023-09-21 15:23:33 +0000

    devel/llvm14: fix build with lld 17

    PR:             273959

 .../files/patch-backport-version-fixes (new)       | 375 +++++++++++++++++++++
 1 file changed, 375 insertions(+)
Comment 8 commit-hook freebsd_committer freebsd_triage 2023-09-21 15:29:46 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=8721e6856a4326c0e3e7bbfd92242c4580e5835d

commit 8721e6856a4326c0e3e7bbfd92242c4580e5835d
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2023-09-21 10:40:16 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2023-09-21 15:23:34 +0000

    devel/llvm15: fix build with lld 17

    PR:             273959

 .../files/patch-backport-version-fixes (new)       | 379 +++++++++++++++++++++
 1 file changed, 379 insertions(+)
Comment 9 commit-hook freebsd_committer freebsd_triage 2023-09-21 15:29:47 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=0926585c93422d88844fe9a259ebcf9da530990b

commit 0926585c93422d88844fe9a259ebcf9da530990b
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2023-09-21 10:16:51 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2023-09-21 15:23:32 +0000

    devel/llvm13: fix build with lld 17

    PR:             273959

 .../files/patch-backport-version-fixes (new)       | 355 +++++++++++++++++++++
 1 file changed, 355 insertions(+)
Comment 10 commit-hook freebsd_committer freebsd_triage 2023-09-21 15:29:50 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=adfdd1a786c22f4e08a4d2338dec8de25bf808ed

commit adfdd1a786c22f4e08a4d2338dec8de25bf808ed
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2023-09-21 10:01:29 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2023-09-21 15:23:30 +0000

    devel/llvm10: actually fix build with llvm17

    I failed to apply the actual patch and committed the ports patch
    instead.  It applies because it just creates files.

    PR:             273959
    Fixes:          50e51d2680b4 devel/llvm10: fix build with llvm17

 .../files/openmp/patch-backport-version-fixes      | 556 ++++++++-------------
 .../files/patch-backport-version-fixes (new)       | 138 +++++
 .../openmp/patch-backport-version-fixes (new)      | 210 ++++++++
 .../files/patch-backport-version-fixes (new)       | 139 ++++++
 4 files changed, 687 insertions(+), 356 deletions(-)
Comment 11 commit-hook freebsd_committer freebsd_triage 2023-09-21 15:29:52 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=d27ad5a010f2410c7c20475753d378b6da5420fd

commit d27ad5a010f2410c7c20475753d378b6da5420fd
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2023-09-21 10:10:06 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2023-09-21 15:23:32 +0000

    devel/llvm12: fix build with lld 17

    PR:             273959

 .../files/patch-backport-version-fixes (new)       | 351 +++++++++++++++++++++
 1 file changed, 351 insertions(+)
Comment 12 commit-hook freebsd_committer freebsd_triage 2023-09-21 15:29:55 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=e198f066ecc3c6dc0a86a75629eba3922ff43f40

commit e198f066ecc3c6dc0a86a75629eba3922ff43f40
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2023-09-21 11:00:08 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2023-09-21 15:23:31 +0000

    devel/llvm11: fix build with lld 17

    PR:             273959

 devel/llvm11/Makefile | 1 +
 1 file changed, 1 insertion(+)
Comment 13 Dimitry Andric freebsd_committer freebsd_triage 2023-09-24 20:26:39 UTC
I think we got them all now?
Comment 14 commit-hook freebsd_committer freebsd_triage 2024-01-03 00:22:36 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=6d28ea4938ed10145852e8df70e401918803df26

commit 6d28ea4938ed10145852e8df70e401918803df26
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2024-01-03 00:18:38 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2024-01-03 00:22:03 +0000

    devel/llvm-{cheri,cheriot,morello}: fix for lld 17

    Grab the patches from devel/llvm13 and devel/llvm14 to fix these ports
    build with lld 17.

    PR:             273959

 devel/llvm-cheri/Makefile                          |   2 +
 .../files/llvm13-backport-version-fixes (new)      | 355 +++++++++++++++++++
 .../files/llvm14-backport-version-fixes (new)      | 375 +++++++++++++++++++++
 3 files changed, 732 insertions(+)