aboutsummaryrefslogtreecommitdiff
path: root/gold/powerpc.cc
AgeCommit message (Collapse)AuthorFilesLines
2012-12-12 * powerpc.cc (class Track_tls): New.Alan Modra1-43/+148
(class Relocate, class Scan): Inherit Track_tls. (Target_powerpc::Scan::local, global): Track tls optimization and avoid creating plt entry for __tls_get_addr if all uses are optimized away. (Target_powerpc::Relocate::relocate): Update to use Track_tls.
2012-12-12 * options.h (General_options): Add --toc-sort/--no-toc-sort.Alan Modra1-3/+79
Replace no_toc_optimize with toc_optimize. * output.h (Output_section::input_sections): Provide non-const variant. * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_, set_has_small_toc_reloc, has_small_toc_reloc): New variable and accessors. (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc. (class Sort_toc_sections): New. (Target_powerpc::do_finalize_sections): Sort toc sections. (Target_powerpc::Relocate::relocate): Update toc_optimize test.
2012-12-10 * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):Alan Modra1-23/+2
Set EM_PPC64 or EM_PPC here. (Target_selector_powerpc::do_recognize): Delete.
2012-12-10 * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ andAlan Modra1-1/+3
stub_table_. (Target_powerpc::Branch_info::make_stub): Don't omit addend.
2012-12-07 * powerpc.cc (Stub_table::do_write): Delete redundant AddressAlan Modra1-3/+10
typedef and invalid_address constant. (Output_data_glink, Stub_table, Target_powerpc): Explicitly instantiate constants.
2012-12-07 * options.h (General_options): Add no_toc_optimize.Alan Modra1-0/+96
* powerpc.cc (ok_lo_toc_insn): New function. (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
2012-12-06 * options.h (General_options): Add plt_align, plt_static_chain,Alan Modra1-89/+226
plt_thread_safe. Update stub_group_size help text. * powerpc.cc (Target_powerpc::plt_thread_safe): New access function for new plt_thread_safe_ var. (use_plt_offset): Correct comments. (Target_powerpc::do_relax): Look for thread creation symbols to determine default plt_thread_safe value. Clear plt call stubs as well as branch stubs each iteration. (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New insn constants. (l, hi, ha, write_insn): Move earlier. (Stub_table): Delete prev_size, add last_plt_size and last_branch_size. (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear plt stubs too. (Stub_table::update_size): Adjust. (Stub_table::prev_size, set_prev_size): Delete. (Stub_table::stub_align): Let --plt-align affect result. (Stub_table::plt_call_size): Calculate sizes for various stubs. (Stub_table::branch_stub_size): Use last_plt_size in address calc. (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size. (Stub_table::do_write): Support more stub variants.
2012-12-04 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.Alan Modra1-11/+7
(Target_powerpc::do_define_standard_symbols): New function.
2012-12-03 * layout.h (Layout::get_executable_sections): Declare.Alan Modra1-338/+1423
* layout.cc (Layout::get_executable_sections): New function. * arm.cc (Target_arm::group_sections): Use it. (Arm_output_section::group_sections): Delete now redundant test. * output.cc (Output_reloc::Output_reloc): Add is_relative. param to handle relative relocs. * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise. (Output_data_reloc::add_absolute): Adjust. (Output_data_reloc::add_relative): New function. (Output_data::reset_data_size): New function. (Output_relaxed_input_section::set_relobj, set_shndx): New functions. (Output_section::set_addralign): New function. (Output_section::checkpoint_set_addralign): New function. (Output_section::clear_section_offsets_need_adjustment): New function. (Output_section::input_sections): Make public. * powerpc.cc (class Output_data_brlt_powerpc): New. (class Stub_table, class Stub_control): New. (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch, stub_table_, set_stub_table, stub_table): New vectors and accessor functions. (Target_powerpc::do_may_relax, do_relax, push_branch, new_stub_table, stub_tables, brlt_section, group_sections, add_branch_lookup_table, find_branch_lookup_table, write_branch_lookup_table, make_brlt_section): New functions. (Target_powerpc::struct Sort_sections, class Branch_info): New. (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_, branch_info_): New vars. (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't make call stubs here. (Output_data_glink): Remove all call stub handling from this class. (Target_powerpc::Scan::local, global): Save interesting branch relocs and relocs for ifunc. Adjust calls to plt entry functions. (Target_powerpc::do_finalize_sections): Only make reg save/restore functions on final link. (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs. Handle long branch destinations too. (Target_powerpc::do_dynsym_value, do_plt_address_for_global, do_plt_address_for_local): Adjust lookup of plt call stubs.
2012-11-30 * powerpc.c (Target_powerpc::Scan::global): Don't emit relativeAlan Modra1-5/+9
relocs against protected symbols when building 32-bit shared libs.
2012-11-30 * powerpc.cc (Target_powerpc::make_plt_section): Add symtabAlan Modra1-14/+23
param. Call got_section() to make .got. Update all callers and their callers and so on.
2012-11-30 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCALAlan Modra1-10/+17
_GLOBAL_OFFSET_TABLE_ rather than STB_WEAK. (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_ value if it already exists.
2012-11-05 * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.Alan Modra1-43/+65
(struct Opd_ent): Use "Address" rather than "Offset". (Output_data_got_powerpc::got_base_offset): Return Valtype. (Target_powerpc::got_section): Make public. (Target_powerpc::scan_relocs): Move code setting symbols.. (Powerpc_relobj::do_scan_relocs): ..to here, new function. Create _SDA_BASE_ only when referenced.
2012-11-01gold/Roland McGrath1-18/+19
* target.h (Sized_target::relocate_relocs): Use Elf_Off for offset_in_output_section parameter. (Sized_target::relocate_special_relocatable): Likewise. * arm.cc (Target_arm::relocate_relocs): Likewise. (Target_arm::relocate_special_relocatable): Likewise. * i386.cc (Target_i386::relocate_relocs): Likewise. * powerpc.cc (Target_powerpc::relocate_relocs): Likewise. * sparc.cc (Target_sparc::relocate_relocs): Likewise. * target-reloc.h (relocate_relocs): Likewise. * testsuite/testfile.cc (Target_test): Likewise. * tilegx.cc (Target_tilegx::relocate_relocs): Likewise. * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
2012-10-18 * target-reloc.h (class Default_comdat_behavior): New, package up..Alan Modra1-41/+29
(get_comdat_behaviour): ..this. (relocate_section): Add Relocate_comdat_behavior template arg, adjust code to suit. * arm.cc (Target_arm::relocate_section): Adjust to suit. (Target_arm::scan_reloc_section): Likewise. * i386.cc (Target_i386::relocate_section): Likewise. * sparc.cc (Target_sparc::relocate_section): Likewise. * tilegx.cc (Target_tilegx::relocate_section): Likewise. * x86_64.cc (Target_x86_64::relocate_section): Likewise. * powerpc.cc (class Relocate_comdat_behavior): New. (Target_powerpc::relocate_section): Don't zap opd relocs. Supply gold::relocate_section with new template arg.
2012-10-17 * powerpc.cc (Target_powerpc::Scan::local, global): Always emitAlan Modra1-21/+70
dynamic relocs for GOT_TPREL got entries, without symbol if resolving locally. (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects. (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early. (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
2012-10-16 * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.Alan Modra1-0/+363
(Target_powerpc::do_finalize_sections): Call it. (Output_data_save_res): New class and supporting functions. (Target_powerpc::symval_for_branch): Only look up .opd entry for normal symbols defined in object files.
2012-10-12 * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.Alan Modra1-3/+32
(struct Opd_ent): Make "discard" a bit field. Add "gc_mark". (Target_powerpc::do_gc_mark_symbol): Delay marking function code section if scan_opd_relocs not yet called. (Target_powerpc::gc_process_relocs): Call process_gc_mark.
2012-10-12 * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,Alan Modra1-18/+11
add_local_ifunc_entry): Revert last change. (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
2012-10-05 * powerpc.cc (Target_powerpc::do_plt_address_for_local,Alan Modra1-105/+229
do_plt_address_for_global): New functions. (Output_data_got_powerpc::do_write): Don't segfault when linking statically. (Output_data_plt_powerpc::add_entry, add_ifunc_entry, add_local_ifunc_entry): Return true on adding entry.. (Target_powerpc::make_plt_entry): ..use to avoid unnecessary glink->add_entry call. Remove unused symtab param. Adjust calls. (Target_powerpc::make_local_ifunc_plt_entry): Likewise. (Target_powerpc::make_iplt_section): Remove symtab param. Don't set up symbols here. (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt syms here. Do so even when no .iplt. Don't segfault when linking statically. (Output_data_glink::add_entry, find_entry): Rearrange params. Add new variants without reloc param. (Glink_sym_ent::Glink_sym_ent): Likewise. (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any reloc when refs will resolve to plt call stub. (Target_powerpc::Scan::local): Correct ifunc handling. Allow R_PPC_PLTREL24 to resolve locally. (Target_powerpc::Scan::global): Correct ifunc handling. (Target_powerpc::Relocate::relocate): Correct local sym glink lookup. Don't destroy "value" when we have a plt call stub, and when checking plt call validity. (Target_powerpc::do_dynsym_value): Simplify.
2012-09-29 * powerpc.cc (Target_powerpc::iplt_): New output section.Alan Modra1-97/+444
(Target_powerpc::iplt_section, make_iplt_section, reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions. (Target_powerpc::make_plt_entry): Handle ifunc syms. Target_powerpc::plt_entry_count): Count iplt entries too. (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create reloc section in constructor. New params. (Target_powerpc::make_plt_section): Create reloc section here instead. (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New functions. (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars. (Output_data_glink::add_entry, find_entry): New functions to deal with local syms. (Glink_sym_ent): Add support for local syms. (Output_data_glink::do_write): Handle ifunc plt entries. (Target_powerpc::Scan::get_reference_flags): Handle more relocs. (Target_powerpc::Scan::local, global): Handle ifunc syms. (Target_powerpc::Relocate::relocate): Likewise. (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
2012-09-25 * object.h (Sized_relobj_file::adjust_local_symbol,Alan Modra1-4/+95
do_adjust_local_symbol): New functions. * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above. * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function. (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs and irregular opd entry spacing. (Powerpc_relobj::do_read_relocs): Add opd size checks. (Global_symbol_visitor_opd): New functor. (Target_powerpc::do_finalize_sections): Omit global symbols defined on deleted opd entries.
2012-09-12 * target-reloc.h (scan_relocs): Call scan.local for relocsAlan Modra1-39/+137
against symbols in discarded sections. Pass is_discarded param. * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local): Add is_discarded param. * powerpc (Target_powerpc::Scan::local): Likewise. Use is_discarded to flag opd entry as discarded. Don't emit dyn relocs on such entries. (Target_powerpc::Scan::global): Similarly detect and handle such opd entries. (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with opd_ent_. Update all uses. (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions. (Target_powerpc::relocate_section): Zero out discarded opd entry relocs.
2012-09-10 * output.h (Output_data_got::add_global_tls, add_local_tls,Alan Modra1-23/+99
add_local_tls_pair): New functions. (Output_data_got::add_local_pair_with_rel): Remove second reloc param. Expand comment. (Output_data_got::Got_entry): Rename use_plt_offset_ to use_plt_or_tls_offset_, similarly for constructor param. (Output_data_got::Got_entry::write): Add got_index param. * output.cc (Output_data_got::add_global_tls, add_local_tls, add_local_tls_pair): New functions. (Output_data_got::Got_entry::write): Handle tls symbols with use_plt_or_tls_offset_ set specially. (Output_data_got::add_local_pair_with_rel): Only one reloc. (Output_data_got::do_write): Replace iterator with index, pass index to entry write function. * target.h (Target::tls_offset_for_local, tls_offset_for_global, do_tls_offset_for_local, do_tls_offset_for_global): New functions. * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel call. * i386.cc (Target_i386::Scan::local): Likewise. * sparc.cc (Target_sparc::Scan::local): Likewise. * x86_64.cc (Target_x86_64::Scan::local): Likewise. * powerpc.cc (Target_powerpc::do_tls_offset_for_local, do_tls_offset_for_global): New functions. (Target_powerpc::Scan::local): Correct TLS relocations and got entry values. (Target_powerpc::Scan::global): Don't emit unnecessary dynamic relocations on TLS GOT entries.
2012-09-09 * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.Alan Modra1-6/+147
(Sized_target::gc_add_reference, do_gc_add_reference): New functions. * gc.h (gc_process_relocs): Call target gc_add_reference. * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym. * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol. (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove unnecessary cast. * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters to cater for when we don't need code offset. Update use. (Powerpc_relobj::access_from_map_, opd_valid_): New vars. (Powerpc_relobj::access_from_map, add_reference, opd_valid, set_opd_valid): New functions. (Target_powerpc::do_gc_add_reference): New function. (Target_powerpc::gc_process_relocs): Call gc()->add_reference on stashed refs. (Target_powerpc::do_gc_mark_symbol): New function.
2012-09-05 * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,Alan Modra1-61/+58
update all uses and lose "enum" when using type.
2012-09-05 * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.Alan Modra1-89/+160
(Powerpc_relocate_functions::Status): New typedef. (Target_powerpc::Scan::get_reference_flags): Handle more relocs. (Target_powerpc::Scan::local): Handle REL64. (Target_powerpc::Scan::global): Likewise, and dynamic relocs for REL32 and REL64. (Target_powerpc::symval_for_branch): New function, extracted from.. (Target_powerpc::Relocate::relocate): ..here. Correct plt call checks. Report overflow errors.
2012-09-05 * object.h (Sized_relobj_file::emit_relocs): Delete.Alan Modra1-50/+190
(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. * testsuite/testfile.cc (Target_test::relocate_for_relocatable): Rename to relocate_relocs. Update error message.
2012-09-04* powerpc.cc (do_make_elf_object): Allow ET_EXEC files withAndreas Schwab1-1/+4
--just-symbols.
2012-08-31 * powerpc.cc (Powerpc_relobj): Add and use Address typedef.Alan Modra1-315/+1437
(Powerpc_relobj::toc_base_offset): New stub function. (Target_powerpc): Add tp_offset, dtp_offset. Rename got_mod_index_offset to tlsld_got_offset. Update all refs. (Target_powerpc::Relocate::enum skip_tls): New. (Target_powerpc::call_tls_get_addr_): New var. (Target_powerpc::is_branch_reloc): Move to file scope. (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete. (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie): New functions. (Target_powerpc::enum Got_type): Delete old values, add new ones. (powerpc_info): Correct common_pagesize for ppc64. (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions. (Powerpc_relocate_functions): Add overflow check enums and functions. Add non-shift version of rela, rela_ua. Delete all rel public functions. Delete addr16_lo. Add addr64, addr64_u, addr32, addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3, addr16_ha3, addr14 functions. (Output_data_got_powerpc::add_constant_pair): New function. (Output_data_got_powerpc::got_base_offset): Likewise. (Output_data_got_powerpc::do_write): Correct 64-bit got header. (instruction constants): Sort, add some more. (Output_data_glink::do_write): Add and use Address typedef. Use object->toc_base_offset() stub for 64-bit. (Target_powerpc::tlsld_got_offset): Use add_constant_pair. (Target_powerpc::Scan::get_reference_flags): Handle more relocs. (Target_powerpc::Scan::local, global): Emit relative dynamic reloc for R_PPC64_TOC. Handle more relocs. Generate got entries for TLS. Always treat .opd relocs as against locally defined symbol. Correct condition for RELATIVE relocs. (Target_powerpc::do_finalize_sections): Test for NULL sections. (Target_powerpc::Relocate::relocate): Use plt call stub as value for 32-bit syms with a plt entry. Correct ppc64 toc base calculations. Handle TLS relocs, and more. Add overflow checking and adjust for Powerpc_relocate_functions changes. (Target_powerpc::relocate_for_relocatable): Handle zero r_sym. Reinstate --emit-relocs code with FIXME.
2012-08-18 * powerpc.cc: Formatting and white space.Alan Modra1-211/+381
(Powerpc_relobj): Rename got2_section_ to special_. Add opd_ent_shndx_ and opd_ent_off_ vectors. (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent, scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions. (Target_powerpc): Add Address typedef and invalid_address. Use throughout. (Target_powerpc::is_branch_reloc): New function. (Powerpc_relocate_functions): Add Address typedef, use throughout. (Powerpc_relocate_functions:rela, rela_ua): Correct type used for dst_mask, value and addend. (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit. (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants. (Output_data_glink::do_write): Correct toc base. Don't try to use uint16_t for 24-bit offset. Use get_output_section_offset and check return. (Target_powerpc::Scan::local): Handle more relocs. (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK. (Target_powerpc::Relocate::relocate): Correct toc base calculation. Plug in toc restoring insn after plt calls. Translate branches to function descriptor symbols to corresponding entry point. (Target_powerpc::relocate_for_relocatable): Check return from get_output_section_offset. * symtab.h: Comment typo.
2012-08-14 * target.h (Target::output_section_name): New function.Alan Modra1-0/+13
(Target::do_output_section_name): New function. * layout.cc (Layout::choose_output_section): Call the above. * powerpc.cc (Target_powerpc::do_output_section_name): New function.
2012-08-14elfcpp/Alan Modra1-21/+37
* powerpc.h: Add more relocs. (R_PPC_REL16*): Rename to R_POWERPC_REL16*. gold/ * powerpc.cc: Update for renamed R_PPC_REL16 relocs. (Output_data_got_powerpc::do_write): Don't rely on base class lookup for replace_constant call. (Output_data_plt_powerpc::do_print_to_mapfile): New function. (Output_data_glink::do_print_to_mapfile): New function. (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE. (Target_powerpc::Relocate::relocate): Likewise.
2012-08-14 * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.Alan Modra1-61/+35
(Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx. (Output_data_glink::add_entry,find_entry): Remove shndx param. (class Glink_sym_ent): Rename from struct Glink_sym_ent. Remove all references to shndx_. Handle special case for R_PPC_PLTREL24 here. (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash. (Output_data_glink::do_write): Retrieve got2_shdnx from object. (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24 here. (Target_powerpc::Scan::global): Nor on make_plt_entry call. (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
2012-08-12 * powerpc.cc: Whitespace fixes. Wrap overly long lines.Alan Modra1-156/+163
(glink insn constants): Use uint32_t. (Output_data_glink::add_entry): Use insert, not [] operator.
2012-08-11 * object.h (Sized_relobj_file::find_shdr): New function.Alan Modra1-554/+1198
(Sized_relobj_file::find_special_sections): New function. * object.cc (Sized_relobj_file::find_shdr): New function. (Sized_relobj_file::find_eh_frame): Use find_shdr. (Sized_relobj_file::find_special_sections): New function, split out.. (Sized_relobj_file::do_read_symbols): ..from here. * output.h (Output_data_got::replace_constant): New function. (Output_data_got::num_entries): New function. (Output_data_got::last_got_offset,set_got_size): Use num_entries. (Output_data_got::got_offset): Protected rather than private. (Output_data_got::replace_got_entry): New function. * output.cc (Output_data_got::replace_got_entry): New function. * powerpc.cc (class Powerpc_relobj): New. (class Powerpc_relocate_functions): Delete all psymval variants or convert to value,addend type. Delete pcrela, pcrela_unaligned. Implement _ha functions using corresponding _hi function. (Powerpc_relobj::find_special_sections): New function. (Target_powerpc::do_make_elf_object): New function. (class Output_data_got_powerpc): New. (class Output_data_glink): New. (class Powerpc_scan_relocatable_reloc): New. Many more changes througout file.
2012-07-11 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.Ian Lance Taylor1-1/+0
(Arm_exidx_cantunwind::do_fixed_endian_write): Likewise. (Target_arm::scan_reloc_for_stub): Likewise. * common.cc (Symbol_table::do_allocate_commons_list): Likewise. * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise. * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise. * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise. * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
2012-05-02 * configure.ac (ENABLE_GOLD): Consider *-*-nacl* targets ELF.Roland McGrath1-100/+110
* configure: Regenerate. gold/ * nacl.cc: New file. * nacl.h: New file. * Makefile.am (CCFILES, HFILES): Add them. * Makefile.in: Regenerate. * i386.cc (Output_data_plt_i386_nacl): New class. (Output_data_plt_i386_nacl_exec): New class. (Output_data_plt_i386_nacl_dyn): New class. (Target_i386_nacl): New class. (Target_selector_i386_nacl): New class. (target_selector_i386): Use it instead of Target_selector_i386. * x86_64.cc (Output_data_plt_x86_64_nacl): New class. (Target_x86_64_nacl): New class. (Target_selector_x86_64_nacl): New class. (target_selector_x86_64, target_selector_x32): Use it instead of Target_selector_x86_64. * arm.cc (Output_data_plt_arm_nacl): New class. (Target_arm_nacl): New class. (Target_selector_arm_nacl): New class. (target_selector_arm, target_selector_armbe): Use it instead of Target_selector_arm. * target-select.cc (select_target): Take new Input_file* and off_t arguments, pass them on to recognize method of selector. * object.cc (make_elf_sized_object): Update caller. * parameters.cc (parameters_force_valid_target): Likewise. * incremental.cc (make_sized_incremental_binary): Likewise. * target-select.h: Update decl. (Target_selector::recognize): Take new Input_file* argument, pass it on to do_recognize. (Target_selector::do_recognize): Take new Input_file* argument. * freebsd.h (Target_selector_freebsd::do_recognize): Likewise. * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise. * sparc.cc (Target_selector_sparc::do_recognize): Likewise. * testsuite/testfile.cc (Target_selector::do_recognize): Likewise. * target.h (Target::Target_info): New members isolate_execinstr and rosegment_gap. (Target::isolate_execinstr, Target::rosegment_gap): New methods. * arm.cc (Target_arm::arm_info): Update initializer. * i386.cc (Target_i386::i386_info): Likewise. * powerpc.cc (Target_powerpc::powerpc_info): Likewise. * sparc.cc (Target_sparc::sparc_info): Likewise. * x86_64.cc (Target_x86_64::x86_64_info): Likewise. * testsuite/testfile.cc (Target_test::test_target_info): Likewise. * layout.cc (Layout::attach_allocated_section_to_segment): Take new const Target* argument. If target->isolate_execinstr(), act like --rosegment. (Layout::find_first_load_seg): Take new const Target* argument; if target->isolate_execinstr(), reject PF_X segments. (Layout::relaxation_loop_body): Update caller. (Layout::set_segment_offsets): If target->isolate_execinstr(), reset file offset to zero when we hit LOAD_SEG, and then do a second loop over the segments before LOAD_SEG to reassign offsets after addresses have been determined. Handle target->rosegment_gap(). (Layout::attach_section_to_segment): Take new const Target* argument; pass it to attach_allocated_section_to_segment. (Layout::make_output_section): Update caller. (Layout::attach_sections_to_segments): Take new const Target* argument; pass it to attach_section_to_segment. * gold.cc (queue_middle_tasks): Update caller. * layout.h (Layout): Update method decls with new arguments. * arm.cc (Target_arm::Target_arm): Take optional argument for the Target_info pointer to use. (Target_arm::do_make_data_plt): New virtual method. (Target_arm::make_data_plt): New method that calls it. (Target_arm::make_plt_entry): Use it. (Output_data_plt_arm::Output_data_plt_arm): Take additional argument for the section alignment. (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual method. (Output_data_plt_arm::first_plt_entry_offset): Call it. (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual method. (Output_data_plt_arm::get_plt_entry_size): Call it. (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method. (Output_data_plt_arm::fill_plt_entry): New method that calls it. (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual method. (Output_data_plt_arm::fill_first_plt_entry): New method that calls it. (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size method instead of sizeof(plt_entry). (Output_data_plt_arm::add_entry): Likewise. Use first_plt_entry_offset method instead of sizeof(first_plt_entry). (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather than static method. (Target_arm::plt_entry_size): Likewise. (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry): Move to ... (Output_data_plt_arm_standard): ... here, new class. (Output_data_plt_arm::do_write): Move guts of PLT filling to... (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ... (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here. * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64): Take additional argument for the PLT entry size. (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Use get_plt_entry_size method rather than plt_entry_size variable. (Output_data_plt_x86_64::reserve_slot): Likewise. (Output_data_plt_x86_64::do_adjust_output_section): Likewise. (Output_data_plt_x86_64::add_entry): Likewise. (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise. (Output_data_plt_x86_64::address_for_global): Likewise. (Output_data_plt_x86_64::address_for_local): Likewise. (Output_data_plt_x86_64::set_final_data_size): Likewise. (Output_data_plt_x86_64::first_plt_entry_offset): Likewise. Make method non-static. (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual method. (Output_data_plt_x86_64::get_plt_entry_size): Just call that. (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method. (Output_data_plt_x86_64::add_eh_frame): New method to call it. (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract virtual method. (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it. (Output_data_plt_x86_64::do_fill_plt_entry): New abstract virtual method. (Output_data_plt_x86_64::fill_plt_entry): New method to call it. (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract virtual method. (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it. (Output_data_plt_x86_64::plt_entry_size) (Output_data_plt_x86_64::first_plt_entry) (Output_data_plt_x86_64::plt_entry) (Output_data_plt_x86_64::tlsdesc_plt_entry) (Output_data_plt_x86_64::plt_eh_frame_fde_size) (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ... (Output_data_plt_x86_64_standard): ... here, new class. (Target_x86_64::Target_x86_64): Take optional argument for the Target_info pointer to use. (Target_x86_64::do_make_data_plt): New virtual method. (Target_x86_64::make_data_plt): New method to call it. (Target_x86_64::init_got_plt_for_update): Use that. Call this->plt_->add_eh_frame method here. (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here. (Target_x86_64::first_plt_entry_offset): Call method on this->plt_ rather than static method. (Target_x86_64::plt_entry_size): Likewise. (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method rather than plt_entry_size variable. Move guts of PLT filling to... (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ... (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ... (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here. * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take additional argument for the section alignment. Don't do add_eh_frame_for_plt here. (Output_data_plt_i386::first_plt_entry_offset): Make the method non-static. Use get_plt_entry_size method rather than plt_entry_size variable. (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual method. (Output_data_plt_i386::get_plt_entry_size): Call it. (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method. (Output_data_plt_i386::add_eh_frame): New method to call it. (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual method. (Output_data_plt_i386::fill_first_plt_entry): New method to call it. (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual method. (Output_data_plt_i386::fill_plt_entry): New method to call it. (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size method instead of plt_entry_size. (Output_data_plt_i386::plt_entry_size) (Output_data_plt_i386::plt_eh_frame_fde_size) (Output_data_plt_i386::plt_eh_frame_fde): Move to ... (Output_data_plt_i386_standard): ... here, new class. (Output_data_plt_i386_exec): New class. (Output_data_plt_i386::exec_first_plt_entry): Move to ... (Output_data_plt_i386_exec::first_plt_entry): ... here. (Output_data_plt_i386::exec_plt_entry): Move to ... (Output_data_plt_i386_exec::plt_entry): ... here. (Output_data_plt_i386_dyn): New class. (Output_data_plt_i386::first_plt_entry): Move to ... (Output_data_plt_i386_dyn::first_plt_entry): ... here. (Output_data_plt_i386::dyn_plt_entry): Move to ... (Output_data_plt_i386_dyn::plt_entry): ... here. (Target_i386::Target_i386): Take optional argument for the Target_info pointer to use. (Target_i386::do_make_data_plt): New virtual method. (Target_i386::make_data_plt): New method to call it. (Target_i386::make_plt_section): Use that. Call this->plt_->add_eh_frame method here. (Output_data_plt_i386::add_entry): Use get_plt_entry_size method rather than plt_entry_size variable. (Output_data_plt_i386::add_local_ifunc_entry): Likewise. (Output_data_plt_i386::address_for_local): Likewise. (Output_data_plt_i386::do_write): Likewise. Move guts of PLT filling to... (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ... (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ... (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ... (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here. Change-Id: Id24b95600489835ff5e860a39c147203d4380c2b
2012-04-17gold: Allow use_plt_offset to be specified for global relocations.David S. Miller1-3/+3
gold/ * output.h (Output_reloc): Allow use_plt_offset for global relocs too. (class Output_data_reloc): Adjust calls to Output_reloc_type. (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset. * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for global relocs too. (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols. * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative calls. * sparc.cc (Target_sparc::Scan::global): Likewise. * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2011-12-19 * object.h (Relobj::local_symbol_value): New function.Ian Lance Taylor1-2/+2
(Relobj::local_plt_offset): New function. (Relobj::local_has_got_offset): New function. (Relobj::local_got_offset): New function. (Relobj::set_local_got_offset): New function. (Relobj::do_local_symbol_value): New pure virtual function. (Relobj::do_local_plt_offset): Likewise. (Relobj::do_local_has_got_offset): Likewise. (Relobj::do_local_got_offset): Likewise. (Relobj::do_set_local_got_offset): Likewise. (Sized_relobj::do_local_has_got_offset): Rename from local_has_got_offset. (Sized_relobj::do_local_got_offset): Rename from local_got_offset. (Sized_relobj::do_set_local_got_offset): Rename from set_local_got_offset. (Sized_relobj_file::do_local_plt_offset): Rename from local_plt_offset. (Sized_relobj_file::do_local_symbol_value): New function. * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from local_plt_offset. * output.cc (Output_data_got::Got_entry::write): Change object to Relobj. Use local_symbol_value. (Output_data_got::add_global_with_rel): Change rel_dyn to Output_data_reloc_generic*. Use add_global_generic. (Output_data_got::add_global_with_rela): Remove. Change all callers to use add_global_with_rel. (Output_data_got::add_global_pair_with_rel): Change rel_dyn to Output_data_reloc_generic*. Use add_global_generic. (Output_data_got::add_global_pair_with_rela): Remove. Change all callers to use add_global_pair_with_rel. (Output_data_got::add_local): Change object to Relobj*. (Output_data_got::add_local_plt): Likewise. (Output_data_got::add_local_with_rel): Change object to Relobj*, change rel_dyn to Output_data_reloc_generic*. Use add_local_generic. (Output_data_got::add_local_with_rela): Remove. Change all callers to use all_local_with_rel. (Output_data_got::add_local_pair_with_rel): Change object to Relobj*, change rel_dyn to Output_data_reloc_generic*. Use add_output_section_generic. (Output_data_got::add_local_pair_with_rela): Remove. Change all callers to use add_local_pair_with_rel. (Output_data_got::reserve_local): Change object to Relobj*. * output.h: (class Output_data_reloc_generic): Add pure virtual declarations for add_global_generic, add_local_generic, add_output_section_generic. (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new functions for Output_data_reloc_generic. Update declarations for changes listed in output.cc. (class Output_data_got): Change template parameter to got_size. Don't define Rel_dyn or Rela_dyn. Update declarations per above. * incremental.h (Sized_relobj_incr::do_local_symbol_value): New function. (Sized_relobj_incr::do_local_plt_offset): New function. * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call add_global_generic.
2011-10-10 PR gold/13249Cary Coutant1-2/+2
* gold/output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag. (Output_reloc::symbol_value): Return PLT offset if flag is set. * gold/output.h (class Output_reloc): Add use_plt_offset flag. (Output_reloc::type_): Adjust size of bit field. (Output_reloc::use_plt_offset_): New bit field. (class Output_data_reloc): Adjust all calls to Output_reloc_type. (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset flag. Adjust all callers. * gold/x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when creating RELATIVE relocations.
2011-06-28 PR gold/12934Ian Lance Taylor1-3/+6
* target-select.cc (Target_selector::Target_selector): Add emulation parameter. Change all callers. (select_target_by_bfd_name): Rename from select_target_by_name. Change all callers. (select_target_by_emulation): New function. (supported_emulation_names): New function. * target-select.h (class Target_selector): Add emulation_ field. Update declarations. (Target_selector::recognize_by_bfd_name): Rename from recognize_by_name. Change all callers. (Target_selector::supported_bfd_names): Rename from supported_names. Change all callers. (Target_selector::recognize_by_emulation): New function. (Target_selector::supported_emulations): New function. (Target_selector::emulation): New function. (Target_selector::do_recognize_by_bfd_name): Rename from do_recognize_by_name. Change all callers. (Target_selector::do_supported_bfd_names): Rename from do_supported_names. Change all callers. (Target_selector::do_recognize_by_emulation): New function. (Target_selector::do_supported_emulations): New function. (select_target_by_bfd_name): Change name in declaration. (select_target_by_emulation): Declare. (supported_emulation_names): Declare. * parameters.cc (parameters_force_valid_target): Try to find target based on emulation from -m option. * options.h (class General_options): Change doc string for -m. * options.cc (help): Print emulations. (General_options::parse_V): Likewise. * freebsd.h (Target_selector_freebsd::Target_selector_freebsd): Add emulation parameter. Change all callers.
2011-06-28 * target.h (Target::can_check_for_function_pointers): Rewrite.Ian Lance Taylor1-1/+5
Make non-virtual. (Target::can_icf_inline_merge_sections): Likewise. (Target::section_may_have_icf_unsafe_poineters): Likewise. (Target::Target_info): Add can_icf_inline_merge_sections field. (Target::do_can_check_for_function_pointers): New virtual function. (Target::do_section_may_have_icf_unsafe_pointers): Likewise. * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename from can_check_for_function_pointers, move in file. (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from section_may_have_icf_unsafe_poineters, move in file. (Target_arm::arm_info): Initialize can_icf_inline_merge_sections. * i386.cc (Target_i386::do_can_check_for_function_pointers): Rename from can_check_for_function_pointers, move in file. (Target_i386::can_icf_inline_merge_sections): Remove. (Target_i386::i386_info): Initialize can_icf_inline_merge_sections. * powerpc.cc (Target_powerpc::powerpc_info) [all versions]: Initialize can_icf_inline_merge_sections. * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise. * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers): Rename from can_check_for_function_pointers, move in file. (Target_x86_64::can_icf_inline_merge_sections): Remove. (Target_x86_64::x86_64_info): Initialize can_icf_inline_merge_sections. * testsuite/testfile.cc (Target_test::test_target_info): Likewise. * icf.cc (get_section_contents): Correct formatting.
2011-05-24 * incremental-dump.cc (dump_incremental_inputs): Print dynamic relocCary Coutant1-38/+39
info; adjust display of GOT entries. * incremental.cc (Sized_incremental_binary::setup_readers): Allocate vector of input objects; remove file_status_. (Sized_incremental_binary::do_reserve_layout): Remove file_status_. (Sized_incremental_binary::do_process_got_plt): Adjust calls to got_plt reader; call target hooks to reserve GOT entries. (Output_section_incremental_inputs::set_final_data_size): Adjust size of input file info header and GOT info entry. (Output_section_incremental_inputs::write_info_blocks): Write dynamic relocation info. (Got_plt_view_info::got_descriptor): Remove. (Got_plt_view_info::sym_index): New data member. (Got_plt_view_info::input_index): New data member. (Local_got_offset_visitor::visit): Write input file index. (Global_got_offset_visitor::visit): Write 0 for input file index. (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor with sym_index and input_index. (Output_section_incremental_inputs::write_got_plt): Adjust size of incremental info GOT entry; replace got_descriptor with input_index. (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record map from input file index to object. (Sized_relobj_incr::do_layout): Replace direct data member reference with accessor function. (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class. * incremental.h (Incremental_input_entry_reader::get_symbol_offset): Adjust size of input file info header. (Incremental_input_entry_reader::get_first_dyn_reloc): New function. (Incremental_input_entry_reader::get_dyn_reloc_count): New function. (Incremental_input_entry_reader::get_input_section): Adjust size of input file info header. (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size of incremental info GOT entry. (Incremental_got_plt_reader::get_got_desc): Remove. (Incremental_got_plt_reader::get_got_symndx): New function. (Incremental_got_plt_reader::get_got_input_index): New function. (Sized_incremental_binary::Sized_incremental_binary): Remove file_status_; add input_objects_. (Sized_incremental_binary::~Sized_incremental_binary): Remove. (Sized_incremental_binary::set_file_is_unchanged): Remove. (Sized_incremental_binary::file_is_unchanged): Remove. (Sized_incremental_binary::set_input_object): New function. (Sized_incremental_binary::input_object): New function. (Sized_incremental_binary::file_status_): Remove. (Sized_incremental_binary::input_objects_): New data member. (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all references. (Sized_relobj_incr::invalid_address): Move to base class. (Sized_relobj_incr::is_output_section_offset_invalid): Move to base class. (Sized_relobj_incr::do_output_section_offset): Likewise. (Sized_relobj_incr::do_for_all_local_got_entries): Likewise. (Sized_relobj_incr::section_offsets_): Likewise. * object.cc (Sized_relobj::do_for_all_local_got_entries): New function. (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_. (Sized_relobj_file::layout_section): Replace refs to section_offsets_ with accessor function. (Sized_relobj_file::do_layout): Likewise. (Sized_relobj_file::do_layout_deferred_sections): Likewise. (Sized_relobj_file::do_for_all_local_got_entries): Move to base class. (Sized_relobj_file::compute_final_local_value): Replace refs to section_offsets_ with accessor function. (Sized_relobj_file::do_finalize_local_symbols): Likewise. * object.h (Relobj::Relobj): Initialize new data members. (Relobj::add_dyn_reloc): New function. (Relobj::first_dyn_reloc): New function. (Relobj::dyn_reloc_count): New function. (Relobj::first_dyn_reloc_): New data member. (Relobj::dyn_reloc_count_): New data member. (Sized_relobj): Rename Sized_relobj_base to this; adjust all references. (Sized_relobj::Address): New typedef. (Sized_relobj::invalid_address): Move here from child class. (Sized_relobj::Sized_relobj): Initialize new data members. (Sized_relobj::sized_relobj): New function. (Sized_relobj::is_output_section_offset_invalid): Move here from child class. (Sized_relobj::get_output_section_offset): Likewise. (Sized_relobj::local_has_got_offset): Likewise. (Sized_relobj::local_got_offset): Likewise. (Sized_relobj::set_local_got_offset): Likewise. (Sized_relobj::do_for_all_local_got_entries): Likewise. (Sized_relobj::clear_got_offsets): New function. (Sized_relobj::section_offsets): Move here from child class. (Sized_relobj::do_output_section_offset): Likewise. (Sized_relobj::do_set_section_offset): Likewise. (Sized_relobj::Local_got_offsets): Likewise. (Sized_relobj::local_got_offsets_): Likewise. (Sized_relobj::section_offsets_): Likewise. (Sized_relobj_file): Rename Sized_relobj to this; adjust all references. (Sized_relobj_file::is_output_section_offset_invalid): Move to base class. (Sized_relobj_file::sized_relobj): New function (Sized_relobj_file::local_has_got_offset): Move to base class. (Sized_relobj_file::local_got_offset): Likewise. (Sized_relobj_file::set_local_got_offset): Likewise. (Sized_relobj_file::get_output_section_offset): Likewise. (Sized_relobj_file::do_for_all_local_got_entries): Likewise. (Sized_relobj_file::do_output_section_offset): Likewise. (Sized_relobj_file::do_set_section_offset): Likewise. (Sized_relobj_file::Local_got_offsets): Likewise. (Sized_relobj_file::local_got_offsets_): Likewise. (Sized_relobj_file::section_offsets_): Likewise. * output.cc (Output_reloc::Output_reloc): Adjust type of relobj (all constructors). (set_needs_dynsym_index): Convert relobj to derived class pointer. (Output_reloc::get_symbol_index): Likewise. (Output_reloc::local_section_offset): Likewise. (Output_reloc::get_address): Likewise. (Output_reloc::symbol_value): Likewise. (Output_data_got::reserve_slot): Move to class definition. (Output_data_got::reserve_local): New function. (Output_data_got::reserve_slot_for_global): Remove. (Output_data_got::reserve_global): New function. * output.h (Output_reloc::Output_reloc): Adjust type of relobj (all constructors, two instantiations). (Output_reloc::get_relobj): New function (two instantiations). (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type. (Output_data_reloc_base::add): Convert relobj to derived class pointer. (Output_data_reloc::add_global): Adjust type of relobj. (Output_data_reloc::add_global_relative): Likewise. (Output_data_reloc::add_symbolless_global_addend): Likewise. (Output_data_reloc::add_local): Likewise. (Output_data_reloc::add_local_relative): Likewise. (Output_data_reloc::add_symbolless_local_addend): Likewise. (Output_data_reloc::add_local_section): Likewise. (Output_data_reloc::add_output_section): Likewise. (Output_data_reloc::add_absolute): Likewise. (Output_data_reloc::add_target_specific): Likewise. (Output_data_got::reserve_slot): Move definition here. (Output_data_got::reserve_local): New function. (Output_data_got::reserve_global): New function. * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to section_offsets_ with accessor function. (Sized_relobj_file::write_sections): Likewise. (Sized_relobj_file::do_relocate_sections): Likewise. * target.h (Sized_target::reserve_local_got_entry): New function. (Sized_target::reserve_global_got_entry): New function. * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function. (Target_x86_64::reserve_global_got_entry): New function. (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
2010-11-11gold/Richard Sandiford1-11/+69
* symtab.h (Symbol::NON_PIC_REF): Remove. (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags. (Symbol::FUNCTION_CALL): Renumber. Reword comment. (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF. (Symbol::use_plt_offset): Take a flags argument and pass it directly to needs_dynamic_reloc. Restrict check for undefined weak symbols to function calls. * arm.cc (Target_arm::Scan::get_reference_flags): New function. (Target_arm::Scan::global): Use it. (Target_arm::Scan::scan_reloc_for_stub): Likewise. (Target_arm::Relocate::relocate): Likewise. (Target_arm::Relocate::should_apply_static_reloc): Replace flags parameter with an r_type parameter. Use get_reference_flags to get the flags. (Target_arm::Relocate::relocate): Update accordingly. * i386.cc (Target_i386::Scan::get_reference_flags): New function. (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it. (Target_i386::Scan::global): Likewise. (Target_i386::Relocate::relocate): Likewise. (Target_i386::Relocate::should_apply_static_reloc): Replace flags parameter with an r_type parameter. Use get_reference_flags to get the flags. (Target_i386::Relocate::relocate): Update accordingly. * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function. (Target_powerpc::Scan::global): Use it. (Target_powerpc::Scan::scan_reloc_for_stub): Likewise. (Target_powerpc::Relocate::relocate): Likewise. * sparc.cc (Target_sparc::Scan::get_reference_flags): New function. (Target_sparc::Scan::global): Use it. (Target_sparc::Scan::scan_reloc_for_stub): Likewise. (Target_sparc::Relocate::relocate): Likewise. * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function. (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it. (Target_x86_64::Scan::global): Likewise. (Target_x86_64::Relocate::relocate): Likewise.
2010-08-25 * archive.cc: Formatting fixes: Remove whitespace betweenNick Clifton1-2/+2
typename and following asterisk. Remove whitespace between function name and opening parenthesis. * archive.h: Likewise. * arm.cc: Likewise. * attributes.cc: Likewise. * attributes.h: Likewise. * common.cc: Likewise. * copy-relocs.cc: Likewise. * dirsearch.h: Likewise. * dynobj.cc: Likewise. * ehframe.cc: Likewise. * ehframe.h: Likewise. * expression.cc: Likewise. * fileread.cc: Likewise. * fileread.h: Likewise. * gc.h: Likewise. * gold-threads.cc: Likewise. * gold.cc: Likewise. * i386.cc: Likewise. * icf.h: Likewise. * incremental-dump.cc: Likewise. * incremental.cc: Likewise. * layout.cc: Likewise. * layout.h: Likewise. * main.cc: Likewise. * merge.cc: Likewise. * merge.h: Likewise. * object.cc: Likewise. * object.h: Likewise. * options.cc: Likewise. * options.h: Likewise. * output.cc: Likewise. * output.h: Likewise. * plugin.cc: Likewise. * plugin.h: Likewise. * powerpc.cc: Likewise. * reloc.cc: Likewise. * script-c.h: Likewise. * script-sections.cc: Likewise. * script.cc: Likewise. * stringpool.cc: Likewise. * symtab.cc: Likewise. * symtab.h: Likewise. * target.cc: Likewise. * timer.cc: Likewise. * timer.h: Likewise. * version.cc: Likewise. * x86_64.cc: Likewise.
2010-08-12elfcpp/ChangeLog:Cary Coutant1-2/+70
* elfcpp.h (enum SHT): Add SHT_GNU_INCREMENTAL_GOT_PLT. gold/ChangeLog: * arm.cc (Target_arm::got_size): Add const. (Target_arm::got_entry_count): New function. (Target_arm::plt_entry_count): New function. (Target_arm::first_plt_entry_offset): New function. (Target_arm::plt_entry_size): New function. (Output_data_plt_arm::entry_count): New function. (Output_data_plt_arm::first_plt_entry_offset): New function. (Output_data_plt_arm::get_plt_entry_size): New function. * i386.cc (Target_i386::got_size): Add const. (Target_i386::got_entry_count): New function. (Target_i386::plt_entry_count): New function. (Target_i386::first_plt_entry_offset): New function. (Target_i386::plt_entry_size): New function. (Output_data_plt_i386::entry_count): New function. (Output_data_plt_i386::first_plt_entry_offset): New function. (Output_data_plt_i386::get_plt_entry_size): New function. * incremental-dump.cc (dump_incremental_inputs): Adjust call to find_incremental_inputs_sections. Dump incremental_got_plt section. * incremental.cc: Include target.h. (Sized_incremental_binary::do_find_incremental_inputs_sections): Add parameter. Adjust all callers. Find incremental_got_plt section. (Incremental_inputs::create_data_sections): Create incremental_got_plt section. (Output_section_incremental_inputs::set_final_data_size): Calculate size of incremental_got_plt section. (Output_section_incremental_inputs::do_write): Write the incremental_got_plt section. (Got_plt_view_info): New struct. (Local_got_offset_visitor): New class. (Global_got_offset_visitor): New class. (Global_symbol_visitor_got_plt): New class. (Output_section_incremental_inputs::write_got_plt): New function. * incremental.h (Incremental_binary::find_incremental_inputs_sections): Add parameter. Adjust all callers. (Incremental_binary::do_find_incremental_inputs_sections): Likewise. (Incremental_inputs::got_plt_section): New function. (Incremental_inputs::got_plt_section_): New data member. (Incremental_got_plt_reader): New class. * layout.cc (Layout::create_incremental_info_sections): Add the incremental_got_plt section. * object.h (Got_offset_list::get_list): New function. (Got offset_list::for_all_got_offsets): New function. (Sized_relobj::local_got_offset_list): New function. * powerpc.cc (Target_powerpc::got_size): Add const. (Target_powerpc::got_entry_count): New function. (Target_powerpc::plt_entry_count): New function. (Target_powerpc::first_plt_entry_offset): New function. (Target_powerpc::plt_entry_size): New function. (Output_data_plt_powerpc::entry_count): New function. (Output_data_plt_powerpc::first_plt_entry_offset): New function. (Output_data_plt_powerpc::get_plt_entry_size): New function. * sparc.cc (Target_sparc::got_size): Add const. (Target_sparc::got_entry_count): New function. (Target_sparc::plt_entry_count): New function. (Target_sparc::first_plt_entry_offset): New function. (Target_sparc::plt_entry_size): New function. (Output_data_plt_sparc::entry_count): New function. (Output_data_plt_sparc::first_plt_entry_offset): New function. (Output_data_plt_sparc::get_plt_entry_size): New function. * symtab.h (Symbol::got_offset_list): New function. (Symbol_table::for_all_symbols): New function. * target.h (Sized_target::got_entry_count): New function. (Sized_target::plt_entry_count): New function. (Sized_target::plt_entry_size): New function. * x86_64.cc (Target_x86_64::got_size): Add const. (Target_x86_64::got_entry_count): New function. (Target_x86_64::plt_entry_count): New function. (Target_x86_64::first_plt_entry_offset): New function. (Target_x86_64::plt_entry_size): New function. (Output_data_plt_x86_64::entry_count): New function. (Output_data_plt_x86_64::first_plt_entry_offset): New function. (Output_data_plt_x86_64::get_plt_entry_size): New function.
2010-08-032010-08-03 Ian Lance Taylor <iant@google.com>Ian Lance Taylor1-12/+11
PR 11805 * layout.h (enum Output_section_order): Define. (class Layout): Update declarations. * layout.cc (Layout::get_output_section): Add order parameter. Remove is_interp, is_dynamic_linker_section, is_last_relro, and is_first_non_relro parameters. Change all callers. (Layout::choose_output_section): Likewise. (Layout::add_output_section_data): Likewise. (Layout::make_output_section): Likewise. Set order. (Layout::default_section_order): New function. (Layout::layout_eh_frame): Call add_output_section_to_nonload. * output.cc (Output_section::Output_section): Initialize order_. Don't initialize deleted fields. (Output_segment::Output_segment): Don't initialize deleted fields. (Output_segment::add_output_section_to_load): New function replacing add_output_section. Change all callers to call this or add_output_section_to_nonload. (Output_segment::add_output_section_to_nonload): New function. (Output_segment::remove_output_section): Rewrite. (Output_segment::add_initial_output_data): Likewise. (Output_segment::has_any_data_sections): Likewise. (Output_segment::is_first_section_relro): Likewise. (Output_segment::maximum_alignment): Likewise. (Output_segment::has_dynamic_reloc): New function replacing dynamic_reloc_count. Change all callers. (Output_segment::has_dynamic_reloc_list): New function replacing dynamic_reloc_count_list. Change all callers. (Output_segment::set_section_addresses): Rewrite. (Output_segment::set_offset): Rewrite. (Output_segment::find_first_and_last_list): Remove. (Output_segment::set_tls_offsets): Rewrite. (Output_segment::first_section_load_address): Likewise. (Output_segment::output_section_count): Likewise. (Output_segment::section_with_lowest_load_address): Likewise. (Output_segment::write_section_headers): Likewise. (Output_segment::print_sections_to_map): Likewise. * output.h (class Output_data): Remove dynamic_reloc_count_ field. Add has_dynamic_reloc_ field. Make bools into bitfields. (Output_data::add_dynamic_reloc): Rewrite. (Output_data::has_dynamic_reloc): New function. (Output_data::dynamic_reloc_count): Remove. (class Output_section): Add order_ field. Remvoe is_relro_local_, is_last_relro_, is_first_non_relro_, is_interp_, is_dynamic_linker_section_ fields. Add order and set_order functions. Remove is_relro_local, set_is_relro_local, is_last_relro, set_is_last_relro, is_first_non_relro, set_is_first_non_relro functions, is_interp, set_is_interp, is_dynamic_linker_section, and set_is_dynamic_linker_section functions. (class Output_segment): Change Output_data_list from std::list to std:;vector. Add output_lists_ field. Remove output_data_ and output_bss_ fields. Update declarations.
2010-08-02 * arm.cc (Target_arm::gc_process_relocs): Use typename.Ian Lance Taylor1-1/+1
* powerpc.cc (Target_powerpc::gc_process_relocs): Likewise. * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
2010-07-29 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add templateSriraman Tallam1-1/+2
paramter to the call to gold::gc_process_relocs. * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template paramter to the call to gold::gc_process_relocs. * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template parameter to the call to gold::gc_process_relocs. * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add template parameter to the call to gold::gc_process_relocs. * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template paramter to the call to gold::gc_process_relocs. * gc.h (get_embedded_addend_size): New function. (gc_process_relocs): Save the size of the reloc for use by ICF. * icf.cc (get_section_contents): Get the addend from the text section for SHT_REL relocation sections. * icf.h (Icf::Reloc_addend_size_info): New typedef. (Icf::Reloc_info): Add new member reloc_addend_size_info. * int_encoding.h (read_from_pointer): New overloaded function. * testsuite/Makefile.am (icf_sht_rel_addend_test): New test. * testsuite/icf_sht_rel_addend_test.sh: New file. * testsuite/icf_sht_rel_addend_test_1.cc: New file. * testsuite/icf_sht_rel_addend_test_2.cc: New file.