Summary: | sys-devel/binutils-2.24: i686-pc-linux-gnu-gcc -o conftest -pie -static conftest.c: Both -static and -pie lead to *** Error in `/usr/lib/gcc/i686-pc-linux-gnu/4.8.4/../../../../i686-pc-linux-gnu/bin/ld': corrupted double-linked list | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Piotr Szymaniak <bugzie> |
Component: | Current packages | Assignee: | Gentoo Toolchain Maintainers <toolchain> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | dirk.olmes, zorry |
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | x86 | ||
OS: | Linux | ||
URL: | https://sourceware.org/bugzilla/show_bug.cgi?id=17826 | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Attachments: | config.log |
Description
Piotr Szymaniak
2014-12-28 21:30:20 UTC
(In reply to Piotr Szymaniak from comment #0) > > Not sure what else can I post? I need the config.log. Created attachment 392662 [details]
config.log
(In reply to Piotr Szymaniak from comment #2) > Created attachment 392662 [details] > config.log Looks like your libdl is broken. Try this 1) Create a file called test.c and put the following in it: char dlopen (); int main () { return dlopen (); return 0; } 2) Compile it using `gcc -o test test.c -ldl` and report what you get. Compiles fine on both x86 machines. (In reply to Piotr Szymaniak from comment #4) > Compiles fine on both x86 machines. Take a look in the config.log file. You'll see configure:4639: checking for library containing dlopen configure:4670: i686-pc-linux-gnu-gcc -o conftest -march=k8-sse3 -Os -pipe -fomit-frame-pointer -msahf --param l1-cache-size=64 --param l1-cache-line-size=64 --param l2-cache-size=128 -Wall -Wl,-O1,--as-needed,--sort-common conftest.c >&5 /home/p/portage/net-proxy/torsocks-2.0.0/temp/ccudWwqZ.o: In function `main': conftest.c:(.text.startup+0x7): undefined reference to `dlopen' collect2: error: ld returned 1 exit status Which is the error I expected from comment #3. Perhaps its the other parameters to gcc. Try this full line: gcc -o test -march=k8-sse3 -Os -pipe -fomit-frame-pointer -msahf --param l1-cache-size=64 --param l1-cache-line-size=64 --param l2-cache-size=128 -Wall -Wl,-O1,--as-needed,--sort-common test.c If this succeeds, then I'm at a loss. If it fails, try to figure out what flag/flags is the cause. (In reply to Anthony Basile from comment #5) > (In reply to Piotr Szymaniak from comment #4) > > Compiles fine on both x86 machines. > > Take a look in the config.log file. You'll see > > configure:4639: checking for library containing dlopen > configure:4670: i686-pc-linux-gnu-gcc -o conftest -march=k8-sse3 -Os -pipe > -fomit-frame-pointer -msahf --param l1-cache-size=64 --param > l1-cache-line-size=64 --param l2-cache-size=128 -Wall > -Wl,-O1,--as-needed,--sort-common conftest.c >&5 > /home/p/portage/net-proxy/torsocks-2.0.0/temp/ccudWwqZ.o: In function `main': > conftest.c:(.text.startup+0x7): undefined reference to `dlopen' > collect2: error: ld returned 1 exit status > > Which is the error I expected from comment #3. Perhaps its the other > parameters to gcc. Try this full line: > > gcc -o test -march=k8-sse3 -Os -pipe -fomit-frame-pointer -msahf --param > l1-cache-size=64 --param l1-cache-line-size=64 --param l2-cache-size=128 > -Wall -Wl,-O1,--as-needed,--sort-common test.c > > If this succeeds, then I'm at a loss. If it fails, try to figure out what > flag/flags is the cause. Oh sorry, never mind. I see that that's the line without -ldl but it does succeeed on linking with libdl. The corrupted double-linked list isn't there. This may be a bug in gcc 4.8.4. Let me try to reproduce exactly. Just a notice, but the second x86 that failed has gcc 4.9.2. (In reply to Piotr Szymaniak from comment #7) > Just a notice, but the second x86 that failed has gcc 4.9.2. Does it fail with 4.8.3? The fact that it fails with 4.9.2 suggests that a fix between 4.8.3 and 4.8.4 broke something and is being carried forward. (In reply to Anthony Basile from comment #6) > Oh sorry, never mind. I see that that's the line without -ldl but it does > succeeed on linking with libdl. The corrupted double-linked list isn't > there. Well, after a test with 4.8.3 (see below) I did this test anyway and it end with an error withot -ldl: wloczykij tmp (: gcc -o test -march=k8-sse3 -Os -pipe -msahf --param l1-cache-size=64 --param l1-cache-line-size=64 --param l2-cache-size=128 -Wall -Wl,-O1,--as-needed,--sort-common test.c /tmp/cc2Rx9zR.o: In function `main': test.c:(.text.startup+0x10): undefined reference to `dlopen' collect2: error: ld returned 1 exit status wloczykij tmp ): gcc -o test -march=k8-sse3 -Os -pipe -msahf --param l1-cache-size=64 --param l1-cache-line-size=64 --param l2-cache-size=128 -Wall -Wl,-O1,--as-needed,--sort-common test.c -ldl wloczykij tmp (: (In reply to Anthony Basile from comment #8) > Does it fail with 4.8.3? The fact that it fails with 4.9.2 suggests that a > fix between 4.8.3 and 4.8.4 broke something and is being carried forward. Tried 4.8.3 on machine with 4.9 and it failed the same way. Another "fun fact" that I forgot (sorry, this can be revelant) - after getting this error compilation (or rather configuration) doesn't end - it just hangs like that for hours. (In reply to Piotr Szymaniak from comment #9) > > Tried 4.8.3 on machine with 4.9 and it failed the same way. Strictly speaking, ld is part of binutils, but you are using 2.24-r3 which is the latest stable. The other things to check in your toolchain are gcc, but that seems to be ruled out. So the last one is glibc-2.20. Did this work before you upgraded to glibc-2.20? The bug might be there. I tested with gcc-4.8.4, binutils-2.24-r3 and glibc-2.19-r1 and I can't reproduce. For the records ... i686-hardened-gdb ~ # emerge --info Portage 2.2.14 (python 3.3.5-final-0, hardened/linux/x86, gcc-4.8.4, glibc-2.19-r1, 3.18.1-hardened i686) ================================================================= System uname: Linux-3.18.1-hardened-i686-QEMU_Virtual_CPU_version_2.1.2-with-gentoo-2.2 KiB Mem: 1024016 total, 217924 free KiB Swap: 3931132 total, 3928424 free Timestamp of tree: Thu, 01 Jan 2015 03:30:01 +0000 ld GNU ld (Gentoo 2.24 p1.4) 2.24 app-shells/bash: 4.2_p53 dev-lang/perl: 5.18.2-r2 dev-lang/python: 2.7.9-r1, 3.3.5-r1, 3.4.1 dev-util/pkgconfig: 0.28-r1 sys-apps/baselayout: 2.2 sys-apps/openrc: 0.12.4 sys-apps/sandbox: 2.6-r1 sys-devel/autoconf: 2.69 sys-devel/automake: 1.13.4 sys-devel/binutils: 2.24-r3 sys-devel/gcc: 4.8.4 sys-devel/gcc-config: 1.7.3 sys-devel/libtool: 2.4.2-r1 sys-devel/make: 4.0-r1 sys-kernel/linux-headers: 3.16 (virtual/os-headers) sys-libs/glibc: 2.19-r1 Repositories: gentoo hardened-dev klondike ACCEPT_KEYWORDS="x86" ACCEPT_LICENSE="* -@EULA" CBUILD="i686-pc-linux-gnu" CFLAGS="-ggdb -O2 -march=i686 -pipe -fstack-check -fno-omit-frame-pointer" CHOST="i686-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo" CXXFLAGS="-ggdb -O2 -march=i686 -pipe -fstack-check -fno-omit-frame-pointer" DISTDIR="/usr/portage/distfiles" FCFLAGS="-march=i686 -O2 -pipe" FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news nostrip parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr" FFLAGS="-march=i686 -O2 -pipe" GENTOO_MIRRORS="ftp://192.168.3.1/pub/gentoo" LDFLAGS="-Wl,-O1 -Wl,--as-needed" MAKEOPTS="-j2" PKGDIR="/usr/portage/packages" PORTAGE_CONFIGROOT="/" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/var/lib/layman/hardened-development /var/lib/layman/klondike" SYNC="rsync://192.168.3.1/portage" USE="acl berkdb bzip2 cli cracklib crypt curl cxx dri gdbm hardened iconv ipv6 modules ncurses nls nptl openmp pam pax_kernel pcre pic ptpax readline session ssl tcpd unicode urandom x86 xattr xtpax zlib" ABI_X86="32" 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" 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 author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap 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 ublox ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_3" RUBY_TARGETS="ruby19 ruby20" USERLAND="GNU" VIDEO_CARDS="apm ark chips cirrus cyrix dummy fbdev glint i128 i740 intel mach64 mga nsc nv r128 radeon rendition s3 s3virge savage siliconmotion sis sisusb tdfx tga trident tseng v4l vesa via vmware nouveau" 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" Unset: CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON For the record, the issue in question just appeared on my box, after upgrading gcc from 4.8.3 to 4.8.4. So it does look like a gcc bug. The conftest.c which breaks is a one-liner, so I'm pasting it here: int main(){return(0);} The gcc command line is: /usr/i686-pc-linux-gnu/gcc-bin/4.8.4/i686-pc-linux-gnu-gcc -o conftest -O2 -march=native -fomit-frame-pointer -pipe -Wall -fPIE -fwrapv --param ssp-buffer-size=1 -fstack-protector-all -fno-strict-overflow -Wl,-O1 -Wl,--as-needed -pie -z relro -z now -D_FORTIFY_SOURCE=2 -static conftest.c -ldl Trial and error suggests that removing -pie from the command line makes the crash go away, as does removing -static. And yes, my box is x86 as well. Portage 2.2.15 (python 2.7.9-final-0, default/linux/x86/13.0/desktop/kde, gcc-4.8.4, glibc-2.19-r1, 3.18.1-gentoo i686) ================================================================= System uname: Linux-3.18.1-gentoo-i686-Intel-R-_Core-TM-2_Duo_CPU_E6750_@_2.66GHz-with-debian-sid KiB Mem: 2072960 total, 325876 free KiB Swap: 1048572 total, 706772 free Timestamp of tree: Fri, 02 Jan 2015 15:30:01 +0000 sh bash 4.2_p53 ld GNU ld (Gentoo 2.24 p1.4) 2.24 app-shells/bash: 4.2_p53 dev-java/java-config: 2.2.0 dev-lang/perl: 5.18.2-r2 dev-lang/python: 2.7.9-r1, 3.2.5-r6, 3.3.5-r1, 3.4.1 dev-util/cmake: 3.0.2 dev-util/pkgconfig: 0.28-r1 sys-apps/baselayout: 2.2 sys-apps/openrc: 0.13.6 sys-apps/sandbox: 2.6-r1 sys-devel/autoconf: 2.13, 2.69 sys-devel/automake: 1.11.6-r1, 1.13.4 sys-devel/binutils: 2.24-r3 sys-devel/gcc: 4.8.4 sys-devel/gcc-config: 1.7.3 sys-devel/libtool: 2.4.2-r1 sys-devel/make: 4.0-r1 sys-kernel/linux-headers: 3.16 (virtual/os-headers) sys-libs/glibc: 2.19-r1 Repositories: gentoo local-overlay roslin Installed sets: @kadu-modular, @system ACCEPT_KEYWORDS="x86" ACCEPT_LICENSE="*" CBUILD="i686-pc-linux-gnu" CFLAGS="-O2 -march=native -fomit-frame-pointer -pipe" CHOST="i686-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/hddtemp /usr/share/themes/oxygen-gtk/gtk-2.0 /usr/share/themes/oxygen-gtk/gtk-3.0 /var/lib/hsqldb" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/splash /etc/terminfo" CXXFLAGS="-O2 -march=native -fomit-frame-pointer -pipe" DISTDIR="/var/tmp/distfiles" EMERGE_DEFAULT_OPTS="--quiet-build=y --ignore-built-slot-operator-deps=y" FCFLAGS="-O2 -march=i686 -pipe" FEATURES="assume-digests binpkg-logs collision-protect config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news noinfo parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync" FFLAGS="-O2 -march=i686 -pipe" GENTOO_MIRRORS="http://gentoo.mirror.pw.edu.pl/" LANG="pl_PL.UTF-8" LC_ALL="pl_PL.UTF-8" LDFLAGS="-Wl,-O1 -Wl,--as-needed" MAKEOPTS="-j2 -s" PKGDIR="/var/tmp/packages" PORTAGE_CONFIGROOT="/" PORTAGE_RSYNC_EXTRA_OPTS="--exclude-from=/etc/portage/banned_branches" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/usr/local/portage /home/mziab/roslin" USE="X a52 aac acpi alsa bash-completion berkdb branding bzip2 cairo cdda cdr cli consolekit cracklib crypt cups curl custom-cflags custom-cxxflags cxx dbus declarative dri dts dvd dvdr emboss encode exif faac faad fam ffmpeg firefox flac ftp gdbm gif glamor gstreamer gtk iconv infinality inotify ipv6 joystick jpeg kde kdehiddenvisibility kdeprefix kipi lame lcdfilter lcms libnotify lzma mad mmx mmxext mng modules mp3 mp4 mpeg musepack ncurses nls nptl ogg opengl openmp pam pango pch pcre pdf phonon plasma png policykit ppds qt3support qt4 readline sdl session smp sndfile spell sse sse2 sse3 ssl ssse3 startup-notification svg tcpd threads tiff timidity truetype udev udisks unicode upower usb vorbis wavpack win32codecs wxwidgets x264 x86 xcb xcomposite xinerama xml xscreensaver xv xvid zlib" ABI_X86="32" ALSA_CARDS="hda-intel" 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 author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap 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 ublox ubx" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="pl" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_3" RUBY_TARGETS="ruby19 ruby20" USERLAND="GNU" VIDEO_CARDS="none nvidia" 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" Unset: CPPFLAGS, CTARGET, INSTALL_MASK, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, SYNC, USE_PYTHON (In reply to Michał Ziąbkowski from comment #12) > For the record, the issue in question just appeared on my box, after > upgrading gcc from 4.8.3 to 4.8.4. So it does look like a gcc bug. > > The conftest.c which breaks is a one-liner, so I'm pasting it here: > int main(){return(0);} > > The gcc command line is: > /usr/i686-pc-linux-gnu/gcc-bin/4.8.4/i686-pc-linux-gnu-gcc -o conftest -O2 > -march=native -fomit-frame-pointer -pipe -Wall -fPIE -fwrapv --param > ssp-buffer-size=1 -fstack-protector-all -fno-strict-overflow -Wl,-O1 > -Wl,--as-needed -pie -z relro -z now -D_FORTIFY_SOURCE=2 -static conftest.c > -ldl > > Trial and error suggests that removing -pie from the command line makes the > crash go away, as does removing -static. > Thanks for narrowing it down! I'm hitting it even in 4.8.3. Steps to reproduce: 1) download stage3-i686-20141209.tar.bz2 and prepare a chroot 2) echo "int main(){return 0;}" > conftest.c 3) gcc -o conftest -pie -static conftest.c #you don't even need the -ldl and you get *** Error in `/usr/lib/gcc/i686-pc-linux-gnu/4.8.3/../../../../i686-pc-linux-gnu/bin/ld': corrupted double-linked list: 0x09ec6d48 *** Having said that, pie + static is not something we support. I know Rich Felker of musl has got it working there and so it is possible. So: 1) Let me look at torsocks build system and add intelligency (easy) 2) We might be able to add something to gcc that says pie + static = boom! (medium hard) 3) We can get pie + static working in gentoo with glibc. (hard). I stand corrected. There is one other relevant package that got updated besides gcc, and that is binutils. So I downgraded binutils just in case.. and the crash is gone. binutils-2.23.2 works as intended, whereas 2.24-r3 crashes. Switching back to the newer binutils makes the crash reappear. So the culprit seems to have been binutils all along! (In reply to Michał Ziąbkowski from comment #14) > I stand corrected. There is one other relevant package that got updated > besides gcc, and that is binutils. So I downgraded binutils just in case.. > and the crash is gone. > > binutils-2.23.2 works as intended, whereas 2.24-r3 crashes. Switching back > to the newer binutils makes the crash reappear. So the culprit seems to have > been binutils all along! I'm not sure what you mean "as intended" pie + static is not supported. You would need different end files that what we ship in gentoo. Here's what I get: # gcc -o conftest -pie -static conftest.c /usr/lib/gcc/i686-pc-linux-gnu/4.8.3/../../../../i686-pc-linux-gnu/bin/ld: /usr/lib/gcc/i686-pc-linux-gnu/4.8.3/crtbeginT.o: warning: relocation in readonly section `.text'. /usr/lib/gcc/i686-pc-linux-gnu/4.8.3/../../../../i686-pc-linux-gnu/bin/ld: BFD (Gentoo 2.23.2 p1.0) 2.23.2 assertion fail /var/tmp/portage/sys-devel/binutils-2.23.2/work/binutils-2.23.2/bfd/elflink.c:13019 /usr/lib/gcc/i686-pc-linux-gnu/4.8.3/../../../../i686-pc-linux-gnu/bin/ld: BFD (Gentoo 2.23.2 p1.0) 2.23.2 assertion fail /var/tmp/portage/sys-devel/binutils-2.23.2/work/binutils-2.23.2/bfd/elflink.c:13019 /usr/lib/gcc/i686-pc-linux-gnu/4.8.3/../../../../i686-pc-linux-gnu/bin/ld: BFD (Gentoo 2.23.2 p1.0) 2.23.2 assertion fail /var/tmp/portage/sys-devel/binutils-2.23.2/work/binutils-2.23.2/bfd/elflink.c:13019 /usr/lib/gcc/i686-pc-linux-gnu/4.8.3/../../../../i686-pc-linux-gnu/bin/ld: BFD (Gentoo 2.23.2 p1.0) 2.23.2 assertion fail /var/tmp/portage/sys-devel/binutils-2.23.2/work/binutils-2.23.2/bfd/elflink.c:13019 /usr/lib/gcc/i686-pc-linux-gnu/4.8.3/../../../../i686-pc-linux-gnu/bin/ld: BFD (Gentoo 2.23.2 p1.0) 2.23.2 assertion fail /var/tmp/portage/sys-devel/binutils-2.23.2/work/binutils-2.23.2/bfd/elflink.c:13019 /usr/lib/gcc/i686-pc-linux-gnu/4.8.3/../../../../i686-pc-linux-gnu/bin/ld: warning: creating a DT_TEXTREL in object. collect2: error: ld returned 1 exit status Right, that was a slightly unfortunate choice of words. What I meant was, with the older binutils the build at least doesn't crash with the "corrupted double-linked list" error. So although pie + static is not a supported combination, this proves the bug is not really a gcc bug, but more likely a binutils bug. I think it makes most sense to just add some intelligence to this package's build system. But researching the reason why the crash occurs with the newer binutils also seems worthwhile. (In reply to Michał Ziąbkowski from comment #16) > I think it makes most sense to just add some intelligence to this package's > build system. But researching the reason why the crash occurs with the newer > binutils also seems worthwhile. I'm debating here because pie + static is possible. I don't want to go around and add this to every build system. I'll look to see if torsocks actively adds static and pie and fix that, else this bug will just revert to getting a fix into binutils 2.24 upstream. Okay I've thought about this. Here's what we should do: 1) The double linked list error needs to be fixed. I'm in the process of narrowing it down. I think it dies in glibc's heap allocator which is a double linked list but it is triggered by something ld does. The error is not there on uclibc or musl. 2) However, the build should not die (either with an assert() or otherwise), but just ignore pie if both -static and -pie are given. So we should change the gcc spec files. In the *link_command: we should change %{pie:-pie} to %{!static:%{pie:-pie}}. I know this makes it "silently work" but anyone who understands those options should not try to give both. Comments from the rest of toolchain? (In reply to Anthony Basile from comment #18) > Okay I've thought about this. Here's what we should do: > > 1) The double linked list error needs to be fixed. I'm in the process of > narrowing it down. I think it dies in glibc's heap allocator which is a > double linked list but it is triggered by something ld does. The error is > not there on uclibc or musl. > > 2) However, the build should not die (either with an assert() or otherwise), > but just ignore pie if both -static and -pie are given. So we should change > the gcc spec files. In the *link_command: we should change %{pie:-pie} to > %{!static:%{pie:-pie}}. > > I know this makes it "silently work" but anyone who understands those > options should not try to give both. > > Comments from the rest of toolchain? The warning in gold should be ported to ld so i would ask upstream. (In reply to Magnus Granberg from comment #19) > (In reply to Anthony Basile from comment #18) > > > > 2) However, the build should not die (either with an assert() or otherwise), > > but just ignore pie if both -static and -pie are given. So we should change > > the gcc spec files. In the *link_command: we should change %{pie:-pie} to > > %{!static:%{pie:-pie}}. > > > > Comments from the rest of toolchain? > The warning in gold should be ported to ld so i would ask upstream. The bug was introduced by the following commit: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=9f7c3e5e99a620b68f6b2d0f3b17329e40b8d781 which looks like they're trying to fix a memory leak in freeing some hash table. They should still fix even if they add the warning. This issue has been reported upstream. (In reply to Anthony Basile from comment #21) > This issue has been reported upstream. My report was a duplicate of https://sourceware.org/bugzilla/show_bug.cgi?id=16428 According to that bug report, ld.bfd does support -static -pie which in principle is possible, you just need different end files. Its gcc, glibc and ld.gold that don't support the conbination. The fix went in yesterday. I tested and it does "work" in that ld.bfd does generate an ET_DYN exectuable object with all the expected segments and sections, but it fails to run. This leaves us with the question of what to do in gentoo. I think we leave things alone and just let the error happen. I also check the hardened spec file and it does have %{!static:%{pie:-pie}} which we may want to remove and let the failure occur as a reminder that this issue is there. This way in the future when/if we do support -pie -static (which may be close on musl) we won't forget and get a false success as I did and went around chasing false leads. (In reply to Piotr Szymaniak from comment #10) > Another "fun fact" that I forgot (sorry, this can be revelant) - after > getting this error compilation (or rather configuration) doesn't end - it > just hangs like that for hours. @Piotr: Okay so as to not loose site of the original issue, I've just committed torsocks-2.0.0-r1 which now avoids the -static -pie combination in its build system. (In reply to Anthony Basile from comment #23) > (In reply to Piotr Szymaniak from comment #10) > > Another "fun fact" that I forgot (sorry, this can be revelant) - after > > getting this error compilation (or rather configuration) doesn't end - it > > just hangs like that for hours. > > @Piotr: Okay so as to not loose site of the original issue, I've just > committed torsocks-2.0.0-r1 which now avoids the -static -pie combination in > its build system. Patch submitted upstream: https://trac.torproject.org/projects/tor/ticket/14166 (In reply to Anthony Basile from comment #23) > @Piotr: Okay so as to not loose site of the original issue, I've just > committed torsocks-2.0.0-r1 which now avoids the -static -pie combination in > its build system. Thanks for noticing. (In reply to Piotr Szymaniak from comment #25) > (In reply to Anthony Basile from comment #23) > > @Piotr: Okay so as to not loose site of the original issue, I've just > > committed torsocks-2.0.0-r1 which now avoids the -static -pie combination in > > its build system. > > Thanks for noticing. There were a couple of things going on. Both are fixed. So we're done. *** Bug 547394 has been marked as a duplicate of this bug. *** |