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

[llvm-bolt] Way to know whether the binary was converted by BOLT #60253

Closed
corona10 opened this issue Jan 24, 2023 · 6 comments
Closed

[llvm-bolt] Way to know whether the binary was converted by BOLT #60253

corona10 opened this issue Jan 24, 2023 · 6 comments
Labels
BOLT question A question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!

Comments

@corona10
Copy link
Contributor

For example, CPython failed to pass the test_gdb if the binary is converted by BOLT and it's intended.
But it would be great if there is a way to know if the binary was converted by BOLT.

@corona10
Copy link
Contributor Author

corona10 commented Jan 24, 2023

cc @aaupov

@corona10
Copy link
Contributor Author

if (!opts::HeatmapMode &&
!(opts::AggregateOnly && BAT->enabledFor(InputFile)) &&
(SectionName.startswith(getOrgSecPrefix()) ||
SectionName == getBOLTTextSectionName()))
return createStringError(
errc::function_not_supported,
"BOLT-ERROR: input file was processed by BOLT. Cannot re-optimize");
}

It looks like there is a section that can be a hint for it.

@llvmbot
Copy link
Member

llvmbot commented Jan 24, 2023

@llvm/issue-subscribers-bolt

@aaupov
Copy link
Contributor

aaupov commented Jan 24, 2023

readelf -p .note.bolt_info <executable> | grep BOLT

Example output:

  [    10]  BOLT revision: <unknown>, command line: /home/worker/bolt-worker2/bolt-x86_64-ubuntu-shared/build/bin/llvm-bolt /home/worker/bolt-worker2/bolt-x86_64-ubuntu-shared/build/tools/bolt/test/Output/re-optimize.test.tmp.exe -o /home/worker/bolt-worker2/bolt-x86_64-ubuntu-shared/build/tools/bolt/test/Output/re-optimize.test.tmp

@aaupov
Copy link
Contributor

aaupov commented Jan 24, 2023

The section is added by default but can be omitted if -bolt-info=0 is passed

@EugeneZelenko EugeneZelenko added the question A question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead! label Jan 24, 2023
@corona10
Copy link
Contributor Author

Okay Thanks looks like it should be solved by reading self-binary :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BOLT question A question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!
Projects
None yet
Development

No branches or pull requests

4 participants