aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorJoel Holdsworth <jholdsworth@nvidia.com>2022-02-24 15:06:28 +0000
committerChris Packham <judge.packham@gmail.com>2022-05-11 20:25:42 +1200
commitda1ffd041276ad87787be0c5cbcd7841082e3619 (patch)
tree4e8b2da4a6a2d1ac1e9c9194bb22c3cd633c4100 /scripts
parent3ac6f1791af77b682b1de4ad56157653aa566417 (diff)
downloadcrosstool-ng-da1ffd041276ad87787be0c5cbcd7841082e3619.tar.gz
crosstool-ng-da1ffd041276ad87787be0c5cbcd7841082e3619.tar.bz2
crosstool-ng-da1ffd041276ad87787be0c5cbcd7841082e3619.zip
cc/gcc: Remove -lstdc++ and -lm from gcc LDFLAGS
In Bryan Hundven's patch 1ad439907 from 2010, the author added -lstdc++ and -lm to the host gcc build's LDFLAGS, because at the time the linker did not correctly include these libraries causing the build to fail. In modern builds, this causes a problem for canadian gcc builds where the host machine is mingw32-w64 Windows. Within the gcc build there is the liblto_plugin module. On Windows this must be built as the "liblto_plugin.dll" dynamic library. However, libtool cannot produce a dynamic library unless every library dependency is also a dynamic library, and falls back to producing a libstdc++.a static library. liblto_plugin does not require libstdc++ - it does not contain any C++ code, and the dependency would usually be elided by the linker. Unfortunately, in this case, crosstool-ng will never build a libstdc++.dll dynamic library - only a libstdc++.a static library. Therefore, there will never be a dynamic library version of stdc++ for libtool to load and then discard. This patch corrects the issue by removing "-lstdc++" from LDFLAGS, because modern versions of gcc are able to correctly include libstdc++ where necessary. It also remove "-lm" for similar reasons. Signed-off-by: Joel Holdsworth <jholdsworth@nvidia.com>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/build/cc/gcc.sh24
1 files changed, 0 insertions, 24 deletions
diff --git a/scripts/build/cc/gcc.sh b/scripts/build/cc/gcc.sh
index 0f369a47..59666160 100644
--- a/scripts/build/cc/gcc.sh
+++ b/scripts/build/cc/gcc.sh
@@ -396,12 +396,6 @@ do_gcc_core_backend() {
host_libstdcxx_flags+=("-Wl,-Bstatic,-lstdc++")
host_libstdcxx_flags+=("-lm")
fi
- # Companion libraries are build static (eg !shared), so
- # the libstdc++ is not pulled automatically, although it
- # is needed. Shoe-horn it in our LDFLAGS
- # Ditto libm on some Fedora boxen
- core_LDFLAGS+=("-lstdc++")
- core_LDFLAGS+=("-lm")
else
if [ "${CT_CC_GCC_STATIC_LIBSTDCXX}" = "y" -a "${CT_GCC_older_than_6}" = "y" ]; then
# this is from CodeSourcery arm-2010q1-202-arm-none-linux-gnueabi.src.tar.bz2
@@ -412,12 +406,6 @@ do_gcc_core_backend() {
host_libstdcxx_flags+=("-Wl,-Bstatic,-lstdc++,-Bdynamic")
host_libstdcxx_flags+=("-lm")
fi
- # When companion libraries are build static (eg !shared),
- # the libstdc++ is not pulled automatically, although it
- # is needed. Shoe-horn it in our LDFLAGS
- # Ditto libm on some Fedora boxen
- core_LDFLAGS+=("-lstdc++")
- core_LDFLAGS+=("-lm")
fi
extra_config+=("--with-gmp=${complibs}")
@@ -1036,12 +1024,6 @@ do_gcc_backend() {
host_libstdcxx_flags+=("-Wl,-Bstatic,-lstdc++")
host_libstdcxx_flags+=("-lm")
fi
- # Companion libraries are build static (eg !shared), so
- # the libstdc++ is not pulled automatically, although it
- # is needed. Shoe-horn it in our LDFLAGS
- # Ditto libm on some Fedora boxen
- final_LDFLAGS+=("-lstdc++")
- final_LDFLAGS+=("-lm")
else
if [ "${CT_CC_GCC_STATIC_LIBSTDCXX}" = "y" -a "${CT_GCC_older_than_6}" = "y" ]; then
# this is from CodeSourcery arm-2010q1-202-arm-none-linux-gnueabi.src.tar.bz2
@@ -1052,12 +1034,6 @@ do_gcc_backend() {
host_libstdcxx_flags+=("-Wl,-Bstatic,-lstdc++,-Bdynamic")
host_libstdcxx_flags+=("-lm")
fi
- # When companion libraries are build static (eg !shared),
- # the libstdc++ is not pulled automatically, although it
- # is needed. Shoe-horn it in our LDFLAGS
- # Ditto libm on some Fedora boxen
- final_LDFLAGS+=("-lstdc++")
- final_LDFLAGS+=("-lm")
fi
extra_config+=("--with-gmp=${complibs}")