$(csu-dummies))
install-lib = $(start-installed-name) g$(start-installed-name) \
$(csu-dummies)
-distribute = initfini.c gmon-start.c start.c defs.awk abi-note.S abi-tag.h
+distribute = initfini.c gmon-start.c start.c defs.awk abi-note.S
all: # Make this the default target; it will be defined in Rules.
include ../Makeconfig
+ifeq ($(elf),yes)
+before-compile = $(objpfx)abi-tag.h
+endif
ifeq ($(have-initfini),yes)
install-lib += $(crtstuff:=.o)
extra-objs += $(crtstuff:=.o)
-generated += $(crtstuff:=.S) initfini.s align.h end.h
+generated += $(crtstuff:=.S) initfini.s defs.h
omit-deps += $(crtstuff)
# Special rules for the building of crti.o and crtn.o
$(objpfx)crt%.o: $(objpfx)crt%.S $(objpfx)defs.h
- $(compile.S) -fPIC -g0 -o $@
+ $(compile.S) -g0 $(ASFLAGS-.os) -o $@
+
+CFLAGS-initfini.s = -g0 -fPIC -fno-inline-functions
$(objpfx)initfini.s: initfini.c
- $(compile.c) -g0 -S -fPIC -finhibit-size-directive \
+ $(compile.c) -S $(CFLAGS-initfini.s) -finhibit-size-directive \
$(no-exceptions) -o $@
+# We only have one kind of startup code files. Static binaries and
+# shared libraries are build using the PIC version.
$(objpfx)crti.S: $(objpfx)initfini.s
sed -n -e '1,/@HEADER_ENDS/p' \
-e '/@_.*_PROLOG_BEGINS/,/@_.*_PROLOG_ENDS/p' \
ifeq (yes,$(elf))
extra-objs += abi-note.o
+asm-CPPFLAGS += -I$(objpfx).
endif
include ../Rules
cp /dev/null $(@:.o=.c)
$(COMPILE.c) $(@:.o=.c) $(OUTPUT_OPTION)
rm -f $(@:.o=.c)
+
+/ := $$/# bite me.
+$(objpfx)abi-tag.h: $(..)abi-tags
+ $(make-target-directory)
+ rm -f $@.new
+ sed 's/#.*$//;/^[ ]*$$/d' $< | while read conf tag; do \
+ test `expr '$(config-machine)-$(config-vendor)-$(config-os)' \
+ : "$$conf"` != 0 || continue; \
+ echo "$$tag" | sed > $@.new \
+ 's/[^0-9xXa-fA-F]/ /g;s/ *$//;s/ /,/g;s/^ */#define ABI_TAG /';\
+ done
+ if test -r $@.new; then mv -f $@.new $@; \
+ else echo >&2 'This configuration not matched in $<'; exit 1; fi