summaryrefslogtreecommitdiffstats
path: root/sys/sys/linker_set.h
diff options
context:
space:
mode:
authorhselasky <hselasky@FreeBSD.org>2014-06-30 18:11:22 +0000
committerhselasky <hselasky@FreeBSD.org>2014-06-30 18:11:22 +0000
commitb76fe8070babe8037cac400f602208678968b999 (patch)
treece90a641348c54f67fb486b6c3002ed569304135 /sys/sys/linker_set.h
parentb2486d3dac534ac15afcbfb1083c0d6c8e697dc1 (diff)
downloadFreeBSD-src-b76fe8070babe8037cac400f602208678968b999.zip
FreeBSD-src-b76fe8070babe8037cac400f602208678968b999.tar.gz
Workaround for bug in GCC on powerpc64. Symbols that are exported are
by fault required to be all "static" or all "extern".
Diffstat (limited to 'sys/sys/linker_set.h')
-rw-r--r--sys/sys/linker_set.h21
1 files changed, 16 insertions, 5 deletions
diff --git a/sys/sys/linker_set.h b/sys/sys/linker_set.h
index 2edb55b..5db8518 100644
--- a/sys/sys/linker_set.h
+++ b/sys/sys/linker_set.h
@@ -40,15 +40,26 @@
* For ELF, this is done by constructing a separate segment for each set.
*/
+#if defined(__powerpc64__)
+/*
+ * Move the symbol pointer from ".text" to ".data" segment, to make
+ * the GCC compiler happy:
+ */
+#define __MAKE_SET_CONST
+#else
+#define __MAKE_SET_CONST const
+#endif
+
/*
* Private macros, not to be used outside this header file.
*/
#ifdef __GNUCLIKE___SECTION
-#define __MAKE_SET(set, sym) \
- __GLOBL(__CONCAT(__start_set_,set)); \
- __GLOBL(__CONCAT(__stop_set_,set)); \
- static void const * const __set_##set##_sym_##sym \
- __section("set_" #set) __used = &sym
+#define __MAKE_SET(set, sym) \
+ __GLOBL(__CONCAT(__start_set_,set)); \
+ __GLOBL(__CONCAT(__stop_set_,set)); \
+ static void const * __MAKE_SET_CONST \
+ __set_##set##_sym_##sym __section("set_" #set) \
+ __used = &(sym)
#else /* !__GNUCLIKE___SECTION */
#ifndef lint
#error this file needs to be ported to your compiler
OpenPOWER on IntegriCloud