From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2044) id 4DC483857C7E; Sat, 11 Dec 2021 13:34:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4DC483857C7E MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Rasmus Villemoes To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-5908] libgcc: vxcrtstuff.c: make ctor/dtor functions static X-Act-Checkin: gcc X-Git-Author: Rasmus Villemoes X-Git-Refname: refs/heads/master X-Git-Oldrev: 8b2885dee57e6e91b6265248f1de88fd53d61ce4 X-Git-Newrev: 365c7c6ac5400d88816e602f7f9aa12268ba53e3 Message-Id: <20211211133456.4DC483857C7E@sourceware.org> Date: Sat, 11 Dec 2021 13:34:56 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Dec 2021 13:34:56 -0000 https://gcc.gnu.org/g:365c7c6ac5400d88816e602f7f9aa12268ba53e3 commit r12-5908-g365c7c6ac5400d88816e602f7f9aa12268ba53e3 Author: Rasmus Villemoes Date: Wed Oct 27 12:21:49 2021 +0200 libgcc: vxcrtstuff.c: make ctor/dtor functions static When the translation unit itself creates pointers to the ctors/dtors in a specific section handled by the linker (whether .init_array or .ctors.*), there's no reason for the functions to have external linkage. That ends up polluting the symbol table in the running kernel. This makes vxcrtstuff.c on par with the generic crtstuff.c which also defines e.g. frame_dummy and __do_global_dtors_aux static. libgcc/ * config/vxcrtstuff.c: Make constructor and destructor functions static when possible. Diff: --- libgcc/config/vxcrtstuff.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libgcc/config/vxcrtstuff.c b/libgcc/config/vxcrtstuff.c index 908146d6c99..c15e15e54e9 100644 --- a/libgcc/config/vxcrtstuff.c +++ b/libgcc/config/vxcrtstuff.c @@ -66,14 +66,18 @@ __attribute__((section(__LIBGCC_EH_FRAME_SECTION_NAME__), aligned(4))) #define EH_CTOR_NAME _crtbe_register_frame #define EH_DTOR_NAME _ctrbe_deregister_frame +#define EH_LINKAGE static #else /* No specific sections for constructors or destructors: we thus use a symbol naming convention so that the constructors are then recognized - by munch or whatever tool is used for the final link phase. */ + by munch or whatever tool is used for the final link phase. Since the + pointers to the constructor/destructor functions are not created in this + translation unit, they must have external linkage. */ #define EH_CTOR_NAME _GLOBAL__I_00101_0__crtbe_register_frame #define EH_DTOR_NAME _GLOBAL__D_00101_1__crtbe_deregister_frame +#define EH_LINKAGE #endif @@ -96,13 +100,13 @@ __attribute__((section(__LIBGCC_EH_FRAME_SECTION_NAME__), aligned(4))) #endif /* USE_INITFINI_ARRAY */ -EH_CTOR_ATTRIBUTE void EH_CTOR_NAME (void) +EH_LINKAGE EH_CTOR_ATTRIBUTE void EH_CTOR_NAME (void) { static struct object object; __register_frame_info (__EH_FRAME_BEGIN__, &object); } -EH_DTOR_ATTRIBUTE void EH_DTOR_NAME (void) +EH_LINKAGE EH_DTOR_ATTRIBUTE void EH_DTOR_NAME (void) { __deregister_frame_info (__EH_FRAME_BEGIN__); }