1
0
mirror of https://github.com/adtools/clib2.git synced 2025-12-08 14:59:05 +00:00

- Cleaned up the GCC constructor/destructor macros again. There is more to come.

git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14872 87f5fb63-7c3d-0410-a384-fd976d0f7a62
This commit is contained in:
Olaf Barthel
2005-03-10 07:47:51 +00:00
parent e3e82b3657
commit d2f157b0a1

View File

@ -1,5 +1,5 @@
/*
* $Id: macros.h,v 1.10 2005-03-09 21:07:25 obarthel Exp $
* $Id: macros.h,v 1.11 2005-03-10 07:47:51 obarthel Exp $
*
* :ts=4
*
@ -136,7 +136,7 @@
#define WEAK __attribute__((weak))
#else
#define WEAK /* WEAK */
#endif
#endif /* __GNUC__ */
#endif /* WEAK */
/****************************************************************************/
@ -148,39 +148,42 @@
#else
#define UNUSED /* UNUSED */
#define NOCOMMON /* NOCOMMON */
#endif
#endif /* __GNUC__ */
#endif /* UNUSED */
/****************************************************************************/
#ifdef __SASC
#define CLIB_CONSTRUCTOR(name) int __stdargs _STI_500_##name(void)
#define CLIB_DESTRUCTOR(name) void __stdargs _STD_500_##name(void)
#define PROFILE_CONSTRUCTOR(name) int __stdargs _STI_150_##name(void)
#define PROFILE_DESTRUCTOR(name) void __stdargs _STD_150_##name(void)
#define CONSTRUCTOR_SUCCEED() return(0)
#define CONSTRUCTOR_FAIL() return(1)
#endif /* __SASC */
#ifdef __GNUC__
#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) __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; \
STATIC VOID (*__name##_dtor)(void) __attribute__((used,section(".dtors._00500"))) = name##_dtor; \
STATIC VOID name##_dtor(void)
#define PROFILE_CONSTRUCTOR(name) \
STATIC VOID __attribute__((used)) name##_ctor(void); \
STATIC VOID (*__name##_ctor)(void) __attribute__((used,section(".ctors.00150"))) = name##_ctor; \
STATIC VOID (*__name##_ctor)(void) __attribute__((used,section(".ctors._00150"))) = name##_ctor; \
STATIC VOID name##_ctor(void)
#define PROFILE_DESTRUCTOR(name) \
STATIC VOID __attribute__((used)) name##_dtor(void); \
STATIC VOID (*__name##_dtor)(void) __attribute__((used,section(".dtors.00150"))) = name##_dtor; \
STATIC VOID (*__name##_dtor)(void) __attribute__((used,section(".dtors._00150"))) = name##_dtor; \
STATIC VOID name##_ctor(void)
#define CONSTRUCTOR_SUCCEED() \
@ -188,6 +191,7 @@
#define CONSTRUCTOR_FAIL() \
exit(RETURN_FAIL) /* ZZZ not a nice thing to do; fix the constructor invocation code! */
#endif /* __GNUC__ */
/****************************************************************************/