aboutsummaryrefslogtreecommitdiff
path: root/bfd
AgeCommit message (Collapse)AuthorFilesLines
2016-04-11Properly handle dynamic reloc against normal symbolH.J. Lu6-6/+52
We shouldn't issue an error for read-only segment with dynamic IFUNC relocations when dynamic relocations are against normal symbols. bfd/ PR ld/19939 * elf-bfd.h (_bfd_elf_allocate_ifunc_dyn_relocs): Add a pointer to bfd_boolean. * elf-ifunc.c (_bfd_elf_allocate_ifunc_dyn_relocs): Updated. Set *readonly_dynrelocs_against_ifunc_p to TRUE if dynamic reloc applies to read-only section. * elf32-i386.c (elf_i386_link_hash_table): Add readonly_dynrelocs_against_ifunc. (elf_i386_allocate_dynrelocs): Updated. (elf_i386_size_dynamic_sections): Issue an error for read-only segment with dynamic IFUNC relocations only if readonly_dynrelocs_against_ifunc is TRUE. * elf64-x86-64.c (elf_x86_64_link_hash_table): Add readonly_dynrelocs_against_ifunc. (elf_x86_64_allocate_dynrelocs): Updated. (elf_x86_64_size_dynamic_sections): Issue an error for read-only segment with dynamic IFUNC relocations only if readonly_dynrelocs_against_ifunc is TRUE. * elfnn-aarch64.c (elfNN_aarch64_allocate_ifunc_dynrelocs): Updated. ld/ PR ld/19939 * testsuite/ld-i386/i386.exp: Run PR ld/19939 tests. * testsuite/ld-x86-64/x86-64.exp: Likewise. * testsuite/ld-i386/pr19939.s: New file. * testsuite/ld-i386/pr19939a.d: Likewise. * testsuite/ld-i386/pr19939b.d: Likewise. * testsuite/ld-x86-64/pr19939.s: Likewise. * testsuite/ld-x86-64/pr19939a.d: Likewise. * testsuite/ld-x86-64/pr19939b.d: Likewise.
2016-04-12Automatic date update in version.inGDB Administrator1-1/+1
2016-04-11Automatic date update in version.inGDB Administrator1-1/+1
2016-04-10Automatic date update in version.inGDB Administrator1-1/+1
2016-04-09Automatic date update in version.inGDB Administrator1-1/+1
2016-04-08Automatic date update in version.inGDB Administrator1-1/+1
2016-04-07Automatic date update in version.inGDB Administrator1-1/+1
2016-04-06Fix memory leak in ld ARM backendThomas Preud'homme2-4/+13
2016-04-06 Thomas Preud'homme <thomas.preudhomme@arm.com> bfd/ * elf32-arm.c (elf32_arm_size_stubs): Move error_ret_free_local to be a fall through from error_ret_free_internal. Free local_syms in error_ret_free_local if allocated from bfd_elf_get_elf_syms ().
2016-04-06Automatic date update in version.inGDB Administrator1-1/+1
2016-04-05[ARC] PLT content endianess awareness.Claudiu Zissulescu2-6/+30
bfd/ 2016-04-05 Cupertino Miranda <cmiranda@synopsys.com> * elf32-arc.c (plt_do_relocs_for_symbol): Changed. (relocate_plt_for_entry): Likewise.
2016-04-05[ARC] Fix to pass ld-elf-ehdr_start-shared.Claudiu Zissulescu2-1/+6
bfd/ 2016-04-05 Cupertino Miranda <cmiranda@synopsys.com> * elf32-arc.c (elf_arc_check_relocs): Changed
2016-04-05[ARC] 24 bit reloc and overflow detection fix.Claudiu Zissulescu2-29/+59
bfd/ 2016-04-05 Cupertino Miranda <cmiranda@synopsys.com> * elf32-arc.c (name_for_global_symbol): Changed assert. (get_replace_function): Created.: (struct arc_relocation_data): Changed to signed types. (defines S, L, P, PDATA): Casted to signed type. (defines SECTSTART, _SDA_BASE_, TLS_REL): Likewise. (PRINT_DEBUG_RELOC_INFO_BEFORE): Changed. (arc_do_relocation): Changed. include/ 2016-04-05 Cupertino Miranda <cmiranda@synopsys.com> * opcode/arc-func.h (replace_bits24): Changed. (replace_bits24_be): Created.
2016-04-05[ARC] Dynamic relocs verification for dynindx == -1.Claudiu Zissulescu2-2/+23
bfd/ 2016-04-05 Cupertino Miranda <cmiranda@synopsys.com> * elf32-arc.c (name_for_global_symbol): Added assert to check for symbol index. (elf_arc_relocate_section): Added and changed asserts, validating the synamic symbol index. (elf_arc_finish_dynamic_symbol): Do not fill the dynamic relocation if symbol has dynindx set to -1.
2016-04-05ELF/LD: Avoid producing hidden and internal dynamic symbolsMaciej W. Rozycki2-1/+7
Always turn hidden and internal symbols which have a dynamic index into local ones. This is required by the the ELF gABI[1]: "A hidden symbol contained in a relocatable object must be either removed or converted to STB_LOCAL binding by the link-editor when the relocatable object is included in an executable file or shared object." "An internal symbol contained in a relocatable object must be either removed or converted to STB_LOCAL binding by the link-editor when the relocatable object is included in an executable file or shared object." The ELF linker usually respects this requirement, however in the case where a dynamic symbol has been preallocated due to a reference of the default export class aka visibility from the object being linked, and then merged with a hidden or internal symbol definition from within the same object, then the original export class is carried over to the output dynamic symbol table, because while merging the generic ELF linker only converts affected dynamic symbols to local when they are defined or referenced by the object being linked and a dynamic object involved in the link both at a time. The dynamic symbol produced confuses then the dynamic loader at the run time -- the hidden or internal export class is ignored and the symbol follows preemption rules as with the default export class. In the MIPS target it happens when `mips_elf_record_global_got_symbol' creates a dynamic symbol when a call relocation is encountered. Additionally if the undefined symbol referred by such a relocation does specify the intended export class, then a local dynamic symbol is created instead, which is harmless and allowed, but useless. Normally no local dynamic symbols are created, except for a single dummy one at the beginning. Correct the problem by removing the extra check for a dynamic symbol being defined or referenced by the object being linked and a dynamic object involved in the link both at a time. The test cases included cover the internal and hidden symbol cases, as well as a protected symbol for a reference, the handling of which is unchanged by this fix. Both cases described above are covered, that is where an internal or hidden dynamic symbol is produced and where a local one is. NB this change affects CRIS results where some symbols in the static table produced in a final link are now converted from STV_HIDDEN to STB_LOCAL. This happens whenever the `elf_backend_hide_symbol' handler is called, so the affected symbols must have been chosen for entering into the dynamic symbol table, except in these test cases no such symbol table is produced. In fully linked binaries the static symbol table is only used for debugging though, so such a change is fine. References: [1] "System V Application Binary Interface - DRAFT - 24 April 2001", The Santa Cruz Operation, Inc., "Symbol Table", <http://www.sco.com/developers/gabi/2001-04-24/ch4.symtab.html> bfd/ PR ld/19908 * elflink.c (elf_link_add_object_symbols): Always turn hidden and internal symbols which have a dynamic index into local ones. ld/ PR ld/19908 * testsuite/ld-cris/tls-e-20.d: Adjust for hidden symbol handling fix. * testsuite/ld-cris/tls-e-20a.d: Likewise. * testsuite/ld-cris/tls-e-21.d: Likewise. * testsuite/ld-cris/tls-e-23.d: Likewise. * testsuite/ld-cris/tls-e-80.d: Likewise. * testsuite/ld-cris/tls-gd-3h.d: Likewise. * testsuite/ld-cris/tls-leie-19.d: Likewise. * testsuite/ld-mips-elf/export-class-ref-lib.sd: New test. * testsuite/ld-mips-elf/export-hidden-ref.sd: New test. * testsuite/ld-mips-elf/export-internal-ref.sd: New test. * testsuite/ld-mips-elf/export-protected-ref.sd: New test. * testsuite/ld-mips-elf/export-class-ref-f0.s: New test source. * testsuite/ld-mips-elf/export-class-ref-f1.s: New test source. * testsuite/ld-mips-elf/export-class-ref-f2.s: New test source. * testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
2016-04-05Automatic date update in version.inGDB Administrator1-1/+1
2016-04-04Ignore DWARF debug information with a version of 0 - assume that it is padding.Nick Clifton2-13/+27
PR 19872 bfd * dwarf2.c (parse_comp_unit): Skip warning about unrecognised version number if the version is zero. bin * dwarf.c (display_debug_aranges): Skip warning about unrecognised version number if the version is zero.
2016-04-04Automatic date update in version.inGDB Administrator1-1/+1
2016-04-03Automatic date update in version.inGDB Administrator1-1/+1
2016-04-02Automatic date update in version.inGDB Administrator1-1/+1
2016-04-01PR19886, --as-needed regressionAlan Modra2-6/+27
This isn't perfect in checking whether libraries will be loaded since elf_link_add_object_symbols doesn't recurse down DT_NEEDED links. (That happens later in ld/emultempl/elf32.em after_open.) So in effect this recursive check really only looks one level down the DT_NEEDED tree. Which is enough for the most common case, and libc.so/ld.so in particular. PR 19886 * elflink.c (on_needed_list): Recursively check needed status. (elf_link_add_object_symbols): Adjust.
2016-04-01Automatic date update in version.inGDB Administrator1-1/+1
2016-03-31enable -Wwrite-strings for gasTrevor Saunders2-2/+22
We add a new AC_SUBST to warning.m4 so that the test if the warning is supported is centralized, but the warning can be enabled per directory. binutils/ChangeLog: 2016-03-31 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * configure: Regenerate. gprof/ChangeLog: 2016-03-31 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * configure: Regenerate. ld/ChangeLog: 2016-03-31 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * configure: Regenerate. opcodes/ChangeLog: 2016-03-31 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * configure: Regenerate. bfd/ChangeLog: 2016-03-31 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * configure: Regenerate. * warning.m4: Add WARN_WRITE_STRINGS AC_SUBST. gold/ChangeLog: 2016-03-31 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * configure: Regenerate. gas/ChangeLog: 2016-03-31 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * Makefile.am: Add WARN_WRITE_STRINGS to WARN_CFLAGS. * Makefile.in: Regenerate. * configure: Likewise.
2016-03-31Automatic date update in version.inGDB Administrator1-1/+1
2016-03-30Fix a seg-fault in the AVR linker.Senthil Kumar Selvaraj2-2/+9
* elf32-avr.c (avr_elf32_load_records_from_section): Free internal_relocs only if they aren't cached.
2016-03-30Automatic date update in version.inGDB Administrator1-1/+1
2016-03-29Relax assertion in BFIN linker to allow for discard GOT relocs.Nick Clifton2-1/+14
PR 17334 * elf32-bfin.c (elf32_bfinfdpic_finish_dynamic_sections): Relax assertion on the size of the got section to allow it to be bigger than the number of relocs.
2016-03-29PE/COFF regression in base of code and data calculationToni Spets2-0/+8
PR 19878 * coffcode.h (coff_write_object_contents): Revert accidental 2014-11-10 change.
2016-03-29Automatic date update in version.inGDB Administrator1-1/+1
2016-03-28Automatic date update in version.inGDB Administrator1-1/+1
2016-03-27Automatic date update in version.inGDB Administrator1-1/+1
2016-03-26Automatic date update in version.inGDB Administrator1-1/+1
2016-03-25Automatic date update in version.inGDB Administrator1-1/+1
2016-03-24Automatic date update in version.inGDB Administrator1-1/+1
2016-03-23Automatic date update in version.inGDB Administrator1-1/+1
2016-03-22Attribute with DW_FORM_flag_presentAlan Modra2-1/+7
PR 19850 * dwarf2.c (read_attribute_value): Skip info_ptr check for DW_FORM_flag_present.
2016-03-22Restore v850-rh850 as a recognised v850 architecture name for backwards ↵Nick Clifton2-1/+5
compatibility. bfd * cpu-v850_rh850.c (arch_info_struct): Restore v850-rh850 as an architecture name for backwards compatibility.
2016-03-22Fix possible unbounded stack use in peXXigen.cNick Clifton2-5/+12
* peXXigen.c (_bfd_XXi_write_codeview_record): Fix possible unbounded stack use.
2016-03-22Add -Wstack-usage to the gcc warning flags list, but only if using a ↵Nick Clifton3-2/+33
sufficiently recent version of gcc. bfd * warning.m4 (GCC_WARN_CFLAGS): Only add -Wstack-usage if using a sufficiently recent version of GCC. * configure: Regenerate. others * configure: Regenerate.
2016-03-22Binutils fails to build with -O0Alan Modra2-2/+6
PR 19851 * plugin.c (try_load_plugin): Avoid -Wstack-usage warning.
2016-03-22Automatic date update in version.inGDB Administrator1-1/+1
2016-03-21arc: Add nps400 machine type, and assembler flag.Andrew Burgess5-2/+20
This commit introduces the nps400 machine type as a variant of arc. There's a new flag in the assembler to select this machine type. All other changes are just adding handling of the new machine type into the relevant places. The nps400 is an arc700 variant with some vendor specific instructions added into the instruction set. This commit does not add any of the new instructions, this is just laying the groundwork for future commits. However, in preparation for these new instructions a new opcode define for nps400 has been added to include/opcode/arc.h, this new opcode define is used in the assembler and disassembler along with the existing define for arc700 such that when assembling and disassembling for nps400 the user will have access to all arc700 instructions and all the nps400 vendor extension instructions. bfd/ChangeLog: * archures.c (bfd_mach_arc_nps400): Define. * bfd-in2.h: Regenerate. * cpu-arc.c (arch_info_struct): New entry for nps400, renumber some existing entries to make space. * elf32-arc.c (arc_elf_object_p): Add nps400 case. (arc_elf_final_write_processing): Likewise. binutils/ChangeLog: * readelf.c (decode_ARC_machine_flags): Handle nps400. gas/ChangeLog: * config/tc-arc.c (cpu_types): Add nps400 entry. (check_zol): Handle nps400. include/ChangeLog: * elf/arc.h (E_ARC_MACH_NPS400): Define. * opcode/arc.h (ARC_OPCODE_NPS400): Define. opcodes/ChangeLog: * arc-dis.c (print_insn_arc): Handle nps400.
2016-03-21arc: Remove EF_ARC_CPU_GENERIC constant.Andrew Burgess2-10/+7
The constant EF_ARC_CPU_GENERIC is defined in the include/elf/arc.h file, and is used in a few places in binutils, however, this constant should never make it into the elf header flags; we always set a valid cpu type in the assembler, which should then be copied over during linking. There are some non-gnu arc compilers that don't write an architecture type into the e_flags field, instead leaving the field as 0, which is the EF_ARC_CPU_GENERIC value. This non-gnu compiler uses the machine type to distinguish between the old and newer arc architectures, setting the machine type to EM_ARC_COMPACT for old arc600, arc601, and arc700 architectures, while using EM_ARC_COMPACT2 for newer arcem and archs architectures. Previously when displaying the machine flags for an older EM_ARC_COMPACT machine, if the e_flags had not been filled in, then we relied on the default case statement to display the message "Generic ARCompact", while in the EM_ARC_COMPACT2 case we specifically handled EF_ARC_CPU_GENERIC to print "ARC Generic", leaving the default case to print a message about unrecognised cpu flag. After this commit EF_ARC_CPU_GENERIC has been removed, for both machine types EM_ARC_COMPACT and EM_ARC_COMPACT2 we now rely on the default case statement to handle the situation where the e_flags has not been filled in. The message displayed is now "Unknown ARCompact" (for older arc architectures) and "Unknown ARC" (for the newer architectures). The switch from "Generic" to "Unknown" in the message string is for clarity, calling the file "Generic" can give the impression that the file is compiled for a common sub-set of the architectures, and would therefore run on any type of machine (or at least any type of new or old machine depending on if the machine type is ARC or ARCv2). However, this was not what "Generic" meant, it really meant "Unknown", so that's what we now say. As part of the merging of the readelf flag reading code, I have unified the strings used in displaying the ELF ABI. This means that for older arc machines (arc600, arc601, and arc700) the string used for the original ABI, and ABIv2 have changed, the current ABIv3 remains the same. For the newer architectures (arcem and archs) the abi strings remain unchanged in all cases. bfd/ChangeLog: * elf32-arc.c (arc_elf_print_private_bfd_data): Remove use of EF_ARC_CPU_GENERIC. (arc_elf_final_write_processing): Don't bother setting cpu field in e_flags, this will have been set elsewhere. binutils/ChangeLog: * readelf.c (get_machine_flags): Move arc processing into... (decode_ARC_machine_flags): ... new function. Remove use of EF_ARC_CPU_GENERIC, change default case from "generic arc" to "unknown arc". Merged ABI printing between two machine types. gas/ChangeLog: * config/tc-arc.c (arc_select_cpu): Remove use of EF_ARC_CPU_GENERIC. include/ChangeLog: * elf/arc.h (EF_ARC_CPU_GENERIC): Delete. Update related comment.
2016-03-21arc: Remove duplicated constant in include/elf/arc.hAndrew Burgess2-1/+6
In the include/elf/arc.h there are two constants that mask out the machine architecture field. One is used lots (EF_ARC_MACH_MSK), the other is used only once (EF_ARC_MACH). Remove EF_ARC_MACH. bfd/ChangeLog: * elf32-arc.c (arc_elf_final_write_processing): Switch to using EF_ARC_MACH_MSK. include/ChangeLog: * elf/arc.h (EF_ARC_MACH): Delete. (EF_ARC_MACH_MSK): Remove out of date comment.
2016-03-21Remove use of alloca.Nick Clifton11-70/+89
bfd * warning.m4 (GCC_WARN_CFLAGS): Add -Wstack-usage=262144 * configure: Regenerate. * elf32-m68hc1x.c (elf32_m68hc11_relocate_section): Replace use of alloca with call to xmalloc. * elf32-nds32.c: Likewise. * elf64-hppa.c: Likewise. * elfxx-mips.c: Likewise. * pef.c: Likewise. * pei-x86_64.c: Likewise. * som.c: Likewise. * xsym.c: Likewise. binutils * dlltool.c: Replace use of alloca with call to xmalloc. * dllwrap.c: Likewise. * nlmconv.c: Likewise. * objdump.c: Likewise. * resrc.c: Likewise. * winduni.c: Likewise. * configure: Regenerate. gas * atof-generic.c: Replace use of alloca with call to xmalloc. * cgen.c: Likewise. * dwarf2dbg.c: Likewise. * macro.c: Likewise. * remap.c: Likewise. * stabs.c: Likewise. * symbols.c: Likewise. * config/obj-elf.c: Likewise. * config/tc-aarch64.c: Likewise. * config/tc-arc.c: Likewise. * config/tc-arm.c: Likewise. * config/tc-avr.c: Likewise. * config/tc-ia64.c: Likewise. * config/tc-mips.c: Likewise. * config/tc-msp430.c: Likewise. * config/tc-nds32.c: Likewise. * config/tc-ppc.c: Likewise. * config/tc-sh.c: Likewise. * config/tc-tic30.c: Likewise. * config/tc-tic54x.c: Likewise. * config/tc-xstormy16.c: Likewise. * config/te-vms.c: Likewise. * configure: Regenerate. ld * emultempl/msp430.em: Replace use of alloca with call to xmalloc. * plugin.c: Likewise. * pe-dll.c: Likewise.
2016-03-21Automatic date update in version.inGDB Administrator1-1/+1
2016-03-20Automatic date update in version.inGDB Administrator1-1/+1
2016-03-19Automatic date update in version.inGDB Administrator1-1/+1
2016-03-18Automatic date update in version.inGDB Administrator1-1/+1
2016-03-17Automatic date update in version.inGDB Administrator1-1/+1
2016-03-16Automatic date update in version.inGDB Administrator1-1/+1