Am Mittwoch, den 12.12.2018, 18:53 +0000 schrieb Wilco Dijkstra: > Hi, > > > > On 12 Dec 2018,@18:21, Richard Earnshaw (lists) <richard.earns...@arm.com> > > wrote: > > > > However, that introduces an issue that that > > > code is potentially used across multiple versions of gcc, with > > > potentially different choices of the static chain register. Hmm, this > > > might need some more careful thought.... > > The static chain is only used inside nested functions, so it's not an ABI but > a > function-local agreement. Although it looks like you can take the address of > a nested function, I think you cannot ever export it in a way that exposes a > different static chain given each address-taken nested function would emit > its own trampoline on the stack. > > In fact the trampoline implementation is broken by design since the stack > should not be executable by default.
Does a non-executable stack actually improve security? For the alternative implementation using (custom) function descriptors (-fno-trampolines) the static chain becomes part of the ABI or not? Best, Martin > > > I'm also not keen on the fact that we are now seriously eating into the > > > space of call clobbered registers; what's the argument behind your > > > selection of r11 as opposed to any other register? > > The static chain register is only used on entry to a nested function. > That's why I suggested using x9 given x8 is the last argument register. > > > suggested r9, then I discovered that r9 and r10 were used > > by the stack probing mechanism, so I just picked the following > > one that didn't seem to be used for other purposes already. > > We could rename those temporaries if we think x9 is better than x11. > > Wilco >