[PATCH] s390: Add -fsplit-stack support
Marcin Kościelnicki
koriakin@0x04.net
Fri Feb 5 21:13:00 GMT 2016
On 04/02/16 17:27, Ulrich Weigand wrote:
> Marcin KoÃ
âºcielnicki wrote:
>
>> Fair enough. Here's what I'm going to implement in gold:
>>
>> - any PLT relocation: call
>> - PC32DBL on a larl: non-call
>> - PC32DBL otherwise: call
>> - any other relocation: non-call
>>
>> Does that sound right?
>
> Hmm, I'm wondering about the PC32DBL choices. There are now
> a large number of other non-call instructions that use PC32DBL,
> including lrl, strl, crl, cgrl, cgfrl, ...
>
> However, these all access *data* at the pointed-to location,
> so it is quite unlikely they would ever be used with a
> function symbol. So, assuming that you also check that the
> target of the relocation is a function symbol, treating only
> larl as non-call might be OK.
Yeah, I make sure the symbol is a STT_FUNC.
>
> Maybe a more conservative approach might be to make the decision
> the other way round: for PC32DBL check for *branch* instructions,
> and treat only those are calls. There's just a few branch
> instruction using PC32DBL:
>
> brasl (call)
> brcl (conditional or unconditional sibcall)
> brcth (???)
>
> where the last one is extremely unlikely (but theorically
> possible) to be used as conditional sibcall combined with
> a register decrement; I don't think this can ever happen
> with current compilers however.
I'll stay with checking for larl - while I can imagine someone adding a
new conditional branch instruction, I don't see a need for another
larl-like instruction. Besides, this way the failure mode for an
unknown instruction would be producing an error, instead of silently
emitting code with unfixed prologue.
>
> For full completeness, there are also PC16DBL relocations that
> *could* target called functions, but only when compiling with
> the -msmall-exec flag to assume total executable size is less
> than 64 KB. These are used by the following instructions:
>
> bras
> brc
> brct
> brctg
> brxh
> brxhg
> brxle
> brxlg
> crj
> cgrj
> clrj
> clgrj
> cij
> cgij
> clij
> clgij
>
> Note that those are *all* branch instructions, so it might
> make sense to add any PC16DBL targetting a function symbol
> to the list of calls, just in case. (But since basically
> nobody ever uses -msmall-exec, it doesn't really matter
> much either.)
Ah right, I've added PC16DBL to the "always call" list.
>
> Bye,
> Ulrich
>
I've updated and resubmitted the gold patch.
Marcin KoÅcielnicki
More information about the Gcc-patches
mailing list