James Carter
2011-Sep-14  15:15 UTC
[Xen-devel][PATCH] xen/xsm: Compile error due to naming clash between XSM and EFI runtime
While compiling XEN with XSM_ENABLE=y and FLASK_ENABLE=y, I received the
following error.
gcc -O1 -fno-omit-frame-pointer -m64 -g -fno-strict-aliasing -std=gnu99 -Wall
-Wstrict-prototypes -Wno-unused-value -Wdeclaration-after-statement
-Wno-unused-but-set-variable  -fno-builtin -fno-common -Wredundant-decls
-iwithprefix include -Werror -Wno-pointer-arith -pipe
-I/home/jwcart2/src/xen/my-xen-unstable/xen/include 
-I/home/jwcart2/src/xen/my-xen-unstable/xen/include/asm-x86/mach-generic
-I/home/jwcart2/src/xen/my-xen-unstable/xen/include/asm-x86/mach-default
-msoft-float -fno-stack-protector -fno-exceptions -Wnested-externs -mno-red-zone
-fpic -fno-asynchronous-unwind-tables -DGCC_HAS_VISIBILITY_ATTRIBUTE
-fno-optimize-sibling-calls -nostdinc -g -D__XEN__ -DXSM_ENABLE -DFLASK_ENABLE
-DXSM_MAGIC=0xf97cff8c -DFLASK_DEVELOP -DFLASK_BOOTPARAM -DFLASK_AVC_STATS
-DVERBOSE -fno-omit-frame-pointer -DCONFIG_FRAME_POINTER -MMD -MF
.platform_hypercall.o.d -c platform_hypercall.c -o platform_hypercall.o
In file included from ../platform_hypercall.c:33:0,
                 from platform_hypercall.c:38:
/home/jwcart2/src/xen/my-xen-unstable/xen/include/xsm/xsm.h: In function
‘xsm_efi_runtime_call’:
/home/jwcart2/src/xen/my-xen-unstable/xen/include/xsm/xsm.h:559:19: error:
‘struct xsm_operations’ has no member named ‘efi_compat_runtime_call’
cc1: warnings being treated as errors
/home/jwcart2/src/xen/my-xen-unstable/xen/include/xsm/xsm.h:560:1: error:
control reaches end of non-void function
make[5]: *** [platform_hypercall.o] Error 1
make[5]: Leaving directory
`/home/jwcart2/src/xen/my-xen-unstable/xen/arch/x86/x86_64''
make[4]: *** [x86_64/built_in.o] Error 2
The problem is that efi_runtime_call is the name of both a function in
xen/arch/x86/efi/runtime.c and a member of the xsm_operations struct in
xen/include/xsm/xsm.h. This causes the macro "#define
efi_runtime_call(x) efi_compat_runtime_call(x)" on line 15 of
xen/arch/x86/x86_64/platform_hypercall.c to cause the above compile
error. (At least, that is what I think is happening.)
Renaming the XSM struct member fixes the problem.
Signed-off-by: James Carter <jwcart2@tycho.nsa.gov>
---
 arch/x86/platform_hypercall.c |    2 +-
 include/xsm/xsm.h             |    6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
diff -r 0312575dc35e xen/arch/x86/platform_hypercall.c
--- a/xen/arch/x86/platform_hypercall.c	Thu Sep 08 15:13:06 2011 +0100
+++ b/xen/arch/x86/platform_hypercall.c	Wed Sep 14 09:48:25 2011 -0400
@@ -306,7 +306,7 @@
         break;
 
     case XENPF_efi_runtime_call:
-        ret = xsm_efi_runtime_call();
+        ret = xsm_efi_call();
         if ( ret )
             break;
 
diff -r 0312575dc35e xen/include/xsm/xsm.h
--- a/xen/include/xsm/xsm.h	Thu Sep 08 15:13:06 2011 +0100
+++ b/xen/include/xsm/xsm.h	Wed Sep 14 09:48:25 2011 -0400
@@ -132,7 +132,7 @@
     int (*physinfo) (void);
     int (*platform_quirk) (uint32_t);
     int (*firmware_info) (void);
-    int (*efi_runtime_call) (void);
+    int (*efi_call) (void);
     int (*acpi_sleep) (void);
     int (*change_freq) (void);
     int (*getidletime) (void);
@@ -554,9 +554,9 @@
     return xsm_call(firmware_info());
 }
 
-static inline int xsm_efi_runtime_call (void)
+static inline int xsm_efi_call (void)
 {
-    return xsm_call(efi_runtime_call());
+    return xsm_call(efi_call());
 }
 
 static inline int xsm_acpi_sleep (void)
-- 
James Carter <jwcart2@tycho.nsa.gov>
National Security Agency
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Jan Beulich
2011-Sep-14  15:32 UTC
Re: [Xen-devel][PATCH] xen/xsm: Compile error due to naming clash between XSM and EFI runtime
>>> On 14.09.11 at 17:15, James Carter <jwcart2@tycho.nsa.gov> wrote: > While compiling XEN with XSM_ENABLE=y and FLASK_ENABLE=y, I received the > following error. > > gcc -O1 -fno-omit-frame-pointer -m64 -g -fno-strict-aliasing -std=gnu99 > -Wall -Wstrict-prototypes -Wno-unused-value -Wdeclaration-after-statement > -Wno-unused-but-set-variable -fno-builtin -fno-common -Wredundant-decls > -iwithprefix include -Werror -Wno-pointer-arith -pipe > -I/home/jwcart2/src/xen/my-xen-unstable/xen/include > -I/home/jwcart2/src/xen/my-xen-unstable/xen/include/asm-x86/mach-generic > -I/home/jwcart2/src/xen/my-xen-unstable/xen/include/asm-x86/mach-default > -msoft-float -fno-stack-protector -fno-exceptions -Wnested-externs > -mno-red-zone -fpic -fno-asynchronous-unwind-tables > -DGCC_HAS_VISIBILITY_ATTRIBUTE -fno-optimize-sibling-calls -nostdinc -g > -D__XEN__ -DXSM_ENABLE -DFLASK_ENABLE -DXSM_MAGIC=0xf97cff8c -DFLASK_DEVELOP > -DFLASK_BOOTPARAM -DFLASK_AVC_STATS -DVERBOSE -fno-omit-frame-pointer > -DCONFIG_FRAME_POINTER -MMD -MF .platform_hypercall.o.d -c > platform_hypercall.c -o platform_hypercall.o > In file included from ../platform_hypercall.c:33:0, > from platform_hypercall.c:38: > /home/jwcart2/src/xen/my-xen-unstable/xen/include/xsm/xsm.h: In function > ‘xsm_efi_runtime_call’: > /home/jwcart2/src/xen/my-xen-unstable/xen/include/xsm/xsm.h:559:19: error: > ‘struct xsm_operations’ has no member named ‘efi_compat_runtime_call’ > cc1: warnings being treated as errors > /home/jwcart2/src/xen/my-xen-unstable/xen/include/xsm/xsm.h:560:1: error: > control reaches end of non-void function > make[5]: *** [platform_hypercall.o] Error 1 > make[5]: Leaving directory > `/home/jwcart2/src/xen/my-xen-unstable/xen/arch/x86/x86_64'' > make[4]: *** [x86_64/built_in.o] Error 2 > > > The problem is that efi_runtime_call is the name of both a function in > xen/arch/x86/efi/runtime.c and a member of the xsm_operations struct in > xen/include/xsm/xsm.h. This causes the macro "#define > efi_runtime_call(x) efi_compat_runtime_call(x)" on line 15 of > xen/arch/x86/x86_64/platform_hypercall.c to cause the above compile > error. (At least, that is what I think is happening.) > > Renaming the XSM struct member fixes the problem. > > Signed-off-by: James Carter <jwcart2@tycho.nsa.gov>Acked-by: Jan Beulich <jbeulich@suse.com>> --- > > arch/x86/platform_hypercall.c | 2 +- > include/xsm/xsm.h | 6 +++--- > 2 files changed, 4 insertions(+), 4 deletions(-) > > diff -r 0312575dc35e xen/arch/x86/platform_hypercall.c > --- a/xen/arch/x86/platform_hypercall.c Thu Sep 08 15:13:06 2011 +0100 > +++ b/xen/arch/x86/platform_hypercall.c Wed Sep 14 09:48:25 2011 -0400 > @@ -306,7 +306,7 @@ > break; > > case XENPF_efi_runtime_call: > - ret = xsm_efi_runtime_call(); > + ret = xsm_efi_call(); > if ( ret ) > break; > > diff -r 0312575dc35e xen/include/xsm/xsm.h > --- a/xen/include/xsm/xsm.h Thu Sep 08 15:13:06 2011 +0100 > +++ b/xen/include/xsm/xsm.h Wed Sep 14 09:48:25 2011 -0400 > @@ -132,7 +132,7 @@ > int (*physinfo) (void); > int (*platform_quirk) (uint32_t); > int (*firmware_info) (void); > - int (*efi_runtime_call) (void); > + int (*efi_call) (void); > int (*acpi_sleep) (void); > int (*change_freq) (void); > int (*getidletime) (void); > @@ -554,9 +554,9 @@ > return xsm_call(firmware_info()); > } > > -static inline int xsm_efi_runtime_call (void) > +static inline int xsm_efi_call (void) > { > - return xsm_call(efi_runtime_call()); > + return xsm_call(efi_call()); > } > > static inline int xsm_acpi_sleep (void) > > > -- > James Carter <jwcart2@tycho.nsa.gov> > National Security Agency_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel