logo

bootstrap-initrd

Linux initrd to bootstrap from a small binary seed git clone https://anongit.hacktivis.me/git/bootstrap-initrd.git/

zlib-1.3.1-use-LDFLAGS-in-configure.patch (2716B)


  1. https://github.com/madler/zlib/pull/599
  2. Rebased version of:
  3. From 37c9730ba474d274f4cc6a974943eef95087b9f6 Mon Sep 17 00:00:00 2001
  4. From: Khem Raj <raj.khem@gmail.com>
  5. Date: Tue, 8 Mar 2022 22:38:47 -0800
  6. Subject: [PATCH] configure: Pass LDFLAGS to link tests
  7. LDFLAGS can contain critical flags without which linking wont succeed
  8. therefore ensure that all configure tests involving link time checks are
  9. using LDFLAGS on compiler commandline along with CFLAGS to ensure the
  10. tests perform correctly. Without this some tests may fail resulting in
  11. wrong confgure result, ending in miscompiling the package
  12. Signed-off-by: Khem Raj <raj.khem@gmail.com>k
  13. --- zlib-1.3.1/configure
  14. +++ zlib-1.3.1/configure
  15. @@ -448,8 +448,8 @@ EOF
  16. if test $shared -eq 1; then
  17. echo Checking for shared library support... | tee -a configure.log
  18. # we must test in two steps (cc then ld), required at least on SunOS 4.x
  19. - if try $CC -c $SFLAGS $test.c &&
  20. - try $LDSHARED $SFLAGS -o $test$shared_ext $test.o; then
  21. + if try $CC -c $SFLAGS $LDFLAGS $test.c &&
  22. + try $LDSHARED $SFLAGS $LDFLAGS -o $test$shared_ext $test.o; then
  23. echo Building shared library $SHAREDLIBV with $CC. | tee -a configure.log
  24. elif test -z "$old_cc" -a -z "$old_cflags"; then
  25. echo No shared library support. | tee -a configure.log
  26. @@ -511,7 +511,7 @@ int main(void) {
  27. }
  28. EOF
  29. fi
  30. - if try $CC $CFLAGS -o $test $test.c; then
  31. + if try $CC $CFLAGS $LDFLAGS -o $test $test.c; then
  32. sizet=`./$test`
  33. echo "Checking for a pointer-size integer type..." $sizet"." | tee -a configure.log
  34. CFLAGS="${CFLAGS} -DNO_SIZE_T=${sizet}"
  35. @@ -545,7 +545,7 @@ int main(void) {
  36. return 0;
  37. }
  38. EOF
  39. - if try $CC $CFLAGS -o $test $test.c; then
  40. + if try $CC $CFLAGS $LDFLAGS -o $test $test.c; then
  41. echo "Checking for fseeko... Yes." | tee -a configure.log
  42. else
  43. CFLAGS="${CFLAGS} -DNO_FSEEKO"
  44. @@ -562,7 +562,7 @@ cat > $test.c <<EOF
  45. #include <errno.h>
  46. int main() { return strlen(strerror(errno)); }
  47. EOF
  48. -if try $CC $CFLAGS -o $test $test.c; then
  49. +if try $CC $CFLAGS $LDFLAGS -o $test $test.c; then
  50. echo "Checking for strerror... Yes." | tee -a configure.log
  51. else
  52. CFLAGS="${CFLAGS} -DNO_STRERROR"
  53. @@ -669,7 +669,7 @@ int main()
  54. return (mytest("Hello%d\n", 1));
  55. }
  56. EOF
  57. - if try $CC $CFLAGS -o $test $test.c; then
  58. + if try $CC $CFLAGS $LDFLAGS -o $test $test.c; then
  59. echo "Checking for vsnprintf() in stdio.h... Yes." | tee -a configure.log
  60. echo >> configure.log
  61. @@ -759,7 +759,7 @@ int main()
  62. }
  63. EOF
  64. - if try $CC $CFLAGS -o $test $test.c; then
  65. + if try $CC $CFLAGS $LDFLAGS -o $test $test.c; then
  66. echo "Checking for snprintf() in stdio.h... Yes." | tee -a configure.log
  67. echo >> configure.log