summaryrefslogtreecommitdiff
path: root/gold/layout.cc
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>2008-04-09 00:26:48 +0000
committerIan Lance Taylor <ian@airs.com>2008-04-09 00:26:48 +0000
commit2c38906f72b07a9e3b8386d9de8a61b33db04d99 (patch)
tree2a6adbbd5b22a4cc9eeffb02b04d65b4c3e066b1 /gold/layout.cc
parentc9825dba58c3e58303a5a09d368275dd220b7c48 (diff)
downloadbinutils-gdb-2c38906f72b07a9e3b8386d9de8a61b33db04d99.tar.gz
* layout.h (class Layout): Add added_eh_frame_data_ field.
* layout.cc (Layout::Layout): Initialize new field. (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame output section until we find a section we merged successfully. * object.cc (Sized_relobj::check_eh_frame_flags): Don't require that the size be non-zero.
Diffstat (limited to 'gold/layout.cc')
-rw-r--r--gold/layout.cc18
1 files changed, 15 insertions, 3 deletions
diff --git a/gold/layout.cc b/gold/layout.cc
index e8582ca7a9a..efeaf659a4d 100644
--- a/gold/layout.cc
+++ b/gold/layout.cc
@@ -82,7 +82,8 @@ Layout::Layout(const General_options& options, Script_options* script_options)
unattached_section_list_(), special_output_list_(),
section_headers_(NULL), tls_segment_(NULL), symtab_section_(NULL),
dynsym_section_(NULL), dynamic_section_(NULL), dynamic_data_(NULL),
- eh_frame_section_(NULL), eh_frame_data_(NULL), eh_frame_hdr_section_(NULL),
+ eh_frame_section_(NULL), eh_frame_data_(NULL),
+ added_eh_frame_data_(false), eh_frame_hdr_section_(NULL),
build_id_note_(NULL), group_signatures_(), output_file_size_(-1),
input_requires_executable_stack_(false),
input_with_gnu_stack_note_(false),
@@ -563,7 +564,6 @@ Layout::layout_eh_frame(Sized_relobj<size, big_endian>* object,
{
this->eh_frame_section_ = os;
this->eh_frame_data_ = new Eh_frame();
- os->add_output_section_data(this->eh_frame_data_);
if (this->options_.eh_frame_hdr())
{
@@ -605,7 +605,19 @@ Layout::layout_eh_frame(Sized_relobj<size, big_endian>* object,
shndx,
reloc_shndx,
reloc_type))
- *off = -1;
+ {
+ // We found a .eh_frame section we are going to optimize, so now
+ // we can add the set of optimized sections to the output
+ // section. We need to postpone adding this until we've found a
+ // section we can optimize so that the .eh_frame section in
+ // crtbegin.o winds up at the start of the output section.
+ if (!this->added_eh_frame_data_)
+ {
+ os->add_output_section_data(this->eh_frame_data_);
+ this->added_eh_frame_data_ = true;
+ }
+ *off = -1;
+ }
else
{
// We couldn't handle this .eh_frame section for some reason.