[PATCH][GOLD] Add __exidx_start and __exidx_end symbols.
Doug Kwan (關振德)
dougkwan@google.com
Thu Dec 3 22:48:00 GMT 2009
I am sorry I kept sending wrong patches. This is the correct one.
-Doug
2009/12/2 Doug Kwan (關振德) <dougkwan@google.com>:
> Sorry. Here is the correct one.
>
> -Doug
>
> 2009/12/1 Ian Lance Taylor <iant@google.com>:
>> "Doug Kwan (關振德)" <dougkwan@google.com> writes:
>>
>>> This patch add __exidx_start and __exidx_end section symbols for
>>> the .ARM.exidx section.
>>
>> You attached the wrong patch.
>>
>> Ian
>>
>
-------------- next part --------------
Index: gold/arm.cc
===================================================================
RCS file: /cvs/src/src/gold/arm.cc,v
retrieving revision 1.36
diff -u -p -r1.36 arm.cc
--- gold/arm.cc 25 Nov 2009 08:08:45 -0000 1.36
+++ gold/arm.cc 3 Dec 2009 21:47:09 -0000
@@ -123,7 +123,6 @@ const int32_t THM2_MAX_BWD_BRANCH_OFFSET
// TODOs:
// - Generate various branch stubs.
// - Support interworking.
-// - Define section symbols __exidx_start and __exidx_stop.
// - Support more relocation types as needed.
// - Make PLTs more flexible for different architecture features like
// Thumb-2 and BE8.
@@ -1234,7 +1233,7 @@ class Target_arm : public Sized_target<3
// Finalize the sections.
void
- do_finalize_sections(Layout*, const Input_objects*);
+ do_finalize_sections(Layout*, const Input_objects*, Symbol_table*);
// Return the value to use for a dynamic symbol which requires special
// treatment.
@@ -4560,7 +4559,8 @@ template<bool big_endian>
void
Target_arm<big_endian>::do_finalize_sections(
Layout* layout,
- const Input_objects* input_objects)
+ const Input_objects* input_objects,
+ Symbol_table* symtab)
{
// Merge processor-specific flags.
for (Input_objects::Relobj_iterator p = input_objects->relobj_begin();
@@ -4625,16 +4625,25 @@ Target_arm<big_endian>::do_finalize_sect
if (this->copy_relocs_.any_saved_relocs())
this->copy_relocs_.emit(this->rel_dyn_section(layout));
- // For the ARM target, we need to add a PT_ARM_EXIDX segment for
- // the .ARM.exidx section.
- if (!layout->script_options()->saw_phdrs_clause()
- && !parameters->options().relocatable())
+ // Hanlde the .ARM.exidx section.
+ Output_section* exidx_section = layout->find_output_section(".ARM.exidx");
+ if (exidx_section != NULL
+ && exidx_section->type() == elfcpp::SHT_ARM_EXIDX)
{
- Output_section* exidx_section =
- layout->find_output_section(".ARM.exidx");
+ // Create __exidx_start and __exdix_end symbols.
+ symtab->define_in_output_data("__exidx_start", NULL, exidx_section,
+ 0, 0, elfcpp::STT_OBJECT,
+ elfcpp::STB_LOCAL, elfcpp::STV_HIDDEN, 0,
+ false, false);
+ symtab->define_in_output_data("__exidx_end", NULL, exidx_section,
+ 0, 0, elfcpp::STT_OBJECT,
+ elfcpp::STB_LOCAL, elfcpp::STV_HIDDEN, 0,
+ true, false);
- if (exidx_section != NULL
- && exidx_section->type() == elfcpp::SHT_ARM_EXIDX)
+ // For the ARM target, we need to add a PT_ARM_EXIDX segment for
+ // the .ARM.exidx section.
+ if (!layout->script_options()->saw_phdrs_clause()
+ && !parameters->options().relocatable())
{
gold_assert(layout->find_output_segment(elfcpp::PT_ARM_EXIDX, 0, 0)
== NULL);
Index: gold/i386.cc
===================================================================
RCS file: /cvs/src/src/gold/i386.cc,v
retrieving revision 1.100
diff -u -p -r1.100 i386.cc
--- gold/i386.cc 9 Nov 2009 23:07:30 -0000 1.100
+++ gold/i386.cc 3 Dec 2009 21:47:09 -0000
@@ -95,7 +95,7 @@ class Target_i386 : public Target_freebs
// Finalize the sections.
void
- do_finalize_sections(Layout*, const Input_objects*);
+ do_finalize_sections(Layout*, const Input_objects*, Symbol_table*);
// Return the value to use for a dynamic which requires special
// treatment.
@@ -1552,7 +1552,10 @@ Target_i386::scan_relocs(Symbol_table* s
// Finalize the sections.
void
-Target_i386::do_finalize_sections(Layout* layout, const Input_objects*)
+Target_i386::do_finalize_sections(
+ Layout* layout,
+ const Input_objects*,
+ Symbol_table*)
{
// Fill in some more dynamic tags.
Output_data_dynamic* const odyn = layout->dynamic_data();
Index: gold/layout.cc
===================================================================
RCS file: /cvs/src/src/gold/layout.cc,v
retrieving revision 1.145
diff -u -p -r1.145 layout.cc
--- gold/layout.cc 5 Nov 2009 06:24:39 -0000 1.145
+++ gold/layout.cc 3 Dec 2009 21:47:09 -0000
@@ -1533,7 +1533,7 @@ off_t
Layout::finalize(const Input_objects* input_objects, Symbol_table* symtab,
Target* target, const Task* task)
{
- target->finalize_sections(this, input_objects);
+ target->finalize_sections(this, input_objects, symtab);
this->count_local_symbols(task, input_objects);
Index: gold/powerpc.cc
===================================================================
RCS file: /cvs/src/src/gold/powerpc.cc,v
retrieving revision 1.20
diff -u -p -r1.20 powerpc.cc
--- gold/powerpc.cc 4 Nov 2009 16:35:51 -0000 1.20
+++ gold/powerpc.cc 3 Dec 2009 21:47:09 -0000
@@ -92,7 +92,7 @@ class Target_powerpc : public Sized_targ
const unsigned char* plocal_symbols);
// Finalize the sections.
void
- do_finalize_sections(Layout*, const Input_objects*);
+ do_finalize_sections(Layout*, const Input_objects*, Symbol_table*);
// Return the value to use for a dynamic which requires special
// treatment.
@@ -1532,7 +1532,8 @@ template<int size, bool big_endian>
void
Target_powerpc<size, big_endian>::do_finalize_sections(
Layout* layout,
- const Input_objects*)
+ const Input_objects*,
+ Symbol_table*)
{
// Fill in some more dynamic tags.
Output_data_dynamic* const odyn = layout->dynamic_data();
Index: gold/sparc.cc
===================================================================
RCS file: /cvs/src/src/gold/sparc.cc,v
retrieving revision 1.24
diff -u -p -r1.24 sparc.cc
--- gold/sparc.cc 4 Nov 2009 16:35:51 -0000 1.24
+++ gold/sparc.cc 3 Dec 2009 21:47:09 -0000
@@ -94,7 +94,7 @@ class Target_sparc : public Sized_target
const unsigned char* plocal_symbols);
// Finalize the sections.
void
- do_finalize_sections(Layout*, const Input_objects*);
+ do_finalize_sections(Layout*, const Input_objects*, Symbol_table*);
// Return the value to use for a dynamic which requires special
// treatment.
@@ -2319,7 +2319,8 @@ template<int size, bool big_endian>
void
Target_sparc<size, big_endian>::do_finalize_sections(
Layout* layout,
- const Input_objects*)
+ const Input_objects*,
+ Symbol_table*)
{
// Fill in some more dynamic tags.
Output_data_dynamic* const odyn = layout->dynamic_data();
Index: gold/target.h
===================================================================
RCS file: /cvs/src/src/gold/target.h,v
retrieving revision 1.40
diff -u -p -r1.40 target.h
--- gold/target.h 30 Oct 2009 18:49:59 -0000 1.40
+++ gold/target.h 3 Dec 2009 21:47:09 -0000
@@ -194,8 +194,9 @@ class Target
// This is called to tell the target to complete any sections it is
// handling. After this all sections must have their final size.
void
- finalize_sections(Layout* layout, const Input_objects* input_objects)
- { return this->do_finalize_sections(layout, input_objects); }
+ finalize_sections(Layout* layout, const Input_objects* input_objects,
+ Symbol_table* symtab)
+ { return this->do_finalize_sections(layout, input_objects, symtab); }
// Return the value to use for a global symbol which needs a special
// value in the dynamic symbol table. This will only be called if
@@ -336,7 +337,7 @@ class Target
// Virtual function which may be implemented by the child class.
virtual void
- do_finalize_sections(Layout*, const Input_objects*)
+ do_finalize_sections(Layout*, const Input_objects*, Symbol_table*)
{ }
// Virtual function which may be implemented by the child class.
Index: gold/x86_64.cc
===================================================================
RCS file: /cvs/src/src/gold/x86_64.cc,v
retrieving revision 1.93
diff -u -p -r1.93 x86_64.cc
--- gold/x86_64.cc 9 Nov 2009 23:07:30 -0000 1.93
+++ gold/x86_64.cc 3 Dec 2009 21:47:09 -0000
@@ -102,7 +102,7 @@ class Target_x86_64 : public Target_free
// Finalize the sections.
void
- do_finalize_sections(Layout*, const Input_objects*);
+ do_finalize_sections(Layout*, const Input_objects*, Symbol_table*);
// Return the value to use for a dynamic which requires special
// treatment.
@@ -1642,7 +1642,10 @@ Target_x86_64::scan_relocs(Symbol_table*
// Finalize the sections.
void
-Target_x86_64::do_finalize_sections(Layout* layout, const Input_objects*)
+Target_x86_64::do_finalize_sections(
+ Layout* layout,
+ const Input_objects*,
+ Symbol_table*)
{
// Fill in some more dynamic tags.
Output_data_dynamic* const odyn = layout->dynamic_data();
More information about the Binutils
mailing list