This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] s390: Add -fsplit-stack support
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: koriakin at 0x04 dot net (Marcin KoÅcielnicki)
- Cc: krebbel at linux dot vnet dot ibm dot com, gcc-patches at gcc dot gnu dot org
- Date: Thu, 4 Feb 2016 17:27:37 +0100 (CET)
- Subject: Re: [PATCH] s390: Add -fsplit-stack support
- Authentication-results: sourceware.org; auth=none
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.
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.
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.)
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU/Linux compilers and toolchain
Ulrich.Weigand@de.ibm.com