aboutsummaryrefslogtreecommitdiff
path: root/bfd
AgeCommit message (Collapse)AuthorFilesLines
2017-11-23Rename u.weakdef and make it a circular listAlan Modra42-294/+377
This makes the elf_link_hash_entry weakdef field, currently used to point from a weak symbol to a strong alias, a circular list so that all aliases can be found from any of them. A new flag, is_weakalias, distinguishes the weak symbol from a strong alias, and is used in all places where we currently test u.weakdef != NULL. With the original u.weakdef handling it was possible to have two or more weak symbols pointing via u.weakdef to a strong definition. Obviously that situation can't map to a circular list; One or more of the weak symbols must point at another weak alias rather than the strong definition. To handle that, I've added an accessor function to return the strong definition. * elf-bfd.h (struct elf_link_hash_entry): Add is_weakalias. Rename u.weakdef to u.alias and update comment. (weakdef): New static inline function. * elflink.c (bfd_elf_record_link_assignment) Test is_weakalias rather than u.weakdef != NULL, and use weakdef function. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. Clear is_weakalias on all aliases if def has been overridden in a regular object, not u.weakdef. (elf_link_add_object_symbols): Delete new_weakdef flag. Test is_weakalias and use weakdef. Set is_weakalias and circular u.alias. Update comments. (_bfd_elf_gc_mark_rsec): Test is_weakalias rather than u.weakdef != NULL and use weakdef function. * elf-m10300.c (_bfd_mn10300_elf_adjust_dynamic_symbol): Test is_weakalias rather than u.weakdef != NULL and use weakdef function. Assert that def is strong defined. * elf32-arc.c (elf_arc_adjust_dynamic_symbol): Likewise. * elf32-arm.c (elf32_arm_adjust_dynamic_symbol): Likewise. * elf32-bfin.c (elf32_bfinfdpic_adjust_dynamic_symbol): Likewise. (bfin_adjust_dynamic_symbol): Likewise. * elf32-cr16.c (_bfd_cr16_elf_adjust_dynamic_symbol): Likewise. * elf32-cris.c (elf_cris_adjust_dynamic_symbol): Likewise. * elf32-frv.c (elf32_frvfdpic_adjust_dynamic_symbol): Likewise. * elf32-hppa.c (elf32_hppa_adjust_dynamic_symbol): Likewise. * elf32-i370.c (i370_elf_adjust_dynamic_symbol): Likewise. * elf32-lm32.c (lm32_elf_adjust_dynamic_symbol): Likewise. * elf32-m32r.c (m32r_elf_adjust_dynamic_symbol): Likewise. * elf32-m68k.c (elf_m68k_adjust_dynamic_symbol): Likewise. * elf32-metag.c (elf_metag_adjust_dynamic_symbol): Likewise. * elf32-microblaze.c (microblaze_elf_adjust_dynamic_symbol): Likewise. * elf32-nds32.c (nds32_elf_adjust_dynamic_symbol): Likewise. * elf32-nios2.c (nios2_elf32_adjust_dynamic_symbol): Likewise. * elf32-or1k.c (or1k_elf_adjust_dynamic_symbol): Likewise. * elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Likewise. * elf32-s390.c (elf_s390_adjust_dynamic_symbol): Likewise. * elf32-score.c (s3_bfd_score_elf_adjust_dynamic_symbol): Likewise. * elf32-score7.c (s7_bfd_score_elf_adjust_dynamic_symbol): Likewise. * elf32-sh.c (sh_elf_adjust_dynamic_symbol): Likewise. * elf32-tic6x.c (elf32_tic6x_adjust_dynamic_symbol): Likewise. * elf32-tilepro.c (tilepro_elf_gc_mark_hook): Likewise. (tilepro_elf_adjust_dynamic_symbol): Likewise. * elf32-vax.c (elf_vax_adjust_dynamic_symbol): Likewise. * elf32-xtensa.c (elf_xtensa_adjust_dynamic_symbol): Likewise. * elf64-alpha.c (elf64_alpha_adjust_dynamic_symbol): Likewise. * elf64-hppa.c (elf64_hppa_adjust_dynamic_symbol): Likewise. * elf64-ia64-vms.c (elf64_ia64_adjust_dynamic_symbol): Likewise. * elf64-ppc.c (ppc64_elf_gc_mark_hook): Likewise. (ppc64_elf_adjust_dynamic_symbol): Likewise. * elf64-s390.c (elf_s390_adjust_dynamic_symbol): Likewise. * elf64-sh64.c (sh64_elf64_adjust_dynamic_symbol): Likewise. * elfnn-aarch64.c (elfNN_aarch64_adjust_dynamic_symbol): Likewise. * elfnn-ia64.c (elfNN_ia64_adjust_dynamic_symbol): Likewise. * elfnn-riscv.c (riscv_elf_adjust_dynamic_symbol): Likewise. * elfxx-mips.c (_bfd_mips_elf_adjust_dynamic_symbol): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_gc_mark_hook): Likewise. (_bfd_sparc_elf_adjust_dynamic_symbol): Likewise. * elfxx-tilegx.c (tilegx_elf_gc_mark_hook): Likewise. (tilegx_elf_adjust_dynamic_symbol): Likewise. * elfxx-x86.c (_bfd_x86_elf_adjust_dynamic_symbol): Likewise.
2017-11-23Automatic date update in version.inGDB Administrator1-1/+1
2017-11-22Automatic date update in version.inGDB Administrator1-1/+1
2017-11-21Add NULL bfd test to elf_symbol_fromAlan Modra3-4/+12
A followup to PR22443. * elf-bfd.h (elf_symbol_from): Check for NULL symbol bfd. * elfcode.h (elf_slurp_reloc_table_from_section): Add FIXME comment.
2017-11-21Automatic date update in version.inGDB Administrator1-1/+1
2017-11-20Fix handling of GNU Property notes that are not in a GNU NOTE PROPERTY section.Nick Clifton2-4/+17
PR 22450 gas * elf-properties.c (_bfd_elf_link_setup_gnu_properties): Skip objects without a GNU_PROPERTY note section when looking for a bfd onto which notes can be accumulated. ld * testsuite/ld-elf/elf.exp: Add --defsym ALIGN=2|3 to assembler command line depending upon the size of the target address space. * testsuite/ld-elf/pr22450.s: New test file. * testsuite/ld-elf/pr22450.d: New test driver. * testsuite/config/default.exp: Add note that LD_CLASS refers to the size of the host linker not the size of the target linker.
2017-11-21PR22451, strip no longer works on older object filesAlan Modra2-7/+25
Setting SHF_GROUP unconditionally on rel/rela sections associated with SHF_GROUP sections fails badly with objcopy/strip and ld -r if the input file SHT_GROUP section didn't specify the rel/rela sections. This patch rearranges where SHF_GROUP is set for rel/rela sections. PR 22451 PR 22460 * elf.c (_bfd_elf_init_reloc_shdr): Delete "sec_hdr" parameter and leave rel_hdr->sh_flags zero. Update calls. (bfd_elf_set_group_contents): Check input rel/rela SHF_GROUP flag when !gas before adding rel/rela section to group. Set output rel/rela SHF_GROUP flags.
2017-11-20Automatic date update in version.inGDB Administrator1-1/+1
2017-11-18Fix error message typo.Jim Wilson2-1/+6
bfd/ * elfnn-riscv.c (_bfd_riscv_relax_align): Add space between alignment and to in error message.
2017-11-19Automatic date update in version.inGDB Administrator1-1/+1
2017-11-18Automatic date update in version.inGDB Administrator1-1/+1
2017-11-17x86: Pass "%F%P:" to linker callback in case of errorH.J. Lu2-10/+15
We should pass "%F%P:" to linker callback in case of error. Otherwise, linker will report: : failed to create GNU property section * elfxx-x86.c (_bfd_x86_elf_link_setup_gnu_properties): Pass "%F%P:", instead of "%F:", to linker callback in case of error.
2017-11-17Automatic date update in version.inGDB Administrator1-1/+1
2017-11-16Prevent illegal memory accesses when parsing incorrecctly formated core notes.Nick Clifton2-0/+17
PR 22421 * elf.c (elfcore_grok_netbsd_procinfo): Check that the note is big enough. (elfcore_grok_openbsd_procinfo): Likewise. (elfcore_grok_nto_status): Likewise.
2017-11-16Prevent a possible seg-fault in the section merging code, by always creating ↵Nick Clifton2-10/+17
a padding buffer. * merge.c (sec_merge_emit): Always create padding buffer. Add asserts to make sure that the buffer is long enough.
2017-11-16Automatic date update in version.inGDB Administrator1-1/+1
2017-11-15Handle ' and I format flagsAlan Modra2-14/+29
Also a little tidying and error checking. * bfd.c (union _bfd_doprnt_args): Add "Bad". (_bfd_doprnt): Handle more flags. (_bfd_doprnt_scan): Likewise. Tidy setting of args array. (error_handler_internal): Init args type to Bad.
2017-11-15Automatic date update in version.inGDB Administrator1-1/+1
2017-11-14PR22431, powerpc64 ld segfault when .plt discardedAlan Modra2-6/+19
The fix for the PR is to not use input_section->output_section->owner to get to the output bfd, but use the output bfd directly since it is available nowadays in struct bfd_link_info. I thought it worth warning when non-empty dynamic sections are discarded too, which meant a tweak to one of the ld tests to avoid the warning. bfd/ PR 22431 * elf64-ppc.c (ppc64_elf_size_dynamic_sections): Warn on discarding non-empty dynamic section. (ppc_build_one_stub): Take elf_gp from output bfd, not output section owner. (ppc_size_one_stub, ppc64_elf_next_toc_section): Likewise. ld/ * testsuite/ld-elf/note-3.t: Don't discard .got.
2017-11-14Inconsistent .eh_frame_hdr on powerpc64Alan Modra2-1/+6
There is code in bfd/elf-eh-frame.c and ld/emultempl/elf32.em that checks for the presence of eh_frame info by testing for a section named .eh_frame sized more than 8 bytes. The size test is to exclude a zero terminator. A similar check in elf64-ppc.c wrongly just tested for non-zero size before creating the linker generated .eh_frame describing plt call and other linkage stubs. The intention was to not generate that info unless there was some user .eh_frame. (No user .eh_frame implies the user doesn't care about exception handling.) Because the test in elf64-ppc.c was wrong, ld generated the stub .eh_frame just on finding a zero .eh_frame terminator in crtend.o, but didn't generate the corresponding .eh_frame_hdr. * elf64-ppc.c (ppc64_elf_size_stubs): Correct test for user .eh_frame info.
2017-11-14Automatic date update in version.inGDB Administrator1-1/+1
2017-11-13PE: don't corrupt section flags when linking from ELF objectsJan Beulich3-8/+27
Linking EFI executables from ELF object files can result in corrupted COFF section flags if the section's alignment is too high. Issue a diagnostic in that case, erroring out if this is not a final link, and make sure only in-range values get written to the output image. While doing this also make tic80 use the generic alignment macros instead of custom #ifdef-ary. No testsuite regressions for the range of COFF/PE targets that actually cross-build in the first place on x86-64-linux.
2017-11-12ld: Remove PF_X from PT_PHDR segmentH.J. Lu2-2/+7
It was reasonable to mark PT_PHDR segment with PF_X for compatibility with UnixWare and Solaris linkers 20 years ago. But it is inappropriate today when the primary OS of GNU ld is Linux. This patch removes PF_X from PT_PHDR segment as gold does. Tested natively on Linux/x86 as well as crosss-binutils for alpha-linux, ia64-linux, powerpc64-linux, powerpc-linux, s390-linux, s390x-linux, sparc64-linux and sparc-linux. bfd/ PR ld/22423 * elf.c (_bfd_elf_map_sections_to_segments): Remove PF_X from PT_PHDR segment. ld/ PR ld/22423 * testsuite/ld-alpha/tlsbin.rd: Replace "R E " with "R +" for PT_PHDR segment. * testsuite/ld-alpha/tlsbinr.rd: Likewise. * testsuite/ld-ia64/tlsbin.rd: Likewise. * testsuite/ld-powerpc/tlsexe.r: Likewise. * testsuite/ld-powerpc/tlsexe32.r: Likewise. * testsuite/ld-powerpc/tlsexetoc.r: Likewise. * testsuite/ld-s390/tlsbin.rd: Likewise. * testsuite/ld-s390/tlsbin_64.rd: Likewise. * testsuite/ld-sparc/tlssunbin32.rd: Likewise. * testsuite/ld-sparc/tlssunbin64.rd: Likewise. * testsuite/ld-elf/pr22423.d: New test.
2017-11-13Automatic date update in version.inGDB Administrator1-1/+1
2017-11-12weakdef list handlingAlan Modra2-4/+9
The existing code allowed common and indirect symbols to pass an assert, but then read root.u.def which is not valid for anything besides defined and weakdef symbols. The garbage root.u.def.section pointer read can't possibly match pointers stored at the same location for indirect and common symbols, so we would always have left u.weakdef NULL. * elflink.c (elf_link_add_object_symbols): Ignore anything but defined and defweak symbols when setting up weakdefs.
2017-11-12non_got_ref after adjust_dynamic_relocsAlan Modra4-139/+165
This patch was aimed at a FIXME in elf32-hppa.c, the ludicrous and confusing fact that non_got_ref after adjust_dynamic_relocs in that backend means precisely the inverse of what it means before adjust_dynamic_relocs. Before, when non_got_ref is set it means there are dynamic relocs, after, if non_got_ref is clear it means "keep dynamic relocs" and later, "has dynamic relocs". There is a reason why it was done that way.. Some symbols that may have dynamic relocations pre-allocated in check_relocs turn out to not be dynamic, and then are not seen by the backend adjust_dynamic_symbols. We want those symbols to lose their dynamic relocs when non-pic, so it's handy that non_got_ref means the opposite after adjust_dynamic_relocs. But it's really confusing. Most other targets, like ppc32, don't always set non_got_ref on non-GOT references that have dynamic relocations. This is because the primary purpose of non_got_ref before adjust_dynamic_relocs is to flag symbols that might need to be copied to .dynbss, and there are relocation types that may require dyn_relocs but clearly cannot have symbols copied into .dynbss, for example, TLS relocations. Why do we need a flag after adjust_dynamic_relocs to say "keep dynamic relocations"? Well, you can discard most unwanted dyn_relocs in the backend adjust_dynamic_relocs, and for those symbols that aren't seen by the backend adjust_dynamic_relocs, in allocate_dynrelocs based on a flag set by adjust_dynamic relocs, dynamic_adjusted. That doesn't solve all our difficulties though. relocate_section needs to know whether a symbol has dyn_relocs, and many targets transfer dyn_relocs to a weakdef if the symbol has one. The transfer means relocate_section can't test dyn_relocs itself and the weakdef field has been overwritten by that time. So non_got_ref is used to flag "this symbol has dynamic relocations" for relocate_section. Confused still? Well, let's hope the comments I've added help clarify things.. The patch also fixes a case where we might wrongly emit dynamic relocations in an executable for common and undefined symbols. * elf32-hppa.c (elf32_hppa_adjust_dynamic_symbol): Set non_got_ref to keep dyn_relocs, clear to discard. Comment. (allocate_dynrelocs): Always clear non_got_ref when clearing dyn_relocs in non-pic case. Invert non_got_ref test. Also test dynamic_adjusted and ELF_COMMON_DEF_P. Move code deleting dyn_relocs on undefined syms to handle for non-pic too. (elf32_hppa_relocate_section): Simplify test for non-pic dyn relocs. * elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Set non_got_ref to keep dyn_relocs, clear to discard. Comment. (allocate_dynrelocs): Always clear non_got_ref when clearing dyn_relocs in non-pic case. Invert non_got_ref test. Also test dynamic_adjusted and ELF_COMMON_DEF_P. Move code deleting dyn_relocs on undefined syms to handle for non-pic too. (ppc_elf_relocate_section): Simplify test for non-pic dyn relocs. * elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Discard dyn_relocs here. Don't bother setting non_got_ref. Comment. (allocate_dynrelocs): Delete special handling of non-pic ELFv2 ifuncs. Move code deleting dyn_relocs on undefined symbols to handle for non-pic too. Don't test non_got_ref. Do test dynamic_adjusted and ELF_COMMON_DEF_P.
2017-11-12Automatic date update in version.inGDB Administrator1-1/+1
2017-11-11Automatic date update in version.inGDB Administrator1-1/+1
2017-11-10Automatic date update in version.inGDB Administrator1-1/+1
2017-11-09Automatic date update in version.inGDB Administrator1-1/+1
2017-11-08BFD: Extract PID from MIPS core dump fileDjordje Todorovic4-0/+12
On MIPS o32, n32 and n64 platforms, PID information was not correctly propagated from core dump file to internal GDB structures. This patch fixes that behavior. A correct PID is needed by `libthread_db' library supplied with glibc repository revisions before commit c579f48edba8 ("Remove cached PID/TID in clone") or released versions before 2.25 for GDB to fetch value of TLS variable from core file. bfd/ChangeLog: * elf32-mips.c (elf32_mips_grok_psinfo): Extract core->pid. * elf64-mips.c (elf64_mips_grok_psinfo): Likewise. * elfn32-mips.c (elf32_mips_grok_psinfo): Likewise.
2017-11-08BFD: Write Linux core PRSTATUS note into MIPS core fileDjordje Todorovic4-0/+141
On MIPS o32, n32 and n64 platforms information such as PID was not correctly written into core file from GDB. This fixes that behavior. bfd/ChangeLog: * elf32-mips.c (elf32_mips_write_core_note): New function. (elf_backend_write_core_note): New macro. * elf64-mips.c (elf64_mips_write_core_note): New function. (elf_backend_write_core_note): New macro. * elfn32-mips.c (elf32_mips_write_core_note): New function. (elf_backend_write_core_note): New macro.
2017-11-08Automatic date update in version.inGDB Administrator1-1/+1
2017-11-07PowerPC64 statistics messageAlan Modra2-10/+18
Fixes "linker stubs in 1 groups". * elf64-ppc.c (ppc64_elf_build_stubs): Correct pluralization in statistics message.
2017-11-07ngettext supportAlan Modra3-23/+51
binutils has lacked proper pluralization of output messages for a long time, for example, readelf will display information about a section that "contains 1 entries" or "There are 1 section headers". Fixing this properly requires us to use ngettext, because other languages have different rules to English. This patch defines macros for ngettext and friends to handle builds with --disable-nls, and tidies the existing nls support. I've redefined gettext rather than just defining "_" as dgettext in bfd and opcodes in case someone wants to use gettext there (which might conceivably happen with generated code). bfd/ * sysdep.h: Formatting, comment fixes. (gettext, ngettext): Redefine when ENABLE_NLS. (ngettext, dngettext, dcngettext): Define when !ENABLE_NLS. (_): Define using gettext. (textdomain, bindtextdomain): Use safer "do nothing". * hosts/alphavms.h (textdomain, bindtextdomain): Likewise. (ngettext, dngettext, dcngettext): Define when !ENABLE_NLS. opcodes/ * opintl.h: Formatting, comment fixes. (gettext, ngettext): Redefine when ENABLE_NLS. (ngettext, dngettext, dcngettext): Define when !ENABLE_NLS. (_): Define using gettext. (textdomain, bindtextdomain): Use safer "do nothing". binutils/ * sysdep.h (textdomain, bindtextdomain): Use safer "do nothing". (ngettext, dngettext, dcngettext): Define when !ENABLE_NLS. gas/ * asintl.h (textdomain, bindtextdomain): Use safer "do nothing". (ngettext, dngettext, dcngettext): Define when !ENABLE_NLS. gold/ * system.h (textdomain, bindtextdomain): Use safer "do nothing". (ngettext, dngettext, dcngettext): Define when !ENABLE_NLS. ld/ * ld.h (textdomain, bindtextdomain): Use safer "do nothing". (ngettext, dngettext, dcngettext): Define when !ENABLE_NLS.
2017-11-07Automatic date update in version.inGDB Administrator1-1/+1
2017-11-06Automatic date update in version.inGDB Administrator1-1/+1
2017-11-05Proper bound check in _bfd_doprnt_scanAlan Modra2-6/+12
While an abort after storing out of bounds by one to an array in our caller is probably OK in practice, it's better to check before storing. PR 22397 * bfd.c (_bfd_doprnt_scan): Check args index before storing, not after.
2017-11-05PR22397, BFD internal error when message locale isn't CAlan Modra2-31/+317
This adds positional parameter support to the bfd error handler, something that was lost 2017-04-13 when _doprnt was added with commit c08bb8dd. The number of format args is now limited to 9, which is sufficient for current _bfd_error_handler messages. If someone exceeds 9 args they get the joy of modifying this code to support more args (shouldn't be too difficult). PR 22397 * bfd.c (union _bfd_doprnt_args): New. (PRINT_TYPE): Add FIELD arg. Take value from args. (_bfd_doprnt): Replace ap parameter with args. Adjust all PRINT_TYPE invocations and reading of format args to suit. Move "%%" handling out of switch handling args. Support positional parameters. (_bfd_doprnt_scan): New function. (error_handler_internal): Call _bfd_doprnt_scan and read args.
2017-11-05Automatic date update in version.inGDB Administrator1-1/+1
2017-11-05powerpc TLS in PIEsAlan Modra3-46/+92
This patch removes unnecessary GOT IE TLS relocations in PIEs. Useful with --no-tls-optimize, or with an enormous TLS segment. With the default --tls-optimize in effect IE code sequences will be edited to LE under the same circumstances we can remove the GOT reloc. * elf32-ppc.c (got_entries_needed, got_relocs_needed): New functions. (allocate_dynrelocs, ppc_elf_size_dynamic_sections): Use them here. (ppc_elf_relocate_section): Don't output a dynamic relocation for IE GOT entries in an executable. * elf64-ppc.c (allocate_got): Trim unnecessary TPREL relocs. (ppc64_elf_size_dynamic_sections): Likewise. (ppc64_elf_relocate_section): Likewise.
2017-11-05PowerPC readonly_dynrelocsAlan Modra3-28/+40
PowerPC64 lacked the mapfile textrel warning on finding dynamic relocs in read-only sections. This patch adds it, and tidies the readonly_dynrelocs interface. PowerPC doesn't need a SEC_ALLOC test because !SEC_ALLOC sections are excluded by check_relocs so will never have dyn_relocs. * elf32-ppc.c (readonly_dynrelocs): Delete info param. Update all callers. Don't bother with SEC_ALLOC test. Return section pointer. Move minfo call to.. (maybe_set_textrel): ..here. * elf64-ppc.c (readonly_dynrelocs): Return section pointer. (maybe_set_textrel): Call minfo to print textrel warning to map file.
2017-11-05hppa-linux TLS relocsAlan Modra2-111/+170
This patch fixes various problems with TLS relocations. 1) Report an error if a symbol has both TLS and normal GOT entries. 2) The GOT entry size calculation was obscure and made use of the fact that a symbol shouldn't have both normal and TLS GOT entries. 3) The second word of a GD GOT entry sometimes omitted a dynamic reloc, which was fine except that doing so makes it impossible for ld.so to differentiate GD and LD entries. Also, a NONE reloc was emitted. 4) Unnecessary relocs were emitted for GOT entries. 5) GOT relocs didn't take note of UNDEFWEAK_NO_DYNAMIC_RELOC. * elf32-hppa.c (enum _tls_type): Move. (struct elf32_hppa_link_hash_entry): Make tls_type a bitfield. (elf32_hppa_check_relocs): Set DF_STATIC_TLS only for shared libraries. Tidy tls_type handling. Set symbol tls_type for GOT_TLS_LDM too. (got_entries_needed, got_relocs_needed): New functions. (allocate_dynrelocs): Use them. (elf32_hppa_size_dynamic_sections): Likewise. (elf32_hppa_relocate_section): Delete bogus FIXME. Formatting. Correct code emitting relocs on GD/IE got entries. Report an error when a symbol has both normal and TLS GOT relocs.
2017-11-05PR22394, hppa-linux-ld fails to emit dynamic relocationsAlan Modra2-37/+94
gcc -mfast-indirect-calls emits a function pointer initialization without a P% (plabel) modifier. ld does not create the necessary dynamic relocations for this to work. It turns out that the problem is caused by the non_got_ref symbol flag. This flag is set for non-pic by check_relocs to indicate that the symbol might need copy relocations or dynamic relocations. Later, the backend adjust_dynamic_symbol clears the flag to indicate dynamic relocations are needed, but leaves it set when copy relocations were created. The inversion in meaning is insane, but it's that way because the backend adjust_dynamic_symbol function doesn't get to look at all symbols.. Anyway, the insanity works for non-function symbols. However, the flag is left set on any function symbol with a dynamic relocation. This patch fixes the non_got_ref handling for function symbols, adds -z nocopyreloc for hppa-elf, reports where textrel occurs, and expands comments. The check_relocs change just stops creation of dyn_relocs we always threw away later. PR 22394 * elf32-hppa.c (elf32_hppa_check_relocs): Don't create dyn_relocs for plabels when non-pic. (maybe_set_textrel): New function. (readonly_dynrelocs): Move and rewrite. (elf32_hppa_adjust_dynamic_symbol): Use it. Don't create copy relocs when def_regular or -z nocopyreloc. Handle non_got_ref for functions. Expand non_got_ref comments. (elf32_hppa_size_dynamic_sections): Use maybe_set_textrel.
2017-11-04Automatic date update in version.inGDB Administrator1-1/+1
2017-11-03x86: Remove func_pointer_refcountH.J. Lu5-60/+60
Since check_reloc is running after gc_sections, there is no need for reference count. If a function pointer relocation can be resolved at run-time, there is no need for PLT and it doesn't count as non-GOT/PLT relocation. func_pointer_refcount can be removed. * elf32-i386.c (elf_i386_check_relocs): Set plt.refcount to 1. Don't use func_pointer_refcount. Don't set plt.refcount nor non_got_ref for function pointer reference. * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise. * elfxx-x86.c (elf_x86_allocate_dynrelocs): Don't use func_pointer_refcount. (_bfd_x86_elf_copy_indirect_symbol): Don't copy func_pointer_refcount. (_bfd_x86_elf_hide_symbol): Don't use func_pointer_refcount. * elfxx-x86.h (GENERATE_DYNAMIC_RELOCATION_P): Likewise. (elf_x86_link_hash_entry): Remove func_pointer_refcount.
2017-11-03Fix excessive memory allocation attempts and possible integer overfloaws ↵Nick Clifton2-2/+23
when attempting to read a COFF binary with a corrupt symbol count. PR 22385 * coffgen.c (_bfd_coff_get_external_symbols): Check for an overlarge raw syment count. (coff_get_normalized_symtab): Likewise.
2017-11-03Automatic date update in version.inGDB Administrator1-1/+1
2017-11-02Automatic date update in version.inGDB Administrator1-1/+1
2017-11-01FT32B is a new FT32 family member. It has a code compression scheme, which ↵James Bowman7-17/+952
requires the use of linker relaxations. The change is quite large, so submission is in several parts. Part 2 adds a relaxation pass, which actually implements the code compression scheme. bfd * archures.c: Add bfd_mach_ft32b. * cpu-ft32.c: Add arch_info_struct. * elf32-ft32.c: Add R_FT32_RELAX, SC0, SC1, DIFF32. (ft32_elf_relocate_section): Add clauses for R_FT32_SC0, SC1, DIFF32. (ft32_reloc_shortable, elf32_ft32_is_diff_reloc, elf32_ft32_adjust_diff_reloc_value, elf32_ft32_adjust_reloc_if_spans_insn, elf32_ft32_relax_delete_bytes, elf32_ft32_relax_is_branch_target, ft32_elf_relax_section): New function. * reloc.c: Add BFD_RELOC_FT32_RELAX, SC0, SC1, DIFF32. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. gas * config/tc-ft32.c (md_assemble): add relaxation reloc BFD_RELOC_FT32_RELAX. (md_longopts): Add "norelax" and "no-relax". (md_apply_fix): Add reloc BFD_RELOC_FT32_DIFF32. (relaxable_section, ft32_validate_fix_sub, ft32_force_relocation, ft32_allow_local_subtract): New function. * config/tc-ft32.h: remove unused MD_PCREL_FROM_SECTION. * testsuite/gas/ft32/insnsc.s: New test exercising all FT32B shortcodes. include * elf/ft32.h: Add R_FT32_RELAX, SC0, SC1, DIFF32.