'profile directed optimization: Creating gcov .gcda files out of branch probability data
In my case it's not possible to compile the programm with the -fprofile-arcs option and run it, to collect the .gcda files, that are necessary to compile the program again with -fbranch-probabilities for profile directed optimizations. But I can monitor the program and get the probabilities of all the branches to be taken or not in a simple text file. Is it possible to create .gcda files out of this simple text file? The problem I currently have, is that I found out not much about the .gcda files. From the documentation (https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html) I found this: "With -fprofile-arcs, for each function of your program GCC creates a program flow graph, then finds a spanning tree for the graph. Only arcs that are not on the spanning tree have to be instrumented: the compiler adds code to count the number of times that these arcs are executed. When an arc is the only exit or only entrance to a block, the instrumentation code can be added to the block; otherwise, a new basic block must be created to hold the instrumentation code" Is the structure of the .gcda files described somewhere more in detail other than in the gcc source code? I find it hard to even estimate if it would theoretically be possible to create the .gcda files using the information from my text file and if yes which data I would have to mock because I think there is more information in these files than just the branch taken/not taken probabilities. The attached picture shows an excerpt of my text file. Address is the address of a particular branch instruction in the program binary. 
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
