public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/64697] C++11 thread_local: relocation truncated to fit: R_X86_64_PC32 against undefined symbol `TLS init function for N::ptd'
Date: Fri, 01 Oct 2021 08:56:32 +0000	[thread overview]
Message-ID: <bug-64697-4-UAl62UJ3Lp@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-64697-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #25 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
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.

  parent reply	other threads:[~2021-10-01  8:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-20 19:16 [Bug c++/64697] New: " vhaisman at gmail dot com
2015-01-20 19:18 ` [Bug c++/64697] " vhaisman at gmail dot com
2020-03-26 22:03 ` wilson at gcc dot gnu.org
2020-03-26 23:02 ` vhaisman at gmail dot com
2020-03-26 23:06 ` wilson at gcc dot gnu.org
2021-10-01  8:56 ` cvs-commit at gcc dot gnu.org [this message]
2021-10-01  8:59 ` cvs-commit at gcc dot gnu.org
2021-10-01  9:02 ` cvs-commit at gcc dot gnu.org
2021-10-01  9:05 ` 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-64697-4-UAl62UJ3Lp@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).