[2.24.51.20140918-1ubuntu1 regression] - /usr/bin/ld: .eh_frame_hdr refers to overlapping FDEs

Bug #1371636 reported by Oibaf
26
This bug affects 5 people
Affects Status Importance Assigned to Milestone
ARB
Invalid
Medium
auto-elmar
Mesa
Won't Fix
Medium
binutils
Unknown
Unknown
binutils (Ubuntu)
Fix Released
Undecided
Matthias Klose
llvm-toolchain-3.5 (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

Since today mesa fails to build on Ubuntu 14.10 (both i386 and amd64) while it still builds fine on Ubuntu 14.04. Nothing relevant changed in mesa since previous build in my PPA (indeed just some vc4 code only built on arm), the bug is reported by ld which I noticed just got updated with binutils package.

Full PPA build log:
https://launchpadlibrarian.net/185286922/buildlog_ubuntu-utopic-i386.mesa_10.4~git1409190730.195891~gd~u_FAILEDTOBUILD.txt.gz

Error:
libtool: link: g++ -fPIC -DPIC -shared -nostdlib /usr/lib/gcc/i686-linux-gnu/4.9/../../../i386-linux-gnu/crti.o /usr/lib/gcc/i686-linux-gnu/4.9/crtbeginS.o -Wl,--whole-archive ../../../../src/gallium/auxiliary/pipe-loader/.libs/libpipe_loader_client.a ../../../../src/gallium/state_trackers/clover/.libs/libclover.a ../../../../src/gallium/auxiliary/.libs/libgallium.a ../../../../src/util/.libs/libmesautil.a ../../../../src/gallium/winsys/sw/null/.libs/libws_null.a ../../../../src/gallium/winsys/sw/dri/.libs/libswdri.a ../../../../src/gallium/winsys/sw/xlib/.libs/libws_xlib.a -Wl,--no-whole-archive -L/usr/lib/llvm-3.5/lib /usr/lib/i386-linux-gnu/libexpat.so -lX11 -lXext -lXfixes -lxcb-dri2 -lxcb -ldrm -ldl -lclangFrontendTool -lclangFrontend -lclangDriver -lclangSerialization -lclangCodeGen -lclangParse -lclangSema -lclangAnalysis -lclangAST -lclangEdit -lclangLex -lclangBasic -lLLVM-3.5.0 -L/usr/lib/gcc/i686-linux-gnu/4.9 -L/usr/lib/gcc/i686-linux-gnu/4.9/../../../i386-linux-gnu -L/usr/lib/gcc/i686-linux-gnu/4.9/../../../../lib -L/lib/i386-linux-gnu -L/lib/../lib -L/usr/lib/i386-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/i686-linux-gnu/4.9/../../.. -lstdc++ -lm -lc -lgcc_s /usr/lib/gcc/i686-linux-gnu/4.9/crtendS.o /usr/lib/gcc/i686-linux-gnu/4.9/../../../i386-linux-gnu/crtn.o -O2 -march=pentium3 -Wl,--gc-sections -Wl,--no-undefined -Wl,--version-script=../../../../../../src/gallium/targets/opencl/opencl.sym -Wl,-Bsymbolic-functions -Wl,-z -Wl,relro -Wl,-soname -Wl,libMesaOpenCL.so.1 -o .libs/libMesaOpenCL.so.1.0.0
/usr/bin/ld: .eh_frame_hdr refers to overlapping FDEs.
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
Makefile:636: recipe for target 'libMesaOpenCL.la' failed

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in binutils (Ubuntu):
status: New → Confirmed
Revision history for this message
Maarten Lankhorst (mlankhorst) wrote :

This affects mesa 10.3 builds too, and happens with debian-experimental as well.

Changed in binutils (Ubuntu):
assignee: nobody → Matthias Klose (doko)
Revision history for this message
Maarten Lankhorst (mlankhorst) wrote :

It doesn't happen if I switch mesa back to using llvm 3.4.

Revision history for this message
In , David Kredba (nheghathivhistha) wrote :
Download full text (5.3 KiB)

With Gentoo LLVM-3.5 and Mesa-10.3 I cannot link libOpenCL.so.1.0.0 in Mesa-10.3.0-abi_x86_32.x86/src/gallium/targets/opencl with ld message
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.2-alpha20140918/../../../../x86_64-pc-linux-gnu/bin/ld: .eh_frame_hdr table[5707] FDE at 0000000000c45b8c overlaps table[5708] FDE at 0000000000c45a88.

gcc -v
Using built-in specs.
COLLECT_GCC=/usr/x86_64-pc-linux-gnu/gcc-bin/4.9.2-alpha20140918/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/4.9.2-alpha20140918/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /var/tmp/portage/sys-devel/gcc-4.9.2_alpha20140918/work/gcc-4.9-20140918/configure --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.9.2-alpha20140918 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.2-alpha20140918/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.9.2-alpha20140918 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.9.2-alpha20140918/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.9.2-alpha20140918/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.2-alpha20140918/include/g++-v4 --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/4.9.2-alpha20140918/python --enable-languages=c,c++,go,objc,obj-c++,fortran,ada --enable-obsolete --disable-werror --with-system-zlib --enable-nls --without-included-gettext --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 4.9.2_alpha20140918' --enable-libstdcxx-time --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-multilib --disable-altivec --disable-fixed-point --enable-targets=all --enable-libgomp --enable-lto --with-cloog --disable-isl-version-check
Thread model: posix
gcc version 4.9.2-alpha20140918 20140919 (prerelease) [gcc-4_9-branch revision 215375] (Gentoo 4.9.2_alpha20140918)

Binutils are today's GIT clone.
I saw bug report at https://bugs.launchpad.net/arb/+bug/1371636 stating this not happens with LLVM 3.4.

Link command:
gmake[3]: Entering directory '/var/tmp/portage/media-libs/mesa-10.3.0/work/Mesa-10.3.0-abi_x86_32.x86/src/gallium/targets/opencl'
/bin/sh ../../../../libtool --tag=CXX --mode=link x86_64-pc-linux-gnu-g++ -m32 -flto=4 -fuse-linker-plugin -O2 -pipe -march=core2 -mtune=core2 -mno-3dnow -mno-sse4.2 -mno-avx -mno-xop -mno-fma4 -mno-sse4a -Wall -fno-strict-aliasing -fno-builtin-memcmp -L/usr/lib32 -no-undefined -version-number 1:0 -Wl,--gc-sections -Wl,--no-undefined -Wl,--version-script=../../../../src/gallium/targets/opencl/opencl.sym -Wl,-flto -fuse-linker-plugin -Wl,--as-needed -Wl,-O2 -Wl,--sort-common -Wl,--hash-style=gnu -O2 -pipe -march=core2 -mtune=core2 -mno-3dnow -mno-sse4.2 -mno-avx -mno-xop -mno-fma4 -mno-sse4a -o libOpenCL.la -rpath /usr/lib32 ../../../../src/gallium/auxiliary/pipe-loader/libpipe_loader_client.la ../../../../src/gallium/state_trackers/clover/libclover.la ../../../../src/gallium/auxiliary/libgallium.la ../../../../src/util/libmesautil.la ../../../../src/gallium/winsys/sw/null/libws_null.la ../../../../src/gallium/winsys/sw/dri/libswdri.la ../../../../src/gallium/winsys/sw/xlib/libws_xlib.la -lX11 -lXext -lXf...

Read more...

Changed in mesa:
importance: Unknown → Medium
status: Unknown → Confirmed
Revision history for this message
In , Kai-4 (kai-4) wrote :

Created attachment 106957
Build log showing the FTBFS

I'm seeing the same FTBFS with Mesa from Git HEAD, LLVM 3.6 from SVN.

I've attached the build log from a build in a clean chroot environment (using pbuilder).

My stack is (base: Debian Testing):
libdrm: 2.4.56-1
LLVM: SVN:trunk/r218506 (3.6 snapshot)
libclc: Git:master/5b48f170c8
Mesa: Git:master/c3f17bb18f
GCC: 4.9.1-14 (gcc (Debian 4.9.1-14) 4.9.1)
autoconf: 2.69-8
libtool: 2.4.2-1.10
binutils: 2.24.51.20140903-1

Please let me know, if you need something else.

Revision history for this message
In , Kai-4 (kai-4) wrote :

CCing Emil (build system) and Tom (OpenCL)

(Bug title should probably be changed to something like "Build failure" or "FTBFS"...)

Revision history for this message
In , Emil-l-velikov (emil-l-velikov) wrote :

Building OpenCL works like a charm here. Can you try to establish which (if any) of the following components is responsible - llvm, gcc (*cough* 4.9.2_alpha) binutils or clang.

I'm building it on Archlinux (llvm 3.5.0, gcc 4.9.1 (snapshot 4.9-20140903), binutils 2.24 [1], clang 3.5.0).

[1] The binutils package has a patch which suspiciously looks like it should handle the issue
https://projects.archlinux.org/svntogit/packages.git/plain/trunk/binutils-2.24-shared-pie.patch?h=packages/binutils&id=47bdd59a9967ee8dd2bcc47797855185c6471546

Revision history for this message
In , David Kredba (nheghathivhistha) wrote :

I tested it with LLVM 3.4.2 and the same set of gcc-4.9.2 (svn) and binutils (svn) used to open this bug report and all built fine. So for me it looks like that LLVM 3.5.0 came with something changed. Is it not a same name of some function, introduced in LLVM 3.5.0 and present in Mesa before?
It seems to not be LTO issue if Kai really not uses it and with LLVM 3.4.2 it builds with LTO for me.
I checked content of ld/emultempl/elf32.em in my git replica and patch you are reffering to is incorporated.

Revision history for this message
In , Emil-l-velikov (emil-l-velikov) wrote :

(In reply to comment #4)
> I tested it with LLVM 3.4.2 and the same set of gcc-4.9.2 (svn) and binutils
> (svn) used to open this bug report and all built fine.
It may be that llvm 3.5 + mesa is "using" gcc/binutils in a slightly different way.
Can you try using the same versions as the one I've listed ? This way if it works one can start looking for the combination that exhibits the problem.

> So for me it looks
> like that LLVM 3.5.0 came with something changed. Is it not a same name of
> some function, introduced in LLVM 3.5.0 and present in Mesa before?
If the function prototype has changed then a compiler warning is due. Afaict your issue is at a later stage - link time.

> It seems to not be LTO issue if Kai really not uses it and with LLVM 3.4.2
> it builds with LTO for me.
I would recommend disabling LTO until one is able to clearly establish the root cause. After it's sorted you can get it back on for llvm.

> I checked content of ld/emultempl/elf32.em in my git replica and patch you
> are reffering to is incorporated.
I would recommend that you try the patch, before doing anything.

Revision history for this message
In , David Kredba (nheghathivhistha) wrote :

patch -p1 < ../../binutils-2.24-shared-pie.patch
patching file ld/emultempl/elf32.em
Hunk #1 FAILED at 1480.
Hunk #2 FAILED at 1504.
Hunk #3 FAILED at 1620.
3 out of 3 hunks FAILED -- saving rejects to file ld/emultempl/elf32.em.rej
The next patch would create the file ld/testsuite/ld-elf/ehdr_start-shared.d,
which already exists! Assume -R? [n]
Apply anyway? [n] n
Skipping patch.
1 out of 1 hunk ignored
patching file ld/testsuite/ld-elf/ehdr_start-userdef.d
Reversed (or previously applied) patch detected! Assume -R? [n] patch: tty read failed: Bad file descriptor
Apply anyway? [n]
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file ld/testsuite/ld-elf/ehdr_start-userdef.d.rej
patching file ld/testsuite/ld-elf/ehdr_start-weak.d
Reversed (or previously applied) patch detected! Assume -R? [n]
Apply anyway? [n]
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file ld/testsuite/ld-elf/ehdr_start-weak.d.rej
patching file ld/testsuite/ld-elf/ehdr_start.d
Reversed (or previously applied) patch detected! Assume -R? [n]
Apply anyway? [n]
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file ld/testsuite/ld-elf/ehdr_start.d.rej

So the patch is really included in my binutils. I will try no LTO and if it fails the same way your version of binutils + your patch to binutils.
In the mean time I will try find out if ld.gold can link it and if I can find out what symbol(s)/function(s) is(are) exactly reffered by that frame numbers.

Revision history for this message
In , Oibaf (oibaf) wrote :

This issue is reproducible without LTO, as reported in the Ubuntu bug. For reference, full build log is here:
https://launchpadlibrarian.net/185286922/buildlog_ubuntu-utopic-i386.mesa_10.4~git1409190730.195891~gd~u_FAILEDTOBUILD.txt.gz

Revision history for this message
In , Kai-4 (kai-4) wrote :

Ok, after trying to build an older Mesa version (Git:HEAD/5a4e0f3873 + patches from Mesa master to build with a recent LLVM 3.6), which I've built successfully in the past, I get the same FTBFS now.

After downgrading binutils to 2.24.51.20140818-1 (the version I've used in the successful build of Mesa 5a4e0f3873), and also downgrading gcc (+ all libraries from the gcc-4.9 package Mesa needs) to 4.9.1-12, because later gcc packages require newer binutils versions, I was able to build even the version I attempted to build yesterday (Mesa c3f17bb18f)

In no build I had LTO activated.

So it seems like this is a bug in binutils/gcc?

Revision history for this message
In , Kai-4 (kai-4) wrote :

(In reply to comment #8)
> Ok, after trying to build an older Mesa version (Git:HEAD/5a4e0f3873 +
> patches from Mesa master to build with a recent LLVM 3.6)

That should have read: (Git:master/5a4e0f3873 + patches from Mesa master to build with a recent LLVM 3.6 (180b152b24, 8f4ee56e49, 58b386dce4 and 4a38b154fd))

Revision history for this message
In , David Kredba (nheghathivhistha) wrote :

The same result with gcc 5.0 svn rev. 215679.

.eh_frame_hdr table[5712] FDE at 0000000000c45788 overlaps table[5713] FDE at 0000000000c45684.

Now I will try older binutils with two gcc versions used before.

Revision history for this message
In , David Kredba (nheghathivhistha) wrote :

With Gentoo vanilla binutils 2.24-r3 with two slim LTO patches and the patch referred by Emil Velikov in Comment #3

https://projects.archlinux.org/svntogit/packages.git/plain/trunk/binutils-2.24-shared-pie.patch?h=packages/binutils&id=47bdd59a9967ee8dd2bcc47797855185c6471546

it builds fine even with LTO enabled (using a trick with calling configure with LTO turned off and then -fno-lto -fno-use-linker-plugin removed from each Makefile).

So trunk binutils seems to be source of the problem.
I have to start with bisecting them.

Revision history for this message
In , Emil-l-velikov (emil-l-velikov) wrote :

(In reply to comment #11)
> With Gentoo vanilla binutils 2.24-r3 with two slim LTO patches and the patch
> referred by Emil Velikov in Comment #3
>
> https://projects.archlinux.org/svntogit/packages.git/plain/trunk/binutils-2.
> 24-shared-pie.patch?h=packages/
> binutils&id=47bdd59a9967ee8dd2bcc47797855185c6471546
>
> it builds fine even with LTO enabled (using a trick with calling configure
> with LTO turned off and then -fno-lto -fno-use-linker-plugin removed from
> each Makefile).
>
> So trunk binutils seems to be source of the problem.
> I have to start with bisecting them.

Nicely done. I hope that the problem does not end up a sheep in wolf's clothing - i.e. somewhere else. Using gcc+bintutils, to compile a third library, which links to another two compiler(ish) products... there are so many things that can be happening in there.

Thank you for the great initiative :)

Revision history for this message
In , Alan Modra (amodra-gmail) wrote :

I don't believe trunk binutils is the source of the problem. Trunk binutils (commit ae6c7e33 and aa8f4d1e) is merely letting you know about a case where previous versions of ld silently created binaries with potential runtime failures during exception handling.

Revision history for this message
In , Michel Dänzer (michel-daenzer) wrote :

(In reply to Alan Modra from comment #13)
> Trunk binutils (commit ae6c7e33 and aa8f4d1e) is merely letting you know about
> a case where previous versions of ld silently created binaries with potential
> runtime failures during exception handling.

Thanks. Would you happen to have any pointers to start looking for a solution?

Revision history for this message
In , Alan Modra (amodra-gmail) wrote :

Build libOpenCL.so.1 with -Wl,-noinhibit-exec,-Map,libOpenCl.map and look at the mapfile entries for .eh_frame. Try to match up with addresses given for the overlapping FDE. This should give you the object file(s) at fault. My guess is that further analysis will point at an llvm bug.

Revision history for this message
Elmar Pruesse (epr) wrote :

The check for overlaps and the error message were added to binutils on Sep 12th. Mail with commit:

https://www.sourceware.org/ml/binutils/2014-09/msg00094.html

I asked Alan about the issue, here's his response:

https://www.sourceware.org/ml/binutils/2014-09/msg00175.html

Revision history for this message
In , Alan Modra (amodra-gmail) wrote :

It looks like the overlapping FDE error is caused by a bunch of zero address range FDEs in /usr/lib/llvm-3.5/lib/libclangCodeGen.a(CGStmtOpenMP.o). These do have the potential to cause an exception handling problem at runtime, so ld is correct to complain. (It might also be reasonable for ld to discard these FDEs.) I haven't looked into why they are being generated, I'll leave that to someone familiar with that library. So, not a mesa bug.

Elmar Pruesse (epr)
Changed in arb:
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Alan Modra (amodra) wrote :

It looks like the overlapping FDE error is caused by a bunch of zero address range FDEs in /usr/lib/llvm-3.5/lib/libclangCodeGen.a(CGStmtOpenMP.o). These do have the potential to cause an exception handling problem at runtime, so ld is correct to complain. (It might also be reasonable for ld to discard these FDEs.) I haven't looked into why they are being generated, I'll leave that to someone familiar with that library.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in llvm-toolchain-3.5 (Ubuntu):
status: New → Confirmed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package binutils - 2.24.51.20141001-1ubuntu2

---------------
binutils (2.24.51.20141001-1ubuntu2) utopic; urgency=medium

  * Fix ld/17447, taken from upstream. LP: #1371636.
 -- Matthias Klose <email address hidden> Sun, 05 Oct 2014 07:54:23 +0200

Changed in binutils (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
In , Oibaf (oibaf) wrote :
Oibaf (oibaf)
Changed in llvm-toolchain-3.5 (Ubuntu):
status: Confirmed → Invalid
Changed in mesa:
status: Confirmed → Won't Fix
Revision history for this message
Oibaf (oibaf) wrote :

@Elmar Pruesse:
This issue should be fixed, is it also fixed for you in ARB?

Oibaf (oibaf)
Changed in arb:
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.