aboutsummaryrefslogtreecommitdiff
path: root/gold
AgeCommit message (Collapse)AuthorFilesLines
2014-08-13Add option -no-pie.Sriraman Tallam2-1/+6
2014-08-08gold aarch64 patch to enable linking hello_wolrd.Jing Yu7-155/+1528
elfcpp/ChangeLog: 2014-08-08 Han Shen <shenhan@google.com> * aarch64.h (withdrawn): Replaced with R_AARCH64_withdrawn. 2014-08-08 Jing Yu <jingyu@google.com> Han Shen <shenhan@google.com> * Makefile.am (HFILES): Add aarch64-reloc-property.h. (DEFFILES): add aarch64-reloc.def. (TARGETSOURCES): Add aarch64-reloc-property.cc. (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT). * Makefile.in: Regenerate. * aarch64-reloc-property.cc: New file. * aarch64-reloc-property.h: New file. * aarch64-reloc.def: New file. * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces with tab to make the format consistent. (Output_data_got_aarch64::symbol_table_): New method. (Target_aarch64::do_plt_address_for_global): New method. (Target_aarch64::do_plt_address_for_local): New method. (Target_aarch64::do_select_as_default_target): New method. (Target_aarch64::do_make_data_plt): New method. (Target_aarch64::make_data_plt): New method. (Output_data_plt_aarch64::has_irelative_section): New method. (Output_data_plt_aarch64::address_for_global): New method. (Output_data_plt_aarch64::address_for_local): New method. (Output_data_plt_aarch64::irelative_rel_): New parameter. (Output_data_plt_aarch64::add_entry): Implement contents. (Output_data_plt_aarch64::set_final_data_size): Fix typo. (Output_data_plt_aarch64::do_write): Remove useless got_base. Set the got_pov entry to plt0. (Output_data_plt_aarch64_standard::do_fill_first_plt_entry): Implement contents. (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement. (AArch64_howto): New struct. (aarch64_howto[]): New static const array. (AArch64_relocate_functions): New class. (Target_aarch64::Scan::get_reference_flags): Remove method. (Target_aarch64::Scan::local): Implement to support a few relocations. (Target_aarch64::Scan::global): Implement to support a few relocations. (Target_aarch64::make_plt_section): Implement contents. (Target_aarch64::make_plt_entry): Implement contents. (Target_aarch64::do_finalize_sections): Implement contents. (Target_aarch64::Relocate::relocate): Implement a few relocations. (Target_aarch64::relocate_section): Implement contents.
2014-08-06Modify new gold test to pass on powerpc64leAlan Modra2-1/+5
* testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
2014-08-06Warn for gold on lto objects without pluginAlan Modra2-0/+9
PR 13227 * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
2014-07-21Fix ChangeLog entry:Sriraman Tallam1-1/+1
2014-07-21 Sriraman Tallam <tmsriram@google.com> * object.cc (Relobj::is_section_name_included): Add ".rodata.nptl_version" to not garbage collect this section.
2014-07-212014-07-21 Sriraman Tallam <tmsriram@google.com>Sriraman Tallam2-1/+8
* object.cc (Relobj::is_section_name_included): Add ".rodata.nptl_version".
2014-07-08Fix --defsym to copy symbol attributes.Cary Coutant9-8/+159
Alan Modra committed a patch to Gnu ld to fix a problem encountered on PPC where the --defsym option wasn't copying the st_other bits to the newly-defined symbol. https://sourceware.org/ml/binutils/2014-07/msg00094.html Gold has the same problem, and additionally wasn't copying the symbol type. This patch fixes both problems, by copying the symbol type, visibility, and the remaining st_other bits to the new symbol for --defsym=sym1=sym2 assignments. gold/ * expression.cc (struct Expression::Expression_eval_info): Add new fields type_pointer, vis_pointer, and nonvis_pointer. (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and nonvis_pointer parameters. Adjust all calls. (Symbol_expression::value): Update type, visibility, and nonvis bits in caller. * script.cc (Symbol_assignment::sized_finalize): Update type, visibility, and remaining st_other bits for new symbol. * script.h: (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and nonvis_pointer parameters. * symtab.h (Symbol::set_type): New method. * testsuite/Makefile.am (defsym_test): New test. * testsuite/Makefile.in: Regenerate. * testsuite/defsym_test.c: New file. * testsuite/defsym_test.sh: New file.
2014-07-08Fix internal error with LTO on ARM.Cary Coutant8-7/+52
This prevents the target-specific do_read_symbols methods from being called twice when do_layout_deferred_sections needs to layout an .eh_frame section. gold/ PR gold/15639 * dynobj.h (Sized_dynobj::base_read_symbols): New method. * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to... (Sized_dynobj::base_read_symbols): ...new method. * object.h (Sized_relobj_file::base_read_symbols): New method. * object.cc (Sized_relobj_file::do_read_symbols): Move body to... (Sized_relobj_file::base_read_symbols): ...new method. * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols. * mips.cc: (Mips_relobj::do_read_symbols): Likewise. * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
2014-07-04Update gold POTFILES.inAlan Modra2-0/+6
for recent aarch64 and mips support. * po/POTFILES.in: Regenerate
2014-07-022014-07-02 Jing Yu <jingyu@google.com>Jing Yu7-4/+1487
Initial patch to enable gold aarch64 backend. This patch is just a skeleton which almost does nothing. It does not support ILP32 now. gold/ChangeLog: * aarch64.cc: New file * Makefile.am (TARGETSOURCES): Add aarch64.cc (ALL_TARGETOBJS): Add aarch64.$(OBJEXT) * Makefile.in: Regenerate. * configure.tgt: Add entries for aarch64*. * configure.ac: Likewise. * configure: Likewise. elfcpp/ChangeLog: * aarch64.h: New file. New enums for aarch64-elf64 relocations. * elfcpp.h (EM_AARCH64, SHT_AARCH64_ATTRIBUTES, PT_AARCH64_ARCHEXT, PT_AARCH64_UNWIND): New enum constant.
2014-06-27Fix undefined symbol errors from mips.ccAlan Modra2-1/+5
* symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
2014-06-24Fix dwp to allow intermediate .dwp files with no .debug_types sections.Cary Coutant2-4/+15
gold/ * dwp.cc (Dwo_file::read): Allow files with no .debug_types sections. (Dwo_file::sized_read_unit_index): Likewise.
2014-06-23gold/Sasa Stankovic7-4/+10563
* mips.cc: New file. * Makefile.am (TARGETSOURCES): Add mips.cc (ALL_TARGETOBJS): Add mips.$(OBJEXT) * configure.tgt: Add entries for mips*. * configure.ac: Likewise. * Makefile.in: Regenerate. * configure: Likewise.
2014-06-09Add check to keep from segfaulting on a corrupt .debug_pubnames section.Cary Coutant2-0/+11
gold/ * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that unit_length is within section bounds.
2014-06-09Print unattached sections in the link map.Cary Coutant2-0/+10
gold/ PR gold/16980 * layout.cc (Layout::print_to_mapfile): Print unattached sections in map.
2014-06-07Allow both signed and unsigned fields in PowerPC cmpli insnAlan Modra2-8/+13
There are legitimate reasons to allow a signed value in a cmpli insn field, for example to test for a "stw r1,lock@sdarel(r13)" instruction in user code, a kernel might use subis r3,r3,STW_R1_0R13@ha # subtract off high part cmplwi r3,lock@sdarel # is low part accessing lock? Since the lock@sdarel may take a range of -32768 to 32767, the allowed range of cmpli immediate must be at least [-32768,65535]. bfd/ * elf32-ppc.c (ppc_elf_relocate_section): Treat field of cmpli insn as a bitfield; Use complain_overflow_bitfield. * elf64-ppc.c (ppc64_elf_relocate_section): Likewise. opcodes/ * ppc-opc.c (UISIGNOPT): Define and use with cmpli. gas/ * config/tc-ppc.c (ppc_insert_operand): Handle PPC_OPERAND_SIGNOPT on unsigned fields. Comment on PPC_OPERAND_SIGNOPT signed fields in 64-bit mode. gold/ * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
2014-06-06Strip .debug_gnu_pubnames and .debug_gnu_pubtypes when building .gdb_index.Cary Coutant4-13/+11
When not stripping those sections, there was a bug where gold was incorrectly adjusting section-relative offsets by the offset of the input section within the output section. That adjustment was both unnecessary and wrong, causing gold to miss a number of debug entries that should have been added to .gdb_index. (With stripping, the adjustment was always 0, so the bug in dwarf_reader.cc would have been hidden by the change to layout.cc.) gold/ * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_. * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise. (Dwarf_pubnames_table::read_header): Likewise. * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and .debug_gnu_pubtypes.
2014-06-05Make it easy to make --disable-werror the default for both binutils and gdbJoel Brobecker4-2/+13
The goal of this patch is to provide an easy way to make --disable-werror the default when building binutils, or the parts of binutils that need to get built when building GDB. In development mode, we want to continue making -Werror the default with GCC. But, when making releases, I think we want to make it as easy as possible for regular users to successfully build from sources. GDB already has this kind of feature to turn -Werror as well as the use of the libmcheck library. As GDB Release Manager, I take advantage of it to turn those off after having cut the branch. I'd like to be able to do the same for the binutils bits. And perhaps Tristan will want to do the same for his releases too (not sure, binutils builders might be a little savvier than GDB builders). This patch introduces a new file, called development.sh, which just sets a variable called $development. In our development branches (Eg. "master"), it's set to true. But setting it to false would allow us to change the default behavior of various development-related features to be turned off; in this case, it turns off the use of -Werror by default (use --enable-werror to turn it back on). bfd/ChangeLog: * development.sh: New file. * warning.m4 (AM_BINUTILS_WARNINGS): Source bfd/development.sh. Make -Werror the default with GCC only if DEVELOPMENT is true. * Makefile.am (CONFIG_STATUS_DEPENDENCIES): Add $(srcdir)/development.sh. * Makefile.in, configure: Regenerate. binutils/ChangeLog: * Makefile.am (CONFIG_STATUS_DEPENDENCIES): Add dependency on bfd's development.sh. * Makefile.in, configure: Regenerate. gas/ChangeLog: * Makefile.am (CONFIG_STATUS_DEPENDENCIES): Add dependency on bfd's development.sh. * Makefile.in, configure: Regenerate. gold/ChangeLog: * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New. * Makefile.in, configure: Regenerate. gprof/ChangeLog: * Makefile.am (CONFIG_STATUS_DEPENDENCIES): Add dependency on bfd's development.sh. * Makefile.in, configure: Regenerate. ld/ChangeLog: * Makefile.am (CONFIG_STATUS_DEPENDENCIES): Add dependency on bfd's development.sh. * Makefile.in, configure: Regenerate. opcodes/ChangeLog: * Makefile.am (CONFIG_STATUS_DEPENDENCIES): Add dependency on bfd's development.sh. * Makefile.in, configure: Regenerate. gdb/ChangeLog: * development.sh: Delete. * Makefile.in (config.status): Adjust dependency on development.sh. * configure.ac: Adjust development.sh source call. * configure: Regenerate. gdb/gdbserver/ChangeLog: * configure.ac: Adjust development.sh source call. * Makefile.in (config.status): Adjust dependency on development.sh. * configure: Regenerate. Tested on x86_64-linux by building two ways: One with DEVELOPMENT set to true, and one with DEVELOPMENT set to false. In the first case, I could see the use of -Werror, while it disappeared in the second case.
2014-06-03Support fusion for ELFv2 stubsAlan Modra2-6/+22
Power8 fuses addis,addi and addis,ld sequences when the target of the addis is the same as the addi/ld. Thus addis r12,r2,xxx@ha addi r12,r12,xxx@l / ld r12,xxx@l(r12) is faster than addis r11,r2,xxx@ha addi r12,r11,xxx@l / ld r12,xxx@l(r11) So use the form that allows fusion in plt call and branch stubs. bfd/ * elf64-ppc.c (ADDIS_R12_R2): Define. (build_plt_stub): Support fusion on ELFv2 stub. (ppc_build_one_stub): Likewise for plt branch stubs. gold/ * powerpc.cc (addis_12_2): Define. (Stub_table::do_write): Support fusion on ELFv2 stubs. ld/testsuite/ * ld-powerpc/elfv2exe.d: Update for changed plt call stubs. gdb/ * ppc64-tdep.c (ppc64_standard_linkage8): New. (ppc64_skip_trampoline_code): Recognise ELFv2 stub supporting fusion.
2014-06-03Fix gold plugin_test failures on PowerPC64 ELFv2Alan Modra2-0/+12
readelf output for ELFv2 includes st_other bits specifying a function's local entry offset. * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility st_other output.
2014-06-02Fix PowerPC64 ELFv2 icf_safe failuresAlan Modra2-5/+21
ELFv2 doesn't use .opd, so folding function code can't be allowed in safe mode if a function's address might be taken. * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer): Only ignore relocs on ELFv1. (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
2014-05-30Fix testsuite to use newly-built linker for ehdr_start_test_4, and fixCary Coutant4-3/+9
check script to look for the right binding. gold/ * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option. * testsuite/Makefile.in: Regenerate. * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
2014-05-27Properly handle 64-bit GOT relocationsH.J. Lu2-2/+11
This patch fixes 2 issues: 1. Since the GOT offset is always negative, we need to use signed int to support 64-bit GOT relocations. 2. R_X86_64_PLTOFF64 uses the address of GLOBAL_OFFSET_TABLE, which is the address of the .got.plt section, not the .got section.
2014-05-15Fix "overflow in PLT unwind data" warningAlan Modra2-33/+52
When linking statically, it's possible to hit this warning with IFUNC or very large executables, due to .glink being unused. * powerpc.cc (do_plt_fde_location): Handle zero length .glink. Compare FDE contents with DW_CFA_nop rather than 0.
2014-05-13With -pie and x86, the linker complains if it sees a PC-relative relocationSriraman Tallam10-24/+86
to access a global as it expects a GOTPCREL relocation. This is really not necessary as the linker could use a copy relocation to get around it. This patch enables copy relocations with pie. Context: This is useful because currently the GCC compiler with option -fpie makes every extern global access go through the GOT. That is because the compiler cannot tell if a global will end up being defined in the executable or not and is conservative. This ends up hurting performance when the binary is linked as mostly static where most of the globals do end up being defined in the executable. By allowing copy relocs with fPIE, the compiler need not generate a GOTPCREL(GOT access) for any global access. It can safely assume that all globals will be defined in the executable and generate a PC-relative access instead. Gold can then create a copy reloc for only the undefined globals. gold/ * symtab.h (may_need_copy_reloc): Remove check for position independent code. * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no position independence before pc absolute may_need_copy_reloc call. Add check for executable output befor pc relative may_need_copy_reloc call. * i386.cc: Ditto. * arm.cc: Ditto. * sparc.cc: Ditto. * tilegx.cc: Ditto. * powerpc.cc: Add check for no position independence before may_need_copy_reloc calls. * testsuite/pie_copyrelocs_test.cc: New file. * testsuite/pie_copyrelocs_shared_test.cc: New file. * Makefile.am (pie_copyrelocs_test): New test. * Makefile.in: Regenerate.
2014-05-13Optimizing accesses to Globals with -fpie -pie:Sriraman Tallam2-0/+57
With -pie and x86, the linker complains if it sees a PC-relative relocation to access a global as it expects a GOTPCREL relocation. This is really not necessary as the linker could use a copy relocation to get around it. This patch enables copy relocations with pie. Context: This is useful because currently the GCC compiler with option -fpie makes every extern global access go through the GOT. That is because the compiler cannot tell if a global will end up being defined in the executable or not and is conservative. This ends up hurting performance when the binary is linked as mostly static where most of the globals do end up being defined in the executable. By allowing copy relocs with fPIE, the compiler need not generate a GOTPCREL(GOT access) for any global access. It can safely assume that all globals will be defined in the executable and generate a PC-relative access instead. Gold can then create a copy reloc for only the undefined globals.
2014-05-082014-05-08 Martin Liška <mliska@suse.cz>Martin Liška2-1/+5
gold/ * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
2014-05-06Fix issue where first reserved word of GOT is not initialized if thereCary Coutant3-68/+167
is no PLT. gold/ PR gold/16900 * i386.cc (Output_data_got_plt_i386): New class. (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt parameter. Change all callers. (Output_data_plt_i386::layout_): Remove. (Output_data_plt_i386::got_plt_): Change type. (Target_i386::got_plt_): Change type. Change all references. (Target_i386::got_section): Create instance of new class. (Output_data_got_plt_i386::do_write): New function. * x86_64.cc (Output_data_got_plt_x86_64): New class. (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt parameter. Change all callers. (Output_data_plt_x86_64::layout_): Remove. (Output_data_plt_x86_64::got_plt_): Change type. (Target_x86_64::got_plt_): Change type. Change all references. (Target_x86_64::got_section): Create instance of new class. (Output_data_got_plt_x86_64::do_write): New function. (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT. (Target_x86_64<size>::init_got_plt_for_update): Create instance of new class.
2014-05-05Don't complain about the source language when we have pubnames/pubtypes info.Cary Coutant2-15/+19
gold/ * gdb-index.cc (Gdb_index_info_reader): Don't complain about language if we have pubnames/pubtypes.
2014-05-02Fix handling of __ehdr_start when it cannot be defined.Cary Coutant13-44/+533
2014-05-02 Cary Coutant <ccoutant@google.com> * defstd.cc (in_segment): Define __ehdr_start here... * layout.cc (Layout::finalize): ...Instead of here. Set the output segment when known. * resolve.cc (Symbol::override_base_with_special): Remember the original binding. * symtab.cc (Symbol::set_output_segment): New function. (Symbol::set_undefined): New function. * symtab.h (Symbol::is_weak_undefined): Check original undef binding. (Symbol::is_strong_undefined): New function. (Symbol::set_output_segment): New function. (Symbol::set_undefined): New function. * target-reloc.h (is_strong_undefined): Remove. (issue_undefined_symbol_error): Call Symbol::is_weak_undefined. Check for hidden undefs. (relocate_section): Call Symbol::is_strong_undefined. * testsuite/Makefile.am (ehdr_start_test_1) (ehdr_start_test_2, ehdr_start_test_3) (ehdr_start_test_4, ehdr_start_test_5): New test cases. * testsuite/Makefile.in: Regenerate. * testsuite/ehdr_start_def.cc: New source file. * testsuite/ehdr_start_test.cc: New source file. * testsuite/ehdr_start_test.t: New linker script. * testsuite/ehdr_start_test_4.sh: New shell script.
2014-04-23Add missing PR ref to ChangeLog entry.Cary Coutant1-0/+1
2014-04-23Add missing break statement for case elfcpp::R_X86_64_PLTOFF64.Cary Coutant2-0/+5
gold/ * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
2014-04-15Allow target to decide whether to include a section.Cary Coutant3-1/+24
2014-04-15 Sasa Stankovic <Sasa.Stankovic@imgtec.com> gold/ * layout.cc (Layout::include_section): Allow a target to decide whether to include a section. * target.h (Target::should_include_section): New function. (Target::do_should_include_section): New function.
2014-04-15Allow target to derive from Copy_relocs class.Cary Coutant3-38/+33
2014-04-15 Sasa Stankovic <Sasa.Stankovic@imgtec.com> gold/ * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and inline into ... (Copy_relocs::emit): ... here. * copy-relocs.h (Copy_reloc_entry): Change from class to struct. (Copy_reloc_entry::make_copy_reloc): Change from private to protected. (Copy_reloc_entry::entries_): Change from private to protected.
2014-04-022014-04-02 Sriraman Tallam <tmsriram@google.com>Sriraman Tallam2-8/+13
* icf.cc (get_section_contents): Replace copies of reloc vectors with (const) references.
2014-04-02Modify gold testsuite to disable plugins added by GCC driver.Cary Coutant5-44/+102
GCC 4.8 now adds linker plugin options by default, which conflict with the --incremental tests in the testsuite. This patch checks whether the compiler supports the -fno-use-linker-plugin option, and adds it to all link commands. 2014-04-02 Cary Coutant <ccoutant@google.com> * configure.ac (HAVE_PUBNAMES): Use C instead of C++. (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin. * configure: Regenerate. * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for -fno-use-linker-plugin. (LINK1, CXXLINK1): Add it to the link command. * testsuite/Makefile.in: Regenerate.
2014-03-12autoreconfAlan Modra2-2/+5
Regenerate Makefile.in in bfd, binutils, gas, gold, gprof, ld, opcodes. Regenerate gas/config.in.
2014-03-10Add function to set non-visibility part of st_other.Cary Coutant2-0/+9
2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com> gold/ * symtab.h (Symbol::set_nonvis): New function.
2014-03-10Add explicit instantiations for Sized_symbol::init_output_data.Cary Coutant2-0/+32
2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com> gold/ * symtab.cc (Sized_symbol<32>::init_output_data): Instantiate the template. (Sized_symbol<64>::init_output_data): Likewise.
2014-03-10Allow target to adjust dynamic symbol value.Cary Coutant3-0/+19
2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com> gold/ * symtab.cc (Symbol_table::sized_write_globals): Allow a target to adjust dynamic symbol value. * target.h (Target::adjust_dyn_symbol): New function. (Target::do_adjust_dyn_symbol): New function.
2014-03-10Allow target to add custom dynamic table entries.Cary Coutant4-1/+38
2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com> gold/ * output.cc (Output_data_dynamic::Dynamic_entry::write): Get the value of DYNAMIC_CUSTOM dynamic entry. * output.h (Output_data_dynamic::add_custom): New function. (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM dynamic entry. (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM. * target.h (Target::dynamic_tag_custom_value): New function. (Target::do_dynamic_tag_custom_value): New function.
2014-03-10Allow target to set dynsym indexes.Cary Coutant3-0/+57
2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com> gold/ * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set dynsym indexes. * target.h (Target::has_custom_set_dynsym_indexes): New function. (Target::do_has_custom_set_dynsym_indexes): New function. (Target::set_dynsym_indexes): New function. (Target::do_set_dynsym_indexes): New function.
2014-03-08Better overflow checking for powerpc64 relocationsAlan Modra2-18/+78
R_PPC64_ADDR16 is used in three contexts: - .short data relocation - 16-bit signed insn fields, eg. addi - 16-bit unsigned insn fields, eg. ori In the first case we want to allow both signed and unsigned 16-bit values, the latter two ought to error if the field exceeds the range of values allowed for 16-bit signed and unsigned integers respectively. These conflicting requirements meant that ld had to choose the least restrictive overflow checks, and thus it is possible to construct testcases where an addi field overflows but is not reported by ld. Many relocations dealing with 16-bit insn fields have this problem. What's more, some relocations that are only ever used for signed fields of instructions woodenly copied the lax overflow checking of R_PPC64_ADDR16. bfd/ * elf64-ppc.c (ppc64_elf_howto_raw): Use complain_overflow_signed for R_PPC64_ADDR14, R_PPC64_ADDR14_BRTAKEN, R_PPC64_ADDR14_BRNTAKEN, R_PPC64_SECTOFF, R_PPC64_ADDR16_DS, R_PPC64_SECTOFF_DS, R_PPC64_REL16 entries. Use complain_overflow_dont for R_PPC64_TOC. (ppc64_elf_relocate_section): Modify overflow test for 16-bit fields in instructions to signed/unsigned according to whether the field takes a signed or unsigned value. gold/ * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN. (Powerpc_relocate_functions::has_overflow_unsigned): New function. (Powerpc_relocate_functions::has_overflow_bitfield, overflowed): Use the above. (Target_powerpc::Relocate::relocate): Correct overflow checking for a number of relocations. Modify overflow test for 16-bit fields in instructions to signed/unsigned according to whether the field takes a signed or unsigned value.
2014-03-05Update copyright yearsAlan Modra380-408/+386
2014-03-05Support R_PPC64_ADDR64_LOCALAlan Modra2-0/+16
This adds support for "func@localentry", an expression that returns the ELFv2 local entry point address of function "func". I've excluded dynamic relocation support because that obviously would require glibc changes. include/elf/ * ppc64.h (R_PPC64_REL24_NOTOC, R_PPC64_ADDR64_LOCAL): Define. bfd/ * elf64-ppc.c (ppc64_elf_howto_raw): Add R_PPC64_ADDR64_LOCAL entry. (ppc64_elf_reloc_type_lookup): Support R_PPC64_ADDR64_LOCAL. (ppc64_elf_check_relocs): Likewise. (ppc64_elf_relocate_section): Likewise. * Add BFD_RELOC_PPC64_ADDR64_LOCAL. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. gas/ * config/tc-ppc.c (ppc_elf_suffix): Support @localentry. (md_apply_fix): Support R_PPC64_ADDR64_LOCAL. ld/testsuite/ * ld-powerpc/elfv2-2a.s, ld-powerpc/elfv2-2b.s: New files. * ld-powerpc/elfv2-2exe.d, ld-powerpc/elfv2-2so.d: New files. * ld-powerpc/powerpc.exp: Run new test. elfcpp/ * powerpc.h (R_PPC64_REL24_NOTOC, R_PPC64_ADDR64_LOCAL): Define. gold/ * powerpc.cc (Target_powerpc::Scan::local, global): Support R_PPC64_ADDR64_LOCAL. (Target_powerpc::Relocate::relocate): Likewise.
2014-03-03Fix various copyright issuesAlan Modra2-1/+5
binutils/ * README: Add "Copyright Notices" paragraph. gas/ * config/bfin-lex-wrapper.c: Correct copyright date. * config/tc-frv.c: Correct copyright punctuation. * config/tc-ip2k.c: Likewise. * config/tc-iq2000.c: Likewise. * config/tc-mep.c: Likewise. * config/tc-tic4x.c: Likewise. * config/tc-tic4x.h: Likewise. ld/testsuite/ * ld-scripts/phdrs2.exp: Correct copyright punctuation. * ld-v850/v850.exp: Correct copyright typo. opcodes/ * i386-gen.c (process_copyright): Emit copyright notice on one line. gold/ * dwp.cc (print_version): Update copyright year to current.
2014-02-11Update ChangeLog from earlier patch.Cary Coutant1-0/+12
2014-02-10binutils potfiles regenAlan Modra2-560/+1745
Adds nds32 files to POTFILES.in
2014-02-06Fix problem where -u is ignored when a weak undef is seen.Cary Coutant6-41/+224
When the linker has a weak undefined symbol, it normally does not select an archive library member just to satisfy the reference. If the same symbol is also listed in a -u option, however, we should select the archive library member. This patch reorders the code in Library_base::should_include_member so that the additional checks are performed in the case of a weak undef. gold/ 2014-02-06 Cary Coutant <ccoutant@google.com> * archive.cc (Library_base::should_include_member): Reorder code to check for -u option if a weak undef has already been seen. * testsuite/Makefile.am (weak_undef_test_2): New test case. * testsuite/Makefile.in: Regenerate. * testsuite/weak_undef_file3.cc: New file. * testsuite/weak_undef_file4.cc: New file. * testsuite/weak_undef_test_2.cc: New file.
2014-02-05Fix issues with gold undefined symbol diagnostics.Cary Coutant3-8/+24
PR binutils/15435 complains that gold issues a visibility error for an weak undefined symbol with hidden visibility. The message should be suppressed if the symbol is a weak undef. An earlier patch to add an extra note about key functions when a class's vtable symbol is undefined missed a case where the reference to the vtable came from a shared library. This patch moves the check to a lower-level routine that catches both cases. gold/ 2014-02-05 Cary Coutant <ccoutant@google.com> * errors.cc (Errors::undefined_symbol): Move undef vtable symbol check to here. * target-reloc.h (is_strong_undefined): New function. (relocate_section): Move undef vtable symbol check from here. Check for is_strong_undefined.