[2/2] AARCH64: Turn off unwind tables for crtbeginT.o
Checks
Commit Message
The problem -fasynchronous-unwind-tables is on by default for aarch64
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? Bootstrapped and tested on aarch64-linux-gnu with no regressions.
libgcc/ChangeLog:
* config.host (aarch64*-*-*): Add t-crtstuff to tmake_file.
* config/aarch64/t-crtstuff: New file.
---
libgcc/config.host | 6 ++++++
libgcc/config/aarch64/t-crtstuff | 5 +++++
2 files changed, 11 insertions(+)
create mode 100644 libgcc/config/aarch64/t-crtstuff
Comments
Andrew Pinski via Gcc-patches <gcc-patches@gcc.gnu.org> writes:
> The problem -fasynchronous-unwind-tables is on by default for aarch64
> 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.
Could you go into more details? Which user-defined object do you mean?
I notice alpha has:
# When GAS-generated unwind tables are created, they get created
# after the __FRAME_END__ terminator, which causes an ld error.
CRTSTUFF_T_CFLAGS = -fno-unwind-tables
which I guess was a separate problem.
Thanks,
Richard
On Mon, Jul 24, 2023 at 5:56 PM Richard Sandiford via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> Andrew Pinski via Gcc-patches <gcc-patches@gcc.gnu.org> writes:
> > The problem -fasynchronous-unwind-tables is on by default for aarch64
> > 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.
>
> Could you go into more details? Which user-defined object do you mean?
>
> I notice alpha has:
>
> # When GAS-generated unwind tables are created, they get created
> # after the __FRAME_END__ terminator, which causes an ld error.
> CRTSTUFF_T_CFLAGS = -fno-unwind-tables
>
> which I guess was a separate problem.
x86 has
# crtend*.o cannot be compiled without -fno-asynchronous-unwind-tables,
# because then __FRAME_END__ might not be the last thing in .eh_frame
# section.
>
> Thanks,
> Richard
@@ -390,6 +390,7 @@ aarch64*-*-elf | aarch64*-*-rtems*)
extra_parts="$extra_parts crtbegin.o crtend.o crti.o crtn.o"
extra_parts="$extra_parts crtfastmath.o"
tmake_file="${tmake_file} ${cpu_type}/t-aarch64"
+ tmake_file="${tmake_file} ${cpu_type}/t-crtstuff"
tmake_file="${tmake_file} ${cpu_type}/t-lse t-slibgcc-libgcc"
tmake_file="${tmake_file} ${cpu_type}/t-softfp t-softfp t-crtfm"
tmake_file="${tmake_file} t-dfprules"
@@ -398,6 +399,7 @@ aarch64*-*-elf | aarch64*-*-rtems*)
aarch64*-*-freebsd*)
extra_parts="$extra_parts crtfastmath.o"
tmake_file="${tmake_file} ${cpu_type}/t-aarch64"
+ tmake_file="${tmake_file} ${cpu_type}/t-crtstuff"
tmake_file="${tmake_file} ${cpu_type}/t-lse t-slibgcc-libgcc"
tmake_file="${tmake_file} ${cpu_type}/t-softfp t-softfp t-crtfm"
tmake_file="${tmake_file} t-dfprules"
@@ -406,12 +408,14 @@ aarch64*-*-freebsd*)
aarch64*-*-netbsd*)
extra_parts="$extra_parts crtfastmath.o"
tmake_file="${tmake_file} ${cpu_type}/t-aarch64"
+ tmake_file="${tmake_file} ${cpu_type}/t-crtstuff"
tmake_file="${tmake_file} ${cpu_type}/t-softfp t-softfp t-crtfm"
tmake_file="${tmake_file} t-dfprules"
md_unwind_header=aarch64/aarch64-unwind.h
;;
aarch64*-*-fuchsia*)
tmake_file="${tmake_file} ${cpu_type}/t-aarch64"
+ tmake_file="${tmake_file} ${cpu_type}/t-crtstuff"
tmake_file="${tmake_file} ${cpu_type}/t-lse t-slibgcc-libgcc"
tmake_file="${tmake_file} ${cpu_type}/t-softfp t-softfp"
tmake_file="${tmake_file} t-dfprules"
@@ -420,6 +424,7 @@ aarch64*-*-linux*)
extra_parts="$extra_parts crtfastmath.o"
md_unwind_header=aarch64/linux-unwind.h
tmake_file="${tmake_file} ${cpu_type}/t-aarch64"
+ tmake_file="${tmake_file} ${cpu_type}/t-crtstuff"
tmake_file="${tmake_file} ${cpu_type}/t-lse t-slibgcc-libgcc"
tmake_file="${tmake_file} ${cpu_type}/t-softfp t-softfp t-crtfm"
tmake_file="${tmake_file} t-dfprules"
@@ -428,6 +433,7 @@ aarch64*-*-vxworks7*)
extra_parts="$extra_parts crtfastmath.o"
md_unwind_header=aarch64/aarch64-unwind.h
tmake_file="${tmake_file} ${cpu_type}/t-aarch64"
+ tmake_file="${tmake_file} ${cpu_type}/t-crtstuff"
tmake_file="${tmake_file} ${cpu_type}/t-lse"
tmake_file="${tmake_file} ${cpu_type}/t-softfp t-softfp t-crtfm"
tmake_file="${tmake_file} t-dfprules"
new file mode 100644
@@ -0,0 +1,5 @@
+# -fasynchronous-unwind-tables -funwind-tables is on by default for aarch64
+# 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