For sampleFDO, because the optimized build uses profile generated from previous release, we cannot tell a function without profile is truely cold or just newly created. Currently we treat them conservatively and put them in .text section instead of .text.unlikely. The result is when we persuing the best performance by locking .text.hot and .text in memory, and use huge pages for them, we waste a lot of memory and huge pages for functions actually being cold.
The patch add a new section to the profile. The section contains a list of function names showing up in the binary used to generate the current profile. During profile use compilation, when profile-sample-accurate is enabled, a function without profile will be regarded as cold only when it is contained in that list.
In order to add the symbol whitelist to the profile, I extend the profile format so it is easier to add a new section or extend an existing section in the future.
Name it 'SectEdgeProfile' or 'SecLBRProfile'?
Also move this after the WhiteList and reserve some enum range between WhiteList and the firstProfile
enum SecType {
}
We should shoot for one profile type per section, but the hybrid mode you mentioned can also be supported if it is a size win.