WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH] xen: Deal with stdarg.h and -nostdinc

To: Keir Fraser <keir.xen@xxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] xen: Deal with stdarg.h and -nostdinc
From: Christoph Egger <Christoph.Egger@xxxxxxx>
Date: Fri, 27 May 2011 09:55:59 +0200
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
Delivery-date: Fri, 27 May 2011 00:56:53 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <CA04479A.1B2D0%keir.xen@xxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <CA04479A.1B2D0%keir.xen@xxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; NetBSD amd64; en-US; rv:1.9.2.17) Gecko/20110523 Lightning/1.0b3pre Thunderbird/3.1.10
On 05/26/11 19:08, Keir Fraser wrote:
On 26/05/2011 17:11, "Ian Jackson"<Ian.Jackson@xxxxxxxxxxxxx>  wrote:

Christoph Egger writes ("[Xen-devel] [PATCH] xen: Deal with stdarg.h and
-nostdinc"):
For compiling the xen kernel we use -nostdinc which means
we don't want to rely on any external headers.
That also counts vor stdarg.h.

Right, OK, but:

Not really. We are only doing the same as Linux right now. I do note that
they add an -isystem option to their command line, with a gcc include path
that they presumably dump out of gcc in some standard way. However, our
current approach seems to work, if it fails to work in some situation it is
likely to be pretty obvious (build or link failure), and we can fix it then.

The cross-compiling facility in NetBSD has been further improved which
made gcc more pendantic for this. -nostdinc is used and -isystem is *not* used.

This stuff can be moderately fragile, and we've now had no actual bug
reports about it in a long while.

Here is a full error message:

gcc -O2 -I/usr/include -I/usr/pkg/include -O2 -fomit-frame-pointer -m64 -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wno-unused-value -Wdeclaration-after-statement -O2 -fomit-frame-pointer -m64 -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wno-unused-value -Wdeclaration-after-statement -O2 -fomit-frame-pointer -m64 -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wno-unused-value -Wdeclaration-after-statement -DNDEBUG -nostdinc -fno-builtin -fno-common -Wredundant-decls -iwithprefix include -Werror -Wno-pointer-arith -pipe -I/tmp/pkgsrc-obj/sysutils/xenkernel41/work.ixp/xen-4.1.0/xen/include -I/tmp/pkgsrc-obj/sysutils/xenkernel41/work.ixp/xen-4.1.0/xen/include/asm-x86/mach-generic -I/tmp/pkgsrc-obj/sysutils/xenkernel41/work.ixp/xen-4.1.0/xen/include/asm-x86/mach-default -msoft-float -fno-stack-protector -fno-exceptions -mno-red-zone -fpic -fno-asynchronous-unwind-tables -DGCC_HAS_VISIBILITY_ATTRIBUTE -g -D__XEN__ -MMD -MF .xen.d -O2 -fomit-frame-pointer -m64 -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wno-unused-value -Wdeclaration-after-statement -DNDEBUG -nostdinc -fno-builtin -fno-common -Wredundant-decls -iwithprefix include -Werror -Wno-pointer-arith -pipe -I/tmp/pkgsrc-obj/sysutils/xenkernel41/work.ixp/xen-4.1.0/xen/include -I/tmp/pkgsrc-obj/sysutils/xenkernel41/work.ixp/xen-4.1.0/xen/include/asm-x86/mach-generic -I/tmp/pkgsrc-obj/sysutils/xenkernel41/work.ixp/xen-4.1.0/xen/include/asm-x86/mach-default -msoft-float -fno-stack-protector -fno-exceptions -mno-red-zone -fpic -fno-asynchronous-unwind-tables -DGCC_HAS_VISIBILITY_ATTRIBUTE -g -D__XEN__ -MMD -MF .asm-offsets.s.d -S -o asm-offsets.s x86_64/asm-offsets.c In file included from /tmp/pkgsrc-obj/sysutils/xenkernel41/work.ixp/xen-4.1.0/xen/include/xen/lib.h:5, from /tmp/pkgsrc-obj/sysutils/xenkernel41/work.ixp/xen-4.1.0/xen/include/asm/system.h:4, from /tmp/pkgsrc-obj/sysutils/xenkernel41/work.ixp/xen-4.1.0/xen/include/xen/spinlock.h:5, from /tmp/pkgsrc-obj/sysutils/xenkernel41/work.ixp/xen-4.1.0/xen/include/xen/sched.h:7,
                 from x86_64/asm-offsets.c:10:
/tmp/pkgsrc-obj/sysutils/xenkernel41/work.ixp/xen-4.1.0/xen/include/xen/stdarg.h:4:22: error: stdarg.h: No such file or directory In file included from /tmp/pkgsrc-obj/sysutils/xenkernel41/work.ixp/xen-4.1.0/xen/include/asm/system.h:4, from /tmp/pkgsrc-obj/sysutils/xenkernel41/work.ixp/xen-4.1.0/xen/include/xen/spinlock.h:5, from /tmp/pkgsrc-obj/sysutils/xenkernel41/work.ixp/xen-4.1.0/xen/include/xen/sched.h:7,
                 from x86_64/asm-offsets.c:10:
/tmp/pkgsrc-obj/sysutils/xenkernel41/work.ixp/xen-4.1.0/xen/include/xen/lib.h:86: error: expected declaration specifiers or '...' before 'va_list' /tmp/pkgsrc-obj/sysutils/xenkernel41/work.ixp/xen-4.1.0/xen/include/xen/lib.h:90: error: expected declaration specifiers or '...' before 'va_list' /tmp/pkgsrc-obj/sysutils/xenkernel41/work.ixp/xen-4.1.0/xen/include/xen/lib.h:94: error: expected declaration specifiers or '...' before 'va_list' In file included from /tmp/pkgsrc-obj/sysutils/xenkernel41/work.ixp/xen-4.1.0/xen/include/acpi/acpi.h:61, from /tmp/pkgsrc-obj/sysutils/xenkernel41/work.ixp/xen-4.1.0/xen/include/xen/acpi.h:34, from /tmp/pkgsrc-obj/sysutils/xenkernel41/work.ixp/xen-4.1.0/xen/include/acpi/apei.h:8, from /tmp/pkgsrc-obj/sysutils/xenkernel41/work.ixp/xen-4.1.0/xen/include/asm/fixmap.h:23,
                 from x86_64/asm-offsets.c:12:
/tmp/pkgsrc-obj/sysutils/xenkernel41/work.ixp/xen-4.1.0/xen/include/acpi/acpiosxf.h:257: error: expected declaration specifiers or '...' before 'va_list'
gmake[3]: *** [asm-offsets.s] Error 1
gmake[3]: Leaving directory `/tmp/pkgsrc-obj/sysutils/xenkernel41/work.ixp/xen-4.1.0/xen/arch/x86' gmake[2]: *** [/tmp/pkgsrc-obj/sysutils/xenkernel41/work.ixp/xen-4.1.0/xen/xen] Error 2 gmake[2]: Leaving directory `/tmp/pkgsrc-obj/sysutils/xenkernel41/work.ixp/xen-4.1.0/xen'
gmake[1]: *** [install] Error 2
gmake[1]: Leaving directory `/tmp/pkgsrc-obj/sysutils/xenkernel41/work.ixp/xen-4.1.0/xen'



  -- Keir

Use the external header when we compile the tools.
Adapt libelf-loader.c which is compiled in the kernel
and with the tools.

-#include<stdarg.h>
+#include "../../include/xen/stdarg.h"

Firstly, is this correct for all uses of libelf-loader ?  This file is
compiled both for use inside Xen and for use on the host.  In the
latter case it /should/ use the system's stdarg.h.

Also, this kind of relative path should not be necessary.  The
relevant files should be on the include path.

So I think this should be fixed by arranging that your new stdarg.h is
on the relevant include path, not by changing the .c file.

Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel





--
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Einsteinring 24, 85689 Dornach b. Muenchen
Geschaeftsfuehrer: Alberto Bozzo, Andrew Bowd
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel