This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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: [PATCH] S390: Save and restore r12 in TLS_IE macro.


On 06/26/2017 09:19 AM, Stefan Liebler wrote:
On 06/20/2017 08:45 AM, Stefan Liebler wrote:
Hi,

the testcases elf/tst-tls1-static and elf/tst-tls2-static
are failing on s390 if gcc is configured with --enable-default-pie:
set bar to 1 (LE)
get sum of foo and bar (IE) = 0
bar = 0

The linker reports the following error without aborting:
elf/tst-tls1-static.o(.text+0x80):
invalid instruction for TLS relocation R_390_TLS_LOAD

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.

Bye.
Stefan

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.

Any objection?
Otherwise I'll commit this patch.
Committed

Bye.
Stefan



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