This is the mail archive of the
newlib@sources.redhat.com
mailing list for the newlib project.
Re: Hard links
- To: Andrew Stubbs <Andrew dot Stubbs at st dot com>
- Subject: Re: Hard links
- From: "J. Johnston" <jjohnstn at cygnus dot com>
- Date: Tue, 19 Jun 2001 20:47:19 -0400
- CC: newlib at sources dot redhat dot com
- Organization: Red Hat Inc.
- References: <Pine.GSO.4.10.10106191342000.18813-100000@absolut>
Andrew Stubbs wrote:
>
> There are several places in the newlib make file which use hard links.
> Unfortunatly the ln command seems to be a bit flakey with the file system
> I am using - sometimes it works and sometimes not, it depends on which
> directory it is in.
>
> This is not a problem for GCC as configure checks whether ln works and I
> can force it to use cp instead (by setting gcc_cv_prog_LN=cp).
>
> Are the hard links used by newlib absolutly necessary? If so could newlib
> please be modified to solve my problem?
>
Actually, there are already tests in the Makefiles so that cp is used to back up the ln operation if
it fails. It is unfortunate that your ln is not returning failure in those cases. Have you
considered just aliasing ln to cp? AFAICT, there are no option flags being used by newlib.
I did manage to find two cases in the top level Makefile.am where cp was not being used to back up
ln. If you are interested, I have attached a patch which fixes these two situations. You apply it
in the top level newlib directory:
patch -u -p0 <ln.patch
-- Jeff J.
Index: Makefile.am
===================================================================
RCS file: /cvs/src/src/newlib/Makefile.am,v
retrieving revision 1.5
diff -u -r1.5 Makefile.am
--- Makefile.am 2000/12/13 19:32:45 1.5
+++ Makefile.am 2001/06/20 00:27:07
@@ -81,7 +81,7 @@
$(AR) x ../libc/libc.a ; \
$(AR) $(AR_FLAGS) ../$@ *.o
$(RANLIB) libc.a
- ln libc.a libg.a
+ ln libc.a libg.a >/dev/null 2>/dev/null || cp libc.a libg.a
rm -rf tmp
libc/libc.a: ; @true
@@ -128,7 +128,7 @@
install-data-local: install-toollibLIBRARIES
rm -f $(DESTDIR)$(toollibdir)/libg.a
- ln $(DESTDIR)$(toollibdir)/libc.a $(DESTDIR)$(toollibdir)/libg.a
+ ln $(DESTDIR)$(toollibdir)/libc.a $(DESTDIR)$(toollibdir)/libg.a >/dev/null 2>/dev/null || cp $(DESTDIR)$(toollibdir)/libc.a $(DESTDIR)$(toollibdir)/libg.a
$(MULTIDO) $(AM_MAKEFLAGS) DO=install multi-do
-if [ -z "$(MULTISUBDIR)" ]; then \
$(mkinstalldirs) $(DESTDIR)$(tooldir)/include; \
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/newlib/Makefile.in,v
retrieving revision 1.5
diff -u -r1.5 Makefile.in
--- Makefile.in 2000/12/13 19:32:45 1.5
+++ Makefile.in 2001/06/20 00:27:07
@@ -516,7 +516,7 @@
$(AR) x ../libc/libc.a ; \
$(AR) $(AR_FLAGS) ../$@ *.o
$(RANLIB) libc.a
- ln libc.a libg.a
+ ln libc.a libg.a >/dev/null 2>/dev/null || cp libc.a libg.a
rm -rf tmp
libc/libc.a: ; @true
@@ -561,7 +561,7 @@
install-data-local: install-toollibLIBRARIES
rm -f $(DESTDIR)$(toollibdir)/libg.a
- ln $(DESTDIR)$(toollibdir)/libc.a $(DESTDIR)$(toollibdir)/libg.a
+ ln $(DESTDIR)$(toollibdir)/libc.a $(DESTDIR)$(toollibdir)/libg.a >/dev/null 2>/dev/null || cp $(DESTDIR)$(toollibdir)/libc.a $(DESTDIR)$(toollibdir)/libg.a
$(MULTIDO) $(AM_MAKEFLAGS) DO=install multi-do
-if [ -z "$(MULTISUBDIR)" ]; then \
$(mkinstalldirs) $(DESTDIR)$(tooldir)/include; \