* [Bug gcov-profile/114115] xz-utils segfaults when built with -fprofile-generate (bad interaction between IFUNC and binding?)
2024-02-26 14:10 [Bug gcov-profile/114115] New: xz-utils segfaults when built with -fprofile-generate (bad interaction between IFUNC and binding?) sjames at gcc dot gnu.org
@ 2024-02-26 14:11 ` sjames at gcc dot gnu.org
2024-02-26 14:13 ` sjames at gcc dot gnu.org
` (20 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: sjames at gcc dot gnu.org @ 2024-02-26 14:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114115
--- Comment #1 from Sam James <sjames at gcc dot gnu.org> ---
One of the xz developers, Jia Tan, has kindly minimised it to not need
BIND_NOW. I've adapted it a bit to cleanup flags and warnings.
I can reproduce it with the following, at least:
```
#!/bin/sh
gcc-14 -O2 -march=znver2 -fvisibility=hidden -fPIC -fprofile-update=atomic
-fprofile-dir=$(pwd) -fprofile-generate=$(pwd) -c test.c -o test.o -Wall
-Wextra
gcc-14 -o libapp.so test.o -shared -Wl,-z,now -fPIC -lgcov
gcc-14 -o app main.c -lgcov -L. -lapp
LD_LIBRARY_PATH=. ./app
```
main.c:
```
#include <stdio.h>
extern int func();
int main(void)
{
printf( "Hello world %p\n", func);
return 0;
}
```
test.c:
```
__attribute__((visibility("default")))
void *foo_ifunc2() __attribute__((ifunc("foo_resolver")));
__attribute__((visibility("default")))
void bar(void)
{
}
static int f3()
{
return 5;
}
__attribute__((visibility("default")))
void (*foo_resolver(void))(void)
{
f3();
return bar;
}
__attribute__((optimize("O0")))
__attribute__((visibility("default")))
int func()
{
foo_ifunc2();
return 0;
}
```
^ permalink raw reply [flat|nested] 23+ messages in thread
* [Bug gcov-profile/114115] xz-utils segfaults when built with -fprofile-generate (bad interaction between IFUNC and binding?)
2024-02-26 14:10 [Bug gcov-profile/114115] New: xz-utils segfaults when built with -fprofile-generate (bad interaction between IFUNC and binding?) sjames at gcc dot gnu.org
2024-02-26 14:11 ` [Bug gcov-profile/114115] " sjames at gcc dot gnu.org
@ 2024-02-26 14:13 ` sjames at gcc dot gnu.org
2024-02-26 14:13 ` sjames at gcc dot gnu.org
` (19 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: sjames at gcc dot gnu.org @ 2024-02-26 14:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114115
--- Comment #2 from Sam James <sjames at gcc dot gnu.org> ---
The reproducer succeeds for me with Clang 17.0.6, but fails for me with GCC
10..14.
^ permalink raw reply [flat|nested] 23+ messages in thread
* [Bug gcov-profile/114115] xz-utils segfaults when built with -fprofile-generate (bad interaction between IFUNC and binding?)
2024-02-26 14:10 [Bug gcov-profile/114115] New: xz-utils segfaults when built with -fprofile-generate (bad interaction between IFUNC and binding?) sjames at gcc dot gnu.org
2024-02-26 14:11 ` [Bug gcov-profile/114115] " sjames at gcc dot gnu.org
2024-02-26 14:13 ` sjames at gcc dot gnu.org
@ 2024-02-26 14:13 ` sjames at gcc dot gnu.org
2024-02-26 14:37 ` pinskia at gcc dot gnu.org
` (18 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: sjames at gcc dot gnu.org @ 2024-02-26 14:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114115
--- Comment #3 from Sam James <sjames at gcc dot gnu.org> ---
(In reply to Sam James from comment #1)
> One of the xz developers, Jia Tan, has kindly minimised it to not need
> BIND_NOW. I've adapted it a bit to cleanup flags and warnings.
(oops, sorry, this one does need it - we were discussing whether we could elide
it but didn't get there yet.)
^ permalink raw reply [flat|nested] 23+ messages in thread
* [Bug gcov-profile/114115] xz-utils segfaults when built with -fprofile-generate (bad interaction between IFUNC and binding?)
2024-02-26 14:10 [Bug gcov-profile/114115] New: xz-utils segfaults when built with -fprofile-generate (bad interaction between IFUNC and binding?) sjames at gcc dot gnu.org
` (2 preceding siblings ...)
2024-02-26 14:13 ` sjames at gcc dot gnu.org
@ 2024-02-26 14:37 ` pinskia at gcc dot gnu.org
2024-02-26 14:40 ` pinskia at gcc dot gnu.org
` (17 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-02-26 14:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114115
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
It is the use of TLS inside an ifunc resolver which seems like causing issues
...
^ permalink raw reply [flat|nested] 23+ messages in thread
* [Bug gcov-profile/114115] xz-utils segfaults when built with -fprofile-generate (bad interaction between IFUNC and binding?)
2024-02-26 14:10 [Bug gcov-profile/114115] New: xz-utils segfaults when built with -fprofile-generate (bad interaction between IFUNC and binding?) sjames at gcc dot gnu.org
` (3 preceding siblings ...)
2024-02-26 14:37 ` pinskia at gcc dot gnu.org
@ 2024-02-26 14:40 ` pinskia at gcc dot gnu.org
2024-02-26 14:52 ` rguenth at gcc dot gnu.org
` (16 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-02-26 14:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114115
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The obvious workaround is to mark the ifunc_resolver with
no_profile_instrument_function attribute since is only ever called once and
really does not need to be PGO'ed anyways.
^ permalink raw reply [flat|nested] 23+ messages in thread
* [Bug gcov-profile/114115] xz-utils segfaults when built with -fprofile-generate (bad interaction between IFUNC and binding?)
2024-02-26 14:10 [Bug gcov-profile/114115] New: xz-utils segfaults when built with -fprofile-generate (bad interaction between IFUNC and binding?) sjames at gcc dot gnu.org
` (4 preceding siblings ...)
2024-02-26 14:40 ` pinskia at gcc dot gnu.org
@ 2024-02-26 14:52 ` rguenth at gcc dot gnu.org
2024-02-26 16:17 ` hjl.tools at gmail dot com
` (15 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-02-26 14:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114115
--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
Maybe we can automatically consider that when handling the ifunc attribute?
^ permalink raw reply [flat|nested] 23+ messages in thread
* [Bug gcov-profile/114115] xz-utils segfaults when built with -fprofile-generate (bad interaction between IFUNC and binding?)
2024-02-26 14:10 [Bug gcov-profile/114115] New: xz-utils segfaults when built with -fprofile-generate (bad interaction between IFUNC and binding?) sjames at gcc dot gnu.org
` (5 preceding siblings ...)
2024-02-26 14:52 ` rguenth at gcc dot gnu.org
@ 2024-02-26 16:17 ` hjl.tools at gmail dot com
2024-02-26 16:23 ` hjl.tools at gmail dot com
` (14 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: hjl.tools at gmail dot com @ 2024-02-26 16:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114115
H.J. Lu <hjl.tools at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Ever confirmed|0 |1
Last reconfirmed| |2024-02-26
Target Milestone|--- |14.0
Assignee|unassigned at gcc dot gnu.org |hjl.tools at gmail dot com
^ permalink raw reply [flat|nested] 23+ messages in thread
* [Bug gcov-profile/114115] xz-utils segfaults when built with -fprofile-generate (bad interaction between IFUNC and binding?)
2024-02-26 14:10 [Bug gcov-profile/114115] New: xz-utils segfaults when built with -fprofile-generate (bad interaction between IFUNC and binding?) sjames at gcc dot gnu.org
` (6 preceding siblings ...)
2024-02-26 16:17 ` hjl.tools at gmail dot com
@ 2024-02-26 16:23 ` hjl.tools at gmail dot com
2024-02-26 22:54 ` hjl.tools at gmail dot com
` (13 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: hjl.tools at gmail dot com @ 2024-02-26 16:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114115
--- Comment #7 from H.J. Lu <hjl.tools at gmail dot com> ---
Created attachment 57544
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57544&action=edit
A patch
^ permalink raw reply [flat|nested] 23+ messages in thread
* [Bug gcov-profile/114115] xz-utils segfaults when built with -fprofile-generate (bad interaction between IFUNC and binding?)
2024-02-26 14:10 [Bug gcov-profile/114115] New: xz-utils segfaults when built with -fprofile-generate (bad interaction between IFUNC and binding?) sjames at gcc dot gnu.org
` (7 preceding siblings ...)
2024-02-26 16:23 ` hjl.tools at gmail dot com
@ 2024-02-26 22:54 ` hjl.tools at gmail dot com
2024-04-02 10:27 ` jasonwucj at gcc dot gnu.org
` (12 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: hjl.tools at gmail dot com @ 2024-02-26 22:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114115
--- Comment #8 from H.J. Lu <hjl.tools at gmail dot com> ---
A patch is posted at
https://patchwork.sourceware.org/project/gcc/list/?series=31343
^ permalink raw reply [flat|nested] 23+ messages in thread
* [Bug gcov-profile/114115] xz-utils segfaults when built with -fprofile-generate (bad interaction between IFUNC and binding?)
2024-02-26 14:10 [Bug gcov-profile/114115] New: xz-utils segfaults when built with -fprofile-generate (bad interaction between IFUNC and binding?) sjames at gcc dot gnu.org
` (8 preceding siblings ...)
2024-02-26 22:54 ` hjl.tools at gmail dot com
@ 2024-04-02 10:27 ` jasonwucj at gcc dot gnu.org
2024-04-02 10:30 ` sjames at gcc dot gnu.org
` (11 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: jasonwucj at gcc dot gnu.org @ 2024-04-02 10:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114115
--- Comment #9 from Chung-Ju Wu <jasonwucj at gcc dot gnu.org> ---
(In reply to Sam James from comment #1)
> One of the xz developers, Jia Tan, has kindly minimised it to not need
> BIND_NOW. I've adapted it a bit to cleanup flags and warnings.
>
CVE-2024-3094
Jia Tan is the one who injected backdoor in xz-5.6.0 and xz-5.6.1, which may be
the cause of the segfaults. I'm wondering if we still need a workaround for
this issue...
^ permalink raw reply [flat|nested] 23+ messages in thread
* [Bug gcov-profile/114115] xz-utils segfaults when built with -fprofile-generate (bad interaction between IFUNC and binding?)
2024-02-26 14:10 [Bug gcov-profile/114115] New: xz-utils segfaults when built with -fprofile-generate (bad interaction between IFUNC and binding?) sjames at gcc dot gnu.org
` (9 preceding siblings ...)
2024-04-02 10:27 ` jasonwucj at gcc dot gnu.org
@ 2024-04-02 10:30 ` sjames at gcc dot gnu.org
2024-04-02 10:35 ` sjames at gcc dot gnu.org
` (10 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: sjames at gcc dot gnu.org @ 2024-04-02 10:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114115
--- Comment #10 from Sam James <sjames at gcc dot gnu.org> ---
I'm aware, but there's a minimised test case attached here which shows this is
still somewhat of a problem by itself.
Either a better diagnostic is needed or to not instrument the resolver.
^ permalink raw reply [flat|nested] 23+ messages in thread
* [Bug gcov-profile/114115] xz-utils segfaults when built with -fprofile-generate (bad interaction between IFUNC and binding?)
2024-02-26 14:10 [Bug gcov-profile/114115] New: xz-utils segfaults when built with -fprofile-generate (bad interaction between IFUNC and binding?) sjames at gcc dot gnu.org
` (10 preceding siblings ...)
2024-04-02 10:30 ` sjames at gcc dot gnu.org
@ 2024-04-02 10:35 ` sjames at gcc dot gnu.org
2024-04-02 13:50 ` pinskia at gcc dot gnu.org
` (9 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: sjames at gcc dot gnu.org @ 2024-04-02 10:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114115
--- Comment #11 from Sam James <sjames at gcc dot gnu.org> ---
(In reply to Sam James from comment #10)
> I'm aware, but there's a minimised test case attached here which shows this
> is still somewhat of a problem by itself.
>
> Either a better diagnostic is needed or to not instrument the resolver.
s/better// (we don't emit any rn)
^ permalink raw reply [flat|nested] 23+ messages in thread
* [Bug gcov-profile/114115] xz-utils segfaults when built with -fprofile-generate (bad interaction between IFUNC and binding?)
2024-02-26 14:10 [Bug gcov-profile/114115] New: xz-utils segfaults when built with -fprofile-generate (bad interaction between IFUNC and binding?) sjames at gcc dot gnu.org
` (11 preceding siblings ...)
2024-04-02 10:35 ` sjames at gcc dot gnu.org
@ 2024-04-02 13:50 ` pinskia at gcc dot gnu.org
2024-04-03 14:07 ` cvs-commit at gcc dot gnu.org
` (8 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-02 13:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114115
--- Comment #12 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
For anyone reading this, -fprofile-generate with ifunc attributes should be
fixed and is not related to the xz backdoor. The issue will show up in valid
usage of ifuncs even ones which don't call external/non-inlined functions like
the example code. There is another bug already about the diagnosising the
calling of external functions so please don't file a new one. Also we don't
need any extra comments about the backdoor in the gcc bugzilla.
^ permalink raw reply [flat|nested] 23+ messages in thread
* [Bug gcov-profile/114115] xz-utils segfaults when built with -fprofile-generate (bad interaction between IFUNC and binding?)
2024-02-26 14:10 [Bug gcov-profile/114115] New: xz-utils segfaults when built with -fprofile-generate (bad interaction between IFUNC and binding?) sjames at gcc dot gnu.org
` (12 preceding siblings ...)
2024-04-02 13:50 ` pinskia at gcc dot gnu.org
@ 2024-04-03 14:07 ` cvs-commit at gcc dot gnu.org
2024-04-03 14:08 ` hjl.tools at gmail dot com
` (7 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-04-03 14:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114115
--- Comment #13 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by H.J. Lu <hjl@gcc.gnu.org>:
https://gcc.gnu.org/g:cab32bacaea268ec062b1fb4fc662d90c9d1cfce
commit r14-9775-gcab32bacaea268ec062b1fb4fc662d90c9d1cfce
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Mon Feb 26 08:38:58 2024 -0800
tree-profile: Disable indirect call profiling for IFUNC resolvers
We can't profile indirect calls to IFUNC resolvers nor their callees as
it requires TLS which hasn't been set up yet when the dynamic linker is
resolving IFUNC symbols.
Add an IFUNC resolver caller marker to cgraph_node and set it if the
function is called by an IFUNC resolver. Disable indirect call profiling
for IFUNC resolvers and their callees.
Tested with profiledbootstrap on Fedora 39/x86-64.
gcc/ChangeLog:
PR tree-optimization/114115
* cgraph.h (symtab_node): Add check_ifunc_callee_symtab_nodes.
(cgraph_node): Add called_by_ifunc_resolver.
* cgraphunit.cc (symbol_table::compile): Call
symtab_node::check_ifunc_callee_symtab_nodes.
* symtab.cc (check_ifunc_resolver): New.
(ifunc_ref_map): Likewise.
(is_caller_ifunc_resolver): Likewise.
(symtab_node::check_ifunc_callee_symtab_nodes): Likewise.
* tree-profile.cc (gimple_gen_ic_func_profiler): Disable indirect
call profiling for IFUNC resolvers and their callees.
gcc/testsuite/ChangeLog:
PR tree-optimization/114115
* gcc.dg/pr114115.c: New test.
^ permalink raw reply [flat|nested] 23+ messages in thread
* [Bug gcov-profile/114115] xz-utils segfaults when built with -fprofile-generate (bad interaction between IFUNC and binding?)
2024-02-26 14:10 [Bug gcov-profile/114115] New: xz-utils segfaults when built with -fprofile-generate (bad interaction between IFUNC and binding?) sjames at gcc dot gnu.org
` (13 preceding siblings ...)
2024-04-03 14:07 ` cvs-commit at gcc dot gnu.org
@ 2024-04-03 14:08 ` hjl.tools at gmail dot com
2024-04-03 14:10 ` hubicka at ucw dot cz
` (6 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: hjl.tools at gmail dot com @ 2024-04-03 14:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114115
H.J. Lu <hjl.tools at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to work| |14.0
--- Comment #14 from H.J. Lu <hjl.tools at gmail dot com> ---
Fixed for GCC 14 so far
^ permalink raw reply [flat|nested] 23+ messages in thread
* [Bug gcov-profile/114115] xz-utils segfaults when built with -fprofile-generate (bad interaction between IFUNC and binding?)
2024-02-26 14:10 [Bug gcov-profile/114115] New: xz-utils segfaults when built with -fprofile-generate (bad interaction between IFUNC and binding?) sjames at gcc dot gnu.org
` (14 preceding siblings ...)
2024-04-03 14:08 ` hjl.tools at gmail dot com
@ 2024-04-03 14:10 ` hubicka at ucw dot cz
2024-04-05 9:13 ` cvs-commit at gcc dot gnu.org
` (5 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: hubicka at ucw dot cz @ 2024-04-03 14:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114115
--- Comment #15 from Jan Hubicka <hubicka at ucw dot cz> ---
> Fixed for GCC 14 so far
It is simple patch, so backporting is OK after a week in mainline.
^ permalink raw reply [flat|nested] 23+ messages in thread
* [Bug gcov-profile/114115] xz-utils segfaults when built with -fprofile-generate (bad interaction between IFUNC and binding?)
2024-02-26 14:10 [Bug gcov-profile/114115] New: xz-utils segfaults when built with -fprofile-generate (bad interaction between IFUNC and binding?) sjames at gcc dot gnu.org
` (15 preceding siblings ...)
2024-04-03 14:10 ` hubicka at ucw dot cz
@ 2024-04-05 9:13 ` cvs-commit at gcc dot gnu.org
2024-04-14 19:59 ` hjl.tools at gmail dot com
` (4 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-04-05 9:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114115
--- Comment #16 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:
https://gcc.gnu.org/g:9ab8fdfeef5b1a47b358e08a98177b2fad65fed9
commit r14-9803-g9ab8fdfeef5b1a47b358e08a98177b2fad65fed9
Author: Richard Biener <rguenther@suse.de>
Date: Fri Apr 5 10:16:41 2024 +0200
middle-end/114599 - fix bitmap allocation for
check_ifunc_callee_symtab_nodes
There's no default bitmap obstack during global CTORs, so allocate the
bitmap locally.
PR middle-end/114599
PR gcov-profile/114115
* symtab.cc (ifunc_ref_map): Do not use auto_bitmap.
(is_caller_ifunc_resolver): Optimize bitmap_bit_p/bitmap_set_bit
pair.
(symtab_node::check_ifunc_callee_symtab_nodes): Properly
allocate ifunc_ref_map here.
^ permalink raw reply [flat|nested] 23+ messages in thread
* [Bug gcov-profile/114115] xz-utils segfaults when built with -fprofile-generate (bad interaction between IFUNC and binding?)
2024-02-26 14:10 [Bug gcov-profile/114115] New: xz-utils segfaults when built with -fprofile-generate (bad interaction between IFUNC and binding?) sjames at gcc dot gnu.org
` (16 preceding siblings ...)
2024-04-05 9:13 ` cvs-commit at gcc dot gnu.org
@ 2024-04-14 19:59 ` hjl.tools at gmail dot com
2024-04-15 11:23 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: hjl.tools at gmail dot com @ 2024-04-14 19:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114115
--- Comment #17 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Jan Hubicka from comment #15)
> > Fixed for GCC 14 so far
> It is simple patch, so backporting is OK after a week in mainline.
These are patches which I am backporting:
https://patchwork.sourceware.org/project/gcc/list/?series=32823
^ permalink raw reply [flat|nested] 23+ messages in thread
* [Bug gcov-profile/114115] xz-utils segfaults when built with -fprofile-generate (bad interaction between IFUNC and binding?)
2024-02-26 14:10 [Bug gcov-profile/114115] New: xz-utils segfaults when built with -fprofile-generate (bad interaction between IFUNC and binding?) sjames at gcc dot gnu.org
` (17 preceding siblings ...)
2024-04-14 19:59 ` hjl.tools at gmail dot com
@ 2024-04-15 11:23 ` cvs-commit at gcc dot gnu.org
2024-04-15 11:26 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-04-15 11:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114115
--- Comment #18 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by H.J. Lu <hjl@gcc.gnu.org>:
https://gcc.gnu.org/g:abe3a80aa2d6d53cc9b8c9f7c531e065451d5b6e
commit r13-8606-gabe3a80aa2d6d53cc9b8c9f7c531e065451d5b6e
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Sun Apr 14 12:57:39 2024 -0700
tree-profile: Disable indirect call profiling for IFUNC resolvers
We can't profile indirect calls to IFUNC resolvers nor their callees as
it requires TLS which hasn't been set up yet when the dynamic linker is
resolving IFUNC symbols.
Add an IFUNC resolver caller marker to cgraph_node and set it if the
function is called by an IFUNC resolver. Disable indirect call profiling
for IFUNC resolvers and their callees.
Tested with profiledbootstrap on Fedora 39/x86-64.
gcc/ChangeLog:
PR tree-optimization/114115
* cgraph.h (symtab_node): Add check_ifunc_callee_symtab_nodes.
(cgraph_node): Add called_by_ifunc_resolver.
* cgraphunit.cc (symbol_table::compile): Call
symtab_node::check_ifunc_callee_symtab_nodes.
* symtab.cc (check_ifunc_resolver): New.
(ifunc_ref_map): Likewise.
(is_caller_ifunc_resolver): Likewise.
(symtab_node::check_ifunc_callee_symtab_nodes): Likewise.
* tree-profile.cc (gimple_gen_ic_func_profiler): Disable indirect
call profiling for IFUNC resolvers and their callees.
gcc/testsuite/ChangeLog:
PR tree-optimization/114115
* gcc.dg/pr114115.c: New test.
(cherry picked from commit cab32bacaea268ec062b1fb4fc662d90c9d1cfce)
^ permalink raw reply [flat|nested] 23+ messages in thread
* [Bug gcov-profile/114115] xz-utils segfaults when built with -fprofile-generate (bad interaction between IFUNC and binding?)
2024-02-26 14:10 [Bug gcov-profile/114115] New: xz-utils segfaults when built with -fprofile-generate (bad interaction between IFUNC and binding?) sjames at gcc dot gnu.org
` (18 preceding siblings ...)
2024-04-15 11:23 ` cvs-commit at gcc dot gnu.org
@ 2024-04-15 11:26 ` cvs-commit at gcc dot gnu.org
2024-04-15 11:29 ` cvs-commit at gcc dot gnu.org
2024-04-15 11:30 ` hjl.tools at gmail dot com
21 siblings, 0 replies; 23+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-04-15 11:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114115
--- Comment #19 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by H.J. Lu <hjl@gcc.gnu.org>:
https://gcc.gnu.org/g:23049e851ebf840dffdd3f062dba0e795be347f8
commit r12-10331-g23049e851ebf840dffdd3f062dba0e795be347f8
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Mon Feb 26 08:38:58 2024 -0800
tree-profile: Disable indirect call profiling for IFUNC resolvers
We can't profile indirect calls to IFUNC resolvers nor their callees as
it requires TLS which hasn't been set up yet when the dynamic linker is
resolving IFUNC symbols.
Add an IFUNC resolver caller marker to cgraph_node and set it if the
function is called by an IFUNC resolver. Disable indirect call profiling
for IFUNC resolvers and their callees.
Tested with profiledbootstrap on Fedora 39/x86-64.
gcc/ChangeLog:
PR tree-optimization/114115
* cgraph.h (symtab_node): Add check_ifunc_callee_symtab_nodes.
(cgraph_node): Add called_by_ifunc_resolver.
* cgraphunit.cc (symbol_table::compile): Call
symtab_node::check_ifunc_callee_symtab_nodes.
* symtab.cc (check_ifunc_resolver): New.
(ifunc_ref_map): Likewise.
(is_caller_ifunc_resolver): Likewise.
(symtab_node::check_ifunc_callee_symtab_nodes): Likewise.
* tree-profile.cc (gimple_gen_ic_func_profiler): Disable indirect
call profiling for IFUNC resolvers and their callees.
gcc/testsuite/ChangeLog:
PR tree-optimization/114115
* gcc.dg/pr114115.c: New test.
(cherry picked from commit cab32bacaea268ec062b1fb4fc662d90c9d1cfce)
^ permalink raw reply [flat|nested] 23+ messages in thread
* [Bug gcov-profile/114115] xz-utils segfaults when built with -fprofile-generate (bad interaction between IFUNC and binding?)
2024-02-26 14:10 [Bug gcov-profile/114115] New: xz-utils segfaults when built with -fprofile-generate (bad interaction between IFUNC and binding?) sjames at gcc dot gnu.org
` (19 preceding siblings ...)
2024-04-15 11:26 ` cvs-commit at gcc dot gnu.org
@ 2024-04-15 11:29 ` cvs-commit at gcc dot gnu.org
2024-04-15 11:30 ` hjl.tools at gmail dot com
21 siblings, 0 replies; 23+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-04-15 11:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114115
--- Comment #20 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by H.J. Lu <hjl@gcc.gnu.org>:
https://gcc.gnu.org/g:574d52a9b6e40a466b90f4810e72d3dd072d5160
commit r11-11321-g574d52a9b6e40a466b90f4810e72d3dd072d5160
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Mon Feb 26 08:38:58 2024 -0800
tree-profile: Disable indirect call profiling for IFUNC resolvers
We can't profile indirect calls to IFUNC resolvers nor their callees as
it requires TLS which hasn't been set up yet when the dynamic linker is
resolving IFUNC symbols.
Add an IFUNC resolver caller marker to cgraph_node and set it if the
function is called by an IFUNC resolver. Disable indirect call profiling
for IFUNC resolvers and their callees.
Tested with profiledbootstrap on Fedora 39/x86-64.
gcc/ChangeLog:
PR tree-optimization/114115
* cgraph.h (symtab_node): Add check_ifunc_callee_symtab_nodes.
(cgraph_node): Add called_by_ifunc_resolver.
* cgraphunit.c (symbol_table::compile): Call
symtab_node::check_ifunc_callee_symtab_nodes.
* symtab.c (check_ifunc_resolver): New.
(ifunc_ref_map): Likewise.
(is_caller_ifunc_resolver): Likewise.
(symtab_node::check_ifunc_callee_symtab_nodes): Likewise.
* tree-profile.c (gimple_gen_ic_func_profiler): Disable indirect
call profiling for IFUNC resolvers and their callees.
gcc/testsuite/ChangeLog:
PR tree-optimization/114115
* gcc.dg/pr114115.c: New test.
(cherry picked from commit cab32bacaea268ec062b1fb4fc662d90c9d1cfce)
^ permalink raw reply [flat|nested] 23+ messages in thread
* [Bug gcov-profile/114115] xz-utils segfaults when built with -fprofile-generate (bad interaction between IFUNC and binding?)
2024-02-26 14:10 [Bug gcov-profile/114115] New: xz-utils segfaults when built with -fprofile-generate (bad interaction between IFUNC and binding?) sjames at gcc dot gnu.org
` (20 preceding siblings ...)
2024-04-15 11:29 ` cvs-commit at gcc dot gnu.org
@ 2024-04-15 11:30 ` hjl.tools at gmail dot com
21 siblings, 0 replies; 23+ messages in thread
From: hjl.tools at gmail dot com @ 2024-04-15 11:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114115
H.J. Lu <hjl.tools at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #21 from H.J. Lu <hjl.tools at gmail dot com> ---
Fixed for GCC 14 and GCC 11/12/13 release branches.
^ permalink raw reply [flat|nested] 23+ messages in thread