public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Fangrui Song <i@maskray.me>
To: GCC Development <gcc@gcc.gnu.org>
Cc: "H.J. Lu" <hjl.tools@gmail.com>, Florian Weimer <fw@deneb.enyo.de>
Subject: Re: Add -fdirect-access-external-data
Date: Wed, 6 Jan 2021 22:26:23 -0800	[thread overview]
Message-ID: <MWHPR1201MB0110FBB62F6D8B7F4168CEEACBAF0@MWHPR1201MB0110.namprd12.prod.outlook.com> (raw)
In-Reply-To: <CAMe9rOoRdC5QGffuLCbwCBhGmCT8-uHKdsqyc8HgAhxqEhbgzw@mail.gmail.com>

On Sat, Dec 26, 2020 at 7:39 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Sat, Dec 26, 2020 at 7:32 AM Florian Weimer <fw@deneb.enyo.de> wrote:
> >
> > * Fangrui Song:
> >
> > > Hi, I filed https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98112 which
> > > proposes -fdirect-access-external-data to address some x86-64
> > > GCC/binutils pain[1] and also benefit non-x86 architectures (also see [1]
> > > it can prevent copy relocations).
> > >
> > > [1] Mentioned in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98112#c2
> > >
> > > Since I am going to add this option to Clang and I hope (once GCC decides to
> > > implement this option the two compilers can use the same option name), I bring
> > > it to your attention.
> >
> > One worry I have is that people start building shared objects with
> > direct data access, expecting the main program to be built with
> > indirect access.  We already see this today with Qt.  It's not really
> > supported well by the toolchain and causes frequent issues.
>
> It can be solved by ABI extension implemented in linker, ld.so and
> compiler.
>
> > Depending on the ELF ABI in question, the new pair of -f options might
> > not actually be meaningful.  It really depends on whether you have
> > reasonably-sized displacements available.  I think there are some ABIs
> > where the optimization is theoretically possible, but impractical
> > because the ilimit it imposes on data segment (think AArch64 without
> > adrp).
>
>
>
> --
> H.J.

Please check out new comments on
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98112

-fdirect-access-external-data is still the best name. The option is
useful to avoid copy relocations / "canonical PLT entry"
(st_shndx=0,st_value!=0) in -fno-pic code.
I will proceed with my Clang patch.

  reply	other threads:[~2021-01-07  6:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-17  7:10 Fangrui Song
2020-12-26 15:31 ` Florian Weimer
2020-12-26 15:39   ` H.J. Lu
2021-01-07  6:26     ` Fangrui Song [this message]
     [not found]     ` <MWHPR1201MB011025EE98F5F40BA9AE62E0CBAF0@MWHPR1201MB0110.namprd12.prod.outlook.com>
2021-01-08  2:07       ` H.J. Lu
2021-01-08  3:38         ` Fangrui Song
     [not found]         ` <MWHPR1201MB01103E59742F469B75B35BDBCBAE0@MWHPR1201MB0110.namprd12.prod.outlook.com>
2021-01-08  4:11           ` H.J. Lu

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=MWHPR1201MB0110FBB62F6D8B7F4168CEEACBAF0@MWHPR1201MB0110.namprd12.prod.outlook.com \
    --to=i@maskray.me \
    --cc=fw@deneb.enyo.de \
    --cc=gcc@gcc.gnu.org \
    --cc=hjl.tools@gmail.com \
    /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).