This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] gold: add dynamic symbol support for ARM target.
- From: Ian Lance Taylor <iant at google dot com>
- To: Doug Kwan (éæå) <dougkwan at google dot com>
- Cc: binutils at sourceware dot org
- Date: Fri, 29 May 2009 13:17:43 -0700
- Subject: Re: [PATCH] gold: add dynamic symbol support for ARM target.
- References: <498552560905281848o1ff18919x18db235edcf6ac1a@mail.gmail.com>
"Doug Kwan (éæå)" <dougkwan@google.com> writes:
> 2009-05-28 Doug Kwan <dougkwan@google.com>
>
> * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
> template class.
> (class Target_arm): Update comments.
> (Target_arm::Target_arm): Initialize new data members GOT_,
> PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
> Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
> and Target_arm::rel_dyn_section.
> Declare new_enum Target_arm::Got_type.
> Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
> and DYNBSS_.
> (Target_arm::got_size, Target_arm::plt_section,
> Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
> new methods inside class defintion.
> (Target_arm::got_section): Define new method.
> (Target_arm::rel_dyn_section): Same.
> (Output_data_plt_arm): New template class.
> (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
> (Output_data_plt_arm:do_adjust_output_section): Define new method.
> (Output_data_plt_arm::add_entry): Same.
> (Output_data_plt_arm::first_plt_entry): Define new
> static data member for PLT instruction template.
> (Output_data_plt_arm::plt_entry): Same.
> (Output_data_plt_arm::do_write): Define new method.
> (Target_arm::make_plt_entry): Same.
> (Target_arm::do_finalize_sections): Same.
> (Target_arm::do_dynsym_value): Same.
> +// The first entry in the PLT.
> +template<bool big_endian>
> +const uint32_t Output_data_plt_arm<big_endian>::first_plt_entry[5] =
> +{
> + 0xe52de004, // str lr, [sp, #-4]!
> + 0xe59fe004, // ldr lr, [pc, #4]
> + 0xe08fe00e, // add lr, pc, lr
> + 0xe5bef008, // ldr pc, [lr, #8]!
> + 0x00000000, // &GOT[0] - .
> +};
> +
> +// Subsequent entries in the PLT.
> +
> +template<bool big_endian>
> +const uint32_t Output_data_plt_arm<big_endian>::plt_entry[3] =
> +{
> + 0xe28fc600, // add ip, pc, #0xNN00000
> + 0xe28cca00, // add ip, ip, #0xNN000
> + 0xe5bcf000, // ldr pc, [ip, #0xNNN]!
> +};
As Richard said, this needs to be more flexible, but you can do that
later if you like. At least add some FIXME comments for now.
> +// Return the value to use for a dynamic which requires special
> +// treatment. This is how we support equality comparisons of function
> +// pointers across shared library boundaries, as described in the
> +// processor specific ABI supplement.
s/for a dynamic/for a dynamic symbol/
OK with those changes.
Thanks.
Ian