BOLT
BOLT copied to clipboard
[Question] What is the .bolt.org.text segment used for?
Hi,
I noticed that the .bolt.org.text segment takes up half of the binary size, but the content of the .bolt.org.text segment already has an optimized edition in the .text and .text.cold segments. I tried to get rid of the .bolt.org.text segment with llvm-objcopy, but the binary won't run.. So what is the .bolt.org.text segment mainly used for?
Thanks!
I tested a small test case and found that the .bolt.org.text section was consistent with the pre-optimized .text section, and the new .text section and the .text.cold section were not empty. But after I deleted the .text section, the program worked well. I don't know why.
The answer depends on how you build the application and what BOLT flags you use. If you run in relocation mode (link with --emit-relocs
), then .bolt.org.text
wouldn't be used unless you also specify -lite
. You can also add --use-old-text
BOLT flag that will reuse the original section for the optimized code.
Hi, @maksfb. I have a similar question. Why not just remove .bolt.org.text
segment if it won't be used. It can reduce the generated binary size.
It should be possible to remove .bolt.org.text
, but then to make the use of the created gap we would have to break the containing segment into two.