ia64/xen-unstable

view extras/mini-os/minios.mk @ 13631:db3d03dfe92f

add libelf: an ELF binary parser library.

This patch adds a library with a small collection of helper functions
to parse and load elf binaries. The library handles endianess and
elfsize at runtime.

The patch also shuffles around the include files a bit. Now there is
*one* include file holding all the elf structures
(xen/include/public/elfstructs.h) which is included by everyone who
needs them.

It's dead code with this patch only, putting the code into use happens
in followup patches.

Signed-off-by: Gerd Hoffmann <kraxel@suse.de>
---
tools/libxc/xc_elf.h | 525 -----------------------------------
xen/arch/x86/boot/mkelf32.c | 2
xen/common/Makefile | 2
xen/common/libelf/Makefile | 4
xen/common/libelf/README | 1
xen/common/libelf/libelf-dominfo.c | 420 ++++++++++++++++++++++++++++
xen/common/libelf/libelf-loader.c | 156 ++++++++++
xen/common/libelf/libelf-private.h | 51 +++
xen/common/libelf/libelf-relocate.c | 345 +++++++++++++++++++++++
xen/common/libelf/libelf-tools.c | 225 +++++++++++++++
xen/include/public/elfstructs.h | 527 ++++++++++++++++++++++++++++++++++++
xen/include/public/libelf.h | 238 ++++++++++++++++
xen/include/xen/elf.h | 490 ---------------------------------
13 files changed, 1972 insertions(+), 1014 deletions(-)
author Emmanuel Ackaouy <ack@xensource.com>
date Thu Jan 25 22:16:52 2007 +0000 (2007-01-25)
parents 8690e3448971
children 236687fb42d7
line source
1 #
2 # The file contains the common make rules for building mini-os.
3 #
5 debug = y
7 # Define some default flags.
8 # NB. '-Wcast-qual' is nasty, so I omitted it.
9 DEF_CFLAGS := -fno-builtin -Wall -Werror -Wredundant-decls -Wno-format
10 DEF_CFLAGS += -Wstrict-prototypes -Wnested-externs -Wpointer-arith -Winline
11 DEF_CFLAGS += -D__XEN_INTERFACE_VERSION__=$(XEN_INTERFACE_VERSION)
13 DEF_ASFLAGS = -D__ASSEMBLY__
15 ifeq ($(debug),y)
16 DEF_CFLAGS += -g
17 else
18 DEF_CFLAGS += -O3
19 endif
21 # Build the CFLAGS and ASFLAGS for compiling and assembling.
22 # DEF_... flags are the common mini-os flags,
23 # ARCH_... flags may be defined in arch/$(TARGET_ARCH_FAM/rules.mk
24 CFLAGS := $(DEF_CFLAGS) $(ARCH_CFLAGS)
25 ASFLAGS := $(DEF_ASFLAGS) $(ARCH_ASFLAGS)
27 # The path pointing to the architecture specific header files.
28 ARCH_SPEC_INC := $(MINI-OS_ROOT)/include/$(TARGET_ARCH_FAM)
30 # Find all header files for checking dependencies.
31 HDRS := $(wildcard $(MINI-OS_ROOT)/include/*.h)
32 HDRS += $(wildcard $(MINI-OS_ROOT)/include/xen/*.h)
33 HDRS += $(wildcard $(ARCH_SPEC_INC)/*.h)
34 # For special wanted header directories.
35 extra_heads := $(foreach dir,$(EXTRA_INC),$(wildcard $(dir)/*.h))
36 HDRS += $(extra_heads)
38 # Add the special header directories to the include paths.
39 extra_incl := $(foreach dir,$(EXTRA_INC),-I$(MINI-OS_ROOT)/include/$(dir))
40 override CPPFLAGS := -I$(MINI-OS_ROOT)/include $(CPPFLAGS) -I$(ARCH_SPEC_INC) $(extra_incl)
42 # The name of the architecture specific library.
43 # This is on x86_32: libx86_32.a
44 # $(ARCH_LIB) has to built in the architecture specific directory.
45 ARCH_LIB_NAME = $(TARGET_ARCH)
46 ARCH_LIB := lib$(ARCH_LIB_NAME).a
48 # This object contains the entrypoint for startup from Xen.
49 # $(HEAD_ARCH_OBJ) has to be built in the architecture specific directory.
50 HEAD_ARCH_OBJ := $(TARGET_ARCH).o
51 HEAD_OBJ := $(TARGET_ARCH_DIR)/$(HEAD_ARCH_OBJ)
54 %.o: %.c $(HDRS) Makefile $(SPEC_DEPENDS)
55 $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
57 %.o: %.S $(HDRS) Makefile $(SPEC_DEPENDS)
58 $(CC) $(ASFLAGS) $(CPPFLAGS) -c $< -o $@