public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/100618] New: Add a -fno-semantic-interposition variant which allows variable interposition
@ 2021-05-15 20:53 i at maskray dot me
  2021-05-15 21:10 ` [Bug c/100618] " i at maskray dot me
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: i at maskray dot me @ 2021-05-15 20:53 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100618
           Summary: Add a -fno-semantic-interposition variant which allows
                    variable interposition
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: i at maskray dot me
  Target Milestone: ---

Extracted from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100483

The documentation says -fno-semantic-interposition applies to variables.

Having an option which only apply to external linkage function definitions will
be useful. Assuming no-variable-interposition is unfortunately incompatible
with the plethora of copy relocations: -fno-pic emits direct access relocations
referencing a global variable. If the global variable turns out to be defined
in a shared object, there will be a copy relocation in the executable. The
object the shared object sees and the executable sees will be different.

See
https://maskray.me/blog/2021-05-16-elf-interposition-and-bsymbolic#the-last-alliance-of-elf-and-men
for more context.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/100618] Add a -fno-semantic-interposition variant which allows variable interposition
  2021-05-15 20:53 [Bug c/100618] New: Add a -fno-semantic-interposition variant which allows variable interposition i at maskray dot me
@ 2021-05-15 21:10 ` i at maskray dot me
  2021-05-16  8:32 ` amonakov at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: i at maskray dot me @ 2021-05-15 21:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Fangrui Song <i at maskray dot me> ---
Perhaps

-fsemantic-interposition=function,variable (default -fpic/-fPIC)
-fsemantic-interposition=variable   (compatible with copy relocations but
enable function optimizations)
-fsemantic-interposition=  (alias: -fno-semantic-interposition)

?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/100618] Add a -fno-semantic-interposition variant which allows variable interposition
  2021-05-15 20:53 [Bug c/100618] New: Add a -fno-semantic-interposition variant which allows variable interposition i at maskray dot me
  2021-05-15 21:10 ` [Bug c/100618] " i at maskray dot me
@ 2021-05-16  8:32 ` amonakov at gcc dot gnu.org
  2021-05-16 12:21 ` amonakov at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: amonakov at gcc dot gnu.org @ 2021-05-16  8:32 UTC (permalink / raw)
  To: gcc-bugs

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

Alexander Monakov <amonakov at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |amonakov at gcc dot gnu.org

--- Comment #2 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
The implied split is 'code,data,tls-data' rather than 'functions,variables'
(there are constants too, which are not variables, but should be treated like
variables here; and TLS data does not rely on copy relocations).

Since the original option was intended to be used mainly in the negative form,
I think it may be less confusing to introduce

-f[no-]semantic-code-interposition

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/100618] Add a -fno-semantic-interposition variant which allows variable interposition
  2021-05-15 20:53 [Bug c/100618] New: Add a -fno-semantic-interposition variant which allows variable interposition i at maskray dot me
  2021-05-15 21:10 ` [Bug c/100618] " i at maskray dot me
  2021-05-16  8:32 ` amonakov at gcc dot gnu.org
@ 2021-05-16 12:21 ` amonakov at gcc dot gnu.org
  2021-06-04 18:00 ` i at maskray dot me
  2021-06-18 13:18 ` redi at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: amonakov at gcc dot gnu.org @ 2021-05-16 12:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
Furthermore as discussed in bug 100483 this request appears based on a
misunderstanding what the 'semantic-' part of the option is about. It does not
affect assembly/linker-level binding mechanism, so things like presence of copy
relocations should not be affected.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/100618] Add a -fno-semantic-interposition variant which allows variable interposition
  2021-05-15 20:53 [Bug c/100618] New: Add a -fno-semantic-interposition variant which allows variable interposition i at maskray dot me
                   ` (2 preceding siblings ...)
  2021-05-16 12:21 ` amonakov at gcc dot gnu.org
@ 2021-06-04 18:00 ` i at maskray dot me
  2021-06-18 13:18 ` redi at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: i at maskray dot me @ 2021-06-04 18:00 UTC (permalink / raw)
  To: gcc-bugs

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

Fangrui Song <i at maskray dot me> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #4 from Fangrui Song <i at maskray dot me> ---
Clang 13  -fno-semantic-interposition will be mostly consistent with GCC 
-fno-semantic-interposition. It looked like a misunderstand from my side.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/100618] Add a -fno-semantic-interposition variant which allows variable interposition
  2021-05-15 20:53 [Bug c/100618] New: Add a -fno-semantic-interposition variant which allows variable interposition i at maskray dot me
                   ` (3 preceding siblings ...)
  2021-06-04 18:00 ` i at maskray dot me
@ 2021-06-18 13:18 ` redi at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2021-06-18 13:18 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|FIXED                       |WORKSFORME

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-06-18 13:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-15 20:53 [Bug c/100618] New: Add a -fno-semantic-interposition variant which allows variable interposition i at maskray dot me
2021-05-15 21:10 ` [Bug c/100618] " i at maskray dot me
2021-05-16  8:32 ` amonakov at gcc dot gnu.org
2021-05-16 12:21 ` amonakov at gcc dot gnu.org
2021-06-04 18:00 ` i at maskray dot me
2021-06-18 13:18 ` redi at gcc dot gnu.org

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).