public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/110066] New: [RISC-V] Segment fault if compiled with -static -pg
@ 2023-05-31 20:36 i at rvalue dot moe
  2023-05-31 20:39 ` [Bug target/110066] " pinskia at gcc dot gnu.org
                   ` (27 more replies)
  0 siblings, 28 replies; 29+ messages in thread
From: i at rvalue dot moe @ 2023-05-31 20:36 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 110066
           Summary: [RISC-V] Segment fault if compiled with -static -pg
           Product: gcc
           Version: 13.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: i at rvalue dot moe
  Target Milestone: ---

When compile the code with option -static and -pg, the compiled program will
fail with segfault before entering main().

Reproduce:

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/riscv64-unknown-linux-gnu/13.1.1/lto-wrapper
Target: riscv64-unknown-linux-gnu
Configured with: /build/gcc/src/gcc/configure
--enable-languages=c,c++,d,fortran,go,lto,objc,obj-c++ --enable-bootstrap
--prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/
--with-build-config=bootstrap-lto --with-linker-hash-style=gnu
--with-system-zlib --enable-__cxa_atexit --enable-cet=auto
--enable-checking=release --enable-clocale=gnu --enable-default-pie
--enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object
--enable-libstdcxx-backtrace --enable-link-serialization=1
--enable-linker-build-id --enable-lto --enable-plugin --enable-shared
--enable-threads=posix --disable-libssp --disable-libstdcxx-pch
--disable-multilib --disable-werror
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.1.1 20230429 (GCC)
$ cat > test.c
int main(){}
$ gcc test.c -o test -static -pg
$ ./test
Segmentation fault (core dumped)

gdb backtrace:
#0 classify_object_over_fdes ()
#1 __register_frame_info ()
#2 frame_dummy ()
#3 __libc_start_main_impl ()
#4 _start ()

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

* [Bug target/110066] [RISC-V] Segment fault if compiled with -static -pg
  2023-05-31 20:36 [Bug target/110066] New: [RISC-V] Segment fault if compiled with -static -pg i at rvalue dot moe
@ 2023-05-31 20:39 ` pinskia at gcc dot gnu.org
  2023-05-31 21:00 ` schwab@linux-m68k.org
                   ` (26 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-31 20:39 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |riscv64-unknown-linux-gnu

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This also could be a glibc issue.

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

* [Bug target/110066] [RISC-V] Segment fault if compiled with -static -pg
  2023-05-31 20:36 [Bug target/110066] New: [RISC-V] Segment fault if compiled with -static -pg i at rvalue dot moe
  2023-05-31 20:39 ` [Bug target/110066] " pinskia at gcc dot gnu.org
@ 2023-05-31 21:00 ` schwab@linux-m68k.org
  2023-05-31 22:35 ` i at rvalue dot moe
                   ` (25 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: schwab@linux-m68k.org @ 2023-05-31 21:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andreas Schwab <schwab@linux-m68k.org> ---
I cannot reproduce that with glibc 2.37 and binutils 2.40 on openSUSE.  I've
also tried with -profile which links against -lc_p, no issue either.

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

* [Bug target/110066] [RISC-V] Segment fault if compiled with -static -pg
  2023-05-31 20:36 [Bug target/110066] New: [RISC-V] Segment fault if compiled with -static -pg i at rvalue dot moe
  2023-05-31 20:39 ` [Bug target/110066] " pinskia at gcc dot gnu.org
  2023-05-31 21:00 ` schwab@linux-m68k.org
@ 2023-05-31 22:35 ` i at rvalue dot moe
  2023-07-21 16:21 ` aurelien at aurel32 dot net
                   ` (24 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: i at rvalue dot moe @ 2023-05-31 22:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from rvalue <i at rvalue dot moe> ---
(In reply to Andrew Pinski from comment #1)
> This also could be a glibc issue.

I tried gcc 12.2.1 and 13.1.1 with exactly the same glibc and binutils
environments, the 12.2.1 version works while 13.1.1 doesn't. So I decide to
report it here.

Further analysis found that the identifier __EH_FRAME_BEGIN__ is different from
the address of .eh_frame section by 0x10, which is unexpected. I suspect the
linker might fail but that didn't change between the two runs.

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

* [Bug target/110066] [RISC-V] Segment fault if compiled with -static -pg
  2023-05-31 20:36 [Bug target/110066] New: [RISC-V] Segment fault if compiled with -static -pg i at rvalue dot moe
                   ` (2 preceding siblings ...)
  2023-05-31 22:35 ` i at rvalue dot moe
@ 2023-07-21 16:21 ` aurelien at aurel32 dot net
  2023-07-22  5:16 ` pinskia at gcc dot gnu.org
                   ` (23 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: aurelien at aurel32 dot net @ 2023-07-21 16:21 UTC (permalink / raw)
  To: gcc-bugs

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

Aurelien Jarno <aurelien at aurel32 dot net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aurelien at aurel32 dot net

--- Comment #4 from Aurelien Jarno <aurelien at aurel32 dot net> ---
This is also reproducible with the tst-gmon-static test from glibc 2.38, when
compiled with GCC 13, while the test passes fine with GCC 12.

A very basic debugging shows that the problem is triggered by using crtbeginT.o
from GCC 13. The test passes when compiling everything with GCC 13, but using
crtbeginT.o from GCC 12.

The backtrace is the following:

Program received signal SIGSEGV, Segmentation fault.
0x00000000000516e2 in classify_object_over_fdes ()
(gdb) bt
#0  0x00000000000516e2 in classify_object_over_fdes ()
#1  0x0000000000052690 in __register_frame_info ()
#2  0x0000000000010570 in frame_dummy ()
#3  0x0000000000010872 in call_init (envp=0x3ffffff3e0, argv=0x3ffffff3c8,
argc=2) at libc-start.c:189
#4  __libc_start_main_impl (main=0x10448 <main>, argc=2, argv=0x3ffffff3c8,
init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>,
stack_end=<optimized out>) at libc-start.c:355
#5  0x0000000000010488 in _start () at ../sysdeps/riscv/start.S:61

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

* [Bug target/110066] [RISC-V] Segment fault if compiled with -static -pg
  2023-05-31 20:36 [Bug target/110066] New: [RISC-V] Segment fault if compiled with -static -pg i at rvalue dot moe
                   ` (3 preceding siblings ...)
  2023-07-21 16:21 ` aurelien at aurel32 dot net
@ 2023-07-22  5:16 ` pinskia at gcc dot gnu.org
  2023-07-22  5:18 ` pinskia at gcc dot gnu.org
                   ` (22 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-22  5:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Can you try reverting r13-923-g2d546ff69455f7deadab and try GCC 13 again?

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

* [Bug target/110066] [RISC-V] Segment fault if compiled with -static -pg
  2023-05-31 20:36 [Bug target/110066] New: [RISC-V] Segment fault if compiled with -static -pg i at rvalue dot moe
                   ` (4 preceding siblings ...)
  2023-07-22  5:16 ` pinskia at gcc dot gnu.org
@ 2023-07-22  5:18 ` pinskia at gcc dot gnu.org
  2023-07-22  8:46 ` aurelien at aurel32 dot net
                   ` (21 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-22  5:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #5)
> Can you try reverting r13-923-g2d546ff69455f7deadab and try GCC 13 again?

That looks like the only thing that changed between GCC 12 and GCC 13 for
crtbeginT.o .

Also can you attach the two versions of crtbeginT.o (the one from GCC 12 and
one from GCC 13).
If anything there has to be some extra null pointer happening ...

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

* [Bug target/110066] [RISC-V] Segment fault if compiled with -static -pg
  2023-05-31 20:36 [Bug target/110066] New: [RISC-V] Segment fault if compiled with -static -pg i at rvalue dot moe
                   ` (5 preceding siblings ...)
  2023-07-22  5:18 ` pinskia at gcc dot gnu.org
@ 2023-07-22  8:46 ` aurelien at aurel32 dot net
  2023-07-22  8:46 ` aurelien at aurel32 dot net
                   ` (20 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: aurelien at aurel32 dot net @ 2023-07-22  8:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Aurelien Jarno <aurelien at aurel32 dot net> ---
Created attachment 55609
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55609&action=edit
crtbeginT.o GCC 12 version

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

* [Bug target/110066] [RISC-V] Segment fault if compiled with -static -pg
  2023-05-31 20:36 [Bug target/110066] New: [RISC-V] Segment fault if compiled with -static -pg i at rvalue dot moe
                   ` (6 preceding siblings ...)
  2023-07-22  8:46 ` aurelien at aurel32 dot net
@ 2023-07-22  8:46 ` aurelien at aurel32 dot net
  2023-07-22  8:47 ` aurelien at aurel32 dot net
                   ` (19 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: aurelien at aurel32 dot net @ 2023-07-22  8:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Aurelien Jarno <aurelien at aurel32 dot net> ---
Created attachment 55610
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55610&action=edit
crtbeginT.o GCC 12 version

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

* [Bug target/110066] [RISC-V] Segment fault if compiled with -static -pg
  2023-05-31 20:36 [Bug target/110066] New: [RISC-V] Segment fault if compiled with -static -pg i at rvalue dot moe
                   ` (7 preceding siblings ...)
  2023-07-22  8:46 ` aurelien at aurel32 dot net
@ 2023-07-22  8:47 ` aurelien at aurel32 dot net
  2023-07-22 12:37 ` aurelien at aurel32 dot net
                   ` (18 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: aurelien at aurel32 dot net @ 2023-07-22  8:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Aurelien Jarno <aurelien at aurel32 dot net> ---
(In reply to Andrew Pinski from comment #5)
> Can you try reverting r13-923-g2d546ff69455f7deadab and try GCC 13 again?

Yep, I'll do that, but it will probably take some time to get the results.

(In reply to Andrew Pinski from comment #6)
> Also can you attach the two versions of crtbeginT.o (the one from GCC 12 and
> one from GCC 13).
> If anything there has to be some extra null pointer happening ...

I have just done that.

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

* [Bug target/110066] [RISC-V] Segment fault if compiled with -static -pg
  2023-05-31 20:36 [Bug target/110066] New: [RISC-V] Segment fault if compiled with -static -pg i at rvalue dot moe
                   ` (8 preceding siblings ...)
  2023-07-22  8:47 ` aurelien at aurel32 dot net
@ 2023-07-22 12:37 ` aurelien at aurel32 dot net
  2023-07-22 14:50 ` aurelien at aurel32 dot net
                   ` (17 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: aurelien at aurel32 dot net @ 2023-07-22 12:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Aurelien Jarno <aurelien at aurel32 dot net> ---
(In reply to Aurelien Jarno from comment #9)
> (In reply to Andrew Pinski from comment #5)
> > Can you try reverting r13-923-g2d546ff69455f7deadab and try GCC 13 again?
> 
> Yep, I'll do that, but it will probably take some time to get the results.
>

I built a cross-compiler so it went faster than expected. However reverting
that commit doesn't change anything, the generated crtbeginT.o is unchanged, so
the issue is still there.

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

* [Bug target/110066] [RISC-V] Segment fault if compiled with -static -pg
  2023-05-31 20:36 [Bug target/110066] New: [RISC-V] Segment fault if compiled with -static -pg i at rvalue dot moe
                   ` (9 preceding siblings ...)
  2023-07-22 12:37 ` aurelien at aurel32 dot net
@ 2023-07-22 14:50 ` aurelien at aurel32 dot net
  2023-07-22 15:30 ` aurelien at aurel32 dot net
                   ` (16 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: aurelien at aurel32 dot net @ 2023-07-22 14:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from Aurelien Jarno <aurelien at aurel32 dot net> ---
I have bisected the issue, and I found it has been introduced by the following
commit:

commit 3cd08f7168c196d7a481b9ed9f4289fd1f14eea8
Author: Andreas Schwab <schwab@suse.de>
Date:   Wed Jan 25 12:00:09 2023 +0100

    riscv: Enable -fasynchronous-unwind-tables by default on Linux

    This follows the example of aarch64.

    gcc/:
            * common/config/riscv/riscv-common.cc
            (riscv_option_optimization_table)
            [TARGET_DEFAULT_ASYNC_UNWIND_TABLES]: Enable
            -fasynchronous-unwind-tables and -funwind-tables.
            * config.gcc (riscv*-*-linux*): Define
            TARGET_DEFAULT_ASYNC_UNWIND_TABLES.

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

* [Bug target/110066] [RISC-V] Segment fault if compiled with -static -pg
  2023-05-31 20:36 [Bug target/110066] New: [RISC-V] Segment fault if compiled with -static -pg i at rvalue dot moe
                   ` (10 preceding siblings ...)
  2023-07-22 14:50 ` aurelien at aurel32 dot net
@ 2023-07-22 15:30 ` aurelien at aurel32 dot net
  2023-07-22 15:53 ` [Bug target/110066] [13/14 Regression] " pinskia at gcc dot gnu.org
                   ` (15 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: aurelien at aurel32 dot net @ 2023-07-22 15:30 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from Aurelien Jarno <aurelien at aurel32 dot net> ---
Backtrace with debug symbols in libgcc_eh.a:

Program received signal SIGSEGV, Segmentation fault.
classify_object_over_fdes (ob=0xe2da0 <object>, this_fde=0x1000530e6,
range=0x3ffffff310) at ../../../gcc/libgcc/unwind-dw2-fde.c:727
727     ../../../gcc/libgcc/unwind-dw2-fde.c: No such file or directory.
(gdb) bt full
#0  classify_object_over_fdes (ob=0xe2da0 <object>, this_fde=0x1000530e6,
range=0x3ffffff310) at ../../../gcc/libgcc/unwind-dw2-fde.c:727
        last_cie = 0x8a43a
        count = 1
        encoding = 0
        base = 0
#1  0x000000000005277c in __register_frame_info_bases (dbase=0x0, tbase=0x0,
ob=0xe2da0 <object>, begin=<optimized out>) at
../../../gcc/libgcc/unwind-dw2-fde.c:129
        range = {4294854026, 4294854042}
        range = <optimized out>
#2  __register_frame_info_bases (dbase=0x0, tbase=0x0, ob=0xe2da0 <object>,
begin=<optimized out>) at ../../../gcc/libgcc/unwind-dw2-fde.c:109
        range = <optimized out>
        range = <optimized out>
#3  __register_frame_info (begin=<optimized out>, ob=0xe2da0 <object>) at
../../../gcc/libgcc/unwind-dw2-fde.c:145
No locals.
#4  0x0000000000010728 in frame_dummy ()
No symbol table info available.
#5  0x0000000000010a2a in call_init (envp=0x3ffffff3d0, argv=0x3ffffff3b8,
argc=2) at libc-start.c:189
        i = 0
        size = <optimized out>
        size = <optimized out>
        size = <optimized out>
        i = <optimized out>
        i = <optimized out>
#6  __libc_start_main_impl (main=0x105f8 <main>, argc=2, argv=0x3ffffff3b8,
init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>,
stack_end=<optimized out>)
    at libc-start.c:355
        ev = 0x3ffffff3d0
        auxvec = <optimized out>
        stack_chk_guard = <optimized out>
        pointer_chk_guard = <optimized out>
#7  0x0000000000010638 in _start () at ../sysdeps/riscv/start.S:61

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

* [Bug target/110066] [13/14 Regression] [RISC-V] Segment fault if compiled with -static -pg
  2023-05-31 20:36 [Bug target/110066] New: [RISC-V] Segment fault if compiled with -static -pg i at rvalue dot moe
                   ` (11 preceding siblings ...)
  2023-07-22 15:30 ` aurelien at aurel32 dot net
@ 2023-07-22 15:53 ` pinskia at gcc dot gnu.org
  2023-07-22 15:56 ` pinskia at gcc dot gnu.org
                   ` (14 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-22 15:53 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
            Summary|[RISC-V] Segment fault if   |[13/14 Regression] [RISC-V]
                   |compiled with -static -pg   |Segment fault if compiled
                   |                            |with -static -pg
   Target Milestone|---                         |13.2
           Keywords|                            |EH, wrong-code
   Last reconfirmed|                            |2023-07-22
             Status|UNCONFIRMED                 |NEW

--- Comment #13 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed. I will be adding a patch for someone to test out ...

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

* [Bug target/110066] [13/14 Regression] [RISC-V] Segment fault if compiled with -static -pg
  2023-05-31 20:36 [Bug target/110066] New: [RISC-V] Segment fault if compiled with -static -pg i at rvalue dot moe
                   ` (12 preceding siblings ...)
  2023-07-22 15:53 ` [Bug target/110066] [13/14 Regression] " pinskia at gcc dot gnu.org
@ 2023-07-22 15:56 ` pinskia at gcc dot gnu.org
  2023-07-22 16:57 ` aurelien at aurel32 dot net
                   ` (13 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-22 15:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #14 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 55614
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55614&action=edit
patch for someone to test out

The problem is the similar across many targets so I basically copied what was
done for another target.

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

* [Bug target/110066] [13/14 Regression] [RISC-V] Segment fault if compiled with -static -pg
  2023-05-31 20:36 [Bug target/110066] New: [RISC-V] Segment fault if compiled with -static -pg i at rvalue dot moe
                   ` (13 preceding siblings ...)
  2023-07-22 15:56 ` pinskia at gcc dot gnu.org
@ 2023-07-22 16:57 ` aurelien at aurel32 dot net
  2023-07-22 17:02 ` pinskia at gcc dot gnu.org
                   ` (12 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: aurelien at aurel32 dot net @ 2023-07-22 16:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #15 from Aurelien Jarno <aurelien at aurel32 dot net> ---
(In reply to Andrew Pinski from comment #14)
> Created attachment 55614 [details]
> patch for someone to test out
> 
> The problem is the similar across many targets so I basically copied what
> was done for another target.

Thanks for the patch, unfortunately it doesn't work as is. However, as commit
3cd08f7168c196d7a481b9ed9f4289fd1f14eea8 enabled both
-fno-asynchronous-unwind-tables and -fno-unwind-tables, I have tried to add
-fno-unwind-tables to riscv/t-crtstuff and that works.

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

* [Bug target/110066] [13/14 Regression] [RISC-V] Segment fault if compiled with -static -pg
  2023-05-31 20:36 [Bug target/110066] New: [RISC-V] Segment fault if compiled with -static -pg i at rvalue dot moe
                   ` (14 preceding siblings ...)
  2023-07-22 16:57 ` aurelien at aurel32 dot net
@ 2023-07-22 17:02 ` pinskia at gcc dot gnu.org
  2023-07-22 17:32 ` schwab@linux-m68k.org
                   ` (11 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-22 17:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #16 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Aurelien Jarno from comment #15)
> (In reply to Andrew Pinski from comment #14)
> > Created attachment 55614 [details]
> > patch for someone to test out
> > 
> > The problem is the similar across many targets so I basically copied what
> > was done for another target.
> 
> Thanks for the patch, unfortunately it doesn't work as is. However, as
> commit 3cd08f7168c196d7a481b9ed9f4289fd1f14eea8 enabled both
> -fno-asynchronous-unwind-tables and -fno-unwind-tables, I have tried to add
> -fno-unwind-tables to riscv/t-crtstuff and that works.

Ok, I will add -fno-unwind-tables and submit the patch then. Thanks for testing
the patch and improving it.

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

* [Bug target/110066] [13/14 Regression] [RISC-V] Segment fault if compiled with -static -pg
  2023-05-31 20:36 [Bug target/110066] New: [RISC-V] Segment fault if compiled with -static -pg i at rvalue dot moe
                   ` (15 preceding siblings ...)
  2023-07-22 17:02 ` pinskia at gcc dot gnu.org
@ 2023-07-22 17:32 ` schwab@linux-m68k.org
  2023-07-22 17:36 ` aurelien at aurel32 dot net
                   ` (10 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: schwab@linux-m68k.org @ 2023-07-22 17:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #17 from Andreas Schwab <schwab@linux-m68k.org> ---
I don't think you need -fno-omit-frame-pointer.

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

* [Bug target/110066] [13/14 Regression] [RISC-V] Segment fault if compiled with -static -pg
  2023-05-31 20:36 [Bug target/110066] New: [RISC-V] Segment fault if compiled with -static -pg i at rvalue dot moe
                   ` (16 preceding siblings ...)
  2023-07-22 17:32 ` schwab@linux-m68k.org
@ 2023-07-22 17:36 ` aurelien at aurel32 dot net
  2023-07-22 17:36 ` schwab@linux-m68k.org
                   ` (9 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: aurelien at aurel32 dot net @ 2023-07-22 17:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #18 from Aurelien Jarno <aurelien at aurel32 dot net> ---
(In reply to Andreas Schwab from comment #17)
> I don't think you need -fno-omit-frame-pointer.

I confirm that CRTSTUFF_T_CFLAGS += -fno-asynchronous-unwind-tables
-fno-unwind-tables is enough to fix the issue.

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

* [Bug target/110066] [13/14 Regression] [RISC-V] Segment fault if compiled with -static -pg
  2023-05-31 20:36 [Bug target/110066] New: [RISC-V] Segment fault if compiled with -static -pg i at rvalue dot moe
                   ` (17 preceding siblings ...)
  2023-07-22 17:36 ` aurelien at aurel32 dot net
@ 2023-07-22 17:36 ` schwab@linux-m68k.org
  2023-07-22 20:32 ` pinskia at gcc dot gnu.org
                   ` (8 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: schwab@linux-m68k.org @ 2023-07-22 17:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #19 from Andreas Schwab <schwab@linux-m68k.org> ---
Probably also needed for aarch64.

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

* [Bug target/110066] [13/14 Regression] [RISC-V] Segment fault if compiled with -static -pg
  2023-05-31 20:36 [Bug target/110066] New: [RISC-V] Segment fault if compiled with -static -pg i at rvalue dot moe
                   ` (18 preceding siblings ...)
  2023-07-22 17:36 ` schwab@linux-m68k.org
@ 2023-07-22 20:32 ` pinskia at gcc dot gnu.org
  2023-07-23  1:07 ` pinskia at gcc dot gnu.org
                   ` (7 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-22 20:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #20 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andreas Schwab from comment #19)
> Probably also needed for aarch64.

Testing that and will submit both patches after that finishes.

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

* [Bug target/110066] [13/14 Regression] [RISC-V] Segment fault if compiled with -static -pg
  2023-05-31 20:36 [Bug target/110066] New: [RISC-V] Segment fault if compiled with -static -pg i at rvalue dot moe
                   ` (19 preceding siblings ...)
  2023-07-22 20:32 ` pinskia at gcc dot gnu.org
@ 2023-07-23  1:07 ` pinskia at gcc dot gnu.org
  2023-07-23  4:55 ` cvs-commit at gcc dot gnu.org
                   ` (6 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-23  1:07 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |pinskia at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

--- Comment #21 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
https://gcc.gnu.org/pipermail/gcc-patches/2023-July/625290.html

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

* [Bug target/110066] [13/14 Regression] [RISC-V] Segment fault if compiled with -static -pg
  2023-05-31 20:36 [Bug target/110066] New: [RISC-V] Segment fault if compiled with -static -pg i at rvalue dot moe
                   ` (20 preceding siblings ...)
  2023-07-23  1:07 ` pinskia at gcc dot gnu.org
@ 2023-07-23  4:55 ` cvs-commit at gcc dot gnu.org
  2023-07-23  4:57 ` [Bug target/110066] [13 " pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-07-23  4:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #22 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <pinskia@gcc.gnu.org>:

https://gcc.gnu.org/g:bbc1a102735c72e3c5a4dede8ab382813d12b058

commit r14-2733-gbbc1a102735c72e3c5a4dede8ab382813d12b058
Author: Andrew Pinski <apinski@marvell.com>
Date:   Sat Jul 22 08:52:42 2023 -0700

    Fix PR 110066: crash with -pg -static on riscv

    The problem -fasynchronous-unwind-tables is on by default for riscv linux
    We need turn it off for crt*.o because it would make __EH_FRAME_BEGIN__
point
    to .eh_frame data from crtbeginT.o instead of the user-defined object
    during static linking.

    This turns it off.

    OK?

    libgcc/ChangeLog:

            * config.host (riscv*-*-linux*): Add t-crtstuff to tmake_file.
            (riscv*-*-freebsd*): Likewise.
            * config/riscv/t-crtstuff: New file.

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

* [Bug target/110066] [13 Regression] [RISC-V] Segment fault if compiled with -static -pg
  2023-05-31 20:36 [Bug target/110066] New: [RISC-V] Segment fault if compiled with -static -pg i at rvalue dot moe
                   ` (21 preceding siblings ...)
  2023-07-23  4:55 ` cvs-commit at gcc dot gnu.org
@ 2023-07-23  4:57 ` pinskia at gcc dot gnu.org
  2023-07-27  9:26 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-23  4:57 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |12.3.0, 14.0
            Summary|[13/14 Regression] [RISC-V] |[13 Regression] [RISC-V]
                   |Segment fault if compiled   |Segment fault if compiled
                   |with -static -pg            |with -static -pg
      Known to fail|                            |13.1.0

--- Comment #23 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed on the trunk will backport to GCC 13 after 13.2.0 is released (since the
branch is frozen except for RM approvals).

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

* [Bug target/110066] [13 Regression] [RISC-V] Segment fault if compiled with -static -pg
  2023-05-31 20:36 [Bug target/110066] New: [RISC-V] Segment fault if compiled with -static -pg i at rvalue dot moe
                   ` (22 preceding siblings ...)
  2023-07-23  4:57 ` [Bug target/110066] [13 " pinskia at gcc dot gnu.org
@ 2023-07-27  9:26 ` rguenth at gcc dot gnu.org
  2023-08-04 11:15 ` aurelien at aurel32 dot net
                   ` (3 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-27  9:26 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|13.2                        |13.3

--- Comment #24 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 13.2 is being released, retargeting bugs to GCC 13.3.

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

* [Bug target/110066] [13 Regression] [RISC-V] Segment fault if compiled with -static -pg
  2023-05-31 20:36 [Bug target/110066] New: [RISC-V] Segment fault if compiled with -static -pg i at rvalue dot moe
                   ` (23 preceding siblings ...)
  2023-07-27  9:26 ` rguenth at gcc dot gnu.org
@ 2023-08-04 11:15 ` aurelien at aurel32 dot net
  2023-09-04  6:26 ` i at rvalue dot moe
                   ` (2 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: aurelien at aurel32 dot net @ 2023-08-04 11:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #25 from Aurelien Jarno <aurelien at aurel32 dot net> ---
(In reply to Andrew Pinski from comment #23)
> Fixed on the trunk will backport to GCC 13 after 13.2.0 is released (since
> the branch is frozen except for RM approvals).

Now that GCC 13.2.0 has been released, would it be possible to backport the
fix, please?

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

* [Bug target/110066] [13 Regression] [RISC-V] Segment fault if compiled with -static -pg
  2023-05-31 20:36 [Bug target/110066] New: [RISC-V] Segment fault if compiled with -static -pg i at rvalue dot moe
                   ` (24 preceding siblings ...)
  2023-08-04 11:15 ` aurelien at aurel32 dot net
@ 2023-09-04  6:26 ` i at rvalue dot moe
  2024-05-08 16:08 ` cvs-commit at gcc dot gnu.org
  2024-05-08 16:08 ` pinskia at gcc dot gnu.org
  27 siblings, 0 replies; 29+ messages in thread
From: i at rvalue dot moe @ 2023-09-04  6:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #26 from rvalue <i at rvalue dot moe> ---
(In reply to CVS Commits from comment #22)
> The trunk branch has been updated by Andrew Pinski <pinskia@gcc.gnu.org>:
> 
> https://gcc.gnu.org/g:bbc1a102735c72e3c5a4dede8ab382813d12b058
> 
> commit r14-2733-gbbc1a102735c72e3c5a4dede8ab382813d12b058
> Author: Andrew Pinski <apinski@marvell.com>
> Date:   Sat Jul 22 08:52:42 2023 -0700
> 
>     Fix PR 110066: crash with -pg -static on riscv
>     
>     The problem -fasynchronous-unwind-tables is on by default for riscv linux
>     We need turn it off for crt*.o because it would make __EH_FRAME_BEGIN__
> point
>     to .eh_frame data from crtbeginT.o instead of the user-defined object
>     during static linking.
>     
>     This turns it off.
>     
>     OK?
>     
>     libgcc/ChangeLog:
>     
>             * config.host (riscv*-*-linux*): Add t-crtstuff to tmake_file.
>             (riscv*-*-freebsd*): Likewise.
>             * config/riscv/t-crtstuff: New file.

Confirmed that the patch works for me.

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

* [Bug target/110066] [13 Regression] [RISC-V] Segment fault if compiled with -static -pg
  2023-05-31 20:36 [Bug target/110066] New: [RISC-V] Segment fault if compiled with -static -pg i at rvalue dot moe
                   ` (25 preceding siblings ...)
  2023-09-04  6:26 ` i at rvalue dot moe
@ 2024-05-08 16:08 ` cvs-commit at gcc dot gnu.org
  2024-05-08 16:08 ` pinskia at gcc dot gnu.org
  27 siblings, 0 replies; 29+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-05-08 16:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #27 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Andrew Pinski
<pinskia@gcc.gnu.org>:

https://gcc.gnu.org/g:929b0fffe4d3d836e07e5a398a8e176e65f8b2c2

commit r13-8728-g929b0fffe4d3d836e07e5a398a8e176e65f8b2c2
Author: Andrew Pinski <apinski@marvell.com>
Date:   Sat Jul 22 08:52:42 2023 -0700

    Fix PR 110066: crash with -pg -static on riscv

    The problem -fasynchronous-unwind-tables is on by default for riscv linux
    We need turn it off for crt*.o because it would make __EH_FRAME_BEGIN__
point
    to .eh_frame data from crtbeginT.o instead of the user-defined object
    during static linking.

    This turns it off.

    OK?

    libgcc/ChangeLog:

            * config.host (riscv*-*-linux*): Add t-crtstuff to tmake_file.
            (riscv*-*-freebsd*): Likewise.
            * config/riscv/t-crtstuff: New file.

    (cherry picked from commit bbc1a102735c72e3c5a4dede8ab382813d12b058)

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

* [Bug target/110066] [13 Regression] [RISC-V] Segment fault if compiled with -static -pg
  2023-05-31 20:36 [Bug target/110066] New: [RISC-V] Segment fault if compiled with -static -pg i at rvalue dot moe
                   ` (26 preceding siblings ...)
  2024-05-08 16:08 ` cvs-commit at gcc dot gnu.org
@ 2024-05-08 16:08 ` pinskia at gcc dot gnu.org
  27 siblings, 0 replies; 29+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-08 16:08 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #28 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2024-05-08 16:08 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-31 20:36 [Bug target/110066] New: [RISC-V] Segment fault if compiled with -static -pg i at rvalue dot moe
2023-05-31 20:39 ` [Bug target/110066] " pinskia at gcc dot gnu.org
2023-05-31 21:00 ` schwab@linux-m68k.org
2023-05-31 22:35 ` i at rvalue dot moe
2023-07-21 16:21 ` aurelien at aurel32 dot net
2023-07-22  5:16 ` pinskia at gcc dot gnu.org
2023-07-22  5:18 ` pinskia at gcc dot gnu.org
2023-07-22  8:46 ` aurelien at aurel32 dot net
2023-07-22  8:46 ` aurelien at aurel32 dot net
2023-07-22  8:47 ` aurelien at aurel32 dot net
2023-07-22 12:37 ` aurelien at aurel32 dot net
2023-07-22 14:50 ` aurelien at aurel32 dot net
2023-07-22 15:30 ` aurelien at aurel32 dot net
2023-07-22 15:53 ` [Bug target/110066] [13/14 Regression] " pinskia at gcc dot gnu.org
2023-07-22 15:56 ` pinskia at gcc dot gnu.org
2023-07-22 16:57 ` aurelien at aurel32 dot net
2023-07-22 17:02 ` pinskia at gcc dot gnu.org
2023-07-22 17:32 ` schwab@linux-m68k.org
2023-07-22 17:36 ` aurelien at aurel32 dot net
2023-07-22 17:36 ` schwab@linux-m68k.org
2023-07-22 20:32 ` pinskia at gcc dot gnu.org
2023-07-23  1:07 ` pinskia at gcc dot gnu.org
2023-07-23  4:55 ` cvs-commit at gcc dot gnu.org
2023-07-23  4:57 ` [Bug target/110066] [13 " pinskia at gcc dot gnu.org
2023-07-27  9:26 ` rguenth at gcc dot gnu.org
2023-08-04 11:15 ` aurelien at aurel32 dot net
2023-09-04  6:26 ` i at rvalue dot moe
2024-05-08 16:08 ` cvs-commit at gcc dot gnu.org
2024-05-08 16:08 ` pinskia 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).