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

[windows] Make def generation work with objs containing LLVM bitcode #23742

Open
yuzhy8701 opened this issue Sep 24, 2024 · 0 comments
Open

[windows] Make def generation work with objs containing LLVM bitcode #23742

yuzhy8701 opened this issue Sep 24, 2024 · 0 comments

Comments

@yuzhy8701
Copy link
Contributor

Description of the feature request:

LLVM already has LTO support on Windows (full or thin). However, if you turn on LTO the created object files would contain llvm bitcode instead of being native objects. This breaks def generation when the windows_export_all_symbols feature is enabled, as the def_parser cannot parse those object files anymore to find the symbols (Unrecognized file format in 'bazel-out/.../a.obj').

One option here is apparently adding bitcode object support to the def_parser tool.

Another option, which seems more straightforward, is having the cc toolchain accepting an additional nm tool (maybe a list_symbols action with action_config, together with a feature to pass the flags), and have def_parser delegating the object files to the nm tool (if enabled) to list the symbols. I think it's fair to assume that if someone uses LTO on windows with LLVM they will have llvm-nm available as well.

This is pretty much the only (bazel-side) obstacle before enabling LTO on Windows.

Which category does this issue belong to?

C++ Rules

What underlying problem are you trying to solve with this feature?

Currently you can't turn on LTO on Windows if you enable the windows_export_all_symbols feature.

Which operating system are you running Bazel on?

Windows

What is the output of bazel info release?

release 7.3.1

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

What's the output of git remote get-url origin; git rev-parse HEAD ?

No response

Have you found anything relevant by searching the web?

https://stackoverflow.com/questions/57082617/building-tensorflow-with-ltcg
https://groups.google.com/g/bazel-discuss/c/IDOsuyJLzZI/m/GxEll6vHDwAJ

Any other information, logs, or outputs that you want to share?

No response

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

No branches or pull requests

4 participants