This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [GOLD] Adjusting --emit-relocs output
- From: Ian Lance Taylor <iant at google dot com>
- To: binutils at sourceware dot org
- Date: Tue, 4 Sep 2012 12:55:22 -0700
- Subject: Re: [GOLD] Adjusting --emit-relocs output
- References: <20120901042558.GK3159@bubble.grove.modra.org>
On Fri, Aug 31, 2012 at 9:25 PM, Alan Modra <amodra@gmail.com> wrote:
>
> gold/
> * object.h (Sized_relobj_file::emit_relocs): Delete.
> (Sized_relobj_file::emit_relocs_reltype): Delete.
> * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
> relocate_relocs for --emit-relocs.
> (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
> * output.h: Update comment.
> (Output_segment::first_section): New function.
> (Output_segment::first_section_load_address): Use first_section.
> * output.cc (Output_segment::first_section): New function extracted..
> (Output_segment::first_section_load_address): ..from here. Delete.
> * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
> * target.h (Sized_target::relocate_for_relocatable): Likewise.
> * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
> adjust call to target.h function.
> * i386.cc (Target_i386): Likewise.
> * sparc.cc (Target_sparc): Likewise.
> * x86_64.cc (Target_x86_64): Likewise.
> * powerpc.cc (Target_powerpc): Likewise.
> (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS. Ensure
> first tls section has section symbol for optimised local dynamic
> output relocs.
> (Target_powerpc::Relocate::relocate): Correct local dynamic value.
> (Target_powerpc::relocate_relocs): Adjust relocs emitted for
> optimised tls code.
> gold/testsuite/
> * testfile.cc (Target_test::relocate_for_relocatable): Rename
> to relocate_relocs. Update error message.
> @@ -4626,9 +4626,7 @@ Output_segment::first_section_load_addre
> ++p)
> {
> if ((*p)->is_section())
> - return ((*p)->has_load_address()
> - ? (*p)->load_address()
> - : (*p)->address());
> + return static_cast<Output_section*>(*p);
Don't use a static_cast here. Instead, return (*p)->output_section().
That may require you to change the return type to be a const pointer.
And that will give you trouble elsewhere. You may need two versions
of this function: one a const member function and one not.
OK with that change.
Thanks.
Ian