From 1d54b2cdef5fc5f512e6a4ae9dec86441b669818 Mon Sep 17 00:00:00 2001 From: George Thessalonikefs Date: Tue, 30 Mar 2021 22:15:12 +0200 Subject: [PATCH 1/5] - Disable the use of stack-protector for cross compiled 32-bit windows builds; relates to #444. --- doc/Changelog | 4 ++++ makedist.sh | 18 +++++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/doc/Changelog b/doc/Changelog index d5412a2a0..e652f3f6d 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,3 +1,7 @@ +30 March 2021: George + - Disable the use of stack-protector for cross compiled 32-bit windows + builds; relates to #444. + 25 March 2021: Wouter - Fix #429: Also fix end of transfer for http download of auth zones. diff --git a/makedist.sh b/makedist.sh index 25cabe136..df44a97a8 100755 --- a/makedist.sh +++ b/makedist.sh @@ -371,7 +371,12 @@ if [ "$DOWIN" = "yes" ]; then || error_cleanup "Could not configure" fi info "Calling make" - make $MINJ || error_cleanup "Could not make" + # Disable stack-protector for 32-bit windows builds. + if test "$W64" = "no"; then + make $MINJ CFLAGS='-fno-stack-protector' || error_cleanup "Could not make" + else + make $MINJ || error_cleanup "Could not make" + fi info "Make complete" if test "`uname`" = "Linux"; then @@ -386,7 +391,12 @@ if [ "$DOWIN" = "yes" ]; then || error_cleanup "Could not configure" fi info "Calling make for DLL" - make $MINJ || error_cleanup "Could not make DLL" + # Disable stack-protector for 32-bit windows builds. + if test "$W64" = "no"; then + make $MINJ CFLAGS='-fno-stack-protector' || error_cleanup "Could not make DLL" + else + make $MINJ || error_cleanup "Could not make DLL" + fi info "Make DLL complete" cd ../unbound fi @@ -413,7 +423,9 @@ if [ "$DOWIN" = "yes" ]; then mkdir libunbound cp ../../unbound_shared/unbound.h ../../unbound_shared/.libs/libunbound*.dll ../../unbound_shared/.libs/libunbound.dll.a ../../unbound_shared/.libs/libunbound.a ../../unbound_shared/.libs/libunbound*.def ../../sslsharedinstall/lib/libcrypto.dll.a ../../sslsharedinstall/lib/libssl.dll.a ../../sslsharedinstall/bin/libcrypto*.dll ../../sslsharedinstall/bin/libssl*.dll ../../wxpinstall/bin/libexpat*.dll ../../wxpinstall/lib/libexpat.dll.a libunbound/. if test "$W64" = "no"; then - cp /usr/i686-w64-mingw32/sys-root/mingw/bin/libssp-0.dll libunbound/. + # Disable stack-protector for 32-bit windows builds. + # cp /usr/i686-w64-mingw32/sys-root/mingw/bin/libssp-0.dll libunbound/. + : else cp /usr/x86_64-w64-mingw32/sys-root/mingw/bin/libssp-0.dll libunbound/. fi From d23e1f11002d23a9967e1cce5f7b515641d023b4 Mon Sep 17 00:00:00 2001 From: "W.C.A. Wijngaards" Date: Wed, 31 Mar 2021 10:01:42 +0200 Subject: [PATCH 2/5] - Fix stack-protector change to not override other CFLAGS options. --- doc/Changelog | 3 +++ makedist.sh | 12 ++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/doc/Changelog b/doc/Changelog index e652f3f6d..fd10160fb 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,3 +1,6 @@ +31 March 2021: Wouter + - Fix stack-protector change to not override other CFLAGS options. + 30 March 2021: George - Disable the use of stack-protector for cross compiled 32-bit windows builds; relates to #444. diff --git a/makedist.sh b/makedist.sh index df44a97a8..d490f4aad 100755 --- a/makedist.sh +++ b/makedist.sh @@ -364,16 +364,16 @@ if [ "$DOWIN" = "yes" ]; then fi echo "$configure"' --enable-debug --enable-static-exe --disable-flto '"$* $cross_flag "$file_flag" "$file2_flag" "$file3_flag"" if test "$W64" = "no"; then - $configure --enable-debug --enable-static-exe --disable-flto $* $cross_flag "$file_flag" "$file2_flag" "$file3_flag" \ + # Disable stack-protector for 32-bit windows builds. + $configure --enable-debug --enable-static-exe --disable-flto $* $cross_flag "$file_flag" "$file2_flag" "$file3_flag" CFLAGS='-O2 -g -fno-stack-protector'\ || error_cleanup "Could not configure" else $configure --enable-debug --enable-static-exe --disable-flto $* $cross_flag \ || error_cleanup "Could not configure" fi info "Calling make" - # Disable stack-protector for 32-bit windows builds. if test "$W64" = "no"; then - make $MINJ CFLAGS='-fno-stack-protector' || error_cleanup "Could not make" + make $MINJ || error_cleanup "Could not make" else make $MINJ || error_cleanup "Could not make" fi @@ -384,16 +384,16 @@ if [ "$DOWIN" = "yes" ]; then cd ../unbound_shared echo "$configure"' --enable-debug --disable-flto '"$* $shared_cross_flag "$file_flag" "$file2_flag" "$file3_flag"" if test "$W64" = "no"; then - $configure --enable-debug --disable-flto $* $shared_cross_flag "$file_flag" "$file2_flag" "$file3_flag" \ + # Disable stack-protector for 32-bit windows builds. + $configure --enable-debug --disable-flto $* $shared_cross_flag "$file_flag" "$file2_flag" "$file3_flag" CFLAGS='-O2 -g -fno-stack-protector'\ || error_cleanup "Could not configure" else $configure --enable-debug --disable-flto $* $shared_cross_flag \ || error_cleanup "Could not configure" fi info "Calling make for DLL" - # Disable stack-protector for 32-bit windows builds. if test "$W64" = "no"; then - make $MINJ CFLAGS='-fno-stack-protector' || error_cleanup "Could not make DLL" + make $MINJ || error_cleanup "Could not make DLL" else make $MINJ || error_cleanup "Could not make DLL" fi From 9d238060e1e84dc9577bdebff304281b3c755bdc Mon Sep 17 00:00:00 2001 From: George Thessalonikefs Date: Wed, 31 Mar 2021 13:37:08 +0200 Subject: [PATCH 3/5] - Clean makedist.sh. --- doc/Changelog | 3 +++ makedist.sh | 34 ++++++++++++++-------------------- 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/doc/Changelog b/doc/Changelog index fd10160fb..b2f9c2e6c 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,3 +1,6 @@ +31 March 2021: George + - Clean makedist.sh. + 31 March 2021: Wouter - Fix stack-protector change to not override other CFLAGS options. diff --git a/makedist.sh b/makedist.sh index d490f4aad..6b7e0a83d 100755 --- a/makedist.sh +++ b/makedist.sh @@ -362,41 +362,35 @@ if [ "$DOWIN" = "yes" ]; then file3_flag="--with-rootcert-file=C:\Program Files (x86)\Unbound\icannbundle.pem" version="$version"-w32 fi - echo "$configure"' --enable-debug --enable-static-exe --disable-flto '"$* $cross_flag "$file_flag" "$file2_flag" "$file3_flag"" if test "$W64" = "no"; then - # Disable stack-protector for 32-bit windows builds. - $configure --enable-debug --enable-static-exe --disable-flto $* $cross_flag "$file_flag" "$file2_flag" "$file3_flag" CFLAGS='-O2 -g -fno-stack-protector'\ - || error_cleanup "Could not configure" + # Disable stack-protector for 32-bit windows builds. + echo "$configure"' --enable-debug --enable-static-exe --disable-flto '"$* $cross_flag" "$file_flag" "$file2_flag" "$file3_flag" CFLAGS='-O2 -g -fno-stack-protector' + $configure --enable-debug --enable-static-exe --disable-flto $* $cross_flag "$file_flag" "$file2_flag" "$file3_flag" CFLAGS='-O2 -g -fno-stack-protector'\ + || error_cleanup "Could not configure" else - $configure --enable-debug --enable-static-exe --disable-flto $* $cross_flag \ - || error_cleanup "Could not configure" + echo "$configure"' --enable-debug --enable-static-exe --disable-flto '"$* $cross_flag" + $configure --enable-debug --enable-static-exe --disable-flto $* $cross_flag \ + || error_cleanup "Could not configure" fi info "Calling make" - if test "$W64" = "no"; then - make $MINJ || error_cleanup "Could not make" - else - make $MINJ || error_cleanup "Could not make" - fi + make $MINJ || error_cleanup "Could not make" info "Make complete" if test "`uname`" = "Linux"; then info "Make DLL" cd ../unbound_shared - echo "$configure"' --enable-debug --disable-flto '"$* $shared_cross_flag "$file_flag" "$file2_flag" "$file3_flag"" if test "$W64" = "no"; then # Disable stack-protector for 32-bit windows builds. - $configure --enable-debug --disable-flto $* $shared_cross_flag "$file_flag" "$file2_flag" "$file3_flag" CFLAGS='-O2 -g -fno-stack-protector'\ - || error_cleanup "Could not configure" + echo "$configure"' --enable-debug --disable-flto '"$* $shared_cross_flag" "$file_flag" "$file2_flag" "$file3_flag" CFLAGS='-O2 -g -fno-stack-protector' + $configure --enable-debug --disable-flto $* $shared_cross_flag "$file_flag" "$file2_flag" "$file3_flag" CFLAGS='-O2 -g -fno-stack-protector'\ + || error_cleanup "Could not configure" else + echo "$configure"' --enable-debug --disable-flto '"$* $shared_cross_flag" $configure --enable-debug --disable-flto $* $shared_cross_flag \ - || error_cleanup "Could not configure" + || error_cleanup "Could not configure" fi info "Calling make for DLL" - if test "$W64" = "no"; then - make $MINJ || error_cleanup "Could not make DLL" - else - make $MINJ || error_cleanup "Could not make DLL" - fi + make $MINJ || error_cleanup "Could not make DLL" info "Make DLL complete" cd ../unbound fi From b0298224cb30e1e3eeb76af589a640e292eb84ac Mon Sep 17 00:00:00 2001 From: orbea Date: Wed, 31 Mar 2021 16:22:47 -0700 Subject: [PATCH 4/5] build: Link with the libtool archive. --- Makefile.in | 10 +++++----- configure.ac | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Makefile.in b/Makefile.in index 69ce8e9b2..8d5c7ee83 100644 --- a/Makefile.in +++ b/Makefile.in @@ -358,10 +358,10 @@ unbound-control$(EXEEXT): $(CONTROL_OBJ_LINK) libunbound.la $(LINK) -o $@ $(CONTROL_OBJ_LINK) $(EXTRALINK) $(SSLLIB) $(LIBS) unbound-host$(EXEEXT): $(HOST_OBJ_LINK) libunbound.la - $(LINK) -o $@ $(HOST_OBJ_LINK) -L. -L.libs -lunbound $(SSLLIB) $(LIBS) + $(LINK) -o $@ $(HOST_OBJ_LINK) libunbound.la $(SSLLIB) $(LIBS) unbound-anchor$(EXEEXT): $(UBANCHOR_OBJ_LINK) libunbound.la - $(LINK) -o $@ $(UBANCHOR_OBJ_LINK) -L. -L.libs -lunbound -lexpat $(SSLLIB) $(LIBS) + $(LINK) -o $@ $(UBANCHOR_OBJ_LINK) libunbound.la -lexpat $(SSLLIB) $(LIBS) unbound-service-install$(EXEEXT): $(SVCINST_OBJ_LINK) $(LINK) -o $@ $(SVCINST_OBJ_LINK) $(LIBS) @@ -370,7 +370,7 @@ unbound-service-remove$(EXEEXT): $(SVCUNINST_OBJ_LINK) $(LINK) -o $@ $(SVCUNINST_OBJ_LINK) $(LIBS) anchor-update$(EXEEXT): $(ANCHORUPD_OBJ_LINK) libunbound.la - $(LINK) -o $@ $(ANCHORUPD_OBJ_LINK) -L. -L.libs -lunbound $(LIBS) + $(LINK) -o $@ $(ANCHORUPD_OBJ_LINK) libunbound.la $(LIBS) unittest$(EXEEXT): $(UNITTEST_OBJ_LINK) $(LINK) -o $@ $(UNITTEST_OBJ_LINK) $(SSLLIB) $(LIBS) @@ -391,7 +391,7 @@ memstats$(EXEEXT): $(MEMSTATS_OBJ_LINK) $(LINK) -o $@ $(MEMSTATS_OBJ_LINK) $(SSLLIB) $(LIBS) asynclook$(EXEEXT): $(ASYNCLOOK_OBJ_LINK) libunbound.la - $(LINK) -o $@ $(ASYNCLOOK_OBJ_LINK) -L. -L.libs -lunbound $(SSLLIB) $(LIBS) + $(LINK) -o $@ $(ASYNCLOOK_OBJ_LINK) libunbound.la $(SSLLIB) $(LIBS) streamtcp$(EXEEXT): $(STREAMTCP_OBJ_LINK) $(LINK) -o $@ $(STREAMTCP_OBJ_LINK) $(SSLLIB) $(LIBS) @@ -468,7 +468,7 @@ libunbound/python/libunbound_wrap.c: $(srcdir)/libunbound/python/libunbound.i un # Pyunbound python unbound wrapper _unbound.la: libunbound_wrap.lo libunbound.la - $(LIBTOOL) --tag=CC --mode=link $(CC) $(RUNTIME_PATH) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -module -avoid-version -no-undefined -shared -o $@ libunbound_wrap.lo -rpath $(PYTHON_SITE_PKG) -L. -L.libs -lunbound $(LIBS) + $(LIBTOOL) --tag=CC --mode=link $(CC) $(RUNTIME_PATH) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -module -avoid-version -no-undefined -shared -o $@ libunbound_wrap.lo -rpath $(PYTHON_SITE_PKG) libunbound.la $(LIBS) util/config_file.c: util/configparser.h util/configlexer.c: $(srcdir)/util/configlexer.lex util/configparser.h diff --git a/configure.ac b/configure.ac index efbdfe6aa..43286e2b9 100644 --- a/configure.ac +++ b/configure.ac @@ -1713,7 +1713,7 @@ case "$enable_allsymbols" in yes) COMMON_OBJ_ALL_SYMBOLS="" UBSYMS="" - EXTRALINK="-L. -L.libs -lunbound" + EXTRALINK="libunbound.la" AC_DEFINE(EXPORT_ALL_SYMBOLS, 1, [Define this if you enabled-allsymbols from libunbound to link binaries to it for smaller install size, but the libunbound export table is polluted by internal symbols]) ;; no|*) From fb315509ab7c221dac1e3360365d3b91c333495c Mon Sep 17 00:00:00 2001 From: "W.C.A. Wijngaards" Date: Thu, 1 Apr 2021 09:12:50 +0200 Subject: [PATCH 5/5] Changelog note for #460. - Merge #460 from orbea: build: Link with the libtool archive. --- doc/Changelog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/Changelog b/doc/Changelog index b2f9c2e6c..c816b2e9d 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,3 +1,6 @@ +1 April 2021: Wouter + - Merge #460 from orbea: build: Link with the libtool archive. + 31 March 2021: George - Clean makedist.sh.