From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4874 invoked by alias); 27 Oct 2009 14:10:29 -0000 Received: (qmail 4865 invoked by uid 22791); 27 Oct 2009 14:10:28 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=BAYES_00,SPF_FAIL X-Spam-Check-By: sourceware.org Received: from mx20.gnu.org (HELO mx20.gnu.org) (199.232.41.8) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 27 Oct 2009 14:10:21 +0000 Received: from mail.codesourcery.com ([38.113.113.100]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1N2mkd-0005rr-Dy for gcc-patches@gcc.gnu.org; Tue, 27 Oct 2009 10:10:19 -0400 Received: (qmail 28763 invoked from network); 27 Oct 2009 14:10:16 -0000 Received: from unknown (HELO rex.config) (julian@127.0.0.2) by mail.codesourcery.com with ESMTPA; 27 Oct 2009 14:10:16 -0000 Date: Tue, 27 Oct 2009 14:24:00 -0000 From: Julian Brown To: gcc-patches@gcc.gnu.org Subject: [PATCH, ARM] Avoid pulling in unwinder for 64-bit division Message-ID: <20091027141012.40ff0d90@rex.config> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/u4+SJleZ=CWXybnnghXJfPg" X-detected-operating-system: by mx20.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2009-10/txt/msg01619.txt.bz2 --MP_/u4+SJleZ=CWXybnnghXJfPg Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline Content-length: 906 This patch sets compilation flags for the relevant parts of libgcc on ARM such that the unwinder is not unnecessarily pulled in to the linked executable when 64-bit division is used. This can be quite a significant space saving on bare-metal systems. Cross-tested on ARM EABI, and verified with a test program which performs 64-bit division. OK to apply? Julian ChangeLog libgcc/ * config.host (arm*-*-linux*, arm*-*-uclinux*, arm*-*-eabi*) (arm*-*-symbianelf): Add arm/t-divmod-ef to tmake_file. * Makefile.in (LIB2_DIVMOD_EXCEPTION_FLAGS): Set to previous default if not set by a target-specific Makefile fragment. (lib2-divmod-o, lib2-divmod-s-o): Use above. * config/arm/t-divmod-ef: New. * shared-object.mk (c_flags-$(base)$(objext)): New. ($(base)$(objext)): Use above. * static-object.mk (c_flags-$(base)$(objext)): New. ($(base)$(objext)): Use above. --MP_/u4+SJleZ=CWXybnnghXJfPg Content-Type: text/x-patch; name=no-unwinder-for-long-division-fsf-1.diff Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=no-unwinder-for-long-division-fsf-1.diff Content-length: 3142 Index: libgcc/shared-object.mk =================================================================== --- libgcc/shared-object.mk (revision 153062) +++ libgcc/shared-object.mk (working copy) @@ -8,11 +8,13 @@ base := $(basename $(notdir $o)) ifeq ($(suffix $o),.c) +c_flags-$(base)$(objext) := $(c_flags) $(base)$(objext): $o - $(gcc_compile) $(c_flags) -c $< $(vis_hide) + $(gcc_compile) $(c_flags-$@) -c $< $(vis_hide) +c_flags-$(base)_s$(objext) := $(c_flags) $(base)_s$(objext): $o - $(gcc_s_compile) $(c_flags) -c $< + $(gcc_s_compile) $(c_flags-$@) -c $< else Index: libgcc/config.host =================================================================== --- libgcc/config.host (revision 153062) +++ libgcc/config.host (working copy) @@ -205,12 +205,15 @@ arm*-*-netbsdelf*) arm*-*-netbsd*) ;; arm*-*-linux*) # ARM GNU/Linux with ELF + tmake_file="${tmake_file} arm/t-divmod-ef" ;; arm*-*-uclinux*) # ARM ucLinux + tmake_file="${tmake_file} arm/t-divmod-ef" ;; arm*-*-ecos-elf) ;; arm*-*-eabi* | arm*-*-symbianelf* ) + tmake_file="${tmake_file} arm/t-divmod-ef" ;; arm*-*-rtems*) ;; Index: libgcc/static-object.mk =================================================================== --- libgcc/static-object.mk (revision 153062) +++ libgcc/static-object.mk (working copy) @@ -8,8 +8,9 @@ base := $(basename $(notdir $o)) ifeq ($(suffix $o),.c) +c_flags-$(base)$(objext) := $(c_flags) $(base)$(objext): $o - $(gcc_compile) $(c_flags) -c $< $(vis_hide) + $(gcc_compile) $(c_flags-$@) -c $< $(vis_hide) else Index: libgcc/Makefile.in =================================================================== --- libgcc/Makefile.in (revision 153062) +++ libgcc/Makefile.in (working copy) @@ -400,18 +400,24 @@ libgcc-s-objects += $(patsubst %,%_s$(ob endif endif +ifeq ($(LIB2_DIVMOD_EXCEPTION_FLAGS),) +# Provide default flags for compiling divmod functions, if they haven't been +# set already by a target-specific Makefile fragment. +LIB2_DIVMOD_EXCEPTION_FLAGS := -fexceptions -fnon-call-exceptions +endif + # Build LIB2_DIVMOD_FUNCS. lib2-divmod-o = $(patsubst %,%$(objext),$(LIB2_DIVMOD_FUNCS)) $(lib2-divmod-o): %$(objext): $(gcc_srcdir)/libgcc2.c $(gcc_compile) -DL$* -c $(gcc_srcdir)/libgcc2.c \ - -fexceptions -fnon-call-exceptions $(vis_hide) + $(LIB2_DIVMOD_EXCEPTION_FLAGS) $(vis_hide) libgcc-objects += $(lib2-divmod-o) ifeq ($(enable_shared),yes) lib2-divmod-s-o = $(patsubst %,%_s$(objext),$(LIB2_DIVMOD_FUNCS)) $(lib2-divmod-s-o): %_s$(objext): $(gcc_srcdir)/libgcc2.c $(gcc_s_compile) -DL$* -c $(gcc_srcdir)/libgcc2.c \ - -fexceptions -fnon-call-exceptions + $(LIB2_DIVMOD_EXCEPTION_FLAGS) libgcc-s-objects += $(lib2-divmod-s-o) endif Index: libgcc/config/arm/t-divmod-ef =================================================================== --- libgcc/config/arm/t-divmod-ef (revision 0) +++ libgcc/config/arm/t-divmod-ef (revision 0) @@ -0,0 +1,4 @@ +# On ARM, specifying -fnon-call-exceptions will needlessly pull in +# the unwinder in simple programs which use 64-bit division. Omitting +# the option is safe. +LIB2_DIVMOD_EXCEPTION_FLAGS := -fexceptions --MP_/u4+SJleZ=CWXybnnghXJfPg--