public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ali_gccbugzilla at emvision dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ipa/97119] New: Top level option to disable creation of IPA symbols such as .localalias is desired
Date: Fri, 18 Sep 2020 23:22:52 +0000	[thread overview]
Message-ID: <bug-97119-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 97119
           Summary: Top level option to disable creation of IPA symbols
                    such as .localalias is desired
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ali_gccbugzilla at emvision dot com
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

I work on the Solaris linkers, and in that role, often
collaborate with Rainer Orth to keep gcc working on that
platform. As part of that, we use gcc to build the OS along
with the native Studio compilers, as a means to better test
things, and because we often find that one compiler finds issues
that the other doesn't.

A couple of years ago (gcc 5?), we became aware of symbols ending
in .localalias.nn, .part.nn, and isra.dd. While this is very
impressive technology, particularly when C++ templates are generating
reams of identical code bodies for various interfaces, it poses
some problems for using gcc to build the core Solaris OS.

To understand the issue, it is necessary to understand that
Solaris has a large infrastructure dedicated to producing
accurate stack traces purely from examining in memory
object content (symbol tables, etc) and not relying on
access to the on-disk image, or on any debug sections.
Our libproc does this efficiently, and as part of that, relies
on symbol sort sections generated by the linkers to map symbol
names to addresses, or addresses to names. When mapping addresses
to names, it is important that the name we report be the one that
the programmer would understand, and not some other name that
happens to have the same address, due to some under the hood
optimizations. DTrace, mdb, and the ptools (pstack, etc) all
rely on this.

In this context, the local symbols generated by IPA, and particularly
the .localalias symbols, mess up our results, causing our 
address-to-name tables to have multiple names, some of which are
optimization implementation details that are not what the
programmer would want to see. Even worse is the case where
2 functions have their bodies merged into one piece of text
with 2 different names. Showing the user the "wrong" name for
a function on their stack can be very misleading, and can cause
wasted debugging time until they realize that they're seeing an
IPA artifact. At the same time, the core OS is largely written in
C, so the benefits from these particular IPA features are modest
at best. We have found a few merged function bodies, and in this
case, the minor duplication bloat is a price worth paying to get
the correct name associated to the different instances.

With previous versions of gcc, we were able to disable the
production of these symbols by using -fno-ipa-icf, so we did
that and moved on. With gcc10 however, we find that -fno-ipa-icf
is not sufficient, and that we still see .localalias symbols
in the resulting links. Although I'm sure that there is another
option like -fno-ipa-icf that we could set to address
that, I would like to ask for a supported way to turn off all
IPA that causes symbols like these to be injected into the link.
so that we can opt out for our admittedly specialized purposes,
and without having to revisit it every time a new gcc version appears,
or dig into the underlying optimization passes to figure out what
to turn off.

Please note that turning down optimization (e.g. -g) in order to
achieve this isn't the sort of answer we're looking for. These are
not debug objects, but rather objects built for production use. Hence
 we want to retain optimizations that don't generate extra symbols
in a simple and maintainable way.

Rainer did a one off experiment that showed that it would be
fairly easy to provide this. I'll leave it to him to describe.

Thanks for your consideration of this.

             reply	other threads:[~2020-09-18 23:22 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-18 23:22 ali_gccbugzilla at emvision dot com [this message]
2020-09-21 11:19 ` [Bug ipa/97119] " marxin at gcc dot gnu.org
2020-09-21 14:12 ` ro at gcc dot gnu.org
2020-09-21 14:12 ` ro at gcc dot gnu.org
2020-09-21 14:28 ` jakub at gcc dot gnu.org
2020-09-21 19:18 ` ali_gccbugzilla at emvision dot com
2020-09-25  9:20 ` ro at CeBiTec dot Uni-Bielefeld.DE
2024-02-02 10:33 ` hubicka at gcc dot gnu.org
2024-02-02 22:42 ` ali_gccbugzilla at emvision dot com
2024-02-02 22:48 ` pinskia at gcc dot gnu.org
2024-02-03  1:40 ` ali_gccbugzilla at emvision 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-97119-4@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).