Bug #3172
openXen PV kernel broken when built with open source /usr/lib/cpp
0%
Description
Depending on whether 32 or 64-bit illumos Xen PV kernel is being built, cpp conditionals in usr/src/uts/common/xen/public/arch-x86/xen.h select the right xen-x86_XXX.h file to include (32 or 64-bit one) as can be seen here.
The first check is to see if __i386__ macro has been defined. If it is - 32-bit file is used. SmartOS and OmniOS both use open source cpp in /usr/lib. Its source can be found here. 64-bit header file is never used on the systems above as __i386__ is one of /usr/lib/cpp built-ins and is defined by default.
I propose making the change below to make 64-bit PV kernels usable when compiled with open source cpp in /usr/lib:
diff --git a/usr/src/uts/common/xen/public/arch-x86/xen.h b/usr/src/uts/common/xen/public/arch-x86/xen.h index d416387..a7ffd4f 100644 --- a/usr/src/uts/common/xen/public/arch-x86/xen.h +++ b/usr/src/uts/common/xen/public/arch-x86/xen.h @@ -49,7 +49,7 @@ #define get_xen_guest_handle(val, hnd) do { val = (hnd).p; } while (0) #endif -#if defined(__i386__) +#if defined(__i386) #include "xen-x86_32.h" #elif defined(__x86_64__) #include "xen-x86_64.h"
__i386 is undefined for 64-bit C compiler and assembler wrapper invocations and can be used instead of __i386__ to select the right include file.
Updated by Rich Lowe over 10 years ago
I have no idea why the compiler would be running the pre-ANSI cpp. Are you sure you have the root cause right?
Updated by Rich Lowe over 10 years ago
Though that said, a compatible cpp shouldn't be defining half of the stuff that cpp is willing to (including i386).