<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/68218>68218</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
17.0.2: libomp is not LTO ready
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
kloczek
</td>
</tr>
</table>
<pre>
Build uses libomp subproject source dist tar ball.
I'm using gcc 13.2.1
<details>
```console
[ 0%] Linking C shared library libomp.so
cd /home/tkloczko/rpmbuild/BUILD/openmp-17.0.2.src/x86_64-redhat-linux-gnu/runtime/src && /usr/bin/cmake -E cmake_link_script CMakeFiles/omp.dir/link.txt --verbose=1
/usr/bin/gcc -fPIC -O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -Wall -Wcast-qual -Wimplicit-fallthrough -Wsign-compare -Wno-extra -Wno-pedantic -Wno-maybe-uninitialized -DNDEBUG -Wl,--as-needed -Wl,--version-script=/home/tkloczko/rpmbuild/BUILD/openmp-17.0.2.src/runtime/src/exports_so.txt -static-libgcc -Wl,-z,noexecstack -Wl,--gc-sections -Wl,--as-needed -flto=auto -flto-partition=none -fuse-linker-plugin -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,--build-id=sha1 -shared -Wl,-soname,libomp.so -o libomp.so CMakeFiles/omp.dir/kmp_alloc.cpp.o CMakeFiles/omp.dir/kmp_atomic.cpp.o CMakeFiles/omp.dir/kmp_csupport.cpp.o CMakeFiles/omp.dir/kmp_debug.cpp.o CMakeFiles/omp.dir/kmp_itt.cpp.o CMakeFiles/omp.dir/kmp_environment.cpp.o CMakeFiles/omp.dir/kmp_error.cpp.o CMakeFiles/omp.dir/kmp_global.cpp.o CMakeFiles/omp.dir/kmp_i18n.cpp.o CMakeFiles/omp.dir/kmp_io.cpp.o CMakeFiles/omp.dir/kmp_runtime.cpp.o CMakeFiles/omp.dir/kmp_settings.cpp.o CMakeFiles/omp.dir/kmp_str.cpp.o CMakeFiles/omp.dir/kmp_tasking.cpp.o CMakeFiles/omp.dir/kmp_threadprivate.cpp.o CMakeFiles/omp.dir/kmp_utility.cpp.o CMakeFiles/omp.dir/kmp_barrier.cpp.o CMakeFiles/omp.dir/kmp_wait_release.cpp.o CMakeFiles/omp.dir/kmp_affinity.cpp.o CMakeFiles/omp.dir/kmp_dispatch.cpp.o CMakeFiles/omp.dir/kmp_lock.cpp.o CMakeFiles/omp.dir/kmp_sched.cpp.o CMakeFiles/omp.dir/kmp_collapse.cpp.o CMakeFiles/omp.dir/z_Linux_util.cpp.o CMakeFiles/omp.dir/kmp_gsupport.cpp.o CMakeFiles/omp.dir/thirdparty/ittnotify/ittnotify_static.cpp.o CMakeFiles/omp.dir/kmp_taskdeps.cpp.o CMakeFiles/omp.dir/kmp_cancel.cpp.o CMakeFiles/omp.dir/kmp_ftn_cdecl.cpp.o CMakeFiles/omp.dir/kmp_ftn_extra.cpp.o CMakeFiles/omp.dir/kmp_version.cpp.o "CMakeFiles/omp.dir/ompt-general.cpp.o" "CMakeFiles/omp.dir/ompd-specific.cpp.o" CMakeFiles/omp.dir/z_Linux_asm.S.o -lm -ldl
/home/tkloczko/rpmbuild/BUILD/openmp-17.0.2.src/runtime/src/kmp.h:2808:32: warning: type ‘struct kmp_base_info’ violates the C++ One Definition Rule [-Wodr]
2808 | typedef struct KMP_ALIGN_CACHE kmp_base_info {
| ^
/home/tkloczko/rpmbuild/BUILD/openmp-17.0.2.src/runtime/src/kmp.h:2808:32: note: a different type is defined in another translation unit
2808 | typedef struct KMP_ALIGN_CACHE kmp_base_info {
| ^
/home/tkloczko/rpmbuild/BUILD/openmp-17.0.2.src/runtime/src/kmp.h:2845:26: note: the first difference of corresponding definitions is field ‘th_def_allocator’
2845 | omp_allocator_handle_t th_def_allocator; /* default allocator */
| ^
/home/tkloczko/rpmbuild/BUILD/openmp-17.0.2.src/runtime/src/kmp.h:2845:26: note: a field of same name but different type is defined in another translation unit
2845 | omp_allocator_handle_t th_def_allocator; /* default allocator */
| ^
/home/tkloczko/rpmbuild/BUILD/openmp-17.0.2.src/runtime/src/kmp.h:2808:32: note: type ‘void *’ should match type ‘omp_allocator_handle_t’
2808 | typedef struct KMP_ALIGN_CACHE kmp_base_info {
| ^
/home/tkloczko/rpmbuild/BUILD/openmp-17.0.2.src/runtime/src/kmp.h:2955:31: warning: type ‘union kmp_info’ violates the C++ One Definition Rule [-Wodr]
2955 | typedef union KMP_ALIGN_CACHE kmp_info {
| ^
/home/tkloczko/rpmbuild/BUILD/openmp-17.0.2.src/runtime/src/kmp.h:2955:31: note: a different type is defined in another translation unit
2955 | typedef union KMP_ALIGN_CACHE kmp_info {
| ^
/home/tkloczko/rpmbuild/BUILD/openmp-17.0.2.src/runtime/src/kmp.h:2958:19: note: the first difference of corresponding definitions is field ‘th’
2958 | kmp_base_info_t th;
| ^
/home/tkloczko/rpmbuild/BUILD/openmp-17.0.2.src/runtime/src/kmp.h:2958:19: note: a field of same name but different type is defined in another translation unit
2958 | kmp_base_info_t th;
| ^
/home/tkloczko/rpmbuild/BUILD/openmp-17.0.2.src/runtime/src/kmp.h:2955:31: note: type ‘struct kmp_base_info_t’ itself violates the C++ One Definition Rule
2955 | typedef union KMP_ALIGN_CACHE kmp_info {
| ^
/home/tkloczko/rpmbuild/BUILD/openmp-17.0.2.src/runtime/src/kmp.h:3000:32: warning: type ‘struct kmp_base_team’ violates the C++ One Definition Rule [-Wodr]
3000 | typedef struct KMP_ALIGN_CACHE kmp_base_team {
| ^
/home/tkloczko/rpmbuild/BUILD/openmp-17.0.2.src/runtime/src/kmp.h:3000:32: note: a different type is defined in another translation unit
3000 | typedef struct KMP_ALIGN_CACHE kmp_base_team {
| ^
/home/tkloczko/rpmbuild/BUILD/openmp-17.0.2.src/runtime/src/kmp.h:3069:26: note: the first difference of corresponding definitions is field ‘t_def_allocator’
3069 | omp_allocator_handle_t t_def_allocator; /* default allocator */
| ^
/home/tkloczko/rpmbuild/BUILD/openmp-17.0.2.src/runtime/src/kmp.h:3069:26: note: a field of same name but different type is defined in another translation unit
3069 | omp_allocator_handle_t t_def_allocator; /* default allocator */
| ^
/home/tkloczko/rpmbuild/BUILD/openmp-17.0.2.src/runtime/src/kmp.h:3000:32: note: type ‘omp_allocator_handle_t’ should match type ‘void *’
3000 | typedef struct KMP_ALIGN_CACHE kmp_base_team {
| ^
/home/tkloczko/rpmbuild/BUILD/openmp-17.0.2.src/runtime/src/kmp.h:3095:23: warning: type ‘union kmp_team’ violates the C++ One Definition Rule [-Wodr]
3095 | union KMP_ALIGN_CACHE kmp_team {
| ^
/home/tkloczko/rpmbuild/BUILD/openmp-17.0.2.src/runtime/src/kmp.h:3095:23: note: a different type is defined in another translation unit
3095 | union KMP_ALIGN_CACHE kmp_team {
| ^
/home/tkloczko/rpmbuild/BUILD/openmp-17.0.2.src/runtime/src/kmp.h:3096:19: note: the first difference of corresponding definitions is field ‘t’
3096 | kmp_base_team_t t;
| ^
/home/tkloczko/rpmbuild/BUILD/openmp-17.0.2.src/runtime/src/kmp.h:3096:19: note: a field of same name but different type is defined in another translation unit
3096 | kmp_base_team_t t;
| ^
/home/tkloczko/rpmbuild/BUILD/openmp-17.0.2.src/runtime/src/kmp.h:3095:23: note: type ‘struct kmp_base_team_t’ itself violates the C++ One Definition Rule
3095 | union KMP_ALIGN_CACHE kmp_team {
| ^
/home/tkloczko/rpmbuild/BUILD/openmp-17.0.2.src/runtime/src/kmp.h:1117:14: warning: type of ‘__kmp_realloc’ does not match original declaration [-Wlto-type-mismatch]
1117 | extern void *__kmp_realloc(int gtid, void *ptr, size_t sz,
| ^
/home/tkloczko/rpmbuild/BUILD/openmp-17.0.2.src/runtime/src/kmp_alloc.cpp:1787:7: note: type mismatch in parameter 4
1787 | void *__kmp_realloc(int gtid, void *ptr, size_t size,
| ^
/home/tkloczko/rpmbuild/BUILD/openmp-17.0.2.src/runtime/src/kmp_alloc.cpp:1787:7: note: type ‘void *’ should match type ‘omp_allocator_handle_t’
/home/tkloczko/rpmbuild/BUILD/openmp-17.0.2.src/runtime/src/kmp_alloc.cpp:1787:7: note: ‘__kmp_realloc’ was previously declared here
/home/tkloczko/rpmbuild/BUILD/openmp-17.0.2.src/runtime/src/kmp_alloc.cpp:1787:7: note: code may be misoptimized unless ‘-fno-strict-aliasing’ is used
/home/tkloczko/rpmbuild/BUILD/openmp-17.0.2.src/runtime/src/kmp.h:1120:13: warning: type of ‘___kmpc_free’ does not match original declaration [-Wlto-type-mismatch]
1120 | extern void ___kmpc_free(int gtid, void *ptr, omp_allocator_handle_t al);
| ^
/home/tkloczko/rpmbuild/BUILD/openmp-17.0.2.src/runtime/src/kmp_alloc.cpp:1824:6: note: type mismatch in parameter 3
1824 | void ___kmpc_free(int gtid, void *ptr, omp_allocator_handle_t allocator) {
| ^
/home/tkloczko/rpmbuild/BUILD/openmp-17.0.2.src/runtime/src/kmp_alloc.cpp:1824:6: note: type ‘void *’ should match type ‘omp_allocator_handle_t’
/home/tkloczko/rpmbuild/BUILD/openmp-17.0.2.src/runtime/src/kmp_alloc.cpp:1824:6: note: ‘___kmpc_free’ was previously declared here
/home/tkloczko/rpmbuild/BUILD/openmp-17.0.2.src/runtime/src/kmp_alloc.cpp:1824:6: note: code may be misoptimized unless ‘-fno-strict-aliasing’ is used
/home/tkloczko/rpmbuild/BUILD/openmp-17.0.2.src/runtime/src/kmp.h:1115:14: warning: type of ‘__kmp_calloc’ does not match original declaration [-Wlto-type-mismatch]
1115 | extern void *__kmp_calloc(int gtid, size_t align, size_t nmemb, size_t sz,
| ^
/home/tkloczko/rpmbuild/BUILD/openmp-17.0.2.src/runtime/src/kmp_alloc.cpp:1758:7: note: type mismatch in parameter 5
1758 | void *__kmp_calloc(int gtid, size_t algn, size_t nmemb, size_t size,
| ^
/home/tkloczko/rpmbuild/BUILD/openmp-17.0.2.src/runtime/src/kmp_alloc.cpp:1758:7: note: type ‘void *’ should match type ‘omp_allocator_handle_t’
/home/tkloczko/rpmbuild/BUILD/openmp-17.0.2.src/runtime/src/kmp_alloc.cpp:1758:7: note: ‘__kmp_calloc’ was previously declared here
/home/tkloczko/rpmbuild/BUILD/openmp-17.0.2.src/runtime/src/kmp_alloc.cpp:1758:7: note: code may be misoptimized unless ‘-fno-strict-aliasing’ is used
/home/tkloczko/rpmbuild/BUILD/openmp-17.0.2.src/runtime/src/kmp.h:1113:14: warning: type of ‘__kmp_alloc’ does not match original declaration [-Wlto-type-mismatch]
1113 | extern void *__kmp_alloc(int gtid, size_t align, size_t sz,
| ^
/home/tkloczko/rpmbuild/BUILD/openmp-17.0.2.src/runtime/src/kmp_alloc.cpp:1546:7: note: type mismatch in parameter 4
1546 | void *__kmp_alloc(int gtid, size_t algn, size_t size,
| ^
/home/tkloczko/rpmbuild/BUILD/openmp-17.0.2.src/runtime/src/kmp_alloc.cpp:1546:7: note: type ‘void *’ should match type ‘omp_allocator_handle_t’
/home/tkloczko/rpmbuild/BUILD/openmp-17.0.2.src/runtime/src/kmp_alloc.cpp:1546:7: note: ‘__kmp_alloc’ was previously declared here
/home/tkloczko/rpmbuild/BUILD/openmp-17.0.2.src/runtime/src/kmp_alloc.cpp:1546:7: note: code may be misoptimized unless ‘-fno-strict-aliasing’ is used
/home/tkloczko/rpmbuild/BUILD/openmp-17.0.2.src/runtime/src/kmp.h:3447:21: warning: ‘__kmp_threads’ violates the C++ One Definition Rule [-Wodr]
3447 | extern kmp_info_t **__kmp_threads; /* Descriptors for the threads */
| ^
/home/tkloczko/rpmbuild/BUILD/openmp-17.0.2.src/runtime/src/kmp_global.cpp:445:14: note: type ‘union kmp_info_t’ itself violates the C++ One Definition Rule
445 | kmp_info_t **__kmp_threads = NULL;
| ^
/home/tkloczko/rpmbuild/BUILD/openmp-17.0.2.src/runtime/src/kmp.h:3447:21: warning: ‘__kmp_threads’ violates the C++ One Definition Rule [-Wodr]
3447 | extern kmp_info_t **__kmp_threads; /* Descriptors for the threads */
| ^
/home/tkloczko/rpmbuild/BUILD/openmp-17.0.2.src/runtime/src/kmp_global.cpp:445:14: note: type ‘union kmp_info_t’ itself violates the C++ One Definition Rule
445 | kmp_info_t **__kmp_threads = NULL;
| ^
/home/tkloczko/rpmbuild/BUILD/openmp-17.0.2.src/runtime/src/kmp_global.cpp:445:14: note: ‘__kmp_threads’ was previously declared here
/home/tkloczko/rpmbuild/BUILD/openmp-17.0.2.src/runtime/src/kmp_global.cpp:445:14: note: code may be misoptimized unless ‘-fno-strict-aliasing’ is used
{standard input}: Assembler messages:
{standard input}: Error: invalid attempt to declare external version name as default in symbol `ompc_set_affinity_format@@VERSION'
lto-wrapper: fatal error: /usr/bin/gcc returned 1 exit status
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
```
</details>
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsW9ly2zrSfhr4BgWVBGq98IUsWed3_T7xqSyTM1csEGiKGIMABwC9Pf0USEqKYtmiE8tbnVTK4tJEd3_s_rpJEMw5udQAx2hwggbzI1b6zNjjS2X4HVweJUbcHp-UUglcOnBYycTkBXZlUljzH-AeO1NaDlhI57FnFidMqQ7qzlF3eoboKMelk3qJl5zjXtShnV59DkUzAZ5J5VB02hyq_w679X9utDMKmqODE4y7iA7QYI7Ppb4MY86wy5gFEayyzN421nWcqS_iAiO6yEwOiC585dKlQXRhizwJLiG6OPl2dj5HdGEK0HlBeqNOt0M7znJEFzfjYTzsEwsiY54oqcsbstRlGKDUXlajOssxokNEh0FV6Syii0RqRBc8Z5eAySmuNmIl9W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