8000 [backport: release/3.2] cmake: fix LTO build on Fedora by Buristan · Pull Request #11523 · tarantool/tarantool · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[backport: release/3.2] cmake: fix LTO build on Fedora #11523

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

Buristan
Copy link
Collaborator

This patch is a follow-up to the commit
25af976 ("build: support cmake 4.0"). Since version 3.4, CMake doesn't add flags to export symbols from executables without the ENABLE_EXPORTS target property, see CMP0065 1 for details. Without this property, some unit C tests produce build warnings with LTO optimization enabled (for example, on Fedora 39):

NO_WRAP

[ 72%] Linking CXX executable luaT_tuple_new.test
In function ‘rmean_collect’,
    inlined from ‘txn_complete_success’ at src/box/txn.c:836:2,
    inlined from ‘txn_limbo_complete’ at src/box/txn_limbo.c:205:3:
src/lib/core/rmean.c:65:9: error: ‘__atomic_add_fetch_8’ writing 8 bytes into a region of size 0 overflows the destination [-Werror=stringop-overflow=]
   65 |         __atomic_add_fetch(&rmean->stats[name].value[0], value, __ATOMIC_RELAXED);
      |         ^
In function ‘txn_limbo_complete’:
lto1: note: destination object is likely at address zero

NO_WRAP

The real reason should be investigated in the scope of #11517. The compilation warning may be suppressed, but it may also mask the actual problems in the future tests. The CMP0065 is removed from CMake version 4.0 2. Thus, this patch fixes the behaviour by setting the property ENABLE_EXPORTS for unit tests directly.

NO_DOC=build
NO_TEST=build
NO_CHANGELOG=build

(cherry picked from commit 2bde926)

This patch is a follow-up to the commit
25af976 ("build: support cmake 4.0").
Since version 3.4, CMake doesn't add flags to export symbols from
executables without the ENABLE_EXPORTS target property, see CMP0065 [1]
for details.  Without this property, some unit C tests produce build
warnings with LTO optimization enabled (for example, on Fedora 39):

NO_WRAP
```
[ 72%] Linking CXX executable luaT_tuple_new.test
In function ‘rmean_collect’,
    inlined from ‘txn_complete_success’ at src/box/txn.c:836:2,
    inlined from ‘txn_limbo_complete’ at src/box/txn_limbo.c:205:3:
src/lib/core/rmean.c:65:9: error: ‘__atomic_add_fetch_8’ writing 8 bytes into a region of size 0 overflows the destination [-Werror=stringop-overflow=]
   65 |         __atomic_add_fetch(&rmean->stats[name].value[0], value, __ATOMIC_RELAXED);
      |         ^
In function ‘txn_limbo_complete’:
lto1: note: destination object is likely at address zero
```
NO_WRAP

The real reason should be investigated in the scope of tarantool#11517. The
compilation warning may be suppressed, but it may also mask the actual
problems in the future tests. The CMP0065 is removed from CMake version
4.0 [2]. Thus, this patch fixes the behaviour by setting the property
`ENABLE_EXPORTS` for unit tests directly.

[1]: https://cmake.org/cmake/help/latest/policy/CMP0065.html
[2]: https://cmake.org/cmake/help/latest/manual/cmake-policies.7.html#policies-introduced-by-cmake-3-4-removed-by-cmake-4-0

NO_DOC=build
NO_TEST=build
NO_CHANGELOG=build

(cherry picked from commit 2bde926)
@Buristan Buristan requested a review from ligurio May 21, 2025 07:50
@Buristan Buristan added full-ci Enables all tests for a pull request build issue The issue describes the problem with the build labels May 21, 2025
@coveralls
Copy link

Coverage Status

coverage: 87.415% (+0.001%) from 87.414%
when pulling 4bb7208 on Buristan:skaplun/backport-fix-lto-fedora-3.2
into e016827
on tarantool:release/3.2
.

@ligurio ligurio assigned Buristan and unassigned ligurio May 26, 2025
@Buristan Buristan merged commit e4b2c20 into tarantool:release/3.2 May 26, 2025
41 of 65 checks passed
@Buristan Buristan deleted the skaplun/backport-fix-lto-fedora-3.2 branch May 26, 2025 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build issue The issue describes the problem with the build full-ci Enables all tests for a pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0