[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] shim: Fix generation of compat/callback.i: allow redef of OBJECT vars



When cross-compiling for x86 with gcc 8.1, the generation of
compat/callback.i fails due to the redefinition of __OBJECT_FILE__ and
__OBJECT_LABEL__ variables on the compiler command line during the shim
build:

| <command-line>: error: "__OBJECT_FILE__" redefined [-Werror]
| <command-line>: note: this is the location of the previous definition
| <command-line>: error: "__OBJECT_LABEL__" redefined [-Werror]
| <command-line>: note: this is the location of the previous definition
| cc1: all warnings being treated as errors
| Makefile:69: recipe for target 'compat/callback.i' failed

__OBJECT_LABEL__ is already unset-before-set in one location where it is
defined in xen/arch/x86/Rules.mk ; this patch applies the same to the
other define site in the same file.

__OBJECT_FILE__ is handled similarly: an undefine statement is added
before its definition in xen/Rules.mk

Signed-off-by: Christopher Clark <christopher.clark6@xxxxxxxxxxxxxx>
---
Please use my gmail address for any correspondence to me.

Behaviour encountered when building with the OpenEmbedded cross-compile
toolchain, with each of Xen 4.10.1, 4.11.0 and the current staging branch.

Example (fairly horrible) command line extracted from logs prior to applying
this patch where the multiple definitions can be seen:
(nb: filesystem paths have been edited for privacy)
(nb: single command line has been text wrapped to make mail client happier)

| x86_64-poky-linux-gcc -E
--sysroot=..../poky/build/tmp/work/core2-64-poky-linux/xen/4.12+gitAUTOINC+773b86303f-r0/recipe-sysroot
-m64 -march=core2 -mtune=core2 -msse3 -O2 -pipe -g
-feliminate-unused-debug-types
-fdebug-prefix-map=/....poky/build/tmp/work/core2-64-poky-linux/xen/4.12+gitAUTOINC+773b86303f-r0=/usr/src/debug/xen/4.12+gitAUTOINC+773b86303f-r0
-fdebug-prefix-map=/....poky/build/tmp/work/core2-64-poky-linux/xen/4.12+gitAUTOINC+773b86303f-r0/recipe-sysroot=
-fdebug-prefix-map=/....poky/build/tmp/work/core2-64-poky-linux/xen/4.12+gitAUTOINC+773b86303f-r0/recipe-sysroot-native=
-m64 -DBUILD_ID -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes
-Wdeclaration-after-statement -Wno-unused-but-set-variable
-Wno-unused-local-typedefs -m64 -DBUILD_ID -fno-strict-aliasing -std=gnu99 -Wall
-Wstrict-prototypes -Wdeclaration-after-statement -Wno-unused-but-set-variable
-Wno-unused-local-typedefs -O2 -fomit-frame-pointer
-D__XEN_INTERFACE_VERSION__=__XEN_LATEST_INTERFACE_VERSION__ -D_LARGEFILE_SOURCE
-D_LARGEFILE64_SOURCE -m64 -DBUILD_ID -fno-strict-aliasing -std=gnu99 -Wall
-Wstrict-prototypes -Wdeclaration-after-statement -Wno-unused-but-set-variable
-Wno-unused-local-typedefs -O2 -fomit-frame-pointer
-D__XEN_INTERFACE_VERSION__=__XEN_LATEST_INTERFACE_VERSION__ -D_LARGEFILE_SOURCE
-D_LARGEFILE64_SOURCE -m64 -DBUILD_ID -fno-strict-aliasing -std=gnu99 -Wall
-Wstrict-prototypes -Wdeclaration-after-statement -Wno-unused-but-set-variable
-Wno-unused-local-typedefs -O2 -fomit-frame-pointer
-D__XEN_INTERFACE_VERSION__=__XEN_LATEST_INTERFACE_VERSION__ -D_LARGEFILE_SOURCE
-D_LARGEFILE64_SOURCE -m64 -DBUILD_ID -fno-strict-aliasing -std=gnu99 -Wall
-Wstrict-prototypes -Wdeclaration-after-statement -Wno-unused-but-set-variable
-Wno-unused-local-typedefs -O2 -fomit-frame-pointer
-D__XEN_INTERFACE_VERSION__=__XEN_LATEST_INTERFACE_VERSION__ -D_LARGEFILE_SOURCE
-D_LARGEFILE64_SOURCE -m64 -DBUILD_ID -fno-strict-aliasing -std=gnu99 -Wall
-Wstrict-prototypes -Wdeclaration-after-statement -Wno-unused-but-set-variable
-Wno-unused-local-typedefs -O2 -fomit-frame-pointer
-D__XEN_INTERFACE_VERSION__=__XEN_LATEST_INTERFACE_VERSION__ -D_LARGEFILE_SOURCE
-D_LARGEFILE64_SOURCE -m64 -DBUILD_ID -fno-strict-aliasing -std=gnu99 -Wall
-Wstrict-prototypes -Wdeclaration-after-statement -Wno-unused-but-set-variable
-Wno-unused-local-typedefs -O2 -fomit-frame-pointer
-D__XEN_INTERFACE_VERSION__=__XEN_LATEST_INTERFACE_VERSION__ -D_LARGEFILE_SOURCE
-D_LARGEFILE64_SOURCE -m64 -DBUILD_ID -fno-strict-aliasing -std=gnu99 -Wall
-Wstrict-prototypes -Wdeclaration-after-statement -Wno-unused-but-set-variable
-Wno-unused-local-typedefs -m64 -DBUILD_ID -fno-strict-aliasing -std=gnu99 -Wall
-Wstrict-prototypes -Wdeclaration-after-statement -Wno-unused-but-set-variable
-Wno-unused-local-typedefs -O2 -fomit-frame-pointer -nostdinc -fno-builtin
-fno-common -Werror -Wredundant-decls -Wno-pointer-arith -pipe -g -D__XEN__
'-D__OBJECT_FILE__="/....poky/build/tmp/work/core2-64-poky-linux/xen/4.12+gitAUTOINC+773b86303f-r0/git/tools/firmware/xen-dir/xen-root/xen/xen"'
-I/....poky/build/tmp/work/core2-64-poky-linux/xen/4.12+gitAUTOINC+773b86303f-r0/git/tools/firmware/xen-dir/xen-root/xen/include
-I/....poky/build/tmp/work/core2-64-poky-linux/xen/4.12+gitAUTOINC+773b86303f-r0/git/tools/firmware/xen-dir/xen-root/xen/include/asm-x86/mach-generic
-I/....poky/build/tmp/work/core2-64-poky-linux/xen/4.12+gitAUTOINC+773b86303f-r0/git/tools/firmware/xen-dir/xen-root/xen/include/asm-x86/mach-default
-DXEN_IMG_OFFSET=0x200000
'-D__OBJECT_LABEL__=ntuildxctopher_oeootfsomeuild_vokyuildmporkore2_64_poky_linuxen.12+gitAUTOINC+773b86303f_r0itoolsirmwareen_diren_rooten$mntuildxctopher_oeootfsomeuild_vokyuildmporkore2_64_poky_linuxen.12+gitAUTOINC+773b86303f_r0itoolsirmwareen_diren_rootenen'
-msoft-float -fno-stack-protector -fno-exceptions -Wnested-externs -DHAVE_AS_VMX
-DHAVE_AS_SSE4_2 -DHAVE_AS_EPT -DHAVE_AS_RDRAND -DHAVE_AS_FSGSBASE
-DHAVE_AS_RDSEED -U__OBJECT_LABEL__ -DHAVE_AS_QUOTED_SYM
'-D__OBJECT_LABEL__=/....poky/build/tmp/work/core2-64-poky-linux/xen/4.12+gitAUTOINC+773b86303f-r0/git/tools/firmware/xen-dir/xen-root/xen//....poky/build/tmp/work/core2-64-poky-linux/xen/4.12+gitAUTOINC+773b86303f-r0/git/tools/firmware/xen-dir/xen-root/xen/xen'
-DHAVE_AS_INVPCID -DHAVE_AS_NEGATIVE_TRUE -mno-red-zone -fpic
-fno-asynchronous-unwind-tables -mno-sse -mskip-rax-setup
-DGCC_HAS_VISIBILITY_ATTRIBUTE -mindirect-branch=thunk-extern
-mindirect-branch-register -DCONFIG_INDIRECT_THUNK -m64 -DBUILD_ID
-fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes
-Wdeclaration-after-statement -Wno-unused-but-set-variable
-Wno-unused-local-typedefs -m64 -DBUILD_ID -fno-strict-aliasing -std=gnu99 -Wall
-Wstrict-prototypes -Wdeclaration-after-statement -Wno-unused-but-set-variable
-Wno-unused-local-typedefs -O2 -fomit-frame-pointer -nostdinc -fno-builtin
-fno-common -Werror -Wredundant-decls -Wno-pointer-arith -pipe -g -D__XEN__
'-D__OBJECT_FILE__="compat/callback.i"'
-I/....poky/build/tmp/work/core2-64-poky-linux/xen/4.12+gitAUTOINC+773b86303f-r0/git/tools/firmware/xen-dir/xen-root/xen/include
-I/....poky/build/tmp/work/core2-64-poky-linux/xen/4.12+gitAUTOINC+773b86303f-r0/git/tools/firmware/xen-dir/xen-root/xen/include/asm-x86/mach-generic
-I/....poky/build/tmp/work/core2-64-poky-linux/xen/4.12+gitAUTOINC+773b86303f-r0/git/tools/firmware/xen-dir/xen-root/xen/include/asm-x86/mach-default
-DXEN_IMG_OFFSET=0x200000 '-D__OBJECT_LABEL__=include$compat$callback.i'
-msoft-float -fno-stack-protector -fno-exceptions -Wnested-externs
-DHAVE_AS_NEGATIVE_TRUE -mno-red-zone -fpic -fno-asynchronous-unwind-tables
-mno-sse -mskip-rax-setup -DGCC_HAS_VISIBILITY_ATTRIBUTE
-mindirect-branch=thunk-extern -mindirect-branch-register
-DCONFIG_INDIRECT_THUNK -m64 -DBUILD_ID -fno-strict-aliasing -std=gnu99 -Wall
-Wstrict-prototypes -Wdeclaration-after-statement -Wno-unused-but-set-variable
-Wno-unused-local-typedefs -include public/xen-compat.h
-DXEN_GENERATING_COMPAT_HEADERS -m32 -o compat/callback.i compat/callback.c


 xen/Rules.mk          | 1 +
 xen/arch/x86/Rules.mk | 1 +
 2 files changed, 2 insertions(+)

diff --git a/xen/Rules.mk b/xen/Rules.mk
index 5337e20..9f122cd 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -55,6 +55,7 @@ endif
 CFLAGS += -nostdinc -fno-builtin -fno-common
 CFLAGS += -Werror -Wredundant-decls -Wno-pointer-arith
 CFLAGS += -pipe -g -D__XEN__ -include $(BASEDIR)/include/xen/config.h
+CFLAGS += '-U__OBJECT_FILE__'
 CFLAGS += '-D__OBJECT_FILE__="$@"'
 
 ifneq ($(clang),y)
diff --git a/xen/arch/x86/Rules.mk b/xen/arch/x86/Rules.mk
index ac585a3..bf1d94d 100644
--- a/xen/arch/x86/Rules.mk
+++ b/xen/arch/x86/Rules.mk
@@ -7,6 +7,7 @@ CFLAGS += -I$(BASEDIR)/include
 CFLAGS += -I$(BASEDIR)/include/asm-x86/mach-generic
 CFLAGS += -I$(BASEDIR)/include/asm-x86/mach-default
 CFLAGS += -DXEN_IMG_OFFSET=$(XEN_IMG_OFFSET)
+CFLAGS += '-U__OBJECT_LABEL__'
 CFLAGS += '-D__OBJECT_LABEL__=$(subst /,$$,$(subst -,_,$(subst 
$(BASEDIR)/,,$(CURDIR))/$@))'
 
 # Prevent floating-point variables from creeping into Xen.
-- 
2.7.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.