This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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]

[Bug sanitizer/79341] Many Asan tests fail on s390


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79341

--- Comment #23 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Ulrich Weigand from comment #22)
> (In reply to Jakub Jelinek from comment #21)
> > Could libsanitizer call __tls_get_offset instead, after setting %r12 or
> > whatever else is needed for it to make work and then perhaps adjust the
> > result if needed?
> > E.g. on s390x __tls_get_offset is internally:
> > __tls_get_offset:\n\
> >         la      %r2,0(%r2,%r12)\n\
> >         jg      __tls_get_addr\n\
> > and in the interceptor:
> > #ifdef __s390x__
> >   "la %r2, 0(%r2,%r12)\n"
> >   "jg __interceptor___tls_get_addr_internal_protected\n"
> > #else
> > at which point the original %r2 and %r12 is lost and it is hard to call the
> > original __tls_get_offset, it might be better to pass the original %r2 and
> > %r12 values to some C function and from that compute the r2 + r12 the code
> > perhaps needs for its own thing, but then we could (again in assembly) call
> > the original __tls_get_offset again if needed.
> 
> Yes, it would appear to be safer to call __tls_get_offset instead.
> You probably do not even need the original %r12, but simply subtract
> %r12 (whatever it currently is) from %r2 before calling the original
> __tls_get_offset.  The value of %r12 is not used for anything except
> adding it to %r2.

If it is that easy, then perhaps glibc should drop __tls_get_addr_internal and
just call __tls_get_offset that way internally too?
Otherwise, if we still wrap __tls_get_addr_internal (perhaps for compatibility
reasons) and just make sure we call __tls_get_offset instead on s390{,x} with
the adjusted argument, we could support even older glibcs.

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