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