diff options
author | peter <peter@FreeBSD.org> | 2002-09-23 06:11:29 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2002-09-23 06:11:29 +0000 |
commit | 1e5c466a5216b4f283c29f68b3e51d08a99833fc (patch) | |
tree | f435ca08a2637edc0d7163be9df09b4b3f9e46f9 | |
parent | 5f1e8c6326db2601e1228565e996830319ae2a42 (diff) | |
download | FreeBSD-src-1e5c466a5216b4f283c29f68b3e51d08a99833fc.zip FreeBSD-src-1e5c466a5216b4f283c29f68b3e51d08a99833fc.tar.gz |
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.
-rw-r--r-- | sys/sys/cdefs.h | 9 | ||||
-rw-r--r-- | sys/sys/linker_set.h | 2 |
2 files changed, 7 insertions, 4 deletions
diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h index 3d0161c..5c5d288 100644 --- a/sys/sys/cdefs.h +++ b/sys/sys/cdefs.h @@ -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'. */ diff --git a/sys/sys/linker_set.h b/sys/sys/linker_set.h index ee60ffd..f025e18d 100644 --- a/sys/sys/linker_set.h +++ b/sys/sys/linker_set.h @@ -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" |