[polymake] Add -gcc5 patch.

Jerry James jjames at fedoraproject.org
Sat Mar 7 00:07:47 UTC 2015


commit 03cd0fcd78b7254b691841255da5bd7862a05860
Author: Jerry James <loganjerry at gmail.com>
Date:   Fri Mar 6 17:07:20 2015 -0700

    Add -gcc5 patch.
    
    Also:
    - Disable hardening flags, which kill RTLD_LAZY.
    - Don't try to fix undefined symbols in the plugins anymore.

 polymake-gcc5.patch | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 polymake.spec       | 30 ++++++++++++----------
 2 files changed, 88 insertions(+), 13 deletions(-)
---
diff --git a/polymake-gcc5.patch b/polymake-gcc5.patch
new file mode 100644
index 0000000..6b7bb8c
--- /dev/null
+++ b/polymake-gcc5.patch
@@ -0,0 +1,71 @@
+--- ./apps/graph/src/Makefile.inc.orig	2014-10-13 06:14:22.000000000 -0600
++++ ./apps/graph/src/Makefile.inc	2015-03-05 20:00:00.000000000 -0700
+@@ -1,4 +1,4 @@
+-ifneq ($(filter 4.8% 4.9%,${GCCversion}),)
++ifneq ($(filter 4.8% 4.9% 5%,${GCCversion}),)
+   bipartite_signature$O : ExtraCXXFLAGS += -O1
+ endif
+ 
+--- ./lib/core/include/perl/Value.h.orig	2014-10-13 06:14:22.000000000 -0600
++++ ./lib/core/include/perl/Value.h	2015-02-26 21:00:00.000000000 -0700
+@@ -646,7 +646,7 @@ protected:
+       , options(value_not_trusted)
+    {}
+ 
+-   static const char* frame_lower_bound();
++   static bool not_on_stack(const char *val, const char *fup);
+ 
+    bool is_defined() const;
+    bool is_TRUE() const;
+@@ -1016,9 +1016,8 @@ public:
+       typedef typename object_traits<Source>::persistent_type Persistent;
+       if (type_cache<Source>::magic_allowed(prescribed_pkg)) {
+          if (fup && !object_traits<Source>::is_lazy) {
+-            const char* const flo=frame_lower_bound();
+             const char* const val=reinterpret_cast<const char*>(&x);
+-            if ((val<flo)==(val<fup)) {
++            if (not_on_stack(val,fup)) {
+                // the wrapped function has returned a reference to an object stored elsewhere
+                return store_magic_ref(x, is_masquerade<Source>(), bool2type<object_traits<Source>::is_lazy>(), identical<Source,Persistent>());
+             }
+@@ -1086,9 +1085,8 @@ public:
+    typename enable_if<Anchor*, list_contains<primitive_lvalues, Source>::value>::type
+    put_lval(const Source& x, const char* fup, int, const Value* owner, OwnerType*)
+    {
+-      const char* const flo=frame_lower_bound();
+       const char* const val=reinterpret_cast<const char*>(&x);
+-      Anchor* anchor=store_primitive_ref(x, type_cache<Source>::get_descr(), (val<flo)==(val<fup));
++      Anchor* anchor=store_primitive_ref(x, type_cache<Source>::get_descr(), not_on_stack(val,fup));
+       if (owner) get_temp();
+       return anchor;
+    }
+--- ./lib/core/src/perl/RefHash.xs.orig	2014-11-08 20:00:00.000000000 -0700
++++ ./lib/core/src/perl/RefHash.xs	2015-03-06 12:30:00.000000000 -0700
+@@ -146,10 +146,10 @@ OP* intercept_pp_helem(pTHX)
+    SV *keysv=TOPs;
+    HV *hv=(HV*)TOPm1s, *class=SvSTASH(hv);
+    MAGIC *mg;
++   tmp_keysv tmp_key;
+    if (HashCPPbound(hv))
+       return pm_perl_cpp_helem(aTHX_ hv, mg);
+    if (SvROK(keysv)) {
+-      tmp_keysv tmp_key;
+       if (!RefKeyAllowed(hv,class))
+          DIE(aTHX_ err_ref);
+       if ((PL_op->op_private & (OPpLVAL_INTRO | OPpLVAL_DEFER)) == OPpLVAL_INTRO &&
+--- ./lib/core/src/perl/Value.cc.orig	2014-10-13 06:14:22.000000000 -0600
++++ ./lib/core/src/perl/Value.cc	2015-02-26 21:00:00.000000000 -0700
+@@ -258,11 +258,10 @@ void ListReturn::upgrade(int size)
+    EXTEND(SP, size);
+ }
+ 
+-const char* Value::frame_lower_bound()
++bool Value::not_on_stack(const char *val, const char *fup)
+ {
+    char c=0;
+-   const char* flo=&c;
+-   return flo;
++   return (val<&c) == (val<fup);
+ }
+ 
+ long Value::int_value() const
diff --git a/polymake.spec b/polymake.spec
index 0e57d53..58ed7c0 100644
--- a/polymake.spec
+++ b/polymake.spec
@@ -1,3 +1,8 @@
+# Polymake intentionally leaves symbols undefined in the plugins, but Fedora's
+# hardening flags disable RTLD_LAZY, resulting in undefined symbol errors while
+# building the documentation.
+%undefine _hardened_build
+
 # If a library used by both polymake and Singular is updated, neither can be
 # rebuilt, because each BRs the other and both are linked against the old
 # version of the library.  Use this to rebuild polymake without Singular
@@ -39,6 +44,8 @@ Patch3:         %{name}-singular.patch
 Patch4:         %{name}-libnormaliz.patch
 # Fix a crash on exit
 Patch5:         %{name}-exit.patch
+# Adapt to gcc 5.0
+Patch6:         %{name}-gcc5.patch
 
 BuildRequires:  bliss-devel
 BuildRequires:  boost-devel
@@ -137,6 +144,7 @@ This package contains documentation for %{name}.
 %patch3
 %patch4
 %patch5
+%patch6
 
 fixtimestamp() {
   touch -r $1.orig $1
@@ -163,6 +171,10 @@ sed -i 's,$singularprefix/lib/libSingular,%{_libdir}/libsingular,' \
     bundled/singular/configure.pl
 %endif
 
+# Turn off hardening flags derived from perl::Config.  See above.
+sed -e '/^\$LDsharedFlags=/a$LDsharedFlags =~ s/ -specs=\\S+//g;' \
+    -i support/configure.pl
+
 %build
 export CFLAGS="%{optflags} -I%{_includedir}/eigen3 -Wno-unused-local-typedefs"
 export CXXFLAGS="$CFLAGS"
@@ -189,19 +201,6 @@ sed -i "/conf\.make/d" support/corelib.make
 export Arch=%{_arch}
 make install release-docs DESTDIR=%{buildroot}
 
-# The apps have undefined weak symbols.  However, fixing that kills the
-# documentation building step for reasons I can't seem to track down.  So
-# instead, we wait until after the docs have been generated, then relink.
-sed -e 's|^Libs :=.*|& -L$(wildcard ${BuildDir}/perlx-*-linux-*) -lpolymake|' \
-    -i support/app.make
-sed -e 's|-lgmp ${LIBS}|& -L${PerlExtDir} -lpolymake|' \
-    -e 's|^${CoreLib} :.*|& ${CallableLib}|' \
-    -i support/corelib.make
-rm -f build.%{_arch}/lib/*.so
-make %{?_smp_mflags} all
-chmod 0755 %{buildroot}%{polydir}/lib/*.so
-cp -p build.%{_arch}/lib/*.so %{buildroot}%{polydir}/lib
-
 # Install the man page
 mkdir -p %{buildroot}%{_mandir}/man1
 sed "s/@VERSION@/%{version}/" %{SOURCE1} > %{buildroot}%{_mandir}/man1/%{name}.1
@@ -260,6 +259,11 @@ sed -i 's,%{buildroot},,' %{buildroot}%{polydir}/bundled/singular/conf.make
 %doc doc/*
 
 %changelog
+* Fri Mar  6 2015 Jerry James <loganjerry at gmail.com> - 2.13-19.git20141013
+- Add -gcc5 patch
+- Disable hardening flags, which kill RTLD_LAZY
+- Don't try to fix undefined symbols in the plugins anymore
+
 * Thu Mar 05 2015 Jitka Plesnikova <jplesnik at redhat.com> - 2.13-19.git20141013
 - Rebuild for perl 5.20.2
 


More information about the scm-commits mailing list