direct-io.hg

changeset 13379:fb46005e0756

[MINIOS] Clean up final link stage of the build.

Allow extra application objects to be linked against a partial link of
minios with non-global names localised. For now we assume that global
names ill be assigned a xenos_ prefix in due course. We may decide to
choose a different prefix.

Those who wish to finish the link from an external Makefile can link
their own objects against mini-os.o (which must be first in link
order!) and specify the appropriate architecture linker script.

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Mon Jan 15 12:25:04 2007 +0000 (2007-01-15)
parents b2a31053955d
children ba5e80864f9c a2b2b2a011f1
files .hgignore extras/mini-os/Makefile
line diff
     1.1 --- a/.hgignore	Mon Jan 15 10:53:06 2007 +0000
     1.2 +++ b/.hgignore	Mon Jan 15 12:25:04 2007 +0000
     1.3 @@ -58,7 +58,7 @@
     1.4  ^docs/xen-api/xenapi-datamodel-graph.eps$
     1.5  ^extras/mini-os/h/hypervisor-ifs$
     1.6  ^extras/mini-os/h/xen-public$
     1.7 -^extras/mini-os/mini-os\..*$
     1.8 +^extras/mini-os/mini-os.*$
     1.9  ^install/.*$
    1.10  ^linux-[^/]*-native/.*$
    1.11  ^linux-[^/]*-xen/.*$
     2.1 --- a/extras/mini-os/Makefile	Mon Jan 15 10:53:06 2007 +0000
     2.2 +++ b/extras/mini-os/Makefile	Mon Jan 15 12:25:04 2007 +0000
     2.3 @@ -17,7 +17,13 @@ CFLAGS += -D__XEN_INTERFACE_VERSION__=$(
     2.4  ASFLAGS = -D__ASSEMBLY__
     2.5  
     2.6  LDLIBS =  -L. -lminios
     2.7 -LDFLAGS := -N -T minios-$(TARGET_ARCH).lds
     2.8 +LDFLAGS_FINAL := -N -T minios-$(TARGET_ARCH).lds
     2.9 +LDFLAGS :=
    2.10 +
    2.11 +# Prefix for global API names. All other symbols are localised before
    2.12 +# linking with EXTRA_OBJS.
    2.13 +GLOBAL_PREFIX := xenos_
    2.14 +EXTRA_OBJS =
    2.15  
    2.16  # For possible special source directories.
    2.17  EXTRA_SRC =
    2.18 @@ -110,18 +116,16 @@ endif
    2.19  links:	$(ARCH_LINKS)
    2.20  	[ -e include/xen ] || ln -sf ../../../xen/include/public include/xen
    2.21  
    2.22 -libminios.a: links $(OBJS) $(HEAD)
    2.23 -	$(AR) r libminios.a $(HEAD) $(OBJS)
    2.24 -
    2.25 -$(TARGET): libminios.a $(HEAD)
    2.26 -	$(LD) $(LDFLAGS) $(HEAD) $(LDLIBS) -o $@.elf
    2.27 -	gzip -f -9 -c $@.elf >$@.gz
    2.28 +$(TARGET): links $(OBJS) $(HEAD)
    2.29 +	$(LD) -r $(LDFLAGS) $(HEAD) $(OBJS) -o $@.o
    2.30 +	$(OBJCOPY) -w -G $(GLOBAL_PREFIX)* -G _start $@.o $@.o
    2.31 +	$(LD) $(LDFLAGS) $(LDFLAGS_FINAL) $@.o $(EXTRA_OBJS) -o $@
    2.32 +	gzip -f -9 -c $@ >$@.gz
    2.33  
    2.34  .PHONY: clean
    2.35  clean:
    2.36  	find . -type f -name '*.o' | xargs rm -f
    2.37 -	rm -f *.o *~ core $(TARGET).elf $(TARGET).raw $(TARGET) $(TARGET).gz
    2.38 -	rm -f libminios.a
    2.39 +	rm -f *.o *~ core $(TARGET) $(TARGET).gz
    2.40  	find . -type l | xargs rm -f
    2.41  	rm -f tags TAGS
    2.42