public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "alvinhochun at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/104862] extern thread_local (emutls) code crashes with ASLR on Windows
Date: Thu, 12 May 2022 14:12:46 +0000	[thread overview]
Message-ID: <bug-104862-4-OLlkY3bpmc@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-104862-4@http.gcc.gnu.org/bugzilla/>

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

Alvin Wong <alvinhochun at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ebotcazou at gcc dot gnu.org

--- Comment #1 from Alvin Wong <alvinhochun at gmail dot com> ---
I found from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64697#c25 that there
was a change that seems related to the issue observed in this report. Can
anyone check?

> The master branch has been updated by Eric Botcazou <ebotcazou@gcc.gnu.org>:
> 
> https://gcc.gnu.org/g:021ad8e5cf9ab66e1a0a41dce3a54586facb86e0
> 
> commit r12-4036-g021ad8e5cf9ab66e1a0a41dce3a54586facb86e0
> Author: Eric Botcazou <ebotcazou@adacore.com>
> Date:   Fri Oct 1 10:49:34 2021 +0200
> 
>     Fix PR c++/64697 at -O1 or above
>     
>     The BFD fix eliminates the link failure and working code is generated at
>     -O0, but _not_ when optimization is enabled because the optimizer
> changes:
>     
>             movq    .refptr._ZTH1s(%rip), %rax
>             testq   %rax, %rax
>             je      .L2
>             call    _ZTH1s
>     
>     into:
>     
>             leaq    _ZTH1s(%rip), %rax
>             testq   %rax, %rax
>             je      .L2
>             call    _ZTH1s
>     
>     and the leaq now also gets the relocation overflow.  So the fix is to
>     teach legitimate_pic_address_disp_p to reject the transformation when
>     the symbol is an external weak function, which yields:
>     
>             cmpq    $0, .refptr._ZTH1s(%rip)
>             je      .L2
>             call    _ZTH1s
>     
>     and the cmpq keeps a relocation that does not overflow.
>     
>     gcc/
>             PR c++/64697
>             * config/i386/i386.c (legitimate_pic_address_disp_p): For
> PE-COFF do
>             not return true for external weak function symbols in medium
> model.

  reply	other threads:[~2022-05-12 14:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-10  9:07 [Bug c++/104862] New: " alvinhochun at gmail dot com
2022-05-12 14:12 ` alvinhochun at gmail dot com [this message]
2022-05-12 15:01 ` [Bug target/104862] " ebotcazou at gcc dot gnu.org
2022-06-30 10:38 ` ebotcazou at gcc dot gnu.org
2022-10-14 10:31 ` ebotcazou at gcc dot gnu.org

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-104862-4-OLlkY3bpmc@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: link
Be 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).