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-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.
This commit is contained in:
Andrew Haley 2010-04-21 16:32:31 +00:00
parent a8ae7dc0fb
commit 85fdf9067f
10 changed files with 76 additions and 12 deletions

View 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.

View 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

View 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

View 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;

View 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.

View 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;

View 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);

View 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.

View 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

View 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