[PATCH][GOLD] Add __exidx_start and __exidx_end symbols.
Doug Kwan (關振德)
dougkwan@google.com
Mon Nov 30 06:57:00 GMT 2009
Hi,
This patch add __exidx_start and __exidx_end section symbols for
the .ARM.exidx section.
-Doug
2009-11-30 Doug Kwan <dougkwan@google.com>
* arm.cc: Remove comment about missing .ARM.exidx section symbols.
(Target_arm::do_finalize_sections): Add parameter for symbol table
pointer. Add __exidx_start and __exidx_end symbols as appropriate.
* i386.cc (Target_i386::do_finalize_sections): Add an additional
parameter for symbol table pointer.
* layout.cc (Layout::finalize): Call Target::finalize_sections with
an additional parameter for a pointer to symbol table.
* powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
parameter for a symbol table pointer.
* sparc.cc (Target_sparc::do_finalize_sections): Ditto.
* target.h (Target::finalize_sections, Target::do_finalize_sections):
Ditto.
* x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
parameter for a symbol table pointer.
-------------- next part --------------
? gold/autom4te.cache
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 29 Nov 2009 07:59:35 -0000
@@ -121,8 +121,6 @@ const int32_t THM2_MAX_BWD_BRANCH_OFFSET
// R_ARM_THM_MOVT_PREL
//
// 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
@@ -1435,9 +1433,12 @@ class Target_arm : public Sized_target<3
if (sym->is_undefined() && !parameters->options().shared())
return false;
+ // We need to treat symbols with no type as functions to allow
+ // assembly functions without proper symbol type annotations.
return (!parameters->doing_static_link()
&& (sym->type() == elfcpp::STT_FUNC
- || sym->type() == elfcpp::STT_ARM_TFUNC)
+ || sym->type() == elfcpp::STT_ARM_TFUNC
+ || sym->type() == elfcpp::STT_NOTYPE)
&& (sym->is_from_dynobj()
|| sym->is_undefined()
|| sym->is_preemptible()));
@@ -1476,25 +1477,36 @@ class Target_arm : public Sized_target<3
section_size_type);
// Return whether we want to pass flag NON_PIC_REF for this
- // reloc.
+ // reloc. This means the relocation type accesses a symbol not via
+ // GOT or PLT.
static inline bool
reloc_is_non_pic (unsigned int r_type)
{
switch (r_type)
{
- case elfcpp::R_ARM_REL32:
- case elfcpp::R_ARM_THM_CALL:
+ // These relocation types reference GOT or PLT entries explicitly.
+ case elfcpp::R_ARM_GOT_BREL:
+ case elfcpp::R_ARM_GOT_ABS:
+ case elfcpp::R_ARM_GOT_PREL:
+ case elfcpp::R_ARM_GOT_BREL12:
+ case elfcpp::R_ARM_PLT32_ABS:
+ case elfcpp::R_ARM_TLS_GD32:
+ case elfcpp::R_ARM_TLS_LDM32:
+ case elfcpp::R_ARM_TLS_IE32:
+ case elfcpp::R_ARM_TLS_IE12GP:
+
+ // These relocate types may use PLT entries.
case elfcpp::R_ARM_CALL:
+ case elfcpp::R_ARM_THM_CALL:
case elfcpp::R_ARM_JUMP24:
- case elfcpp::R_ARM_PREL31:
- case elfcpp::R_ARM_THM_ABS5:
- case elfcpp::R_ARM_ABS8:
- case elfcpp::R_ARM_ABS12:
- case elfcpp::R_ARM_ABS16:
- case elfcpp::R_ARM_BASE_ABS:
- return true;
- default:
+ case elfcpp::R_ARM_THM_JUMP24:
+ case elfcpp::R_ARM_THM_JUMP19:
+ case elfcpp::R_ARM_PLT32:
+ case elfcpp::R_ARM_THM_XPC22:
return false;
+
+ default:
+ return true;
}
}
};
@@ -1926,7 +1938,7 @@ class Arm_relocate_functions : public Re
// R_ARM_BASE_ABS: B(S) + A
static inline typename This::Status
base_abs(unsigned char* view,
- Arm_address origin)
+ Arm_address origin)
{
Base::rel32(view, origin);
return STATUS_OKAY;
@@ -1941,13 +1953,13 @@ class Arm_relocate_functions : public Re
return This::STATUS_OKAY;
}
- // R_ARM_GOT_PREL: GOT(S) + A ? P
+ // R_ARM_GOT_PREL: GOT(S) + A - P
static inline typename This::Status
- got_prel(unsigned char* view,
- typename elfcpp::Swap<32, big_endian>::Valtype got_offset,
+ got_prel(unsigned char *view,
+ Arm_address got_entry,
Arm_address address)
{
- Base::rel32(view, got_offset - address);
+ Base::rel32(view, got_entry - address);
return This::STATUS_OKAY;
}
@@ -4382,33 +4394,11 @@ Target_arm<big_endian>::Scan::global(Sym
break;
case elfcpp::R_ARM_JUMP24:
- case elfcpp::R_ARM_THM_CALL:
+ case elfcpp::R_ARM_THM_JUMP24:
case elfcpp::R_ARM_CALL:
- {
- if (Target_arm<big_endian>::Scan::symbol_needs_plt_entry(gsym))
- target->make_plt_entry(symtab, layout, gsym);
- // Make a dynamic relocation if necessary.
- int flags = Symbol::NON_PIC_REF;
- if (gsym->type() == elfcpp::STT_FUNC
- || gsym->type() == elfcpp::STT_ARM_TFUNC)
- flags |= Symbol::FUNCTION_CALL;
- if (gsym->needs_dynamic_reloc(flags))
- {
- if (target->may_need_copy_reloc(gsym))
- {
- target->copy_reloc(symtab, layout, object,
- data_shndx, output_section, gsym,
- reloc);
- }
- else
- {
- check_non_pic(object, r_type);
- Reloc_section* rel_dyn = target->rel_dyn_section(layout);
- rel_dyn->add_global(gsym, r_type, output_section, object,
- data_shndx, reloc.get_r_offset());
- }
- }
- }
+ case elfcpp::R_ARM_THM_CALL:
+ if (Target_arm<big_endian>::Scan::symbol_needs_plt_entry(gsym))
+ target->make_plt_entry(symtab, layout, gsym);
break;
case elfcpp::R_ARM_PLT32:
@@ -4848,7 +4838,7 @@ Target_arm<big_endian>::Relocate::reloca
output_section))
// No thumb bit for this relocation: (S + A)
reloc_status = Arm_relocate_functions::abs32(view, object, psymval,
- false);
+ 0);
break;
case elfcpp::R_ARM_MOVW_ABS_NC:
More information about the Binutils
mailing list