aboutsummaryrefslogtreecommitdiff
path: root/bfd
AgeCommit message (Collapse)AuthorFilesLines
2017-06-16[AArch64] Use SYMBOL_REFERENCES_LOCAL in one symbol checkJiong Wang2-4/+9
For some pc-relative relocations we want to allow them under PIC mode while a normal global symbol defined in the same dynamic object can still bind externally through copy relocation. So, we should not allow pc-relative relocation against such symbol. SYMBOL_REFERENCES_LOCAL should be used and is more accurate than the original individual checks. bfd/ * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Use SYMBOL_REFERENCES_LOCAL. ld/ * testsuite/ld-aarch64/aarch64-elf.exp: Update test name * testsuite/ld-aarch64/pcrel.s: Add new testcases. * testsuite/ld-aarch64/pcrel_pic_undefined.d: Update the expected warnings. * testsuite/ld-aarch64/pcrel_pic_defined_local.d: Rename ... * testsuite/ld-aarch64/pcrel_pic_defined.d: ... to this. Update expected warnings.
2017-06-16Automatic date update in version.inGDB Administrator1-1/+1
2017-06-15[AArch64] Allow COPY relocation eliminationJiong Wang2-47/+138
As discussed at the PR, this patch tries to avoid COPY relocation generation and propagate the original relocation into runtime if it was relocating on writable section. The ELIMINATE_COPY_RELOCS has been set to true and it's underlying infrastructure has been improved so that the COPY reloc elimination at least working on absoluate relocations (ABS64) on AArch64. BFD linker copy relocation elimination framwork requires the backend to always allocate dynrelocs for all those relocation types that are possible to introduce copy relocations. This is for adjust_dynamic_symbol hook to be able to get all symbol reference information. Should one symbol is referenced by more than one relocations, if there is any of them needs copy relocation then linker should generate it. bfd/ PR ld/21532 * elfnn-aarch64.c (ELIMINATE_COPY_RELOCS): Set to 1. (elfNN_aarch64_final_link_relocate): Also propagate relocations to runtime for if there needs copy relocation elimination. (need_copy_relocation_p): New function. Return true for symbol with pc-relative references and if it's against read-only sections. (elfNN_aarch64_adjust_dynamic_symbol): Use need_copy_relocation_p. (elfNN_aarch64_check_relocs): Allocate dynrelocs for relocation types that are related with accessing external objects. (elfNN_aarch64_gc_sweep_hook): Sync the relocation types with the change in elfNN_aarch64_check_relocs. ld/ * testsuite/ld-aarch64/copy-reloc-exe-2.s: New test source file. * testsuite/ld-aarch64/copy-reloc-2.d: New test. * testsuite/ld-aarch64/copy-reloc-exe-eliminate.s: New test source file. * testsuite/ld-aarch64/copy-reloc-eliminate.d: New test. * testsuite/ld-aarch64/copy-reloc-so.s: Define new global objects. * testsuite/ld-aarch64/aarch64-elf.exp: Run new tests.
2017-06-15Fix address violation parsing a corrupt ieee binary.Nick Clifton2-1/+3
PR binutils/21581 (ieee_archive_p): Use a static buffer to avoid compiler bugs.
2017-06-15Avoid a possible compiler bug by using a static buffer instead of a stack ↵Nick Clifton2-1/+7
local buffer. PR binutils/21582 * ieee.c (ieee_object_p): Use a static buffer to avoid compiler bugs.
2017-06-15Handle EITR records in VMS Alpha binaries with overlarge command length ↵Nick Clifton2-8/+13
parameters. PR binutils/21579 * vms-alpha.c (_bfd_vms_slurp_etir): Extend check of cmd_length.
2017-06-15Automatic date update in version.inGDB Administrator1-1/+1
2017-06-14xtensa: don't expect XCHAL_* macros to be constantMax Filippov2-25/+44
Get rid of the assumption that XCHAL_* macros are preprocessor constants: don't use them in preprocessor conditionals or in static variable initializers. 2017-06-14 Max Filippov <jcmvbkbc@gmail.com> bfd/ * elf32-xtensa.c (elf_xtensa_be_plt_entry, elf_xtensa_le_plt_entry): Add dimension for the ABI to arrays, keep both windowed and call0 ABI PLT definitions. (elf_xtensa_create_plt_entry): Use selected ABI to choose upper elf_xtensa_*_plt_entry endex. (ELF_MAXPAGESIZE): Fix at minimal supported MMU page size. gas/ * config/tc-xtensa.c (density_supported, xtensa_fetch_width, absolute_literals_supported): Leave definitions uninitialized. (directive_state): Leave entries for directive_density and directive_absolute_literals initialized to false. (xg_init_global_config, xtensa_init): New functions. * config/tc-xtensa.h (TARGET_BYTES_BIG_ENDIAN): Define as 0. (HOST_SPECIAL_INIT): New definition. (xtensa_init): New declaration.
2017-06-14Fix address violation bug when disassembling a corrupt SH binary.Nick Clifton2-1/+7
PR binutils/21578 * elf32-sh.c (sh_elf_set_mach_from_flags): Fix check for invalid flag value.
2017-06-14Fix potential address violations when processing a corrupt Alpha VMA binary.Nick Clifton2-10/+50
PR binutils/21589 * vms-alpha.c (_bfd_vms_get_value): Add an extra parameter - the maximum value for the ascic pointer. Check that name processing does not read beyond this value. (_bfd_vms_slurp_etir): Add checks for attempts to read beyond the end of etir record.
2017-06-14Fix seg-faults in objdump when disassembling a corrupt versados binary.Nick Clifton2-4/+14
PR binutils/21591 * versados.c (versados_mkobject): Zero the allocated tdata structure. (process_otr): Check for an invalid offset in the otr structure.
2017-06-14Accept more epiphany targetsSebastian Huber2-1/+5
In particular this adds support for the epiphany-rtems target. bfd/ * config.bfd (epiphany-*-elf): Accept epiphany-*-*. ld/ * configure.tgt (epiphany-*-elf): Accept epiphany-*-*.
2017-06-14Automatic date update in version.inGDB Administrator1-1/+1
2017-06-13Always define referenced __start_SECNAME/__stop_SECNAMEH.J. Lu5-103/+92
Currently, linker will define __start_SECNAME and __stop_SECNAME symbols only for orphaned sections. However, during garbage collection, ELF linker marks all sections with references to __start_SECNAME and __stop_SECNAME symbols as used even when section SECNAME isn't an orphaned section and linker won't define __start_SECNAME nor __stop_SECNAME. And ELF linker stores the first input section whose name matches __start_SECNAME or __stop_SECNAME in u.undef.section for garbage collection. If these symbols are provided in linker script, u.undef.section is set to the section where they will defined by linker script, which leads to the incorrect output. This patch changes linker to always define referenced __start_SECNAME and __stop_SECNAME if the input section name is the same as the output section name, which is always true for orphaned sections, and SECNAME is a C identifier. Also __start_SECNAME and __stop_SECNAME symbols are marked as hidden by ELF linker so that __start_SECNAME and __stop_SECNAME symbols for section SECNAME in different modules are unique. For garbage collection, ELF linker stores the first matched input section in the unused vtable field. bfd/ PR ld/20022 PR ld/21557 PR ld/21562 PR ld/21571 * elf-bfd.h (elf_link_hash_entry): Add start_stop. Change the vtable field to a union. (_bfd_elf_is_start_stop): Removed. * elf32-i386.c (elf_i386_convert_load_reloc): Also check for __start_SECNAME and __stop_SECNAME symbols. * elf64-x86-64.c (elf_x86_64_convert_load_reloc): Likewise. * elflink.c (_bfd_elf_is_start_stop): Removed. (_bfd_elf_gc_mark_rsec): Check start_stop instead of calling _bfd_elf_is_start_stop. (elf_gc_propagate_vtable_entries_used): Skip __start_SECNAME and __stop_SECNAME symbols. Updated. (elf_gc_smash_unused_vtentry_relocs): Likewise. (bfd_elf_gc_record_vtinherit): Likewise. (bfd_elf_gc_record_vtentry): Likewise. ld/ PR ld/20022 PR ld/21557 PR ld/21562 PR ld/21571 * ld.texinfo: Update __start_SECNAME/__stop_SECNAME symbols. * ldlang.c (lang_insert_orphan): Move handling of __start_SECNAME and __stop_SECNAME symbols to ... (lang_set_startof): Here. Also define __start_SECNAME and __stop_SECNAME for -Ur. * emultempl/elf32.em (gld${EMULATION_NAME}_after_open): Mark referenced __start_SECNAME and __stop_SECNAME symbols as hidden and set start_stop for garbage collection. * testsuite/ld-elf/pr21562a.d: New file. * testsuite/ld-elf/pr21562a.s: Likewise. * testsuite/ld-elf/pr21562a.t: Likewise. * testsuite/ld-elf/pr21562b.d: Likewise. * testsuite/ld-elf/pr21562b.s: Likewise. * testsuite/ld-elf/pr21562b.t: Likewise. * testsuite/ld-elf/pr21562c.d: Likewise. * testsuite/ld-elf/pr21562c.t: Likewise. * testsuite/ld-elf/pr21562d.d: Likewise. * testsuite/ld-elf/pr21562d.t: Likewise. * testsuite/ld-elf/pr21562e.d: Likewise. * testsuite/ld-elf/pr21562f.d: Likewise. * testsuite/ld-elf/pr21562g.d: Likewise. * testsuite/ld-elf/pr21562h.d: Likewise. * testsuite/ld-elf/pr21562i.d: Likewise. * testsuite/ld-elf/pr21562j.d: Likewise. * testsuite/ld-elf/pr21562k.d: Likewise. * testsuite/ld-elf/pr21562l.d: Likewise. * testsuite/ld-elf/pr21562m.d: Likewise. * testsuite/ld-elf/pr21562n.d: Likewise. * testsuite/ld-gc/pr20022.d: Likewise. * testsuite/ld-gc/pr20022a.s: Likewise. * testsuite/ld-gc/pr20022b.s: Likewise. * testsuite/ld-gc/gc.exp: Run PR ld/20022 tests. * testsuite/ld-gc/pr19161.d: Also accept local __start_SECNAME symbol. * testsuite/ld-gc/start.d: Likewise. * testsuite/ld-x86-64/lea1a.d: Updated. * testsuite/ld-x86-64/lea1b.d: Updated. * testsuite/ld-x86-64/lea1d.d: Updated. * testsuite/ld-x86-64/lea1e.d: Likewise.
2017-06-13Prevent a call to abort when a relocatable link encounters a relocation ↵Nick Clifton2-4/+26
against a symbol in a section removed by garbage collection. PR ld/21524 * elflink.c (elf_link_adjust_relocs): Generate an error when encountering a reloc against a symbol removed by garbage collection.
2017-06-13Automatic date update in version.inGDB Administrator1-1/+1
2017-06-12ELF: Pass bfd_link_info to merge_gnu_propertiesH.J. Lu5-11/+28
Pass struct bfd_link_info * to merge_gnu_properties to give backend control of how GNU properties are merged based on linker command line options. * elf-bfd.h (elf_backend_data): Add struct bfd_link_info * to merge_gnu_properties. * elf-properties.c (elf_merge_gnu_properties): Add struct bfd_link_info * and pass it to merge_gnu_properties. (elf_merge_gnu_property_list): Add struct bfd_link_info * and pass it to elf_merge_gnu_properties. (_bfd_elf_link_setup_gnu_properties): Pass info to elf_merge_gnu_property_list. * elf32-i386.c (elf_i386_merge_gnu_properties): Add struct bfd_link_info *. * elf64-x86-64.c (elf_x86_64_merge_gnu_properties): Likewise.
2017-06-12S/390: Return with an error for broken tls rewritesAndreas Krebbel2-10/+32
bfd/ChangeLog: 2017-06-12 Andreas Krebbel <krebbel@linux.vnet.ibm.com> * elf32-s390.c (elf_s390_relocate_section): Return false in case the rewriting fails. * elf64-s390.c (elf_s390_relocate_section): Likewise.
2017-06-12Automatic date update in version.inGDB Administrator1-1/+1
2017-06-11PR 21564, Section start in binary output file incorrectAlan Modra2-1/+9
PR 21564 * binary.c (binary_set_section_contents): Scale lma by octets per byte to set filepos.
2017-06-11Automatic date update in version.inGDB Administrator1-1/+1
2017-06-10Automatic date update in version.inGDB Administrator1-1/+1
2017-06-09Revert "[AArch64] Allow COPY relocation elimination"Jiong Wang2-73/+8
This reverts commit bc327528fd2ccdc6c29ab6ae608085dddbad5cc8. This patch can only be committed after PC-relative relocation types support on copy relocation elimination is also completed.
2017-06-09Automatic date update in version.inGDB Administrator1-1/+1
2017-06-08[ARC] Corrected conditions for dynamic sections creation.Cupertino Miranda2-9/+16
Fixed conditions to create the dynamic sections. Previously there would be times where the dynamic sections would not be created although they were actually required for linking to work. Issue found through OpenADK build, more precisely the ublicb testsuite package. bfd/ChangeLog: Cupertino Miranda <cmiranda@synopsys.com> elf32-arc.c (elf_arc_check_relocs): Fixed conditions to generate dynamic sections.
2017-06-08[ARC] Fixed condition to generate TEXTREL.Cupertino Miranda2-1/+7
TEXTREL was being generated even when relocatable .o files had the .rela.text section. Now it is limitted only to dynamic object files that still have them. Nevertheless, our target aborts in those cases due to architecture limitations where icache is not coherent with dcache, and to force this coherence expensive kernel level support would be needed. bfd/ChangeLog: Cupertino Miranda <cmiranda@synopsys.com> * elf32-arc.c (elf_arc_size_dynamic_sections): Changed condition to require TEXTREL.
2017-06-08[ARC] Fixed TLS for IE model.Cupertino Miranda3-2/+12
In the case of static relocation, the GOT entries are fixed at link time and are set by the linker. In order to compute the right TLS offset it is necessary to add TCB_SIZE to the offset, just in case the dynamic linker is not expected to be executed (static linked case). This problem does appear in dynamic linked applications, as the dynamic linker is adding this TCB_SIZE by operating the TCB block structure. Problem revealed in GLIBC with static linking. bfd/ChangeLog: Cupertino Miranda <cmiranda@synopsys.com> arc-got.h (relocate_fix_got_relocs_for_got_info): Added TCB_SIZE to patched section contents for TLS IE reloc. elf32-arc.c: Remove TCB_SIZE preprocessor macro. Rebase to 0006
2017-06-08[ARC] Add RELOC_FOR_GLOBAL_SYMBOL in ARC target code.Cupertino Miranda2-0/+14
This miss was identified in the context of openssh building for ARC. bfd/ChangeLog: Cupertino Miranda <cmiranda@synopsys.com> elf32-arc.c (elf_arc_relocate_section): Added "call" to RELOC_FOR_GLOBAL_SYMBOL macro.
2017-06-08[ARC] ARC_PC32 dynamic reloc incorrectly generated.Cupertino Miranda2-10/+18
Fixed issue related to the generation of ARC_PC32 dynamic relocs when symbol is dynamic but still defined in a non shared object. bfd/ChangeLog: Cupertino Miranda <cmiranda@synopsys.com> elf32-arc.c (elf_arc_relocate_section): Small refactor and condition changes.
2017-06-08[ARC] Don't convert _DYNAMIC@ to _GLOBAL_OFFSET_TABLE_Vineet Gupta1-0/+5
Historically the arc abi demanded that a GOT[0] should be referencible as [pc+_DYNAMIC@gotpc]. Hence we convert a _DYNAMIC@gotpc to a GOTPC reference to _GLOBAL_OFFSET_TABLE_. This is no longer the case and uClibc and upcomming GNU libc don't expect this to happen. gas/ChangeLog: Vineet Gupta <vgupta@synopsys.com> Cupertino Miranda <cmiranda@synopsys.com> * config/tc-arc.c (md_undefined_symbol): Changed. * config/tc-arc.h (DYNAMIC_STRUCT_NAME): Removed.
2017-06-08[ARC] Reassign the symbol got information to actual symbol when indirect.Cupertino Miranda2-0/+10
GOT information would not be reassign to symbol when it became a indect symbol. bfd/ChangeLog: Cupertino Miranda <cmiranda@synopsys.com> * elf32-arc.c (elf_arc_relocate_section): Fixed reassign of indirect symbols.
2017-06-08[ARC] Disable warning on absolute relocs when symbol is local.Cupertino Miranda2-1/+7
R_ARC_32 and R_ARC_32_ME cannot be generated as dynamic relocs. However, a warning message and check_relocs was aborting when this type of reloc was being resolved to a local symbol. This is wrong as local symbols are resolvable at link time. bfd/ChangeLog: Cupertino Miranda <cmiranda@synopsys.com> * elf32-arc.c (elf_arc_check_relocs): Added condition to disable warning and "Bad value" for local symbols ARC_32 or ARC_32_ME relocs.
2017-06-08[ARC] Avoid creating dynamic relocs when static linked is requested.Cupertino Miranda2-11/+19
bfd/Changelog: Cupertino Miranda <cmiranda@synopsys.com> * elf32-arc.c (ADD_RELA): Changed to only work when dynamic object is created.
2017-06-08[bfd][arm] Don't assert on suspicious build attributes in input fileRichard Earnshaw2-1/+16
It's generally a bad idea to use assertions to validate our idea of what an input file looks like. We need to be as liberal as possible in what we accept with respect to standards and conservative with what we produce. Currently, if gcc is used to produce an assembler file which contains only data, but the FPU is set to fpv4-sp-d16 and mfloat-abi=hard, then the following attributes will be set in the output: .cpu arm7tdmi .eabi_attribute 27, 1 @ Tag_ABI_HardFP_use .eabi_attribute 28, 1 @ Tag_ABI_VFP_args .eabi_attribute 20, 1 @ Tag_ABI_FP_denormal .eabi_attribute 21, 1 @ Tag_ABI_FP_exceptions .eabi_attribute 23, 3 @ Tag_ABI_FP_number_model .eabi_attribute 24, 1 @ Tag_ABI_align8_needed .eabi_attribute 25, 1 @ Tag_ABI_align8_preserved .eabi_attribute 26, 2 @ Tag_ABI_enum_size .eabi_attribute 30, 6 @ Tag_ABI_optimization_goals .eabi_attribute 34, 0 @ Tag_CPU_unaligned_access .eabi_attribute 18, 4 @ Tag_ABI_PCS_wchar_t There is then no .fpu directive to cause Tag_FP_arch to be set, because there are no functions containing code in the object file. If this object file is assembled by hand, but without -mfpu on the invocation of the assembler, then the build attributes produced will trigger an assertion during linking. Thinking about the build attributes, the combination of a single-precision only implementation of no floating-point architecture is still no floating-point architecture. Hence the assertion on the input BFD in the linker makes no real sense. We should, however, be more conservative in what we generate, so I've left the assertion on the output bfd in place; I don't think we can trigger it with this change since we never merge the problematic tags from a perversely generated input file. * elf32-arm.c (elf32_arm_merge_eabi_attributes): Remove assertion that the input bfd has Tag_FP_ARCH non-zero if Tag_ABI_HardFP_use is non-zero. Add clarifying comments.
2017-06-08x86: Dump local IFUNC functions in the map fileH.J. Lu2-9/+33
Dump local IFUNC functions in the map file when generating IRELATIVE relocations if -Map is used. bfd/ * elf32-i386.c (elf_i386_check_relocs): Set local IFUNC symbol name. Use local IFUNC symbol name string to report unsupported non-PIC call to IFUNC function. (elf_i386_relocate_section): Dump local IFUNC name with minfo when generating R_386_IRELATIVE relocation. (elf_i386_finish_dynamic_symbol): Likewise. * elf_x86_64_check_relocs (elf_x86_64_check_relocs): Set local IFUNC symbol name. (elf_x86_64_relocate_section): Dump local IFUNC name with minfo when generating R_X86_64_IRELATIVE relocation. (elf_x86_64_finish_dynamic_symbol): Likewise. ld/ * testsuite/ld-ifunc/ifunc-1-local-x86.d: Pass "-Map tmpdir/ifunc-1-local-x86.map" to ld and check ifunc-1-local-x86.map. * testsuite/ld-ifunc/ifunc-1-x86.d: Pass "-Map tmpdir/ifunc-1-x86.map" to ld and check ifunc-1-x86.map. * testsuite/ld-ifunc/ifunc-1-local-x86.map: New file. * testsuite/ld-ifunc/ifunc-1-x86.map: Likewise.
2017-06-08clH.J. Lu1-0/+14
2017-06-08[AArch64] Allow COPY relocation eliminationJiong Wang2-8/+73
As discussed at the PR, this patch tries to avoid COPY relocation generation and propagate the original relocation into runtime if it was relocating on writable section. The ELIMINATE_COPY_RELOCS has been set to true and it's underlying infrastructure has been improved so that the COPY reloc elimination at least working on absoluate relocations (ABS64) after this patch. bfd/ PR ld/21532 * elfnn-aarch64.c (ELIMINATE_COPY_RELOCS): Set to 1. (elfNN_aarch64_final_link_relocate): Also propagate relocations to runtime for copy relocation elimination cases. (alias_readonly_dynrelocs): New function. (elfNN_aarch64_adjust_dynamic_symbol): Keep the dynamic relocs instead of generating copy relocation if it is not against read-only sections. (elfNN_aarch64_check_relocs): Likewise. ld/ * testsuite/ld-aarch64/copy-reloc-eliminate.d: New test. * testsuite/ld-aarch64/copy-reloc-exe-eliminate.s: New test source file. * testsuite/ld-aarch64/aarch64-elf.exp: Run new testcase.
2017-06-08Automatic date update in version.inGDB Administrator1-1/+1
2017-06-07Automatic date update in version.inGDB Administrator1-1/+1
2017-06-06bfd: support section groups with preceding SHF_GROUP sectionsJose E. Marchesi2-28/+13
GAS always places section groups (SHT_GROUP) before the rest of the sections in the output file. However, other assemblers may place section groups after the group members. This patch fixes handlign such situations, and removes some duplicated logic. bfd/ChangeLog: 2017-06-06 Jose E. Marchesi <jose.marchesi@oracle.com> * elf.c (setup_group): Make sure BFD sections are created for all group sections in the input file when processing SHF_GROUP sections. (bfd_section_from_shdr): Avoid duplicating logic already implemented in `setup_group'.
2017-06-06Handle printing information about PE format files which have 0 as the value ↵Daniel Bonniot de Ruisselet2-0/+11
of the HInt Table in the import tables structure. PR binutils/21546 * peXXigen.c (pe_print_idata): Use the address of the first thunk if the hint address is zero.
2017-06-06Fix AArch64 in the same way as other targets updated in ↵James Clarke2-1/+7
8170f7693bc0a9442c0aa280197925db92d48ca6. PR ld/19579 * elfnn-aarch64.c (elfNN_aarch64_finish_dynamic_symbol): Check ELF_COMMON_DEF_P for common symbols.
2017-06-06ld: Allow section groups to be resolved as part of a relocatable linkAndrew Burgess3-20/+35
This commit adds a new linker feature: the ability to resolve section groups as part of a relocatable link. Currently section groups are automatically resolved when performing a final link, and are carried through when performing a relocatable link. By carried through this means that one copy of each section group (from all the copies that might be found in all the input files) is placed into the output file. Sections that are part of a section group will not match input section specifiers within a linker script and are forcibly kept as separate sections. There is a slight resemblance between section groups and common section. Like section groups, common sections are carried through when performing a relocatable link, and resolved (allocated actual space) only at final link time. However, with common sections there is an ability to force the linker to allocate space for the common sections when performing a relocatable link, there's currently no such ability for section groups. This commit adds such a mechanism. This new facility can be accessed in two ways, first there's a command line switch --force-group-allocation, second, there's a new linker script command FORCE_GROUP_ALLOCATION. If one of these is used when performing a relocatable link then the linker will resolve the section groups as though it were performing a final link, the section group will be deleted, and the members of the group will be placed like normal input sections. If there are multiple copies of the group (from multiple input files) then only one copy of the group members will be placed, the duplicate copies will be discarded. Unlike common sections that have the --no-define-common command line flag, and INHIBIT_COMMON_ALLOCATION linker script command there is no way to prevent group resolution during a final link, this is because the ELF gABI specifically prohibits the presence of SHT_GROUP sections in a fully linked executable. However, the code as written should make adding such a feature trivial, setting the new resolve_section_groups flag to false during a final link should work as you'd expect. bfd/ChangeLog: * elf.c (_bfd_elf_make_section_from_shdr): Don't initially mark SEC_GROUP sections as SEC_EXCLUDE. (bfd_elf_set_group_contents): Replace use of abort with an assert. (assign_section_numbers): Use resolve_section_groups flag instead of relocatable link type. (_bfd_elf_init_private_section_data): Use resolve_section_groups flag instead of checking the final_link flag for part of the checks in here. Fix white space as a result. * elflink.c (elf_link_input_bfd): Use resolve_section_groups flag instead of relocatable link type. (bfd_elf_final_link): Likewise. include/ChangeLog: * bfdlink.h (struct bfd_link_info): Add new resolve_section_groups flag. ld/ChangeLog: * ld.h (struct args_type): Add force_group_allocation field. * ldgram.y: Add support for FORCE_GROUP_ALLOCATION. * ldlex.h: Likewise. * ldlex.l: Likewise. * lexsup.c: Likewise. * ldlang.c (unique_section_p): Check resolve_section_groups flag not the relaxable link flag. (lang_add_section): Discard section groups when we're resolving groups. Clear the SEC_LINK_ONCE flag if we're resolving section groups. * ldmain.c (main): Initialise resolve_section_groups flag in link_info based on command line flags. * testsuite/ld-elf/group11.d: New file. * testsuite/ld-elf/group12.d: New file. * testsuite/ld-elf/group12.ld: New file. * NEWS: Mention new features. * ld.texinfo (Options): Document --force-group-allocation. (Miscellaneous Commands): Document FORCE_GROUP_ALLOCATION.
2017-06-06bfd: remove unused local variables in elf32-score, elf32-score7 and elfxx-mipsJose E. Marchesi4-14/+10
bfd/ChangeLog: 2017-06-06 Jose E. Marchesi <jose.marchesi@oracle.com> * elfxx-mips.c (_bfd_mips_elf_relocate_section): Remove unused variable `bed'. * elf32-score.c (score_elf_final_link_relocate): Likewise. (s3_bfd_score_elf_check_relocs): Likewise. * elf32-score7.c (s7_bfd_score_elf_relocate_section): Likewise. (score_elf_final_link_relocate): Likewise. (s7_bfd_score_elf_check_relocs): Likewise.
2017-06-06bfd: remove unused local variable in elflink.c:init_reloc_cookie_relsJose E. Marchesi2-4/+5
bfd/ChangeLog: 2017-06-06 Jose E. Marchesi <jose.marchesi@oracle.com> * elflink.c (init_reloc_cookie_rels): Remove unused variable `bed'.
2017-06-06ELF/BFD: Hold the number of internal static relocs in `->reloc_count'Maciej W. Rozycki8-37/+57
Correct a commit e5713223cbc1 ("MIPS/BFD: For n64 hold the number of internal relocs in `->reloc_count'") regression and change internal relocation handling in the generic ELF BFD linker code such that, except in the presence of R_SPARC_OLO10 relocations, a section's `reloc_count' holds the number of internal rather than external relocations, making the handling more consistent between GAS, which sets `->reloc_count' with a call to `bfd_set_reloc', and LD, which sets `->reloc_count' as it reads input sections. The handling of dynamic relocations remains unchanged and they continue holding the number of external relocations in `->reloc_count'; they are also not converted to the internal form except in `elf_link_sort_relocs' (which does not handle the general, i.e. non-n64-MIPS case of composed relocations correctly as per the ELF gABI, though it does not seem to matter for the targets we currently support). The n64 MIPS backend is the only one with `int_rels_per_ext_rel' set to non-one, and consequently the change is trivial for all the remaining backends and targets. bfd/ * elf-bfd.h (RELOC_AGAINST_DISCARDED_SECTION): Subtract `count' from `reloc_count' rather than decrementing it. * elf.c (bfd_section_from_shdr): Multiply the adjustment to `reloc_count' by `int_rels_per_ext_rel'. * elf32-score.c (score_elf_final_link_relocate): Do not multiply `reloc_count' by `int_rels_per_ext_rel' for last relocation entry determination. (s3_bfd_score_elf_check_relocs): Likewise. * elf32-score7.c (score_elf_final_link_relocate): Likewise. (s7_bfd_score_elf_relocate_section): Likewise. (s7_bfd_score_elf_check_relocs): Likewise. * elf64-mips.c (mips_elf64_get_reloc_upper_bound): Remove prototype and function. (mips_elf64_slurp_one_reloc_table): Do not update `reloc_count'. (mips_elf64_slurp_reloc_table): Assert that `reloc_count' is triple rather than once the sum of REL and RELA relocation entry counts. (bfd_elf64_get_reloc_upper_bound): Remove macro. * elflink.c (_bfd_elf_link_read_relocs): Do not multiply `reloc_count' by `int_rels_per_ext_rel' for internal relocation storage allocation size determination. (elf_link_input_bfd): Multiply `.ctors' and `.dtors' section's size by `int_rels_per_ext_rel'. Do not multiply `reloc_count' by `int_rels_per_ext_rel' for last relocation entry determination. (bfd_elf_final_link): Do not multiply `reloc_count' by `int_rels_per_ext_rel' for internal relocation storage allocation size determination. (init_reloc_cookie_rels): Do not multiply `reloc_count' by `int_rels_per_ext_rel' for last relocation entry determination. (elf_gc_smash_unused_vtentry_relocs): Likewise. * elfxx-mips.c (_bfd_mips_elf_check_relocs): Likewise. (_bfd_mips_elf_relocate_section): Likewise.
2017-06-06Automatic date update in version.inGDB Administrator1-1/+1
2017-06-05PR21529, internal error in linker.cAlan Modra2-1/+6
PR 21529 * linker.c (_bfd_generic_link_output_symbols): Handle BSF_GNU_UNIQUE.
2017-06-05Automatic date update in version.inGDB Administrator1-1/+1
2017-06-04Automatic date update in version.inGDB Administrator1-1/+1