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

            Bug ID: 83466
           Summary: Wrong TLS GD sequence for ILP32
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sch...@linux-m68k.org
  Target Milestone: ---
            Target: aarch64-*-*

$ cat tls.c
__thread int ti;

int f (void)
{
  return ti;
}
$ gcc -S -fPIC tls.c -mabi=ilp32

        adrp    x0, :tlsdesc:ti
        ldr     x1, [x0, #:tlsdesc_lo12:ti]
        add     x0, x0, :tlsdesc_lo12:ti
        .tlsdesccall    ti
        blr     x1
        mrs     x1, tpidr_el0
        add     x0, x1, x0

x1 + x0 needs to be performed in SImode so that it wraps around in the 32-bit
address space.

Reply via email to