Closed CcWeapon closed 2 years ago
cc @rafaelauler @maksfb @aaupov
thx!!
I guess it's because of the alignment of function or section. You can try to adjust the value like https://github.com/facebookincubator/BOLT/blob/88c70afe9d388ad430cc150cc158641701397f70/bolt/include/bolt/Core/BinaryFunction.h#L181 or options like --align-text
, --align-functions
, --block-alignment
.
I guess it's because of the alignment of function or section. You can try to adjust the value like
or options like
--align-text
,--align-functions
,--block-alignment
.
It doesn't work. --align-functions
mast >0, so i set it to 1, then bolt log say : BOLT-WARNING: original .text too small to fit the new code using 0x1000 alignment. 2354092 bytes needed, have 2354072 bytes available.
The required space is smaller, but still larger than the original space.
We always align the new .text
at a page boundary. Historically, it was done for performance reasons. If the goal is to modify the binary for other reasons, it makes sense to remove the alignment. You can add a patch. Note that for C++, you need a 2-byte minimum alignment for functions for correctness reasons.
thx
I want to use “-use-old-text” to reuse .text when I don't use any optimizations. There was only one fake entry in the null.fdata. e.g:
~/cpu-bolt/build/bin/llvm-bolt libxx.so -o libxx.bolt.none -data=null.fdata -reorder-blocks=none -reorder-functions=none -split-functions=0 -dyno-stats -use-old-text -v=1
then , bolt log say
BOLT-WARNING: original .text too small to fit the new code using 0x1000 alignment. 2400776 bytes needed, have 2354072 bytes available.
i find bolt add some nop after the method. can u tell me why bolt do this, and when do bolt add these nops?![image](https://user-images.githubusercontent.com/33447048/164966803-74850f4d-c463-43d8-b727-b89734bd93eb.png)