public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: "maskray@google.com" <maskray@google.com>
To: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
Cc: Szabolcs Nagy <Szabolcs.Nagy@arm.com>,
	'GNU C Library' <libc-alpha@sourceware.org>
Subject: Re: [PATCH 2/3] Revert "[AArch64][BZ #17711] Fix extern protected data handling"
Date: Tue, 24 May 2022 10:28:28 -0700	[thread overview]
Message-ID: <20220524172828.7gawda2en7nx6zg3@google.com> (raw)
In-Reply-To: <DB6PR0801MB187936CC075E089479679EF683D79@DB6PR0801MB1879.eurprd08.prod.outlook.com>

On 2022-05-24, Wilco Dijkstra wrote:
>Hi,

Hi Wilco,

>>> * Clang code generation treats STV_PROTECTED the same way as STV_HIDDEN:
>>>   no GOT-generating relocation in the first place.
>
>We should change GCC's behaviour to match this - is this something that
>applies to all targets?

I have a blog post on the topic about copy relocations and protected
symbols:
https://maskray.me/blog/2021-01-09-copy-relocations-canonical-plt-entries-and-protected

"The GCC pessimization applies to all ports with #define TARGET_BINDS_LOCAL_P default_binds_local_p_2."

The aarch64 pessimization was due to the side affect of a commit
attempting to fix another issue: commit
cbddf64c0243816b45e6680754a251c603245dbc (From-SVN: r222992)

>>> * gold and lld reject copy relocation on a STV_PROTECTED symbol.
>>> * Nowadays -fpie/-fpic modes are popular. GCC/Clang's codegen uses
>>>   GOT-generating relocation when accessing an default visibility
>>>   external symbol which avoids copy relocation.
>
>Would it be reasonable to add a way to override settings for binaries?
>For example if all imported symbols are marked with the correct visibility,
>PIE binaries could avoid using GOT for default visibility external symbols to
>get better performance. And non-PIE binaries could force GOT accesses for
>non-default visibility to avoid copy relocations and support protected visibility.

In Clang, -fno-direct-access-external-data is such an option:)

---

Regarding function symbols, there is a bit which should be fixed:
"Protected function symbols and canonical PLT entries"

  reply	other threads:[~2022-05-24 17:28 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-24 13:46 Wilco Dijkstra
2022-05-24 17:28 ` maskray [this message]
2022-05-24 21:58 ` H.J. Lu
2022-05-25 17:13   ` Wilco Dijkstra
2022-05-25 18:21     ` Florian Weimer
2022-05-25 20:44       ` H.J. Lu
2022-05-26 19:17         ` Wilco Dijkstra
2022-05-26 19:25           ` Florian Weimer
2022-05-26 20:03             ` Wilco Dijkstra
2022-05-26 21:27               ` H.J. Lu
2022-05-27 12:43               ` Florian Weimer
2022-05-31  2:03                 ` H.J. Lu
2022-05-31  7:49                   ` Fangrui Song
2022-05-31  9:42                     ` Wilco Dijkstra
2022-05-31 13:47                     ` H.J. Lu
2022-05-31  7:42               ` Fangrui Song
2022-05-25 20:10     ` maskray
  -- strict thread matches above, loose matches on Subject: below --
2022-05-01  6:06 [PATCH 0/3] Simplify ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA and revert aarch64/arm's extern protected data handling Fangrui Song
2022-05-01  6:06 ` [PATCH 2/3] Revert "[AArch64][BZ #17711] Fix extern protected data handling" Fangrui Song
2022-05-23 20:10   ` Szabolcs Nagy
2022-05-23 20:17     ` Fangrui Song
2022-05-24  5:13       ` Fangrui Song

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=20220524172828.7gawda2en7nx6zg3@google.com \
    --to=maskray@google.com \
    --cc=Szabolcs.Nagy@arm.com \
    --cc=Wilco.Dijkstra@arm.com \
    --cc=libc-alpha@sourceware.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).