4d625b70fc
For MIPS-64, the r_info field in the relocation format is replaced by several individual fields, including r_sym and r_type. To enable support for this format, I've refactored target-independent code to remove almost all uses of the r_info field. (I've left alone a couple of routines used only for incremental linking, which I can update if/when the MIPS target adds support for incremental linking.) For routines that are already templated on a Classify_reloc class (namely, gc_process_relocs, relocate_section, and relocate_relocs), I've extended the Classify_reloc interface to include sh_type (which no longer needs to be a separate template parameter) as well as get_r_sym() and get_r_type() methods for extracting the r_sym and r_type fields. For scan_relocatable_relocs, I've extended the Default_scan_relocatable_relocs class by converting it to a class template with Classify_reloc as a template parameter. For the remaining routines that need to access r_sym, I've added a virtual Target::get_r_sym() method with an override for the MIPS target. In elfcpp, I've added Mips64_rel, etc., accessor classes and corresponding internal data structures. The MIPS target uses these new classes within its own Mips_classify_reloc class. The Mips64_ accessor classes also expose the r_ssym, r_type2, and r_type3 fields from the relocation. These changes should be functionally the same for all but the MIPS target. elfcpp/ * elfcpp.h (Mips64_rel, Mips64_rel_write): New classes. (Mips64_rela, Mips64_rela_write): New classes. * elfcpp_internal.h (Mips64_rel_data, Mips64_rela_data): New structs. gold/ * gc.h (get_embedded_addend_size): Remove sh_type parameter. (gc_process_relocs): Remove sh_type template parameter. Use Classify_reloc to access r_sym, r_type, and r_addend fields. * object.h (Sized_relobj_file::split_stack_adjust): Add target parameter. (Sized_relobj_file::split_stack_adjust_reltype): Likewise. * reloc-types.h (Reloc_types::copy_reloc_addend): (SHT_REL and SHT_RELA specializations) Remove. * reloc.cc (Emit_relocs_strategy): Rename and move to target-reloc.h. (Sized_relobj_file::emit_relocs_scan): Call Target::emit_relocs_scan(). (Sized_relobj_file::emit_relocs_scan_reltype): Remove. (Sized_relobj_file::split_stack_adjust): Add target parameter. Adjust all callers. (Sized_relobj_file::split_stack_adjust_reltype): Likewise. Call Target::get_r_sym() to get r_sym field from relocations. (Track_relocs::next_symndx): Call Target::get_r_sym(). * target-reloc.h (scan_relocs): Remove sh_type template parameter; add Classify_reloc template parameter. Use for accessing r_sym and r_type. (relocate_section): Likewise. (Default_classify_reloc): New class (renamed and moved from reloc.cc). (Default_scan_relocatable_relocs): Remove sh_type template parameter. (Default_scan_relocatable_relocs::Reltype): New typedef. (Default_scan_relocatable_relocs::reloc_size): New const. (Default_scan_relocatable_relocs::sh_type): New const. (Default_scan_relocatable_relocs::get_r_sym): New method. (Default_scan_relocatable_relocs::get_r_type): New method. (Default_emit_relocs_strategy): New class. (scan_relocatable_relocs): Replace sh_type template parameter with Scan_relocatable_relocs class. Use it to access r_sym and r_type fields. (relocate_relocs): Replace sh_type template parameter with Classify_reloc class. Use it to access r_sym and r_type fields. * target.h (Target::is_call_to_non_split): Replace r_type parameter with pointer to relocation. Adjust all callers. (Target::do_is_call_to_non_split): Likewise. (Target::emit_relocs_scan): New virtual method. (Sized_target::get_r_sym): New virtual method. * target.cc (Target::do_is_call_to_non_split): Replace r_type parameter with pointer to relocation. * aarch64.cc (Target_aarch64::emit_relocs_scan): New method. (Target_aarch64::Relocatable_size_for_reloc): Remove. (Target_aarch64::gc_process_relocs): Use Default_classify_reloc. (Target_aarch64::scan_relocs): Likewise. (Target_aarch64::relocate_section): Likewise. (Target_aarch64::Relocatable_size_for_reloc::get_size_for_reloc): Remove. (Target_aarch64::scan_relocatable_relocs): Use Default_classify_reloc. (Target_aarch64::relocate_relocs): Use Default_classify_reloc. * arm.cc (Target_arm::Arm_scan_relocatable_relocs): Remove sh_type template parameter. (Target_arm::emit_relocs_scan): New method. (Target_arm::Relocatable_size_for_reloc): Replace with... (Target_arm::Classify_reloc): ...this. (Target_arm::gc_process_relocs): Use Classify_reloc. (Target_arm::scan_relocs): Likewise. (Target_arm::relocate_section): Likewise. (Target_arm::scan_relocatable_relocs): Likewise. (Target_arm::relocate_relocs): Likewise. * i386.cc (Target_i386::emit_relocs_scan): New method. (Target_i386::Relocatable_size_for_reloc): Replace with... (Target_i386::Classify_reloc): ...this. (Target_i386::gc_process_relocs): Use Classify_reloc. (Target_i386::scan_relocs): Likewise. (Target_i386::relocate_section): Likewise. (Target_i386::scan_relocatable_relocs): Likewise. (Target_i386::relocate_relocs): Likewise. * mips.cc (Mips_scan_relocatable_relocs): Remove sh_type template parameter. (Mips_reloc_types): New class template. (Mips_classify_reloc): New class template. (Target_mips::Reltype): New typedef. (Target_mips::Relatype): New typedef. (Target_mips::emit_relocs_scan): New method. (Target_mips::get_r_sym): New method. (Target_mips::Relocatable_size_for_reloc): Replace with Mips_classify_reloc. (Target_mips::copy_reloc): Use Mips_classify_reloc. (Target_mips::gc_process_relocs): Likewise. (Target_mips::scan_relocs): Likewise. (Target_mips::relocate_section): Likewise. (Target_mips::scan_relocatable_relocs): Likewise. (Target_mips::relocate_relocs): Likewise. (mips_get_size_for_reloc): New function, factored out from Relocatable_size_for_reloc::get_size_for_reloc. (Target_mips::Scan::local): Use Mips_classify_reloc. (Target_mips::Scan::global): Likewise. (Target_mips::Relocate::relocate): Likewise. * powerpc.cc (Target_powerpc::emit_relocs_scan): New method. (Target_powerpc::Relocatable_size_for_reloc): Remove. (Target_powerpc::gc_process_relocs): Use Default_classify_reloc. (Target_powerpc::scan_relocs): Likewise. (Target_powerpc::relocate_section): Likewise. (Powerpc_scan_relocatable_reloc): Convert to class template. (Powerpc_scan_relocatable_reloc::Reltype): New typedef. (Powerpc_scan_relocatable_reloc::reloc_size): New const. (Powerpc_scan_relocatable_reloc::sh_type): New const. (Powerpc_scan_relocatable_reloc::get_r_sym): New method. (Powerpc_scan_relocatable_reloc::get_r_type): New method. (Target_powerpc::scan_relocatable_relocs): Use Powerpc_scan_relocatable_reloc. (Target_powerpc::relocate_relocs): Use Default_classify_reloc. * s390.cc (Target_s390::emit_relocs_scan): New method. (Target_s390::Relocatable_size_for_reloc): Remove. (Target_s390::gc_process_relocs): Use Default_classify_reloc. (Target_s390::scan_relocs): Likewise. (Target_s390::relocate_section): Likewise. (Target_s390::Relocatable_size_for_reloc::get_size_for_reloc): Remove. (Target_s390::scan_relocatable_relocs): Use Default_classify_reloc. (Target_s390::relocate_relocs): Use Default_classify_reloc. * sparc.cc (Target_sparc::emit_relocs_scan): New method. (Target_sparc::Relocatable_size_for_reloc): Remove. (Target_sparc::gc_process_relocs): Use Default_classify_reloc. (Target_sparc::scan_relocs): Likewise. (Target_sparc::relocate_section): Likewise. (Target_sparc::Relocatable_size_for_reloc::get_size_for_reloc): Remove. (Target_sparc::scan_relocatable_relocs): Use Default_classify_reloc. (Target_sparc::relocate_relocs): Use Default_classify_reloc. * tilegx.cc (Target_tilegx::emit_relocs_scan): New method. (Target_tilegx::Relocatable_size_for_reloc): Remove. (Target_tilegx::gc_process_relocs): Use Default_classify_reloc. (Target_tilegx::scan_relocs): Likewise. (Target_tilegx::relocate_section): Likewise. (Target_tilegx::Relocatable_size_for_reloc::get_size_for_reloc): Remove. (Target_tilegx::scan_relocatable_relocs): Use Default_classify_reloc. (Target_tilegx::relocate_relocs): Use Default_classify_reloc. * x86_64.cc (Target_x86_64::emit_relocs_scan): New method. (Target_x86_64::Relocatable_size_for_reloc): Remove. (Target_x86_64::gc_process_relocs): Use Default_classify_reloc. (Target_x86_64::scan_relocs): Likewise. (Target_x86_64::relocate_section): Likewise. (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc): Remove. (Target_x86_64::scan_relocatable_relocs): Use Default_classify_reloc. (Target_x86_64::relocate_relocs): Use Default_classify_reloc. * testsuite/testfile.cc (Target_test::emit_relocs_scan): New method. |
||
---|---|---|
.. | ||
arm_abs_global.s | ||
arm_abs_global.sh | ||
arm_abs_lib.s | ||
arm_attr_merge.sh | ||
arm_attr_merge_6a.s | ||
arm_attr_merge_6b.s | ||
arm_attr_merge_7a.s | ||
arm_attr_merge_7b.s | ||
arm_bl_in_range.s | ||
arm_bl_out_of_range.s | ||
arm_branch_in_range.sh | ||
arm_branch_out_of_range.sh | ||
arm_branch_range.t | ||
arm_cortex_a8.sh | ||
arm_cortex_a8_b.s | ||
arm_cortex_a8_b_cond.s | ||
arm_cortex_a8_b_local.s | ||
arm_cortex_a8_bl.s | ||
arm_cortex_a8_blx.s | ||
arm_cortex_a8_local.s | ||
arm_cortex_a8_local_reloc.s | ||
arm_exidx_test.s | ||
arm_exidx_test.sh | ||
arm_farcall_arm_arm.s | ||
arm_farcall_arm_arm.sh | ||
arm_farcall_arm_thumb.s | ||
arm_farcall_arm_thumb.sh | ||
arm_farcall_thumb_arm.s | ||
arm_farcall_thumb_arm.sh | ||
arm_farcall_thumb_thumb.s | ||
arm_farcall_thumb_thumb.sh | ||
arm_fix_1176.s | ||
arm_fix_1176.sh | ||
arm_fix_v4bx.s | ||
arm_fix_v4bx.sh | ||
arm_thm_jump8.s | ||
arm_thm_jump8.t | ||
arm_thm_jump11.s | ||
arm_thm_jump11.t | ||
arm_unaligned_reloc.s | ||
arm_unaligned_reloc.sh | ||
basic_test.cc | ||
binary.in | ||
binary_test.cc | ||
binary_unittest.cc | ||
common_test_1.c | ||
common_test_1_v1.c | ||
common_test_1_v2.c | ||
common_test_2.c | ||
common_test_3.c | ||
constructor_test.cc | ||
copy_test.cc | ||
copy_test_1.cc | ||
copy_test_2.cc | ||
copy_test_v1.cc | ||
debug_msg.cc | ||
debug_msg.sh | ||
defsym_test.c | ||
defsym_test.sh | ||
discard_locals_relocatable_test.c | ||
discard_locals_test.c | ||
discard_locals_test.sh | ||
dwp_test.h | ||
dwp_test_1.cc | ||
dwp_test_1.s | ||
dwp_test_1.sh | ||
dwp_test_1b.cc | ||
dwp_test_1b.s | ||
dwp_test_2.cc | ||
dwp_test_2.s | ||
dwp_test_2.sh | ||
dwp_test_main.cc | ||
dwp_test_main.s | ||
dyn_weak_ref.sh | ||
dyn_weak_ref_1.c | ||
dyn_weak_ref_2.c | ||
dynamic_list.sh | ||
dynamic_list.t | ||
dynamic_list_2.cc | ||
dynamic_list_2.t | ||
dynamic_list_lib1.cc | ||
dynamic_list_lib2.cc | ||
eh_test_a.cc | ||
eh_test_b.cc | ||
ehdr_start_def.cc | ||
ehdr_start_test.cc | ||
ehdr_start_test.t | ||
ehdr_start_test_4.sh | ||
exception_test.h | ||
exception_test_1.cc | ||
exception_test_2.cc | ||
exception_test_main.cc | ||
exclude_libs_test.c | ||
exclude_libs_test.sh | ||
exclude_libs_test_1.c | ||
exclude_libs_test_2.c | ||
exclude_libs_test_3.c | ||
final_layout.cc | ||
final_layout.sh | ||
gc_comdat_test.sh | ||
gc_comdat_test_1.cc | ||
gc_comdat_test_2.cc | ||
gc_dynamic_list_test.c | ||
gc_dynamic_list_test.sh | ||
gc_dynamic_list_test.t | ||
gc_orphan_section_test.cc | ||
gc_orphan_section_test.sh | ||
gc_tls_test.cc | ||
gc_tls_test.sh | ||
gdb_index_test.cc | ||
gdb_index_test_1.sh | ||
gdb_index_test_2.sh | ||
gdb_index_test_2_gabi.sh | ||
gdb_index_test_3.c | ||
gdb_index_test_3.sh | ||
gdb_index_test_4.sh | ||
gdb_index_test_comm.sh | ||
hidden_test.sh | ||
hidden_test_1.c | ||
hidden_test_main.c | ||
i386_mov_to_lea.sh | ||
i386_mov_to_lea1.s | ||
i386_mov_to_lea2.s | ||
i386_mov_to_lea3.s | ||
i386_mov_to_lea4.s | ||
i386_mov_to_lea5.s | ||
icf_keep_unique_test.cc | ||
icf_keep_unique_test.sh | ||
icf_preemptible_functions_test.cc | ||
icf_preemptible_functions_test.sh | ||
icf_safe_so_test.cc | ||
icf_safe_so_test.sh | ||
icf_safe_test.cc | ||
icf_safe_test.sh | ||
icf_sht_rel_addend_test.sh | ||
icf_sht_rel_addend_test_1.cc | ||
icf_sht_rel_addend_test_2.cc | ||
icf_string_merge_test.cc | ||
icf_string_merge_test.sh | ||
icf_test.cc | ||
icf_test.sh | ||
icf_virtual_function_folding_test.cc | ||
ifunc-sel.h | ||
ifuncdep2.c | ||
ifuncmain1.c | ||
ifuncmain1vis.c | ||
ifuncmain2.c | ||
ifuncmain3.c | ||
ifuncmain4.c | ||
ifuncmain5.c | ||
ifuncmain6pie.c | ||
ifuncmain7.c | ||
ifuncmod1.c | ||
ifuncmod3.c | ||
ifuncmod5.c | ||
ifuncmod6.c | ||
ifuncvar1.c | ||
ifuncvar2.c | ||
ifuncvar3.c | ||
incr_comdat_test_1.cc | ||
incr_comdat_test_2_v1.cc | ||
incr_comdat_test_2_v2.cc | ||
incr_comdat_test_2_v3.cc | ||
incremental_test.sh | ||
incremental_test_1.c | ||
incremental_test_2.c | ||
initpri1.c | ||
initpri2.c | ||
initpri3.c | ||
justsyms.t | ||
justsyms_1.cc | ||
justsyms_2.cc | ||
justsyms_exec.c | ||
justsyms_lib.c | ||
large.c | ||
large_symbol_alignment.cc | ||
leb128_unittest.cc | ||
Makefile.am | ||
Makefile.in | ||
many_sections_test.cc | ||
memory_test.s | ||
memory_test.sh | ||
memory_test.t | ||
memory_test_inc.t | ||
memory_test_inc_1.t.src | ||
memory_test_inc_2.t.src | ||
memory_test_inc_3.t.src | ||
merge_string_literals.sh | ||
merge_string_literals_1.cc | ||
merge_string_literals_2.cc | ||
missing_key_func.cc | ||
missing_key_func.sh | ||
no_version_test.c | ||
no_version_test.sh | ||
object_unittest.cc | ||
odr_header1.h | ||
odr_header2.h | ||
odr_violation1.cc | ||
odr_violation2.cc | ||
pie_copyrelocs_shared_test.cc | ||
pie_copyrelocs_test.cc | ||
plugin_common_test_1.c | ||
plugin_common_test_2.c | ||
plugin_final_layout.cc | ||
plugin_final_layout.sh | ||
plugin_section_order.c | ||
plugin_test.c | ||
plugin_test_1.sh | ||
plugin_test_2.sh | ||
plugin_test_3.sh | ||
plugin_test_4.sh | ||
plugin_test_6.sh | ||
plugin_test_7.sh | ||
plugin_test_7_1.c | ||
plugin_test_7_2.c | ||
plugin_test_10.sh | ||
plugin_test_11.sh | ||
plugin_test_tls.sh | ||
pr12826.sh | ||
pr12826_1.s | ||
pr12826_2.s | ||
pr14265.c | ||
pr14265.sh | ||
pr14265.t | ||
pr18689.c | ||
pr18689.sh | ||
protected_1.cc | ||
protected_2.cc | ||
protected_3.cc | ||
protected_4.cc | ||
protected_main_1.cc | ||
protected_main_2.cc | ||
protected_main_3.cc | ||
relro_script_test.t | ||
relro_test.cc | ||
relro_test.sh | ||
relro_test_main.cc | ||
retain_symbols_file_test.sh | ||
script_test_1.h | ||
script_test_1.t | ||
script_test_1a.cc | ||
script_test_1b.cc | ||
script_test_2.cc | ||
script_test_2.t | ||
script_test_2a.cc | ||
script_test_2b.cc | ||
script_test_3.sh | ||
script_test_3.t | ||
script_test_4.sh | ||
script_test_4.t | ||
script_test_5.cc | ||
script_test_5.sh | ||
script_test_5.t | ||
script_test_6.sh | ||
script_test_6.t | ||
script_test_7.sh | ||
script_test_7.t | ||
script_test_8.sh | ||
script_test_9.cc | ||
script_test_9.sh | ||
script_test_9.t | ||
script_test_10.s | ||
script_test_10.sh | ||
script_test_10.t | ||
script_test_11.h | ||
script_test_11.t | ||
script_test_11a.c | ||
script_test_11b.c | ||
script_test_12.t | ||
script_test_12a.c | ||
script_test_12b.c | ||
script_test_12i.t | ||
searched_file_test.cc | ||
searched_file_test_lib.cc | ||
section_sorting_name.cc | ||
section_sorting_name.sh | ||
split_i386.sh | ||
split_i386_1.s | ||
split_i386_2.s | ||
split_i386_3.s | ||
split_i386_4.s | ||
split_i386_n.s | ||
split_x32.sh | ||
split_x32_1.s | ||
split_x32_2.s | ||
split_x32_3.s | ||
split_x32_4.s | ||
split_x32_n.s | ||
split_x86_64.sh | ||
split_x86_64_1.s | ||
split_x86_64_2.s | ||
split_x86_64_3.s | ||
split_x86_64_4.s | ||
split_x86_64_n.s | ||
start_lib_test_1.c | ||
start_lib_test_2.c | ||
start_lib_test_3.c | ||
start_lib_test_main.c | ||
strong_ref_weak_def.sh | ||
strong_ref_weak_def_1.c | ||
strong_ref_weak_def_2.c | ||
test.cc | ||
test.h | ||
testfile.cc | ||
testfile.h | ||
testmain.cc | ||
text_section_grouping.cc | ||
text_section_grouping.sh | ||
thin_archive_main.cc | ||
thin_archive_test_1.cc | ||
thin_archive_test_2.cc | ||
thin_archive_test_3.cc | ||
thin_archive_test_4.cc | ||
thumb2_branch_range.t | ||
thumb_bl_in_range.s | ||
thumb_bl_out_of_range.s | ||
thumb_bl_out_of_range_local.s | ||
thumb_blx_in_range.s | ||
thumb_blx_out_of_range.s | ||
thumb_branch_range.t | ||
tls_pie_test.sh | ||
tls_test.cc | ||
tls_test.h | ||
tls_test_c.c | ||
tls_test_file2.cc | ||
tls_test_main.cc | ||
two_file_shared.sh | ||
two_file_test.h | ||
two_file_test_1.cc | ||
two_file_test_1_v1.cc | ||
two_file_test_1b.cc | ||
two_file_test_1b_v1.cc | ||
two_file_test_2.cc | ||
two_file_test_2_tls.cc | ||
two_file_test_2_v1.cc | ||
two_file_test_main.cc | ||
two_file_test_tls.cc | ||
undef_symbol.cc | ||
undef_symbol.sh | ||
undef_symbol_main.cc | ||
ver_matching_def.cc | ||
ver_matching_test.sh | ||
ver_test.h | ||
ver_test_1.cc | ||
ver_test_1.sh | ||
ver_test_2.cc | ||
ver_test_2.script | ||
ver_test_2.sh | ||
ver_test_3.cc | ||
ver_test_4.cc | ||
ver_test_4.script | ||
ver_test_4.sh | ||
ver_test_5.cc | ||
ver_test_5.script | ||
ver_test_5.sh | ||
ver_test_6.c | ||
ver_test_7.cc | ||
ver_test_7.sh | ||
ver_test_8.script | ||
ver_test_9.cc | ||
ver_test_10.script | ||
ver_test_10.sh | ||
ver_test_13.c | ||
ver_test_13.script | ||
ver_test_13.sh | ||
ver_test_main.cc | ||
ver_test_main_2.cc | ||
version_script.map | ||
weak_alias_test.script | ||
weak_alias_test_1.cc | ||
weak_alias_test_2.cc | ||
weak_alias_test_3.cc | ||
weak_alias_test_4.cc | ||
weak_alias_test_5.cc | ||
weak_alias_test_main.cc | ||
weak_plt.sh | ||
weak_plt_main.cc | ||
weak_plt_shared.cc | ||
weak_test.cc | ||
weak_undef.h | ||
weak_undef_file1.cc | ||
weak_undef_file2.cc | ||
weak_undef_file3.cc | ||
weak_undef_file4.cc | ||
weak_undef_test.cc | ||
weak_undef_test_2.cc | ||
weak_unresolved_symbols_test.cc | ||
x86_64_mov_to_lea.sh | ||
x86_64_mov_to_lea1.s | ||
x86_64_mov_to_lea2.s | ||
x86_64_mov_to_lea3.s | ||
x86_64_mov_to_lea4.s |