Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 236054 - dev-libs/gmp-4.2.2-r2: text relocations in tests which fails on hardened
Summary: dev-libs/gmp-4.2.2-r2: text relocations in tests which fails on hardened
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High minor (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-08-28 18:57 UTC by Joshua Pettett
Modified: 2013-12-24 07:49 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Build log (dev-libs:gmp-4.2.2-r2.log.gz,23.36 KB, application/octet-stream)
2008-08-28 19:00 UTC, Joshua Pettett
Details
add -nopie to the tests (gmp-5.0.1-x86-nopie-tests.patch,3.71 KB, patch)
2010-07-27 02:11 UTC, Magnus Granberg
Details | Diff
GMP PIC x86 tests patch (gmp-5.0.1-pic.diff,7.08 KB, patch)
2011-02-26 17:59 UTC, Robert Connolly
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joshua Pettett 2008-08-28 18:57:56 UTC
Using a hardened kernel configured to disallow ELF text relocations, gmp tests fail:

make[4]: Entering directory `/var/tmp/portage/dev-libs/gmp-4.2.2-r2/work/gmp-4.2.2/tests'
/var/tmp/portage/dev-libs/gmp-4.2.2-r2/work/gmp-4.2.2/tests/.libs/lt-t-bswap: error while loading shared libraries: cannot make segment writable for relocation: Permission denied
FAIL: t-bswap
/var/tmp/portage/dev-libs/gmp-4.2.2-r2/work/gmp-4.2.2/tests/.libs/lt-t-constants: error while loading shared libraries: cannot make segment writable for relocation: Permission denied
FAIL: t-constants
/var/tmp/portage/dev-libs/gmp-4.2.2-r2/work/gmp-4.2.2/tests/.libs/lt-t-count_zeros: error while loading shared libraries: cannot make segment writable for relocation: Permission denied
FAIL: t-count_zeros
PASS: t-gmpmax
PASS: t-hightomask
/var/tmp/portage/dev-libs/gmp-4.2.2-r2/work/gmp-4.2.2/tests/.libs/lt-t-modlinv: error while loading shared libraries: cannot make segment writable for relocation: Permission denied
FAIL: t-modlinv
/var/tmp/portage/dev-libs/gmp-4.2.2-r2/work/gmp-4.2.2/tests/.libs/lt-t-popc: error while loading shared libraries: cannot make segment writable for relocation: Permission denied
FAIL: t-popc
/var/tmp/portage/dev-libs/gmp-4.2.2-r2/work/gmp-4.2.2/tests/.libs/lt-t-parity: error while loading shared libraries: cannot make segment writable for relocation: Permission denied
FAIL: t-parity
/var/tmp/portage/dev-libs/gmp-4.2.2-r2/work/gmp-4.2.2/tests/.libs/lt-t-sub: error while loading shared libraries: cannot make segment writable for relocation: Permission denied
FAIL: t-sub


Workarounds include skipping tests (not recommended by the developers) or manually disabling PaX restrictions on tests (a pain).


Portage 2.1.4.4 (hardened/x86/2.6, gcc-3.4.6, glibc-2.5-r4, 2.6.24-hardened-r3-configuration1 i686)
=================================================================
System uname: 2.6.24-hardened-r3-configuration1 i686 Pentium III (Coppermine)
Timestamp of tree: Thu, 28 Aug 2008 08:36:01 +0000
ccache version 2.4 [enabled]
app-shells/bash:     3.2_p33
dev-java/java-config: 1.3.7, 2.1.6
dev-lang/python:     2.4.4-r13
dev-python/pycrypto: 2.0.1-r6
dev-util/ccache:     2.4-r7
sys-apps/baselayout: 1.12.11.1
sys-apps/sandbox:    1.2.18.1-r2
sys-devel/autoconf:  2.13, 2.61-r2
sys-devel/automake:  1.5, 1.7.9-r1, 1.10.1
sys-devel/binutils:  2.18-r3
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool:   1.5.26
virtual/os-headers:  2.6.23-r3
ACCEPT_KEYWORDS="x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=pentium3 -fomit-frame-pointer -fforce-addr -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /var/bind"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/terminfo /etc/udev/rules.d"
CXXFLAGS="-O2 -march=pentium3 -fomit-frame-pointer -fforce-addr -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="buildpkg ccache collision-protect distlocks metadata-transfer sandbox sfperms strict test unmerge-orphans userfetch userpriv usersandbox"
GENTOO_MIRRORS="ftp://distro.ibiblio.org/pub/linux/distributions/gentoo/ http://distro.ibiblio.org/pub/linux/distributions/gentoo/ ftp://ftp.gtlib.cc.gatech.edu/pub/gentoo"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/portage/local"
SYNC="rsync://netserver/gentoo-portage"
USE="acl apache2 berkdb bzip2 caps cracklib crypt curl doc fam ftp gd gdbm gmp gnutls hardened iconv innodb java jpeg ldap logrotate maildir mhash midi mysql mysqli ncurses nls nocd nptl nptlonly pam pcre perl php pic png posix prelude readline sasl session sockets spell spl sqlite sse ssl sysvipc tcpd unicode urandom vhosts x86 xml xorg zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic auth_digest authn_anon authn_dbd authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_http rewrite setenvif so speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="mouse keyboard" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="apm ark chips cirrus cyrix dummy fbdev glint i128 i740 i810 imstt mach64 mga neomagic nsc nv r128 radeon rendition s3 s3virge savage siliconmotion sis sisusb tdfx tga trident tseng v4l vesa vga vmware voodoo"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Joshua Pettett 2008-08-28 19:00:53 UTC
Created attachment 164017 [details]
Build log
Comment 2 Carsten Lohrke (RETIRED) gentoo-dev 2008-08-28 21:40:10 UTC
Please do not attach compressed logs, but attach the relevant parts as plain text in future. Assuming dupe. If you don't think so, feel free to reopen.

*** This bug has been marked as a duplicate of bug 186710 ***
Comment 3 Joshua Pettett 2008-08-29 04:00:26 UTC
(In reply to comment #2)
> *** This bug has been marked as a duplicate of bug 186710 ***

Bug 186710 is about a warning about a binary with text relocations that was being merged.  In my case, only the tests had relocations, which causes the emerge to fail hardened system, but after getting past the tests, the actually merged files do not have any text relocations.

This suggests to me that either bug could be solved without necessarily affecting the other.  So these are two separate, albeit related, issues, correct?
Comment 4 Carsten Lohrke (RETIRED) gentoo-dev 2008-08-29 22:53:49 UTC
(In reply to comment #3)
> So these are two separate, albeit related, issues, correct?

If you so. ;) Honestly, I can't look at all bugs in depth, especially when there's compressed data attached, so my approach to bug wrangling is somewhat fuzzy. It's just a matter of time. Thanks four your feedback.

Comment 5 Joshua Pettett 2008-08-29 23:22:31 UTC
Sorry about the compressed log; I got into that habit when I was having a problem with OpenOffice and the build log was too large to upload uncompressed.

The most relevant part of the log, as far as I can tell, is the snippet I included in the original report.  The same ld warning is also returned for each one: "creating a DT_TEXTREL in object."

The emerge process dies after these test failures.  However, when changing PaX restrictions to allow these tests to pass, many of the subsequent tests have the same problem.

Thanks.
Comment 6 Beech Horn 2008-12-28 17:54:06 UTC
There are two .asm files in the tests folder, starting with x86.
I tried the Gentoo hardened TEXTREL removal guide to no avail.
7 out of 9 tests fail due to (AFAIK) two assembler files.

They reference what I can only assume to be an external reference (named callable_arguments) which is translated into a fixed memory address.

Bug is reproducible on dev-libs/gmp-4.2.4 for x86.
Comment 7 Mark Loeser (RETIRED) gentoo-dev 2009-05-16 20:11:03 UTC
Hardened team: some help please :)  Is this still a problem with gmp-4.3.0?
Comment 8 Xake 2009-06-14 16:20:21 UTC
>>> Test phase [check]: dev-libs/gmp-4.3.1
make -j5 -j1 check 
make  check-recursive
make[1]: Entering directory `/var/tmp/portage/dev-libs/gmp-4.3.1/work/gmp-4.3.1'
Making check in tests
make[2]: Entering directory `/var/tmp/portage/dev-libs/gmp-4.3.1/work/gmp-4.3.1/tests'
Making check in .
make[3]: Entering directory `/var/tmp/portage/dev-libs/gmp-4.3.1/work/gmp-4.3.1/tests'
make  libtests.la t-bswap t-constants t-count_zeros t-gmpmax t-hightomask t-modlinv t-popc t-parity t-sub
make[4]: Entering directory `/var/tmp/portage/dev-libs/gmp-4.3.1/work/gmp-4.3.1/tests'
/bin/sh ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I..    -O3 -march=pentium4 -mtune=pentium4 -pipe -c -o memory.lo memory.c
mkdir .libs
 gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O3 -march=pentium4 -mtune=pentium4 -pipe -c memory.c  -fPIC -DPIC -o .libs/memory.o
 gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O3 -march=pentium4 -mtune=pentium4 -pipe -c memory.c -o memory.o >/dev/null 2>&1
/bin/sh ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I..    -O3 -march=pentium4 -mtune=pentium4 -pipe -c -o misc.lo misc.c
 gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O3 -march=pentium4 -mtune=pentium4 -pipe -c misc.c  -fPIC -DPIC -o .libs/misc.o
 gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O3 -march=pentium4 -mtune=pentium4 -pipe -c misc.c -o misc.o >/dev/null 2>&1
/bin/sh ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I..    -O3 -march=pentium4 -mtune=pentium4 -pipe -c -o refmpf.lo refmpf.c
 gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O3 -march=pentium4 -mtune=pentium4 -pipe -c refmpf.c  -fPIC -DPIC -o .libs/refmpf.o
 gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O3 -march=pentium4 -mtune=pentium4 -pipe -c refmpf.c -o refmpf.o >/dev/null 2>&1
/bin/sh ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I..    -O3 -march=pentium4 -mtune=pentium4 -pipe -c -o refmpn.lo refmpn.c
 gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O3 -march=pentium4 -mtune=pentium4 -pipe -c refmpn.c  -fPIC -DPIC -o .libs/refmpn.o
 gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O3 -march=pentium4 -mtune=pentium4 -pipe -c refmpn.c -o refmpn.o >/dev/null 2>&1
/bin/sh ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I..    -O3 -march=pentium4 -mtune=pentium4 -pipe -c -o refmpq.lo refmpq.c
 gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O3 -march=pentium4 -mtune=pentium4 -pipe -c refmpq.c  -fPIC -DPIC -o .libs/refmpq.o
 gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O3 -march=pentium4 -mtune=pentium4 -pipe -c refmpq.c -o refmpq.o >/dev/null 2>&1
/bin/sh ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I..    -O3 -march=pentium4 -mtune=pentium4 -pipe -c -o refmpz.lo refmpz.c
 gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O3 -march=pentium4 -mtune=pentium4 -pipe -c refmpz.c  -fPIC -DPIC -o .libs/refmpz.o
 gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O3 -march=pentium4 -mtune=pentium4 -pipe -c refmpz.c -o refmpz.o >/dev/null 2>&1
/bin/sh ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I..    -O3 -march=pentium4 -mtune=pentium4 -pipe -c -o spinner.lo spinner.c
 gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O3 -march=pentium4 -mtune=pentium4 -pipe -c spinner.c  -fPIC -DPIC -o .libs/spinner.o
 gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O3 -march=pentium4 -mtune=pentium4 -pipe -c spinner.c -o spinner.o >/dev/null 2>&1
/bin/sh ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I..    -O3 -march=pentium4 -mtune=pentium4 -pipe -c -o trace.lo trace.c
 gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O3 -march=pentium4 -mtune=pentium4 -pipe -c trace.c  -fPIC -DPIC -o .libs/trace.o
 gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O3 -march=pentium4 -mtune=pentium4 -pipe -c trace.c -o trace.o >/dev/null 2>&1
/bin/sh ../libtool --mode=compile --tag=CC ../mpn/m4-ccas --m4="m4" gcc -c -DHAVE_CONFIG_H -I. -I. -I.. -I..    -O3 -march=pentium4 -mtune=pentium4 -pipe -Wa,--noexecstack `test -f 'x86call.asm' || echo './'`x86call.asm
 ../mpn/m4-ccas --m4=m4 gcc -c -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O3 -march=pentium4 -mtune=pentium4 -pipe -Wa,--noexecstack x86call.asm  -fPIC -DPIC -o .libs/x86call.o
m4  -DHAVE_CONFIG_H -DPIC x86call.asm >tmp-x86call.s
 gcc -c -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O3 -march=pentium4 -mtune=pentium4 -pipe -Wa,--noexecstack tmp-x86call.s -fPIC -DPIC -o .libs/x86call.o
 ../mpn/m4-ccas --m4=m4 gcc -c -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O3 -march=pentium4 -mtune=pentium4 -pipe -Wa,--noexecstack x86call.asm -o x86call.o >/dev/null 2>&1
/bin/sh ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I..    -O3 -march=pentium4 -mtune=pentium4 -pipe -c -o x86check.lo x86check.c
 gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O3 -march=pentium4 -mtune=pentium4 -pipe -c x86check.c  -fPIC -DPIC -o .libs/x86check.o
 gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O3 -march=pentium4 -mtune=pentium4 -pipe -c x86check.c -o x86check.o >/dev/null 2>&1
/bin/sh ../libtool --mode=link gcc  -O3 -march=pentium4 -mtune=pentium4 -pipe  -Wl,-O1 -Wl,--sort-common -Wl,--warn-once,--hash-style=gnu -Wl,--as-needed -o libtests.la   memory.lo misc.lo refmpf.lo refmpn.lo refmpq.lo refmpz.lo spinner.lo trace.lo x86call.lo x86check.lo ../libgmp.la 
i686-pc-linux-gnu-ar cq .libs/libtests.a .libs/memory.o .libs/misc.o .libs/refmpf.o .libs/refmpn.o .libs/refmpq.o .libs/refmpz.o .libs/spinner.o .libs/trace.o .libs/x86call.o .libs/x86check.o
i686-pc-linux-gnu-ranlib .libs/libtests.a
creating libtests.la
(cd .libs && rm -f libtests.la && ln -s ../libtests.la libtests.la)
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I..    -O3 -march=pentium4 -mtune=pentium4 -pipe -c t-bswap.c
/bin/sh ../libtool --mode=link gcc  -O3 -march=pentium4 -mtune=pentium4 -pipe  -Wl,-O1 -Wl,--sort-common -Wl,--warn-once,--hash-style=gnu -Wl,--as-needed -o t-bswap  t-bswap.o libtests.la ../libgmp.la 
gcc -O3 -march=pentium4 -mtune=pentium4 -pipe -Wl,-O1 -Wl,--sort-common -Wl,--warn-once -Wl,--hash-style=gnu -o .libs/t-bswap t-bswap.o  -Wl,--as-needed ./.libs/libtests.a /var/tmp/portage/dev-libs/gmp-4.3.1/work/gmp-4.3.1/.libs/libgmp.so ../.libs/libgmp.so 
/usr/lib/gcc/i686-pc-linux-gnu/4.3.3/../../../../i686-pc-linux-gnu/bin/ld: warning: creating a DT_TEXTREL in object.
creating t-bswap
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I..    -O3 -march=pentium4 -mtune=pentium4 -pipe -c t-constants.c
/bin/sh ../libtool --mode=link gcc  -O3 -march=pentium4 -mtune=pentium4 -pipe  -Wl,-O1 -Wl,--sort-common -Wl,--warn-once,--hash-style=gnu -Wl,--as-needed -o t-constants  t-constants.o libtests.la ../libgmp.la 
gcc -O3 -march=pentium4 -mtune=pentium4 -pipe -Wl,-O1 -Wl,--sort-common -Wl,--warn-once -Wl,--hash-style=gnu -o .libs/t-constants t-constants.o  -Wl,--as-needed ./.libs/libtests.a /var/tmp/portage/dev-libs/gmp-4.3.1/work/gmp-4.3.1/.libs/libgmp.so ../.libs/libgmp.so 
/usr/lib/gcc/i686-pc-linux-gnu/4.3.3/../../../../i686-pc-linux-gnu/bin/ld: warning: creating a DT_TEXTREL in object.
creating t-constants
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I..    -O3 -march=pentium4 -mtune=pentium4 -pipe -c t-count_zeros.c
/bin/sh ../libtool --mode=link gcc  -O3 -march=pentium4 -mtune=pentium4 -pipe  -Wl,-O1 -Wl,--sort-common -Wl,--warn-once,--hash-style=gnu -Wl,--as-needed -o t-count_zeros  t-count_zeros.o libtests.la ../libgmp.la 
gcc -O3 -march=pentium4 -mtune=pentium4 -pipe -Wl,-O1 -Wl,--sort-common -Wl,--warn-once -Wl,--hash-style=gnu -o .libs/t-count_zeros t-count_zeros.o  -Wl,--as-needed ./.libs/libtests.a /var/tmp/portage/dev-libs/gmp-4.3.1/work/gmp-4.3.1/.libs/libgmp.so ../.libs/libgmp.so 
/usr/lib/gcc/i686-pc-linux-gnu/4.3.3/../../../../i686-pc-linux-gnu/bin/ld: warning: creating a DT_TEXTREL in object.
creating t-count_zeros
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I..    -O3 -march=pentium4 -mtune=pentium4 -pipe -c t-gmpmax.c
/bin/sh ../libtool --mode=link gcc  -O3 -march=pentium4 -mtune=pentium4 -pipe  -Wl,-O1 -Wl,--sort-common -Wl,--warn-once,--hash-style=gnu -Wl,--as-needed -o t-gmpmax  t-gmpmax.o libtests.la ../libgmp.la 
gcc -O3 -march=pentium4 -mtune=pentium4 -pipe -Wl,-O1 -Wl,--sort-common -Wl,--warn-once -Wl,--hash-style=gnu -o .libs/t-gmpmax t-gmpmax.o  -Wl,--as-needed ./.libs/libtests.a /var/tmp/portage/dev-libs/gmp-4.3.1/work/gmp-4.3.1/.libs/libgmp.so ../.libs/libgmp.so 
creating t-gmpmax
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I..    -O3 -march=pentium4 -mtune=pentium4 -pipe -c t-hightomask.c
/bin/sh ../libtool --mode=link gcc  -O3 -march=pentium4 -mtune=pentium4 -pipe  -Wl,-O1 -Wl,--sort-common -Wl,--warn-once,--hash-style=gnu -Wl,--as-needed -o t-hightomask  t-hightomask.o libtests.la ../libgmp.la 
gcc -O3 -march=pentium4 -mtune=pentium4 -pipe -Wl,-O1 -Wl,--sort-common -Wl,--warn-once -Wl,--hash-style=gnu -o .libs/t-hightomask t-hightomask.o  -Wl,--as-needed ./.libs/libtests.a /var/tmp/portage/dev-libs/gmp-4.3.1/work/gmp-4.3.1/.libs/libgmp.so ../.libs/libgmp.so 
creating t-hightomask
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I..    -O3 -march=pentium4 -mtune=pentium4 -pipe -c t-modlinv.c
/bin/sh ../libtool --mode=link gcc  -O3 -march=pentium4 -mtune=pentium4 -pipe  -Wl,-O1 -Wl,--sort-common -Wl,--warn-once,--hash-style=gnu -Wl,--as-needed -o t-modlinv  t-modlinv.o libtests.la ../libgmp.la 
gcc -O3 -march=pentium4 -mtune=pentium4 -pipe -Wl,-O1 -Wl,--sort-common -Wl,--warn-once -Wl,--hash-style=gnu -o .libs/t-modlinv t-modlinv.o  -Wl,--as-needed ./.libs/libtests.a /var/tmp/portage/dev-libs/gmp-4.3.1/work/gmp-4.3.1/.libs/libgmp.so ../.libs/libgmp.so 
/usr/lib/gcc/i686-pc-linux-gnu/4.3.3/../../../../i686-pc-linux-gnu/bin/ld: warning: creating a DT_TEXTREL in object.
creating t-modlinv
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I..    -O3 -march=pentium4 -mtune=pentium4 -pipe -c t-popc.c
/bin/sh ../libtool --mode=link gcc  -O3 -march=pentium4 -mtune=pentium4 -pipe  -Wl,-O1 -Wl,--sort-common -Wl,--warn-once,--hash-style=gnu -Wl,--as-needed -o t-popc  t-popc.o libtests.la ../libgmp.la 
gcc -O3 -march=pentium4 -mtune=pentium4 -pipe -Wl,-O1 -Wl,--sort-common -Wl,--warn-once -Wl,--hash-style=gnu -o .libs/t-popc t-popc.o  -Wl,--as-needed ./.libs/libtests.a /var/tmp/portage/dev-libs/gmp-4.3.1/work/gmp-4.3.1/.libs/libgmp.so ../.libs/libgmp.so 
/usr/lib/gcc/i686-pc-linux-gnu/4.3.3/../../../../i686-pc-linux-gnu/bin/ld: warning: creating a DT_TEXTREL in object.
creating t-popc
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I..    -O3 -march=pentium4 -mtune=pentium4 -pipe -c t-parity.c
/bin/sh ../libtool --mode=link gcc  -O3 -march=pentium4 -mtune=pentium4 -pipe  -Wl,-O1 -Wl,--sort-common -Wl,--warn-once,--hash-style=gnu -Wl,--as-needed -o t-parity  t-parity.o libtests.la ../libgmp.la 
gcc -O3 -march=pentium4 -mtune=pentium4 -pipe -Wl,-O1 -Wl,--sort-common -Wl,--warn-once -Wl,--hash-style=gnu -o .libs/t-parity t-parity.o  -Wl,--as-needed ./.libs/libtests.a /var/tmp/portage/dev-libs/gmp-4.3.1/work/gmp-4.3.1/.libs/libgmp.so ../.libs/libgmp.so 
/usr/lib/gcc/i686-pc-linux-gnu/4.3.3/../../../../i686-pc-linux-gnu/bin/ld: warning: creating a DT_TEXTREL in object.
creating t-parity
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I..    -O3 -march=pentium4 -mtune=pentium4 -pipe -c t-sub.c
/bin/sh ../libtool --mode=link gcc  -O3 -march=pentium4 -mtune=pentium4 -pipe  -Wl,-O1 -Wl,--sort-common -Wl,--warn-once,--hash-style=gnu -Wl,--as-needed -o t-sub  t-sub.o libtests.la ../libgmp.la 
gcc -O3 -march=pentium4 -mtune=pentium4 -pipe -Wl,-O1 -Wl,--sort-common -Wl,--warn-once -Wl,--hash-style=gnu -o .libs/t-sub t-sub.o  -Wl,--as-needed ./.libs/libtests.a /var/tmp/portage/dev-libs/gmp-4.3.1/work/gmp-4.3.1/.libs/libgmp.so ../.libs/libgmp.so 
/usr/lib/gcc/i686-pc-linux-gnu/4.3.3/../../../../i686-pc-linux-gnu/bin/ld: warning: creating a DT_TEXTREL in object.
creating t-sub
make[4]: Leaving directory `/var/tmp/portage/dev-libs/gmp-4.3.1/work/gmp-4.3.1/tests'
make  check-TESTS
make[4]: Entering directory `/var/tmp/portage/dev-libs/gmp-4.3.1/work/gmp-4.3.1/tests'
/var/tmp/portage/dev-libs/gmp-4.3.1/work/gmp-4.3.1/tests/.libs/lt-t-bswap: error while loading shared libraries: cannot make segment writable for relocation: Permission denied
FAIL: t-bswap
/var/tmp/portage/dev-libs/gmp-4.3.1/work/gmp-4.3.1/tests/.libs/lt-t-constants: error while loading shared libraries: cannot make segment writable for relocation: Permission denied
FAIL: t-constants
/var/tmp/portage/dev-libs/gmp-4.3.1/work/gmp-4.3.1/tests/.libs/lt-t-count_zeros: error while loading shared libraries: cannot make segment writable for relocation: Permission denied
FAIL: t-count_zeros
PASS: t-gmpmax
PASS: t-hightomask
/var/tmp/portage/dev-libs/gmp-4.3.1/work/gmp-4.3.1/tests/.libs/lt-t-modlinv: error while loading shared libraries: cannot make segment writable for relocation: Permission denied
FAIL: t-modlinv
/var/tmp/portage/dev-libs/gmp-4.3.1/work/gmp-4.3.1/tests/.libs/lt-t-popc: error while loading shared libraries: cannot make segment writable for relocation: Permission denied
FAIL: t-popc
/var/tmp/portage/dev-libs/gmp-4.3.1/work/gmp-4.3.1/tests/.libs/lt-t-parity: error while loading shared libraries: cannot make segment writable for relocation: Permission denied
FAIL: t-parity
/var/tmp/portage/dev-libs/gmp-4.3.1/work/gmp-4.3.1/tests/.libs/lt-t-sub: error while loading shared libraries: cannot make segment writable for relocation: Permission denied
FAIL: t-sub
====================================
7 of 9 tests failed
Please report to gmp-bugs@gmplib.org
====================================
make[4]: *** [check-TESTS] Error 1
make[4]: Leaving directory `/var/tmp/portage/dev-libs/gmp-4.3.1/work/gmp-4.3.1/tests'
make[3]: *** [check-am] Error 2
make[3]: Leaving directory `/var/tmp/portage/dev-libs/gmp-4.3.1/work/gmp-4.3.1/tests'
make[2]: *** [check-recursive] Error 1
make[2]: Leaving directory `/var/tmp/portage/dev-libs/gmp-4.3.1/work/gmp-4.3.1/tests'
make[1]: *** [check-recursive] Error 1
make[1]: Leaving directory `/var/tmp/portage/dev-libs/gmp-4.3.1/work/gmp-4.3.1'
make: *** [check] Error 2
 * 
 * ERROR: dev-libs/gmp-4.3.1 failed.
 * Call stack:
 *               ebuild.sh, line   49:  Called src_test
 *             environment, line 3368:  Called _eapi0_src_test
 *               ebuild.sh, line  607:  Called die
 * The specific snippet of code:
 *   			hasq test $FEATURES && die "Make check failed. See above for details."
 *  The die message:
 *   Make check failed. See above for details.
Comment 9 Joshua Pettett 2010-03-02 17:38:49 UTC
Crazy work-around kludge that actually works (assumes standard paths; set NEW_GMP_VERSION to version being installed):

until (ebuild /usr/portage/dev-libs/gmp/gmp-$NEW_GMP_VERSION.ebuild merge); do
scanelf -RqtxXz 'm' /var/tmp/portage/dev-libs/gmp-$NEW_GMP_VERSION/work/gmp-$NEW_GMP_VERSION/tests/
done
Comment 10 Magnus Granberg gentoo-dev 2010-07-27 02:11:09 UTC
Created attachment 240257 [details, diff]
add -nopie to the tests

This patch add -nopie to the CFLAGS in the Makefiles in /tests
And it should only be for x86 and hardened
Comment 11 Magnus Granberg gentoo-dev 2010-07-27 02:35:16 UTC
Fixed in 5.0.1 rev 1.5
Comment 12 Robert Connolly 2011-02-26 17:57:26 UTC
I tried this patch from GMP unstable:
http://gmplib.org:8000/gmp/raw-rev/f6ad7c54bb00
and it works for me. Test suite compiles and works with -fPIC -pie on i686. I suggest replacing the nopie patch with it. Patch is attached.
Comment 13 Robert Connolly 2011-02-26 17:59:04 UTC
Created attachment 263955 [details, diff]
GMP PIC x86 tests patch