On Tue, 19 Apr 2016, AKASHI Takahiro wrote: > > > But if Szabolcs' two-instruction > > > sequence in the adjacent subthread is sufficient, this is moot. > > > > . It can also be solved by having just one NOP after the function label, > > and a number of them before, then no thread can be in the nop pad. That > > seems to indicate that GCC should not try to be too clever and simply > > leave the specified number of nops before and after the function label, > > leaving safety measures to the patching infrastructure. > > I don't get this idea very well. > How can the instructions *before* a function label be executed > after branching into this function?
The single nop after the function label is changed to a short backwards branch to the instructions just before the function label. As a result, the last instruction in the pad would have to become a short forward branch jumping over the backwards branch described above, to the first real instruction of the function. Alexander