public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/110729] New: -fpatchable-function-entries: __patchable_function_entries has wrong sh_link
@ 2023-07-19  6:20 i at maskray dot me
  2023-07-19  6:24 ` [Bug middle-end/110729] " pinskia at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: i at maskray dot me @ 2023-07-19  6:20 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 110729
           Summary: -fpatchable-function-entries:
                    __patchable_function_entries has wrong sh_link
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: i at maskray dot me
  Target Milestone: ---

Noticed by Ziwei Mao.

% cat a.c
void f() {}
void g() {}
void h() {}
% gcc -ffunction-sections -fpatchable-function-entry=2 -c a.c
% gcc -ffunction-sections -fpatchable-function-entry=2 -S a.c

a.o has .text.f, .text.g, and .text.h, but just one
__patchable_function_entries section.

% grep __patchable_function_entries a.s
        .section        __patchable_function_entries,"awo",@progbits,f
        .section        __patchable_function_entries,"awo",@progbits,f
        .section        __patchable_function_entries,"awo",@progbits,f

I think the second and the third __patchable_function_entries should reference
g and h, respectively. Otherwise, if f is discarded by ld --gc-sections, the
whole __patchable_function_entries (also used by g and h) will be discarded.
(Also, if g is discarded, its __patchable_function_entries fragment may be
retained if f is retained.)

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

* [Bug middle-end/110729] -fpatchable-function-entries: __patchable_function_entries has wrong sh_link
  2023-07-19  6:20 [Bug middle-end/110729] New: -fpatchable-function-entries: __patchable_function_entries has wrong sh_link i at maskray dot me
@ 2023-07-19  6:24 ` pinskia at gcc dot gnu.org
  2023-07-19  6:26 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-19  6:24 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |12.3.0
      Known to work|                            |13.1.0

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This was fixed in GCC 13:
f:
.LFB0:
        .cfi_startproc
        .section        __patchable_function_entries,"awo",@progbits,.LPFE0
        .align 8
        .quad   .LPFE0
        .section        .text.f
.LPFE0:
...
g:
.LFB1:
        .cfi_startproc
        .section        __patchable_function_entries,"awo",@progbits,.LPFE1
        .align 8
        .quad   .LPFE1
        .section        .text.g
.LPFE1:
...
h:
.LFB2:
        .cfi_startproc
        .section        __patchable_function_entries,"awo",@progbits,.LPFE2
        .align 8
        .quad   .LPFE2
        .section        .text.h
.LPFE2:

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

* [Bug middle-end/110729] -fpatchable-function-entries: __patchable_function_entries has wrong sh_link
  2023-07-19  6:20 [Bug middle-end/110729] New: -fpatchable-function-entries: __patchable_function_entries has wrong sh_link i at maskray dot me
  2023-07-19  6:24 ` [Bug middle-end/110729] " pinskia at gcc dot gnu.org
@ 2023-07-19  6:26 ` pinskia at gcc dot gnu.org
  2023-07-19  6:27 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-19  6:26 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=105169
         Resolution|---                         |DUPLICATE
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 105169.

*** This bug has been marked as a duplicate of bug 105169 ***

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

* [Bug middle-end/110729] -fpatchable-function-entries: __patchable_function_entries has wrong sh_link
  2023-07-19  6:20 [Bug middle-end/110729] New: -fpatchable-function-entries: __patchable_function_entries has wrong sh_link i at maskray dot me
  2023-07-19  6:24 ` [Bug middle-end/110729] " pinskia at gcc dot gnu.org
  2023-07-19  6:26 ` pinskia at gcc dot gnu.org
@ 2023-07-19  6:27 ` pinskia at gcc dot gnu.org
  2023-07-19  6:28 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-19  6:27 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|DUPLICATE                   |FIXED

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Actually maybe PR 99889 fixed it ...

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

* [Bug middle-end/110729] -fpatchable-function-entries: __patchable_function_entries has wrong sh_link
  2023-07-19  6:20 [Bug middle-end/110729] New: -fpatchable-function-entries: __patchable_function_entries has wrong sh_link i at maskray dot me
                   ` (2 preceding siblings ...)
  2023-07-19  6:27 ` pinskia at gcc dot gnu.org
@ 2023-07-19  6:28 ` pinskia at gcc dot gnu.org
  2023-07-21  5:18 ` cvs-commit at gcc dot gnu.org
  2023-07-21  5:49 ` linkw at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-19  6:28 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |13.0

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

* [Bug middle-end/110729] -fpatchable-function-entries: __patchable_function_entries has wrong sh_link
  2023-07-19  6:20 [Bug middle-end/110729] New: -fpatchable-function-entries: __patchable_function_entries has wrong sh_link i at maskray dot me
                   ` (3 preceding siblings ...)
  2023-07-19  6:28 ` pinskia at gcc dot gnu.org
@ 2023-07-21  5:18 ` cvs-commit at gcc dot gnu.org
  2023-07-21  5:49 ` linkw at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-07-21  5:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Kewen Lin <linkw@gcc.gnu.org>:

https://gcc.gnu.org/g:6894581ac453361e3fb4e1ffd54f9499acb87466

commit r14-2693-g6894581ac453361e3fb4e1ffd54f9499acb87466
Author: Kewen Lin <linkw@linux.ibm.com>
Date:   Fri Jul 21 00:16:29 2023 -0500

    testsuite: Add a test case for PR110729 [PR110729]

    As PR110729 reported, there was one issue for .section
    __patchable_function_entries with -ffunction-sections, that
    is we put the same symbol as link_to section symbol for all
    functions wrongly.  The commit r13-4294 for PR99889 has
    fixed this with the corresponding label LPFE* which sits in
    the function_section.

    As Fangrui suggested [1], this patch is to add a bit more
    test coverage.  I didn't find a good way to check all
    linked_to symbols are different, so I checked for LPFE[012].

    [1] https://gcc.gnu.org/pipermail/gcc-patches/2023-July/624866.html

            PR testsuite/110729

    gcc/testsuite/ChangeLog:

            * gcc.dg/pr110729.c: New test.

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

* [Bug middle-end/110729] -fpatchable-function-entries: __patchable_function_entries has wrong sh_link
  2023-07-19  6:20 [Bug middle-end/110729] New: -fpatchable-function-entries: __patchable_function_entries has wrong sh_link i at maskray dot me
                   ` (4 preceding siblings ...)
  2023-07-21  5:18 ` cvs-commit at gcc dot gnu.org
@ 2023-07-21  5:49 ` linkw at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: linkw at gcc dot gnu.org @ 2023-07-21  5:49 UTC (permalink / raw)
  To: gcc-bugs

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

Kewen Lin <linkw at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |linkw at gcc dot gnu.org
         Resolution|FIXED                       |DUPLICATE

--- Comment #5 from Kewen Lin <linkw at gcc dot gnu.org> ---


*** This bug has been marked as a duplicate of bug 99889 ***

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

end of thread, other threads:[~2023-07-21  5:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-19  6:20 [Bug middle-end/110729] New: -fpatchable-function-entries: __patchable_function_entries has wrong sh_link i at maskray dot me
2023-07-19  6:24 ` [Bug middle-end/110729] " pinskia at gcc dot gnu.org
2023-07-19  6:26 ` pinskia at gcc dot gnu.org
2023-07-19  6:27 ` pinskia at gcc dot gnu.org
2023-07-19  6:28 ` pinskia at gcc dot gnu.org
2023-07-21  5:18 ` cvs-commit at gcc dot gnu.org
2023-07-21  5:49 ` linkw 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).