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

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