[Repost] Obtaining the actual size of BBs in bytes and the number of fixups per each BB


I want to obtain the following information at each object file during compilation, and store them into the new section that I define. Currently the target architecture is x86_64 with ELF format.

a) actual size of basic blocks in bytes to be emitted

b) number of fixups that belong to each basic block

By the time of emitting the actual bytes, I could only see the unit of the fragment without the boundary of functions and basic blocks. In general, what is the best strategy to get the info from frontend at backend if necessary?

Thanks a lot for your help in advance!