Bug 4454 - [regression] ld errors: no .eh_frame_hdr table will be created.
Summary: [regression] ld errors: no .eh_frame_hdr table will be created.
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: 2.18
: P2 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-05-02 21:38 UTC by Matthias Klose
Modified: 2007-05-10 23:56 UTC (History)
3 users (show)

See Also:
Host:
Target: hppa-linux-gnu
Build:
Last reconfirmed:


Attachments
handle local syms (764 bytes, patch)
2007-05-05 22:50 UTC, Alan Modra
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Klose 2007-05-02 21:38:03 UTC
building the gcc-4.2.0 RC2 with binutils_20070426 on Debian unstable, some
hundred  testcases fail like:

PASS: g++.dg/other/classkey1.C (test for excess errors)
Executing on host:
/scratch/packages/gcc/4.2/gcc-4.2-4.2-20070502/build/gcc/testsuite/g++/../../g++
-B/s
cratch/packages/gcc/4.2/gcc-4.2-4.2-20070502/build/gcc/testsuite/g++/../../
/scratch/packages/gcc/4.2/gc
c-4.2-4.2-20070502/src/gcc/testsuite/g++.dg/other/complex1.C  -nostdinc++
-I/scratch/packages/gcc/4.2/gc
c-4.2-4.2-20070502/build/hppa-linux-gnu/libstdc++-v3/include/hppa-linux-gnu
-I/scratch/packages/gcc/4.2/
gcc-4.2-4.2-20070502/build/hppa-linux-gnu/libstdc++-v3/include
-I/scratch/packages/gcc/4.2/gcc-4.2-4.2-2
0070502/src/libstdc++-v3/libsupc++
-I/scratch/packages/gcc/4.2/gcc-4.2-4.2-20070502/src/libstdc++-v3/inc
lude/backward
-I/scratch/packages/gcc/4.2/gcc-4.2-4.2-20070502/src/libstdc++-v3/testsuite/util
-fmessage
-length=0     
-L/scratch/packages/gcc/4.2/gcc-4.2-4.2-20070502/build/hppa-linux-gnu/./libstdc++-v3/src/
.libs 
-L/scratch/packages/gcc/4.2/gcc-4.2-4.2-20070502/build/hppa-linux-gnu/./libstdc++-v3/src/.libs
-L
/scratch/packages/gcc/4.2/gcc-4.2-4.2-20070502/build/hppa-linux-gnu/./libiberty
 -lm   -o ./complex1.exe
    (timeout = 600)
/usr/bin/ld: error in /tmp/cci9XkZD.o(.eh_frame); no .eh_frame_hdr table will be
created.
output is:
/usr/bin/ld: error in /tmp/cci9XkZD.o(.eh_frame); no .eh_frame_hdr table will be
created.

FAIL: g++.dg/other/complex1.C (test for excess errors)
Excess errors:
/usr/bin/ld: error in /tmp/cci9XkZD.o(.eh_frame); no .eh_frame_hdr table will be
created.
Comment 1 dave@hiauly1.hia.nrc.ca 2007-05-02 22:32:55 UTC
Subject: Re:  New: [regression] ld errors: no .eh_frame_hdr table will be created.

> building the gcc-4.2.0 RC2 with binutils_20070426 on Debian unstable, some
> hundred  testcases fail like:

2.17.50 20070116 is ok.  Do you have a build using a more
recent binutils that was ok?  

Dave
Comment 2 Matthias Klose 2007-05-02 22:36:33 UTC
checking with a 20070210 build, starting the build now; will have results
tomorrow; I didn't build newer snapshots on hppa.
Comment 3 dave@hiauly1.hia.nrc.ca 2007-05-02 23:42:34 UTC
Subject: Re:  New: [regression] ld errors: no .eh_frame_hdr table will be created.

> > building the gcc-4.2.0 RC2 with binutils_20070426 on Debian unstable, some
> > hundred  testcases fail like:

I think this was introduced by the following change:

2007-04-24  Alan Modra  <amodra@bigpond.net.au>

        * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Warn if
	eh_frame_hdr table won't be created.

We use an indirect pc-relative encoding for global and code symbols.
This is somewhat unusual and possibly the cause of the problem.  The
goal here was to get rid of all dynamic relocations.

Dave
Comment 4 Alan Modra 2007-05-02 23:48:13 UTC
The patch merely warns about a problem that existed before.  It's a real problem
too.  C++ exception handling will be slow for you if you have .eh_frame_hdr
without the lookup table.
Comment 5 dave@hiauly1.hia.nrc.ca 2007-05-03 02:43:02 UTC
Subject: Re:  [regression] ld errors: no .eh_frame_hdr table will be created.

> ------- Additional Comments From amodra at bigpond dot net dot au  2007-05-02 23:48 -------
> The patch merely warns about a problem that existed before.  It's a real problem
> too.  C++ exception handling will be slow for you if you have .eh_frame_hdr
> without the lookup table.

I don't think anything more can be done at the gcc end.  The most likely
problem is _bfd_elf_discard_section_eh_frame can't cope with the indirect
pc-relative encoding that we use for the personality function.

Dave
Comment 6 dave@hiauly1.hia.nrc.ca 2007-05-03 03:51:27 UTC
Subject: Re:  [regression] ld errors: no .eh_frame_hdr table will be created.

> I don't think anything more can be done at the gcc end.  The most likely
> problem is _bfd_elf_discard_section_eh_frame can't cope with the indirect
> pc-relative encoding that we use for the personality function.

I see a problem is here:

                      /* Ensure we have a reloc here, against
			 a global symbol.  */

In our case, the reloc is against a local symbol.  So, cie->personality
doesn't get set and REQUIRE (cie->personality) fails.

Dave
Comment 7 Alan Modra 2007-05-03 07:55:45 UTC
If that is the only problem, it's easily fixed.  cie->personality is only used
when checking that two CIEs are equivalent.  Since we are fairly late in the
link process here, you could use a bfd_vma set to the final symbol value instead
of a struct elf_link_hash_entry * for cie->personality.  That ought to work for
local syms as well as global.
Comment 8 Alan Modra 2007-05-05 22:50:36 UTC
Created attachment 1754 [details]
handle local syms
Comment 9 dave@hiauly1.hia.nrc.ca 2007-05-08 03:51:44 UTC
Subject: Re:  [regression] ld errors: no .eh_frame_hdr table will be created.

> ------- Additional Comments From amodra at bigpond dot net dot au  2007-05-05 22:50 -------
> Created an attachment (id=1754)
>  --> (http://sourceware.org/bugzilla/attachment.cgi?id=1754&action=view)
> handle local syms

This works for me.  The ld testsuite is clean and I don't see any
problems in gcc builds and checks using it on hppa-unknown-linux-gnu.

Thanks,
Dave
Comment 10 Daniel Jacobowitz 2007-05-10 15:19:12 UTC
FYI, this appears to fix m68k-elf too.  The problem only shows up if you rebuild
libstdc++; in eh_personality.o ".long __gxx_personality_v0" becomes a relocation
against the section .text.__gxx_personality_v0 after assembly.

I'm not sure gas is correct in making that transformation for a locally defined
global symbol, but there you have it.
Comment 12 Alan Modra 2007-05-10 16:44:24 UTC
Hmm.  I'll bet hppa is doing the same as m68k-elf.  Looks like both have buggy
tc_fix_adjustable implementations.  Reducing relocs against globals to relocs
against section syms can break ELF shared libraries, since you must be able to
override a function or variable in the library with one in the executable or
another shared lib.  What's more, there is no point in reducing to a section sym
because you're going to output a global sym anyway.
Comment 13 Andreas Schwab 2007-05-10 17:18:53 UTC
From tc-m68k.h:
/* Target *-*-elf implies an embedded target.  No shared libs.
   *-*-uclinux also requires special casing to prevent GAS from
   generating unsupported R_68K_PC16 relocs.  */
#define EXTERN_FORCE_RELOC \
  ((strcmp (TARGET_OS, "elf") != 0) && (strcmp (TARGET_OS, "uclinux") != 0))
Comment 14 Alan Modra 2007-05-11 00:56:52 UTC
I guess I shouldn't comment late at night.  I'd forgotten about
EXTERN_FORCE_RELOC and the S_FORCE_RELOC check in adjust_reloc_syms.  ie. the
hppa-linux tc_fix_adjustable is fine.