Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2016-12-22 22:50:00 +0300
committerJeff Johnston <jjohnstn@redhat.com>2016-12-22 22:50:00 +0300
commit959d85b3414d56fc49fc111eb0338cd8fd8dd971 (patch)
treeb652c1159354efc2d889a9838e9f2a96709a9a4b
parent483e696049e6c254d30663b15c7a5df1b75ca735 (diff)
This is an attempt to fix the problem described here:
https://sourceware.org/ml/newlib/2016/msg01139.html https://gcc.gnu.org/ml/gcc/2016-12/msg00010.html There is no change if libtool is used. Some run-time support libraries provided by GCC (e.g. libgomp) use configure checks to detect certain features, e.g. availability of thread-local storage. The configure script generates a test program and tries to compile and link it. It should use target libraries and startfiles of the build tree if available and not random ones from the installation prefix for this procedure. The search directories specified by -B are a bit special, see for_each_path() in gcc.c of the GCC sources. First a search is performed on all search paths with the multilib directory appended (if desired), then a second search is performed on demand with the base directory only. For each multilib there is a "newlib" subdirectory. This directory is specified by a -B option for the support libraries. In order to find the newlib artifacts (ctr0.o, libc.a, libg.a and libm.a) they must be located in a proper multilib subdirectory withing the build directory. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
-rw-r--r--newlib/Makefile.am39
-rw-r--r--newlib/Makefile.in30
-rwxr-xr-xnewlib/configure52
-rw-r--r--newlib/configure.in24
4 files changed, 122 insertions, 23 deletions
diff --git a/newlib/Makefile.am b/newlib/Makefile.am
index 20ab1633b..e43b2e3d8 100644
--- a/newlib/Makefile.am
+++ b/newlib/Makefile.am
@@ -77,19 +77,25 @@ toollibdir = $(tooldir)/lib$(MULTISUBDIR)
AR_FLAGS = rc
+noinst_DATA = stmp-targ-include
+
if USE_LIBTOOL
toollib_LTLIBRARIES = libm.la \
libc.la
else
toollib_LIBRARIES = libm.a \
libc.a
+if HAVE_MULTISUBDIR
+BUILD_MULTISUBDIR = $(builddir)$(MULTISUBDIR)
+if HAVE_CRT0
+noinst_DATA += $(BUILD_MULTISUBDIR)/$(CRT0)
+endif
+noinst_DATA += $(BUILD_MULTISUBDIR)/libc.a $(BUILD_MULTISUBDIR)/libm.a
+endif
endif
-
-noinst_DATA = stmp-targ-include
toollib_DATA = $(CRT0) $(CRT1)
-
# The functions ldexp, frexp and modf are traditionally supplied in
# both libc.a and libm.a. We build them in libm.a and copy them over,
# along with some required supporting routines.
@@ -171,23 +177,40 @@ libc/libc.a: ; @true
libm.a: libm/libm.a
rm -f $@
- ln libm/libm.a $@ >/dev/null 2>/dev/null || cp libm/libm.a $@
+ ln $< $@ >/dev/null 2>/dev/null || cp $< $@
libm/libm.a: ; @true
endif # USE_LIBTOOL
+if HAVE_MULTISUBDIR
+$(BUILD_MULTISUBDIR):
+ $(MKDIR_P) $@
+
+$(BUILD_MULTISUBDIR)/crt0.o: $(CRT0_DIR)$(CRT0) $(BUILD_MULTISUBDIR)
+ rm -f $@
+ ln $< $@ >/dev/null 2>/dev/null || cp $< $@
+
+$(BUILD_MULTISUBDIR)/libc.a: libc.a $(BUILD_MULTISUBDIR)
+ rm -f $@ $(BUILD_MULTISUBDIR)/libg.a
+ ln $< $@ >/dev/null 2>/dev/null || cp $< $@
+ ln libg.a $(BUILD_MULTISUBDIR)/libg.a >/dev/null 2>/dev/null || \
+ cp libg.a $(BUILD_MULTISUBDIR)/libg.a
+
+$(BUILD_MULTISUBDIR)/libm.a: libm.a $(BUILD_MULTISUBDIR)
+ rm -f $@
+ ln $< $@ >/dev/null 2>/dev/null || cp $< $@
+endif
+
crt0.o: $(CRT0_DIR)$(CRT0)
rm -f $@
- ln $(CRT0_DIR)$(CRT0) $@ >/dev/null 2>/dev/null \
- || cp $(CRT0_DIR)$(CRT0) $@
+ ln $< $@ >/dev/null 2>/dev/null || cp $< $@
$(CRT0_DIR)$(CRT0): ; @true
crt1.o: $(CRT1_DIR)$(CRT1)
rm -f $@
- ln $< $@ >/dev/null 2>/dev/null \
- || cp $< $@
+ ln $< $@ >/dev/null 2>/dev/null || cp $< $@
$(CRT1_DIR)$(CRT1): ; @true
diff --git a/newlib/Makefile.in b/newlib/Makefile.in
index f0296b667..58b4acdd2 100644
--- a/newlib/Makefile.in
+++ b/newlib/Makefile.in
@@ -53,6 +53,8 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
+@HAVE_CRT0_TRUE@@HAVE_MULTISUBDIR_TRUE@@USE_LIBTOOL_FALSE@am__append_1 = $(BUILD_MULTISUBDIR)/$(CRT0)
+@HAVE_MULTISUBDIR_TRUE@@USE_LIBTOOL_FALSE@am__append_2 = $(BUILD_MULTISUBDIR)/libc.a $(BUILD_MULTISUBDIR)/libm.a
subdir = .
DIST_COMMON = NEWS README ChangeLog $(srcdir)/Makefile.in \
$(srcdir)/Makefile.am $(top_srcdir)/configure \
@@ -380,13 +382,14 @@ SUBDIRS = libc libm \
tooldir = $(exec_prefix)/$(host_alias)
toollibdir = $(tooldir)/lib$(MULTISUBDIR)
AR_FLAGS = rc
+noinst_DATA = stmp-targ-include $(am__append_1) $(am__append_2)
@USE_LIBTOOL_TRUE@toollib_LTLIBRARIES = libm.la \
@USE_LIBTOOL_TRUE@ libc.la
@USE_LIBTOOL_FALSE@toollib_LIBRARIES = libm.a \
@USE_LIBTOOL_FALSE@ libc.a
-noinst_DATA = stmp-targ-include
+@HAVE_MULTISUBDIR_TRUE@@USE_LIBTOOL_FALSE@BUILD_MULTISUBDIR = $(builddir)$(MULTISUBDIR)
toollib_DATA = $(CRT0) $(CRT1)
# The functions ldexp, frexp and modf are traditionally supplied in
@@ -930,21 +933,36 @@ uninstall-am: uninstall-toollibDATA uninstall-toollibLIBRARIES \
@USE_LIBTOOL_FALSE@libm.a: libm/libm.a
@USE_LIBTOOL_FALSE@ rm -f $@
-@USE_LIBTOOL_FALSE@ ln libm/libm.a $@ >/dev/null 2>/dev/null || cp libm/libm.a $@
+@USE_LIBTOOL_FALSE@ ln $< $@ >/dev/null 2>/dev/null || cp $< $@
@USE_LIBTOOL_FALSE@libm/libm.a: ; @true
+@HAVE_MULTISUBDIR_TRUE@$(BUILD_MULTISUBDIR):
+@HAVE_MULTISUBDIR_TRUE@ $(MKDIR_P) $@
+
+@HAVE_MULTISUBDIR_TRUE@$(BUILD_MULTISUBDIR)/crt0.o: $(CRT0_DIR)$(CRT0) $(BUILD_MULTISUBDIR)
+@HAVE_MULTISUBDIR_TRUE@ rm -f $@
+@HAVE_MULTISUBDIR_TRUE@ ln $< $@ >/dev/null 2>/dev/null || cp $< $@
+
+@HAVE_MULTISUBDIR_TRUE@$(BUILD_MULTISUBDIR)/libc.a: libc.a $(BUILD_MULTISUBDIR)
+@HAVE_MULTISUBDIR_TRUE@ rm -f $@ $(BUILD_MULTISUBDIR)/libg.a
+@HAVE_MULTISUBDIR_TRUE@ ln $< $@ >/dev/null 2>/dev/null || cp $< $@
+@HAVE_MULTISUBDIR_TRUE@ ln libg.a $(BUILD_MULTISUBDIR)/libg.a >/dev/null 2>/dev/null || \
+@HAVE_MULTISUBDIR_TRUE@ cp libg.a $(BUILD_MULTISUBDIR)/libg.a
+
+@HAVE_MULTISUBDIR_TRUE@$(BUILD_MULTISUBDIR)/libm.a: libm.a $(BUILD_MULTISUBDIR)
+@HAVE_MULTISUBDIR_TRUE@ rm -f $@
+@HAVE_MULTISUBDIR_TRUE@ ln $< $@ >/dev/null 2>/dev/null || cp $< $@
+
crt0.o: $(CRT0_DIR)$(CRT0)
rm -f $@
- ln $(CRT0_DIR)$(CRT0) $@ >/dev/null 2>/dev/null \
- || cp $(CRT0_DIR)$(CRT0) $@
+ ln $< $@ >/dev/null 2>/dev/null || cp $< $@
$(CRT0_DIR)$(CRT0): ; @true
crt1.o: $(CRT1_DIR)$(CRT1)
rm -f $@
- ln $< $@ >/dev/null 2>/dev/null \
- || cp $< $@
+ ln $< $@ >/dev/null 2>/dev/null || cp $< $@
$(CRT1_DIR)$(CRT1): ; @true
diff --git a/newlib/configure b/newlib/configure
index 30e1d5766..24f41e0a2 100755
--- a/newlib/configure
+++ b/newlib/configure
@@ -632,7 +632,11 @@ CRT1_DIR
CRT1
CRT0_DIR
CRT0
+HAVE_CRT0_FALSE
+HAVE_CRT0_TRUE
EXTRA_DIRS
+HAVE_MULTISUBDIR_FALSE
+HAVE_MULTISUBDIR_TRUE
HAVE_DOC_FALSE
HAVE_DOC_TRUE
subdirs
@@ -11776,7 +11780,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11779 "configure"
+#line 11783 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11882,7 +11886,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11885 "configure"
+#line 11889 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12157,13 +12161,13 @@ subdirs="$subdirs libm"
if test -z "${with_multisubdir}"; then
+ have_multisubdir=no
subdirs="$subdirs doc"
- have_doc=yes
else
- have_doc=
+ have_multisubdir=yes
fi
- if test x$have_doc = xyes; then
+ if test x$have_multisubdir = xno; then
HAVE_DOC_TRUE=
HAVE_DOC_FALSE='#'
else
@@ -12172,6 +12176,28 @@ else
fi
+# Some run-time support libraries provided by GCC (e.g. libgomp) use configure
+# checks to detect certain features, e.g. availability of thread-local storage.
+# The configure script generates a test program and tries to compile and link
+# it. It should use target libraries and startfiles of the build tree if
+# available and not random ones from the installation prefix for this
+# procedure. The search directories specified by -B are a bit special, see
+# for_each_path() in gcc.c of the GCC sources. First a search is performed on
+# all search paths with the multilib directory appended (if desired), then a
+# second search is performed on demand with the base directory only. For each
+# multilib there is a "newlib" subdirectory. This directory is specified by a
+# -B option for the support libraries. In order to find the newlib artifacts
+# (ctr0.o, libc.a, libg.a and libm.a) they must be located in a proper multilib
+# subdirectory withing the build directory.
+ if test x$have_multisubdir = xyes; then
+ HAVE_MULTISUBDIR_TRUE=
+ HAVE_MULTISUBDIR_FALSE='#'
+else
+ HAVE_MULTISUBDIR_TRUE='#'
+ HAVE_MULTISUBDIR_FALSE=
+fi
+
+
EXTRA_DIRS=
case $host in
i[34567]86-pc-linux-*)
@@ -12188,6 +12214,14 @@ if test "x${have_crt0}" = "xyes"; then
CRT0=crt0.o
CRT0_DIR=libc/
fi
+ if test x$have_crt0 = xyes; then
+ HAVE_CRT0_TRUE=
+ HAVE_CRT0_FALSE='#'
+else
+ HAVE_CRT0_TRUE='#'
+ HAVE_CRT0_FALSE=
+fi
+
@@ -12827,6 +12861,14 @@ if test -z "${HAVE_DOC_TRUE}" && test -z "${HAVE_DOC_FALSE}"; then
as_fn_error $? "conditional \"HAVE_DOC\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${HAVE_MULTISUBDIR_TRUE}" && test -z "${HAVE_MULTISUBDIR_FALSE}"; then
+ as_fn_error $? "conditional \"HAVE_MULTISUBDIR\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${HAVE_CRT0_TRUE}" && test -z "${HAVE_CRT0_FALSE}"; then
+ as_fn_error $? "conditional \"HAVE_CRT0\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${HAVE_LONG_DOUBLE_TRUE}" && test -z "${HAVE_LONG_DOUBLE_FALSE}"; then
as_fn_error $? "conditional \"HAVE_LONG_DOUBLE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/newlib/configure.in b/newlib/configure.in
index 01c6367a9..bfaf038c7 100644
--- a/newlib/configure.in
+++ b/newlib/configure.in
@@ -261,12 +261,27 @@ AC_CONFIG_SUBDIRS(libc)
AC_CONFIG_SUBDIRS(libm)
if test -z "${with_multisubdir}"; then
+ have_multisubdir=no
AC_CONFIG_SUBDIRS(doc)
- have_doc=yes
else
- have_doc=
-fi
-AM_CONDITIONAL(HAVE_DOC, test x$have_doc = xyes)
+ have_multisubdir=yes
+fi
+AM_CONDITIONAL(HAVE_DOC, test x$have_multisubdir = xno)
+
+# Some run-time support libraries provided by GCC (e.g. libgomp) use configure
+# checks to detect certain features, e.g. availability of thread-local storage.
+# The configure script generates a test program and tries to compile and link
+# it. It should use target libraries and startfiles of the build tree if
+# available and not random ones from the installation prefix for this
+# procedure. The search directories specified by -B are a bit special, see
+# for_each_path() in gcc.c of the GCC sources. First a search is performed on
+# all search paths with the multilib directory appended (if desired), then a
+# second search is performed on demand with the base directory only. For each
+# multilib there is a "newlib" subdirectory. This directory is specified by a
+# -B option for the support libraries. In order to find the newlib artifacts
+# (ctr0.o, libc.a, libg.a and libm.a) they must be located in a proper multilib
+# subdirectory withing the build directory.
+AM_CONDITIONAL(HAVE_MULTISUBDIR, test x$have_multisubdir = xyes)
EXTRA_DIRS=
case $host in
@@ -283,6 +298,7 @@ if test "x${have_crt0}" = "xyes"; then
CRT0=crt0.o
CRT0_DIR=libc/
fi
+AM_CONDITIONAL(HAVE_CRT0, test x$have_crt0 = xyes)
AC_SUBST(CRT0)
AC_SUBST(CRT0_DIR)