mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-27 01:11:14 +00:00
1d7042231b
Add -static-libstdc++ to TARGET_LDFLAGS to avoid a hard dependency on libstdc++, and -Wl,--gc-sections to further reduce the size on platforms that support it. Fixes CVE-2017-9778. Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
77 lines
2.7 KiB
Diff
77 lines
2.7 KiB
Diff
--- a/configure.ac
|
|
+++ b/configure.ac
|
|
@@ -1300,13 +1300,13 @@ if test -z "$LD"; then
|
|
fi
|
|
fi
|
|
|
|
-# Check whether -static-libstdc++ -static-libgcc is supported.
|
|
+# Check whether -static-libstdc++ is supported.
|
|
have_static_libs=no
|
|
if test "$GCC" = yes; then
|
|
saved_LDFLAGS="$LDFLAGS"
|
|
|
|
- LDFLAGS="$LDFLAGS -static-libstdc++ -static-libgcc"
|
|
- AC_MSG_CHECKING([whether g++ accepts -static-libstdc++ -static-libgcc])
|
|
+ LDFLAGS="$LDFLAGS -static-libstdc++"
|
|
+ AC_MSG_CHECKING([whether g++ accepts -static-libstdc++])
|
|
AC_LANG_PUSH(C++)
|
|
AC_LINK_IFELSE([
|
|
#if (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
|
|
@@ -1632,7 +1632,7 @@ AC_ARG_WITH(stage1-ldflags,
|
|
# if supported. But if the user explicitly specified the libraries to use,
|
|
# trust that they are doing what they want.
|
|
if test "$stage1_libs" = "" -a "$have_static_libs" = yes; then
|
|
- stage1_ldflags="-static-libstdc++ -static-libgcc"
|
|
+ stage1_ldflags="-static-libstdc++"
|
|
fi])
|
|
AC_SUBST(stage1_ldflags)
|
|
|
|
@@ -1661,7 +1661,7 @@ AC_ARG_WITH(boot-ldflags,
|
|
# statically. But if the user explicitly specified the libraries to
|
|
# use, trust that they are doing what they want.
|
|
if test "$poststage1_libs" = ""; then
|
|
- poststage1_ldflags="-static-libstdc++ -static-libgcc"
|
|
+ poststage1_ldflags="-static-libstdc++"
|
|
fi])
|
|
AC_SUBST(poststage1_ldflags)
|
|
|
|
--- a/configure
|
|
+++ b/configure
|
|
@@ -5005,14 +5005,14 @@ if test -z "$LD"; then
|
|
fi
|
|
fi
|
|
|
|
-# Check whether -static-libstdc++ -static-libgcc is supported.
|
|
+# Check whether -static-libstdc++ is supported.
|
|
have_static_libs=no
|
|
if test "$GCC" = yes; then
|
|
saved_LDFLAGS="$LDFLAGS"
|
|
|
|
- LDFLAGS="$LDFLAGS -static-libstdc++ -static-libgcc"
|
|
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether g++ accepts -static-libstdc++ -static-libgcc" >&5
|
|
-$as_echo_n "checking whether g++ accepts -static-libstdc++ -static-libgcc... " >&6; }
|
|
+ LDFLAGS="$LDFLAGS -static-libstdc++"
|
|
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether g++ accepts -static-libstdc++" >&5
|
|
+$as_echo_n "checking whether g++ accepts -static-libstdc++... " >&6; }
|
|
ac_ext=cpp
|
|
ac_cpp='$CXXCPP $CPPFLAGS'
|
|
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
|
@@ -5795,7 +5795,7 @@ else
|
|
# if supported. But if the user explicitly specified the libraries to use,
|
|
# trust that they are doing what they want.
|
|
if test "$stage1_libs" = "" -a "$have_static_libs" = yes; then
|
|
- stage1_ldflags="-static-libstdc++ -static-libgcc"
|
|
+ stage1_ldflags="-static-libstdc++"
|
|
fi
|
|
fi
|
|
|
|
@@ -5831,7 +5831,7 @@ else
|
|
# statically. But if the user explicitly specified the libraries to
|
|
# use, trust that they are doing what they want.
|
|
if test "$poststage1_libs" = ""; then
|
|
- poststage1_ldflags="-static-libstdc++ -static-libgcc"
|
|
+ poststage1_ldflags="-static-libstdc++"
|
|
fi
|
|
fi
|
|
|