From patchwork Fri Sep 21 07:41:53 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joey Ye X-Patchwork-Id: 185601 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id CD25E2C007B for ; Fri, 21 Sep 2012 17:42:47 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1348818168; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: From:To:Subject:Date:Message-ID:MIME-Version:Content-Type: Content-Transfer-Encoding:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=JmnAloqK+an4vAPVpFaoQaGVVkQ=; b=tj0dJRZ4a1i77sy KU13YzFwazHobuv6USpxAgcfWxKT8LEb2N2ukfn6cszy6eBBI9+0c57exi9w9wFq 5RNE6coOwDVo13guaFCZhoZCDUfP/OVTENY1oxHxsocFKDsT46rsBj63KHAW1raI 0d22VxzFrAWzmZ5Y895ZuJGjodaw= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:From:To:Subject:Date:Message-ID:MIME-Version:X-MC-Unique:Content-Type:Content-Transfer-Encoding:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=d5y+llpOi+St7wiTlI/kqwMydrx+XhI1EdzIUQBz6gECj2MuJVmAO6AHlOFYGc SLl0mLyiguA/873TDdsUVH1t7qLI0rswD94q8Z+2Nqn7vpB+GsNLPi5W9XfCD3U7 GzR+ALS4d18pX5Jfca4ikPg70Dr1FZmXEBAxI4SxnplSM=; Received: (qmail 31597 invoked by alias); 21 Sep 2012 07:42:39 -0000 Received: (qmail 31577 invoked by uid 22791); 21 Sep 2012 07:42:35 -0000 X-SWARE-Spam-Status: No, hits=-1.1 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, MSGID_MULTIPLE_AT, RCVD_IN_DNSWL_LOW, TW_FN X-Spam-Check-By: sourceware.org Received: from service87.mimecast.com (HELO service87.mimecast.com) (91.220.42.44) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 21 Sep 2012 07:42:20 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Fri, 21 Sep 2012 08:42:18 +0100 Received: from E103005 ([10.1.255.212]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.0); Fri, 21 Sep 2012 08:42:16 +0100 From: "Joey Ye" To: Subject: [PATCH, libgcc] Make possible to disable JCR in crtstuff.c Date: Fri, 21 Sep 2012 15:41:53 +0800 Message-ID: <000001cd97cc$93210630$b9631290$@ye@arm.com> MIME-Version: 1.0 X-MC-Unique: 112092108421802701 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Current crtstuff.c checks if JCR_SECTION_NAME is defined to decide whether do work for JCR. However, defaults.h always defines JCR_SECTION_NAME: #ifndef JCR_SECTION_NAME #define JCR_SECTION_NAME ".jcr" #endif So it is impossible to disable JCR related code in crtbegin.o, which can save some bytes for every applications that doesn't need java. This patch revise the check of JCR_SECTION_NAME to TARGET_USE_JCR_SECTION. By defining latter to zero disable JCR in crtstuff. This change doesn't impact logic of any target given following defines in defaults.h: #ifndef TARGET_USE_JCR_SECTION #ifdef JCR_SECTION_NAME #define TARGET_USE_JCR_SECTION 1 #else #define TARGET_USE_JCR_SECTION 0 #endif #endif Again, this patch doesn't impact libgcc on any target, unless TARGET_USE_JCR_SECTION is explicitly defined to 0 with make CFLAGS_FOR_TARGET=-DTARGET_USE_JCR_SECTION=0. AIX defines TARGET_USE_JCR_SECTION to 0, but it has no crtbegin/end stuff. So also no impact. OK to trunk? 2012-09-21 Joey Ye * crtstuff.c: Check TARGET_USE_JCR_SECTION. #else /* OBJECT_FORMAT_ELF */ @@ -551,7 +551,7 @@ } #if defined(USE_EH_FRAME_REGISTRY) \ - || defined(JCR_SECTION_NAME) \ + || defined(TARGET_USE_JCR_SECTION) \ || defined(USE_TM_CLONE_REGISTRY) /* A helper function for __do_global_ctors, which is in crtend.o. Here in crtbegin.o, we can reference a couple of symbols not visible there. @@ -566,7 +566,7 @@ __register_frame_info (__EH_FRAME_BEGIN__, &object); #endif -#ifdef JCR_SECTION_NAME +#if TARGET_USE_JCR_SECTION if (__JCR_LIST__[0]) { void (*register_classes) (void *) = _Jv_RegisterClasses; @@ -580,7 +580,7 @@ register_tm_clones (); #endif /* USE_TM_CLONE_REGISTRY */ } -#endif /* USE_EH_FRAME_REGISTRY || JCR_SECTION_NAME || USE_TM_CLONE_REGISTRY */ +#endif /* USE_EH_FRAME_REGISTRY || TARGET_USE_JCR_SECTION || USE_TM_CLONE_REGISTRY */ #else /* ! INIT_SECTION_ASM_OP && ! HAS_INIT_SECTION */ #error "What are you doing with crtstuff.c, then?" @@ -656,13 +656,13 @@ = { 0 }; #endif /* EH_FRAME_SECTION_NAME */ -#ifdef JCR_SECTION_NAME +#if TARGET_USE_JCR_SECTION && defined (JCR_SECTION_NAME) /* Null terminate the .jcr section array. */ STATIC void *__JCR_END__[1] __attribute__ ((used, section(JCR_SECTION_NAME), aligned(sizeof(void *)))) = { 0 }; -#endif /* JCR_SECTION_NAME */ +#endif /* TARGET_USE_JCR_SECTION && JCR_SECTION_NAME */ #if USE_TM_CLONE_REGISTRY # ifndef HAVE_GAS_HIDDEN @@ -742,7 +742,7 @@ { func_ptr *p; #if defined(USE_EH_FRAME_REGISTRY) \ - || defined(JCR_SECTION_NAME) \ + || defined(TARGET_USE_JCR_SECTION) \ || defined(USE_TM_CLONE_REGISTRY) __do_global_ctors_1(); #endif Index: libgcc/crtstuff.c =================================================================== --- libgcc/crtstuff.c (revision 190556) +++ libgcc/crtstuff.c (working copy) @@ -256,13 +256,13 @@ = { }; #endif /* USE_EH_FRAME_REGISTRY */ -#ifdef JCR_SECTION_NAME +#if TARGET_USE_JCR_SECTION && defined (JCR_SECTION_NAME) /* Stick a label at the beginning of the java class registration info so we can register them properly. */ STATIC void *__JCR_LIST__[] __attribute__ ((used, section(JCR_SECTION_NAME), aligned(sizeof(void*)))) = { }; -#endif /* JCR_SECTION_NAME */ +#endif /* TARGET_USE_JCR_SECTION && JCR_SECTION_NAME */ #if USE_TM_CLONE_REGISTRY STATIC func_ptr __TMC_LIST__[] @@ -438,7 +438,7 @@ #endif #if defined(USE_EH_FRAME_REGISTRY) \ - || defined(JCR_SECTION_NAME) \ + || defined(TARGET_USE_JCR_SECTION) \ || defined(USE_TM_CLONE_REGISTRY) /* Stick a call to __register_frame_info into the .init section. For some reason calls with no arguments work more reliably in .init, so stick the @@ -461,7 +461,7 @@ #endif /* CRT_GET_RFIB_DATA */ #endif /* USE_EH_FRAME_REGISTRY */ -#ifdef JCR_SECTION_NAME +#if TARGET_USE_JCR_SECTION if (__JCR_LIST__[0]) { void (*register_classes) (void *) = _Jv_RegisterClasses; @@ -469,7 +469,7 @@ if (register_classes) register_classes (__JCR_LIST__); } -#endif /* JCR_SECTION_NAME */ +#endif /* TARGET_USE_JCR_SECTION */ #if USE_TM_CLONE_REGISTRY register_tm_clones (); @@ -483,7 +483,7 @@ __attribute__ ((__used__, section(".init_array"), aligned(sizeof(func_ptr)))) = { frame_dummy }; #endif /* !defined(INIT_SECTION_ASM_OP) */ -#endif /* USE_EH_FRAME_REGISTRY || JCR_SECTION_NAME || USE_TM_CLONE_REGISTRY */ +#endif /* USE_EH_FRAME_REGISTRY || TARGET_USE_JCR_SECTION || USE_TM_CLONE_REGISTRY */