Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 466924 - sys-devel/binutils: sys-libs/db linking with --as-needed causes segmentation fault in check_match (sym=0x10270) at dl-lookup.c:177
Summary: sys-devel/binutils: sys-libs/db linking with --as-needed causes segmentation ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: HPPA Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL: https://sourceware.org/bugzilla/show_...
Whiteboard:
Keywords: Inclusion, PATCH
Depends on:
Blocks:
 
Reported: 2013-04-23 20:35 UTC by Jeroen Roovers (RETIRED)
Modified: 2014-06-03 02:53 UTC (History)
2 users (show)

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


Attachments
config.log (config.log,57.21 KB, text/plain)
2013-04-23 20:35 UTC, Jeroen Roovers (RETIRED)
Details
successful config log from my amd64 box (successful-config.log,64.78 KB, text/x-log)
2013-08-26 19:42 UTC, Rick Farina (Zero_Chaos)
Details
Cleanup version info from hidden symbols forced locals. (binutils-hppa_remove_version_when_local.diff,438 bytes, patch)
2013-10-23 10:12 UTC, Guy Martin (RETIRED)
Details | Diff
Cleanup version info from hidden symbols forced locals (binutils-hppa_remove_version_when_local-v2.diff,7.31 KB, patch)
2013-10-23 10:53 UTC, Guy Martin (RETIRED)
Details | Diff
Cleanup version info from hidden symbols forced locals (binutils-hppa_remove_version_when_local-v2.diff,438 bytes, patch)
2013-10-23 10:56 UTC, Guy Martin (RETIRED)
Details | Diff
Cleanup version info from hidden symbols forced locals (binutils-hppa_remove_version_when_local-v3.diff,870 bytes, patch)
2013-10-24 11:15 UTC, Guy Martin (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jeroen Roovers (RETIRED) gentoo-dev 2013-04-23 20:35:59 UTC
Created attachment 346404 [details]
config.log

Tue Apr 23 22:34:10 CEST 2013
emerge --info dev-libs/apr-util
Portage 2.1.11.62 (default/linux/hppa/13.0, gcc-4.6.3, glibc-2.17, 3.9.0-rc4-JeR-00018-g3912a67 parisc64)
=================================================================
                        System Settings
=================================================================
System uname: Linux-3.9.0-rc4-JeR-00018-g3912a67-parisc64-PA8800_-Mako-with-gentoo-2.2
KiB Mem:     1021528 total,    169248 free
KiB Swap:    2101676 total,   2101400 free
Timestamp of tree: Tue, 23 Apr 2013 15:45:01 +0000
ld GNU ld (GNU Binutils) 2.22
distcc 3.1 hppa2.0-unknown-linux-gnu [enabled]
ccache version 3.1.9 [disabled]
app-shells/bash:          4.2_p37
dev-lang/python:          2.5.4-r5, 2.6.8-r1, 2.7.3-r3, 3.1.5-r1, 3.2.3-r2
dev-util/ccache:          3.1.9
dev-util/cmake:           2.8.9
dev-util/pkgconfig:       0.28
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.11.8
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.9.6-r3, 1.11.6, 1.12.6
sys-devel/binutils:       2.21.1-r1, 2.22-r1
sys-devel/gcc:            4.6.3
sys-devel/gcc-config:     1.7.3
sys-devel/libtool:        2.4-r1
sys-devel/make:           3.82-r4
sys-kernel/linux-headers: 3.7 (virtual/os-headers)
sys-libs/glibc:           2.17
Repositories: gentoo JeR
ACCEPT_KEYWORDS="hppa"
ACCEPT_LICENSE="* -@EULA"
CBUILD="hppa2.0-unknown-linux-gnu"
CFLAGS="-mschedule=8000 -march=2.0 -ggdb -pipe -Wall -O2 -Wno-comment"
CHOST="hppa2.0-unknown-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib/distcc/bin /usr/share/gnupg/qualified.txt /var/bind /var/www/localhost/htdocs/wordpress/wp-config.php"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.3/ext-active/ /etc/php/apache2-php5.4/ext-active/ /etc/php/cgi-php5.3/ext-active/ /etc/php/cgi-php5.4/ext-active/ /etc/php/cli-php5.3/ext-active/ /etc/php/cli-php5.4/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-mschedule=8000 -march=2.0 -ggdb -pipe -Wall -O2"
DISTDIR="/world/distfiles"
EMERGE_DEFAULT_OPTS="--quiet-build=n"
FCFLAGS=""
FEATURES="assume-digests binpkg-logs buildpkg config-protect-if-modified distcc distlocks ebuild-locks fixlafiles merge-sync metadata-transfer news notitles parallel-fetch preserve-libs protect-owned sfperms splitdebug strict test test-fail-continue unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv xattr"
FFLAGS="-mschedule=8000 -march=2.0 -ggdb -pipe -Wall -O2"
GENTOO_MIRRORS="http://de-mirror.org/distro/gentoo/ http://mirror.netcologne.de/gentoo/ http://ftp.snt.utwente.nl/pub/os/linux/gentoo http://gentoo.tiscali.nl/ http://mirror.leaseweb.com/gentoo/ "
LC_ALL="C"
LDFLAGS="-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed"
MAKEOPTS="-j6"
PKGDIR="/keeps/gentoo/packages/karsten"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/world/gentoo/portage"
PORTDIR_OVERLAY="/keeps/gentoo/local"
SYNC="rsync://rsync.nl.gentoo.org/gentoo-portage"
USE="256-color X acl amr apng bash-completion berkdb bzip2 cli coverage cracklib crypt cups custom-cflags cxx dirac directfb dri exif fbcon filecaps firefox firmware foomaticdb fortran frontend-optional gdbm geoip gpm gsm gstreamer gtk gudev hppa hwdb iconv idn imlib ipv6 jpeg kmod ladspa launch-frontend libcaca libwww lua lzo mad mng modules mp3 mudflap multislot ncurses nls nptl openmp pam pcre php pkcs11 png pnm python qt quvi readline rtmp samba session smi speex spell sqlite ssl tcl tcpd test tga theora threads tk truetype unicode v4l vorbis wcwidth xattr xcb xft xml2 xvfb xvid zlib" ALSA_CARDS="ad1889 usb-audio" 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="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" DRACUT_MODULES="nfs syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="evdev joystick keyboard mouse acecad aiptek calcomp citron digitaledge dmc dynapro elo2300 elographics fpit hyperpen jamstudio magellan microtouch mutouch palmax penmount spaceorb summa tek4957 tslib ur98 void" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en nl he" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-3" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_5 python2_6 python2_7 python3_1 python3_2" RUBY_TARGETS="ruby18 ruby19" USERLAND="GNU" VIDEO_CARDS="stifb dummy" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
USE_PYTHON="2.5 2.6 2.7 3.1 3.2"
Unset:  CPPFLAGS, CTARGET, INSTALL_MASK, LANG, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

=================================================================
                        Package Settings
=================================================================

dev-libs/apr-util-1.3.12 was built with the following:
USE="gdbm sqlite test -berkdb -doc -freetds -ldap -mysql -odbc -postgres -static-libs"
Comment 1 Jeroen Roovers (RETIRED) gentoo-dev 2013-04-23 20:40:29 UTC
dev-vcs/subversion performs the same test with the same result.
Comment 2 Rick Farina (Zero_Chaos) gentoo-dev 2013-08-26 19:42:54 UTC
Created attachment 357108 [details]
successful config log from my amd64 box
Comment 3 Rick Farina (Zero_Chaos) gentoo-dev 2013-08-26 19:43:38 UTC
I'm unable to replicate this issue with either package using amd64, x86, or arm.  I'm marking this hppa specific
Comment 4 Jeroen Roovers (RETIRED) gentoo-dev 2013-08-30 14:47:02 UTC
It looks like something might have gone wrong with the /usr/lib/libdb.{a,so} symlinks after some upgrades/downgrades.
Comment 5 Jeroen Roovers (RETIRED) gentoo-dev 2013-08-30 15:21:28 UTC
-rw-r--r-- 1 root root 2082514 Apr 23 21:43 /usr/lib/libdb-4.7.a
-rw-r--r-- 1 root root     923 Apr 23 21:24 /usr/lib/libdb-4.7.la
-rwxr-xr-x 1 root root 1507876 Apr 23 21:44 /usr/lib/libdb-4.7.so
-rwxr-xr-x 1 root root 1541496 Apr 11 15:15 /usr/lib/libdb-4.8.so
lrwxrwxrwx 1 root root      11 Aug 28 14:59 /usr/lib/libdb.a -> libdb-4.7.a
lrwxrwxrwx 1 root root      12 Aug 28 14:59 /usr/lib/libdb.so -> libdb-4.8.so
Comment 6 Jeroen Roovers (RETIRED) gentoo-dev 2013-08-30 15:27:59 UTC
Also: 

lrwxrwxrwx 1 root root      10 Aug 28 14:59 /usr/include/db.h -> db4.7/db.h

That looks like a likely cause paired with 

lrwxrwxrwx 1 root root      12 Aug 28 14:59 /usr/lib/libdb.so -> libdb-4.8.so

Is this something that might have been recently fixed in db.eclass?
Comment 7 Jeroen Roovers (RETIRED) gentoo-dev 2013-09-01 14:29:25 UTC
# cat libdb.c 
#include <db.h>

int main() {
                return 0;
}

# make test
gcc -Wl,--as-needed -ggdb -O libdb.c -o libdb -ldb
./libdb
make: *** [test] Segmentation fault (core dumped)

gdb> t a a bt full
  Id   Target Id         Frame 
* 1    LWP 16719         0x403a9ee8 in check_match (sym=0x10270) at dl-lookup.c:177

# scanelf -n libdb
 TYPE   NEEDED FILE 
ET_EXEC libdb-4.7.so,libc.so.6 libdb

With -Wl,--no-as-needed it runs with no problems.
Comment 8 Guy Martin (RETIRED) gentoo-dev 2013-10-23 10:12:32 UTC
Created attachment 361696 [details, diff]
Cleanup version info from hidden symbols forced locals.

It appears that the function elf32_hppa_hide_symbol() doesn't remove potiential version information when forcing a symbol to be local.

When linking with libdb.so, the library's _GLOBAL_OFFSET_TABLE_ symbol is read first. When it's overwritten later on in _bfd_elf_create_got_section(), the version information is kept while it shouldn't.

I'll get this upstream after a bit of testing.
Comment 9 Guy Martin (RETIRED) gentoo-dev 2013-10-23 10:53:20 UTC
Created attachment 361712 [details, diff]
Cleanup version info from hidden symbols forced locals

Add a patch that actually builds :)
Comment 10 Guy Martin (RETIRED) gentoo-dev 2013-10-23 10:56:21 UTC
Created attachment 361714 [details, diff]
Cleanup version info from hidden symbols forced locals
Comment 11 Guy Martin (RETIRED) gentoo-dev 2013-10-24 11:15:06 UTC
Created attachment 361778 [details, diff]
Cleanup version info from hidden symbols forced locals

Here is the final patch without regression :)
Comment 12 Jeroen Roovers (RETIRED) gentoo-dev 2013-10-24 11:57:58 UTC
That works.
Comment 13 Guy Martin (RETIRED) gentoo-dev 2013-11-20 12:36:18 UTC
The patch is upstream now.
Comment 14 Guy Martin (RETIRED) gentoo-dev 2014-05-27 14:57:03 UTC
Toolchain, ping ?

Can this patch be included in the patch set for 2.23 and 2.24 ?

Thanks
Comment 15 SpanKY gentoo-dev 2014-06-03 02:53:47 UTC
i've added the fix to binutils-2.24-r3

http://sources.gentoo.org/gentoo/src/patchsets/binutils/2.24/53_all_hppa-as-needed.patch?rev=1.1