This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix -fasynchronous-unwind-tables bug on x86_64
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Richard Henderson <rth at redhat dot com>, jh at suse dot cz
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 26 Nov 2002 18:59:12 +0100
- Subject: [PATCH] Fix -fasynchronous-unwind-tables bug on x86_64
- References: <20021121104450.Z27455@devserv.devel.redhat.com> <20021121175625.GC12079@redhat.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Thu, Nov 21, 2002 at 09:56:25AM -0800, Richard Henderson wrote:
> On Thu, Nov 21, 2002 at 10:44:50AM -0500, Jakub Jelinek wrote:
> > The solutions I can see for this are:
> > a) build crtend.o always with -fno-asynchronous-unwind-tables
> > (ATM that FDE is never seen by frame unwinders anyway, since it is
> > past the terminating 0).
>
> I guess this seems easiest.
>
> > b) write the terminating 0 in asm magic, which every
> > -fasynchronous-unwind-tables defaulting target would have to write
> > (using .subsection)
>
> This would be my fallback preference, if someone has strong
> objections to leaving the constructor function without unwind
> tables.
As nobody voiced any objections, here is a) implemented.
IMHO it makes no sense to emit .eh_frame for crtbegin*.o and crtend*.o,
since all the 3 functions are called from .init resp. .fini sections anyway
and those sections don't have unwind info.
Furthermore, I noticed that crtbegin.o is built with -fno-omit-frame-pointer
while crtbeginS.o with -fPIC (and no -fno-omit-frame-pointer),
my understanding is that crt*S.o flags should be on Linux the same as crt*.o
with additional -fPIC.
Ok to commit?
2002-11-26 Jakub Jelinek <jakub@redhat.com>
* config.gcc (x86_64-*-linux*) [tmake_file]: Remove i386/t-crtstuff.
* config/t-linux (CRTSTUFF_T_CFLAGS_S): Add $(CRTSTUFF_T_CFLAGS).
* config/i386/t-linux64 (CRTSTUFF_T_CFLAGS): Define.
--- gcc/config.gcc.jj 2002-11-26 11:26:44.000000000 +0100
+++ gcc/config.gcc 2002-11-26 19:58:20.000000000 +0100
@@ -1124,7 +1124,7 @@ i[34567]86-*-linux*) # Intel 80386's run
x86_64-*-linux*)
tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h svr4.h linux.h \
i386/x86-64.h i386/linux64.h"
- tmake_file="t-slibgcc-elf-ver t-linux i386/t-crtstuff i386/t-linux64"
+ tmake_file="t-slibgcc-elf-ver t-linux i386/t-linux64"
;;
i[34567]86-*-gnu*)
;;
--- gcc/config/t-linux.jj 2001-12-15 14:00:20.000000000 +0100
+++ gcc/config/t-linux 2002-11-26 20:04:29.000000000 +0100
@@ -2,7 +2,7 @@
STMP_FIXPROTO =
# Compile crtbeginS.o and crtendS.o with pic.
-CRTSTUFF_T_CFLAGS_S = -fPIC
+CRTSTUFF_T_CFLAGS_S = $(CRTSTUFF_T_CFLAGS) -fPIC
# Compile libgcc2.a with pic.
TARGET_LIBGCC2_CFLAGS = -fPIC
--- gcc/config/i386/t-linux64.jj 2002-10-04 14:35:16.000000000 +0200
+++ gcc/config/i386/t-linux64 2002-11-26 20:00:14.000000000 +0100
@@ -12,3 +12,9 @@ LIBGCC = stmp-multilib
INSTALL_LIBGCC = install-multilib
EXTRA_MULTILIB_PARTS=crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o
+
+# The pushl in CTOR initialization interferes with frame pointer elimination.
+# crtend*.o cannot be compiled without -fno-asynchronous-unwind-tables,
+# because then __FRAME_END__ might not be the last thing in .eh_frame
+# section.
+CRTSTUFF_T_CFLAGS = -fno-omit-frame-pointer -fno-asynchronous-unwind-tables
Jakub