public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "hjl.tools at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/58066] GCC mis-compiles access to TLS variable with -fPIC on x86_64 Date: Wed, 12 Mar 2014 22:22:00 -0000 [thread overview] Message-ID: <bug-58066-4-Cw1pEkpERP@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-58066-4@http.gcc.gnu.org/bugzilla/> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58066 --- Comment #5 from H.J. Lu <hjl.tools at gmail dot com> --- Another problem: [hjl@gnu-6 gcc]$ cat /tmp/c.i static __thread char ccc; void* __cxa_get_globals() { return &ccc; } [hjl@gnu-6 gcc]$ ./xgcc -B./ -S -O2 -fPIC /tmp/c.i [hjl@gnu-6 gcc]$ cat /tmp/c.i static __thread char ccc; void* __cxa_get_globals() { return &ccc; } [hjl@gnu-6 gcc]$ ./xgcc -B./ -S -O2 -fPIC /tmp/c.i -m32 [hjl@gnu-6 gcc]$ cat c.s .file "c.i" .section .text.unlikely,"ax",@progbits .LCOLDB0: .text .LHOTB0: .p2align 4,,15 .globl __cxa_get_globals .type __cxa_get_globals, @function __cxa_get_globals: .LFB0: .cfi_startproc pushl %ebx .cfi_def_cfa_offset 8 .cfi_offset 3, -8 call __x86.get_pc_thunk.bx addl $_GLOBAL_OFFSET_TABLE_, %ebx subl $8, %esp .cfi_def_cfa_offset 16 addl $8, %esp .cfi_def_cfa_offset 8 leal ccc@tlsgd(,%ebx,1), %eax call ___tls_get_addr@PLT popl %ebx .cfi_restore 3 .cfi_def_cfa_offset 4 ret .cfi_endproc .LFE0: .size __cxa_get_globals, .-__cxa_get_globals sched2 doesn't know (insn:TI 15 25 13 2 (parallel [ (set (reg:SI 0 ax [86]) (unspec:SI [ (reg:SI 3 bx) (symbol_ref:SI ("ccc") [flags 0x1a] <var_decl 0x7f2b2be 5e980 ccc>) (symbol_ref:SI ("___tls_get_addr")) ] UNSPEC_TLS_GD)) (clobber (reg:SI 1 dx [88])) (clobber (reg:SI 2 cx [89])) (clobber (reg:CC 17 flags)) ]) /tmp/c.i:5 772 {*tls_global_dynamic_32_gnu} (expr_list:REG_DEAD (reg:SI 3 bx) (expr_list:REG_UNUSED (reg:CC 17 flags) (expr_list:REG_UNUSED (reg:SI 2 cx [89]) (expr_list:REG_UNUSED (reg:SI 1 dx [88]) (expr_list:REG_EQUIV (unspec:SI [ (reg:SI 3 bx) (symbol_ref:SI ("ccc") [flags 0x1a] <var_decl 0 x7f2b2be5e980 ccc>) (symbol_ref:SI ("___tls_get_addr")) ] UNSPEC_TLS_GD) (nil))))))) is a function call and move stack adjustment cross it.
next prev parent reply other threads:[~2014-03-12 22:22 UTC|newest] Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-08-02 23:12 [Bug c/58066] New: " ppluzhnikov at google dot com 2013-08-02 23:57 ` [Bug target/58066] " pinskia at gcc dot gnu.org 2013-08-06 23:14 ` ppluzhnikov at google dot com 2014-03-12 21:05 ` hjl.tools at gmail dot com 2014-03-12 22:22 ` hjl.tools at gmail dot com [this message] 2014-05-19 5:26 ` wmi at gcc dot gnu.org 2014-12-18 17:54 ` dvyukov at google dot com 2015-07-11 21:03 ` [Bug target/58066] __tls_get_addr is called with misaligned stack on x86-64 hjl.tools at gmail dot com 2015-07-13 3:58 ` hjl.tools at gmail dot com 2015-07-13 6:41 ` ubizjak at gmail dot com 2015-07-13 9:16 ` [Bug rtl-optimization/58066] " ubizjak at gmail dot com 2015-07-13 11:08 ` ubizjak at gmail dot com 2015-07-13 12:08 ` hjl.tools at gmail dot com 2015-07-15 7:40 ` uros at gcc dot gnu.org 2015-07-15 7:41 ` [Bug target/58066] " ubizjak at gmail dot com 2015-07-15 13:42 ` uros at gcc dot gnu.org 2015-07-23 18:52 ` uros at gcc dot gnu.org 2015-07-30 8:54 ` uros at gcc dot gnu.org 2015-07-30 9:00 ` ubizjak at gmail dot com
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-58066-4-Cw1pEkpERP@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).