How can I rewrite the changed function in BOLT

I have increased the number of instructions of the function in my bolt pass. How can I rewrite the changed function? Now I get the following warning and no change in binary:

BOLT-WARNING: new function size (0x1b0) is larger than maximum allowed size (0x150) for function main

Thank you!

Or in other words, how are modified functions in BOLT rewritten?

Looks like you’re using use-old-text or no-relocs mode which attempt to rewrite the function in-place. Can you please show BOLT command line and the output?

1 Like

When the input binary lacks relocations saved by the linker under -q/--emit-relocs option, BOLT tries to overwrite the function in-place. If you can relink the input binary, then just add -q (-Wl,-q if invoking via the compiler). Otherwise, we’ll need to expand the capabilities to write new function body to a new segment in non-relocation mode.

1 Like

Thanks for your reply, the option -Wl,-q has solved my problem. And I think it’s a good idea to expand the capabilities to write new function body to a new segment in non-relocation mode. Sometimes we can’t relink the input binary.