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

            Bug ID: 84010
           Summary: [sparc64] Bad TLS code generation
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rth at gcc dot gnu.org
  Target Milestone: ---

Created attachment 43224
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43224&action=edit
preprocessed input and assembly output

Seen in top-of-tree qemu:

        lduw    [%fp+1823], %g1
...
        ldx     [%l7 + %g1], %g1, %tie_ldx(tcg_ctx)
...
        ldx     [%g7+%g1], %o1

Linker relaxation of R_SPARC_TLS_IE_LDX requires the input to be the
output of R_SPARC_TLS_IE_HI/LO.  However, the tie_ld64 pattern uses
an SImode input.  This led to spill/fill that dropped the sign-extension
of the value.

In addition to fixing the mode, we should think about letting reload
reconstitute the value -- it's just sethi+or pair.

command-line:

cc -I/home/rth/qemu/bld/sparc64-softmmu/../target/sparc -Itarget/sparc
-I/home/rth/qemu/qemu/tcg -I/home/rth/qemu/qemu/tcg/sparc
-I/home/rth/qemu/qemu/linux-headers -I/home/rth/qemu/bld/linux-headers -I.
-I/home/rth/qemu/qemu -I/home/rth/qemu/qemu/accel/tcg
-I/home/rth/qemu/qemu/include -I/usr/include/pixman-1
-I/home/rth/qemu/qemu/dtc/libfdt -Werror -pthread -I/usr/include/glib-2.0
-I/usr/lib/sparc64-linux-gnu/glib-2.0/include -m64 -mcpu=ultrasparc
-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes
-Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes
-fno-strict-aliasing -fno-common -fwrapv  -Wexpansion-to-defined -Wendif-labels
-Wno-shift-negative-value -Wno-missing-include-dirs -Wempty-body
-Wnested-externs -Wformat-security -Wformat-y2k -Winit-self
-Wignored-qualifiers -Wold-style-declaration -Wold-style-definition
-Wtype-limits -fstack-protector-strong -I/home/rth/qemu/qemu/capstone/include 
-I../linux-headers -I.. -I/home/rth/qemu/qemu/target/sparc -DNEED_CPU_H
-I/home/rth/qemu/qemu/include  -MMD -MP -MT target/sparc/translate.o -MF
target/sparc/translate.d -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -g   -c -o
target/sparc/translate.o /home/rth/qemu/qemu/target/sparc/translate.c
--save-temps

Reply via email to