On Tue, Apr 09, 2019 at 12:35:49PM -0500, William Tambe wrote: > On Tue, Apr 9, 2019 at 10:58 AM Jeff Law <law@xxxxxxxxxx> wrote: > > So the first question I would ask is whether or not your static chain is > > a call clobbered register is not. If not, why -- most ports have a call > > clobbered static chain. Can a non-volatile (i.e. caller saved) static chain reg work at all? With current GCC, at least? > My static chain register is not marked in CALL_USED_REGISTERS , which > I assume mean, it is not call clobbered. > My preference would be to have it call clobbered so I wouldn't need to > do anything special. So define it as a call-clobbered (i.e. volatile) register? Most ABIs don't define what register to use for the static chain; many ABIs don't even define anything for passing an environment pointer. The static chain is pretty much a GCC implementation detail, and you can pick anything you want, if it works with the ABI you have. Segher