]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix PR 110066: crash with -pg -static on riscv
authorAndrew Pinski <apinski@marvell.com>
Sat, 22 Jul 2023 15:52:42 +0000 (08:52 -0700)
committerAndrew Pinski <apinski@marvell.com>
Sun, 23 Jul 2023 04:55:22 +0000 (21:55 -0700)
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.

libgcc/config.host
libgcc/config/riscv/t-crtstuff [new file with mode: 0644]

index 9d7212028d063648206b521705601ad2b50620c5..c94d69d84b7ce95c1189821f5da4ccb01ab72d09 100644 (file)
@@ -1304,12 +1304,12 @@ pru-*-*)
        tm_file="$tm_file pru/pru-abi.h"
        ;;
 riscv*-*-linux*)
-       tmake_file="${tmake_file} riscv/t-softfp${host_address} t-softfp riscv/t-elf riscv/t-elf${host_address} t-slibgcc-libgcc"
+       tmake_file="${tmake_file} riscv/t-crtstuff riscv/t-softfp${host_address} t-softfp riscv/t-elf riscv/t-elf${host_address} t-slibgcc-libgcc"
        extra_parts="$extra_parts crtbegin.o crtend.o crti.o crtn.o crtendS.o crtbeginT.o"
        md_unwind_header=riscv/linux-unwind.h
        ;;
 riscv*-*-freebsd*)
-       tmake_file="${tmake_file} riscv/t-softfp${host_address} t-softfp riscv/t-elf riscv/t-elf${host_address} t-slibgcc-libgcc"
+       tmake_file="${tmake_file} riscv/t-crtstuff riscv/t-softfp${host_address} t-softfp riscv/t-elf riscv/t-elf${host_address} t-slibgcc-libgcc"
        extra_parts="$extra_parts crtbegin.o crtend.o crti.o crtn.o crtendS.o crtbeginT.o"
        ;;
 riscv*-*-*)
diff --git a/libgcc/config/riscv/t-crtstuff b/libgcc/config/riscv/t-crtstuff
new file mode 100644 (file)
index 0000000..685d11b
--- /dev/null
@@ -0,0 +1,5 @@
+# -fasynchronous-unwind-tables -funwind-tables is on by default for riscv linux
+# We 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.
+CRTSTUFF_T_CFLAGS += -fno-asynchronous-unwind-tables -fno-unwind-tables