Bug 17742 - ABI version 1 is not compatible with ABI version 0 output
Summary: ABI version 1 is not compatible with ABI version 0 output
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: 2.25
: P2 normal
Target Milestone: ---
Assignee: Alan Modra
URL: https://sourceware.org/ml/binutils/20...
Keywords:
Depends on:
Blocks:
 
Reported: 2014-12-22 16:44 UTC by Andreas Schwab
Modified: 2015-02-11 13:02 UTC (History)
1 user (show)

See Also:
Host:
Target: powerpc64-*-*
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Schwab 2014-12-22 16:44:27 UTC
$ echo 'int x;' > foo.c
$ gcc -shared -o foo.so foo.c
$ gcc -c foo.c
$ readelf -h foo.o | grep Flags:
  Flags:                             0x0
$ readelf -h foo.so | grep Flags:
  Flags:                             0x1, abiv1
$ ld -shared --eh-frame-hdr foo.o foo.so 
ld: foo.so: ABI version 1 is not compatible with ABI version 0 output
ld: failed to merge target specific data of file foo.so
Comment 1 Alan Modra 2014-12-23 11:15:54 UTC
How did you manage that?  Here's what I see on my powerpc64 box, using a freshly compiled binutils-2.25 for the final link and recent trunk binutils for the rest.

[alan@squeak bin-225]$ echo 'int x;' > foo.c
[alan@squeak bin-225]$ gcc -shared -o foo.so foo.c
[alan@squeak bin-225]$ gcc -c foo.c
[alan@squeak bin-225]$ readelf -h foo.o | grep Flags:
  Flags:                             0x0
[alan@squeak bin-225]$ readelf -h foo.so | grep Flags:
  Flags:                             0x1, abiv1
[alan@squeak bin-225]$ ld/ld-new -shared --eh-frame-hdr foo.o foo.so
[alan@squeak bin-225]$ readelf -h a.out | grep Flags:
  Flags:                             0x1, abiv1
Comment 2 Andreas Schwab 2014-12-23 13:31:40 UTC
This is strange.  The error is coming from <https://build.opensuse.org/package/live_build_log/openSUSE:Factory:PowerPC/libgcj48/standard/ppc64> and I can reproduce the problem with the binutils used there for building (which was cut from commit 89e0345), but I cannot reproduce it when I try it with the exact same binutils sources built locally.
Comment 3 Andreas Schwab 2014-12-24 10:54:17 UTC
$ ld -shared --eh-frame-hdr --as-needed foo.o foo.so 
ld: foo.so: ABI version 1 is not compatible with ABI version 0 output
ld: failed to merge target specific data of file foo.so
Comment 4 Sourceware Commits 2014-12-24 13:19:19 UTC
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gdb and binutils".

The branch, master has been updated
       via  ca0694adf6d128c2feba16f6374954c191fb5edb (commit)
      from  854399ea9d0d5d5c14b4035bbc0adfe891f26a3d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ca0694adf6d128c2feba16f6374954c191fb5edb

commit ca0694adf6d128c2feba16f6374954c191fb5edb
Author: Alan Modra <amodra@gmail.com>
Date:   Wed Dec 24 22:07:42 2014 +1030

    Don't create .eh_frame_hdr on shared lib bfd
    
    If no object files have .eh_frame, but some shared library does, then
    ld creates a .eh_frame_hdr section using the shared library bfd.  This
    is silly since shared library .eh_frame sections don't contribute to
    the output .eh_frame and thus no .eh_frame_hdr is needed.
    
    Also, the bfd section list and count is cleared for shared libraries,
    and a zero section count used as a flag in lang_check to omit a call
    to bfd_merge_private_bfd_data for shared libraries.  If we create a
    section on a shared lib bfd then ld will wrongly attempt to merge the
    shared library private bfd data.
    
    	PR 17742
    	* ld/emultempl/elf32.em (gld${EMULATION_NAME}_after_open): Exclude
    	shared libraries in loop looking for .eh_frame sections.
    	Similarly for build-id loop.

-----------------------------------------------------------------------

Summary of changes:
 ld/ChangeLog          |    6 ++++++
 ld/emultempl/elf32.em |    5 ++++-
 2 files changed, 10 insertions(+), 1 deletions(-)
Comment 5 Sourceware Commits 2015-02-11 12:52:07 UTC
The binutils-2_25-branch branch has been updated by Alan Modra <amodra@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e5edeec54c859d3e072fc324ff39fcaf185754fb

commit e5edeec54c859d3e072fc324ff39fcaf185754fb
Author: Alan Modra <amodra@gmail.com>
Date:   Wed Dec 24 22:07:42 2014 +1030

    Don't create .eh_frame_hdr on shared lib bfd
    
    If no object files have .eh_frame, but some shared library does, then
    ld creates a .eh_frame_hdr section using the shared library bfd.  This
    is silly since shared library .eh_frame sections don't contribute to
    the output .eh_frame and thus no .eh_frame_hdr is needed.
    
    Also, the bfd section list and count is cleared for shared libraries,
    and a zero section count used as a flag in lang_check to omit a call
    to bfd_merge_private_bfd_data for shared libraries.  If we create a
    section on a shared lib bfd then ld will wrongly attempt to merge the
    shared library private bfd data.
    
    	PR 17742
    	* ld/emultempl/elf32.em (gld${EMULATION_NAME}_after_open): Exclude
    	shared libraries in loop looking for .eh_frame sections.
    	Similarly for build-id loop.
Comment 6 Alan Modra 2015-02-11 13:02:35 UTC
fixed