Add a __section(x) macro as well. Use this in linker_set.h. ie:

static void const * const __set_##set##_sym_##sym
 __attribute__((__section__("set_" #set),__unused__)) = &sym
becomes:
static void const * const __set_##set##_sym_##sym
 __section("set_" #set) __unused = &sym
Like the other macros, these #define away for unrecognized compilers or
lint.

Also, fix the argments in the previous commit for the non-gcc case. lint
might be a bit happier about that.  Note that the gcc <= 2.6 case
needs some research.
This commit is contained in:
Peter Wemm 2002-09-23 06:11:29 +00:00
parent acb460624e
commit a7865fc147
2 changed files with 7 additions and 4 deletions

View File

@ -117,14 +117,16 @@
#define __pure2
#define __unused
#define __packed
#define __aligned
#define __aligned(x)
#define __section(x)
#endif
#if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 && __GNUC_MINOR__ < 7
#define __dead2 __attribute__((__noreturn__))
#define __pure2 __attribute__((__const__))
#define __unused
#define __packed
#define __aligned
#define __packed /* XXX find this out, if we care */
#define __aligned(x) /* XXX find this out, if we care */
#define __section(x) /* XXX find this out, if we care */
#endif
#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ == 3
#define __dead2 __attribute__((__noreturn__))
@ -132,6 +134,7 @@
#define __unused __attribute__((__unused__))
#define __packed __attribute__((__packed__))
#define __aligned(x) __attribute__((__aligned__(x)))
#define __section(x) __attribute__((__section__(x)))
#endif
/* XXX: should use `#if __STDC_VERSION__ < 199901'. */

View File

@ -42,7 +42,7 @@
#ifdef __GNUC__
#define __MAKE_SET(set, sym) \
static void const * const __set_##set##_sym_##sym \
__attribute__((__section__("set_" #set),__unused__)) = &sym
__section("set_" #set) __unused = &sym
#else /* !__GNUC__ */
#ifndef lint
#error "This file needs to be compiled by GCC or lint"