aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* PR26574, heap buffer overflow in _bfd_elf_slurp_secondary_reloc_sectiongentoo/binutils-2.35.1Alan Modra2021-01-233-5/+14
| | | | | | | | | | | | A horribly fuzzed object with section headers inside the ELF header. Disallow that, and crazy reloc sizes. PR 26574 * elfcode.h (elf_object_p): Sanity check section header offset. * elf.c (_bfd_elf_slurp_secondary_reloc_section): Sanity check sh_entsize. (cherry picked from commit 8642dafaef21aa6747cec01df1977e9c52eb4679)
* Automatic date update in version.inGDB Administrator2021-01-231-1/+1
| | | | (cherry picked from commit 4100e6999664833defb8ee038f75812d9b85f9c7)
* PR27140, ppc32 segmentation fault in make_stubAlan Modra2021-01-232-4/+13
| | | | | | | | | | | | | | This fixes a thinko in commit fa40fbe4849. st_other global entry bits are relevant only for 64-bit ELFv2. PowerPC gold leaves local sym vector of st_other bits as NULL for 32-bit, hence the segfault. PR 27140 * powerpc.cc (Target_powerpc::Branch_info::make_stub): Only access object->st_other() when 64-bit. (Stub_table::add_long_branch_entry): Ignore "other" when 32-bit. (cherry picked from commit e3b53295d59d2e78292eaae4500243dd9e007ae4) (cherry picked from commit f8db4612c51d9980131268a1be06654846d9c8de)
* PR27128, nm -P portable output format regressionAlan Modra2021-01-2310-13/+131
| | | | | | | | | | | | | | | | | | | | binutils/ PR 27128 * nm.c (print_symname): Append version string to symbol name before printing the lot under control of "form". Append version to demangled names too. ld/ PR 27128 * testsuite/ld-elf/pr27128.s: New file. * testsuite/ld-elf/pr27128.t: Likewise. * testsuite/ld-elf/pr27128a.d: Likewise. * testsuite/ld-elf/pr27128b.d: Likewise. * testsuite/ld-elf/pr27128c.d: Likewise. * testsuite/ld-elf/pr27128d.d: Likewise. * testsuite/ld-elf/pr27128e.d: Likewise. (cherry picked from commit cab3f4da68672647cde72bc0c06ec08977819817) (cherry picked from commit 5ca7ac981b734591b1ca0acc36c2b2081e64d06c)
* sparc testsuite falloutAlan Modra2021-01-233-2/+6
| | | | | (cherry picked from commit f1a9fbd995b8997b7ed7e8e6a83129e923400a58) (cherry picked from commit 9640c06f805c6143e60c166906d270eeceb3cb19)
* elf: Keep only one '@' for undefined versioned symbolsH.J. Lu2021-01-239-5/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The symbol string table in the .symtab section is optional and cosmetic. Keep only one '@' for undefined versioned symbols, which are defined in shared objects, in the symbol string table. Update "nm -D" to display only one '@' for undefined versioned symbols. bfd/ PR ld/26382 * elflink.c (elf_link_output_symstrtab): Keep only one '@' for versioned symbols, which are defined in shared objects, in symbol string table. binutils/ PR ld/26382 * nm.c (print_symname): Display only one '@' for undefined versioned symbols. * doc/binutils.texi: Update nm version information. ld/ PR ld/26382 * testsuite/ld-elf/pr26302.nd: Updated. * testsuite/ld-elf/pr26302.rd: New file. * testsuite/ld-elf/shared.exp: Add a test for readelf -sW. (cherry picked from commit 3f2e9699234ca31d083bc93ea6e03903f10baeaf) (cherry picked from commit 0a690cf659075e47ec1f7aecf332e641b0bb0ed5)
* nm: Remove --with-symbol-versionsH.J. Lu2021-01-239-28/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since commit 7e6e972f74aeac0ebdbd95a7f905d871cd2581de Author: H.J. Lu <hjl.tools@gmail.com> Date: Tue Mar 24 04:23:11 2020 -0700 bfd: Display symbol version for nm -D always displays symbol version for nm, remove --with-symbol-versions and silently accept it for backward compatibility. binutils/ PR binutils/26302 * nm.c (with_symbol_versions): Removed. (long_option_values): Add OPTION_WITH_SYMBOL_VERSIONS. (long_options): Update --with-symbol-versions entry. (print_symbol): Remove the with_symbol_versions check. (main): Add OPTION_WITH_SYMBOL_VERSIONS for backward compatibility. * doc/binutils.texi: Remove --with-symbol-versions. ld/ PR binutils/26302 * testsuite/ld-elf/pr26302.nd: New file. * testsuite/ld-elf/pr26302.ver: Likewise. * testsuite/ld-elf/pr26302a.c: Likewise. * testsuite/ld-elf/pr26302b.c: Likewise. * testsuite/ld-elf/shared.exp: Run binutils/26302 tests. (cherry picked from commit 9b0ac51b22d0cf900f39e17e615bb22e32720f6e) (cherry picked from commit 794e008bac4ed9948015644bcf9b3ae178ef9a50)
* x86-64: Convert load to mov only for GOTPCRELX relocationsH.J. Lu2021-01-238-1/+91
| | | | | | | | | | | | | | | | | | | | | | | | Since converting load to mov needs to rewrite the REX byte and we don't know if there is a REX byte with GOTPCREL relocation, do it only for GOTPCRELX relocations. bfd/ PR ld/27016 * elf64-x86-64.c (elf_x86_64_convert_load_reloc): Convert load to mov only for GOTPCRELX relocations. ld/ PR ld/27016 * testsuite/ld-x86-64/x86-64.exp: Run pr27016a and pr27016b. * testsuite/ld-x86-64/pr27016a.d: New file. * testsuite/ld-x86-64/pr27016a.s: Likewise. * testsuite/ld-x86-64/pr27016b.d: Likewise. * testsuite/ld-x86-64/pr27016b.s: Likewise. (cherry picked from commit 7e45e7a9ab38ee904ca62ed9934e933fdb1d6e9c) (cherry picked from commit e539c8303ff871dda6ea95c5ec3da9ea6f3609ae)
* asan: readelf: stack buffer overflowAlan Modra2021-01-232-2/+10
| | | | | | | | | PR 26929 * readelf.c (print_dynamic_symbol): Don't sprintf to buffer to find string length. (cherry picked from commit ddb43bab174c50656331e5460b18bd8e8be5f522) (cherry picked from commit 372dd157272e0674d13372655cc60eaca9c06926)
* gas, arm: PR26858 Fix availability of single precision vmul/vmla in arm modeAndre Vieira2021-01-233-2/+16
| | | | | | | | | | | | | | | | | | This patch fixes a mistake when enabling MVE instructions that disabled support for single precision vmla and vmul for arm mode. gas/ChangeLog: 2020-11-19 Andre Vieira <andre.simoesdiasvieira@arm.com> Backport from mainline. 2020-11-12 Andre Vieira <andre.simoesdiasvieira@arm.com> PR 26858 * config/tc-arm.c (asm_opcode insns): Fix vmul and vmla's ARM_VARIANT. * testsuite/gas/arm/pr26858.s: New test. * testsuite/gas/arm/pr26858.d: New test. (cherry picked from commit 3792ebe961f68438b06c0a0b4a731a38b666080c)
* [GOLD] powerpc incremental-dump assertion failureAlan Modra2021-01-232-10/+18
| | | | | | | | | | | | | | | | incremental-dump wants to instantiate Target_powerpc without options being set up. This patch fixes internal error in options, at gold/parameters.h:92 * powerpc.cc (Target_powerpc::no_tprel_opt_): Rename from tprel_opt_. Init to false. (Target_powerpc::tprel_opt): Test parameters->options().tls_optimize(). (Target_powerpc::set_tprel_opt): Delete. (Target_powerpc::set_no_tprel_opt): New function. Update all uses of set_tprel_opt. (cherry picked from commit 4e0e019fa8eda9b7ffe0615133f55e9b0b882fa1) (cherry picked from commit 984b18d6d228ecb1c49f70acb7ae6e4f47f09414)
* [GOLD] fix jump to long branch on powerpcMichael Hudson-Doyle2021-01-232-2/+7
| | | | | | | | | PR 26902 * powerpc.cc (Relocate::relocate): Do not include local entry offset of target function when computing the address of a stub. (cherry picked from commit f1e05b19786669d29d59f48f26bc06ad67c221e2) (cherry picked from commit f7b330574f32eb91881e56401fe0cd875a96df19)
* dwarf: Also match abbrev base when searching abbrev listH.J. Lu2021-01-235-22/+1520
| | | | | | | | | | | | | | | | | | | | | | A .debug_abbrev section can have multiple CUs. When caching abbrev list, we need to check abbrev base to support multiple CUs. PR binutils/26808 * dwarf.c (abbrev_list): Add abbrev_base. (new_abbrev_list): Add an abbrev_base argument and record it. (find_abbrev_list_by_abbrev_offset): Add an abbrev_base argument and match it. (process_debug_info): Pass abbrev_base to new_abbrev_list and find_abbrev_list_by_abbrev_offset. (display_debug_abbrev): Pass 0 abbrev_base to new_abbrev_list and find_abbrev_list_by_abbrev_offset. * testsuite/binutils-all/x86-64/pr26808.dump: New file. * testsuite/binutils-all/x86-64/pr26808.dwp.bz2: Likewise. * testsuite/binutils-all/x86-64/x86-64.exp: Run PR binutils/26808 test. (cherry picked from commit 76868f3606fb9de04f49c441c1e3cdd3e943a34d) (cherry picked from commit 56cd748924ab24d64a87ae65bafc84f112b720c2)
* Re: Sync libiberty and include with GCC for get_DW_UT_nameAlan Modra2021-01-232-0/+16
| | | | | | | * dwarf.h (DW_FIRST_UT, DW_UT, DW_END_UT): Define. (cherry picked from commit cc9ea2c21cd6e2c88995a7484d2c848c7d7ce71b) (cherry picked from commit c33430a9e758aa3314483b96c358dba79dac9834)
* Accept the DW_FORM_ref8 type when parsing DWARF types.Nick Clifton2021-01-232-0/+24
| | | | | | | | | * dwarf.c (skip_attr_bytes): Correctly handle DW_FORM_ref8. (get_type_abbrev_from_form): Accept DW_FORM_ref8. (cherry picked from commit 1f57314183549008c065ad2240598d2b0f0ff56b and commit ed1afd86668781159a131dc9c9c4a54a3b0a1e3a) (cherry picked from commit 6feeb5de6a245f5739bc0369beb774a3ba1191f2)
* Fix the decoding of DW_FORM_ref_addr DWARF attribute.Nick Clifton2021-01-232-138/+477
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * dwarf.c (struct abbrev_list): New structure. Used to collect lists of abbreviation sets. (struct abbrev_map): New structure. Used to map CU offsets to abbreviation offsets. (record_abbrev_list): New function. A new entry to an abbreviation list. (free_all_abbrevs): Update to free abbreviation lists. (new_abbrev_list): New function. Start a new abbreviation list. (find_abbrev_list_by_abbrev_offset): New function. (find_abbrev_map_by_offset): New function. (add_abbrev): Add abbrev_list parameter. (add_abbrev_attr): Likewise. (process_abbrev_section): Rename to process_abbrev_set and add list parameter. (get_type_abbrev_from_form): New function. Attempts to decode the forms used by DW_AT_type attributes. (get_type_signedness): Display type names if operating in wide mode. Use get_type_abbrev_from_form. (read_and_display_attr_value): Use get_type_abbrev_from_form. (process_debug_info): Pre-parse the CU headers to collate all the abbrevs before starting the main scan. (process_debug_abbrev): Do not free any loaded abbrevs. (free_debug_memory): Free the abbrev maps. (cherry picked from commit bcd213b2cfbca2df53fb7e5d187fd67ea8eb7185) (cherry picked from commit ef5e3e92dc7234f64e77e8c8af5d61685d96263b)
* Work around problem in DWARF decoding library which can result in attempts ↵Nick Clifton2021-01-232-18/+39
| | | | | | | | | | | | | | | | to read arbitrary bytes as if they were an LEB128 encoded value. * dwarf.c (skip_attr_bytes): Accept DWARF versions higher than 4 when processing the DW_FORM_ref_addr form. Skip bytes in DW_FORM_block and DW_FORM_exprloc forms. Handle DW_FORM_indirect. (get_type_signedness): Allow a limited amount of recursion. Do not attempt to decode types that use the DW_FORM_ref_addr form. (read_and_display_attr_value): Do not attempt to decode types that use the DW_FORM_ref_addr form. (cherry picked from commit 596245135106b2a965d809e272dc7c758afdc98f) (cherry picked from commit e7c1a13eb8fcdbd389b75b6ce261b17f7947ad9d)
* gas: Reuse the input file entry in the file tableH.J. Lu2021-01-2311-29/+309
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some instructions can be emitted (dwarf2_emit_insn is called) before the first .file <NUMBER> directive has been seen, which allocates the input file as the first file entry. Reuse the input file entry in the file table. PR gas/25878 PR gas/26740 * dwarf2dbg.c (file_entry): Remove auto_assigned. (assign_file_to_slot): Remove the auto_assign argument. (allocate_filenum): Updated. (allocate_filename_to_slot): Reuse the input file entry in the file table. (dwarf2_where): Replace as_where with as_where_physical. * testsuite/gas/i386/dwarf5-line-1.d: New file. * testsuite/gas/i386/dwarf5-line-1.s: Likewise. * testsuite/gas/i386/i386.exp: Run dwarf5-line-1. (cherry picked from commit 6915020bb134ae29fd772295c66fd67b5944962d) gas: Always use as_where for preprocessed assembly codes Always clear the slot 1 if it was assigned to the input file before the first .file <NUMBER> directive has been seen. Always use as_where to generate the correct debug infor for preprocessed assembly codes. PR gas/25878 PR gas/26740 * dwarf2dbg.c (allocate_filename_to_slot): Don't reuse the slot 1 here. (dwarf2_where): Restore as_where. (dwarf2_directive_filename): Clear the slot 1 if it was assigned to the input file. * testsuite/gas/i386/dwarf5-line-2.d: New file. * testsuite/gas/i386/dwarf5-line-2.s: Likewise. * testsuite/gas/i386/dwarf5-line-3.d: Likewise. * testsuite/gas/i386/dwarf5-line-3.s: Likewise. * testsuite/gas/i386/i386.exp: Run dwarf5-line-2 and dwarf5-line-3. (cherry picked from commit bd0c565edbf4ba8121fded38e389530d7fa6f963) gas: Clear all auto-assigned file slots Since a file slot is auto-assigned for the #APP marker appeared before the first .file <NUMBER> directive has been seen, clear all auto-assigned file slots when seeing the first .file <NUMBER> directive. PR gas/26778 * * dwarf2dbg.c (num_of_auto_assigned): New. (allocate_filenum): Increment num_of_auto_assigned. (dwarf2_directive_filename): Clear the slots auto-assigned before the first .file <NUMBER> directive was seen. * testsuite/gas/i386/dwarf4-line-1.d: New file. * testsuite/gas/i386/dwarf4-line-1.s: Likewise. * testsuite/gas/i386/i386.exp: Run dwarf4-line-1. (cherry picked from commit ae9d2233e61a98ff8dba56be10219aa5306ffc9a) (cherry picked from commit ea873d892ebfae612aed5d308061b083b3f06636)
* readelf: Fix output of rnglists sectionBernd Edlinger2021-01-232-2/+17
| | | | | | | | * dwarf.c (display_debug_rnglists_list): Only bias the DW_RLS_offset_pair with the base address. (cherry picked from commit 4d93271533473d65165022ee9f82c368511ce82a) (cherry picked from commit 97cdf5f93459ff85e4e73e4da60d4f76e03187d0)
* binutils: dwarf.c handle DWARF5 DW_LLE_start_end and DW_LLE_start_length.Mark Wielaard2021-01-232-4/+27
| | | | | | | | | | | | | | display_loclists_list only handled DW_LLE_offset_pair as bounded location description. Also handle DW_LLE_start_end and DW_LLE_start_lenght. These don't use the base_address. binutils/ChangeLog: * dwarf.c (display_loclists_list): Handle DW_LLE_start_end and DW_LLE_start_length. Only add base_address for DW_LLE_offset_pair. (cherry picked from commit 1c9f770d16a715662564d810a1c1efefd7a66540) (cherry picked from commit 6ccb0b25575511e699f2c32631717fdfe14f5ad5)
* readelf: Show Unit Type for DWARF5Mark Wielaard2021-01-236-0/+23
| | | | | | | | | | | | | | | binutils/ChangeLog: * dwarf.c (process_debug_info): Print Unit Type for DWARF5. * testsuite/binutils-all/dw5.W: Adjust expected output. * testsuite/binutils-all/dwarf-attributes.W: Likewise. gas/ChangeLog: * testsuite/gas/elf/dwarf-5-cu.d: Adjust expected output. (cherry picked from commit debd1a62c4d250a6257e9018d9f9c7355edcdf8b) (cherry picked from commit b0ee5cba0726ba5c9698c301fdf86e651fd9c3f6)
* Sync libiberty and include with GCC for get_DW_UT_name.Mark Wielaard2021-01-235-13/+50
| | | | | | | | | | | | | | | | | | | | | | | This adds a get_DW_UT_name function to dwarfnames using dwarf2.def for use in binutils readelf to show the unit types in a DWARF5 header. include/ChangeLog: Sync with GCC * dwarf2.def: Add DWARF5 Unit type header encoding macros DW_UT_FIRST, DW_UT and DW_UT_END. * dwarf2.h (enum dwarf_unit_type): Removed and define using DW_UT_FIRST, DW_UT and DW_UT_END macros. (get_DW_UT_name): New function declaration. libiberty/ChangeLog: Sync with GCC * dwarfnames.c (get_DW_UT_name): Define using DW_UT_FIRST, DW_UT and DW_UT_END. (cherry picked from commit d7b477c541bd31045483f37345727bd8335a052a) (cherry picked from commit d89b66edf5baac6febf636c130c9a1b748c0ce97)
* binutils: Handle DWARF5 DW_FORM_ref_addr and DW_UT_partial.Mark Wielaard2021-01-232-2/+13
| | | | | | | | | | | | | | | | dwz in DWARF5 mode might produce DW_UT_partial unit types, which are the same as DW_UT_compile unit types (but start with a DW_TAG_partial_unit) and it might produce DW_FORM_ref_addr to create a reference between units. Accept both constructs. binutils/ChangeLog: * dwarf.c (read_and_display_attr_value): Handle DW_FORM_ref_addr for dwarf_version 5 just as version 3 and 4 (only 2 is different). (process_debug_info): Allow DW_UT_partial. (cherry picked from commit ec47b32a85294af959457ad19bd98dd13f6389fd) (cherry picked from commit c9ebbcc99b94820f4462308942ea0cab70c4b427)
* elf: Set rel_from_abs to 1 for __ehdr_startH.J. Lu2021-01-235-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bfdlink.h has /* Symbol will be converted from absolute to section-relative. Set for symbols defined by a script from "dot" (also SEGMENT_START or ORIGIN) outside of an output section statement. */ unsigned int rel_from_abs : 1; linker.c has .{* Return TRUE if the symbol described by a linker hash entry H . is going to be absolute. Linker-script defined symbols can be . converted from absolute to section-relative ones late in the . link. Use this macro to correctly determine whether the symbol . will actually end up absolute in output. *} .#define bfd_is_abs_symbol(H) \ . (((H)->type == bfd_link_hash_defined \ . || (H)->type == bfd_link_hash_defweak) \ . && bfd_is_abs_section ((H)->u.def.section) \ . && !(H)->rel_from_abs) . Set rel_from_abs to 1 for __ehdr_start which will be converted from absolute to section-relative in assign_file_positions_for_load_sections. PR ld/26869 * ldelf.c (ldelf_before_allocation): Set rel_from_abs to 1 for __ehdr_start. * testsuite/ld-i386/i386.exp: Run pr26869. * testsuite/ld-i386/pr26869.d: New file. * testsuite/ld-i386/pr26869.s: Likewise. (cherry picked from commit cbd5b99cce073273f668b154d4514e8e7e7ccc51) (cherry picked from commit 1767e3f3bd6d460491f8c8d032a7fea88d5ec8ff)
* aarch64: Add support for Neoverse N2 CPUAlex Coplan2021-01-233-0/+16
| | | | | | | | | | | | This patch backports the AArch64 support for Arm's Neoverse N2 CPU to binutils 2.35. gas/ChangeLog: * config/tc-aarch64.c (aarch64_cpus): Add neoverse-n2. * doc/c-aarch64.texi: Document support for Neoverse N2. (cherry picked from commit 1d63b4bfae093ef33f0aaef6863a726fed3e34ff)
* Automatic date update in version.ingentoo/binutils-2.35.1-2GDB Administrator2020-10-301-1/+1
| | | | (cherry picked from commit e8aa34cb4049866790cbd18bc7d95140a5e761c1)
* arm: Fix the wrong error message string for mve vldr/vstr (PR26763).Srinath Parvathaneni2020-10-305-1/+864
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For mve vldr/vstr instructions assembler is throwing wrong error message. Instead of 'Error: syntax error' assembler fails with 'Error: lo register required'. This patch fixes the issue. eg: $ cat x.s .syntax unified .thumb vldrb.s16 q0, r0 Before this patch: $ arm-none-eabi-as x.s -march=armv8.1-m.main+mve -mfloat-abi=hard x.s: Assembler messages: x.s:4: Error: lo register required -- `vldrb.s16 q0,r0' After this patch: $ arm-none-eabi-as x.s -march=armv8.1-m.main+mve -mfloat-abi=hard x.s: Assembler messages: x.s:4: Error: syntax error -- `vldrb.s16 q0,r0' gas/ChangeLog: 2020-10-21 Srinath Parvathaneni <srinath.parvathaneni@arm.com> PR target/26763 * config/tc-arm.c (parse_address_main): Add new MVE addressing mode check. * testsuite/gas/arm/mve-vldr-vstr-bad.d: New test. * testsuite/gas/arm/mve-vldr-vstr-bad.l: Likewise. * testsuite/gas/arm/mve-vldr-vstr-bad.s: Likewise. (cherry picked from commit 83b4a887fce217923a92b5a3c2b939c1629ff7a8)
* Automatic date update in version.inGDB Administrator2020-10-211-1/+1
| | | | (cherry picked from commit d70052f938853107d75a46b1ab19c79cf3f27369)
* arm: Add support for Neoverse N2 CPUAlex Coplan2020-10-213-0/+11
| | | | | | | | | | | | This patch backports the AArch32 support for Arm's Neoverse N2 CPU to binutils 2.35. gas/ChangeLog: * config/tc-arm.c (arm_cpus): Add Neoverse N2. * doc/c-arm.texi: Document -mcpu=neoverse-n2. (cherry picked from commit 72e2c97030c686248df2e8fd6e2eb8bfbdc730f3)
* [GOLD] Power10 segv due to wild r2Alan Modra2020-10-214-18/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Calling non-pcrel functions from pcrel code requires a stub to set up r2. Gold created the stub, but an "optimisation" made the stub jump to the function local entry, ie. r2 was not initialised. This patch fixes that long branch stub problem, and another that might occur for plt call stubs to local functions. bfd/ * elf64-ppc.c (write_plt_relocs_for_local_syms): Don't do local entry offset optimisation. gold/ * powerpc.cc (Powerpc_relobj::do_relocate_sections): Don't do local entry offset optimisation for lplt_section. (Target_powerpc::Branch_info::make_stub): Don't add local entry offset to long branch dest passed to add_long_branch_entry. Do pass st_other bits. (Stub_table::Branch_stub_ent): Add "other_" field. (Stub_table::add_long_branch_entry): Add "other" param, and save. (Stub_table::branch_stub_size): Adjust long branch offset. (Stub_table::do_write): Likewise. (Target_powerpc::Relocate::relocate): Likewise. (cherry picked from commit fa40fbe484954c560ab1c0ff4bc1b2eeb1511344) (cherry picked from commit 43fb3c78d42692620400eb76a6b6aa87b37f7693)
* [GOLD] internal error in relocate, at powerpc.cc:10473Alan Modra2020-10-212-7/+21
| | | | | | | | | | | | | GOT relocations can refer directly to a function in a fixed position executable, unlike ADDR64 which needs a global entry stub, or branch relocs, which need PLT stubs. * powerpc.cc (is_got_reloc): New function. (Target_powerpc::Relocate::relocate): Use it here, exclude GOT relocs when looking for stubs. (cherry picked from commit 4290b0ab2b65db23afc9bd8177885bfd91911c0c) (cherry picked from commit caa173b504c6c5d8edbe7c4f48b85664657b319b)
* arm: Add support for Neoverse V1 CPUAlex Coplan2020-10-213-0/+11
| | | | | | | | | | | | This patch backports the AArch32 support for Arm's Neoverse V1 CPU to binutils 2.35. gas/ChangeLog: * config/tc-arm.c (arm_cpus): Add Neoverse V1. * doc/c-arm.texi: Document Neoverse V1 support. (cherry picked from commit 923aeb9c87eefae7fb9602c573b951a134bcee53)
* gold: Update testsuite/split_[i386|x32|x86_64].shH.J. Lu2020-10-214-7/+13
| | | | | | | | | | | | | | | | | | | Update testsuite/split_i386.sh, testsuite/split_x32.sh and testsuite/split_x86_64.sh for commit f9ff65d4dffbaf342dce7a8760059c27683cd962 Author: Alan Modra <amodra@gmail.com> Date: Thu Oct 8 10:27:43 2020 +1030 [GOLD] Increase --split-stack-adjust-size * testsuite/split_i386.sh: Updated for --split-stack-adjust-size default change. * testsuite/split_x32.sh: Likewise. * testsuite/split_x86_64.sh: Likewise. (cherry picked from commit f511427204f281bc6278bb1facf6493518300806) (cherry picked from commit e6a9b6b62f787806b2cb410ffee8b2df31e6f8d8)
* [GOLD] Increase --split-stack-adjust-sizeAlan Modra2020-10-212-1/+5
| | | | | | | | | | | | | | For functions with small (< 256 bytes) stack frames, the current x86 do_calls_non_split ignores --split-stack-adjust-size and, in combination with __morestack_non_split, supplies a non-split-stack function with at least 0x100000 (1M) available stack. On powerpc64, a default of 0x4000 is not large enough to reliably work with the golang testsuite. This increase the default size to the defacto x86 value. * options.h (split_stack_adjust_size): Default to 0x100000. (cherry picked from commit f9ff65d4dffbaf342dce7a8760059c27683cd962) (cherry picked from commit 5cffc4901e1d72da87aa7ff6d22c152726455831)
* x86: Update register operand check for AddrPrefixOpRegH.J. Lu2020-10-2121-61/+202
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the address size prefix applies to both the memory and the register operand, we need to extract the address size prefix from the register operand if the memory operand has no real registers, like symbol, DISP or symbol(%rip). NB: GCC always generates symbol(%rip) for RIP-relative addressing for both x32 and x86-64. Move the .code16 tests in movdir.s to movdir-16bit to show the correct output from objdump. gas/ PR gas/26685 * config/tc-i386.c (process_suffix): Also check the register operand for the address size prefix if the memory operand has no real registers. * testsuite/gas/i386/enqcmd-16bit.d: New file. * testsuite/gas/i386/enqcmd-16bit.s: Likewise. * testsuite/gas/i386/movdir-16bit.d: Likewise. * testsuite/gas/i386/movdir-16bit.s: Likewise. * testsuite/gas/i386/enqcmd.s: Add tests with symbol and DISP. * testsuite/gas/i386/x86-64-enqcmd.s: Likewise. * testsuite/gas/i386/x86-64-movdir.s: Likewise. * testsuite/gas/i386/movdir.s: Add tests with symbol and DISP. Remove the .code16 test. * testsuite/gas/i386/i386.exp: Run movdir-16bit and enqcmd-16bit. * testsuite/gas/i386/x86-64-enqcmd-intel.d: Updated. * testsuite/gas/i386/x86-64-enqcmd.d: Likewise. * testsuite/gas/i386/x86-64-movdir-intel.d: Likewise. * testsuite/gas/i386/x86-64-movdir.d: Likewise. * testsuite/gas/i386/enqcmd-intel.d: Likewise. * testsuite/gas/i386/enqcmd.d: Likewise. * testsuite/gas/i386/movdir-intel.d: Likewise. * testsuite/gas/i386/movdir.d: Likewise. * testsuite/gas/i386/x86-64-enqcmd-intel.d: Likewise. * testsuite/gas/i386/x86-64-enqcmd.d: Likewise. * testsuite/gas/i386/x86-64-movdir-intel.d: Likewise. * testsuite/gas/i386/x86-64-movdir.d: Likewise. opcodes/ PR gas/26685 * i386-dis.c (mod_table): Replace Gv with Gdq on movdiri. (cherry picked from commit b3a3496f83a14ad226790725c8e3ed9777fe2899) (cherry picked from commit be5ff8fe6dc4bd39caf9073f1a40816513f46a65)
* x86: Check register operand for AddrPrefixOpRegH.J. Lu2020-10-218-34/+114
| | | | | | | | | | | | | | | | | | | If the address prefix changes the register operand, we need to check the register operand when the memory operand is RIP-relative. PR gas/26685 * config/tc-i386.c (process_suffix): Check the register operand for the address size prefix if the memory operand is symbol(%rip). * testsuite/gas/i386/x86-64-enqcmd.s: Add tests with RIP-relative addressing. * testsuite/gas/i386/x86-64-movdir.s: Likewise. * testsuite/gas/i386/x86-64-enqcmd-intel.d: Updated. * testsuite/gas/i386/x86-64-enqcmd.d: Likewise. * testsuite/gas/i386/x86-64-movdir-intel.d: Likewise. * testsuite/gas/i386/x86-64-movdir.d: Likewise. (cherry picked from commit 27f134698ac529f3050f5ddbd31a0ab0bbe5be99) (cherry picked from commit 3879a8a82d0c02d0322daa32523523cc42c26ca3)
* Revert "x86: Don't display eiz with no scale"Jan Beulich2020-10-216-14/+25
| | | | | | | | | | This reverts commit 04c662e2b66bedd050f97adec19afe0fcfce9ea7. In my underlying suggestion I neglected the fact that in those cases (,%eiz,1) is the only visible indication that 32-bit addressing is in effect. (cherry picked from commit bf4ba07ca61793a1faf81c0447ba97fdc6639b50) (cherry picked from commit 95f2e4249640dca770715e3ff33d18129bea7e32)
* x86: Update GNU property testsH.J. Lu2020-10-217-0/+16
| | | | | | | | | | | | | | | | | | Update property tests for glibc compiled by Fedora binary annotation plugin for GCC, which may insert additonal GNU properties: x86 ISA needed: SSE, SSE2 * testsuite/ld-i386/property-3.r: Updated for Fedora binary annotation plugin for GCC. * testsuite/ld-i386/property-4.r: Likewise. * testsuite/ld-i386/property-5.r: Likewise. * testsuite/ld-x86-64/property-3.r: Likewise. * testsuite/ld-x86-64/property-4.r: Likewise. * testsuite/ld-x86-64/property-5.r: Likewise. (cherry picked from commit f95f5adb9a50a27639a811c540c008e776aee46d) (cherry picked from commit b189feab422f695b3dfb0d017b4ec8d32002499b)
* x86: Properly merge -z ibt and -z shstkH.J. Lu2020-10-2115-12/+173
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Merge -z ibt and -z shstk only with GNU_PROPERTY_X86_FEATURE_1_AND, not any GNU_PROPERTY_X86_UINT32_AND_XXX properties. bfd/ PR ld/26711 * elfxx-x86.c (_bfd_x86_elf_merge_gnu_properties): Merge -z ibt and -z shstk only with GNU_PROPERTY_X86_FEATURE_1_AND. ld/ PR ld/26711 * testsuite/ld-i386/i386.exp: Run ld/26711 tests. * testsuite/ld-x86-64/x86-64.exp: Likewise. * testsuite/ld-i386/pr26711-1.d: Likewise. * testsuite/ld-i386/pr26711-2.d: Likewise. * testsuite/ld-i386/pr26711-3.d: Likewise. * testsuite/ld-x86-64/pr26711-1-x32.d: Likewise. * testsuite/ld-x86-64/pr26711-1.d: Likewise. * testsuite/ld-x86-64/pr26711-2-x32.d: Likewise. * testsuite/ld-x86-64/pr26711-2.d: Likewise. * testsuite/ld-x86-64/pr26711-3-x32.d: Likewise. * testsuite/ld-x86-64/pr26711-3.d: Likewise. * testsuite/ld-x86-64/pr26711.s: Likewise. (cherry picked from commit 574df58f5295ef2728526e6a73b5f429b05f2a8c) (cherry picked from commit 691e341c06659f7161c5b08d092039efe6eae209)
* aarch64: Fix bogus type punning in parse_barrier() [PR26699]Alex Coplan2020-10-214-7/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes a bogus use of type punning in parse_barrier() which was causing an assembly failure on big endian LP64 hosts when attempting to assemble "isb sy" for AArch64. The type of the entries in aarch64_barrier_opt_hsh is aarch64_name_value_pair. We were incorrectly casting this to the locally-defined asm_barrier_opt which has a wider type (on LP64) for the second member. This happened to work on little-endian hosts but fails on LP64 big endian. The fix is to use the correct type in parse_barrier(). This makes the locally-defined asm_barrier_opt redundant, so remove it. gas/ChangeLog: PR 26699 * config/tc-aarch64.c (asm_barrier_opt): Delete. (parse_barrier): Fix bogus type punning. * testsuite/gas/aarch64/system.d: Update disassembly. * testsuite/gas/aarch64/system.s: Add isb sy test. (cherry picked from commit 05cfb0d8cc9b7f8676f5ae55a93642f091d5405f) (cherry picked from commit def9db5cb2a3e87ceada962a3269367b08dc4846)
* aarch64: Add support for Neoverse V1 CPUAlex Coplan2020-10-213-0/+15
| | | | | | | | | | | | This backports the AArch64 support for Arm's Neoverse V1 CPU to binutils 2.35. gas/ChangeLog: * config/tc-aarch64.c (aarch64_cpus): Add Neoverse V1. * doc/c-aarch64.texi: Document Neoverse V1 support. (cherry picked from commit bb671bac84078bf01b681e22b7301914955057dd)
* Re: PR26656, power10 libstdc++.so segfault in __cxxabiv1::__cxa_throwAlan Modra2020-10-212-1/+10
| | | | | | | | | | | | Some missing NULL checks meant a stub for a local symbol used a stub looking like the __tls_get_addr_opt stub. PR 26656 * elf64-ppc.c (ppc_build_one_stub, ppc_size_one_stub): Check for NULL stub_entry->h before calling is_tls_get_addr. (cherry picked from commit 12cf8b93da0ae155643d262235486fde5af72a80) (cherry picked from commit 39f2c1f7b80a30297e93f04c885b444e5a874372)
* [GOLD] PPC64_OPT_LOCALENTRY is incompatible with tail callsAlan Modra2020-10-212-20/+81
| | | | | | | | | | | | | | | | | | | | | | | | Gold version of commit 3cd7c7d7ef. * powerpc.cc (Target_powerpc): Rename power10_stubs_ to power10_relocs_. (Target_powerpc::set_power10_relocs): New accessor. (Target_powerpc::set_power10_stubs): Delete. (Target_powerpc::power10_stubs): Adjust. (Target_powerpc::has_localentry0): New accessor. (ld_0_11): New constant. (glink_eh_frame_fde_64v1, glink_eh_frame_fde_64v2): Adjust. (glink_eh_frame_fde_64v2_localentry0): New. (Output_data_glink::pltresolve_size): Update. (Output_data_glink::add_eh_frame): Use localentry0 version eh_frame. (Output_data_glink::do_write): Move r2 save to start of ELFv2 stub and only emit for has_localentry0. Don't use r2 in the stub. (Target_powerpc::Scan::local, global): Adjust for set_power10_relocs renaming. (Target_powerpc::scan_relocs): Warn and reset plt_localentry0_. (cherry picked from commit 63e5eea234c2bd2c7ce7dc921c71b22bc4fd0d6b) (cherry picked from commit 9ac6946e2514e5ec1bb51d1afe9f127807e21067)
* PPC64_OPT_LOCALENTRY is incompatible with tail callsAlan Modra2020-10-2112-52/+124
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The save of r2 in __glink_PLTresolve is the culprit. Remove it, unless we know we need it for --plt-localentry. --plt-localentry should not be used with power10 pc-relative code that makes tail calls. The patch also removes use of r2 as a scratch reg in the ELFv2 __glink_PLTresolve. Using r2 isn't a problem, this is just reducing the number of scratch regs. bfd/ * elf64-ppc.c (GLINK_PLTRESOLVE_SIZE): Depend on has_plt_localentry0. (LD_R0_0R11, ADD_R11_R0_R11): Define. (ppc64_elf_tls_setup): Disable params->plt_localentry0 when power10 code detected. (ppc64_elf_size_stubs): Update __glink_PLTresolve eh_frame. (ppc64_elf_build_stubs): Move r2 save to start of __glink_PLTresolve, and only emit for has_plt_localentry0. Don't use r2 in the stub. ld/ * testsuite/ld-powerpc/elfv2so.d, * testsuite/ld-powerpc/notoc2.d, * testsuite/ld-powerpc/tlsdesc.wf, * testsuite/ld-powerpc/tlsdesc2.d, * testsuite/ld-powerpc/tlsdesc2.wf, * testsuite/ld-powerpc/tlsopt5.d, * testsuite/ld-powerpc/tlsopt5.wf, * testsuite/ld-powerpc/tlsopt6.d, * testsuite/ld-powerpc/tlsopt6.wf: Update __glink_PLTresolve. (cherry picked from commit 3cd7c7d7ef38ec5dc0a0c137c47d9ad0fc9e2e5f) (cherry picked from commit eec51831f13bbbb57f34def5734bc7b1aedd6675)
* Import patch from mainline to fix decoding DWARF information in the BFD library.Nick Clifton2020-10-212-2/+12
| | | | | | | | PR 26520 * dwarf2.c (scan_unit_for_symbols): Add member entries to the variable table. (cherry picked from commit 269d40a2ef3b020b5beb3f3de5b8e909c43ab53b)
* [GOLD] PowerPC64 __tls_get_addr_opt stubAlan Modra2020-10-212-14/+22
| | | | | | | | | | This stub doesn't have the r2 store at the beginning. * powerpc.cc (Target_powerpc::Relocate::relocate): Don't skip first insn of __tls_get_addr_opt stub. (cherry picked from commit a993d270f8423a8b6faa2ce9d245073bed076bb0) (cherry picked from commit dc9f426801780e98f6bb81e74d5bb10b663260ac)
* [GOLD] Power10 stub selectionAlan Modra2020-10-214-235/+551
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | gold version of commit e10a07b32dc1. * options.h (DEFINE_enum): Add optional_arg__ param, adjust all uses. (General_options): Add --power10-stubs and --no-power10-stubs. * options.cc (General_options::finalize): Handle --power10-stubs. * powerpc.cc (set_power10_stubs): Don't set when --power10-stubs=no. (power10_stubs_auto): New. (struct Plt_stub_ent): Add toc_ and tocoff_. Don't use a bitfield for indx_. (struct Branch_stub_ent): Add toc_and tocoff_. Use bitfields for iter_, notoc_ and save_res_. (add_plt_call_entry): Set toc_. Adjust resizing conditions for --power10-stubs=auto. (add_long_branch_entry): Set toc_. (add_eh_frame, define_stub_syms): No longer use const_iterators for plt and long branch stub iteration. (build_tls_opt_head, build_tls_opt_tail): Change parameters and return value. Move tests for __tls_get_addr to callers. (plt_call_size): Handle --power10-stubs=auto. (branch_stub_size): Likewise. (Stub_table::do_write): Likewise. (relocate): Likewise. (cherry picked from commit afd2ea23626c43886ab8b028b68b7b663d6de3c6) (cherry picked from commit 55ae73eaa02c4268e5fdf9e4cf1f154ea3689879)
* PR26656, power10 libstdc++.so segfault in __cxxabiv1::__cxa_throwAlan Modra2020-10-212-185/+259
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds missing support for a power10 version of the __tls_get_addr call stub implementing DT_PPC64_OPT PPC64_OPT_TLS. Without this, power10 code using __tls_get_addr fails miserably at runtime unless the --no-tls-get-addr-optimize option is given. PR 26656 * elf64-ppc.c (plt_stub_size): Add "odd" param. Use it with size_power10_offset rather than calculating from start of stub. Add size for notoc tls_get_addr_opt stub. (plt_stub_pad): Add "odd" param, pass to plt_stub_size. (build_tls_get_addr_head, build_tls_get_addr_tail): New functions. (build_tls_get_addr_stub): Delete. (ppc_build_one_stub): Use a temp for htab->params->stub_bfd. Emit notoc tls_get_addr_opt stub. Move eh_frame code to suit. Adjust code to use bfd_tls_get_addr_head/tail in place of build_tls_get_addr_stub. (ppc_size_one_stub): Size notoc tls_get_addr_opt stub. Adjust plt_stub_size and plt_stub_pad calls. Correct "odd" when padding stub. Size eh_frame for notoc stub too. Correct lr_restore value. (ppc64_elf_relocate_section): Don't skip over first insn of notoc tls_get_addr_opt stub. (cherry picked from commit 294338867c268b6da43327b6cbe70e746bff1a04) (cherry picked from commit 6f9a6c28850f6839ff61af22c277b2abbf7895da)
* PR26655, Power10 libstdc++.so R_PPC64_NONE dynamic relocsAlan Modra2020-10-215-15/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some of the powerpc64 code editing functions are better run after dynamic symbols have stabilised in order to make proper decisions based on SYMBOL_REFERENCES_LOCAL. The dynamic symbols are processed early in bfd_elf_size_dynamic_sections, before the backend always_size_sections function is called. One function, ppc64_elf_tls_setup must run before bfd_elf_size_dynamic_sections because it changes dynamic symbols. ppc64_elf_edit_opd and ppc64_elf_inline_plt can run early or late, I think. ppc64_elf_tls_optimize and ppc64_elf_edit_toc are better run later. So this patch arranges to call some edit functions later via always_size_sections. PR 26655 bfd/ * elf64-ppc.c (ppc64_elf_func_desc_adjust): Rename to.. (ppc64_elf_edit): Call params->edit. (ppc64_elf_tls_setup): Don't call _bfd_elf_tls_setup. Return a bfd_boolean. * elf64-ppc.h (struct ppc64_elf_params): Add "edit". (ppc64_elf_tls_setup): Update declaration. ld/ * emultempl/ppc64elf.em (params): Add ppc_edit. (ppc_before_allocation): Split off some edit functions to.. (ppc_edit): ..this, new function. (cherry picked from commit c94053440e29421dd8846530da73f09c9ede2e0f) (cherry picked from commit 97c22b122492ab3d2d1fd6237cadc56296ce76d2)
* Correct vcmpsq, vcmpuq and xvtlsbb BF fieldAlan Modra2020-10-216-6/+15
| | | | | | | | | | | | | | | | | These shouldn't be optional. The record form of vector instructions set CR6, giving an expectation that omitting BF should be the same as specifying CR6. opcodes/ * ppc-opc.c (powerpc_opcodes): Replace OBF with BF for vcmpsq, vcmpuq and xvtlsbb. gas/ * testsuite/gas/ppc/int128.s: Correct vcmpuq. * testsuite/gas/ppc/int128.d: Update. * testsuite/gas/ppc/xvtlsbb.d: Update. (cherry picked from commit 18a8a00ebe3159b65798c6132cb5f93ff4ef6c17) (cherry picked from commit 172234e1fab477ba36ec292913b1f13ef6b94783)