[mc1322x] linking in math libraries?

Mariano Alvira mar at devl.org
Thu Apr 8 10:15:53 EDT 2010


On Thu, Apr 08, 2010 at 09:36:29AM -0400, Jon Smirl wrote:
> On Thu, Apr 8, 2010 at 9:31 AM, Mariano Alvira <mar at devl.org> wrote:
> > On Thu, Apr 08, 2010 at 12:00:49AM -0700, Andrew Pullin wrote:
> >> On 4/7/2010 2:37 PM, Mariano Alvira wrote:
> >>> On Wed, Apr 07, 2010 at 01:05:13PM -0700, Andrew Pullin wrote:
> >>>
> >> Well, that seems to work properly. Would newlib solve this & other
> >> problems?
> >
> > I just tried my newlib build and it does solve the build issue. The
> > rftests are 10KB larger though and it looks like printf doesn't work
> > at all...
> 
> Are you using -nodefaultlibs? If not you are mixing the two libs.

I was not, but now with -nodefaultlibs it's actually worse. rftest-tx
is now 51KB.

I verified that from the .map that it's using newlib for everything
except for the things it needs from libgcc.

-Mar.

diff --git a/Makefile.include b/Makefile.include
index 885e4a2..a9c1b91 100644
--- a/Makefile.include
+++ b/Makefile.include
@@ -76,7 +76,7 @@ $(MC1322X)/src/src.a: $(MC1322X)/src/src.a($(SRCOBJS))
 
 %_$(BOARD).elf:	$(OBJDIR)/%.o $(START) $(ISR) $(SRCOBJS) $(LINKERSCRIPT) $(LIBMC1322X)/libmc1322x.a $(OBJDIR)/board.a $(MC1322X)/src/src.a
 	$(CC) $(LDFLAGS)  \
-	-L $(LIBMC1322X) -L $(MC1322X)/src -L $(OBJDIR)  $< -o $@ $(START) $(MC1322X)/src/src.a --start-group $(OBJDIR)/board.a $(LIBMC1322X)/libmc1322x.a --end-group
+	-L $(LIBMC1322X) -L $(MC1322X)/src -L $(OBJDIR) $< -o $@ $(START) $(MC1322X)/src/src.a -L /home/malvira/build-newlib/arm-elf/newlib/ -lgcc -lc -lm --start-group -lgcc -lc -lm $(OBJDIR)/board.a $(LIBMC1322X)/libmc1322x.a  --end-group
 
 %.srec:		%.elf
 		$(OBJCOPY) ${OBJCFLAGS} -O srec $< $@
diff --git a/config.mk b/config.mk
index 52e5a54..1a4ee8e 100644
--- a/config.mk
+++ b/config.mk
@@ -30,7 +30,7 @@ gccincdir := $(shell $(CC) -print-file-name=include)
 
 CPPFLAGS := $(DBGFLAGS) $(OPTFLAGS) $(RELFLAGS)		\
 	-D__KERNEL__ -DTEXT_BASE=$(TEXT_BASE)		\
-	-fno-builtin -ffreestanding -isystem	\
+	-nodefaultlibs -fno-builtin -ffreestanding -isystem	\
 	$(gccincdir) -pipe $(PLATFORM_CPPFLAGS)
 
 CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wcast-align -Wextra -Werror
@@ -38,7 +38,7 @@ CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wcast-align -Wextra -Werror
 AFLAGS_DEBUG := -Wa,-gstabs
 AFLAGS := $(AFLAGS_DEBUG) -D__ASSEMBLY__ $(CPPFLAGS)
 
-LDFLAGS += -T $(LINKERSCRIPT) -nostartfiles -static -Wl,-Map=$*_$(BOARD).map -export-dynamic
+LDFLAGS += -T $(LINKERSCRIPT) -nodefaultlibs -nostartfiles -static -Wl,-Map=$*_$(BOARD).map -export-dynamic
 
 #########################################################################
 



More information about the mc1322x mailing list