public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "iains at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/112397] Two persistent libstdc++ test failures on x86_64-apple-darwin
Date: Wed, 07 Feb 2024 17:37:07 +0000	[thread overview]
Message-ID: <bug-112397-4-3vx3O6RL7l@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-112397-4@http.gcc.gnu.org/bugzilla/>

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

Iain Sandoe <iains at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2024-02-07
     Ever confirmed|0                           |1

--- Comment #3 from Iain Sandoe <iains at gcc dot gnu.org> ---
(In reply to Iain Sandoe from comment #2)
> (In reply to Jonathan Wakely from comment #1)
> > The .cold symbol is created by gcc, I don't see any way to control its
> > visibility in the source. So maybe a target bug in the compiler, not a
> > library bug.
> 
> Agreed its a target issue - it's a question of convincing the linker that
> the label is not reachable from a different TU if the implementation of the
> non-cold symbol comes from that.

The problem is this:

We partition the function into hot/cold.

so we have

  weak definition
  hot
 ..... do stuff
 ... make a call

Landingpad1 OK... return
   epilogue_code:
   ....

Landingpad2 bad -> jump to error_case

   cold
error_case:
   ... do stuff
   jump epilogue_code.


====

The linker says "oh you have a direct jump to that epilogue code in a weak
definition which would be broken if a different weak definition was chosen by
the dynamic linker".

On the face of it, the linker is correct ...
... but what it cannot see is that the only way to be executing the code that
makes this jump is if it came from Landingpad2.

So actually, we do not have a real error - but I am not sure how we could go
about teaching the linker to DTRT (even if we could persuade Apple to do the
same for the new closed source one).

I'm tempted to suggest that we consider building libstdc++ with
`-fno-reorder-blocks-and-partition` and see if there's any measurable
performance decrease.

NOTE; that Darwin's linker (using subsections_by_symbols) is also able to
partition and reorder code without help from the compiler .. (although
whether/how much it does I"m not sure).

If there's a way to add that [-fno-reorder-blocks-and-partition] flag to that
single source for Darwin-only, that would be a short-term workaround.

  parent reply	other threads:[~2024-02-07 17:37 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-05 20:42 [Bug libstdc++/112397] New: " fxcoudert at gcc dot gnu.org
2023-11-06  9:19 ` [Bug libstdc++/112397] " redi at gcc dot gnu.org
2023-11-06 16:17 ` [Bug target/112397] " iains at gcc dot gnu.org
2024-02-07 17:37 ` iains at gcc dot gnu.org [this message]
2024-02-08 12:11 ` redi at gcc dot gnu.org
2024-02-08 12:15 ` redi at gcc dot gnu.org
2024-02-08 12:21 ` jakub at gcc dot gnu.org
2024-02-08 13:12 ` iains at gcc dot gnu.org
2024-02-08 13:18 ` jakub at gcc dot gnu.org
2024-02-08 13:22 ` jakub at gcc dot gnu.org
2024-02-08 14:02 ` iains at gcc dot gnu.org
2024-02-19 20:16 ` cvs-commit at gcc dot gnu.org
2024-04-03 14:57 ` cvs-commit at gcc dot gnu.org
2024-04-21 13:04 ` cvs-commit at gcc dot gnu.org
2024-04-29 14:18 ` cvs-commit at gcc dot gnu.org
2024-04-29 14:42 ` iains 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-112397-4-3vx3O6RL7l@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).