This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch, libgloss] Create nosys.specs


Bare-metal toolchain users often run into missing libgloss symbols problem.
The typical reason is that -lnosys isn't given in the right place. For
example:

# this works
$ arm-none-eabi-gcc a.o -lc -lnosys -o a.axf

# putting object file at end of option, it doesn't work
$ arm-none-eabi-gcc -lc -lnosys -o a.axf a.o
libc.a(lib_a-sbrkr.o): In function `_sbrk_r':
sbrkr.c:(.text._sbrk_r+0x12): undefined reference to `_sbrk'

This patch introduces nosys.specs to group -lnosys with -lc, which is quite
similar to rdimon.specs. With this patch, following simple command line will
work:
$ arm-none-eabi-gcc -specs=nosys.specs -o a.axf a.o

OK to trunk?

ChangeLog:
libnosys/Makefile.in: install nosys.specs.
libnosys/nosys.specs: New specs.

diff --git a/libgloss/libnosys/Makefile.in b/libgloss/libnosys/Makefile.in
index ff4c416..22828a4 100644
--- a/libgloss/libnosys/Makefile.in
+++ b/libgloss/libnosys/Makefile.in
@@ -77,6 +77,7 @@ GCC_LDFLAGS = `if [ -d ${objroot}/../gcc ] ; \
 	then echo -L${objroot}/../gcc ; fi`
 
 OUTPUTS = libnosys.a
+SPECS = ${srcdir}/nosys.specs
 
 # Host specific makefile fragment comes in here.
 @host_makefile_frag@
@@ -101,7 +102,7 @@ distclean maintainer-clean realclean: clean
 
 .PHONY: install info install-info clean-info
 install:
-	@for outputs in ${OUTPUTS}; do\
+	@for outputs in ${OUTPUTS} ${SPECS}; do\
 	 mkdir -p $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}; \
 	 $(INSTALL_DATA) $${outputs} $(DESTDIR)$(tooldir)/lib${MULTISUBDIR};
\
 	done
diff --git a/libgloss/libnosys/nosys.specs b/libgloss/libnosys/nosys.specs
new file mode 100644
index 0000000..dffc28d
--- /dev/null
+++ b/libgloss/libnosys/nosys.specs
@@ -0,0 +1,7 @@
+%rename lib libc
+
+*libgloss:
+-lnosys
+
+*lib:
+--start-group %(libc) %(libgloss) --end-group




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]