Skip to contentSkip to conversation

xen/stdarg.h patch

DISCUSSION John Levon 2 participants 5 messages Oct 18, 2006 – Oct 19, 2006

lore
Share & tools
lore

John Levon

author
#0 lore raw

I should have tested my suggestion. Unfortunately the standard stdarg.h on Solaris needs to include other files in /usr/include/. The current patch we have just uses gcc's stdarg.h in xen/include/xen/stdarg.h. Keir, would you take such a change?

regards
john

#1 lore raw
Quoted 4 lines · John Levon

I should have tested my suggestion. Unfortunately the standard stdarg.h on Solaris needs to include other files in /usr/include/. The current patch we have just uses gcc's stdarg.h in xen/include/xen/stdarg.h. Keir, would you take such a change?

#includes it, or includes it verbatim? The latter is a bit suspect, but I suppose okay if it's obviously solaris-specific code. Is there no CFLAG magic that can make <stdarg.h> work for you? My suspicion is that gcc handles it a bit 'specially' when it runs on Linux.

-- Keir

author
#2 lore raw
Quoted 4 lines · Keir Fraser
Quoted 2 lines

patch we have just uses gcc's stdarg.h in xen/include/xen/stdarg.h. Keir, would you take such a change?

#includes it, or includes it verbatim? The latter is a bit suspect, but I

Verbatim. My patch just replaces xen/stdarg.h with gcc's.

Quoted 2 lines

suppose okay if it's obviously solaris-specific code. Is there no CFLAG magic that can make <stdarg.h> work for you?

Only by adding "-I /usr/include/", and that doesn't seem ideal.

regards,
john

#3 lore raw
Quoted 4 lines · John Levon
Quoted 2 lines

suppose okay if it's obviously solaris-specific code. Is there no CFLAG magic that can make <stdarg.h> work for you?

Only by adding "-I /usr/include/", and that doesn't seem ideal.

Perhaps acceptable if it works? We generally like to avoid it because it prevents us accidentally including system header files. If we need it just for Solaris it's not so bad though -- our main build environment (Linux) will continue to provide a safety net.

-- Keir

author
#4 lore raw
Quoted 6 lines · Keir Fraser
Quoted 1 line

Only by adding "-I /usr/include/", and that doesn't seem ideal.

Perhaps acceptable if it works? We generally like to avoid it because it prevents us accidentally including system header files. If we need it just for Solaris it's not so bad though -- our main build environment (Linux) will continue to provide a safety net.

Fair point.

regards
john

# HG changeset patch
# User [email protected]
# Date 1161272148 25200
# Node ID 73d8a4df0f0b0d5747f5937f5954a5302a9e2f74
# Parent 2e1a04af35cf4bc43dc6f0cde4539c5117fa500f Disable -nostdinc on Solaris so we can use the system's <stdarg.h>.

config/StdGNU.mk +2 -0
@@ -21,6 +21,8 @@ SONAME_LDFLAG = -soname
 SONAME_LDFLAG = -soname
 SHLIB_CFLAGS = -shared
 
+STDINC_CFLAG = -nostdinc
+
 ifneq ($(debug),y)
 # Optimisation flags are overridable
 CFLAGS ?= -O2 -fomit-frame-pointer
config/SunOS.mk +3 -0
@@ -33,4 +33,7 @@ endif
 
 CFLAGS += -Wa,--divide -D_POSIX_C_SOURCE=200112L -D__EXTENSIONS__
 
+# We can't use -nostdinc, as Xen needs <stdarg.h>
+STDINC_CFLAG =
+
 CONFIG_IOEMU_OS = n
xen/arch/x86/Rules.mk +1 -1
@@ -11,7 +11,7 @@ pae ?= n
 pae ?= n
 supervisor_mode_kernel ?= n
 
-CFLAGS += -nostdinc -fno-builtin -fno-common -fno-strict-aliasing
+CFLAGS += $(STDINC_CFLAG) -fno-builtin -fno-common -fno-strict-aliasing
 CFLAGS += -iwithprefix include -Werror -Wno-pointer-arith -pipe
 CFLAGS += -I$(BASEDIR)/include 
 CFLAGS += -I$(BASEDIR)/include/asm-x86/mach-generic
xen/include/xen/stdarg.h +1 -1
@@ -1,4 +1,4 @@
-#if defined(__OpenBSD__) || defined(__sun__)
+#if defined(__OpenBSD__)
 #  include "/usr/include/stdarg.h"
 #else
 #  include <stdarg.h>