This is part of BOLT core changes for golang support patch: https://reviews.llvm.org/D124347
I'm not sure what causes clang-format to complain about BF.h , locally I'm unable to repeat this.
Anyway I've commented about 3 main problems in this patch. I would be happy to discuss them and submit the golang support patches one-by-one, it would be the most right and simple away I think.
@maksfb @rafauler @Amir
We need this, since some of the instructions annotations might be "locked". E.g. when dealing with golang inlined functions, we might inline only one instruction (e.g NOP) which will be removed by bolt. But this instruction has inline metadata that we need to have in order to restore inlining golang tables. So before removing such instruction we need to create NOP instruction on it's place that will store this metadata.
Golang pass needs to create 2 extra read sections. We need to create PHDR for them and emit them properly to the binary. I'm not sure how to refactor the code connected to extra section handling, would be thankful for ideas.
This is currently used for the created by golang pass sections. They don't have input data, so it is used as a crutch where we mark the section as changed and use its output contents for emission. With the new sections creating/emission that is probable the second problem we need to discuss.
Do you care about the order? Or is a SmallStringSet sufficient?
Basically you are right here, but this is temp code and one of the problem that was marked by me above - we need to think about refactoring the code that emits extra sections, so probably it would be removed.
New writable segment creation was re-developed and separate review was created, let's start from there https://reviews.llvm.org/D143390 @maksfb @rafaelauler @Amir
Change patch according to https://reviews.llvm.org/D143390
@maksfb @rafauler please review D143390 :)