From 91f12dd8f0154f0fd5f2b2cbf48a3d0f2d52a8cd Mon Sep 17 00:00:00 2001 From: Olaf Barthel Date: Thu, 10 Mar 2005 07:53:57 +0000 Subject: [PATCH] - Reworked the constructor/destructor macros again. git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14873 87f5fb63-7c3d-0410-a384-fd976d0f7a62 --- library/macros.h | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/library/macros.h b/library/macros.h index 4022153..a0520b4 100644 --- a/library/macros.h +++ b/library/macros.h @@ -1,5 +1,5 @@ /* - * $Id: macros.h,v 1.11 2005-03-10 07:47:51 obarthel Exp $ + * $Id: macros.h,v 1.12 2005-03-10 07:53:57 obarthel Exp $ * * :ts=4 * @@ -166,11 +166,27 @@ #ifdef __GNUC__ +#define CONSTRUCTOR(name,pri) \ + STATIC VOID __attribute__((used)) name##_ctor(void); \ + STATIC VOID (*__##name##_ctor)(void) __attribute__((used,section(".ctors._" #pri))) = name##_ctor; \ + STATIC VOID name##_ctor(void) + +#define DESTRUCTOR(name,pri) \ + STATIC VOID __attribute__((used)) name##_dtor(void); \ + STATIC VOID (*__##name##_dtor)(void) __attribute__((used,section(".dtors._" #pri))) = name##_dtor; \ + STATIC VOID name##_dtor(void) + +#define CLIB_CONSTRUCTOR(name) CONSTRUCTOR(name, 00500) +#define CLIB_DESTRUCTOR(name) DESTRUCTOR(name, 00500) +#define PROFILE_CONSTRUCTOR(name) CONSTRUCTOR(name, 00150) +#define PROFILE_DESTRUCTOR(name) DESTRUCTOR(name, 00150) + +/* #define CLIB_CONSTRUCTOR(name) \ STATIC VOID __attribute__((used)) name##_ctor(void); \ STATIC VOID (*__name##_ctor)(void) __attribute__((used,section(".ctors._00500"))) = name##_ctor; \ STATIC VOID name##_ctor(void) - + #define CLIB_DESTRUCTOR(name) \ STATIC VOID __attribute__((used)) name##_dtor(void); \ STATIC VOID (*__name##_dtor)(void) __attribute__((used,section(".dtors._00500"))) = name##_dtor; \ @@ -185,6 +201,7 @@ STATIC VOID __attribute__((used)) name##_dtor(void); \ STATIC VOID (*__name##_dtor)(void) __attribute__((used,section(".dtors._00150"))) = name##_dtor; \ STATIC VOID name##_ctor(void) +*/ #define CONSTRUCTOR_SUCCEED() \ return