aboutsummaryrefslogtreecommitdiff
path: root/bfd
AgeCommit message (Collapse)AuthorFilesLines
2017-08-23Make undefined symbols in allocate_dynrelocs dynamicAlan Modra4-54/+59
..if they have dynamic relocs. An undefined symbol in a PIC object that finds no definition ought to become dynamic in order to support --allow-shlib-undefined, but there is nothing in the generic ELF linker code to do this if the reference isn't via the GOT or PLT. (An initialized function pointer is an example.) So it falls to backend code to ensure the symbol is made dynamic. PR 21988 * elf64-ppc.c (ensure_undef_dynamic): Rename from ensure_undefweak_dynamic. Handle undefined too. * elf32-ppc.c (ensure_undef_dynamic): Likewise. * elf32-hppa.c (ensure_undef_dynamic): Likewise. (allocate_dynrelocs): Discard undefined non-default visibility relocs first. Make undefined syms dynamic. Tidy goto.
2017-08-21Make __start/__stop symbols protected visibilityAlan Modra3-12/+33
They can't be hidden visibility since apparently people use dlsym to look them up. bfd/ PR ld/21964 * elf-bfd.h (SYMBOLIC_BIND): Return TRUE for __start/__stop symbols. * elflink.c (bfd_elf_define_start_stop): Rewrite. ld/ PR ld/21964 * testsuite/ld-elf/pr21562a.d: Update for changed start/stop symbols. * testsuite/ld-elf/pr21562b.d: Likewise. * testsuite/ld-elf/pr21562c.d: Likewise. * testsuite/ld-elf/pr21562d.d: 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-elf/sizeofa.d: Likewise. * testsuite/ld-elf/sizeofb.d: Likewise. * testsuite/ld-elf/startofa.d: Likewise. * testsuite/ld-elf/startofb.d: Likewise. * testsuite/ld-gc/pr20022.d: Likewise. * testsuite/ld-gc/start.d: Likewise. * testsuite/ld-elf/pr21964-1a.c: New file. * testsuite/ld-elf/pr21964-1b.c: New file. * testsuite/ld-elf/pr21964-2a.c: New file. * testsuite/ld-elf/pr21964-2b.c: New file. * testsuite/ld-elf/shared.exp: Run PR ld/21964 tests.
2017-08-21PR ld/20125, MMIX weak symbolsHans-Peter Nilsson2-6/+23
Weak undefineds with PUSHJ relocs were "lost", causing internal inconsistencies and an abort.
2017-08-21Automatic date update in version.inGDB Administrator1-1/+1
2017-08-20Automatic date update in version.inGDB Administrator1-1/+1
2017-08-19Automatic date update in version.inGDB Administrator1-1/+1
2017-08-18Fix buffer overrun parsing a corrupt tekhex binary.Nick Clifton2-1/+7
PR binutils/21962 * tekhex.c (getsym): Fix check for source pointer walking off the end of the input buffer.
2017-08-18Automatic date update in version.inGDB Administrator1-1/+1
2017-08-17[AArch64] Skip IFUNC relocations in debug sectionsSzabolcs Nagy2-3/+28
Skip IFUNC relocations in debug sections ignored by ld.so. Fixes the following ld test failures on aarch64: FAIL: Build libpr18808.so FAIL: Build libpr18808.so_2 FAIL: Run pr18808 aborting at bfd/elfnn-aarch64.c:4986 in elf64_aarch64_final_link_relocate. bfd/ PR ld/18808 * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Skip IFUNC relocations in debug sections, change abort to _bfd_error_handler.
2017-08-17Automatic date update in version.inGDB Administrator1-1/+1
2017-08-16Automatic date update in version.inGDB Administrator1-1/+1
2017-08-14Fix null pointer dereference when parsing a corrupt ELF binary.Nick Clifton3-1123/+1180
PR 21957 * elf.c (setup_group): Check for an empty or very small group section. * po/bfd.pot: Regenerate.
2017-08-14Automatic date update in version.inGDB Administrator1-1/+1
2017-08-14PR21441, Unnecessary padding of .eh_frame sectionAlan Modra3-9/+37
Until all .eh_frame sections have been edited we don't know their sizes. So it isn't possible to properly decide whether a non-empty .eh_frame section follows a given section until editing is complete. bfd/ PR 21441 * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Don't add alignment padding here. * elflink.c (bfd_elf_discard_info): Add .eh_frame padding here in a reverse pass over sections. ld/ PR 21441 * testsuite/ld-x86-64/pr21038a.d: Adjust. * testsuite/ld-x86-64/pr21038a-now.d: Adjust.
2017-08-13Automatic date update in version.inGDB Administrator1-1/+1
2017-08-12Automatic date update in version.inGDB Administrator1-1/+1
2017-08-11x86: Allocate space for symbol names with symbol tableH.J. Lu3-84/+73
When synthesizing symbols for PLT entries, allocate space for symbol names with @plt suffixes together with symbol table so that all memory is returned when symbol table is freed. PR binutils/21943 * elf32-i386.c (elf_i386_get_synthetic_symtab): Allocate space for @plt suffixes first. * elf64-x86-64.c (elf_x86_64_get_synthetic_symtab): Likewise.
2017-08-11Automatic date update in version.inGDB Administrator1-1/+1
2017-08-10Fix out of bounds memory access when trying to allocate space for a note of ↵Nick Clifton1-1/+1
size -1. PR 21933 * elf.c (elf_read_notes): Check for a note size of -1.
2017-08-10Automatic date update in version.inGDB Administrator1-1/+1
2017-08-09Automatic date update in version.inGDB Administrator1-1/+1
2017-08-08Fix address violation problems when parsing corrupt ELF binaries.Nick Clifton3-47/+80
PR 21916 * elf-attrs.c (_bfd_elf_parse_attributes): Complain about very small section lengths. * elf.c (_bfd_elf_setup_sections): Skip empty entries in the group table. (elfcore_grok_freebsd_prstatus): Add checks to make sure that there is enough data present in the note.
2017-08-08PR21017, microblaze missing _GLOBAL_OFFSET_TABLE_ symbolAlan Modra2-1/+17
PR 21017 * elf32-microblaze.c (microblaze_elf_check_relocs): Don't bump got.refcount for GOTOFF relocs, just create .got section.
2017-08-08Automatic date update in version.inGDB Administrator1-1/+1
2017-08-07Move common symbol check after bed->common_definitionH.J. Lu2-5/+11
bfd/ * elflink.c (elf_link_add_object_symbols): Move common symbol check after bed->common_definition. ld/ * testsuite/ld-elf/pr21903.s (start): Removed. (_start): Likewise. (__start): Likewise. (main): Likewise. (bar): New.
2017-08-07PR21910, segfault in common symbol override test when hash-style=gnuAlan Modra2-1/+7
PR 21910 * elflink.c (bfd_elf_final_link): Don't segfault when sections needed to define various dynamic tags have been discarded.
2017-08-07Do not choose a non-ELF format input file to hold the linker created GOT ↵Nick Clifton3-17/+37
sections. PR 21884 * elf32-i386.c (elf_i386_link_setup_gnu_properties): If the dynobj has not been set then use the bfd returned by _bfd_elf_link_setup_gnu_properties. If that is null then search through all the input bfds selecting the first normal, ELF format one. * elf64-x86-64.c (elf_x86_64_link_setup_gnu_properties): Likewise.
2017-08-07Automatic date update in version.inGDB Administrator1-1/+1
2017-08-06x86: Lookup __tls_get_addr or ___tls_get_addr onceH.J. Lu3-58/+70
Instead of checking if a symbol is __tls_get_addr or ___tls_get_addr, we check if there is a reference to __tls_get_addr or ___tls_get_addr before starting relocation check. * elf32-i386.c (elf_i386_link_hash_entry): Change tls_get_addr to 1 bit. (elf_i386_link_hash_newfunc): Initialize tls_get_addr to 0. (elf_i386_check_tls_transition): Check tls_get_addr directly. (elf_i386_convert_load_reloc): Update tls_get_addr check. (elf_i386_link_check_relocs): New function. (bfd_elf32_bfd_link_check_relocs): New. * elf64-x86-64.c (elf_x86_64_link_hash_entry): Change tls_get_addr to 1 bit. (elf_x86_64_link_hash_newfunc): Initialize tls_get_addr to 0. (elf_x86_64_check_tls_transition): Check tls_get_addr directly. (elf_x86_64_convert_load_reloc): Update tls_get_addr check. (elf_x86_64_link_check_relocs): New function. (bfd_elf64_bfd_link_check_relocs): New. (bfd_elf32_bfd_link_check_relocs): Likewise.
2017-08-06Treat common symbol as undefined for --no-define-commonH.J. Lu2-0/+11
When --no-define-common is used to build shared library, treat common symbol as undefined so that common symbols that are referenced from a shared library to be assigned addresses only in the main program. This eliminates the unused duplicate space in the shared library, and also prevents any possible confusion over resolving to the wrong duplicate when there are many dynamic modules with specialized search paths for runtime symbol resolution. --no-define-common is only allowed when building a shared library. bfd/ PR ld/21903: * elflink.c (elf_link_add_object_symbols): Treat common symbol as undefined for --no-define-common. include/ PR ld/21903: * bfdlink.h (bfd_link_info): Add inhibit_common_definition. ld/ PR ld/21903: * ld.h (command_line): Remove inhibit_common_definition. * ldgram.y: Replace command_line.inhibit_common_definition with link_info.inhibit_common_definition. * ldlang.c (lang_common): Likewise. * lexsup.c (parse_args): Likewise. * ldmain.c (main): Only allow --no-define-common with -shared. * testsuite/ld-elf/pr21903.s: New file. * testsuite/ld-elf/pr21903a.d: Likewise. * testsuite/ld-elf/pr21903b.d: Likewise. * testsuite/ld-elf/pr21903c.d: Likewise. * testsuite/ld-elf/pr21903d.d: Likewise. * testsuite/ld-elf/pr21903e.d: Likewise.
2017-08-06Automatic date update in version.inGDB Administrator1-1/+1
2017-08-05Don't fail in elf32_hppa_set_gpAlan Modra2-9/+12
The base bfd_link_hash_table works fine here, the only thing to watch out for is to only set elf_gp if the output is ELF. bfd/ * elf32-hppa.c (elf32_hppa_set_gp): Don't require an hppa_link_hash_table. ld/ * testsuite/ld-unique/pr21529.d: Don't xfail hppa.
2017-08-05Automatic date update in version.inGDB Administrator1-1/+1
2017-08-04Automatic date update in version.inGDB Administrator1-1/+1
2017-08-03Automatic date update in version.inGDB Administrator1-1/+1
2017-08-02Fix potential illegal memory access in Xtensa port.Max Filippov2-1/+7
* xtensa-isa.c (xtensa_isa_init): Don't update lookup table entries for sysregs with negative indices.
2017-08-02Automatic date update in version.inGDB Administrator1-1/+1
2017-08-01S/390: Fix claimfile failuresAndreas Krebbel3-0/+12
This fixes a segfault when trying to access the local_plt field in the s390 specific elf data althoug the underlaying object is a generic elf object. This fixes the following testsuite failures: < FAIL: plugin claimfile replace symbol with source < FAIL: plugin claimfile resolve symbol with source < FAIL: plugin claimfile replace file with source < FAIL: plugin set symbol visibility with source < FAIL: plugin ignore lib with source < FAIL: plugin claimfile replace lib with source < FAIL: plugin 2 with source lib < FAIL: load plugin 2 with source < FAIL: plugin 3 with source lib < FAIL: load plugin 3 with source bfd/ChangeLog: 2017-08-01 Andreas Krebbel <krebbel@linux.vnet.ibm.com> * elf32-s390.c (elf_s390_finish_dynamic_sections): Skip if it isn't the S/390 specific elf data. * elf64-s390.c (elf_s390_finish_dynamic_sections): Likewise.
2017-08-01Automatic date update in version.inGDB Administrator1-1/+1
2017-07-31Improve handling of ADD and SUB relocations on the RISCV target.Kuan-Lin Chen2-9/+80
* elfxx-riscv.c (riscv_elf_add_sub_reloc): New function. * (howto_table) [R_RISCV_ADD8]: Use riscv_elf_add_sub_reloc. [R_RISCV_ADD16]: Likewise. [R_RISCV_ADD32]: Likewise. [R_RISCV_ADD64]: Likewise. [R_RISCV_SUB6]: Likewise. [R_RISCV_SUB8]: Likewise. [R_RISCV_SUB16]: Likewise. [R_RISCV_SUB32]: Likewise. [R_RISCV_SUB64]: Likewise.
2017-07-31PR 21847, PowerPC64 --plt-localentry againAlan Modra2-0/+11
This makes ld warn about --plt-localentry if a version of glibc without the necessary ld.so checks is detected, and revises the documentation. bfd/ * elf64-ppc.c (ppc64_elf_tls_setup): Warn on --plt-localentry without ld.so checks. gold/ * powerpc.cc (Target_powerpc::scan_relocs): Warn on --plt-localentry without ld.so checks. ld/ * ld.texinfo (plt-localentry): Revise.
2017-07-31Automatic date update in version.inGDB Administrator1-1/+1
2017-07-30Automatic date update in version.inGDB Administrator1-1/+1
2017-07-29PR 21847, Don't default PowerPC64 to --plt-localentryAlan Modra2-4/+31
The big comment in ppc64_elf_tls_setup says why. I've also added some code to the bfd linker that catches the -lpthread -lc symbol differences and disable generation of optimized call stubs even when --plt-localentry is activated. Gold doesn't yet have that. PR 21847 bfd/ * elf64-ppc.c (struct ppc_link_hash_entry): Add non_zero_localentry. (ppc64_elf_merge_symbol): Set non_zero_localentry. (is_elfv2_localentry0): Test non_zero_localentry. (ppc64_elf_tls_setup): Default to --no-plt-localentry. gold/ * powerpc.cc (Target_powerpc::scan_relocs): Default to --no-plt-localentry. ld/ * ld.texinfo (plt-localentry): Document.
2017-07-29Automatic date update in version.inGDB Administrator1-1/+1
2017-07-28Add missing changelogAndreas Krebbel1-0/+6
2017-07-28S/390: Fix segfault when linking -shared -nostartfilesAndreas Krebbel2-3/+9
Regression-tested on s390x. bfd/ChangeLog: 2017-07-28 Andreas Krebbel <krebbel@linux.vnet.ibm.com> * elf32-s390.c (elf_s390_finish_dynamic_sections): Add NULL pointer check for htab->elf.irelplt. * elf64-s390.c (elf_s390_finish_dynamic_sections): Likewise.
2017-07-28Automatic date update in version.inGDB Administrator1-1/+1
2017-07-27Fix address violation issues encountered when parsing corrupt binaries.Nick Clifton6-39/+82
PR 21840 * mach-o.c (bfd_mach_o_read_symtab_strtab): Fail if the symtab size is -1. * nlmcode.h (nlm_swap_auxiliary_headers_in): Replace assertion with error return. * section.c (bfd_make_section_with_flags): Fail if the name or bfd are NULL. * vms-alpha.c (bfd_make_section_with_flags): Correct computation of end pointer. (evax_bfd_print_emh): Check for invalid string lengths.
2017-07-27Automatic date update in version.inGDB Administrator1-1/+1