This is the mail archive of the 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]

Re: [patch, libgloss] Create nosys.specs

Patch added in manually. Please attach patches rather than including them in your message. Line wrapping sometimes occurs from the mail program and these patches cannot be applied cleanly. In your case, the last continuation character got wrapped and the patch did not apply past that point).

-- Jeff J.

On 09/12/2013 11:04 AM, Joey Ye wrote:
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

# 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
$ arm-none-eabi-gcc -specs=nosys.specs -o a.axf a.o

OK to trunk?

libnosys/ install nosys.specs.
libnosys/nosys.specs: New specs.

diff --git a/libgloss/libnosys/ b/libgloss/libnosys/
index ff4c416..22828a4 100644
--- a/libgloss/libnosys/
+++ b/libgloss/libnosys/
@@ -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.
@@ -101,7 +102,7 @@ distclean maintainer-clean realclean: clean

  .PHONY: install info install-info clean-info
-	@for outputs in ${OUTPUTS}; do\
+	@for outputs in ${OUTPUTS} ${SPECS}; do\
  	 mkdir -p $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}; \
  	 $(INSTALL_DATA) $${outputs} $(DESTDIR)$(tooldir)/lib${MULTISUBDIR};
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
+--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]