dev-libs/gmp: add USE=pic for static libraries, bug #707332
authorSergei Trofimovich <slyfox@gentoo.org>
Fri, 31 Jan 2020 07:56:56 +0000 (07:56 +0000)
committerSergei Trofimovich <slyfox@gentoo.org>
Fri, 31 Jan 2020 07:57:17 +0000 (07:57 +0000)
gmp makes a decision to use PIC or non-PIC assemply at
./configure time instead of (typical) build time.

On top of that non-PIC assembly also has TEXTRELs in it
which musl can't handle and crashes binaries at relocation
setup time. For gmp is it relevant only for static linking.

The change adds USE=pic to force static libraries to generate
assembly code without TEXTRELs.

Reported-by: Andrew Aladjev
Closes: https://bugs.gentoo.org/707332
Package-Manager: Portage-2.3.86, Repoman-2.3.20
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
dev-libs/gmp/gmp-6.1.2-r1.ebuild
dev-libs/gmp/gmp-6.1.2.ebuild
dev-libs/gmp/gmp-6.2.0-r1.ebuild
dev-libs/gmp/gmp-6.2.0.ebuild
dev-libs/gmp/metadata.xml

index ba741c4f37d96cd04fd2a609e9b9d95f637ca339..31bf8c0b5eb45c86a9a2bc7175181e4f26463247 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 1999-2019 Gentoo Authors
+# Copyright 1999-2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=6
@@ -19,7 +19,7 @@ LICENSE="|| ( LGPL-3+ GPL-2+ )"
 # The subslot reflects the C & C++ SONAMEs.
 SLOT="0/10.4"
 KEYWORDS="~alpha amd64 arm arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~riscv s390 ~sh sparc x86 ~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-IUSE="+asm doc cxx static-libs"
+IUSE="+asm doc cxx pic static-libs"
 
 DEPEND="sys-devel/m4
        app-arch/xz-utils"
@@ -77,12 +77,15 @@ multilib_src_configure() {
                filter-flags -O?
        fi
 
+       # --with-pic forces static libraries to be built as PIC
+       # and without TEXTRELs. musl does not support TEXTRELs: bug #707332
        tc-export CC
        ECONF_SOURCE="${S}" econf \
                --localstatedir="${EPREFIX}"/var/state/gmp \
                --enable-shared \
                $(use_enable asm assembly) \
                $(use_enable cxx) \
+               $(use pic && echo --with-pic) \
                $(use_enable static-libs static)
 }
 
index d7e8b5b45d4738f78bbe12953c4b3d356eaa46b9..38497f189d2cc65439cc9db22b3f9ca56c69d05e 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 1999-2019 Gentoo Authors
+# Copyright 1999-2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI="5"
@@ -19,7 +19,7 @@ LICENSE="|| ( LGPL-3+ GPL-2+ )"
 # The subslot reflects the C & C++ SONAMEs.
 SLOT="0/10.4"
 KEYWORDS="~alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-IUSE="+asm doc cxx static-libs"
+IUSE="+asm doc cxx pic static-libs"
 
 DEPEND="sys-devel/m4
        app-arch/xz-utils"
@@ -76,12 +76,15 @@ multilib_src_configure() {
                filter-flags -O?
        fi
 
+       # --with-pic forces static libraries to be built as PIC
+       # and without TEXTRELs. musl does not support TEXTRELs: bug #707332
        tc-export CC
        ECONF_SOURCE="${S}" econf \
                --localstatedir="${EPREFIX}"/var/state/gmp \
                --enable-shared \
                $(use_enable asm assembly) \
                $(use_enable cxx) \
+               $(use pic && echo --with-pic) \
                $(use_enable static-libs static)
 }
 
index b5347356b32b95e8d9755b63cfce1879f3e96cf6..d5fd3a7c0fa23ccd4a30aeff4141e5db7471baf0 100644 (file)
@@ -19,7 +19,7 @@ LICENSE="|| ( LGPL-3+ GPL-2+ )"
 # The subslot reflects the C & C++ SONAMEs.
 SLOT="0/10.4"
 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-IUSE="+asm doc cxx static-libs"
+IUSE="+asm doc cxx pic static-libs"
 
 DEPEND="sys-devel/m4
        app-arch/xz-utils"
@@ -77,12 +77,15 @@ multilib_src_configure() {
                filter-flags -O?
        fi
 
+       # --with-pic forces static libraries to be built as PIC
+       # and without TEXTRELs. musl does not support TEXTRELs: bug #707332
        tc-export CC
        ECONF_SOURCE="${S}" econf \
                --localstatedir="${EPREFIX}"/var/state/gmp \
                --enable-shared \
                $(use_enable asm assembly) \
                $(use_enable cxx) \
+               $(use pic && echo --with-pic) \
                $(use_enable static-libs static)
 }
 
index c5495e13aef5765d79a8448893696bd3804fffb5..e49ac021edd73ea60008dc1b0597cf92622ecd78 100644 (file)
@@ -19,7 +19,7 @@ LICENSE="|| ( LGPL-3+ GPL-2+ )"
 # The subslot reflects the C & C++ SONAMEs.
 SLOT="0/10.4"
 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-IUSE="+asm doc cxx static-libs"
+IUSE="+asm doc cxx pic static-libs"
 
 DEPEND="sys-devel/m4
        app-arch/xz-utils"
@@ -77,12 +77,15 @@ multilib_src_configure() {
                filter-flags -O?
        fi
 
+       # --with-pic forces static libraries to be built as PIC
+       # and without TEXTRELs. musl does not support TEXTRELs: bug #707332
        tc-export CC
        ECONF_SOURCE="${S}" econf \
                --localstatedir="${EPREFIX}"/var/state/gmp \
                --enable-shared \
                $(use_enable asm assembly) \
                $(use_enable cxx) \
+               $(use pic && echo --with-pic) \
                $(use_enable static-libs static)
 }
 
index 84e19205350dc09ed19d56affddfc1ac12dd8ea1..2b4236a14c6c5dd11ed983f34fd33a66bbc43fd9 100644 (file)
@@ -7,6 +7,7 @@
 </maintainer>
 <use>
        <flag name="asm">Enable use of hand optimized assembly routines (faster execution)</flag>
+       <flag name="pic">Force static libraries to be built as PIC to avoid TEXTRELs.</flag>
 </use>
 <upstream>
        <remote-id type="cpe">cpe:/a:gmplib:gmp</remote-id>