]> xenbits.xensource.com Git - people/julieng/xen-unstable.git/commitdiff
compat: enforce distinguishable file names in symbol table
authorJan Beulich <jbeulich@suse.com>
Tue, 3 Nov 2015 17:07:20 +0000 (18:07 +0100)
committerJan Beulich <jbeulich@suse.com>
Tue, 3 Nov 2015 17:07:20 +0000 (18:07 +0100)
To make it possible to tell apart the static symbols in files built a
second time for compat guest support, arrange for their source file
names to be prefixed by a suitable path. We can't do this without
explicit .file directives, since gcc has always been stripping paths
from file names handed to the internally generated .file directive.
However, we can leverage __FILE__ if we make sure the second instance
gets compiled out of other than the very directory the wrapper sits in.

Where suitable, remove the long redundant explicit inclusions of
xen/config.h at once.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
14 files changed:
xen/Rules.mk
xen/arch/x86/Makefile
xen/arch/x86/x86_64/Makefile
xen/arch/x86/x86_64/compat.c
xen/arch/x86/x86_64/mm.c
xen/arch/x86/x86_64/physdev.c
xen/arch/x86/x86_64/platform_hypercall.c
xen/common/Makefile
xen/common/compat/Makefile [deleted file]
xen/common/compat/domain.c
xen/common/compat/kernel.c
xen/common/compat/memory.c
xen/common/compat/multicall.c
xen/include/Makefile

index 433dad3e236ee127f1e81262307fb138bd005068..e9d03b9900fcaf60613ec4bbed825c5a6eb10ce6 100644 (file)
@@ -86,8 +86,7 @@ AFLAGS-$(clang)         += -no-integrated-as
 ALL_OBJS := $(ALL_OBJS-y)
 
 # Get gcc to generate the dependencies for us.
-CFLAGS-y += -MMD -MF .$(@F).d
-DEPS = .*.d
+CFLAGS-y += -MMD -MF $(@D)/.$(@F).d
 
 CFLAGS += $(CFLAGS-y)
 
@@ -103,6 +102,14 @@ LDFLAGS += $(LDFLAGS-y)
 
 include Makefile
 
+DEPS = .*.d
+define gendep
+    ifneq ($(1),$(subst /,:,$(1)))
+        DEPS += $(dir $(1)).$(basename $(notdir $(1))).d
+    endif
+endef
+$(foreach o,$(filter-out %/,$(obj-y)),$(eval $(call gendep,$(o))))
+
 # Ensure each subdirectory has exactly one trailing slash.
 subdir-n := $(patsubst %,%/,$(patsubst %/,%,$(subdir-n) $(subdir-)))
 subdir-y := $(patsubst %,%/,$(patsubst %/,%,$(subdir-y)))
index 8c1a890631dd5d8e43a93f9f86b1aec42ccb2e5c..d4e507a06f0a2044e154e5bf6d854e2828a83dc1 100644 (file)
@@ -13,7 +13,7 @@ obj-y += bitops.o
 obj-bin-y += bzimage.init.o
 obj-bin-y += clear_page.o
 obj-bin-y += copy_page.o
-obj-y += compat.o
+obj-y += compat.o x86_64/compat.o
 obj-$(CONFIG_KEXEC) += crash.o
 obj-y += debug.o
 obj-y += delay.o
@@ -25,7 +25,6 @@ obj-y += domain_page.o
 obj-y += e820.o
 obj-y += extable.o
 obj-y += flushtlb.o
-obj-y += platform_hypercall.o
 obj-y += i387.o
 obj-y += i8259.o
 obj-y += io_apic.o
@@ -37,14 +36,15 @@ obj-y += microcode_amd.o
 obj-y += microcode_intel.o
 # This must come after the vendor specific files.
 obj-y += microcode.o
-obj-y += mm.o
+obj-y += mm.o x86_64/mm.o
 obj-y += monitor.o
 obj-y += mpparse.o
 obj-y += nmi.o
 obj-y += numa.o
 obj-y += pci.o
 obj-y += percpu.o
-obj-y += physdev.o
+obj-y += physdev.o x86_64/physdev.o
+obj-y += platform_hypercall.o x86_64/platform_hypercall.o
 obj-y += psr.o
 obj-y += setup.o
 obj-y += shutdown.o
index 7f8fb3de88629f7bac5cf2634dd87be23a6b6f90..d5af7224212cb93b4da04448b812de83d6c2002b 100644 (file)
@@ -2,7 +2,6 @@ subdir-y += compat
 
 obj-bin-y += entry.o
 obj-bin-y += gpr_switch.o
-obj-y += mm.o
 obj-y += traps.o
 obj-y += machine_kexec.o
 obj-y += pci.o
@@ -10,10 +9,7 @@ obj-y += acpi_mmcfg.o
 obj-y += mmconf-fam10h.o
 obj-y += mmconfig_64.o
 obj-y += mmconfig-shared.o
-obj-y += compat.o
 obj-y += domain.o
-obj-y += physdev.o
-obj-y += platform_hypercall.o
 obj-y += cpu_idle.o
 obj-y += cpufreq.o
 obj-bin-y += kexec_reloc.o
index 69b9aa096b96c87bda7581eaef74686fb9669284..f8f633b2a64f96c315c3f7087de9883ec9f7458f 100644 (file)
@@ -2,7 +2,8 @@
  * compat.c
  */
 
-#include <xen/config.h>
+asm(".file \"" __FILE__ "\"");
+
 #include <xen/hypercall.h>
 #include <compat/xen.h>
 #include <compat/physdev.h>
index d918002ce2d434b1fcdfcbd87893dbb97841d83a..bbbf8e3b8a61b8f3854a6134428583ae766b45ba 100644 (file)
@@ -16,7 +16,8 @@
  * with this program; If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <xen/config.h>
+asm(".file \"" __FILE__ "\"");
+
 #include <xen/lib.h>
 #include <xen/init.h>
 #include <xen/mm.h>
index d376cd04dd19f79e95c28ea3c6d2da6a982a2c11..c5a00ea93f398b703f623e69666f51dd55ef6cac 100644 (file)
@@ -2,7 +2,8 @@
  * physdev.c
  */
 
-#include <xen/config.h>
+asm(".file \"" __FILE__ "\"");
+
 #include <xen/types.h>
 #include <xen/guest_access.h>
 #include <compat/xen.h>
index ccfd30d67943e5d54d5506f1309cd9be69f3d33e..8fa2543a2d8ee82f12811a1e941236d454ef54be 100644 (file)
@@ -2,7 +2,8 @@
  * platform_hypercall.c
  */
 
-#include <xen/config.h>
+asm(".file \"" __FILE__ "\"");
+
 #include <xen/lib.h>
 #include <compat/platform.h>
 
index a7829db2586ae4b6096b081196a4b365c079fec3..3547c8e2ce433ca78a468423df69e6bbce70d7b2 100644 (file)
@@ -63,7 +63,7 @@ obj-$(perfc)       += perfc.o
 obj-$(crash_debug) += gdbstub.o
 obj-$(xenoprof)    += xenoprof.o
 
-subdir-$(CONFIG_COMPAT) += compat
+obj-$(CONFIG_COMPAT) += $(addprefix compat/,domain.o kernel.o memory.o multicall.o tmem_xen.o xlat.o)
 
 subdir-$(x86_64) += hvm
 
diff --git a/xen/common/compat/Makefile b/xen/common/compat/Makefile
deleted file mode 100644 (file)
index 1cf289a..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-obj-y += domain.o
-obj-y += kernel.o
-obj-y += memory.o
-obj-y += multicall.o
-obj-y += xlat.o
-obj-y += tmem_xen.o
index 157570a97e47daf1258592532f86c3921501ea70..c60d824aff736c5ddf6d1bfb0a20f7cdecaecedc 100644 (file)
@@ -3,7 +3,8 @@
  *
  */
 
-#include <xen/config.h>
+asm(".file \"" __FILE__ "\"");
+
 #include <xen/lib.h>
 #include <xen/sched.h>
 #include <xen/domain.h>
index 65cc25bd492203e712c3f3fdef3af18971348b77..df93fdd89c15a5af55bbcea4a4491ce2d54541a2 100644 (file)
@@ -2,7 +2,8 @@
  * kernel.c
  */
 
-#include <xen/config.h>
+asm(".file \"" __FILE__ "\"");
+
 #include <xen/init.h>
 #include <xen/lib.h>
 #include <xen/errno.h>
index 002948b673242a822eabc844c352b58ef3689354..bb10993f7ac6cd61bec85f02510c3ed9289f9e7b 100644 (file)
@@ -1,4 +1,5 @@
-#include <xen/config.h>
+asm(".file \"" __FILE__ "\"");
+
 #include <xen/types.h>
 #include <xen/hypercall.h>
 #include <xen/guest_access.h>
index 2af8aef8b7e1f1a0fe15c5a626b6e77ae432290e..43d2d8152dd2d88d5c1549d5484013e9c15dfa3c 100644 (file)
@@ -2,7 +2,8 @@
  * multicall.c
  */
 
-#include <xen/config.h>
+asm(".file \"" __FILE__ "\"");
+
 #include <xen/types.h>
 #include <xen/multicall.h>
 #include <xen/trace.h>
index 66641072948b7e426fdb98bc3b0b896bf0ba85b5..c674f7f1b9db2af3c38f98f813aed533e5d4387a 100644 (file)
@@ -58,7 +58,7 @@ compat/%.h: compat/%.i Makefile $(BASEDIR)/tools/compat-build-header.py
        mv -f $@.new $@
 
 compat/%.i: compat/%.c Makefile
-       $(CPP) $(filter-out -M% .%.d -include %/include/xen/config.h,$(CFLAGS)) $(cppflags-y) -o $@ $<
+       $(CPP) $(filter-out -M% %.d -include %/include/xen/config.h,$(CFLAGS)) $(cppflags-y) -o $@ $<
 
 compat/%.c: public/%.h xlat.lst Makefile $(BASEDIR)/tools/compat-build-source.py
        mkdir -p $(@D)