This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
[PATCH 1/3] arc: Support "nano" build of newlib
- From: Anton Kolesov <Anton dot Kolesov at synopsys dot com>
- To: newlib at sourceware dot org
- Cc: Francois dot Bedard at synopsys dot com, Anton Kolesov <Anton dot Kolesov at synopsys dot com>
- Date: Fri, 29 Apr 2016 18:29:11 +0300
- Subject: [PATCH 1/3] arc: Support "nano" build of newlib
- Authentication-results: sourceware.org; auth=none
Add necessary infrastructure to support "nano" build of newlib - optimized
for code size. ARC aproach to this feature is similiar to ARM's one here.
libgloss/Changelog:
2016-04-29 Anton Kolesov <anton.kolesov@synopsys.com>
* arc/nano.specs: New file.
* arc/Makefile.in: Support nano.specs.
* arc/nsim.specs: Likewise.
Signed-off-by: Anton Kolesov <Anton.Kolesov@synopsys.com>
---
libgloss/arc/Makefile.in | 10 +++++++++-
libgloss/arc/nano.specs | 18 ++++++++++++++++++
libgloss/arc/nsim.specs | 10 ++++++++--
3 files changed, 35 insertions(+), 3 deletions(-)
create mode 100644 libgloss/arc/nano.specs
diff --git a/libgloss/arc/Makefile.in b/libgloss/arc/Makefile.in
index ab8ad6d..58f0c57 100644
--- a/libgloss/arc/Makefile.in
+++ b/libgloss/arc/Makefile.in
@@ -58,6 +58,9 @@ NSIM_OBJS = \
NSIM_INSTALL = install-nsim
NSIM_SCRIPTS = nsim.specs
+NANO_SCRIPTS = nano.specs
+NANO_INSTALL = install-nano
+
CFLAGS = -g
# Host specific makefile fragment comes in here.
@@ -83,7 +86,7 @@ distclean maintainer-clean realclean: clean
rm -f Makefile config.status config.log config.cache *~
.PHONY: install info install-info clean-info doc dvi
-install: $(CRT0_INSTALL) $(NSIM_INSTALL)
+install: $(CRT0_INSTALL) $(NSIM_INSTALL) $(NANO_INSTALL)
# multilibdir may not exist yet - libgcc for ARC depends on libc, hence
# newlib/libgloss is built before libgcc. And in parallel build libgloss maybe
@@ -100,6 +103,11 @@ $(NSIM_INSTALL):
for x in $(NSIM_SCRIPTS); do \
$(INSTALL_DATA) $(srcdir)/$$x $(DESTDIR)$(tooldir)/lib$(MULTISUBDIR)/$$x; done
+$(NANO_INSTALL):
+ $(mkinstalldirs) $(DESTDIR)${tooldir}/lib${MULTISUBDIR}
+ for x in $(NANO_SCRIPTS); do \
+ $(INSTALL_DATA) $(srcdir)/$$x $(DESTDIR)$(tooldir)/lib$(MULTISUBDIR)/$$x; done
+
doc:
info:
dvi:
diff --git a/libgloss/arc/nano.specs b/libgloss/arc/nano.specs
new file mode 100644
index 0000000..91ab61d
--- /dev/null
+++ b/libgloss/arc/nano.specs
@@ -0,0 +1,18 @@
+%rename link nano_link
+%rename link_gcc_c_sequence nano_link_gcc_c_sequence
+
+*nano_libc:
+-lc_nano
+
+*nano_libgloss:
+%{specs=nsim.specs:-lnsim} %{specs=nosys.specs:-lnosys}
+
+*link_gcc_c_sequence:
+%(nano_link_gcc_c_sequence) --start-group %G %(nano_libc) %(nano_libgloss) --end-group
+
+*link:
+%(nano_link) %:replace-outfile(-lc -lc_nano) %:replace-outfile(-lg -lg_nano) %:replace-outfile(-lstdc++ -lstdc++_nano) %:replace-outfile(-lsupc++ -lsupc++_nano)
+
+*lib:
+%{!shared:%{g*:-lg_nano} %{!p:%{!pg:-lc_nano}}%{p:-lc_p}%{pg:-lc_p}}
+
diff --git a/libgloss/arc/nsim.specs b/libgloss/arc/nsim.specs
index aa77eea..508bdb2 100644
--- a/libgloss/arc/nsim.specs
+++ b/libgloss/arc/nsim.specs
@@ -1,5 +1,11 @@
-%rename link_gcc_c_sequence nsim_link_gcc_c_sequence
+%rename link_gcc_c_sequence nsim_link_gcc_c_sequence
+
+*nsim_libgloss:
+-lnsim
+
+*nsim_libc:
+%{!specs=nano.specs:-lc} %{specs=nano.specs:-lc_nano}
*link_gcc_c_sequence:
-%(nsim_link_gcc_c_sequence) --start-group %G -lc -lnsim --end-group
+%(nsim_link_gcc_c_sequence) --start-group %G %(nsim_libc) %(nsim_libgloss) --end-group
--
2.8.1