Skip to content
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

Allow disabling IPO/LTO in CMakeLists #291

Open
ShadowApex opened this issue Apr 10, 2024 · 3 comments
Open

Allow disabling IPO/LTO in CMakeLists #291

ShadowApex opened this issue Apr 10, 2024 · 3 comments

Comments

@ShadowApex
Copy link

I maintain Rust bindings to libryzenadj and encountered linking issues in Rust when CMAKE_INTERPROCEDURAL_OPTIMIZATION is set to TRUE. Could we update the CMakeLists to include a flag to disable IPO/LTO even if it is supported?

@FlyGoat
Copy link
Owner

FlyGoat commented Apr 11, 2024

I can just disable it.
What was the problem btw

@ShadowApex
Copy link
Author

In the linking step at the end of the Rust build, it fails to find the symbols.

Small snippet from attached log:

...
  = note: /usr/bin/ld: /home/william/Projects/PowerStation/target/debug/deps/liblibryzenadj-ec6b339ba685ce56.rlib(libryzenadj-ec6b339ba685ce56.1pc6pnmuzuak76qe.rcgu.o): in function `libryzenadj::RyzenAdj::new':
          /home/william/Projects/libryzenadj-rs/src/lib.rs:89: undefined reference to `init_ryzenadj'
          /usr/bin/ld: /home/william/Projects/libryzenadj-rs/src/lib.rs:94: undefined reference to `init_table'
          /usr/bin/ld: /home/william/Projects/PowerStation/target/debug/deps/liblibryzenadj-ec6b339ba685ce56.rlib(libryzenadj-ec6b339ba685ce56.1pc6pnmuzuak76qe.rcgu.o): in function `libryzenadj::RyzenAdj::get_fast_limit':
          /home/william/Projects/libryzenadj-rs/src/lib.rs:220: undefined reference to `get_fast_limit'
          /usr/bin/ld: /home/william/Projects/PowerStation/target/debug/deps/liblibryzenadj-ec6b339ba685ce56.rlib(libryzenadj-ec6b339ba685ce56.1pc6pnmuzuak76qe.rcgu.o): in function `libryzenadj::RyzenAdj::get_stapm_limit':
          /home/william/Projects/libryzenadj-rs/src/lib.rs:315: undefined reference to `get_stapm_limit'
...

lto-compile-failure.log

Disabling LTO fixes the issue.

@Falcosc
Copy link
Collaborator

Falcosc commented Apr 11, 2024

Do you rebuild ryzenadj in your setup? Looks like it.
It feels like your build configuration doesn't know that these methods are exposed interface endpoints, because your build did maybe inline these, if disabling it did fix it.

But yes, I don't think INTERPROCEDURAL_OPTIMIZATION makes any difference at our already short call stacks, so it is a quick and easy fix on our side. Just wanted to remind you of a potential hidden secondary issue in your build setup.

Maybe we wait some days and let this question open before we do it in case somebody knows it better than us :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants