aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@novell.com>2011-03-14 17:02:50 +0000
committerJan Beulich <jbeulich@novell.com>2011-03-14 17:02:50 +0000
commit84c4461b7d3a3ea0a082812821018a3e9a9cb12f (patch)
tree7fd71ae97572b301ece654a466c6db1ff9232a43
parentd62b3c2276ae4caeb4674fe865061b04f0514e66 (diff)
downloadxen-84c4461b7d3a3ea0a082812821018a3e9a9cb12f.tar.gz
xen-84c4461b7d3a3ea0a082812821018a3e9a9cb12f.tar.bz2
xen-84c4461b7d3a3ea0a082812821018a3e9a9cb12f.zip
Force out-of-line instances of inline functions into .init.text in init-only code
Some compiler versions may choose to not inline certain functions, but the check introduced in c/s 23003:768269c43914 wants .text to be empty. Also make sure an eventual error gets properly propagated even on the first section of an object (.text typically being the first one), and cover a broader set of sections. Signed-off-by: Jan Beulich <jbeulich@novell.com>
-rw-r--r--xen/Rules.mk8
-rw-r--r--xen/include/xen/compiler.h9
2 files changed, 15 insertions, 2 deletions
diff --git a/xen/Rules.mk b/xen/Rules.mk
index 7ab809ac9e..b3224a6afa 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -100,6 +100,8 @@ obj-y := $(patsubst %/,%/built-in.o,$(obj-y))
subdir-all := $(subdir-y) $(subdir-n)
+$(filter %.init.o,$(obj-y) $(obj-bin-y)): CFLAGS += -DINIT_SECTIONS_ONLY
+
ifeq ($(lto),y)
# Would like to handle all object files as bitcode, but objects made from
# pure asm are in a different format and have to be collected separately.
@@ -158,8 +160,10 @@ SPECIAL_DATA_SECTIONS := rodata $(foreach n,1 2 4 8,rodata.str1.$(n)) \
%.init.o: %.o Makefile
$(OBJDUMP) -h $< | sed -n '/[0-9]/{s,00*,0,g;p}' | while read idx name sz rest; do \
case "$$name" in \
- .text|.data|.bss) test $$sz = 0 || \
- { echo "Error: size of $<:$$name is 0x$$sz" >&2; exit $$idx; };; \
+ .text|.text.*|.data|.data.*|.bss) \
+ test $$sz != 0 || continue; \
+ echo "Error: size of $<:$$name is 0x$$sz" >&2; \
+ exit $(shell expr $$idx + 1);; \
esac; \
done
$(OBJCOPY) $(foreach s,$(SPECIAL_DATA_SECTIONS),--rename-section .$(s)=.init.$(s)) $< $@
diff --git a/xen/include/xen/compiler.h b/xen/include/xen/compiler.h
index 909dec0bdf..23532ea331 100644
--- a/xen/include/xen/compiler.h
+++ b/xen/include/xen/compiler.h
@@ -14,6 +14,15 @@
#define always_inline __inline__ __attribute__ ((always_inline))
#define noinline __attribute__((noinline))
+#ifdef INIT_SECTIONS_ONLY
+/*
+ * For sources indicated to have only init code, make sure even
+ * inline functions not expanded inline get placed in .init.text.
+ */
+#include <xen/init.h>
+#define __inline__ __inline__ __init
+#endif
+
#define __attribute_pure__ __attribute__((pure))
#define __attribute_const__ __attribute__((__const__))