Bug 6658 - gold SEGVs when linking, apparently due to a .eh_frame section
Summary: gold SEGVs when linking, apparently due to a .eh_frame section
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: gold (show other bugs)
Version: 2.19
: P2 normal
Target Milestone: ---
Assignee: Ian Lance Taylor
URL:
Keywords:
Depends on:
Blocks: 19567
  Show dependency treegraph
 
Reported: 2008-06-19 20:09 UTC by Christopher Faylor
Modified: 2016-02-04 16:26 UTC (History)
1 user (show)

See Also:
Host: x86_64-rhel5-linux
Target: x86_64-unknown-freebsd6.0
Build: x86_64-rhel5-linux
Last reconfirmed:


Attachments
Removing .eh_frame from this object allows the build to complete (993 bytes, application/octet-stream)
2008-06-19 20:10 UTC, Christopher Faylor
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Christopher Faylor 2008-06-19 20:09:04 UTC
I just had gold segv when trying to link a freebsd shared library.

Through trial or error, I tracked the problem down to the .eh_frame
section in crtbeginS.o.  If I remove that frame it works.  If I add a
--eh-frame-header option to the gold command line, it fails an
assertion: agold_assert(found) at line 948 in
gold::Merged_symbol_value<64>::value_from_output_section .

I can work around this by removing the .eh_frame section for now but I
thought you'd like to know about this.

(Although I realize you probably won't be able to do anything since your
at the gcc symposium)


The segv is here:

#0  0x0000000000581100 in
gold::Eh_frame_hdr::found_unrecognized_eh_frame_section (this=0x0) at
../../gold/ehframe.h:60
60        { this->any_unrecognized_eh_frame_sections_ = true; }

#1  0x000000000058ce67 in gold::Eh_frame::add_ehframe_input_section<64, false>
(this=0xbadf6e0, object=0xbb0bf40, symbols=0x2b3a2c9b6568 "", symbols_size=384,
symbol_names=0x2b3a2c9b66e8 "", symbol_names_size=86, shndx=7,
    reloc_shndx=8, reloc_type=4) at ../../gold/ehframe.cc:560
#2  0x0000000000474f62 in gold::Layout::layout_eh_frame<64, false>
(this=0x7fff7e0facf0, object=0xbb0bf40, symbols=0x2b3a2c9b6568 "",
symbols_size=384, symbol_names=0x2b3a2c9b66e8 "", symbol_names_size=86, shndx=7,
    shdr=@0x7fff7e0f8100, reloc_shndx=8, reloc_type=4, off=0x7fff7e0f80f8) at
../../gold/layout.cc:650
#3  0x0000000000498e03 in gold::Sized_relobj<64, false>::do_layout
(this=0xbb0bf40, symtab=0x7fff7e0fafb0, layout=0x7fff7e0facf0, sd=0xbb0c130) at
../../gold/object.cc:1030
#4  0x00000000004e4cf2 in gold::Object::layout (this=0xbb0bf40,
symtab=0x7fff7e0fafb0, layout=0x7fff7e0facf0, sd=0xbb0c130) at
../../gold/object.h:339
#5  0x00000000004e41f6 in gold::Add_symbols::run (this=0xbae0600) at
../../gold/readsyms.cc:367
#6  0x000000000054c18a in gold::Workqueue::find_and_run_task
(this=0x7fff7e0fb220, thread_number=0) at ../../gold/workqueue.cc:314
#7  0x000000000054c313 in gold::Workqueue::process (this=0x7fff7e0fb220,
thread_number=0) at ../../gold/workqueue.cc:480
#8  0x00000000004041d9 in main (argc=13, argv=0x7fff7e0fb458) at
../../gold/main.cc:218

The stack trace from the assert is:

#0  gold::Merged_symbol_value<64>::value_from_output_section (this=0x1ef885f0,
object=0x1ef33070, input_shndx=10, input_offset=0) at ../../gold/reloc.cc:948
#1  0x0000000000428f32 in gold::Merged_symbol_value<64>::value (this=0x1ef885f0,
object=0x1ef33070, input_shndx=10, addend=0) at ../../gold/object.h:900
#2  0x0000000000428fbf in gold::Symbol_value<64>::value<false> (this=0x1ef333f0,
object=0x1ef33070, addend=0) at ../../gold/object.h:949
#3  0x00000000004d26a7 in gold::Output_reloc<9, true, 64, false>::symbol_value
(this=0x1ef649a0, addend=0) at ../../gold/output.cc:924
#4  0x00000000004d2702 in gold::Output_reloc<4, true, 64, false>::write
(this=0x1ef649a0, pov=0x2b90c2f6d750 "(0") at ../../gold/output.cc:989
#5  0x00000000004d27f1 in gold::Output_data_reloc_base<4, true, 64,
false>::do_write (this=0x1ef609e0, of=0x1ef44cb0) at ../../gold/output.cc:1039
#6  0x000000000046b4e2 in gold::Output_data::write (this=0x1ef609e0,
file=0x1ef44cb0) at ../../gold/output.h:206
#7  0x00000000004ae738 in gold::Output_section::Input_section::write
(this=0x1ef60b80, of=0x1ef44cb0) at ../../gold/output.cc:1691
#8  0x00000000004b0dfa in gold::Output_section::do_write (this=0x1ef60aa0,
of=0x1ef44cb0) at ../../gold/output.cc:2424
#9  0x000000000046b4e2 in gold::Output_data::write (this=0x1ef60aa0,
file=0x1ef44cb0) at ../../gold/output.h:206
#10 0x0000000000463c5c in gold::Layout::write_output_sections
(this=0x7fffe7b4d740, of=0x1ef44cb0) at ../../gold/layout.cc:2978
#11 0x0000000000463cb1 in gold::Write_sections_task::run (this=0x1ef63d40) at
../../gold/layout.cc:3207
#12 0x000000000054c18a in gold::Workqueue::find_and_run_task
(this=0x7fffe7b4dc70, thread_number=0) at ../../gold/workqueue.cc:314
#13 0x000000000054c313 in gold::Workqueue::process (this=0x7fffe7b4dc70,
thread_number=0) at ../../gold/workqueue.cc:480
#14 0x00000000004041d9 in main (argc=14, argv=0x7fffe7b4dea8) at
../../gold/main.cc:218

objdump -h from crtbeginS.o:

Sections:
Idx Name          Size      VMA               LMA               File off  Algn
  0 .text         000000a4  0000000000000000  0000000000000000  00000040  2**4
                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
  1 .data         00000000  0000000000000000  0000000000000000  000000e4  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  2 .bss          00000050  0000000000000000  0000000000000000  00000100  2**5
                  ALLOC
  3 .ctors        00000008  0000000000000000  0000000000000000  00000100  2**3
                  CONTENTS, ALLOC, LOAD, DATA
  4 .dtors        00000008  0000000000000000  0000000000000000  00000108  2**3
                  CONTENTS, ALLOC, LOAD, DATA
  5 .eh_frame     00000058  0000000000000000  0000000000000000  00000110  2**3
                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
  6 .jcr          00000000  0000000000000000  0000000000000000  00000168  2**3
                  CONTENTS, ALLOC, LOAD, DATA
  7 .data.rel     00000008  0000000000000000  0000000000000000  00000168  2**3
                  CONTENTS, ALLOC, LOAD, RELOC, DATA
  8 .data.rel.local 00000008  0000000000000000  0000000000000000  00000170  2**3
                  CONTENTS, ALLOC, LOAD, RELOC, DATA
  9 .fini         00000005  0000000000000000  0000000000000000  00000178  2**0
                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
 10 .init         00000005  0000000000000000  0000000000000000  0000017d  2**0
                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
 11 .comment      00000023  0000000000000000  0000000000000000  00000182  2**0
                  CONTENTS, READONLY
Comment 1 Christopher Faylor 2008-06-19 20:10:00 UTC
Created attachment 2787 [details]
Removing .eh_frame from this object allows the build to complete
Comment 2 Ian Lance Taylor 2008-07-24 01:28:53 UTC
Thanks for the test case.  I think the object file may be malformed.  However, I
just committed a patch which should handle it.