aboutsummaryrefslogtreecommitdiff
path: root/gold
AgeCommit message (Collapse)AuthorFilesLines
2016-06-13Add .got.plt to testsuite/script_test_2.tH.J. Lu2-0/+6
The .got.plt section must be placed right after the .got section. Otherwise, GOT offset will be wrong. PR gold/20246 * testsuite/script_test_2.t: Add .got.plt after .got.
2016-06-11Add support for .MIPS.abiflags and .gnu.attributes sections.Vladimir Radosavljevic2-62/+819
elfcpp/ * elfcpp.h (SHT_MIPS_ABIFLAGS): New enum constant. * mips.h (EF_MIPS_FP64, EF_MIPS_NAN2008): New enum constants for processor-specific flags. (E_MIPS_MACH_5900): New enum constant for machine variant. (AFL_REG_NONE, AFL_REG_32, AFL_REG_64, AFL_REG_128): New enum constants. (AFL_ASE_DSP, AFL_ASE_DSPR2, AFL_ASE_EVA, AFL_ASE_MCU, AFL_ASE_MDMX, AFL_ASE_MIPS3D, AFL_ASE_MT, AFL_ASE_SMARTMIPS, AFL_ASE_VIRT, AFL_ASE_MSA, AFL_ASE_MIPS16, AFL_ASE_MICROMIPS, AFL_ASE_XPA): Likewise. (AFL_EXT_XLR, AFL_EXT_OCTEON2, AFL_EXT_OCTEONP, AFL_EXT_LOONGSON_3A, AFL_EXT_OCTEON, AFL_EXT_5900, AFL_EXT_4650, AFL_EXT_4010, AFL_EXT_4100, AFL_EXT_3900, AFL_EXT_10000, AFL_EXT_SB1, AFL_EXT_4111, AFL_EXT_4120, AFL_EXT_5400, AFL_EXT_5500, AFL_EXT_LOONGSON_2E, AFL_EXT_LOONGSON_2F, AFL_EXT_OCTEON3): Likewise. (Tag_GNU_MIPS_ABI_FP, Tag_GNU_MIPS_ABI_MSA): Likewise. (Val_GNU_MIPS_ABI_FP_ANY, Val_GNU_MIPS_ABI_FP_DOUBLE, Val_GNU_MIPS_ABI_FP_SINGLE, Val_GNU_MIPS_ABI_FP_SOFT, Val_GNU_MIPS_ABI_FP_OLD_64,Val_GNU_MIPS_ABI_FP_XX, Val_GNU_MIPS_ABI_FP_64, Val_GNU_MIPS_ABI_FP_64A, Val_GNU_MIPS_ABI_FP_NAN2008, Val_GNU_MIPS_ABI_MSA_ANY, Val_GNU_MIPS_ABI_MSA_128): Likewise. (AFL_FLAGS1_ODDSPREG): New enum constant. gold/ * mips.cc (struct Mips_abiflags): New struct. (Mips_relobj::Mips_relobj): Initialize attributes_section_data_ and abiflags_. (Mips_relobj::~Mips_relobj): Delete object pointed by attributes_section_data_. (Mips_relobj::abiflags): New method. (Mips_relobj::attributes_section_data): Likewise. (Mips_relobj::attributes_section_data_): New data member. (Mips_relobj::abiflags_): Likewise. (class Mips_output_section_abiflags): New class. (Target_mips::Target_mips): Initialize attributes_section_data_, abiflags_ and has_abiflags_section_. (Target_mips::do_should_include_section): Don't emit input .MIPS.abiflags sections to output .MIPS.abiflags. (Target_mips::Mips_mach): Add new enum constants. (Target_mips::mips_isa_ext_mach): New method. (Target_mips::mips_isa_ext): Likewise. (Target_mips::update_abiflags_isa): Likewise. (Target_mips::infer_abiflags): Likewise. (Target_mips::create_abiflags): Likewise. (Target_mips::fp_abi_string): Likewise. (Target_mips::select_fp_abi): Likewise. (Target_mips::merge_obj_attributes): Likewise. (Target_mips::merge_obj_abiflags): Likewise. (Target_mips::level_rev): Likewise. (Target_mips::merge_obj_e_flags): Rename from merge_processor_specific_flags. Remove dyn_obj argument, call update_abiflags_isa when needed, compare NaN encodings and compare FP64 state. (Target_mips::add_machine_extensions): Add two machine extensions and fix one. (Target_mips::attributes_section_data_): New data member. (Target_mips::abiflags_): Likewise. (Target_mips::has_abiflags_section_): Likewise. (Mips_relobj::do_read_symbols): Read .gnu.attributes and .MIPS.abiflags sections if they exists. (Target_mips::elf_mips_mach): Add E_MIPS_MACH_5900 and E_MIPS_MACH_OCTEON3 support. (Target_mips::do_adjust_elf_header): Setup EI_ABIVERSION flag. (Target_mips::do_finalize_sections): Merge .gnu.attributes and .MIPS.abiflags sections from input. Create these sections if needed. (Target_mips::elf_mips_mach_name): Add E_MIPS_MACH_5900 and E_MIPS_MACH_OCTEON3 support, and change strings for E_MIPS_MACH_LS2E, E_MIPS_MACH_LS2F and E_MIPS_MACH_LS3A just to match bfd.
2016-06-10Fix problems emitting MIPS .reginfo section.Vladimir Radosavljevic2-81/+80
gold/ * mips.cc (Mips_relobj::Mips_relobj): Initialize has_reginfo_section_. (Mips_relobj::has_reginfo_section_): New data member. (Mips_relobj::has_reginfo_section): New method. (class Mips_output_section_reginfo): Change base class to Output_section_data, and set masks of the output .reginfo section in constructor. (Mips_output_section_reginfo::as_mips_output_section_reginfo): Remove. (Mips_output_section_reginfo::set_masks): Likewise. (Mips_output_section_reginfo::set_final_data_size): Likewise. (Mips_output_section_reginfo::do_print_to_mapfile): New method. (Target_mips::do_make_output_section): Remove. (Mips_relobj::do_read_symbols): Set has_reginfo_section_ to true if the object contains a .reginfo section. (Target_mips::do_finalize_sections): Create a .reginfo output section if needed.
2016-06-09Fix compilation error in mips.cc with some versions of GCC.Artemiy Volkov2-2/+10
gold/ * mips.cc (Mips_output_data_got::do_write): Add missing template args via typedef.
2016-05-30gold/s390: Fix compilation on gcc 4.4Marcin Kościelnicki2-66/+162
gold/ChangeLog: PR/19960 * s390.cc (Target_s390::ss_code_st_r14): Removed. (Target_s390::ss_code_l_r14): Removed. (Target_s390::ss_code_ear): Removed. (Target_s390::ss_code_c): Removed. (Target_s390::ss_match_st_r14): New function. (Target_s390::ss_match_l_r14): New function. (Target_s390::ss_match_mcount): Call ss_match_{l,st}_r14 instead of matching code directly. (Target_s390::ss_match_ear): New function. (Target_s390::ss_match_c): New function. (Target_s390::do_calls_non_split): Call ss_match_{ear,c} instead of matching code directly.
2016-05-19Don't allow COPY relocations for protected symbols.Cary Coutant13-92/+265
gold/ PR gold/19823 * copy-relocs.cc (Copy_relocs::make_copy_reloc): Add object parameter; check for protected symbol. * copy-relocs.h (Copy_relocs::make_copy_reloc): Add object parameter. * mips.cc (Mips_copy_relocs): Adjust call to make_copy_reloc. * symtab.cc (Symbol::init_fields): Initialize is_protected_. (Symbol_table::add_from_dynobj): Mark protected symbols. * symtab.h (Symbol::is_protected): New method. (Symbol::set_is_protected): New method. (Symbol::is_protected_): New data member. * testsuite/Makefile.am (copy_test_protected): New test. * testsuite/Makefile.in: Regenerate. * testsuite/copy_test.cc (main): Add legal reference to protected symbol. * testsuite/copy_test_v1.cc (main): Likewise. * testsuite/copy_test_2.cc (ip): Add protected symbol. * testsuite/copy_test_protected.cc: New test source file. * testsuite/copy_test_protected.sh: New test script.
2016-05-19Fix non-deterministic behavior when generating MIPS GOT.Vladimir Radosavljevic2-52/+106
* mips.cc (Mips_got_entry::Mips_got_entry): Remove object argument for global got symbols, and set addend to 0. (Mips_got_entry::hash): Change hash algorithm. (Mips_got_entry::equals): Refactor. (Mips_got_entry::object): Return input object for local got symbols from union d. (Mips_got_entry::addend): Change return of the relocation addend. (Mips_got_entry::addend_): Move from union d. (Mips_got_entry::object_): Move into union d. (class Mips_symbol_hash): New class. (Mips_got_info::Global_got_entry_set): New type. (Mips_got_info::global_got_symbols): Change return type to Global_got_entry_set. (Mips_got_info::global_got_symbols_): Change type to Global_got_entry_set. (Mips_symbol::hash): New method. (Mips_output_data_la25_stub::symbols_): Change type to std::vector. (Mips_output_data_mips_stubs::Mips_stubs_entry_set): New type. (Mips_output_data_mips_stubs::symbols_): Change type to Mips_stubs_entry_set. (Mips_got_info::record_global_got_symbol): Don't pass object argument when creating global got symbol. (Mips_got_info::record_got_entry): Remove find before inserting got entries. (Mips_got_info::add_reloc_only_entries): Change type of iterator to Global_got_entry_set. (Mips_got_info::count_got_symbols): Likewise. (Mips_output_data_la25_stub::create_la25_stub): Use push_back for adding entries to symbols_. (Mips_output_data_la25_stub::do_write): Change type of iterator to std::vector. (Mips_output_data_mips_stubs::set_lazy_stub_offsets): Change type of iterator to Mips_stubs_entry_set. (Mips_output_data_mips_stubs::set_needs_dynsym_value): Likewise. (Mips_output_data_mips_stubs::do_write): Likewise.
2016-05-09Fix for PR gold/19987.Han Shen3-4/+30
2016-05-09Regenerate configureAlan Modra1-6/+10
2016-04-28Updated Chinese (simplified) translations for bfd, binutils and gold.Nick Clifton2-86/+79
2016-04-15Regenerate Makefile.in/aclocal.m4 automake 1.11.6H.J. Lu4-528/+643
bfd/ * Makefile.in: Regenerated with automake 1.11.6. * aclocal.m4: Likewise. * doc/Makefile.in: Likewise. binutils/ * Makefile.in: Regenerated with automake 1.11.6. * aclocal.m4: Likewise. * doc/Makefile.in: Likewise. gas/ * Makefile.in: Regenerated with automake 1.11.6. * aclocal.m4: Likewise. * doc/Makefile.in: Likewise. gold/ * Makefile.in: Regenerated with automake 1.11.6. * aclocal.m4: Likewise. * testsuite/Makefile.in: Likewise. gprof/ * Makefile.in: Regenerated with automake 1.11.6. * aclocal.m4: Likewise. ld/ * Makefile.in: Regenerated with automake 1.11.6. * aclocal.m4: Likewise. opcodes/ * Makefile.in: Regenerated with automake 1.11.6. * aclocal.m4: Likewise.
2016-03-31enable -Wwrite-strings for gasTrevor Saunders1-0/+16
We add a new AC_SUBST to warning.m4 so that the test if the warning is supported is centralized, but the warning can be enabled per directory. binutils/ChangeLog: 2016-03-31 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * configure: Regenerate. gprof/ChangeLog: 2016-03-31 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * configure: Regenerate. ld/ChangeLog: 2016-03-31 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * configure: Regenerate. opcodes/ChangeLog: 2016-03-31 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * configure: Regenerate. bfd/ChangeLog: 2016-03-31 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * configure: Regenerate. * warning.m4: Add WARN_WRITE_STRINGS AC_SUBST. gold/ChangeLog: 2016-03-31 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * configure: Regenerate. gas/ChangeLog: 2016-03-31 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * Makefile.am: Add WARN_WRITE_STRINGS to WARN_CFLAGS. * Makefile.in: Regenerate. * configure: Likewise.
2016-03-30Don't override definition a shared object by one in a later shared object.Cary Coutant2-0/+13
In PR 16979, a reference to malloc is being resolved to an unversioned reference in libmalloc.so. When linked with --as-needed, however, the dynamic table does not list libmalloc.so as a DT_NEEDED library. If we have a reference to an unversioned symbol in a shared object, and we later see a versioned definition in another shared object, we were overriding the first definition with the second in the process of defining the default version. As a result, we no longer think that the first shared object was actually needed to resolve any symbols, and we don't list it as a DT_NEEDED library. This patch fixes the problem by treating the two definitions as separate symbols, so the second definition does not override the first. 2016-03-30 Cary Coutant <ccoutant@gmail.com> gold/ PR gold/16979 * symtab.cc (Symbol_table::define_default_version): Check for case where symbols are both in different shared objects.
2016-03-27Fix failure to diagnose GOTOFF relocation to undef symbol in shared lib (i386).Cary Coutant2-0/+23
gold/ PR gold/16111 * i386.cc (Target_i386): Add check for fully-resolved symbol for R_386_GOTOFF.
2016-03-22Add -Wstack-usage to the gcc warning flags list, but only if using a ↵Nick Clifton2-1/+23
sufficiently recent version of gcc. bfd * warning.m4 (GCC_WARN_CFLAGS): Only add -Wstack-usage if using a sufficiently recent version of GCC. * configure: Regenerate. others * configure: Regenerate.
2016-03-21Fix problem where gold fails to issue an undefined symbol error during LTO.Cary Coutant7-2/+143
During LTO, if (1) an IR file contains a COMDAT group that is kept, (2) a later non-claimed file contains the same group, which we discard, and (3) the plugin fails to provide a definition of the symbols in that COMDAT group, gold silently resolves any references to those symbols to 0. This patch adds a check for a placeholder symbol when deciding whether to issue an undefined symbol error. It also adds an extra note after any undefined placeholder symbol error that explains that a definition was expected from the plugin. gold/ PR gold/19842 * errors.cc (Errors::undefined_symbol): Add info message when symbol should have been provided by a plugin. * target-reloc.h (issue_undefined_symbol_error): Check for placeholder symbols defined in discarded sections. * testsuite/Makefile.am (plugin_test_9b): New test case. * testsuite/Makefile.in: Regenerate. * testsuite/plugin_test_9b_elf.cc: New test source file. * testsuite/plugin_test_9b_ir.cc: New test source file.
2016-03-21Remove use of alloca.Nick Clifton1-1/+1
bfd * warning.m4 (GCC_WARN_CFLAGS): Add -Wstack-usage=262144 * configure: Regenerate. * elf32-m68hc1x.c (elf32_m68hc11_relocate_section): Replace use of alloca with call to xmalloc. * elf32-nds32.c: Likewise. * elf64-hppa.c: Likewise. * elfxx-mips.c: Likewise. * pef.c: Likewise. * pei-x86_64.c: Likewise. * som.c: Likewise. * xsym.c: Likewise. binutils * dlltool.c: Replace use of alloca with call to xmalloc. * dllwrap.c: Likewise. * nlmconv.c: Likewise. * objdump.c: Likewise. * resrc.c: Likewise. * winduni.c: Likewise. * configure: Regenerate. gas * atof-generic.c: Replace use of alloca with call to xmalloc. * cgen.c: Likewise. * dwarf2dbg.c: Likewise. * macro.c: Likewise. * remap.c: Likewise. * stabs.c: Likewise. * symbols.c: Likewise. * config/obj-elf.c: Likewise. * config/tc-aarch64.c: Likewise. * config/tc-arc.c: Likewise. * config/tc-arm.c: Likewise. * config/tc-avr.c: Likewise. * config/tc-ia64.c: Likewise. * config/tc-mips.c: Likewise. * config/tc-msp430.c: Likewise. * config/tc-nds32.c: Likewise. * config/tc-ppc.c: Likewise. * config/tc-sh.c: Likewise. * config/tc-tic30.c: Likewise. * config/tc-tic54x.c: Likewise. * config/tc-xstormy16.c: Likewise. * config/te-vms.c: Likewise. * configure: Regenerate. ld * emultempl/msp430.em: Replace use of alloca with call to xmalloc. * plugin.c: Likewise. * pe-dll.c: Likewise.
2016-03-20Fix problem where gold cannot build .eh_frame_hdr from ld -r output.Cary Coutant7-12/+145
When running ld -r on objects that have comdat groups, when gold deduplicates a function in a comdat group, it removes the relocations from the EH information that referred to the dropped copy of the function. When running a final link using the result of the -r link, the missing relocation cause it to fail to recognize the FDE for the dropped function. This patch improves gold's FDE scanning to take into account the possibility that an FDE corresponds to a dropped function, and drops that FDE as well. Gnu ld, on the other hand, leaves the relocations in the ld -r output, but makes them R_NONE with an r_sym field of 0. This was sufficient to let both linkers recognize the FDE properly. With this fix, if you do an ld -r with gold, then do the final link with Gnu ld, the .eh_frame_hdr section will not be generated. To make it work with Gnu ld, we would have to leave the R_NONE relocations in, but I think it's better to drop the relocations entirely. I'd hope that if you're doing a -r link with gold, you'll also do the final link with gold. gold/ PR gold/19002 * ehframe.cc (Eh_frame::read_fde): Check for dropped functions. * testsuite/Makefile.am (eh_test_2): New test. * testsuite/Makefile.in: Regenerate. * testsuite/eh_test_2.sh: New test script. * testsuite/eh_test_a.cc (bar): Make it comdat. * testsuite/eh_test_b.cc (bar): Add a duplicate copy.
2016-03-18Remove is_n64_ data member from Mips_relobj class.Vladimir Radosavljevic2-44/+39
elfcpp/ * mips.h (abi_64): Remove. gold/ * mips.cc (Mips_relobj::is_n64_): Remove. (Target_mips::ei_class_): Likewise. (Mips_relobj::is_newabi): Call methods. (Mips_relobj::is_n64): Change checking for N64 ABI. (Target_mips::is_output_n64): Likewise. (Target_mips::merge_processor_specific_flags): Remove ei_class argument, and remove comparing ei_class. (Target_mips::do_adjust_elf_header): Remove setting EI_CLASS field of the ELF header. (Target_mips::do_finalize_sections): Don't pass ei_class argument to merge_processor_specific_flags. (Target_mips::elf_mips_abi_name): Remove ei_class argument, and change checking for N64 ABI.
2016-03-17Add MIPS-64 support.Vladimir Radosavljevic2-635/+1413
gold/ * mips.cc (enum Special_relocation_symbol): New enum type. (is_readonly_section): New function. (eh_reloc): Likewise. (Mips_got_entry::is_section_symbol_): New member. (Mips_got_entry::is_section_symbol): New method. (Mips_got_info::record_local_got_symbol): Add is_section_symbol argument. (Mips_relobj::mips_elf_options_section_name): New method. (Mips_output_data_got::record_local_got_symbol): Add is_section_symbol argument, and pass it to Mips_got_info::record_local_got_symbol. (Mips_output_data_got::got_offset): Add addend argument, and pass it to Relobj::local_got_offset. (struct Mips_output_reloc_writer): New type. (class Mips_output_data_reloc): New class. (Mips_output_data_plt::Reloc_section): Change type to Mips_output_data_reloc. (Target_mips::Reloc_section): Likewise. (Mips_reloc_types::get_r_addend): Remove unsigned from return type. (Mips_classify_reloc::get_r_type2): New method. (Mips_classify_reloc::get_r_type3): Likewise. (Mips_classify_reloc::get_r_ssym): Likewise. (Target_mips::Reloca_section): Remove. (Relocate::should_apply_static_reloc): Rename from should_apply_r_mips_32_reloc. (Target_mips::copy_reloc): Replace Reltype parameter with r_type and r_offset. (Mips_relocate_functions::Valtype): New type. (Mips_relocate_functions::Valtype64): New type. (Mips_relocate_functions::check_overflow): New method. (Mips_relocate_functions::mips_reloc_unshuffle): Move to public interface. (Mips_relocate_functions::mips_reloc_shuffle): Likewise. (Mips_relocate_functions::rel16): Add support for resolving relocations for Mips64. (Mips_relocate_functions::rel32): Likewise. (Mips_relocate_functions::reljalr): Likewise. (Mips_relocate_functions::relpc32): Likewise. (Mips_relocate_functions::rel26): Likewise. (Mips_relocate_functions::relpc16): Likewise. (Mips_relocate_functions::relmicromips_pc7_s1): Likewise. (Mips_relocate_functions::relmicromips_pc10_s1): Likewise. (Mips_relocate_functions::relmicromips_pc16_s1): Likewise. (Mips_relocate_functions::do_relhi16): Likewise. (Mips_relocate_functions::do_relgot16_local): Likewise. (Mips_relocate_functions::rello16): Likewise. (Mips_relocate_functions::relgot): Likewise. (Mips_relocate_functions::relgotpage): Likewise. (Mips_relocate_functions::relgotofst): Likewise. (Mips_relocate_functions::relgot_hi16): Likewise. (Mips_relocate_functions::relgot_lo16): Likewise. (Mips_relocate_functions::relgprel): Likewise. (Mips_relocate_functions::relgprel32): Likewise. (Mips_relocate_functions::tlsrelhi16): Likewise. (Mips_relocate_functions::tlsrello16): Likewise. (Mips_relocate_functions::tlsrel32): Likewise. (Mips_relocate_functions::relsub): Likewise. (Mips_relocate_functions::releh): New method. (Mips_relocate_functions::rel64): Likewise. (Mips_got_info::record_local_got_symbol): Add is_section_symbol and pass it to Mips_got_entry. (Mips_got_info::add_local_entries): Pass addend argument to code functions, and for STT_SECTION symbols call add_symbolless_local_addend. (Mips_got_info::add_tls_entries): Pass addend argument to code functions. (Mips_relobj::do_read_symbols): Read gp value that was used to create object. (Mips_output_data_plt::plt_entry): Remove opcode from l[wd] instruction. Opcode for instruction will be selected later. (Target_mips::gc_process_relocs): Add case for SHT_RELA. (Target_mips::scan_relocatable_relocs): Likewise. (Target_mips::emit_relocs_scan): Likewise. (Target_mips::relocate_relocs): Likewise. (Target_mips::do_finalize_sections): Skip objects for merging processor specific flags in which all input sections will be discarded. (mips_get_size_for_reloc): Add case for R_MIPS_EH. (Target_mips::Scan::get_reference_flags): Likewise. (Target_mips::relocate_special_relocatable): Call rel26 method with calculate_only and calculated_value arguments. (Target_mips::Scan::local): Add case for R_MIPS_EH. Don't create a dynamic relocation against a readonly sections, and pass is_section_symbol to Mips_got_info::record_local_got_symbol. (Target_mips::Scan::global): Add case for R_MIPS_EH. Don't create a dynamic relocation against a readonly sections, and pass r_type and r_offset to Target_mips::copy_reloc. (Target_mips::Relocate::relocate): Add support for resolving relocations for Mips64. (Target_mips::mips_info): Add case for Mips64 default dynamic linker name. (Target_selector_mips): Correct emulation names.
2016-03-17Add missing Mips_output_data_la25_stub::do_print_to_mapfile.Vladimir Radosavljevic2-0/+10
gold/ * mips.cc (class Mips_output_data_la25_stub): Add do_print_to_mapfile function.
2016-03-17Fix problem with --emit-relocs for Mips-32.Vladimir Radosavljevic2-1/+6
gold/ * mips.cc (Mips_classify_reloc::put_r_info): Call 32bit version of elf_r_info.
2016-03-09Workaround a C++ bug in GCC 4.2 in gold testH.J. Lu4-7/+15
G++ in GCC 4.2 silently ignores --- __attribute__ ((section(".rodata.v1_a2"))) const short rodata_item1 = 101; --- which leads to plugin_layout_with_alignment test failure with Expected 12 sections, found 8 sections since 4 .rodata sections are missing. As a workaround, this patch changes plugin_layout_with_alignment test from C++ to C. * testsuite/plugin_layout_with_alignment.cc: Renamed to .. * testsuite/plugin_layout_with_alignment.c: This. * testsuite/Makefile.am (plugin_layout_with_alignment.o): Updated. (plugin_layout_with_alignment): Likewise. * testsuite/Makefile.in: Regenerated.
2016-03-08Remove checks for constructors that might have been eliminated by GCC.Cary Coutant5-4/+9
GCC 6 does not generate constructors for two of gold's test cases. This patch simply removes the checks for them. gold/ PR 19751 * testsuite/Makefile.am (retain_symbols_file_test): Remove check for constructor. * testsuite/Makefile.in: Regenerate. * testsuite/dynamic_list.sh: Likewise. * testsuite/retain_symbols_file_test.sh: Likewise.
2016-03-08Add unused attribute where necessary to quiet GCC 6 warnings.Cary Coutant3-2/+8
gold/ PR 19751 * arm.cc (Reloc_stub::Key::name): Add unused attribute. * dirsearch.cc (Dir_caches::~Dir_caches): Likewise.
2016-03-08Fix Makefile so make clean removes overlooked files.Cary Coutant2-5/+20
gold/ * testsuite/Makefile.am: Add to MOSTLYCLEANFILES. * testsuite/Makefile.in: Regenerate.
2016-03-08Refactor Output_data_reloc_base::do_write for MIPS-specific relocs.Cary Coutant3-157/+191
This patch is a simple refactoring that will allow the MIPS backend to replace the Output_data_reloc_base::do_write() method without copying its entire implementation. I've moved the implementation of do_write() into a function template, which can be instantiated with a custom class to write the MIPS-specific relocation format. The custom class for MIPS needs access to the symbol index and address from Output_reloc, so I've included the part of Vlad's MIPS-64 patch that makes those accessor methods public. 2016-03-08 Cary Coutant <ccoutant@gmail.com> Vladimir Radosavljevic <vladimir.radosavljevic@imgtec.com> gold/ * output.cc (Output_reloc_writer): New type. (Output_data_reloc_base::do_write): Move implementation to template in output.h and replace with invocation of template. * output.h (Output_file): Move to top of file. (Output_reloc::get_symbol_index): Move to public interface. (Output_reloc::get_address): Likewise. (Output_data_reloc_base::do_write_generic): New function template.
2016-03-04Fix datestamps on ChangeLog entries to read 2015 instead of 2016.Cary Coutant1-2/+2
2016-03-04Add missing ChangeLog entries for commit 82838H.J. Lu2-0/+12
Fix gold/testsuite/plugin_layout_with_alignment.sh permission.
2016-03-04Fix undefined symbol errors introduced with previous commit.Cary Coutant2-0/+37
gold/ PR gold/19019 PR gold/19763 * symtab.cc: Instantiate Sized_symbol::init_constant and Sized_symbol::init_undefined.
2016-03-03Add support for STT_SPARC_REGISTER symbols.Cary Coutant8-20/+236
gold/ PR gold/19019 * layout.h (Layout::add_target_specific_dynamic_tag): New function. * layout.cc (Layout::add_target_specific_dynamic_tag): New function. * mips.cc (Target_mips::make_symbol): Adjust function signature. * sparc.cc (Target_sparc::Target_sparc): Initialize register_syms_. (Target_sparc::do_is_defined_by_abi): Remove test for STT_SPARC_REGISTER. (Target_sparc::Register_symbol): New struct type. (Target_sparc::register_syms_): New data member. (Target_sparc<64, true>::sparc_info): Set has_make_symbol to true. (Target_sparc::make_symbol): New function. (Target_sparc::do_finalize_sections): Add register symbols and new dynamic table entries. * symtab.h (Sized_symbol::init_undefined): Add value parameter. (Symbol_table::add_target_global_symbol): New function. (Symbol_table::target_symbols_): New data member. * symtab.cc (Sized_symbol::init_undefined): Add value parameter. (Symbol_table::Symbol_table): Initialize target_symbols_. (Symbol_table::add_from_object): Pass additional parameters to Target::make_symbol. (Symbol_table::define_special_symbol): Likewise. (Symbol_table::add_undefined_symbol_from_command_line): Pass 0 for undefined symbol value. (Symbol_table::set_dynsym_indexes): Process target-specific symbols. (Symbol_table::sized_finalize): Likewise. (Symbol_table::sized_write_globals): Likewise. * target.h (Sized_target::make_symbol): Add name, st_type, object, st_shndx, and value parameters.
2016-03-03Don't handle every plugin symbol as defined.Rafael Ávila de Espíndola2-0/+7
Gold was fetching --start-lib/--end-lib members if that member defined or used a currently undefined symbol.
2016-03-03Add new plugin hooks to support querying section alignment and size.Cary Coutant6-4/+505
include/ 2016-03-03 Than McIntosh <thanm@google.com> * plugin-api.h: Add new hooks to the plugin transfer vector to to support querying section alignment and section size. (ld_plugin_get_input_section_alignment): New hook. (ld_plugin_get_input_section_size): New hook. (ld_plugin_tag): Add LDPT_GET_INPUT_SECTION_ALIGNMENT and LDPT_GET_INPUT_SECTION_SIZE. (ld_plugin_tv): Add tv_get_input_section_alignment and tv_get_input_section_size. gold/ 2016-03-03 Than McIntosh <thanm@google.com> * plugin.cc (Plugin::load): Include hooks for get_input_section_size and get_input_section_alignment in transfer vector. (get_input_section_alignment): New function. (get_input_section_size): New function. * testsuite/Makefile.am: Add plugin_layout_with_alignment.sh test. * testsuite/Makefile.in: [Regenerate.] * testsuite/plugin_section_alignment.cc: New test file. * testsuite/plugin_layout_with_alignment.cc: New test file. * testsuite/plugin_layout_with_alignment.sh: New test file.
2016-03-03get_symbols() plugin API tweak to support --start-lib/--end-lib.Evgenii Stepanov8-17/+169
Let the plugin know that a file is not being included in the link by returning LDPS_NO_SYMS from get_symbols(). include/ * plugin-api.h (enum ld_plugin_tag): Add LDPT_GET_SYMBOLS_V3. gold/ * plugin.h (Pluginobj::get_symbol_resolution_info): Add version parameter. * plugin.cc (get_symbols_v3): New function. (Plugin::load): Add LDPT_GET_SYMBOLS_V3. (Pluginobj::get_symbol_resolution_info): Return LDPS_NO_SYMS when using new version.
2016-02-26Discard FDEs for zero-length address ranges.Cary Coutant3-5/+47
2016-02-26 Egor Kochetov <egor.kochetov@intel.com> Cary Coutant <ccoutant@gmail.com> gold/ PR gold/19735 * ehframe.h (Cie::fde_encoding): New method. * ehframe.cc (Eh_frame::read_fde): Discard FDEs for zero-length address ranges.
2016-02-16Pass -mrelax-relocations=yes to $(TEST_AS)H.J. Lu3-8/+12
x86_64_mov_to_lea5.o and x86_64_mov_to_lea6.o must be assembled with -mrelax-relocations=yes since when assembler is configured with --disable-x86-relax-relocations, R_X86_64_GOTPCRELX relocation won't be generated. This linker optimization requires R_X86_64_GOTPCRELX relocation. This patch also removed the duplicated x86_64_overflow_pc32.o target. * testsuite/Makefile.am (x86_64_mov_to_lea5.o): Pass -mrelax-relocations=yes to $(TEST_AS). (x86_64_mov_to_lea6.o): Likewise. (x86_64_overflow_pc32.o): Remove duplicated target. * testsuite/Makefile.in: Regenerated.
2016-02-15gold: Add s390 -fsplit-stack support.Marcin Kościelnicki25-6/+1664
gold/ChangeLog: * s390.cc (Target_s390::match_view_u): New helper method. (Target_s390::do_is_call_to_non_split): New method. (Target_s390::ss_code_st_r14): New const. (Target_s390::ss_code_l_r14): New const. (Target_s390::ss_code_bras_8): New const. (Target_s390::ss_code_l_basr): New const. (Target_s390::ss_code_a_basr): New const. (Target_s390::ss_code_ear): New const. (Target_s390::ss_code_c): New const. (Target_s390::ss_code_larl): New const. (Target_s390::ss_code_brasl): New const. (Target_s390::ss_code_jg): New const. (Target_s390::ss_code_jgl): New const. (Target_s390::ss_match_mcount): New helper method. (Target_s390::ss_match_l): New helper method. (Target_s390::ss_match_ahi): New helper method. (Target_s390::ss_match_alfi): New helper method. (Target_s390::ss_match_cr): New helper method. (Target_s390::do_calls_non_split): New method. * testsuite/Makefile.am: Added new tests. * testsuite/split_s390.sh: New test. * testsuite/split_s390_1_a1.s: New test. * testsuite/split_s390_1_a2.s: New test. * testsuite/split_s390_1_n1.s: New test. * testsuite/split_s390_1_n2.s: New test. * testsuite/split_s390_1_z1.s: New test. * testsuite/split_s390_1_z2.s: New test. * testsuite/split_s390_1_z3.s: New test. * testsuite/split_s390_1_z4.s: New test. * testsuite/split_s390_2_ns.s: New test. * testsuite/split_s390_2_s.s: New test. * testsuite/split_s390x_1_a1.s: New test. * testsuite/split_s390x_1_a2.s: New test. * testsuite/split_s390x_1_n1.s: New test. * testsuite/split_s390x_1_n2.s: New test. * testsuite/split_s390x_1_z1.s: New test. * testsuite/split_s390x_1_z2.s: New test. * testsuite/split_s390x_1_z3.s: New test. * testsuite/split_s390x_1_z4.s: New test. * testsuite/split_s390x_2_ns.s: New test. * testsuite/split_s390x_2_s.s: New test.
2016-02-11Remove info message for every erratum 843419 found and fixed.Han Shen2-4/+5
2016-02-11 Rahul Chaudhry <rahulchaudhry@google.com> * aarch64.cc (Target_aarch64::scan_erratum_843419_span): Remove info message for every erratum 843419 found and fixed.
2016-02-07Add additional information to relocation overflow errors.Cary Coutant2-2/+31
gold/ PR gold/18695 * x86_64.cc (Target_x86_64::Relocate::relocate): Add additional information to relocation overflow errors.
2016-02-07Fix incorrect x32 overflow checking for refs to weak undef symbols.Cary Coutant2-2/+16
On x32, a pc-relative reference to an undef weak symbol (value 0) with a negative addend (typically -4) generates a spurious overflow error because Symbol_value::value() returns a 32-bit negative number as an unsigned number, which gets zero-extended before subtracting the PC value. This patch fixes the problem by special-casing the negative addend, and adding it to the value after widening it to 64 bits. Symbol_value::value() does not need the addend if it's negative, since it is only important when processing section symbols for merge sections, where a positive addend provides the input section offset of the merged constant. gold/ * x86_64.cc (X86_64_relocate_functions::pcrela32_check): Fix x32 overflow checking when symbol value + addend < 0.
2016-02-06Fix compile errors about shift counts too large.Cary Coutant2-10/+41
In order to get around the optimizer and newer compiler warnings about shift counts, the overflow checking code had resorted to some messy shifting, and with the never-before-seen instantiations of the template functions, we were still running afoul of the compiler checks. This patch replaces those messy shift sequences with a simple class template that provides the min and max limits for any bit size up to 64, with a specialization for 64 that prevents the compiler from complaining. gold/ PR gold/19577 * reloc.h (Limits): New class. (Bits::has_overflow32): Use min/max values from Limits. (Bits::has_unsigned_overflow32): Likewise. (Bits::has_signed_unsigned_overflow32): Likewise. (Bits::has_overflow): Likewise. (Bits::has_unsigned_overflow): Likewise. (Bits::has_signed_unsigned_overflow64): Likewise.
2016-02-06Fix overflow checking for 32-bit pc-relative relocations on x32.Cary Coutant7-15/+151
The problem here is that x32 is really using 64-bit addressing, while pretending to be 32-bit. Even though the object file format is 32-bit, we need to do the overflow checking with 64-bit arithmetic (because that's what the hardware will be using). This patch overrides the pcrela32_check functions in reloc.h with target-specific versions that do 64-bit checking. I've also updated the test case to use -Tdata instead of adding a huge .space directive, to reduce the size of the .o files. gold/ PR gold/19567 * reloc.h (Relocate_functions::Overflow_check): Add comments. * x86_64.cc (X86_64_relocate_functions): New class. (Target_x86_64::Relocate::relocate): Use the new class. * testsuite/Makefile.am (x86_64_overflow_pc32): Add -Tdata option. (x32_overflow_pc32): New test case. * testsuite/Makefile.in: Regenerate. * testsuite/x32_overflow_pc32.sh: New script. * testsuite/x86_64_overflow_pc32.s: Remove .space directive.
2016-02-06Fix incorrect casts.Cary Coutant2-2/+8
gold/ PR gold/19577 * reloc.h (Bits::has_unsigned_overflow32): Fix static_cast. (Bits::has_unsigned_overflow): Remove unnecessary static_cast.
2016-02-06Add PR number to ChangeLog entry.Cary Coutant1-0/+1
2016-02-06Fix build failure in gold due to signed vs. unsigned comparisons.Cary Coutant2-2/+8
* reloc.h (Bits::has_unsigned_overflow32): Fix unsigned/signed comparison. (Bits::has_unsigned_overflow): Likewise.
2016-02-06gold: Add view and view_size parameters to is_call_to_non_split.Marcin Kościelnicki5-7/+25
This is needed by s390 split-stack support, to distinguish call and load-address relocations. gold/ChangeLog: * i386.cc (Target_i386::is_call_to_non_split): Add view and view_size parameters. * reloc.cc (Sized_relobj_file::split_stack_adjust_reltype): Pass view and view_size to is_call_to_non_split. * target.cc (Target::is_call_to_non_split): Add view and view_size parameters. * target.h (class Target): Likewise.
2016-02-052016-02-05 Sriraman Tallam <tmsriram@google.com>Sriraman Tallam2-47/+75
* icf.cc (get_rel_addend): New function. (get_section_contents): Move merge section addend computation to a new function. Ignore negative values for SHT_REL and SHT_RELA addends. Fix bug to not read past the length of the section. Fix bug related to addend computation for MERGE sections.
2016-02-05Add some relocation overflow checks for x86_64.Cary Coutant6-47/+157
2016-02-05 Cary Coutant <ccoutant@gmail.com> Andrew Senkevich <andrew.senkevich@intel.com> gold/ PR gold/18695 * x86_64.cc (Target_x86_64::Relocate::relocate): Add overflow checking for R_X86_64_32, R_X86_64_32S, R_X86_64_PC32, and R_X86_64_PLT32. * testsuite/Makefile.am (x86_64_overflow_pc32): New test. * testsuite/x86_64_overflow_pc32.sh: New test script. * testsuite/x86_64_overflow_pc32.s: New source file.
2016-02-05Overhaul relocation framework to support overflow checking.Cary Coutant5-150/+632
gold/ PR gold/18695 * reloc.h (Relocate_functions::Address): New typedef. (Relocate_functions::Addendtype): New typedef. (Relocate_functions::Overflow_check): New enum type. (Relocate_functions::Reloc_status): New enum type. (Relocate_functions::check_overflow): New function template. (Relocate_functions::rel): Add check parameter; check for overflow. (Relocate_functions::rel_unaligned): Likewise. (Relocate_functions::rela): Likewise. (Relocate_functions::pcrel): Likewise. (Relocate_functions::pcrel_unaligned): Likewise. (Relocate_functions::pcrela): Likewise. (Relocate_functions::rel8): Adjust parameter types. (Relocate_functions::rela8): Likewise. (Relocate_functions::pcrel8): Likewise. (Relocate_functions::pcrela8): Likewise. (Relocate_functions::rel16): Likewise. (Relocate_functions::rela168): Likewise. (Relocate_functions::pcrel16): Likewise. (Relocate_functions::pcrela16): Likewise. (Relocate_functions::rel32): Likewise. (Relocate_functions::rel32_unaligned): Likewise. (Relocate_functions::rela32): Likewise. (Relocate_functions::pcrel32): Likewise. (Relocate_functions::pcrel32_unaligned): Likewise. (Relocate_functions::pcrela32): Likewise. (Relocate_functions::rel8_check): New function. (Relocate_functions::rela8_check): New function. (Relocate_functions::pcrel8_check): New function. (Relocate_functions::pcrela8_check): New function. (Relocate_functions::rel16_check): New function. (Relocate_functions::rela168_check): New function. (Relocate_functions::pcrel16_check): New function. (Relocate_functions::pcrela16_check): New function. (Relocate_functions::rel32_check): New function. (Relocate_functions::rel32_unaligned_check): New function. (Relocate_functions::rela32_check): New function. (Relocate_functions::pcrel32_check): New function. (Relocate_functions::pcrel32_unaligned_check): New function. (Relocate_functions::pcrela32_check): New function. (Bits::has_unsigned_overflow32): New function. (Bits::has_unsigned_overflow): New function. * testsuite/Makefile.am (overflow_unittest): New test. * testsuite/Makefile.in: Regenerate. * testsuite/overflow_unittest.cc: New source file.
2016-02-04Fix "PowerPC64 ELFv2 entry code" for big-endianAlan Modra2-1/+5
bfd/ * elf64-ppc.c (ppc64_elf_relocate_section): Adjust last patch for big-endian. gold/ * powerpc.cc (relocate): Adjust last patch for big-endian.