summaryrefslogtreecommitdiff
path: root/include/linux/compiler-gcc4.h
diff options
context:
space:
mode:
authorAndi Kleen <ak@linux.intel.com>2012-09-17 14:09:15 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2012-09-17 15:00:38 -0700
commit9a858dc7cebce01a7bb616bebb85087fa2b40871 (patch)
tree70e8b7fd41d6503e105cdd0b5b9ed3e6f7c464ee /include/linux/compiler-gcc4.h
parent579035dc5ddd6d48fd8529e7358b03d911ab9d8a (diff)
downloadlwn-9a858dc7cebce01a7bb616bebb85087fa2b40871.tar.gz
lwn-9a858dc7cebce01a7bb616bebb85087fa2b40871.zip
compiler.h: add __visible
gcc 4.6+ has support for a externally_visible attribute that prevents the optimizer from optimizing unused symbols away. Add a __visible macro to use it with that compiler version or later. This is used (at least) by the "Link Time Optimization" patchset. Signed-off-by: Andi Kleen <ak@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/compiler-gcc4.h')
-rw-r--r--include/linux/compiler-gcc4.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h
index 2f4079175afb..934bc34d5f99 100644
--- a/include/linux/compiler-gcc4.h
+++ b/include/linux/compiler-gcc4.h
@@ -49,6 +49,13 @@
#endif
#endif
+#if __GNUC_MINOR__ >= 6
+/*
+ * Tell the optimizer that something else uses this function or variable.
+ */
+#define __visible __attribute__((externally_visible))
+#endif
+
#if __GNUC_MINOR__ > 0
#define __compiletime_object_size(obj) __builtin_object_size(obj, 0)
#endif