aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2018-04-27New plugin interface to get list of symbols wrapped with --wrap option.binutils-2_29-branchSriraman Tallam10-10/+262
2018-02-22 Sriraman Tallam <tmsriram@google.com> * plugin.cc (get_wrap_symbols): New plugin interface. (load): Add get_wrap_symbols to transfer vector. * plugin-api.h (ld_plugin_get_wrap_symbols): New plugin interface. * testsuite/plugin_test.c (onload): Call and check get_wrap_symbols interface. * testsuite/plugin_test_wrap_symbols.sh: New test script. * testsuite/plugin_test_wrap_symbols_1.cc: New file. * testsuite/plugin_test_wrap_symbols_2.cc: New file. * testsuite/Makefile.am (plugin_test_wrap_symbols): New test. * testsuite/Makefile.in: Regenerate. (cherry picked from commit 0b65c07b97c43e8891c2e14061270878a85222c8)
2018-04-27Fix symbol resolution with linker plugins for defsym symbols.Sriraman Tallam10-20/+272
2018-02-07 Sriraman Tallam <tmsriram@google.com> * expression.cc (Symbol_expression::set_expr_sym_in_real_elf): New method. (Unary_expression::set_expr_sym_in_real_elf): New method. (Binary_expression::set_expr_sym_in_real_elf): New method. (Trinary_expression::set_expr_sym_in_real_elf): New method. * plugin.cc (get_symbol_resolution_info): Fix symbol resolution if defined or used in defsyms. * plugin.h (Plugin_manager::is_defsym_def): New method. (Plugin_manager::Plugin_manager): Initialize defsym_defines_set_. (Plugin_manager::defsym_defines_set_): New member. (Plugin_manager::Defsym_defines_set): New typedef. * script.cc (Script_options::set_defsym_uses_in_real_elf): New method. (Script_options::find_defsym_defs): New method. * script.h (Expression::set_expr_sym_in_real_elf): New method. (Symbol_assignment::is_defsym): New method. (Symbol_assignment::value): New method. (Script_options::find_defsym_defs): New method. (Script_options::set_defsym_uses_in_real_elf): New method. * testsuite/Makefile.am (plugin_test_defsym): New test. * testsuite/Makefile.in: Regenerate. * testsuite/plugin_test.c: Check for new symbol resolution. * testsuite/plugin_test_defsym.sh: New script. * testsuite/plugin_test_defsym.c: New test source. (cherry picked from commit 3281b315c89caf1d539a316e41cc095e46482f75)
2018-04-04Apply:Eric Christopher2-2/+10
2017-11-08 Kyle Butt <iteratee@google.com> * object.cc (do_find_special_sections): Fix a thinko with memmem return values and check for != NULL rather than == 0.
2018-03-28PR ld/22972 on SPARC.Eric Botcazou8-6/+117
This is a regression for the corner case of a hidden symbol in a PIC/PIE binary which is subject to both a new-style GOTDATA relocation and an old-style GOT relocation. In this case, depending on the link order, the R_SPARC_RELATIVE dynamic relocation for the GOT slot needed because of the old-style relocation can be replaced with R_SPARC_NONE coming from the GOTDATA relocation. The fix simply records whether an old-style GOT relocation is seen for a symbol and prevents the R_SPARC_NONE from being generated in this case. bfd/ * elfxx-sparc.c (struct _bfd_sparc_elf_link_hash_entry): Add new flag has_old_style_got_reloc. (_bfd_sparc_elf_check_relocs) <GOT relocations>: Set it for old-style relocations. Fix a couple of long lines. (_bfd_sparc_elf_relocate_section) <R_SPARC_GOTDATA_OP>: Do not generate a R_SPARC_NONE for the GOT slot if the symbol is also subject to old-style GOT relocations. ld/ * testsuite/ld-sparc/sparc.exp: Add test for mixed GOTDATA/GOT relocs. * testsuite/ld-sparc/gotop-hidden.c: New file. * testsuite/ld-sparc/got-hidden32.s: Likewise. * testsuite/ld-sparc/got-hidden64.s: Likewise. * testsuite/ld-sparc/pass.out: Likewise.
2018-03-20New option -z,keep-text-section prefix.Sriraman Tallam8-18/+276
This option does not merge certain text sections with prefixes .text.hot, .text.unlikely, .text.startup and .text.exit. * layout.cc (Layout::default_section_order): Check for text section prefixes. (Layout::text_section_name_mapping): New static member. (Layout::text_section_name_mapping_count): New static member. (Layout::match_section_name): New static function. (Layout::output_section_name): Check for text section prefixes. * layout.h (Output_section_order::ORDER_TEXT_HOT): New enum value. (Output_section_order::ORDER_TEXT_STARTUP): New enum value. (Output_section_order::ORDER_TEXT_EXIT): New enum value. (Output_section_order::ORDER_TEXT_UNLIKELY): New enum value. (Layout::text_section_name_mapping): New static member. (Layout::text_section_name_mapping_count): New static member. (Layout::match_section_name): New static function. * options.h (keep_text_section_prefix): New -z option. * testsuite/Makefile.am (keep_text_section_prefix): New test. * testsuite/Makefile.in: Regenerate. * testsuite/keep_text_section_prefix.cc: New test source. * testsuite/keep_text_section_prefix.sh: New test script. (cherry picked from commit 779bdadbea9a62e5a2203651703e15edd321b9d6)
2018-02-22Another mergeNick Clifton5-66/+114
2018-02-22Fix memory corruption when using memcpy to overwtite a string in place.A. Wilcox2-1/+7
PR 22014 * config/tc-mips.c (mips_lookup_insn): Use memmove to strip the instruction size suffix.
2018-02-10Fix GOT relocation overflow on SPARC.Eric Botcazou2-64/+100
There are 2 failures left in the linker testsuite on SPARC64/Linux and they are caused by 2 different issues leading to the same end effect: the overflow of the relocation section for the GOT, i.e. the linker generates too many dynamic relocations for the GOT wrt the size of the relocation section, leading to memory corruption and missing relocations in the final binary. The first issue was introduced by: https://sourceware.org/ml/binutils/2017-06/msg00368.html which makes the linker generate more R_SPARC_RELATIVE relocations for the GOT without adjusting the size of the relocation section. This is fixed by (1) preventively adjusting this size in allocate_dynrelocs and (2) generating R_SPARC_NONE if needed when R_SPARC_GOTDATA_OP is relaxed. The second issue is that we generate a GOT relocation for an undefined weak symbol with non-default visibility in a PIC binary without accounting for that in the size of the relocation section. Since the address of the symbol should resolve to 0 at run time, it is fixed by not generating the relocation at all, i.e. leaving the GOT entry zeroed. bfd/ * elfxx-sparc.c (UNDEFINED_WEAK_RESOLVED_TO_ZERO): Reorder conditions. (sparc_elf_append_rela): Assert that there is enough room in section. (_bfd_sparc_elf_copy_indirect_symbol): Fix formatting. (_bfd_sparc_elf_adjust_dynamic_symbol): Minor tweak. (allocate_dynrelocs): Remove outdated comments and reorder conditions. For a symbol subject to a GOT relocation, reserve a slot in the relocation section if the symbol isn't dynamic and we are in PIC mode. (_bfd_sparc_elf_relocate_section) <R_SPARC_GOTDATA_OP>: If relocation is relaxed and a slot was reserved, generate a R_SPARC_NONE relocation. <R_SPARC_GOTDATA_OP_HIX22>: Adjust comments. <R_SPARC_PC10>: Reorder conditions. Remove always-false assertion. (_bfd_sparc_elf_finish_dynamic_symbol): Rename local_undefweak into resolved_to_zero. Do not generate a dynamic GOT relocation for an undefined weak symbol with non-default visibility. Remove superfluous 'else' and fix formatting.
2018-01-15Automatic date update in version.inGDB Administrator1-1/+1
2018-01-14Automatic date update in version.inGDB Administrator1-1/+1
2018-01-13Automatic date update in version.inGDB Administrator1-1/+1
2018-01-122018-01-12 Eric Christopher <echristo@gmail.com>Eric Christopher2-1/+13
Apply from master: 2018-01-12 Sterling Augustine <saugustine@google.com> * cref.cc (Cref_inputs::Cref_table_compare::operator): Add conditionals and calls to is_forwarder.
2018-01-12Automatic date update in version.inGDB Administrator1-1/+1
2018-01-11Automatic date update in version.inGDB Administrator1-1/+1
2018-01-10Automatic date update in version.inGDB Administrator1-1/+1
2018-01-09Automatic date update in version.inGDB Administrator1-1/+1
2018-01-08Automatic date update in version.inGDB Administrator1-1/+1
2018-01-07Automatic date update in version.inGDB Administrator1-1/+1
2018-01-06Automatic date update in version.inGDB Administrator1-1/+1
2018-01-05Automatic date update in version.inGDB Administrator1-1/+1
2018-01-04Automatic date update in version.inGDB Administrator1-1/+1
2018-01-03Automatic date update in version.inGDB Administrator1-1/+1
2018-01-02Automatic date update in version.inGDB Administrator1-1/+1
2018-01-01Automatic date update in version.inGDB Administrator1-1/+1
2017-12-31Automatic date update in version.inGDB Administrator1-1/+1
2017-12-30Automatic date update in version.inGDB Administrator1-1/+1
2017-12-29Automatic date update in version.inGDB Administrator1-1/+1
2017-12-28Automatic date update in version.inGDB Administrator1-1/+1
2017-12-27Automatic date update in version.inGDB Administrator1-1/+1
2017-12-26Automatic date update in version.inGDB Administrator1-1/+1
2017-12-25Automatic date update in version.inGDB Administrator1-1/+1
2017-12-24Automatic date update in version.inGDB Administrator1-1/+1
2017-12-23Automatic date update in version.inGDB Administrator1-1/+1
2017-12-22Automatic date update in version.inGDB Administrator1-1/+1
2017-12-21Automatic date update in version.inGDB Administrator1-1/+1
2017-12-20Automatic date update in version.inGDB Administrator1-1/+1
2017-12-19Automatic date update in version.inGDB Administrator1-1/+1
2017-12-19PR22626, invalid dynindx used for dynamic relocs against section symsAlan Modra2-8/+22
_bfd_elf_link_renumber_dynsyms is called twice by the linker. The first call in bfd_elf_size_dynamic_sections is just to answer the question as to whether there are there any dynamic symbols. The second call in bfd_elf_size_dynsym_hash_dynstr sets the st_shndx value that dynamic symbols will have. strip_excluded_output_sections is called between these two calls. So sections seen on the first _bfd_elf_link_renumber_dynsyms pass might differ from those seen on the second pass. Unfortunately, that can result in a stripped section's dynamic symbol being assigned a dynindx on the first pass but not corrected to the final value (of zero, ie. not dynamic) on the second pass. PowerPC, x86, mips, and most other targets that emit dynamic section symbols, just test that section symbol dynindx is non-zero before using a given section symbol in dynamic relocations. This patch prevents _bfd_elf_link_renumber_dynsyms from setting any section symbol dynindx on the first pass. PR 22626 * elflink.c (_bfd_elf_link_renumber_dynsyms): Don't set section dynindx when section_sym_count is NULL. (bfd_elf_size_dynamic_sections): Pass NULL section_sym_count to preliminary _bfd_elf_link_renumber_dynsyms call. (cherry picked from commit 63f452a8bfd9c89b56dcc087cea84151e7a9ec24)
2017-12-18Automatic date update in version.inGDB Administrator1-1/+1
2017-12-17Automatic date update in version.inGDB Administrator1-1/+1
2017-12-16Automatic date update in version.inGDB Administrator1-1/+1
2017-12-15Automatic date update in version.inGDB Administrator1-1/+1
2017-12-14Automatic date update in version.inGDB Administrator1-1/+1
2017-12-13Automatic date update in version.inGDB Administrator1-1/+1
2017-12-12Don't mask X_add_number containing a register numberAlan Modra2-1/+6
It's obviously wrong to mask SPRs to 8 bits. PR 21118 * config/tc-ppc.c (md_assemble): Don't mask register number. (cherry picked from commit 4b1c0f7e85f2aec3df3498d04b5beaf45813dea8)
2017-12-12Automatic date update in version.inGDB Administrator1-1/+1
2017-12-11Automatic date update in version.inGDB Administrator1-1/+1
2017-12-10Automatic date update in version.inGDB Administrator1-1/+1
2017-12-09Automatic date update in version.inGDB Administrator1-1/+1
2017-12-08Automatic date update in version.inGDB Administrator1-1/+1