Message ID | yddpqs9n9zh.fsf@manam.CeBiTec.Uni-Bielefeld.DE |
---|---|
State | New |
Headers | show |
On Thu, Jan 6, 2011 at 7:49 PM, Rainer Orth <ro@cebitec.uni-bielefeld.de> wrote: > Uros Bizjak <ubizjak@gmail.com> writes: > >> Attached variant of your original patch works for me - I have >> bootstrapped and regression test the patch on x86_64-pc-linux-gnu. > > Thanks. I've successfully bootstrapped the following version (changing > SUN to Sun; while Sun started as an acronym ages ago, it has long been a > name) on i386-pc-solaris2.1[01] with Sun as and gas. Thanks for explaining this bit of computer history! > Ok for mainline now and the obvious backport (replacing define_c_enum > with define_constants) for the 4.4 and 4.5 branches after testing? > PR target/43309 > * config/i386/i386.c (legitimize_tls_address) > <TLS_MODEL_INITIAL_EXEC>: Handle TARGET_64BIT && TARGET_SUN_TLS. > * config/i386/i386.md (UNSPEC_TLS_IE_SUN): Declare. > (tls_initial_exec_64_sun): New pattern. Yes, this is OK everywhere. Thanks, Uros.
diff -r 91ae5b1efcf5 gcc/config/i386/i386.c --- a/gcc/config/i386/i386.c Wed Jan 05 14:19:38 2011 +0100 +++ b/gcc/config/i386/i386.c Wed Jan 05 14:27:56 2011 +0100 @@ -12542,6 +12542,17 @@ case TLS_MODEL_INITIAL_EXEC: if (TARGET_64BIT) { + if (TARGET_SUN_TLS) + { + /* The Sun linker took the AMD64 TLS spec literally + and can only handle %rax as destination of the + initial executable code sequence. */ + + dest = gen_reg_rtx (Pmode); + emit_insn (gen_tls_initial_exec_64_sun (dest, x)); + return dest; + } + pic = NULL; type = UNSPEC_GOTNTPOFF; } diff -r 91ae5b1efcf5 gcc/config/i386/i386.md --- a/gcc/config/i386/i386.md Wed Jan 05 14:19:38 2011 +0100 +++ b/gcc/config/i386/i386.md Wed Jan 05 14:27:56 2011 +0100 @@ -93,6 +93,7 @@ UNSPEC_TLS_GD UNSPEC_TLS_LD_BASE UNSPEC_TLSDESC + UNSPEC_TLS_IE_SUN ;; Other random patterns UNSPEC_SCAS @@ -12686,6 +12687,18 @@ (set_attr "memory" "load") (set_attr "imm_disp" "false")]) +;; The Sun linker took the AMD64 TLS spec literally and can only handle +;; %rax as destination of the initial executable code sequence. +(define_insn "tls_initial_exec_64_sun" + [(set (match_operand:DI 0 "register_operand" "=a") + (unspec:DI + [(match_operand:DI 1 "tls_symbolic_operand" "")] + UNSPEC_TLS_IE_SUN)) + (clobber (reg:CC FLAGS_REG))] + "TARGET_64BIT && TARGET_SUN_TLS" + "mov{q}\t{%%fs:0, %0|%0, QWORD PTR fs:0}\n\tadd{q}\t{%a1@gottpoff(%%rip), %0|%0, %a1@gottpoff[rip]}" + [(set_attr "type" "multi")]) + ;; GNU2 TLS patterns can be split. (define_expand "tls_dynamic_gnu2_32"