Add stuff for generating assembler symbols in Makefile
Hi,
for the ia64 port of the mini-os I need to generate some symbols from C-headers for the assembler code.
I have attached a patch of extras/mini-os/Makefile to handle this (see GEN_ASSYM_... parts).
Thanks.
Dietmar.
# HG changeset patch
# User [email protected]
# Date 1158913773 -7200
# Node ID 964994e5d7961673e1bd26e65b141186c0aab11f
# Parent 8374be07c6226cac672a87f6e259b48ac5129f3b
Added functionality to generate symbols from C-source for assembling. See GEN_ASSYM_... stuff.
extras/mini-os/Makefile +30 -4
@@ -29,6 +29,12 @@ TARGET_ARCH_DIR = $(TARGET_ARCH) # This is used for architecture specific links. ARCH_LINKS = +# Initialization for generating assymbler symbols from C-source. +GEN_ASSYM_DIR=genassym +GEN_ASSYM_BIN=$(GEN_ASSYM_DIR)/gen_assym +GEN_ASSYM_H=$(GEN_ASSYM_DIR)/assym_$(TARGET_ARCH).h +DO_GEN_ASSYM= + ifeq ($(TARGET_ARCH),x86_32) CFLAGS += -m32 -march=i686 LDFLAGS += -m elf_i386
@@ -59,6 +65,7 @@ ASFLAGS += -x assembler-with-cpp -ansi - ASFLAGS += -x assembler-with-cpp -ansi -Wall ASFLAGS += -mfixed-range=f12-f15,f32-f127 ARCH_LINKS = IA64_LINKS # Special link on ia64 needed +DO_GEN_ASSYM=genassym_ia64 define arch_links [ -e include/ia64/asm-xsi-offsets.h ] || ln -sf ../../../../xen/include/asm-ia64/asm-xsi-offsets.h include/ia64/asm-xsi-offsets.h endef
@@ -70,9 +77,6 @@ CFLAGS += -O3 CFLAGS += -O3 endif -# Add the special header directories to the include paths. -extra_incl := $(foreach dir,$(EXTRA_INC),-Iinclude/$(dir)) -override CPPFLAGS := -Iinclude $(CPPFLAGS) -Iinclude/$(TARGET_ARCH_DIR) $(extra_incl) TARGET := mini-os
@@ -105,11 +109,31 @@ ifneq ($(ARCH_LINKS),) $(arch_links) endif +# Generate assymbler symbols from C-source. +ifneq ($(DO_GEN_ASSYM),) + +$(DO_GEN_ASSYM): $(GEN_ASSYM_H) + +$(GEN_ASSYM_H): $(GEN_ASSYM_BIN) + +$(GEN_ASSYM_BIN): $(HDRS) $(GEN_ASSYM_BIN)_$(TARGET_ARCH).c + rm -f $(GEN_ASSYM_H) + cc -o $@ $(CFLAGS) $(CPPFLAGS) $(GEN_ASSYM_BIN)_$(TARGET_ARCH).c + $(GEN_ASSYM_BIN) > $(GEN_ASSYM_H) + +CPPFLAGS += -I$(GEN_ASSYM_DIR) +endif + +# Add the special header directories to the include paths. +extra_incl := $(foreach dir,$(EXTRA_INC),-Iinclude/$(dir)) +override CPPFLAGS := -Iinclude $(CPPFLAGS) -Iinclude/$(TARGET_ARCH_DIR) $(extra_incl) + + .PHONY: links links: $(ARCH_LINKS) [ -e include/xen ] || ln -sf ../../../xen/include/public include/xen -libminios.a: links $(OBJS) $(HEAD) +libminios.a: links $(DO_GEN_ASSYM) $(OBJS) $(HEAD) $(AR) r libminios.a $(HEAD) $(OBJS) $(TARGET): libminios.a $(HEAD)
@@ -122,6 +146,8 @@ clean: rm -f *.o *~ core $(TARGET).elf $(TARGET).raw $(TARGET) $(TARGET).gz rm -f libminios.a find . -type l | xargs rm -f + rm -f $(GEN_ASSYM_BIN) + rm -f $(GEN_ASSYM_H) %.o: %.c $(HDRS) Makefile $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
What is it exactly you need these symbols for (I don't know much about genassym myself)? It strikes me that this is all specific to ia64 at the moment, and therefore should be handled by Makefile in arch/ia64. The resulting header file should also be put somewhere there as well.
Of course if you convince me generation of symbols is possible/useful for x86 then we can make it global to all archs.
Cheers
Gregor
Quoted 10 lines
Hi,
for the ia64 port of the mini-os I need to generate some symbols from C-headers for the assembler code.
I have attached a patch of extras/mini-os/Makefile to handle this (seeGEN_ASSYM_... parts).
Thanks.Dietmar.
<mini-os_genassym.patch>
Am Freitag, 22. September 2006 15:47 schrieben Sie:
Quoted 6 lines
What is it exactly you need these symbols for (I don't know much about genassym myself)? It strikes me that this is all specific to ia64 at the moment, and therefore should be handled by
Makefileinarch/ia64. The resulting header file should also be put somewhere there as well.
Quoted 16 lines
Of course if you convince me generation of symbols is possible/useful for x86 then we can make it global to all archs.
Cheers
GregorQuoted 10 lines
Hi,
for the ia64 port of the mini-os I need to generate some symbols from C-headers for the assembler code.
I have attached a patch of extras/mini-os/Makefile to handle this (seeGEN_ASSYM_... parts).
Thanks.Dietmar.
<mini-os_genassym.patch>
Hi Gregor,
what I want to do is generating some #defines ... from items within structures in C-headers for use in assembler code (for example the trap frame). Linux does this with offset.h or asm-offset.h
Maybe symbol was misleading, sorry.
I thought of a Makefile in arch/ia64 but this would change the current makefile structure.
Another problem for me with the current Makefile structure is that all *.c and *.S in the specified subdirectories are build in one make run. For the
iterative development process for ia64 it's not possible to build all
existing stuff from x86 too. My question is, should I move the files with currently not supported code to the x86 directories and add dummy header files in the ia64 specific directory or should I use
#ifndef __ia64__ ... around the code?
What do you mean.?
Thanks.
Dietmar