2010-04-15 Andrew Haley <aph@redhat.com>
authorAndrew Haley <aph@redhat.com>
Wed, 21 Apr 2010 16:32:31 +0000 (16:32 +0000)
committerAndrew Haley <aph@redhat.com>
Wed, 21 Apr 2010 16:32:31 +0000 (16:32 +0000)
* emultempl/armelf.em (merge_exidx_entries): New variable.
(OPTION_NO_MERGE_EXIDX_ENTRIES): New definition.
("no-merge-exidx-entries"): New option.
* ld.texinfo (merge-exidx-entries): Document this option.

2010-04-15  Andrew Haley  <aph@redhat.com>

* bfd-in.h (elf32_arm_fix_exidx_coverage): Add new flag:
merge_exidx_entries.
* bfd-in2.h: Likewise.
* elf32-arm.c (elf32_arm_fix_exidx_coverage): Likewise.  Use it to
control merging of exidx entries.

2010-04-15  Andrew Haley  <aph@redhat.com>

* options.h (merge_exidx_entries): New option.
* arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
(class Arm_exidx_fixup::merge_exidx_entries_): New member.
(Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
(Target_arm::merge_exidx_entries): New function.
(process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
(Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
to Arm_exidx_fixup constructor.
Add new arg, merge_exidx_entries.
(Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
Arm_output_section::fix_exidx_coverage.

bfd/ChangeLog
bfd/bfd-in.h
bfd/bfd-in2.h
bfd/elf32-arm.c
gold/ChangeLog
gold/arm.cc
gold/options.h
ld/ChangeLog
ld/emultempl/armelf.em
ld/ld.texinfo

index 7c1aa05587b6acf089431f72b496403b7d527abe..5cd828953f88353ff9344fd2b573afc25e292d89 100644 (file)
@@ -1,3 +1,11 @@
+2010-04-15  Andrew Haley  <aph@redhat.com>
+
+       * bfd-in.h (elf32_arm_fix_exidx_coverage): Add new flag:
+       merge_exidx_entries.
+       * bfd-in2.h: Likewise.
+       * elf32-arm.c (elf32_arm_fix_exidx_coverage): Likewise.  Use it to
+       control merging of exidx entries.
+       
 2010-04-20  Joseph Myers  <joseph@codesourcery.com>
 
        * elf32-tic6x.h: New.
index 07f2fae849eb7dc9999cf2060c0d759f88244441..cfa5225325bf308dc2a949b93327a9397007f31d 100644 (file)
@@ -906,7 +906,7 @@ extern bfd_boolean elf32_arm_build_stubs
 
 /* ARM unwind section editing support.  */
 extern bfd_boolean elf32_arm_fix_exidx_coverage
-  (struct bfd_section **, unsigned int, struct bfd_link_info *);
+(struct bfd_section **, unsigned int, struct bfd_link_info *, bfd_boolean);
 
 /* PowerPC @tls opcode transform/validate.  */
 extern unsigned int _bfd_elf_ppc_at_tls_transform
index 9cf4f643449f405e893e155196236be38c948025..a3f8ccc9f174857137d3ac0a9e65c91090e6afaa 100644 (file)
@@ -913,7 +913,7 @@ extern bfd_boolean elf32_arm_build_stubs
 
 /* ARM unwind section editing support.  */
 extern bfd_boolean elf32_arm_fix_exidx_coverage
-  (struct bfd_section **, unsigned int, struct bfd_link_info *);
+  (struct bfd_section **, unsigned int, struct bfd_link_info *, bfd_boolean);
 
 /* PowerPC @tls opcode transform/validate.  */
 extern unsigned int _bfd_elf_ppc_at_tls_transform
index 2ebbb791bae36acec427b8a2ad1d818dbd4825b5..2c24bddc102c797e1aded16dcc981633462e282d 100644 (file)
@@ -9215,6 +9215,8 @@ insert_cantunwind_after(asection *text_sec, asection *exidx_sec)
      2. Duplicate entries are merged together (EXIDX_CANTUNWIND, or unwind
         codes which have been inlined into the index).
 
+   If MERGE_EXIDX_ENTRIES is false, duplicate entries are not merged.
+
    The edits are applied when the tables are written
    (in elf32_arm_write_section).
 */
@@ -9222,7 +9224,8 @@ insert_cantunwind_after(asection *text_sec, asection *exidx_sec)
 bfd_boolean
 elf32_arm_fix_exidx_coverage (asection **text_section_order,
                              unsigned int num_text_sections,
-                             struct bfd_link_info *info)
+                             struct bfd_link_info *info,
+                             bfd_boolean merge_exidx_entries)
 {
   bfd *inp;
   unsigned int last_second_word = 0, i;
@@ -9334,7 +9337,8 @@ elf32_arm_fix_exidx_coverage (asection **text_section_order,
          /* Inlined unwinding data.  Merge if equal to previous.  */
          else if ((second_word & 0x80000000) != 0)
            {
-             if (last_second_word == second_word && last_unwind_type == 1)
+             if (merge_exidx_entries
+                  && last_second_word == second_word && last_unwind_type == 1)
                elide = 1;
              unwind_type = 1;
              last_second_word = second_word;
index 1045328c5746bd1d23a3a7ceaecaa8c7e6223f6c..c4f934f352f3cfe5794d0fe5d1828f29a1a0f6b6 100644 (file)
@@ -1,3 +1,17 @@
+2010-04-15  Andrew Haley  <aph@redhat.com>
+
+       * options.h (merge_exidx_entries): New option.
+       * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
+       (class Arm_exidx_fixup::merge_exidx_entries_): New member.
+       (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
+       (Target_arm::merge_exidx_entries): New function.
+       (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
+       (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
+       to Arm_exidx_fixup constructor.
+       Add new arg, merge_exidx_entries.
+       (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
+       Arm_output_section::fix_exidx_coverage.
+
 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
 
        * icf.cc (get_section_contents): Check for preemptible functions.
index 028069bdc71f95833b82f264fa2d2fb9bf2bb215..11a0734625e42aaaa8371b618aa6f377433fb990 100644 (file)
@@ -1226,10 +1226,12 @@ class Arm_input_section : public Output_relaxed_input_section
 class Arm_exidx_fixup
 {
  public:
-  Arm_exidx_fixup(Output_section* exidx_output_section)
+  Arm_exidx_fixup(Output_section* exidx_output_section,
+                 bool merge_exidx_entries = true)
     : exidx_output_section_(exidx_output_section), last_unwind_type_(UT_NONE),
       last_inlined_entry_(0), last_input_section_(NULL),
-      section_offset_map_(NULL), first_output_text_section_(NULL)
+      section_offset_map_(NULL), first_output_text_section_(NULL),
+      merge_exidx_entries_(merge_exidx_entries)
   { }
 
   ~Arm_exidx_fixup()
@@ -1301,6 +1303,8 @@ class Arm_exidx_fixup
   // Output section for the text section which is linked to the first exidx
   // input in output.
   Output_section* first_output_text_section_;
+
+  bool merge_exidx_entries_;
 };
 
 // Arm output section class.  This is defined mainly to add a number of
@@ -1340,7 +1344,8 @@ class Arm_output_section : public Output_section
   void
   fix_exidx_coverage(Layout* layout,
                     const Text_section_list& sorted_text_section,
-                    Symbol_table* symtab);
+                    Symbol_table* symtab,
+                    bool merge_exidx_entries);
 
  private:
   // For convenience.
@@ -2261,6 +2266,11 @@ class Target_arm : public Sized_target<32, big_endian>
   fix_cortex_a8() const
   { return this->fix_cortex_a8_; }
 
+  // Whether we merge exidx entries in debuginfo.
+  bool
+  merge_exidx_entries() const
+  { return parameters->options().merge_exidx_entries(); }
+
   // Whether we fix R_ARM_V4BX relocation.
   // 0 - do not fix
   // 1 - replace with MOV instruction (armv4 target)
@@ -5186,7 +5196,8 @@ Arm_exidx_fixup::process_exidx_entry(uint32_t second_word)
   else if ((second_word & 0x80000000) != 0)
     {
       // Inlined unwinding data.  Merge if equal to previous.
-      delete_entry = (this->last_unwind_type_ == UT_INLINED_ENTRY
+      delete_entry = (merge_exidx_entries_
+                     && this->last_unwind_type_ == UT_INLINED_ENTRY
                      && this->last_inlined_entry_ == second_word);
       this->last_unwind_type_ = UT_INLINED_ENTRY;
       this->last_inlined_entry_ = second_word;
@@ -5553,7 +5564,8 @@ void
 Arm_output_section<big_endian>::fix_exidx_coverage(
     Layout* layout,
     const Text_section_list& sorted_text_sections,
-    Symbol_table* symtab)
+    Symbol_table* symtab,
+    bool merge_exidx_entries)
 {
   // We should only do this for the EXIDX output section.
   gold_assert(this->type() == elfcpp::SHT_ARM_EXIDX);
@@ -5585,7 +5597,7 @@ Arm_output_section<big_endian>::fix_exidx_coverage(
       known_input_sections.insert(Section_id(p->relobj(), p->shndx()));
     }
 
-  Arm_exidx_fixup exidx_fixup(this);
+  Arm_exidx_fixup exidx_fixup(this, merge_exidx_entries);
 
   // Go over the sorted text sections.
   Section_id_set processed_input_sections;
@@ -10884,7 +10896,8 @@ Target_arm<big_endian>::fix_exidx_coverage(
       arm_output_section->append_text_sections_to_list(&sorted_text_sections);
     } 
 
-  exidx_section->fix_exidx_coverage(layout, sorted_text_sections, symtab);
+  exidx_section->fix_exidx_coverage(layout, sorted_text_sections, symtab,
+                                   merge_exidx_entries());
 }
 
 Target_selector_arm<false> target_selector_arm;
index 049a7eeca7c009938b76d9fd785ff95ab6873602..ca5f74d9c84563a063c15a8260d5ae4790ecc8d8 100644 (file)
@@ -733,6 +733,10 @@ class General_options
              N_("(ARM only) Fix binaries for Cortex-A8 erratum."),
              N_("(ARM only) Do not fix binaries for Cortex-A8 erratum."));
 
+  DEFINE_bool(merge_exidx_entries, options::TWO_DASHES, '\0', true,
+             N_("(ARM only) Merge exidx entries in debuginfo."),
+             N_("(ARM only) Do not merge exidx entries in debuginfo."));
+
   DEFINE_special(fix_v4bx, options::TWO_DASHES, '\0',
                  N_("(ARM only) Rewrite BX rn as MOV pc, rn for ARMv4"),
                  NULL);
index 4268690d3237da2aff1ea27c44f04ff383411449..e0745e5571bcfd21c74c5e955c1c28d6591a9cf0 100644 (file)
@@ -1,3 +1,10 @@
+2010-04-15  Andrew Haley  <aph@redhat.com>
+
+       * emultempl/armelf.em (merge_exidx_entries): New variable.
+       (OPTION_NO_MERGE_EXIDX_ENTRIES): New definition.
+       ("no-merge-exidx-entries"): New option.
+       * ld.texinfo (merge-exidx-entries): Document this option.
+
 2010-04-14  Tristan Gingold  <gingold@adacore.com>
 
        * emulparams/alphavms.sh: New file.
index 4783bf89d001749fedf735a33986de55ab5507b5..6c4c78d504782bfd8779c7442f47b062fcd808e5 100644 (file)
@@ -41,6 +41,7 @@ static int fix_cortex_a8 = -1;
 static int no_enum_size_warning = 0;
 static int no_wchar_size_warning = 0;
 static int pic_veneer = 0;
+static int merge_exidx_entries = -1;
 
 static void
 gld${EMULATION_NAME}_before_parse (void)
@@ -314,7 +315,8 @@ gld${EMULATION_NAME}_after_allocation (void)
        
       qsort (sec_list, sec_count, sizeof (asection *), &compare_output_sec_vma);
       
-      if (elf32_arm_fix_exidx_coverage (sec_list, sec_count, &link_info))
+      if (elf32_arm_fix_exidx_coverage (sec_list, sec_count, &link_info,
+                                          merge_exidx_entries))
        need_laying_out = 1;
       
       free (sec_list);
@@ -526,6 +528,7 @@ PARSE_AND_LIST_PROLOGUE='
 #define OPTION_NO_WCHAR_SIZE_WARNING   313
 #define OPTION_FIX_CORTEX_A8           314
 #define OPTION_NO_FIX_CORTEX_A8                315
+#define OPTION_NO_MERGE_EXIDX_ENTRIES   316
 '
 
 PARSE_AND_LIST_SHORTOPTS=p
@@ -547,6 +550,7 @@ PARSE_AND_LIST_LONGOPTS='
   { "no-wchar-size-warning", no_argument, NULL, OPTION_NO_WCHAR_SIZE_WARNING},
   { "fix-cortex-a8", no_argument, NULL, OPTION_FIX_CORTEX_A8 },
   { "no-fix-cortex-a8", no_argument, NULL, OPTION_NO_FIX_CORTEX_A8 },
+  { "no-merge-exidx-entries", no_argument, NULL, OPTION_NO_MERGE_EXIDX_ENTRIES },
 '
 
 PARSE_AND_LIST_OPTIONS='
@@ -574,6 +578,8 @@ PARSE_AND_LIST_OPTIONS='
                            the linker should choose suitable defaults.\n"
                   ));
   fprintf (file, _("  --[no-]fix-cortex-a8        Disable/enable Cortex-A8 Thumb-2 branch erratum fix\n"));
+  fprintf (file, _("  --no-merge-exidx-entries    Disable merging exidx entries\n"));
 '
 
 PARSE_AND_LIST_ARGS_CASES='
@@ -653,6 +659,10 @@ PARSE_AND_LIST_ARGS_CASES='
     case OPTION_NO_FIX_CORTEX_A8:
       fix_cortex_a8 = 0;
       break;
+
+   case OPTION_NO_MERGE_EXIDX_ENTRIES:
+      merge_exidx_entries = 0;
+
 '
 
 # We have our own before_allocation etc. functions, but they call
index 6bcc6ff6340a8a0b783ab5c947bfe0cb4dfd9a26..65327423809d8a198827fa89c5bfe666b4c5b399 100644 (file)
@@ -5939,6 +5939,10 @@ The @samp{--fix-cortex-a8} switch enables a link-time workaround for an erratum
 
 The erratum only affects Thumb-2 code.  Please contact ARM for further details.
 
+@kindex --merge-exidx-entries
+@kindex --no-merge-exidx-entries
+The @samp{--no-merge-exidx-entries} switch disables the merging of adjacent exidx entries in debuginfo.
+
 @ifclear GENERIC
 @lowersections
 @end ifclear