diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/examples/elf/tests/errno/Makefile | 7 | ||||
-rw-r--r-- | apps/examples/elf/tests/hello/Makefile | 6 | ||||
-rw-r--r-- | apps/examples/elf/tests/helloxx/Makefile | 18 | ||||
-rw-r--r-- | apps/examples/elf/tests/longjmp/Makefile | 6 | ||||
-rw-r--r-- | apps/examples/elf/tests/mutex/Makefile | 6 | ||||
-rw-r--r-- | apps/examples/elf/tests/pthread/Makefile | 6 | ||||
-rw-r--r-- | apps/examples/elf/tests/signal/Makefile | 6 | ||||
-rw-r--r-- | apps/examples/elf/tests/struct/Makefile | 6 | ||||
-rw-r--r-- | apps/examples/elf/tests/task/Makefile | 6 | ||||
-rw-r--r-- | apps/import/Make.defs | 16 |
10 files changed, 49 insertions, 34 deletions
diff --git a/apps/examples/elf/tests/errno/Makefile b/apps/examples/elf/tests/errno/Makefile index b9029e163..89e3f2bfd 100644 --- a/apps/examples/elf/tests/errno/Makefile +++ b/apps/examples/elf/tests/errno/Makefile @@ -66,17 +66,17 @@ endif BIN = errno SRCS = $(BIN).c -OBJS = $(SRCS:.c=.o) +OBJS = $(SRCS:.c=$(OBJEXT)) all: $(BIN) -$(OBJS): %.o: %.c +$(OBJS): %$(OBJEXT): %.c @echo "CC: $<" $(Q) $(CC) -c $(CELFFLAGS) $< -o $@ $(BIN): $(OBJS) @echo "LD: $<" - $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $^ $(LDLIBS) + $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ $(LDLIBS) clean: $(call DELFILE, $(BIN)) @@ -85,4 +85,3 @@ clean: install: $(Q) mkdir -p $(ROMFS_DIR) $(Q) install $(BIN) $(ROMFS_DIR)/$(BIN) - diff --git a/apps/examples/elf/tests/hello/Makefile b/apps/examples/elf/tests/hello/Makefile index 2fb1fdce4..f89759a66 100644 --- a/apps/examples/elf/tests/hello/Makefile +++ b/apps/examples/elf/tests/hello/Makefile @@ -66,17 +66,17 @@ endif BIN = hello SRCS = $(BIN).c -OBJS = $(SRCS:.c=.o) +OBJS = $(SRCS:.c=$(OBJEXT)) all: $(BIN) -$(OBJS): %.o: %.c +$(OBJS): %$(OBJEXT): %.c @echo "CC: $<" $(Q) $(CC) -c $(CELFFLAGS) $< -o $@ $(BIN): $(OBJS) @echo "LD: $<" - $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $^ $(LDLIBS) + $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ $(LDLIBS) clean: $(call DELFILE, $(BIN)) diff --git a/apps/examples/elf/tests/helloxx/Makefile b/apps/examples/elf/tests/helloxx/Makefile index f16ef7e6f..cd153bd52 100644 --- a/apps/examples/elf/tests/helloxx/Makefile +++ b/apps/examples/elf/tests/helloxx/Makefile @@ -72,18 +72,18 @@ endif ALL_BIN = $(BIN1) $(BIN2) $(BIN3) $(BIN4) SRCS1 = $(BIN1).c -OBJS1 = $(SRCS1:.c=.o) +OBJS1 = $(SRCS1:.c=$(OBJEXT)) SRCS2 = $(BIN2).c -OBJS2 = $(SRCS2:.c=.o) +OBJS2 = $(SRCS2:.c=$(OBJEXT)) ifeq ($(CONFIG_BINFMT_CONSTRUCTORS),y) SRCS3 = $(BIN3).c -OBJS3 = $(SRCS3:.c=.o) +OBJS3 = $(SRCS3:.c=$(OBJEXT)) endif #SRCS4 = $(BIN4).c -#OBJS4 = $(SRCS4:.c=.o) +#OBJS4 = $(SRCS4:.c=$(OBJEXT)) SRCS = $(SRCS1) $(SRCS2) $(SRCS3) $(SRCS4) OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $(OBJS4) @@ -93,7 +93,7 @@ LDLIBSTDC_STUBS_LIB = $(LDLIBSTDC_STUBS_DIR)/liblibxx.a all: $(BIN1) $(BIN2) $(BIN3) $(BIN4) -$(OBJS): %.o: %.cpp +$(OBJS): %$(OBJEXT): %.cpp @echo "CC: $<" $(Q) $(CXX) -c $(CXXELFFLAGS) $< -o $@ @@ -110,18 +110,18 @@ $(LDLIBSTDC_STUBS_LIB): $(BIN1): $(OBJS1) @echo "LD: $<" - $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $^ $(LDLIBS) + $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ $(LDLIBS) $(BIN2): $(OBJS2) @echo "LD: $<" - $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $^ $(LDLIBS) + $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ $(LDLIBS) # BIN3 is equivalent to BIN2 except that is uses static initializers ifeq ($(CONFIG_BINFMT_CONSTRUCTORS),y) $(BIN3): $(OBJS3) @echo "LD: $<" - $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $^ $(LDLIBS) + $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ $(LDLIBS) endif # BIN4 is similar to BIN3 except that it uses the streams code from libstdc++ @@ -130,7 +130,7 @@ endif # #$(BIN4): $(OBJS4) # @echo "LD: $<" -# $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $^ $(LDLIBS) +# $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ $(LDLIBS) clean: $(call DELFILE, $(BIN1)) diff --git a/apps/examples/elf/tests/longjmp/Makefile b/apps/examples/elf/tests/longjmp/Makefile index 9cc3a9922..26fa393bd 100644 --- a/apps/examples/elf/tests/longjmp/Makefile +++ b/apps/examples/elf/tests/longjmp/Makefile @@ -66,17 +66,17 @@ endif BIN = longjmp SRCS = $(BIN).c -OBJS = $(SRCS:.c=.o) +OBJS = $(SRCS:.c=$(OBJEXT)) all: $(BIN) -$(OBJS): %.o: %.c +$(OBJS): %$(OBJEXT): %.c @echo "CC: $<" $(Q) $(CC) -c $(CELFFLAGS) $< -o $@ $(BIN): $(OBJS) @echo "LD: $<" - $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $^ $(LDLIBS) + $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ $(LDLIBS) clean: $(call DELFILE, $(BIN)) diff --git a/apps/examples/elf/tests/mutex/Makefile b/apps/examples/elf/tests/mutex/Makefile index d7ce09041..f8ce4f613 100644 --- a/apps/examples/elf/tests/mutex/Makefile +++ b/apps/examples/elf/tests/mutex/Makefile @@ -66,17 +66,17 @@ endif BIN = mutex SRCS = $(BIN).c -OBJS = $(SRCS:.c=.o) +OBJS = $(SRCS:.c=$(OBJEXT)) all: $(BIN) -$(OBJS): %.o: %.c +$(OBJS): %$(OBJEXT): %.c @echo "CC: $<" $(Q) $(CC) -c $(CELFFLAGS) $< -o $@ $(BIN): $(OBJS) @echo "LD: $<" - $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $^ $(LDLIBS) + $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ $(LDLIBS) clean: $(call DELFILE, $(BIN)) diff --git a/apps/examples/elf/tests/pthread/Makefile b/apps/examples/elf/tests/pthread/Makefile index 0b34c8f8a..9d4ce496b 100644 --- a/apps/examples/elf/tests/pthread/Makefile +++ b/apps/examples/elf/tests/pthread/Makefile @@ -66,17 +66,17 @@ endif BIN = pthread SRCS = $(BIN).c -OBJS = $(SRCS:.c=.o) +OBJS = $(SRCS:.c=$(OBJEXT)) all: $(BIN) -$(OBJS): %.o: %.c +$(OBJS): %$(OBJEXT): %.c @echo "CC: $<" $(Q) $(CC) -c $(CELFFLAGS) $< -o $@ $(BIN): $(OBJS) @echo "LD: $<" - $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $^ $(LDLIBS) + $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ $(LDLIBS) clean: $(call DELFILE, $(BIN)) diff --git a/apps/examples/elf/tests/signal/Makefile b/apps/examples/elf/tests/signal/Makefile index 93f7bc183..c442ae9c6 100644 --- a/apps/examples/elf/tests/signal/Makefile +++ b/apps/examples/elf/tests/signal/Makefile @@ -66,17 +66,17 @@ endif BIN = signal SRCS = $(BIN).c -OBJS = $(SRCS:.c=.o) +OBJS = $(SRCS:.c=$(OBJEXT)) all: $(BIN) -$(OBJS): %.o: %.c +$(OBJS): %$(OBJEXT): %.c @echo "CC: $<" $(Q) $(CC) -c $(CELFFLAGS) $< -o $@ $(BIN): $(OBJS) @echo "LD: $<" - $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $^ $(LDLIBS) + $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ $(LDLIBS) clean: $(call DELFILE, $(BIN)) diff --git a/apps/examples/elf/tests/struct/Makefile b/apps/examples/elf/tests/struct/Makefile index 4dec5e51e..8fe7cf710 100644 --- a/apps/examples/elf/tests/struct/Makefile +++ b/apps/examples/elf/tests/struct/Makefile @@ -67,17 +67,17 @@ endif BIN = struct SRCS = struct_main.c struct_dummy.c -OBJS = $(SRCS:.c=.o) +OBJS = $(SRCS:.c=$(OBJEXT)) all: $(BIN) -$(OBJS): %.o: %.c +$(OBJS): %$(OBJEXT): %.c @echo "CC: $<" $(Q) $(CC) -c $(CELFFLAGS) $< -o $@ $(BIN): $(OBJS) @echo "LD: $<" - $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $^ $(LDLIBS) + $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ $(LDLIBS) clean: $(call DELFILE, $(BIN)) diff --git a/apps/examples/elf/tests/task/Makefile b/apps/examples/elf/tests/task/Makefile index 13d07e18a..572d1072e 100644 --- a/apps/examples/elf/tests/task/Makefile +++ b/apps/examples/elf/tests/task/Makefile @@ -66,17 +66,17 @@ endif BIN = task SRCS = $(BIN).c -OBJS = $(SRCS:.c=.o) +OBJS = $(SRCS:.c=$(OBJEXT)) all: $(BIN) -$(OBJS): %.o: %.c +$(OBJS): %$(OBJEXT): %.c @echo "CC: $<" $(Q) $(CC) -c $(CELFFLAGS) $< -o $@ $(BIN): $(OBJS) @echo "LD: $<" - $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $^ $(LDLIBS) + $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ $(LDLIBS) clean: $(call DELFILE, $(BIN)) diff --git a/apps/import/Make.defs b/apps/import/Make.defs index 3d12fd368..4ac269f19 100644 --- a/apps/import/Make.defs +++ b/apps/import/Make.defs @@ -155,10 +155,12 @@ ifeq ($(WINTOOL),y) # Windows-native toolchains ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)$(DELIM)include}" ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)$(DELIM)include}" -isystem "${shell cygpath -w $(TOPDIR)$(DELIM)include$(DELIM)cxx}" + ARCHCRT0OBJ = "${shell cygpath -w $(TOPDIR)$(DELIM)startup$(DELIM)crt0$(OBJEXT)}" else # Linux/Cygwin-native toolchain ARCHINCLUDES = -I. -isystem $(TOPDIR)$(DELIM)include ARCHXXINCLUDES = -I. -isystem $(TOPDIR)$(DELIM)include -isystem $(TOPDIR)$(DELIM)include$(DELIM)cxx + ARCHCRT0OBJ = $(TOPDIR)$(DELIM)startup$(DELIM)crt0$(OBJEXT) endif CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe @@ -167,6 +169,11 @@ CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS) CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS) +# ELF module definitions + +CELFFLAGS = $(CFLAGS) -mlong-calls # --target1-abs +CXXELFFLAGS = $(CXXFLAGS) -mlong-calls # --target1-abs + # C Pre-processor CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) @@ -192,3 +199,12 @@ ifneq ($(LIBGCC),) LDLIBPATH += -L ${shell dirname $(LIBGCC)} LDLIBS += -lgcc endif + +# ELF module definitions + +LDELFFLAGS = -r -e _start -Bstatic +ifeq ($(WINTOOL),y) + LDELFFLAGS += -T "${shell cygpath -w $(TOPDIR)/scripts/gnu-elf.ld}" +else + LDELFFLAGS += -T $(TOPDIR)/scripts/gnu-elf.ld +endif |