]> git.ipfire.org Git - thirdparty/gcc.git/commit
S/390: Introduce jdd constraint
authoriii <iii@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 8 Feb 2019 12:39:27 +0000 (12:39 +0000)
committeriii <iii@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 8 Feb 2019 12:39:27 +0000 (12:39 +0000)
commite41570582156e8616ce4bdb60a104527298300cf
tree2eda6c5ea5df299062509119d9c47bd770d4d319
parent9160da73a1d001dcde36632e94175326edd5d6d1
S/390: Introduce jdd constraint

Implementation of section anchors in S/390 back-end added in r266741
broke jump labels in S/390 Linux kernel [1].  Currently jump labels
pass global variable addresses to .quad directive in inline assembly
using "X" constraint.  In the past this used to produce regular symbol
references, however, after r266741 we sometimes get values like
(plus (reg) (const_int)), where (reg) points to a section anchor.
Strictly speaking, this is still correct, since "X" accepts anything.
Thus, now we need another way to support jump labels.

The existing "i" constraint cannot be used, since with -fPIC it must
not accept non-local symbols, however, jump labels do require that,
e.g. __tracepoint_xdp_exception from kernel proper might be referenced
from kernel modules.

The existing "ZL" constraint cannot be used for the same reason.

The existing "b" constraint cannot be used because of the way
expand_asm_stmt works.  It deduces whether the constraint allows
regs, subregs or mems, and processes asm operands differently based on
that.  "b" is supposed to accept values like (mem (symbol_ref)), and
there appears to be no way to explain to expand_asm_stmt that for "b"
mem's address must not be in a register.

This patch introduces the new machine-specific constraint named "jdd" -
"j" prefix is already used for constants, and "d" stands for "data".
It accepts anything that fits into the data section, whether or not
this might require a relocation, that is, anything that passes
CONSTANT_P check.

[1] https://lkml.org/lkml/2019/1/23/346

gcc/ChangeLog:

2019-02-08  Ilya Leoshkevich  <iii@linux.ibm.com>

* config/s390/constraints.md (jdd): New constraint.

gcc/testsuite/ChangeLog:

2019-02-08  Ilya Leoshkevich  <iii@linux.ibm.com>

* gcc.target/s390/jump-label.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@268688 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/config/s390/constraints.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/s390/jump-label.c [new file with mode: 0644]