From 9f6654f4a86ec123bb690190714db3e949fa80bb Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Mon, 21 Jul 2014 13:16:18 +0200 Subject: [PATCH] Use crtbeginS.o and crtendS.o for everything. * The glue code files crtbegin.o and crtend.o don't cleanup globals properly, only the variants with the S suffix do. As executables are shared on Haiku, we use crtbeginS.o and crtendS.o for those, too. This fixes crashes on shutdown of Haiku servers that load add-ons (e.g. Print Server and Media Add-On Server). --- gcc/libgcc/config.host | 14 +++++--------- gcc/gcc/config/haiku.h | 4 ++-- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/gcc/libgcc/config.host b/gcc/libgcc/config.host index d394074..cda47a1 100644 --- a/gcc/libgcc/config.host +++ b/gcc/libgcc/config.host @@ -96,7 +96,7 @@ ;; avr-*-*) cpu_type=avr - ;; + ;; bfin*-*) cpu_type=bfin ;; @@ -201,7 +201,7 @@ # configuration. tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-haiku t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver" tmake_file="$tmake_file t-slibgcc-nolc-override" - extra_parts="crtbegin.o crtend.o" + extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" ;; *-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu | *-*-gnu* | *-*-kopensolaris*-gnu) tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-eh-dw2-dip t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver t-linux" @@ -335,7 +335,6 @@ tmake_file="${tmake_file} t-softfp-sfdf t-softfp-excl arm/t-softfp t-softfp" tm_file="${tm_file} arm/bpabi-lib.h" unwind_header=config/arm/unwind-arm.h - extra_parts="crtbegin.o crtend.o" ;; arm*-*-linux*) # ARM GNU/Linux with ELF tmake_file="${tmake_file} arm/t-arm t-fixedpoint-gnu-prefix" @@ -527,7 +526,6 @@ ;; x86_64-*-haiku*) tmake_file="${tmake_file} i386/t-crtstuff i386/t-eh-dw2" - extra_parts="crtbegin.o crtend.o" ;; i[34567]86-*-netbsdelf*) ;; @@ -686,7 +684,7 @@ lm32-*-uclinux*) extra_parts="$extra_parts crtbegin.o crtendS.o crtbeginT.o" tmake_file="lm32/t-lm32 lm32/t-uclinux t-libgcc-pic t-softfp-sfdf t-softfp" - ;; + ;; m32r-*-elf*) tmake_file=t-fdpbit ;; @@ -703,9 +701,6 @@ m32rle-*-linux*) tmake_file="$tmake_file m32r/t-linux t-fdpbit" ;; -m68k-*-haiku*) - extra_parts="crtbegin.o crtend.o" - ;; m68k-*-elf* | fido-*-elf) tmake_file="$tmake_file m68k/t-floatlib" ;; @@ -858,9 +853,6 @@ md_unwind_header=rs6000/freebsd-unwind.h ;; esac - ;; -powerpc-*-haiku*) - extra_parts="crtbegin.o crtend.o" ;; powerpc-*-netbsd*) tmake_file="$tmake_file rs6000/t-netbsd rs6000/t-crtstuff" diff --git a/gcc/gcc/config/haiku.h b/gcc/gcc/config/haiku.h index 258e154..9dcda0e 100644 --- a/gcc/gcc/config/haiku.h +++ b/gcc/gcc/config/haiku.h @@ -63,10 +63,10 @@ #undef STARTFILE_SPEC -#define STARTFILE_SPEC "crti.o%s crtbegin.o%s %{!shared:%{!nostart:start_dyn.o%s}} init_term_dyn.o%s" +#define STARTFILE_SPEC "crti.o%s crtbeginS.o%s %{!shared:%{!nostart:start_dyn.o%s}} init_term_dyn.o%s" #undef ENDFILE_SPEC -#define ENDFILE_SPEC "crtend.o%s crtn.o%s" +#define ENDFILE_SPEC "crtendS.o%s crtn.o%s" /* Every program on Haiku links against libroot which contains the pthread routines, so there's no need to explicitly call out when doing threaded -- gitore 0.2.2