Skip to contentSkip to conversation

tools - Remove machine setting from HOSTCFLAGS

PATCH In review Bastian Blank 2 participants 12 messages Jan 26, 2008 – Jan 27, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 tools - Remove machine setting from HOSTCFLAGS

# HG changeset patch
# User Bastian Blank <[email protected]>
# Date 1201375662 -3600
# Node ID 15419f59710aeaaf83fc35fbbf955b15ec713051 # Parent c98a1a50be44c52cb59b5795347bf852941b4fdc Remove machine setting from HOSTCFLAGS.

The host compiler must know how to produce runnable binaries without special settings.

Config.mk +0 -3
diff -r c98a1a50be44 -r 15419f59710a Config.mk
@@ -21,9 +21,6 @@ HOSTCC      = gcc
 HOSTCC      = gcc
 HOSTCFLAGS  = -Wall -Werror -Wstrict-prototypes -O2 -fomit-frame-pointer
 HOSTCFLAGS += -fno-strict-aliasing
-HOSTCFLAGS_x86_32 = -m32
-HOSTCFLAGS_x86_64 = -m64
-HOSTCFLAGS += $(HOSTCFLAGS_$(XEN_COMPILE_ARCH))
 
 DISTDIR     ?= $(XEN_ROOT)/dist
 DESTDIR     ?= /
#1 lore raw
Quoted 11 lines · Bastian Blank

# HG changeset patch
# User Bastian Blank <[email protected]>
# Date 1201375662 -3600
# Node ID 15419f59710aeaaf83fc35fbbf955b15ec713051 # Parent c98a1a50be44c52cb59b5795347bf852941b4fdc Remove machine setting from HOSTCFLAGS.

The host compiler must know how to produce runnable binaries without special settings.

Unfortunately those lines *were* introduced for a reason. See the thread at
http://lists.xensource.com/archives/html/xen-devel/2007-08/msg00342.html. In brief summary, the HOSTCFLAGS mod ensures that Solaris gcc produces 64-bit binaries when COMPILE_ARCH==x86_64; a sane thing to do you'll agree.

We could move the HOSTCFLAGS modification to config/SunOS.mk. Or to tools/include/xen-foreign/Makefile. But actually afaict doing it globally in Config.mk is harmless, it just looks a bit odd and potentially purgable. :-)

-- Keir

#2 lore raw
Quoted 9 lines · Keir Fraser
Quoted 4 lines · Bastian Blank

Remove machine setting from HOSTCFLAGS.

The host compiler must know how to produce runnable binaries without special settings.

Unfortunately those lines *were* introduced for a reason. See the thread at
http://lists.xensource.com/archives/html/xen-devel/2007-08/msg00342.html. In brief summary, the HOSTCFLAGS mod ensures that Solaris gcc produces 64-bit binaries when COMPILE_ARCH==x86_64; a sane thing to do you'll agree.

Your summary not complete. The build assumes the HOSTCC is able to produce binaries which both run on the host and match the target environment.

Quoted 3 lines

We could move the HOSTCFLAGS modification to config/SunOS.mk. Or to tools/include/xen-foreign/Makefile. But actually afaict doing it globally in Config.mk is harmless, it just looks a bit odd and potentially purgable. :-)

It just missuses the name HOST, IMHO.

Anyway, why not the following patch? It removes the special case in mkchecker.py and always checks if all _translated_ structs have the correct size. This should catch both error cases: orig struct was changed and translation is broken. Also it can run always now. Or is it a fix for something else to do the check this way and forget the translated one?

tools/include/xen-foreign/Makefile Sun Jan 27 10:49:04 2008 +0000 renamed from tools/include/xen-foreign/Makefile Sat Jan 26 20:58:54 2008 +0100 +1 -6
diff -r 52dd15058648 tools/include/xen-foreign/Makefile
@@ -18,7 +18,6 @@ clean:
        rm -f checker checker.c
        rm -f *.pyc *.o *~
 
-ifeq ($(CROSS_COMPILE)$(XEN_TARGET_ARCH),$(XEN_COMPILE_ARCH))
 checker: checker.c $(headers)
        $(HOSTCC) $(HOSTCFLAGS) -o $@ $<
 
@@ -26,10 +25,6 @@ check-headers: checker
        ./checker > tmp.size
        diff -u $(ROOT)/foreign/reference.size tmp.size
        rm tmp.size
-else
-check-headers:
-       @echo "cross build: skipping check"
-endif
 
 x86_32.h: $(MKHEADER_PY) $(ROOT)/arch-x86/xen-x86_32.h $(ROOT)/arch-x86/xen.h $(ROOT)/xen.h
        python $< $* $@ $(filter %.h,$^)
@@ -41,4 +36,4 @@ ia64.h: $(MKHEADER_PY) $(ROOT)/arch-ia64
        python $< $* $@ $(filter %.h,$^)
 
 checker.c: $(MKCHECKER_PY)
-       python $< $(XEN_TARGET_ARCH) $@ $(architectures)
+       python $< $@ $(architectures)
xen/include/public/foreign/mkchecker.py Sun Jan 27 10:49:04 2008 +0000 renamed from xen/include/public/foreign/mkchecker.py Sat Jan 26 20:58:54 2008 +0100 +3 -7
diff -r 52dd15058648 xen/include/public/foreign/mkchecker.py
@@ -4,9 +4,8 @@ from structs import structs;
 from structs import structs;
 
 # command line arguments
-arch    = sys.argv[1];
-outfile = sys.argv[2];
-archs   = sys.argv[3:];
+outfile = sys.argv[1];
+archs   = sys.argv[2:];
 
 f = open(outfile, "w");
 f.write('''
@@ -38,10 +37,7 @@ for struct in structs:
 for struct in structs:
     f.write('\tprintf("%%-25s |", "%s");\n' % struct);
     for a in archs:
-        if a == arch:
-            s = struct; # native
-        else:
-            s = struct + "_" + a;
+        s = struct + "_" + a;
         f.write('#ifdef %s_has_no_%s\n' % (a, struct));
         f.write('\tprintf("%8s", "-");\n');
         f.write("#else\n");

Bastian

Signature · 2 lines
Vulcans do not approve of violence.
		-- Spock, "Journey to Babel", stardate 3842.4
#3 lore raw
Quoted 8 lines · Bastian Blank
Quoted 4 lines

Unfortunately those lines *were* introduced for a reason. See the thread at
http://lists.xensource.com/archives/html/xen-devel/2007-08/msg00342.html. In brief summary, the HOSTCFLAGS mod ensures that Solaris gcc produces 64-bit binaries when COMPILE_ARCH==x86_64; a sane thing to do you'll agree.

Your summary not complete. The build assumes the HOSTCC is able to produce binaries which both run on the host and match the target environment.

Not sure what you mean? You think HOSTCC needs special casing too?

Quoted 4 lines
Quoted 3 lines

We could move the HOSTCFLAGS modification to config/SunOS.mk. Or to tools/include/xen-foreign/Makefile. But actually afaict doing it globally in Config.mk is harmless, it just looks a bit odd and potentially purgable. :-)

Quoted 8 lines

It just missuses the name HOST, IMHO.

Anyway, why not the following patch? It removes the special case in mkchecker.py and always checks if all _translated_ structs have the correct size. This should catch both error cases: orig struct was changed and translation is broken. Also it can run always now. Or is it a fix for something else to do the check this way and forget the translated one?

Your patch might make sense. I'll take a look.

-- Keir

#4 lore raw
In reply to Bastian Blank
Quoted 6 lines · Bastian Blank

Anyway, why not the following patch? It removes the special case in mkchecker.py and always checks if all _translated_ structs have the correct size. This should catch both error cases: orig struct was changed and translation is broken. Also it can run always now. Or is it a fix for something else to do the check this way and forget the translated one?

Yes, I think this patch makes sense so I checked it in.

I still don't understand why you'd want to remove -m32/-m64 from HOSTCFLAGS though. Is it just a cleanliness thing, or does it break something for you?

-- Keir

#5 lore raw
Quoted 2 lines · Keir Fraser

I still don't understand why you'd want to remove -m32/-m64 from HOSTCFLAGS though. Is it just a cleanliness thing, or does it break something for you?

It fails for me sometimes if I forget to say that the system is not able to run x86_64 binaries.

Bastian

Signature · 3 lines
I object to intellect without discipline;  I object to power without
constructive purpose.
		-- Spock, "The Squire of Gothos", stardate 2124.5
#6 lore raw
Quoted 6 lines · Bastian Blank
Quoted 2 lines · Keir Fraser

I still don't understand why you'd want to remove -m32/-m64 from HOSTCFLAGS though. Is it just a cleanliness thing, or does it break something for you?

It fails for me sometimes if I forget to say that the system is not able to run x86_64 binaries.

Then you would not have 'uname -m' indicating x86_64 or amd64, and so XEN_COMPILE_ARCH would be x86_32 by default?

-- Keir

#7 lore raw
Quoted 2 lines · Keir Fraser

Then you would not have 'uname -m' indicating x86_64 or amd64, and so XEN_COMPILE_ARCH would be x86_32 by default?

No. uname -m == x86_64 and XEN_TARGET_ARCH = x86_64, but the system lacks critical parts to execute the x86_64 binaries.

Bastian

Signature · 2 lines
Fascinating, a totally parochial attitude.
		-- Spock, "Metamorphosis", stardate 3219.8
#8 lore raw
Quoted 6 lines · Bastian Blank
Quoted 2 lines · Keir Fraser

Then you would not have 'uname -m' indicating x86_64 or amd64, and so XEN_COMPILE_ARCH would be x86_32 by default?

No. uname -m == x86_64 and XEN_TARGET_ARCH = x86_64, but the system lacks critical parts to execute the x86_64 binaries.

Weird. Well, okay, we can remove the HOSTCFLAGS bits now anyway, since the mkchecker problem is fixed.

-- Keir

#9 lore raw
Quoted 2 lines · Keir Fraser

Weird. Well, okay, we can remove the HOSTCFLAGS bits now anyway, since the mkchecker problem is fixed.

Thanks.

Bastian

Signature · 3 lines
The face of war has never changed.  Surely it is more logical to heal
than to kill.
		-- Surak of Vulcan, "The Savage Curtain", stardate 5906.5
#10 lore raw
In reply to Keir Fraser

Can you please move the remaining files from xen/public/foreign to tools/include/xen-foreign?

Bastian

Signature · 2 lines
Madness has no purpose.  Or reason.  But it may have a goal.
		-- Spock, "The Alternative Factor", stardate 3088.7
#11 lore raw

Done.

K.

Quoted 4 lines · Bastian Blank

Can you please move the remaining files from xen/public/foreign to tools/include/xen-foreign?

Bastian