Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 503838 (PR60465) - sys-libs/glibc: building w/>=gcc-4.8 crashes early on ia64 in rtld GNU hash bootstrap
Summary: sys-libs/glibc: building w/>=gcc-4.8 crashes early on ia64 in rtld GNU hash b...
Status: RESOLVED FIXED
Alias: PR60465
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: IA64 Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL: http://gcc.gnu.org/PR60465
Whiteboard:
Keywords:
: 536940 (view as bug list)
Depends on:
Blocks: gcc-4.8 gcc-4.9 gcc-4.8-stable 518130 545124 gcc-4.9-stable
  Show dependency tree
 
Reported: 2014-03-08 11:16 UTC by Dennis Schridde
Modified: 2017-03-18 03:16 UTC (History)
5 users (show)

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


Attachments
backtrace (sys-libs/glibc-2.18-r1,sys-devel/binutils-2.24-r2,sys-devel/gcc-4.8.2) (date-segfault-glibc-2.18-r1-binutils-2.24-r2-gcc-4.8.2.log,12.75 KB, text/plain)
2014-03-08 11:16 UTC, Dennis Schridde
Details
emerge --info (emerge.info,4.40 KB, text/plain)
2014-03-08 12:09 UTC, Dennis Schridde
Details
0001-elf-get-dynamic-info.h-fix-early-GNU_HASH-processing.patch (0001-elf-get-dynamic-info.h-fix-early-GNU_HASH-processing.patch,3.14 KB, patch)
2015-12-26 19:36 UTC, Sergei Trofimovich (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dennis Schridde 2014-03-08 11:16:13 UTC
Created attachment 372064 [details]
backtrace (sys-libs/glibc-2.18-r1,sys-devel/binutils-2.24-r2,sys-devel/gcc-4.8.2)

I tried to build sys-libs/glibc-2.17 and sys-libs/glibc-2.18-r1 with sys-devel/binutils-2.23.2 or sys-devel/binutils-2.24-r2 and sys-devel/gcc-4.8.2, but always run into the same error in the pkg_preinst stage:
/var/cache/portage/gentoo/sys-libs/glibc/files/eblits/pkg_preinst.eblit: line 21:  9222 Segmentation fault      ./ld-*.so --library-path . ${x} >
/dev/null
 * ERROR: sys-libs/glibc-2.18-r1::gentoo failed (preinst phase):
 *   simple run test (/bin/date) failed
 *

Please find a backtrace for the sys-libs/glibc-2.18-r1,sys-devel/binutils-2.24-r2,sys-devel/gcc-4.8.2 combination attached.

The context of the crash is (according to glibc-2.18/elf/get-dynamic-info.h):
elf_get_dynamic_info (struct link_map *l, ElfW(Dyn) *temp) {
  ElfW(Dyn) **info;
  info = l->l_info;
  info[DT_ADDRTAGIDX (dyn->d_tag) + DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM + DT_EXTRANUM + DT_VALNUM] = dyn;
}

GDB reports this function being called as:
elf_get_dynamic_info (temp=0x0, l=0x2000000800051458 <_rtld_local+2456>)

What I find to be suspicious is the changed order of parameters.

I would like to check this with valgrind, too, but it is hardmasked for ia64 (i.e. anything but x86, ppc and arm).
Comment 1 Dennis Schridde 2014-03-08 11:23:49 UTC
P.S: It crashes in exactly the same way when running without --library-path and when running with ../usr/bin/locale as argument.
Comment 2 Dennis Schridde 2014-03-08 12:09:42 UTC
Created attachment 372070 [details]
emerge --info

Since sys-libs/glibc-2.17 compiled fine with sys-devel/gcc-4.7.3, I assume that sys-devel/gcc-4.8.2 is to blame.

See-Also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60465
Comment 3 SpanKY gentoo-dev 2014-03-09 00:06:32 UTC
you're running a hardened system, but it reproduces on a normal system too
Comment 4 SpanKY gentoo-dev 2014-03-09 04:14:09 UTC
building all of glibc w/4.8 and then rebuilding just elf/rtld.c w/4.7 works
Comment 5 SpanKY gentoo-dev 2014-03-18 07:19:12 UTC
i suspect bad code generation from gcc.  you should update your bug with the fields i entered in the duplicate report.
Comment 6 SpanKY gentoo-dev 2015-02-09 16:05:57 UTC
*** Bug 536940 has been marked as a duplicate of this bug. ***
Comment 7 Jack Morgan (RETIRED) gentoo-dev 2015-05-30 15:24:40 UTC
This is reproducible in gcc-4.8.4 with glibc-2.20-r2, errors I got are...


>>> Done.
 * checking 1403 files for package collisions
1000 files checked ...
>>> Merging sys-libs/glibc-2.20-r2 to /
 * Defaulting /etc/host.conf:multi to on
/usr/portage/sys-libs/glibc/files/eblits/pkg_preinst.eblit: line 24: 15682 Segmentation fault      ./ld-*.so --library-path . ${x} > /dev/null
 * ERROR: sys-libs/glibc-2.20-r2::gentoo failed (preinst phase):
 *   simple run test (/usr/bin/cal) failed
 * 
 --snip---
 *
!!! FAILED preinst: 1
Comment 8 Brendan Horan 2015-09-24 12:44:50 UTC
I get the same. On a non harden install.

# gcc --version
gcc (GCC) 4.8.2 20130815 (prerelease)

and
glibc-2.20-r2

 message :
ecompressdir: bzip2 -9 /usr/share/man
 * checking 1439 files for package collisions
1000 files checked ...
>>> Merging sys-libs/glibc-2.20-r2 to /
 * Defaulting /etc/host.conf:multi to on
/usr/portage/sys-libs/glibc/files/eblits/pkg_preinst.eblit: line 24: 21352 Segme
ntation fault      ./ld-*.so --library-path . ${x} > /dev/null
 * ERROR: sys-libs/glibc-2.20-r2::gentoo failed (preinst phase):
 *   simple run test (/usr/bin/cal) failed
Comment 9 Brendan Horan 2015-09-24 13:00:10 UTC
I also get it on : glibc-2.19-r1

1000 files checked ...
>>> Merging sys-libs/glibc-2.19-r1 to /
 * Defaulting /etc/host.conf:multi to on
/usr/portage/sys-libs/glibc/files/eblits/pkg_preinst.eblit: line 24: 16154 Segmentation fault      ./ld-*.so --library-path . ${x} > /dev/null
 * ERROR: sys-libs/glibc-2.19-r1::gentoo failed (preinst phase):
 *   simple run test (/usr/bin/cal) failed
Comment 10 Émeric Maschino 2015-10-30 19:43:37 UTC
Naive question there: is this only a problem between glibc and gcc-4.8, or is it a sign of something more seriously broken in gcc-4.8 that will break many other packages on ia64?

     Émeric
Comment 11 Agostino Sarubbo gentoo-dev 2015-11-18 13:57:42 UTC
I have the same issue with gcc-4.9.3
Comment 12 Brendan Horan 2015-12-18 01:37:12 UTC
Still an issue :
1000 files checked ...
>>> Merging sys-libs/glibc-2.21-r1 to /
 * Defaulting /etc/host.conf:multi to on
/usr/portage/sys-libs/glibc/files/eblits/pkg_preinst.eblit: line 24: 32147 Segmentation fault      LC_ALL=C ./ld-*.so --library-path . ${x} > /dev/null
 * ERROR: sys-libs/glibc-2.21-r1::gentoo failed (preinst phase):
 *   simple run test (/usr/bin/cal) failed
 * 


Using sys-libs/glibc-2.21-r1 and sys-devel/gcc-4.7.4
Comment 13 Sergei Trofimovich (RETIRED) gentoo-dev 2015-12-19 19:45:18 UTC
I've found a weird workaround for it (the same crash as in comment #1):

building glibc-2.22-r1 with
    LDFLAGS="-Wl,--hash-style=sysv"
instead of --hash-style=gnu makes glibc install fine.

I'll explore why exactly rtld crashes.
Comment 14 Brendan Horan 2015-12-20 07:01:43 UTC
(In reply to Sergei Trofimovich from comment #13)
> I've found a weird workaround for it (the same crash as in comment #1):
> 
> building glibc-2.22-r1 with
>     LDFLAGS="-Wl,--hash-style=sysv"
> instead of --hash-style=gnu makes glibc install fine.
> 
> I'll explore why exactly rtld crashes.

This works for me.
I can build glibc-2.17 and glibc-2-21 with no issues.

LDFLAGS="${LDFLAGS}  -Wl,--hash-style=sysv" emerge -av sys-libs/glibc
Comment 15 Sergei Trofimovich (RETIRED) gentoo-dev 2015-12-26 19:36:44 UTC
Created attachment 420900 [details, diff]
0001-elf-get-dynamic-info.h-fix-early-GNU_HASH-processing.patch

This workaround makes GNU_HASH load work correctly on gcc-4.9.3.

Sent it upstream:
https://sourceware.org/ml/libc-alpha/2015-12/msg00556.html
Comment 16 SpanKY gentoo-dev 2015-12-28 18:35:26 UTC
i've deployed the workaround to glibc:
http://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cbd2a52033efd9a333508d5cd9bd35bd00a2c06b

we can address the proper fix in the respective upstreams
Comment 17 Sergei Trofimovich (RETIRED) gentoo-dev 2016-01-17 10:30:58 UTC
upstream gcc fix: https://github.com/gcc-mirror/gcc/commit/afe82e5b25dda439d84a99d95b3767d6cced79c8
Comment 19 Émeric Maschino 2016-01-31 14:29:42 UTC
(In reply to SpanKY from comment #18)
> i've queued the 4.9 & 5 backports here:
> https://sources.gentoo.org/gentoo/src/patchsets/gcc/4.9.3/gentoo/36_all_gcc-
> ia64-pr60465.patch?rev=1.1
> https://sources.gentoo.org/gentoo/src/patchsets/gcc/5.3.0/gentoo/36_all_gcc-
> ia64-pr60465.patch?rev=1.1
> 
> should be all set now.  thanks for fixing this Sergei!

Do we need updated glibc to definitely fix this issue?

As I've already reported in https://bugs.gentoo.org/show_bug.cgi?id=518130#c5, gdb is still failing when booting kernel built with gcc 4.9 (no problem when built with gcc 4.5). All this with current ia64 stable stack:
- sys-devel/binutils-2.25.1-r1
- sys-devel/gcc-4.9.3
- sys-devel/gdb-7.10.1
- sys-kernel/gentoo-sources-4.1.12
- sys-libs/glibc-2.21-r1

Among other oddities, mail-client/evolution:2.0 is failing with:

/usr/lib/gcc/ia64-unknown-linux-gnu/4.9.3/../../../libwebkitgtk-3.0.so: undefined reference to `std::chrono::steady_clock::now()@GLIBCXX_3.4.17'

I've however rebuilt both sys-devel/glibc and net-libs/webkit-gtk using gcc 4.9. This doesn't happen when building with gcc 4.7.

Can you please double-check on your side?

Thanks,

     Émeric
Comment 20 SpanKY gentoo-dev 2016-02-01 04:19:09 UTC
(In reply to Émeric Maschino from comment #19)

this bug is only about glibc crashing early.  a workaround was added to current glibc versions, and the fix to not make it crash added to current gcc versions.  any other issue is unrelated to this bug.
Comment 21 Émeric Maschino 2016-02-01 11:34:28 UTC
> (In reply to SpanKY from comment #20)
> 
> this bug is only about glibc crashing early.  a workaround was added to
> current glibc versions, and the fix to not make it crash added to current
> gcc versions.  any other issue is unrelated to this bug.

So, I'm lost ;-) Following resolution of this bug, why was bug #518130 then closed, saying that it should resolved by itself now that gcc 4.8/4.9 is ia64 stable [1]? That's indeed not the case actually.

     Émeric


[1] https://bugs.gentoo.org/show_bug.cgi?id=518130#c3
Comment 22 Sergei Trofimovich (RETIRED) gentoo-dev 2016-02-01 21:35:51 UTC
> As I've already reported in
> https://bugs.gentoo.org/show_bug.cgi?id=518130#c5, gdb is still failing when
> booting kernel built with gcc 4.9 (no problem when built with gcc 4.5). All
> this with current ia64 stable stack:
> - sys-devel/binutils-2.25.1-r1
> - sys-devel/gcc-4.9.3
> - sys-devel/gdb-7.10.1
> - sys-kernel/gentoo-sources-4.1.12
> - sys-libs/glibc-2.21-r1

Sounds like a different gcc/gdb/kernel bug. I suggest filing a new report with
reference to bug #518130 as bug claims gdb worked at some point around gcc-4.8.

> Among other oddities, mail-client/evolution:2.0 is failing with:
> 
> /usr/lib/gcc/ia64-unknown-linux-gnu/4.9.3/../../../libwebkitgtk-3.0.so:
> undefined reference to `std::chrono::steady_clock::now()@GLIBCXX_3.4.17'
> 
> I've however rebuilt both sys-devel/glibc and net-libs/webkit-gtk using gcc
> 4.9. This doesn't happen when building with gcc 4.7.
> 
> Can you please double-check on your side?

gcc changed ABI for some C++ symbols and all binaries trying to use that require recompilation.
It's a bug #513386 which has some hints and a news item:

https://www.gentoo.org/support/news-items/2015-10-22-gcc-5-new-c++11-abi.html

Which means you need to rebuild some c++ stuff after compiler switch.
Comment 23 SpanKY gentoo-dev 2016-02-01 22:12:54 UTC
(In reply to Émeric Maschino from comment #21)

bug 518130 isn't about linking at all.  let's keep discussion of that bug there.
Comment 24 Ryan Hill (RETIRED) gentoo-dev 2016-04-29 00:27:57 UTC
5.3.0 p1.1 containing this patch is now in the tree.