Fix second stage link

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1907 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2009-06-18 23:00:33 +00:00
parent c520315d42
commit d832940aed
9 changed files with 52 additions and 36 deletions

View File

@ -41,5 +41,6 @@ NXFLATCC = $(CC)
NXFLATCFLAGS = $(CFLAGS)
NXFLATLD = $(LD)
NXFLATLDFLAGS = -e main
NXFLATLDFLAGS1 = -e main
NXFLATLDFLAGS2 = -e main -T $(TOPDIR)/examples/nxflat/nxflat.ld -no-check-sections

View File

@ -54,13 +54,13 @@ $(R2OBJ): %.o: %.S
$(NXFLATCC) -c $(NXFLATCFLAGS) $< -o $@
$(BIN).r1: $(R1OBJS)
$(NXFLATLD) -r $(NXFLATLDFLAGS) -o $@ $^
$(NXFLATLD) -r $(NXFLATLDFLAGS1) -o $@ $^
$(R2SRC): $(BIN).r1
$(MKNXFLAT) -o $@ $^
$(BIN).r2: $(R2OBJ)
$(NXFLATLD) -r $(NXFLATLDFLAGS) -o $@ $^
$(NXFLATLD) $(NXFLATLDFLAGS2) -o $@ $(R1OBJS) $(R2OBJ)
$(BIN): $(BIN).r2
touch $(BIN) # For now

View File

@ -44,22 +44,22 @@ BIN3 = hello++3
ALL_BIN = $(BIN1) $(BIN2) $(BIN3) $(BIN4)
R1SRCS1 = $(BIN1).c
OBJS1 = $(R1SRCS1:.c=.o)
R1OBJS1 = $(R1SRCS1:.c=.o)
R2SRC1 = $(BIN1)-thunk.S
R2OBJ1 = $(R2SRC1:.S=.o)
R1SRCS2 = $(BIN2).c
OBJS2 = $(R1SRCS2:.c=.o)
R1OBJS2 = $(R1SRCS2:.c=.o)
R2SRC2 = $(BIN2)-thunk.S
R2OBJ2 = $(R2SRC2:.S=.o)
R1SRCS3 = $(BIN3).c
OBJS3 = $(R1SRCS3:.c=.o)
R1OBJS3 = $(R1SRCS3:.c=.o)
R2SRC3 = $(BIN3)-thunk.S
R2OBJ3 = $(R2SRC3:.S=.o)
#R1SRCS4 = $(BIN4).c
#OBJS4 = $(R1SRCS4:.c=.o)
#R1OBJS4 = $(R1SRCS4:.c=.o)
#R2SRC4 = $(BIN4)-thunk.S
#R2OBJ4 = $(R2SRC4:.S=.o)
@ -90,26 +90,26 @@ $(LIBSTDC_STUBS_LIB):
# BIN2 contains a class that implements hello world, but it is
# not statically initialized.
$(BIN1).r1: $(OBJS1)
$(NXFLATLD) -r $(NXFLATLDFLAGS) -o $@ $^
$(BIN1).r1: $(R1OBJS1)
$(NXFLATLD) -r $(NXFLATLDFLAGS1) -o $@ $^
$(R2SRC1): $(BIN1).r1
$(MKNXFLAT) -o $@ $^
$(BIN1).r2: $(R2OBJ1)
$(NXFLATLD) -r $(NXFLATLDFLAGS) -o $@ $^
$(NXFLATLD) $(NXFLATLDFLAGS2) -o $@ $(R1OBJS1) $(R2OBJ1)
$(BIN1): $(BIN1).r2
touch $(BIN1) # For now
$(BIN2).r1: $(OBJS2) $(LIBSTDC_STUBS_LIB)
$(NXFLATLD) -r $(NXFLATLDFLAGS) -o $@ $^
$(BIN2).r1: $(R1OBJS2) $(LIBSTDC_STUBS_LIB)
$(NXFLATLD) -r $(NXFLATLDFLAGS1) -o $@ $^
$(R2SRC2): $(BIN2).r1
$(MKNXFLAT) -o $@ $^
$(BIN2).r2: $(R2OBJ2)
$(NXFLATLD) -r $(NXFLATLDFLAGS) -o $@ $^
$(NXFLATLD) $(NXFLATLDFLAGS2) -o $@ $(R1OBJS2) $(R2OBJ2)
(BIN2): $(BIN2).r2
touch $(BIN2) # For now
@ -120,14 +120,14 @@ $(BIN2).r2: $(R2OBJ2)
#
# BIN3 is equivalent to BIN2 except that is uses static initializers
$(BIN3).r1: $(OBJS3) $(LIBSTDC_STUBS_LIB)
$(NXFLATLD) -r $(NXFLATLDFLAGS) -o $@ $^
$(BIN3).r1: $(R1OBJS3) $(LIBSTDC_STUBS_LIB)
$(NXFLATLD) -r $(NXFLATLDFLAGS1) -o $@ $^
$(R2SRC3): $(BI3N).r1
$(R2SRC3): $(BIN3).r1
$(MKNXFLAT) -o $@ $^
$(BIN3).r2: $(R2OBJ3)
$(NXFLATLD) -r $(NXFLATLDFLAGS) -o $@ $^
$(NXFLATLD) $(NXFLATLDFLAGS2) -o $@ $(R1OBJS3) $(R2OBJ3)
$(BIN3): $(BIN3).r2
touch $(BIN3) # For now
@ -136,14 +136,14 @@ $(BIN3): $(BIN3).r2
#
# NOTE: libstdc++ is not available for XFLAT as of this writing
#
#$(BIN4).r1: $(OBJS4) $(LIBSTDC_STUBS_LIB)
# $(NXFLATLD) -r $(NXFLATLDFLAGS) -o $@ $^
#$(BIN4).r1: $(R1OBJS4) $(LIBSTDC_STUBS_LIB)
# $(NXFLATLD) -r $(NXFLATLDFLAGS1) -o $@ $^
#
#$(R2SRC4): $(BIN4).r1
# $(MKNXFLAT) -o $@ $^
#
#$(BIN4).r2: $(R2OBJ4)
# $(NXFLATLD) -r $(NXFLATLDFLAGS) -o $@ $^
# $(NXFLATLD) $(NXFLATLDFLAGS2) -o $@ $(R1OBJS4) $(R2OBJ4)
#
#$(BIN4): $(BIN4).r2
# touch $(BIN4) # For now

View File

@ -54,13 +54,13 @@ $(R2OBJ): %.o: %.S
$(NXFLATCC) -c $(NXFLATCFLAGS) $< -o $@
$(BIN).r1: $(R1OBJS)
$(NXFLATLD) -r $(NXFLATLDFLAGS) -o $@ $^
$(NXFLATLD) -r $(NXFLATLDFLAGS1) -o $@ $^
$(R2SRC): $(BIN).r1
$(MKNXFLAT) -o $@ $^
$(BIN).r2: $(R2OBJ)
$(NXFLATLD) -r $(NXFLATLDFLAGS) -o $@ $^
$(NXFLATLD) $(NXFLATLDFLAGS2) -o $@ $(R1OBJS) $(R2OBJ)
$(BIN): $(BIN).r2
touch $(BIN) # For now

View File

@ -54,13 +54,13 @@ $(R2OBJ): %.o: %.S
$(NXFLATCC) -c $(NXFLATCFLAGS) $< -o $@
$(BIN).r1: $(R1OBJS)
$(NXFLATLD) -r $(NXFLATLDFLAGS) -o $@ $^
$(NXFLATLD) -r $(NXFLATLDFLAGS1) -o $@ $^
$(R2SRC): $(BIN).r1
$(MKNXFLAT) -o $@ $^
$(BIN).r2: $(R2OBJ)
$(NXFLATLD) -r $(NXFLATLDFLAGS) -o $@ $^
$(NXFLATLD) $(NXFLATLDFLAGS2) -o $@ $(R1OBJS) $(R2OBJ)
$(BIN): $(BIN).r2
touch $(BIN) # For now

View File

@ -54,13 +54,13 @@ $(R2OBJ): %.o: %.S
$(NXFLATCC) -c $(NXFLATCFLAGS) $< -o $@
$(BIN).r1: $(R1OBJS)
$(NXFLATLD) -r $(NXFLATLDFLAGS) -o $@ $^
$(NXFLATLD) -r $(NXFLATLDFLAGS1) -o $@ $^
$(R2SRC): $(BIN).r1
$(MKNXFLAT) -o $@ $^
$(BIN).r2: $(R2OBJ)
$(NXFLATLD) -r $(NXFLATLDFLAGS) -o $@ $^
$(NXFLATLD) $(NXFLATLDFLAGS2) -o $@ $(R1OBJS) $(R2OBJ)
$(BIN): $(BIN).r2
touch $(BIN) # For now

View File

@ -54,13 +54,13 @@ $(R2OBJ): %.o: %.S
$(NXFLATCC) -c $(NXFLATCFLAGS) $< -o $@
$(BIN).r1: $(R1OBJS)
$(NXFLATLD) -r $(NXFLATLDFLAGS) -o $@ $^
$(NXFLATLD) -r $(NXFLATLDFLAGS1) -o $@ $^
$(R2SRC): $(BIN).r1
$(MKNXFLAT) -o $@ $^
$(BIN).r2: $(R2OBJ)
$(NXFLATLD) -r $(NXFLATLDFLAGS) -o $@ $^
$(NXFLATLD) $(NXFLATLDFLAGS2) -o $@ $(R1OBJS) $(R2OBJ)
$(BIN): $(BIN).r2
touch $(BIN) # For now

View File

@ -39,19 +39,34 @@ include ../Make.defs # NXFLAT make info
BIN = signal
SRCS = $(BIN).c
OBJS = $(SRCS:.c=.o)
R1SRCS = $(BIN).c
R1OBJS = $(R1SRCS:.c=.o)
R2SRC = $(BIN)-thunk.S
R2OBJ = $(R2SRC:.S=.o)
all: $(BIN)
$(OBJS): %.o: %.c
$(R1OBJS): %.o: %.c
$(NXFLATCC) -c $(NXFLATCFLAGS) $< -o $@
$(BIN): $(OBJS)
$(NXFLATLD) $(NXFLATLDFLAGS) -o $@ $(OBJS)
$(R2OBJ): %.o: %.S
$(NXFLATCC) -c $(NXFLATCFLAGS) $< -o $@
$(BIN).r1: $(R1OBJS)
$(NXFLATLD) -r $(NXFLATLDFLAGS1) -o $@ $^
$(R2SRC): $(BIN).r1
$(MKNXFLAT) -o $@ $^
$(BIN).r2: $(R2OBJ)
$(NXFLATLD) $(NXFLATLDFLAGS2) -o $@ $(R1OBJS) $(R2OBJ)
$(BIN): $(BIN).r2
touch $(BIN) # For now
clean:
rm -f $(BIN) *.o core
rm -f $(BIN) $(R2SRC) *.o *.r1 *.r2 *~ .*.swp core
install:
install -D $(BIN) $(ROMFS_DIR)/$(BIN)

View File

@ -54,13 +54,13 @@ $(R2OBJ): %.o: %.S
$(NXFLATCC) -c $(NXFLATCFLAGS) $< -o $@
$(BIN).r1: $(R1OBJS)
$(NXFLATLD) -r $(NXFLATLDFLAGS) -o $@ $^
$(NXFLATLD) -r $(NXFLATLDFLAGS1) -o $@ $^
$(R2SRC): $(BIN).r1
$(MKNXFLAT) -o $@ $^
$(BIN).r2: $(R2OBJ)
$(NXFLATLD) -r $(NXFLATLDFLAGS) -o $@ $^
$(NXFLATLD) $(NXFLATLDFLAGS2) -o $@ $(R1OBJS) $(R2OBJ)
$(BIN): $(BIN).r2
touch $(BIN) # For now