This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [ping] Change static chain to r11 on aarch64

On Wed, 12 Dec 2018, Wilco Dijkstra wrote:
> I've not seen such an alternative implementation (-fno-trampolines is
> ignored on all targets I tried), but it wouldn't affect the ABI since you can
> only take the address of a nested function when you're the parent function.

Regarding the trampoline-code-on-executable-stack variant of
nested functions, don't miss one fine detail:

While the choice of static-chain register does not affect the
ABI, it's the other way round: the choice of static-chain
register matters, specifically it's call-clobberedness.

The sublime port (to invent a soundalike term for port
maintainership alluding to unused terminology) is recommended to
pick a call-clobbered register that isn't used to carry any odd
special part of a function argument (including but not
restricted to regular function arguments and the

It looks like the current aarch64 static-chain register R18 is
call-saved but without special provisions to save and restore
the static chain register, i.e. the port is broken wrt.
trampolines but may appear to work (likely as-if you got the
call-clobberedness wrong for a special case; I haven't
investigated).  I understand the i386 port gets this right.
The CRIS port does not, but attempts and adds another bug (you
can't use the trampoline as a register-save area on return).

So, changing from R18 to R11 for aarch64 seems right, as the
latter is call-clobbered and the former is call-saved IIUC.

Unless of course I and grep both miss something or other.

brgds, H-P

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]