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

--- Comment #4 from Uroš Bizjak <ubizjak at gmail dot com> ---
-O2 -fpie -mtls-direct-seg-refs -m32 works OK, compiler goes through the same
code paths as in 64bit case:

(insn 18 17 19 2 (set (reg:SI 3 bx [ cache+4 ])
        (mem/u/c:SI (const:SI (plus:SI (unspec:SI [
                            (symbol_ref:SI ("_ZZ7tempDirvE5cache") [flags
0x2a])
                        ] UNSPEC_NTPOFF)
                    (const_int 4 [0x4]))) [1 cache+4 S4 A32 AS2]))
resulting in:

        movl    %gs:_ZZ7tempDirvE5cache@ntpoff, %ecx
        movl    8(%esp), %eax
        movl    %gs:4+_ZZ7tempDirvE5cache@ntpoff, %ebx
        movl    %ecx, (%eax)
        movl    %ebx, 4(%eax)

It looks to me that 64bit x86_64 should also accept UNSPEC_NTPOFF symbol
references with a small offset.

Reply via email to