Skip to contentSkip to conversation

shim: Fix generation of compat/callback.i: allow redef of OBJECT vars

PATCH In review Christopher Clark 4 participants 9 messages Jul 18, 2018 – Jul 20, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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

---
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(+)
xen/Rules.mk +1 -0
index 5337e20..9f122cd 100644
@@ -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)
xen/arch/x86/Rules.mk +1 -0
index ac585a3..bf1d94d 100644
@@ -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.
Signature · 7 lines
2.7.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 19.07.18 at 01:33, <[email protected]> wrote:

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:

Quoted 6 lines
| <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

First of all, as to the title - is this really just affecting callback.i? If so, why? If not, the title should be generalized.

Quoted 6 lines

__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

Now what you fail to explain is what these double definitions result from. Understanding that my suggest alternative approaches to addressing the issue. For example there may me undue propagation of CFLAGS at some layer.

Quoted 3 lines

---
Please use my gmail address for any correspondence to me.

I think it is generally considered bad practice to have From: and S-o-b differ.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#2 lore raw
Quoted 6 lines · Jan Beulich
Quoted 3 lines

---
Please use my gmail address for any correspondence to me.

I think it is generally considered bad practice to have From: and S-o-b differ.

Why? That is perfectly fine. Signed-off-by is about copyright of the code while From: is about authorship. Moreover, it is still possible to specify an alternative From: as first line of the body. So Christopher could:

From: Christopher Clark <[email protected]> (the email header)
From: Christopher Clark <[email protected]> (in the body)

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#3 lore raw
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines

Stefano Stabellini <[email protected]> 07/19/18 7:00 PM >>>

Quoted 4 lines · Jan Beulich
Quoted 3 lines

---
Please use my gmail address for any correspondence to me.

Quoted 5 lines
Quoted 2 lines

I think it is generally considered bad practice to have From: and S-o-b differ.

Why? That is perfectly fine. Signed-off-by is about copyright of the code while From: is about authorship.

Well, in this particular case Christopher had even asked that communication to go to the mail address he sent from. How is anyone going to know that if judging just from the eventual commit in git?

Besides that - how does anyone know whether the two are actually addresses of the same person?

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#4 lore raw
Quoted 9 lines · Jan Beulich
Quoted 9 lines
Quoted 1 line
Quoted 1 line

Stefano Stabellini <[email protected]> 07/19/18 7:00 PM >>>

Quoted 6 lines · Jan Beulich
Quoted 3 lines

---
Please use my gmail address for any correspondence to me.

I think it is generally considered bad practice to have From: and S-o-b differ.

Quoted 6 lines
Quoted 2 lines

Why? That is perfectly fine. Signed-off-by is about copyright of the code while From: is about authorship.

Well, in this particular case Christopher had even asked that communication to go to the mail address he sent from. How is anyone going to know that if judging just from the eventual commit in git?

Yeah, that bit of information is lost in the commit message, unfortunately. At that point, the patch is already committed, so it is usually not a big deal.

Quoted 2 lines

Besides that - how does anyone know whether the two are actually addresses of the same person?

I don't think they have to be the same person. What matters is the Signed-off-by line, the author is only to give credits to whom did the work. It could be a pseudonym. While the Signed-off-by has to be a real person.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#5 lore raw
Quoted 18 lines · Stefano Stabellini
Quoted 5 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line

Stefano Stabellini <[email protected]> 07/19/18 7:00 PM >>>

Quoted 3 lines · Jan Beulich
Quoted 3 lines

---
Please use my gmail address for any correspondence to me.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

I think it is generally considered bad practice to have From: and S-o-b differ.

Why? That is perfectly fine. Signed-off-by is about copyright of the code while From: is about authorship.

Well, in this particular case Christopher had even asked that communication to go to the mail address he sent from. How is anyone going to know that if judging just from the eventual commit in git?

Yeah, that bit of information is lost in the commit message, unfortunately. At that point, the patch is already committed, so it is usually not a big deal.

Quoted 6 lines
Quoted 2 lines

Besides that - how does anyone know whether the two are actually addresses of the same person?

I don't think they have to be the same person. What matters is the Signed-off-by line, the author is only to give credits to whom did the work. It could be a pseudonym. While the Signed-off-by has to be a real person.

In particular, it is common for employees of companies with broken/draconian mail/firewall policies (or simply just Exchange) to email from gmail, with SoB referring to their proper company email address.

You'll notice that there large number of contributions to Linux which follow this style.

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#6 lore raw
In reply to Stefano Stabellini
Quoted 14 lines
Quoted 1 line
Quoted 1 line

Stefano Stabellini <[email protected]> 07/19/18 8:49 PM >>>

Quoted 12 lines · Jan Beulich
Quoted 11 lines
Quoted 1 line
Quoted 1 line

Stefano Stabellini <[email protected]> 07/19/18 7:00 PM >>>

Quoted 6 lines · Jan Beulich
Quoted 3 lines

---
Please use my gmail address for any correspondence to me.

I think it is generally considered bad practice to have From: and S-o-b differ.

Why? That is perfectly fine. Signed-off-by is about copyright of the code while From: is about authorship.

Quoted 7 lines
Quoted 3 lines

Well, in this particular case Christopher had even asked that communication to go to the mail address he sent from. How is anyone going to know that if judging just from the eventual commit in git?

Yeah, that bit of information is lost in the commit message, unfortunately. At that point, the patch is already committed, so it is usually not a big deal.

What if there is an issue with the change, or simply a question about it? I'd expect to be able to get in touch with the author by using the provided email address, at least if the commit isn't overly old yet.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#7 lore raw
Quoted 18 lines · Jan Beulich
Quoted 18 lines
Quoted 1 line
Quoted 1 line

Stefano Stabellini <[email protected]> 07/19/18 8:49 PM >>>

Quoted 15 lines · Jan Beulich
Quoted 11 lines
Quoted 1 line
Quoted 1 line

Stefano Stabellini <[email protected]> 07/19/18 7:00 PM >>>

Quoted 6 lines · Jan Beulich
Quoted 3 lines

---
Please use my gmail address for any correspondence to me.

I think it is generally considered bad practice to have From: and S-o-b differ.

Why? That is perfectly fine. Signed-off-by is about copyright of the code while From: is about authorship.

Well, in this particular case Christopher had even asked that communication to go to the mail address he sent from. How is anyone going to know that if judging just from the eventual commit in git?

Quoted 7 lines
Quoted 3 lines

Yeah, that bit of information is lost in the commit message, unfortunately. At that point, the patch is already committed, so it is usually not a big deal.

What if there is an issue with the change, or simply a question about it? I'd expect to be able to get in touch with the author by using the provided email address, at least if the commit isn't overly old yet.

Thinking about it, the From: email address will end up in the Author:
field of the commit. So actually, the information will be retained.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#8 lore raw

On Thu, Jul 19, 2018 at 12:34 PM, Stefano Stabellini <[email protected]

Quoted 29 lines

wrote:

Quoted 5 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line

Stefano Stabellini <[email protected]> 07/19/18 8:49 PM >>>

Quoted 3 lines · Jan Beulich
Quoted 3 lines
Quoted 1 line
Quoted 1 line

Stefano Stabellini <[email protected]> 07/19/18 7:00 PM >>>

Quoted 1 line · Jan Beulich
Quoted 1 line

baesystems.com>

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

---
Please use my gmail address for any correspondence to me.

I think it is generally considered bad practice to have From: and

S-o-b

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 1 line

differ.

Why? That is perfectly fine. Signed-off-by is about copyright of the code while From: is about authorship.

Well, in this particular case Christopher had even asked that

communication

Quoted 1 line
Quoted 1 line
Quoted 1 line

to go to the mail address he sent from. How is anyone going to know

that if

Quoted 6 lines
Quoted 5 lines
Quoted 1 line

judging just from the eventual commit in git?

Yeah, that bit of information is lost in the commit message, unfortunately. At that point, the patch is already committed, so it is usually not a big deal.

Quoted 8 lines
Quoted 2 lines

What if there is an issue with the change, or simply a question about it? I'd expect to be able to get in touch with the author by using the

provided

Quoted 1 line

email address, at least if the commit isn't overly old yet.

Thinking about it, the From: email address will end up in the Author:
field of the commit. So actually, the information will be retained.

Thanks for the group input on the From/Author and S-o-b identifiers.

Context on the constraints which lead to the structure of my original message on this thread:

* Email message source:

My messages are sent to the list from my gmail account as that's the one I have easiest access to from my development environment. Shouldn't be a concern as I'm easily reachable there and as Stefano pointed out, inclusion of an alternate 'From:' in within the message body is enough to change the git 'Author' if the patch is merged.

* Commit Author:

I can provide either address for the From/Author address for the commit.

My preference is for it being the address I am reliably reachable at -- which would be my gmail account as noted. My reachability at this email address has exceeded that of any other email address I have ever had, surviving multiple changes of organizational affiliation.

* Commit Signed-off-by:

I have a legal requirement to ensure that copyright is attributed for the work, and I have used the S-o-b address to do so. In the patch I sent, the email address provided for the S-o-b is under the administrative control of the legal owner of the copyright, which seems appropriate for it.

I could change the S-o-b to match the From/Author, and add further language to the commit message to clarify copyright attribution, but that seems incorrect and would require further effort to support any automation for eg. harvesting community contribution statistics.

Re: Jan's feedback on the patch content:

The hint to CFLAGS was helpful, thanks, as this double define is indeed being triggered when CFLAGS is not cleared, so: this patch isn't necessary.

I still haven't quite determined why a top level "make install" triggers a "make -C xen-root/xen distclean", which then causes further compilation to be performed, in what should be an install-only step, which made this other behaviour visible (since in the cross-compile system I'm working with, CFLAGS is being explicitly cleared for the "make" but happened not to be for "make install").

It's also been brought to my attention that this isn't the first time this undefine has been proposed on this list -- so apologies for the revisit.

thanks,

Christopher

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel