The testcases elf/tst-tls1-static and elf/tst-tls2-static
are failing on s390 if gcc is configured with --enable-default-pie.
According to binutils, there are only four valid cases for IE -> LE transition:
lg %rx,(0,%ry) -> sllg %rx,%ry,0
lg %rx,(%ry,0) -> sllg %rx,%ry,0
lg %rx,(%ry,%r12) -> sllg %rx,%ry,0
lg %rx,(%r12,%ry) -> sllg %rx,%ry,0
Thus I've adjusted the TLS_IE macro in s390 tls-macros.h files in PIC case
in order to use r12 for the address of global offset table.
The adjusted macro definition is not used if gcc is not configured with
--enable-default-pie.
ChangeLog:
* sysdeps/s390/s390-32/tls-macros.h (TLS_IE): Use r12 for GOT address.
* sysdeps/s390/s390-64/tls-macros.h (TLS_IE): Likewise.
This patch also clobbers r14 in TLS_LD, TLS_GD macros on 31bit.
This ensures that r14 isn't used to save and restore r12 while
r14 is clobbered by the bas-instruction.
As note:
r12 can't be added to clobber list as gcc would fail with:
error: PIC register clobbered by ‘12’ in ‘asm’
For 64bit this fix was already done in 2004 in the
commit b80af23ac6.
ChangeLog:
* sysdeps/s390/s390-32/tls-macros.h (TLS_LD, TLS_GD):
Clobber also r14.