diff --git a/erlang.spec b/erlang.spec index d0e1820..63209fd 100644 --- a/erlang.spec +++ b/erlang.spec @@ -66,7 +66,7 @@ Name: erlang Version: 22.2.7 -Release: 1%{?dist} +Release: 2%{?dist} Summary: General-purpose programming language and runtime environment License: ASL 2.0 @@ -107,6 +107,7 @@ Patch7: otp-0007-Add-extra-search-directory.patch Patch8: otp-0008-Avoid-forking-sed-to-get-basename.patch Patch9: otp-0009-Load-man-pages-from-system-wide-directory.patch Patch10: otp-0010-erl_child_setup-reduce-number-of-calls-to-close.patch +Patch11: otp-0011-Add-fno-common-gcc-option.patch # end of autogenerated patch tag list BuildRequires: gcc @@ -726,9 +727,9 @@ Provides support for XML 1.0. # Set up proper cflags/cxxflags first %ifarch sparcv9 sparc64 -ERL_FLAGS="${RPM_OPT_FLAGS} -mcpu=ultrasparc -fno-strict-aliasing" +ERL_FLAGS="${RPM_OPT_FLAGS} -mcpu=ultrasparc -fno-strict-aliasing -fcommon" %else -ERL_FLAGS="${RPM_OPT_FLAGS} -fno-strict-aliasing" +ERL_FLAGS="${RPM_OPT_FLAGS} -fno-strict-aliasing -fcommon" %endif # Kernel poll is buggy on s390x for unknown reasons, disable it @@ -1943,6 +1944,9 @@ useradd -r -g epmd -d /dev/null -s /sbin/nologin \ %changelog +* Fri Feb 21 2020 Peter Lemenkov - 22.2.7-2 +- Fix building with GCC 10 (-fno-common) + * Fri Feb 21 2020 Peter Lemenkov - 22.2.7-1 - Ver. 22.2.7 diff --git a/otp-0011-Add-fno-common-gcc-option.patch b/otp-0011-Add-fno-common-gcc-option.patch new file mode 100644 index 0000000..758c78d --- /dev/null +++ b/otp-0011-Add-fno-common-gcc-option.patch @@ -0,0 +1,56 @@ +From: Sverker Eriksson +Date: Fri, 17 Jan 2020 17:21:32 +0100 +Subject: [PATCH] Add -fno-common gcc option + + +diff --git a/erts/aclocal.m4 b/erts/aclocal.m4 +index 5fefd72d5d..5d274e69c3 100644 +--- a/erts/aclocal.m4 ++++ b/erts/aclocal.m4 +@@ -2935,6 +2935,12 @@ fi + # DED_EMU_THR_DEFS=$EMU_THR_DEFS + DED_CFLAGS="$CFLAGS $CPPFLAGS $DED_CFLAGS" + if test "x$GCC" = xyes; then ++ # Use -fno-common for gcc, that is link error if multiple definitions of ++ # global variables are encountered. This is ISO C compliant. ++ # Until version 10, gcc has had -fcommon as default, which allows and merges ++ # such dubious duplicates. ++ LM_TRY_ENABLE_CFLAG([-fno-common], [DED_CFLAGS]) ++ + DED_STATIC_CFLAGS="$DED_CFLAGS" + DED_CFLAGS="$DED_CFLAGS -fPIC" + fi +diff --git a/erts/configure.in b/erts/configure.in +index a887f86621..0a466ad5cc 100644 +--- a/erts/configure.in ++++ b/erts/configure.in +@@ -566,6 +566,12 @@ if test "x$GCC" = xyes; then + WFLAGS="$WFLAGS -Wdeclaration-after-statement" + fi + CFLAGS=$saved_CFLAGS ++ ++ # Use -fno-common for gcc, that is link error if multiple definitions of ++ # global variables are encountered. This is ISO C compliant. ++ # Until version 10, gcc has had -fcommon as default, which allows and merges ++ # such dubious duplicates. ++ LM_TRY_ENABLE_CFLAG([-fno-common], [CFLAGS]) + else + WFLAGS="" + WERRORFLAGS="" +diff --git a/lib/erl_interface/configure.in b/lib/erl_interface/configure.in +index f0e9b2eb3f..230dba25d6 100644 +--- a/lib/erl_interface/configure.in ++++ b/lib/erl_interface/configure.in +@@ -315,6 +315,12 @@ if test "x$GCC" = xyes; then + WFLAGS="$WFLAGS -fno-strict-aliasing";; + esac + CFLAGS="$WERRORFLAGS $CFLAGS" ++ ++ # Use -fno-common for gcc, that is link error if multiple definitions of ++ # global variables are encountered. This is ISO C compliant. ++ # Until version 10, gcc has had -fcommon as default, which allows and merges ++ # such dubious duplicates. ++ LM_TRY_ENABLE_CFLAG([-fno-common], [CFLAGS]) + else + WFLAGS="" + WERRORFLAGS=""