e785d0e901224a6e0780ceb973ceecb6227179da
[external/binutils.git] / bfd / ChangeLog
1 2017-08-26  Alan Modra  <amodra@gmail.com>
2
3         * elf32-ppc.c (must_be_dyn_reloc): Use bfd_link_dll.  Comment.
4         (ppc_elf_check_relocs): Only set DF_STATIC_TLS in shared libs.
5         (ppc_elf_relocate_section): Comment fix.
6         * elf64-ppc.c (must_be_dyn_reloc): Use bfd_link_dll.  Comment.
7         (ppc64_elf_check_relocs): Only set DF_STATIC_TLS in shared libs.
8         Support dynamic relocs for TPREL16 when non-pic too.
9         (dec_dynrel_count): Adjust TPREL16 handling as per check_relocs.
10         (ppc64_elf_relocate_section): Support dynamic relocs for TPREL16
11         when non-pic too.
12
13 2017-08-25  H.J. Lu  <hongjiu.lu@intel.com>
14
15         * elf32-i386.c (elf_i386_link_hash_entry): Remove redundant
16         "symbol" in comments.
17         * elf64-x86-64.c (elf_x86_64_link_hash_entry): Likewise.
18
19 2017-08-24  H.J. Lu  <hongjiu.lu@intel.com>
20
21         PR ld/22001
22         * elf64-x86-64.c (elf_x86_64_relocate_section): Check for
23         R_X86_64_PC32 relocation run-time overflow and unresolvable
24         R_X86_64_32S relocation with -z nocopyreloc.
25
26 2017-08-24  H.J. Lu  <hongjiu.lu@intel.com>
27
28         * elf32-i386.c (elf_i386_check_relocs): Revert the last change.
29         Undefined symbols may not have a type.
30         * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
31
32 2017-08-23  H.J. Lu  <hongjiu.lu@intel.com>
33
34         * elf64-x86-64.c (elf_x86_64_need_pic): Add an argument for
35         bfd_link_info.  Report shared, PIE or PDE object based on
36         bfd_link_info.
37         (elf_x86_64_check_relocs): Update elf_x86_64_need_pic call.
38         (elf_x86_64_relocate_section): Likewise.
39
40 2017-08-23  H.J. Lu  <hongjiu.lu@intel.com>
41
42         * elf32-i386.c (elf_i386_check_relocs): Increment PLT count only
43         for function symbols.
44         * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
45
46 2017-08-23  H.J. Lu  <hongjiu.lu@intel.com>
47
48         * elf32-i386.c (elf_i386_link_setup_gnu_properties): Set
49         extern_protected_data to FALSE if GNU_PROPERTY_NO_COPY_ON_PROTECTED
50         is set on any input relocatable file.
51         * elf64-x86-64.c (elf_x86_64_link_setup_gnu_properties): Likewise.
52
53 2017-08-23  Alan Modra  <amodra@gmail.com>
54
55         PR 21988
56         * elf64-ppc.c (ensure_undef_dynamic): Rename from
57         ensure_undefweak_dynamic.  Handle undefined too.
58         * elf32-ppc.c (ensure_undef_dynamic): Likewise.
59         * elf32-hppa.c (ensure_undef_dynamic): Likewise.
60         (allocate_dynrelocs): Discard undefined non-default visibility
61         relocs first.  Make undefined syms dynamic.  Tidy goto.
62
63 2017-08-21  Alan Modra  <amodra@gmail.com>
64             H.J. Lu  <hongjiu.lu@intel.com>
65
66         PR ld/21964
67         * elf-bfd.h (SYMBOLIC_BIND): Return TRUE for __start/__stop symbols.
68         * elflink.c (bfd_elf_define_start_stop): Rewrite.
69
70 2017-08-21  Hans-Peter Nilsson  <hp@bitrange.com>
71
72         PR ld/20125
73         * elf64-mmix.c (mmix_elf_relax_section): Correct handling of
74         undefined weak symbols.
75
76 2017-08-18  Nick Clifton  <nickc@redhat.com>
77
78         PR binutils/21962
79         * tekhex.c (getsym): Fix check for source pointer walking off the
80         end of the input buffer.
81
82 2017-08-17  Szabolcs Nagy  <szabolcs.nagy@arm.com>
83
84         PR ld/18808
85         * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Skip IFUNC
86         relocations in debug sections, change abort to _bfd_error_handler.
87
88 2017-08-14  Nick Clifton  <nickc@redhat.com>
89
90         PR 21957
91         * elf.c (setup_group): Check for an empty or very small group
92         section.
93         * po/bfd.pot: Regenerate.
94
95 2017-08-14  Alan Modra  <amodra@gmail.com>
96
97         PR 21441
98         * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Don't add
99         alignment padding here.
100         * elflink.c (bfd_elf_discard_info): Add .eh_frame padding here
101         in a reverse pass over sections.
102
103 2017-08-11  H.J. Lu  <hongjiu.lu@intel.com>
104
105         PR binutils/21943
106         * elf32-i386.c (elf_i386_get_synthetic_symtab): Allocate space
107         for @plt suffixes first.
108         * elf64-x86-64.c (elf_x86_64_get_synthetic_symtab): Likewise.
109
110 2017-08-08  Nick Clifton  <nickc@redhat.com>
111
112         PR 21916
113         * elf-attrs.c (_bfd_elf_parse_attributes): Complain about very
114         small section lengths.
115         * elf.c (_bfd_elf_setup_sections): Skip empty entries in the group
116         table.
117         (elfcore_grok_freebsd_prstatus): Add checks to make sure that
118         there is enough data present in the note.
119
120 2017-08-08  Alan Modra  <amodra@gmail.com>
121
122         PR 21017
123         * elf32-microblaze.c (microblaze_elf_check_relocs): Don't bump
124         got.refcount for GOTOFF relocs, just create .got section.
125
126 2017-08-07  H.J. Lu  <hongjiu.lu@intel.com>
127
128         * elflink.c (elf_link_add_object_symbols): Move common symbol
129         check after bed->common_definition.
130
131 2017-08-07  Alan Modra  <amodra@gmail.com>
132
133         PR 21910
134         * elflink.c (bfd_elf_final_link): Don't segfault when sections
135         needed to define various dynamic tags have been discarded.
136
137 2017-08-07  Nick Clifton  <nickc@redhat.com>
138
139         PR 21884
140         * elf32-i386.c (elf_i386_link_setup_gnu_properties): If the dynobj
141         has not been set then use the bfd returned by
142         _bfd_elf_link_setup_gnu_properties.  If that is null then search
143         through all the input bfds selecting the first normal, ELF format
144         one.
145         * elf64-x86-64.c (elf_x86_64_link_setup_gnu_properties): Likewise.
146
147 2017-08-06  H.J. Lu  <hongjiu.lu@intel.com>
148
149         * elf32-i386.c (elf_i386_link_hash_entry): Change tls_get_addr
150         to 1 bit.
151         (elf_i386_link_hash_newfunc): Initialize tls_get_addr to 0.
152         (elf_i386_check_tls_transition): Check tls_get_addr directly.
153         (elf_i386_convert_load_reloc): Update tls_get_addr check.
154         (elf_i386_link_check_relocs): New function.
155         (bfd_elf32_bfd_link_check_relocs): New.
156         * elf64-x86-64.c (elf_x86_64_link_hash_entry): Change tls_get_addr
157         to 1 bit.
158         (elf_x86_64_link_hash_newfunc): Initialize tls_get_addr to 0.
159         (elf_x86_64_check_tls_transition): Check tls_get_addr directly.
160         (elf_x86_64_convert_load_reloc): Update tls_get_addr check.
161         (elf_x86_64_link_check_relocs): New function.
162         (bfd_elf64_bfd_link_check_relocs): New.
163         (bfd_elf32_bfd_link_check_relocs): Likewise.
164
165 2017-08-06  H.J. Lu  <hongjiu.lu@intel.com>
166
167         PR ld/21903:
168         * elflink.c (elf_link_add_object_symbols): Treat common symbol
169         as undefined for --no-define-common.
170
171 2017-08-05  Alan Modra  <amodra@gmail.com>
172
173         * elf32-hppa.c (elf32_hppa_set_gp): Don't require an
174         hppa_link_hash_table.
175
176 2017-08-02  Max Filippov  <jcmvbkbc@gmail.com>
177
178         * xtensa-isa.c (xtensa_isa_init): Don't update lookup table
179         entries for sysregs with negative indices.
180
181 2017-08-01  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
182
183         * elf32-s390.c (elf_s390_finish_dynamic_sections): Skip if it
184         isn't the S/390 specific elf data.
185         * elf64-s390.c (elf_s390_finish_dynamic_sections): Likewise.
186
187 2017-07-31  Kuan-Lin Chen  <rufus@andestech.com>
188
189         * elfxx-riscv.c (riscv_elf_add_sub_reloc): New function.
190         * (howto_table) [R_RISCV_ADD8]: Use riscv_elf_add_sub_reloc.
191         [R_RISCV_ADD16]: Likewise.
192         [R_RISCV_ADD32]: Likewise.
193         [R_RISCV_ADD64]: Likewise.
194         [R_RISCV_SUB6]: Likewise.
195         [R_RISCV_SUB8]: Likewise.
196         [R_RISCV_SUB16]: Likewise.
197         [R_RISCV_SUB32]: Likewise.
198         [R_RISCV_SUB64]: Likewise.
199
200 2017-07-31  Alan Modra  <amodra@gmail.com>
201
202         * elf64-ppc.c (ppc64_elf_tls_setup): Warn on --plt-localentry
203         without ld.so checks.
204
205 2017-07-29  Alan Modra  <amodra@gmail.com>
206
207         PR 21847
208         * elf64-ppc.c (struct ppc_link_hash_entry): Add non_zero_localentry.
209         (ppc64_elf_merge_symbol): Set non_zero_localentry.
210         (is_elfv2_localentry0): Test non_zero_localentry.
211         (ppc64_elf_tls_setup): Default to --no-plt-localentry.
212
213 2017-07-28  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
214
215         * elf32-s390.c (elf_s390_finish_dynamic_sections): Add NULL
216         pointer check for htab->elf.irelplt.
217         * elf64-s390.c (elf_s390_finish_dynamic_sections): Likewise.
218
219 2017-07-27  Nick Clifton  <nickc@redhat.com>
220
221         PR 21840
222         * mach-o.c (bfd_mach_o_read_symtab_strtab): Fail if the symtab
223         size is -1.
224         * nlmcode.h (nlm_swap_auxiliary_headers_in): Replace assertion
225         with error return.
226         * section.c (bfd_make_section_with_flags): Fail if the name or bfd
227         are NULL.
228         * vms-alpha.c (bfd_make_section_with_flags): Correct computation
229         of end pointer.
230         (evax_bfd_print_emh): Check for invalid string lengths.
231
232 2017-07-25  Nick Clifton  <nickc@redhat.com>
233
234         * po/fr.po: Updated French translation.
235
236 2017-07-25  Benjamin Green  <bengreen5mx@gmail.com>
237
238         PR 21824
239         * elf32-msp430.c (msp430_elf_relax_section): Allow conversion of
240         16-bit absolute branches into 10-bit pc-relative branches on the
241         MSP430 as well as the MSP430X.
242
243 2017-07-25  Alan Modra  <amodra@gmail.com>
244
245         * elf64-ppc.c (struct map_stub): Add tls_get_addr_opt_bctrl.
246         (stub_eh_frame_size): New function.
247         (ppc_size_one_stub): Set group tls_get_addr_opt_bctrl.
248         (group_sections): Init group tls_get_addr_opt_bctrl.
249         (ppc64_elf_size_stubs): Update sizing and initialization of
250         .eh_frame.  Iteration over stubs via group list.
251         (ppc64_elf_build_stubs): Iterate over stubs via group list.
252         (ppc64_elf_finish_dynamic_sections): Update finalization of
253         .eh_frame.
254
255 2017-07-24  Nick Clifton  <nickc@redhat.com>
256
257         PR 21813
258         * mach-o.c (bfd_mach_o_canonicalize_relocs): Pass the base address
259         of the relocs to the canonicalize_one_reloc routine.
260         * mach-o.h (struct bfd_mach_o_backend_data): Update the prototype
261         for the _bfd_mach_o_canonicalize_one_reloc field.
262         * mach-o-arm.c (bfd_mach_o_arm_canonicalize_one_reloc): Add
263         res_base parameter.  Use to check for corrupt pair relocs.
264         * mach-o-aarch64.c (bfd_mach_o_arm64_canonicalize_one_reloc):
265         Likewise.
266         * mach-o-i386.c (bfd_mach_o_i386_canonicalize_one_reloc):
267         Likewise.
268         * mach-o-x86-64.c (bfd_mach_o_x86_64_canonicalize_one_reloc):
269         Likewise.
270
271         * vms-alpha.c (_bfd_vms_slurp_eihd): Make sure that there is
272         enough data in the record before attempting to parse it.
273         (_bfd_vms_slurp_eeom): Likewise.
274
275         (_bfd_vms_slurp_egsd): Check for an invalid section index.
276         (image_set_ptr): Likewise.
277         (alpha_vms_slurp_relocs): Likewise.
278
279         (alpha_vms_object_p): Check for a truncated record.
280
281 2017-07-24  Nick Clifton  <nickc@redhat.com>
282
283         PR 21803
284         * reloc.c (_bfd_unrecognized_reloc): New function.  Reports
285         an unrecognized reloc and sets the bfd_error value.
286         * libbfd.h: Regenerate.
287         * elf32-arm.c (elf32_arm_final_link_relocate): Use the new
288         function.
289         * elf32-i386.c (elf_i386_relocate_section): Likewise.
290         * elf32-tilepro.c (tilepro_elf_relocate_section): Likewise.
291         * elf64-x86-64.c (elf_x86_64_relocate_section): Likewise.
292         * elfnn-aarch64.c (elfNN_aarch64_relocate_section): Likewise.
293         * elfxx-tilegx.c (tilegx_elf_relocate_section): Likewise.
294
295 2017-07-23  Alan Modra  <amodra@gmail.com>
296
297         * elf64-ppc.c (ppc64_elf_size_stubs): Correct advance to
298         restore of LR.
299
300 2017-07-19  Szabolcs Nagy  <szabolcs.nagy@arm.com>
301
302         PR ld/18841
303         * elfnn-aarch64.c (elfNN_aarch64_reloc_type_class): Return
304         reloc_class_ifunc for ifunc symbols.
305
306 2017-07-19  Nick Clifton  <nickc@redhat.com>
307
308         PR 21787
309         * archive.c (bfd_generic_archive_p): If the bfd does not have the
310         correct magic bytes at the start, set the error to wrong format
311         and clear the format selector before returning NULL.
312
313 2017-07-19  Nick Clifton  <nickc@redhat.com>
314
315         PR 21786
316         * coff-rs6000.c (_bfd_strntol): New function.
317         (_bfd_strntoll): New function.
318         (GET_VALUE_IN_FIELD): New macro.
319         (EQ_VALUE_IN_FIELD): new macro.
320         (_bfd_xcoff_slurp_armap): Use new macros.
321         (_bfd_xcoff_archive_p): Likewise.
322         (_bfd_xcoff_read_ar_hdr): Likewise.
323         (_bfd_xcoff_openr_next_archived_file): Likewise.
324         (_bfd_xcoff_stat_arch_elt): Likewise.
325         * coff64-rs6000.c (_bfd_strntol): New function.
326         (_bfd_strntoll): New function.
327         (GET_VALUE_IN_FIELD): New macro.
328         (xcoff64_slurp_armap): Use new macros.
329
330 2017-07-19  Claudiu Zissulescu  <claziss@synopsys.com>
331             John Eric Martin  <John.Martin@emmicro-us.com>
332
333         * bfd-in2.h: Regenerate.
334         * libbfd.h: Regenerate.
335         * elf32-arc.c (JLI): Define.
336         * reloc.c: Add JLI relocations.
337
338 2017-07-18  Nick Clifton  <nickc@redhat.com>
339
340         PR 21775
341         * coff-sh.c: Fix spelling typos.
342         * compress.c: Likewise.
343         * cpu-pdp11.c: Likewise.
344         * ecofflink.c: Likewise.
345         * elf-m10300.c: Likewise.
346         * elf.c: Likewise.
347         * elf32-arm.c: Likewise.
348         * elf32-m68k.c: Likewise.
349         * elf32-nds32.c: Likewise.
350         * elf32-ppc.c: Likewise.
351         * elf32-sh.c: Likewise.
352         * elf32-v850.c: Likewise.
353         * elf64-ppc.c: Likewise.
354         * elf64-x86-64.c: Likewise.
355         * elflink.c: Likewise.
356         * elfnn-aarch64.c: Likewise.
357         * elfxx-mips.c: Likewise.
358         * som.c: Likewise.
359         * sunos.c: Likewise.
360         * vms-alpha.c: Likewise.
361         * xcofflink.c: Likewise.
362
363 2017-07-18  Nick Clifton  <nickc@redhat.com>
364
365         PR binutils/21781
366         * coffcode.h (handle_COMDAT): Replace abort with an error message
367         and return.
368
369 2017-07-17  H.J. Lu  <hongjiu.lu@intel.com>
370
371         PR ld/21782
372         * elf64-x86-64.c (elf_x86_64_relocate_section): Limit PIC check
373         to shared library.
374
375 2017-07-17  H.J. Lu  <hongjiu.lu@intel.com>
376
377         * elf64-x86-64.c (elf_x86_64_relocate_section): Re-indent.
378
379 2017-07-16  Alan Modra  <amodra@gmail.com>
380
381         * elf64-ppc.c (ppc64_elf_relocate_section): Don't optimize
382         __tls_index GOT entries when using __tls_get_addr_opt stub.
383         * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
384
385 2017-07-12  Alan Modra  <amodra@gmail.com>
386
387         * po/es.po: Update from translationproject.org/latest/bfd/.
388         * po/fi.po: Likewise.
389         * po/fr.po: Likewise.
390         * po/id.po: Likewise.
391         * po/ja.po: Likewise.
392         * po/ro.po: Likewise.
393         * po/ru.po: Likewise.
394         * po/sr.po: Likewise.
395         * po/sv.po: Likewise.
396         * po/tr.po: Likewise.
397         * po/uk.po: Likewise.
398         * po/vi.po: Likewise.
399         * po/zh_CN.po: Likewise.
400         * po/hr.po: New file from translationproject.org.
401         * configure.ac (ALL_LINGUAS): Add hr.  Sort.
402         * configure: Regenerate.
403
404 2017-07-12  Nick Clifton  <nickc@redhat.com>
405
406         Fix compile time warnings using gcc 7.1.1.
407         * elf32-xtensa.c (elf_xtensa_get_plt_section): Increase length of
408         plt_name buffer.
409         (elf_xtensa_get_gotplt_section): Increase length of got_name
410         buffer.
411         * mach-o-arm.c (bfd_mach_o_arm_canonicalize_one_reloc): Add a
412         default return of FALSE.
413         * mach-o-i386.c (bfd_mach_o_i386_canonicalize_one_reloc): Add a
414         default return of FALSE.
415
416 2017-07-12  Alan Modra  <amodra@gmail.com>
417
418         * binary.c (binary_set_section_contents): Don't print filepos in
419         error message.
420         (coff_write_object_contents): Cast size_t for error message.
421         (coff_slurp_line_table): Don't use bfd_vma symndx.
422         (coff_slurp_reloc_table): Remove unneeded cast.
423         * dwarf2.c (read_section): Cast bfd_int64_t to long long for
424         error message.
425         (find_abstract_instance_name): Likewise.
426         * elf32-arm.c (arm_type_of_stub): Correct error arg order.
427         (bfd_elf32_arm_stm32l4xx_erratum_scan): Don't cast error arg.
428         (elf32_arm_check_relocs): Make r_symndx an int.
429         * elf32-cris.c (cris_elf_check_relocs): Delete extraneous %s in
430         format string.
431         * elf32-metag.c (elf_metag_relocate_section): Delete extra error
432         message arg.
433         * elf32-nds32.c (nds32_elf_ex9_build_hash_table): Rewrite bogus
434         error message.
435         * elf32-i386.c (elf_i386_check_relocs): Make r_symndx an int.
436         * elf32-s390.c (elf_s390_check_relocs): Likewise.
437         * elf32-tic6x.c (elf32_tic6x_check_relocs): Likewise.
438         * elf32-tilepro.c (tilepro_elf_check_relocs): Likewise.
439         * elf32-xtensa.c (elf_xtensa_check_relocs): Likewise.
440         * elf64-s390.c (elf_s390_check_relocs): Likewise.
441         * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
442         * elfnn-aarch64.c (elfNN_aarch64_check_relocs): Likewise.
443         * elfnn-riscv.c (riscv_elf_check_relocs): Likewise.
444         * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Likewise.
445         * elfxx-tilegx.c (tilegx_elf_check_relocs): Likewise.
446         * elf64-mmix.c (_bfd_mmix_after_linker_allocation): Cast size_t args
447         and use %lu for error message.
448         * elflink.c (elf_link_adjust_relocs): Delete extra error message arg.
449         * mmo.c (mmo_scan): Make stab_loc a file_ptr.  Cast expression for
450         error message.
451
452         * elf32-arm.c (elf32_arm_tls_relax): Correct format string and args
453         in error message.
454         (elf32_arm_final_link_relocate): Likewise.
455         * coff-arm.c (bfd_arm_process_before_allocation): Likewise.
456         * coffcode.h (styp_to_sec_flags): Likewise.
457         * cofflink.c (_bfd_coff_write_global_sym): Likewise.
458         * ecoff.c (_bfd_ecoff_slurp_symbol_table): Likewise.
459         * elf32-arc.c (arc_elf_merge_private_bfd_data): Likewise.
460         * elf32-bfin.c (bfinfdpic_check_relocs): Likewise.
461         (elf32_bfin_merge_private_bfd_data): Likewise.
462         * elf32-cris.c (cris_elf_relocate_section): Likewise.
463         * elf32-frv.c (frv_elf_merge_private_bfd_data): Likewise.
464         * elf32-i370.c (i370_elf_merge_private_bfd_data): Likewise.
465         (i370_elf_relocate_section): Likewise.
466         * elf32-iq2000.c (iq2000_elf_merge_private_bfd_data): Likewise.
467         * elf32-m32c.c (m32c_elf_merge_private_bfd_data): Likewise.
468         * elf32-m68hc1x.c (_bfd_m68hc11_elf_merge_private_bfd_data): Likewise.
469         * elf32-mcore.c (mcore_elf_relocate_section): Likewise.
470         * elf32-mep.c (mep_elf_merge_private_bfd_data): Likewise.
471         * elf32-mt.c (mt_elf_merge_private_bfd_data): Likewise.
472         * elf64-sparc.c (elf64_sparc_merge_private_bfd_data): Likewise.
473         * elfxx-mips.c (mips_elf_merge_obj_e_flags): Likewise.
474         (_bfd_mips_elf_merge_private_bfd_data): Likewise.
475         * ieee.c (ieee_write_id, read_id): Likewise.
476         * mach-o.c (bfd_mach_o_write_contents): Likewise.
477         (bfd_mach_o_layout_commands, bfd_mach_o_read_section_32): Likewise.
478         (bfd_mach_o_read_section_64, bfd_mach_o_read_symtab_symbol): Likewise.
479         (bfd_mach_o_read_command, bfd_mach_o_header_p): Likewise.
480         * peXXigen.c (_bfd_XXi_swap_aouthdr_in): Likewise.
481         * stabs.c (_bfd_link_section_stabs): Likewise.
482
483         * coff-arm.c (coff_arm_relocate_section): Use L modifier in error
484         format.
485         * coff-mcore.c (coff_mcore_relocate_section): Likewise.
486         * coff-ppc.c (coff_ppc_relocate_section): Likewise.
487         * coff-rs6000.c (xcoff_reloc_type_toc): Likewise.
488         * coff-sh.c (sh_relax_section): Likewise.
489         (sh_relax_delete_bytes, sh_swap_insns): Likewise.
490         * coff-tic80.c (coff_tic80_relocate_section): Likewise.
491         * coffcode.h (coff_slurp_reloc_table): Likewise.
492         * coffgen.c (_bfd_coff_get_external_symbols): Likewise.
493         (_bfd_coff_read_string_table): Likewise.
494         * cofflink.c (_bfd_coff_generic_relocate_section): Likewise.
495         * compress.c (bfd_get_full_section_contents): Likewise.
496         * dwarf2.c (read_formatted_entries, decode_line_info): Likewise.
497         * elf-m10300.c (mn10300_elf_relocate_section): Likewise.
498         * elf.c (bfd_elf_string_from_elf_section): Likewise.
499         * elf32-arc.c (arc_special_overflow_checks): Likewise.
500         * elf32-arm.c (elf32_arm_tls_relax): Likewise.
501         (elf32_arm_final_link_relocate, elf32_arm_relocate_section): Likewise.
502         (elf32_arm_write_section): Likewise.
503         * elf32-bfin.c (bfin_relocate_section): Likewise.
504         (bfinfdpic_relocate_section): Likewise.
505         * elf32-hppa.c (hppa_build_one_stub): Likewise.
506         (final_link_relocate, elf32_hppa_relocate_section): Likewise.
507         * elf32-i386.c (elf_i386_tls_transition): Likewise.
508         (elf_i386_relocate_section): Likewise.
509         * elf32-ip2k.c (ip2k_final_link_relocate): Likewise.
510         * elf32-lm32.c (lm32_elf_finish_dynamic_sections): Likewise.
511         * elf32-m32r.c (m32r_elf_relocate_section): Likewise.
512         * elf32-m68k.c (elf_m68k_relocate_section): Likewise.
513         * elf32-metag.c (elf_metag_relocate_section): Likewise.
514         * elf32-nds32.c (unrecognized_reloc_msg): Likewise.
515         (nds32_elf_relax_longcall1, nds32_elf_relax_longcall2): Likewise.
516         (nds32_elf_relax_longcall3, nds32_elf_relax_longjump1): Likewise.
517         (nds32_elf_relax_longjump2, nds32_elf_relax_longjump3): Likewise.
518         (nds32_elf_relax_longcall4, nds32_elf_relax_longcall5): Likewise.
519         (nds32_elf_relax_longcall6, nds32_elf_relax_longjump4): Likewise.
520         (nds32_elf_relax_longjump5, nds32_elf_relax_longjump6): Likewise.
521         (nds32_elf_relax_longjump7, nds32_elf_relax_loadstore): Likewise.
522         (nds32_elf_relax_ptr, nds32_elf_ex9_build_hash_table): Likewise.
523         * elf32-nios2.c (nios2_elf32_relocate_section): Likewise.
524         * elf32-rx.c (UNSAFE_FOR_PID): Likewise.
525         * elf32-s390.c (invalid_tls_insn, elf_s390_relocate_section): Likewise.
526         * elf32-score.c (s3_bfd_score_elf_check_relocs): Likewise.
527         * elf32-score7.c (s7_bfd_score_elf_check_relocs): Likewise.
528         * elf32-sh.c (sh_elf_relax_section): Likewise.
529         (sh_elf_relax_delete_bytes, sh_elf_swap_insns): Likewise.
530         (sh_elf_relocate_section): Likewise.
531         * elf32-sh64.c (shmedia_prepare_reloc): Likewise.
532         * elf32-spu.c (spu_elf_relocate_section): Likewise.
533         * elf32-tic6x.c (elf32_tic6x_relocate_section): Likewise.
534         * elf32-tilepro.c (tilepro_elf_relocate_section): Likewise.
535         * elf32-v850.c (v850_elf_relax_section): Likewise.
536         * elf32-vax.c (elf_vax_check_relocs): Likewise.
537         (elf_vax_relocate_section): Likewise.
538         * elf32-xtensa.c (elf_xtensa_relocate_section): Likewise.
539         (extend_ebb_bounds_forward, extend_ebb_bounds_backward): Likewise.
540         (compute_text_actions, compute_ebb_proposed_actions): Likewise.
541         (do_fix_for_relocatable_link): Likewise.
542         * elf64-alpha.c (elf64_alpha_relax_got_load): Likewise.
543         (elf64_alpha_relax_with_lituse): Likewise.
544         * elf64-hppa.c (elf64_hppa_finish_dynamic_symbol): Likewise.
545         (elf_hppa_final_link_relocate): Likewise.
546         * elf64-ia64-vms.c (elf64_ia64_relax_section): Likewise.
547         (elf64_ia64_choose_gp, elf64_ia64_relocate_section): Likewise.
548         (elf64_vms_link_add_object_symbols): Likewise.
549         * elf64-mmix.c (mmix_elf_perform_relocation): Likewise.
550         (mmix_final_link_relocate): Likewise.
551         * elf64-s390.c (invalid_tls_insn): Likewise.
552         (elf_s390_relocate_section): Likewise.
553         * elf64-sh64.c (sh_elf64_relocate_section): Likewise.
554         * elf64-x86-64.c (elf_x86_64_tls_transition): Likewise.
555         (elf_x86_64_relocate_section): Likewise.
556         * elfcode.h (elf_slurp_symbol_table): Likewise.
557         * elfcore.h (elf_core_file_p): Likewise.
558         * elflink.c (elf_link_read_relocs_from_section): Likewise.
559         * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Likewise.
560         (elfNN_aarch64_relocate_section): Likewise.
561         * elfnn-ia64.c (elfNN_ia64_relax_section): Likewise.
562         (elfNN_ia64_choose_gp, elfNN_ia64_relocate_section): Likewise.
563         * elfnn-riscv.c (riscv_elf_relocate_section): Likewise.
564         * elfxx-mips.c (_bfd_mips_elf_check_relocs): Likewise.
565         (_bfd_mips_elf_relocate_section): Likewise.
566         (_bfd_mips_elf_finish_dynamic_symbol, mips_finish_exec_plt): Likewise.
567         * elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Likewise.
568         * elfxx-tilegx.c (tilegx_elf_relocate_section): Likewise.
569         * ieee.c (ieee_slurp_external_symbols): Likewise.
570         * ihex.c (ihex_write_object_content): Likewise.
571         * mach-o.c (bfd_mach_o_build_exec_seg_command): Likewise.
572         * merge.c (_bfd_merged_section_offset): Likewise.
573         * mmo.c (mmo_write_loc_chunk): Likewise.
574         (mmo_write_object_contents): Likewise.
575         * peXXigen.c (_bfd_XX_bfd_copy_private_bfd_data_common): Likewise.
576         * stabs.c (_bfd_link_section_stabs): Likewise.
577         * xcofflink.c (xcoff_link_add_symbols, xcoff_find_tc0): Likewise.
578
579 2017-07-11  Alan Modra  <amodra@gmail.com>
580
581         * elf32-ppc.c (ppc_elf_relocate_section): Fix typo.
582
583 2017-07-11  Alan Modra  <amodra@gmail.com>
584
585         * elf32-ppc.c (ppc_elf_relocate_section): Emit "unexpected
586         instruction" error using _bfd_error_handler, not einfo.
587
588 2017-07-10  Nick Clifton  <nickc@redhat.com>
589
590         * coffcode.h (coff_slurp_symbol_table): Do not include an entry
591         for C_AIX_WEAKEXT if it has the same value as C_WEAKEXT.
592
593 2017-07-07  John Baldwin  <jhb@FreeBSD.org>
594
595         * elf.c (elfcore_grok_freebsd_note): Handle NT_FREEBSD_PTLWPINFO.
596
597 2017-07-07  Alan Modra  <amodra@gmail.com>
598
599         * coffcode.h (coff_slurp_symbol_table): Handle C_AIX_WEAKEXT.
600
601 2017-07-07  Alan Modra  <amodra@gmail.com>
602
603         * bfd.c (_doprnt): Replace "L" with "ll" when printing bfd_vma
604         as long long.  Move code replacing "ll" with "I64", and simplify.
605
606 2017-07-06  H.J. Lu  <hongjiu.lu@intel.com>
607
608         * bfd.c (_doprnt): Convert 'L' to 'l' when setting wide_width
609         to 1.
610
611 2017-07-05  H.J. Lu  <hongjiu.lu@intel.com>
612
613         * dwarf2.c (line_info_add_include_dir_stub): Replace time with
614         xtime.
615         (line_info_add_file_name): Likewise.
616         (decode_line_info): Likewise.
617
618 2017-07-04  Tristan Gingold  <gingold@adacore.com>
619
620         * version.m4: Bump version to 2.29.51
621         * configure: Regenerate.
622
623 2017-07-04  Jiong Wang  <jiong.wang@arm.com>
624
625         * elfnn-aarch64.c (elfNN_aarch64_finish_dynamic_symbol): Remove the
626         sanity check at the head of this function.
627
628 2017-07-04  Jan Kratochvil  <jan.kratochvil@redhat.com>
629
630         * dwarf2.c (struct dwarf2_debug): Add fields dwarf_line_str_buffer and
631         dwarf_line_str_size.
632         (struct attr_abbrev): Add field implicit_const.
633         (dwarf_debug_sections): Add .debug_line_str.
634         (enum dwarf_debug_section_enum): Add debug_line_str and debug_max.
635         (dwarf_debug_section_assert): Add static assertion.
636         (read_indirect_line_string): New.
637         (read_abbrevs): Support DW_FORM_implicit_const.
638         (is_str_attr): Support DW_FORM_line_strp.
639         (read_attribute_value): Support DW_FORM_line_strp and
640         DW_FORM_implicit_const.
641         (read_attribute): Support DW_FORM_implicit_const.
642         (line_info_add_include_dir, line_info_add_include_dir_stub):
643         (line_info_add_file_name, read_formatted_entries): New.
644         (decode_line_info, parse_comp_unit): Support DWARF 5.
645         (_bfd_dwarf2_cleanup_debug_info): Free dwarf_line_str_buffer.
646
647 2017-07-03  Egeyar Bagcioglu  <egeyar.bagcioglu@oracle.com>
648
649         * elfxx-sparc.c (_bfd_sparc_elf_finish_dynamic_symbol): Remove the
650         abort statement that was put for symbols that are not dynamic.
651
652 2017-07-03  Tristan Gingold  <gingold@adacore.com>
653
654         * po/bfd.pot: Regenerate
655
656 2017-07-03  Alan Modra  <amodra@gmail.com>
657
658         * bfd.c (_doprnt): Rewrite "ll" and "L" modifiers to "I64" for
659         __MSVCRT__.  Support "L" modifier for bfd_vma.  Formatting.
660         * elf.c (setup_group): Use "Lx" to print sh_size.
661         (_bfd_elf_setup_sections): Remove unnecessary cast and print
662         unknown section type in hex.
663         (copy_special_section_fields): Style fix.
664         (bfd_section_from_shdr): Correct format for sh_link.  Use a
665         common error message for all the variants of unrecognized
666         section types.
667         (assign_file_positions_for_load_sections): Use "Lx" for lma
668         adjust error message.
669         (assign_file_positions_for_non_load_sections): Formatting.
670         (rewrite_elf_program_header): Formatting.  Use "Lx" for
671         bfd_vma values in error messages.
672         * elfcode.h (elf_slurp_reloc_table_from_section): Cast
673         ELF_R_SYM value to type expected by format.
674         * elflink.c (elf_link_read_relocs_from_section): Use "Lx"
675         in error messages.
676         (elf_link_add_object_symbols): Use "Lu" for symbol sizes.
677         (elf_link_input_bfd): Use "Lx" for r_info.
678         (bfd_elf_gc_record_vtinherit): Use "Lx" for offset.
679
680 2017-07-03  Alan Modra  <amodra@gmail.com>
681
682         * bfd.c (bfd_scan_vma): Don't use long long unless HAVE_LONG_LONG.
683         * coff-rs6000.c (FMT20): Handle hosts with 64-bit long and
684         Microsoft C library variant of long long format specifier.
685         (PRINT20): Cast value to bfd_uint64_t not long long.
686         * coffcode.h (coff_print_aux): Use BFD_VMA_FMT.
687         * coff-x86_64.c (coff_amd64_reloc): Use bfd_uint64_t rather than
688         long long.  Don't cast to bfd_vma.
689         * elf32-score.c (score3_bfd_getl48): Likewise.
690         * vms-alpha.c (_bfd_vms_slurp_eisd): Likewise.
691
692 2017-07-03  Alan Modra  <amodra@gmail.com>
693
694         * elf.c (_bfd_elf_print_private_bfd_data): Use BFD_VMA_FMT to
695         print d_tag.
696         (bfd_elf_print_symbol): Don't cast symbol->flags.
697         (_bfd_elf_symbol_from_bfd_symbol): Likewise.
698         * elf32-ppc.c (ppc_elf_begin_write_processing): Correct
699         _bfd_error_handler argument order.
700         (ppc_elf_merge_private_bfd_data): Don't cast flags.
701
702 2017-07-03  Alan Modra  <amodra@gmail.com>
703
704         * configure.ac: Invoke AC_CHECK_TYPES for long long.  Invoke
705         AC_TYPE_LONG_DOUBLE.
706         * configure: Regenerate.
707         * config.in: Regenerate.
708
709 2017-06-29  Andrew Waterman  <andrew@sifive.com>
710
711         * elfnn-riscv.c (riscv_elf_adjust_dynamic_symbol): Fix TLS copy
712         relocs.
713
714 2017-06-29  Egeyar Bagcioglu  <egeyar.bagcioglu@oracle.com>
715
716         * elfxx-sparc.c (allocate_dynrelocs): Don't make a symbol dynamic
717         unless it is undefined weak.
718         * elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Set the flag
719         relative_reloc to direct non-dynamic symbols to R_SPARC_RELATIVE
720         relocation.
721         * elfxx-sparc.c (_bfd_sparc_elf_finish_dynamic_symbol): If symbol
722         is not dynamic in PIC, abort.
723
724 2017-06-29  Jiong Wang  <jiong.wang@arm.com>
725
726         PR ld/21402
727         * elfnn-aarch64.c (elfNN_aarch64_allocate_dynrelocs): Only make
728         undefined weak symbols into dynamic.
729         (elfNN_aarch64_final_link_relocate): Generate runtime RELATIVE
730         relocation for non-dynamic symbols.
731         (elfNN_aarch64_finish_dynamic_symbol): Add sanity check.
732
733 2017-06-29  Jiong Wang  <jiong.wang@arm.com>
734
735         * elfnn-aarch64.c (aarch64_relocation_aginst_gp_p): New function.
736         (elfNN_aarch64_final_link_relocate): Delete duplicated code for
737         BFD_RELOC_AARCH64_LD64_GOTOFF_LO15, BFD_RELOC_AARCH64_MOVW_GOTOFF_G0_NC,
738         BFD_RELOC_AARCH64_MOVW_GOTOFF_G1.
739         * elfxx-aarch64.c (_bfd_aarch64_elf_resolve_relocation): Optimize the
740         support for them.
741
742 2017-06-29  Andreas Arnez  <arnez@linux.vnet.ibm.com>
743
744         * elf-bfd.h (elfcore_write_s390_gs_cb): Add prototype.
745         (elfcore_write_s390_gs_bc): Likewise.
746         * elf.c (elfcore_grok_s390_gs_cb): New function.
747         (elfcore_grok_s390_gs_bc): New function.
748         (elfcore_grok_note): Call them.
749         (elfcore_write_s390_gs_cb): New function.
750         (elfcore_write_s390_gs_bc): New function.
751         (elfcore_write_register_note): Call them.
752
753 2017-06-28  H.J. Lu  <hongjiu.lu@intel.com>
754
755         * libbfd.c (_bfd_generic_get_section_contents): Don't call
756         bfd_get_file_size.  Check archive element size.
757         (_bfd_generic_get_section_contents_in_window): Likewise.
758
759 2017-06-28  H.J. Lu  <hongjiu.lu@intel.com>
760
761         * bfd-in2.h: Regenerated.
762         * bfdio.c (bfd_get_size): Change return type to ufile_ptr.
763         (bfd_get_file_size): Likewise.
764
765 2017-06-28  Maciej W. Rozycki  <macro@imgtec.com>
766             Matthew Fortune  <matthew.fortune@imgtec.com>
767
768         * archures.c (bfd_mach_mips_interaptiv_mr2): New macro.
769         * cpu-mips.c (I_interaptiv_mr2): New enum value.
770         (arch_info_struct): Add "mips:interaptiv-mr2" entry.
771         * elfxx-mips.c (_bfd_elf_mips_mach) <E_MIPS_MACH_IAMR2>: New
772         case.
773         (mips_set_isa_flags) <bfd_mach_mips_interaptiv_mr2>: Likewise.
774         (bfd_mips_isa_ext) <bfd_mach_mips_interaptiv_mr2>: Likewise.
775         (print_mips_isa_ext) <AFL_EXT_INTERAPTIV_MR2>: Likewise.
776         (mips_mach_extensions): Add `bfd_mach_mipsisa32r3' and
777         `bfd_mach_mips_interaptiv_mr2' entries.
778         * bfd-in2.h: Regenerate.
779
780 2017-06-27  Nick Clifton  <nickc@redhat.com>
781
782         * tekhex.c (pass_over): Revert accidental conversion of a local
783         array to a static array.
784
785 2017-06-27  Senthil Kumar Selvaraj  <senthil_kumar.selvaraj@atmel.com>
786
787         PR ld/13402
788         * elf32-avr.c (elf32_avr_adjust_diff_reloc_value): Adjust
789         reloc addend if necessary. Adjust diff only if
790         shrinked_insn_address < end_address.
791
792 2017-06-27  Alan Modra  <amodra@gmail.com>
793
794         PR binutils/21665
795         * libbfd.c (_bfd_generic_get_section_contents): Warning fix.
796         (_bfd_generic_get_section_contents_in_window): Likewise.
797
798 2017-06-26  Kuan-Lin Chen  <rufus@andestech.com>
799
800         * elfnn-riscv.c (perform_relocation): Support the new
801         R_RISCV_32_PCREL relocation.
802         (riscv_elf_relocate_section): Likewise.
803         * elfxx-riscv.c (howto_table): Likewise.
804         (riscv_reloc_map): Likewise.
805         * bfd-in2.h (BFD_RELOC_RISCV_32_PCREL): New relocation.
806         * libbfd.h: Regenerate.
807
808 2017-06-27  Alan Modra  <amodra@gmail.com>
809
810         PR binutils/21665
811         * libbfd.c (_bfd_generic_get_section_contents): Delete abort.
812         Use unsigned file pointer type, and remove cast.
813         * libbfd.c (_bfd_generic_get_section_contents_in_window): Likewise.
814         Add "count", not "sz".
815
816 2017-06-26  Pedro Alves  <palves@redhat.com>
817
818         PR binutils/21665
819         * libbfd.c (_bfd_generic_get_section_contents): Add "count", not
820         "sz".
821
822 2017-06-26  H.J. Lu  <hongjiu.lu@intel.com>
823
824         PR binutils/21665
825         * libbfd.c (_bfd_generic_get_section_contents_in_window): Add
826         a missing line.
827
828 2017-06-26  Maciej W. Rozycki  <macro@imgtec.com>
829
830         * cpu-mips.c (arch_info_struct): Mark the 4010 32-bit.
831         * elfxx-mips.c (mips_set_isa_flags) <bfd_mach_mips4010>: Set
832         E_MIPS_ARCH_2 rather than E_MIPS_ARCH_3 in `e_flags'.
833         (mips_mach_extensions): Mark `bfd_mach_mips4010' as extending
834         `bfd_mach_mips6000' rather than `bfd_mach_mips4000'.
835
836 2017-06-26  H.J. Lu  <hongjiu.lu@intel.com>
837
838         PR binutils/21665
839         * compress.c (bfd_get_full_section_contents): Don't check the
840         file size here.
841         * libbfd.c (_bfd_generic_get_section_contents): Check for and
842         reject a section whose size + offset is greater than the size
843         of the entire file.
844         (_bfd_generic_get_section_contents_in_window): Likewise.
845
846 2017-06-26  Nick Clifton  <nickc@redhat.com>
847
848         PR binutils/21670
849         * tekhex.c (getvalue): Check for the source pointer exceeding the
850         end pointer before the first byte is read.
851
852 2017-06-26  Nick Clifton  <nickc@redhat.com>
853
854         PR binutils/21665
855         * opncls.c (get_build_id): Check that the section is big enough
856         to contain the whole note.
857         * compress.c (bfd_get_full_section_contents): Check for and reject
858         a section whose size is greater than the size of the entire file.
859         * elf32-v850.c (v850_elf_copy_notes): Allow for the ouput to not
860         contain a notes section.
861
862 2017-06-26  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
863
864         * elf64-s390.c (elf_s390_additional_program_headers): Add NULL
865         pointer checks.
866         (elf_s390_modify_segment_map): Likewise.
867         (bfd_elf_s390_set_options): Lisewise.
868
869 2017-06-26  Alan Modra  <amodra@gmail.com>
870
871         * elflink.c (_bfd_elf_link_create_dynstrtab): Don't make dynobj
872         a --just-syms bfd.
873         (_bfd_elf_size_group_sections): Skip --just-syms bfds.
874         (bfd_elf_size_dynamic_sections): Ignore .note.GNU-stack and
875         .preinit_array on --just-syms bfds.
876         (_bfd_elf_gc_mark_extra_sections): Skip --just-syms bfds.
877         (elf_gc_sweep, bfd_elf_parse_eh_frame_entries): Likewise.
878         (bfd_elf_gc_sections, bfd_elf_discard_info): Likewise.
879
880 2017-06-25  Sergei Trofimovich  <slyfox@gentoo.org>
881
882         * elf.c (find_link): Bounds check "hint".
883
884 2017-06-24  Thomas Preud'homme  <thomas.preudhomme@arm.com>
885
886         * elf32-arm.c (using_thumb_only): Update list of architectures in
887         BFD_ASSERT for which the logic is valid.
888         (using_thumb2_bl): Likewise.
889         (using_thumb2): Likewise and return true for ARMv8-R.
890         (arch_has_arm_nop): Likewise.
891         (tag_cpu_arch_combine): New v8r table for ARMv8-R Tag_CPU_arch
892         merging logic.  Update commentis for value 15 of v8m_baseline,
893         v8m_mainline and v4t_plus_v6_m arrays.  Use v8r array to decide
894         merging of value 15 of Tag_CPU_arch.
895
896 2017-06-23  Jiong Wang  <jiong.wang@arm.com>
897
898         * reloc.c (BFD_RELOC_AARCH64_ADR_GOTPAGE): Rename to
899         BFD_RELOC_AARCH64_ADR_GOT_PAGE
900         * bfd-in2.h: Regenerate.
901
902 2017-06-22  H.J. Lu  <hongjiu.lu@intel.com>
903
904         * elf64-x86-64.c (elf_x86_64_link_setup_gnu_properties): Move
905         the error_alignment label forward.  Properly align program
906         property note section.
907
908 2017-06-22  Eric Christopher  <echristo@gmail.com>
909
910         * elf32-arm.c (elf32_arm_final_link_relocate): Use labs rather than
911         abs to fix a truncation warning.
912
913 2017-06-22  H.J. Lu  <hongjiu.lu@intel.com>
914
915         * elf32-i386.c (UNDEFINED_WEAK_RESOLVED_TO_ZERO): Resolve
916         local undefined weak symbol to 0.
917         * elf64-x86-64.c (UNDEFINED_WEAK_RESOLVED_TO_ZERO): Likewise.
918
919 2017-06-22  H.J. Lu  <hongjiu.lu@intel.com>
920
921         * elf32-i386.c (elf_i386_merge_gnu_properties): If info->shstk
922         is set, turn on GNU_PROPERTY_X86_FEATURE_1_SHSTK.
923         (elf_i386_link_setup_gnu_properties): If info->shstk is set,
924         turn on GNU_PROPERTY_X86_FEATURE_1_IBT.
925         * elf64-x86-64.c (elf_x86_64_merge_gnu_properties): If
926         info->shstk is set, turn on GNU_PROPERTY_X86_FEATURE_1_SHSTK.
927         (elf_x86_64_link_setup_gnu_properties): If info->shstk is set,
928         turn on GNU_PROPERTY_X86_FEATURE_1_IBT.
929
930 2017-06-22  H.J. Lu  <hongjiu.lu@intel.com>
931
932         * elf32-i386.c (elf_i386_lazy_ibt_plt0_entry): New.
933         (elf_i386_lazy_ibt_plt_entry): Likewise.
934         (elf_i386_pic_lazy_ibt_plt0_entry): Likewise.
935         (elf_i386_non_lazy_ibt_plt_entry): Likewise.
936         (elf_i386_pic_non_lazy_ibt_plt_entry): Likewise.
937         (elf_i386_eh_frame_lazy_ibt_plt): Likewise.
938         (elf_i386_lazy_plt_layout): Likewise.
939         (elf_i386_non_lazy_plt_layout): Likewise.
940         (elf_i386_link_hash_entry): Add plt_second.
941         (elf_i386_link_hash_table): Add plt_second and
942         plt_second_eh_frame.
943         (elf_i386_allocate_dynrelocs): Use the second PLT if needed.
944         (elf_i386_size_dynamic_sections): Use .plt.got unwind info for
945         the second PLT.  Check the second PLT.
946         (elf_i386_relocate_section): Use the second PLT to resolve
947         PLT reference if needed.
948         (elf_i386_finish_dynamic_symbol): Fill and use the second PLT if
949         needed.
950         (elf_i386_finish_dynamic_sections): Set sh_entsize on the
951         second PLT.  Generate unwind info for the second PLT.
952         (elf_i386_plt_type): Add plt_second.
953         (elf_i386_get_synthetic_symtab): Support the second PLT.
954         (elf_i386_parse_gnu_properties): Support
955         GNU_PROPERTY_X86_FEATURE_1_AND.
956         (elf_i386_merge_gnu_properties): Support
957         GNU_PROPERTY_X86_FEATURE_1_AND.  If info->ibt is set, turn
958         on GNU_PROPERTY_X86_FEATURE_1_IBT
959         (elf_i386_link_setup_gnu_properties): If info->ibt is set,
960         turn on GNU_PROPERTY_X86_FEATURE_1_IBT.  Use IBT-enabled PLT
961         for info->ibtplt, info->ibt or GNU_PROPERTY_X86_FEATURE_1_IBT
962         is set on all relocatable inputs.
963         * elf64-x86-64.c (elf_x86_64_lazy_ibt_plt_entry): New.
964         (elf_x32_lazy_ibt_plt_entry): Likewise.
965         (elf_x86_64_non_lazy_ibt_plt_entry): Likewise.
966         (elf_x32_non_lazy_ibt_plt_entry): Likewise.
967         (elf_x86_64_eh_frame_lazy_ibt_plt): Likewise.
968         (elf_x32_eh_frame_lazy_ibt_plt): Likewise.
969         (elf_x86_64_lazy_ibt_plt): Likewise.
970         (elf_x32_lazy_ibt_plt): Likewise.
971         (elf_x86_64_non_lazy_ibt_plt): Likewise.
972         (elf_x32_non_lazy_ibt_plt): Likewise.
973         (elf_x86_64_get_synthetic_symtab): Support the second PLT.
974         (elf_x86_64_parse_gnu_properties): Support
975         GNU_PROPERTY_X86_FEATURE_1_AND.
976         (elf_x86_64_merge_gnu_properties): Support
977         GNU_PROPERTY_X86_FEATURE_1_AND.  If info->ibt is set, turn
978         on GNU_PROPERTY_X86_FEATURE_1_IBT
979         (elf_x86_64_link_setup_gnu_properties): If info->ibt is set,
980         turn on GNU_PROPERTY_X86_FEATURE_1_IBT.  Use IBT-enabled PLT
981         for info->ibtplt, info->ibt or GNU_PROPERTY_X86_FEATURE_1_IBT
982         is set on all relocatable inputs.
983
984 2017-06-22  Nick Clifton  <nickc@redhat.com>
985
986         PR binutils/21649
987         * som.c (setup_sections): NUL terminate the space_strings buffer.
988         Check that the space.name field does not index beyond the end of
989         the space_strings buffer.
990
991 2017-06-21  Nick Clifton  <nickc@redhat.com>
992
993         PR binutils/21646
994         * coff-sh.c (sh_reloc): Check for an out of range reloc.
995
996 2017-06-21  Nick Clifton  <nickc@redhat.com>
997
998         PR binutils/21639
999         * vms-misc.c (_bfd_vms_save_sized_string): Use unsigned int as
1000         type of the size parameter.
1001         (_bfd_vms_save_counted_string): Add second parameter - the maximum
1002         length of the counted string.
1003         * vms.h (_bfd_vms_save_sized_string): Update prototype.
1004         (_bfd_vms_save_counted_string): Likewise.
1005         * vms-alpha.c (_bfd_vms_slurp_eisd): Update calls to
1006         _bfd_vms_save_counted_string.
1007         (_bfd_vms_slurp_ehdr): Likewise.
1008         (_bfd_vms_slurp_egsd): Likewise.
1009         (Parse_module): Likewise.
1010
1011 2017-06-21  Alan Modra  <amodra@gmail.com>
1012
1013         * elf64-ppc.c (ppc64_elf_size_stubs): Test for localentry:0 plt
1014         calls before tocsave calls.
1015         (ppc64_elf_relocate_section): Allow localentry:0 plt calls without
1016         following nop.
1017
1018 2017-06-21  Nick Clifton  <nickc@redhat.com>
1019
1020         PR binutils/21645
1021         * reloc.c (bfd_generic_get_relocated_section_contents): Fail if
1022         bfd_get_full_section_contents returns no contents.
1023
1024 2017-06-21  Nick Clifton  <nickc@redhat.com>
1025
1026         PR binutils/21638
1027         * vms-alpha.c (_bfd_vms_slurp_egsd): Check for an undersized
1028         record.
1029
1030 2017-06-21  Nick Clifton  <nickc@redhat.com>
1031
1032         PR binutils/21637
1033         * vms-alpha.c (_bfd_vms_slurp_egsd): Check for an empty section
1034         list.
1035         (image_set_ptr): Likewise.
1036         (alpha_vms_fix_sec_rel): Likewise.
1037         (alpha_vms_slurp_relocs): Likewise.
1038
1039 2017-06-21  Nick Clifton  <nickc@redhat.com>
1040
1041         PR binutils/21633
1042         * ieee.c (ieee_slurp_sections): Check for a NULL return from
1043         read_id.
1044         (ieee_archive_p): Likewise.
1045         (ieee_object_p): Likewise.
1046
1047 2017-06-21  Nick Clifton  <nickc@redhat.com>
1048
1049         PR binutils/21640
1050         * elf.c (setup_group): Zero the group section pointer list after
1051         allocation so that loops can be caught.  Check for NULL pointers
1052         when processing a group list.
1053
1054 2017-06-20  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
1055
1056         * elf-s390.h: New file.
1057         * elf64-s390.c (struct elf_s390_link_hash_table): Add params
1058         field.
1059         (elf_s390_additional_program_headers): New function.
1060         (elf_s390_modify_segment_map): New function.
1061         (bfd_elf_s390_set_options): New function.
1062         (elf_backend_additional_program_headers)
1063         (elf_backend_modify_segment_map): Add macro definitions.
1064
1065 2017-06-19  H.J. Lu  <hongjiu.lu@intel.com>
1066
1067         PR ld/21626
1068         * elf-properties.c (_bfd_elf_link_setup_gnu_properties): Check
1069         the DYNAMIC bit instead of bfd_count_sections.
1070
1071 2017-06-19  Nick Clifton  <nickc@redhat.com>
1072
1073         PR binutils/21618
1074         * vms-alpha.c (evax_bfd_print_emh): Check for insufficient record
1075         length.
1076         (evax_bfd_print_eeom): Likewise.
1077         (evax_bfd_print_egsd): Check for an overlarge record length.
1078         (evax_bfd_print_etir): Likewise.
1079
1080 2017-06-19  Nick Clifton  <nickc@redhat.com>
1081
1082         PR binutils/21612
1083         * libieee.h (struct common_header_type): Add end_p field.
1084         * ieee.c (this_byte_and_next): Do not advance input_p beyond
1085         end_p.
1086         (read_id): Check for a length that exceeds the remaining bytes in
1087         the input buffer.
1088         (ieee_seek): Initialise end_p.
1089         (ieee_archive_p): Likewise.
1090         (ieee_object_p): Likewise.
1091
1092 2017-06-19  Nick Clifton  <nickc@redhat.com>
1093
1094         PR binutils/21611
1095         * vms-alpha.c (_bfd_vms_slurp_eihs): Check for invalid offset
1096         before reading the EIHS structure entries.
1097
1098 2017-06-19  Nick Clifton  <nickc@redhat.com>
1099
1100         PR binutils/21615
1101         * vms-alpha.c (_bfd_vms_slurp_egsd): Use unsigned int for
1102         gsd_size.  Check that there are enough bytes remaining to read the
1103         type and size of the next egsd.  Check that the size of the egsd
1104         does not exceed the size of the record.
1105
1106 2017-06-19  Alan Modra  <amodra@gmail.com>
1107
1108         * config.bfd: Correct targ_underscore for cris.
1109
1110 2017-06-18  Alan Modra  <amodra@gmail.com>
1111
1112         * config.bfd: Correct targ_underscore for epiphany, ip2k,
1113         m32c, mn10200, pru, rl78, rx, crisv32 and v850.
1114
1115 2017-06-16  Nick Clifton  <nickc@redhat.com>
1116
1117         * elflink.c (bfd_elf_size_dynsym_hash_dynstr): Do not fail if the
1118         bucketlist is empty because there are no symbols to add to the
1119         list.
1120
1121 2017-06-16  Alan Modra  <amodra@gmail.com>
1122
1123         PR ld/20022
1124         PR ld/21557
1125         PR ld/21562
1126         PR ld/21571
1127         * targets.c (struct bfd_target): Add _bfd_define_start_stop.
1128         (BFD_JUMP_TABLE_LINK): Likewise.
1129         * elf-bfd.h (bfd_elf_define_start_stop): Declare.
1130         * elflink.c (_bfd_elf_gc_mark_rsec): Update comment.
1131         (bfd_elf_define_start_stop): New function.
1132         * linker.c (bfd_generic_define_start_stop): New function.
1133         * coff64-rs6000.c (rs6000_xcoff64_vec, rs6000_xcoff64_aix_vec): Init
1134         new field.
1135         * aout-adobe.c (aout_32_bfd_define_start_stop): Define.
1136         * aout-target.h (MY_bfd_define_start_stop): Define.
1137         * aout-tic30.c (MY_bfd_define_start_stop): Define.
1138         * binary.c (binary_bfd_define_start_stop): Define.
1139         * bout.c (b_out_bfd_define_start_stop): Define.
1140         * coff-alpha.c (_bfd_ecoff_bfd_define_start_stop): Define.
1141         * coff-mips.c (_bfd_ecoff_bfd_define_start_stop): Define.
1142         * coff-rs6000.c (_bfd_xcoff_bfd_define_start_stop): Define.
1143         * coffcode.h (coff_bfd_define_start_stop): Define.
1144         * elfxx-target.h (bfd_elfNN_bfd_define_start_stop): Define.
1145         * i386msdos.c (msdos_bfd_define_start_stop): Define.
1146         * i386os9k.c (os9k_bfd_define_start_stop): Define.
1147         * ieee.c (ieee_bfd_define_start_stop): Define.
1148         * ihex.c (ihex_bfd_define_start_stop): Define.
1149         * libbfd-in.h (_bfd_nolink_bfd_define_start_stop): Define.
1150         * mach-o-target.c (bfd_mach_o_bfd_define_start_stop): Define.
1151         * mmo.c (mmo_bfd_define_start_stop): Define.
1152         * nlm-target.h (nlm_bfd_define_start_stop): Define.
1153         * oasys.c (oasys_bfd_define_start_stop): Define.
1154         * pef.c (bfd_pef_bfd_define_start_stop): Define.
1155         * plugin.c (bfd_plugin_bfd_define_start_stop): Define.
1156         * ppcboot.c (ppcboot_bfd_define_start_stop): Define.
1157         * som.c (som_bfd_define_start_stop): Define.
1158         * srec.c (srec_bfd_define_start_stop): Define.
1159         * tekhex.c (tekhex_bfd_define_start_stop): Define.
1160         * versados.c (versados_bfd_define_start_stop): Define.
1161         * vms-alpha.c (vms_bfd_define_start_stop): Define.
1162         (alpha_vms_bfd_define_start_stop): Define.
1163         * xsym.c (bfd_sym_bfd_define_start_stop): Define.
1164         * bfd-in2.h: Regenerate.
1165         * libbfd.h: Regenerate.
1166
1167 2017-06-16  Jiong Wang  <jiong.wang@arm.com>
1168
1169         * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Use
1170         SYMBOL_REFERENCES_LOCAL.
1171
1172 2017-06-15  Jiong Wang  <jiong.wang@arm.com>
1173
1174         PR ld/21532
1175         * elfnn-aarch64.c (ELIMINATE_COPY_RELOCS): Set to 1.
1176         (elfNN_aarch64_final_link_relocate): Also propagate relocations to
1177         runtime for if there needs copy relocation elimination.
1178         (need_copy_relocation_p): New function.  Return true for symbol with
1179         pc-relative references and if it's against read-only sections.
1180         (elfNN_aarch64_adjust_dynamic_symbol): Use need_copy_relocation_p.
1181         (elfNN_aarch64_check_relocs): Allocate dynrelocs for relocation types
1182         that are related with accessing external objects.
1183         (elfNN_aarch64_gc_sweep_hook): Sync the relocation types with the change
1184         in elfNN_aarch64_check_relocs.
1185
1186 2017-06-15  Nick Clifton  <nickc@redhat.com>
1187
1188         PR binutils/21582
1189         * ieee.c (ieee_object_p): Use a static buffer to avoid compiler
1190         bugs.
1191         PR binutils/21581
1192         (ieee_archive_p): Likewise.
1193
1194 2017-06-15  Nick Clifton  <nickc@redhat.com>
1195
1196         PR binutils/21579
1197         * vms-alpha.c (_bfd_vms_slurp_etir): Extend check of cmd_length.
1198
1199 2017-06-14  Max Filippov  <jcmvbkbc@gmail.com>
1200
1201         * elf32-xtensa.c (elf_xtensa_be_plt_entry,
1202         elf_xtensa_le_plt_entry): Add dimension for the ABI to arrays,
1203         keep both windowed and call0 ABI PLT definitions.
1204         (elf_xtensa_create_plt_entry): Use selected ABI to choose upper
1205         elf_xtensa_*_plt_entry endex.
1206         (ELF_MAXPAGESIZE): Fix at minimal supported MMU page size.
1207
1208 2017-06-14  Nick Clifton  <nickc@redhat.com>
1209
1210         PR binutils/21578
1211         * elf32-sh.c (sh_elf_set_mach_from_flags): Fix check for invalid
1212         flag value.
1213
1214 2017-06-14  Nick Clifton  <nickc@redhat.com>
1215
1216         PR binutils/21589
1217         * vms-alpha.c (_bfd_vms_get_value): Add an extra parameter - the
1218         maximum value for the ascic pointer.  Check that name processing
1219         does not read beyond this value.
1220         (_bfd_vms_slurp_etir): Add checks for attempts to read beyond the
1221         end of etir record.
1222
1223 2017-06-14  Nick Clifton  <nickc@redhat.com>
1224
1225         PR binutils/21591
1226         * versados.c (versados_mkobject): Zero the allocated tdata structure.
1227         (process_otr): Check for an invalid offset in the otr structure.
1228
1229 2017-06-14  Sebastian Huber  <sebastian.huber@embedded-brains.de>
1230
1231         * config.bfd (epiphany-*-elf): Accept epiphany-*-*.
1232
1233 2017-06-13  H.J. Lu  <hongjiu.lu@intel.com>
1234
1235         PR ld/20022
1236         PR ld/21557
1237         PR ld/21562
1238         PR ld/21571
1239         * elf-bfd.h (elf_link_hash_entry): Add start_stop.  Change the
1240         vtable field to a union.
1241         (_bfd_elf_is_start_stop): Removed.
1242         * elf32-i386.c (elf_i386_convert_load_reloc): Also check for
1243         __start_SECNAME and __stop_SECNAME symbols.
1244         * elf64-x86-64.c (elf_x86_64_convert_load_reloc): Likewise.
1245         * elflink.c (_bfd_elf_is_start_stop): Removed.
1246         (_bfd_elf_gc_mark_rsec): Check start_stop instead of calling
1247         _bfd_elf_is_start_stop.
1248         (elf_gc_propagate_vtable_entries_used): Skip __start_SECNAME and
1249         __stop_SECNAME symbols.  Updated.
1250         (elf_gc_smash_unused_vtentry_relocs): Likewise.
1251         (bfd_elf_gc_record_vtinherit): Likewise.
1252         (bfd_elf_gc_record_vtentry): Likewise.
1253
1254 2017-06-13  Nick Clifton  <nickc@redhat.com>
1255
1256         PR ld/21524
1257         * elflink.c (elf_link_adjust_relocs): Generate an error when
1258         encountering a reloc against a symbol removed by garbage
1259         collection.
1260
1261 2017-06-12  H.J. Lu  <hongjiu.lu@intel.com>
1262
1263         * elf-bfd.h (elf_backend_data): Add struct bfd_link_info *
1264         to merge_gnu_properties.
1265         * elf-properties.c (elf_merge_gnu_properties): Add struct
1266         bfd_link_info * and pass it to merge_gnu_properties.
1267         (elf_merge_gnu_property_list): Add struct bfd_link_info *
1268         and pass it to elf_merge_gnu_properties.
1269         (_bfd_elf_link_setup_gnu_properties): Pass info to
1270         elf_merge_gnu_property_list.
1271         * elf32-i386.c (elf_i386_merge_gnu_properties): Add struct
1272         bfd_link_info *.
1273         * elf64-x86-64.c (elf_x86_64_merge_gnu_properties): Likewise.
1274
1275 2017-06-11  Joe Zbiciak  <joe.zbiciak@leftturnonly.info>
1276
1277         PR 21564
1278         * binary.c (binary_set_section_contents): Scale lma by octets
1279         per byte to set filepos.
1280
1281 2017-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
1282
1283         * elf32-arc.c (elf_arc_check_relocs): Fixed conditions to generate
1284         dynamic sections.
1285
1286 2017-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
1287
1288         * elf32-arc.c (elf_arc_size_dynamic_sections): Changed condition to
1289         require TEXTREL.
1290
1291 2017-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
1292
1293         * arc-got.h (relocate_fix_got_relocs_for_got_info): Added TCB_SIZE to
1294         patched section contents for TLS IE reloc.
1295         * elf32-arc.c: Remove TCB_SIZE preprocessor macro.
1296
1297 2017-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
1298
1299         * elf32-arc.c (elf_arc_relocate_section): Added "call" to
1300         RELOC_FOR_GLOBAL_SYMBOL macro.
1301
1302 2018-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
1303
1304         * elf32-arc.c (elf_arc_relocate_section): Small refactor and condition
1305         changes.
1306
1307 2017-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
1308
1309         * config/tc-arc.c (md_undefined_symbol): Changed.
1310         * config/tc-arc.h (DYNAMIC_STRUCT_NAME): Removed.
1311
1312 2017-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
1313
1314         * elf32-arc.c (elf_arc_relocate_section): Fixed reassign of indirect
1315         symbols.
1316
1317 2017-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
1318
1319         * elf32-arc.c (elf_arc_check_relocs): Added condition to disable
1320         warning and "Bad value" for local symbols ARC_32 or ARC_32_ME relocs.
1321
1322 2017-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
1323
1324         * elf32-arc.c (ADD_RELA): Changed to only work when dynamic
1325         object is created.
1326
1327 2017-06-08  Richard Earnshaw  <rearnsha@arm.com>
1328
1329         * elf32-arm.c (elf32_arm_merge_eabi_attributes): Remove assertion
1330         that the input bfd has Tag_FP_ARCH non-zero if Tag_ABI_HardFP_use
1331         is non-zero.  Add clarifying comments.
1332
1333 2017-06-08  H.J. Lu  <hongjiu.lu@intel.com>
1334
1335         * elf32-i386.c (elf_i386_check_relocs): Set local IFUNC symbol
1336         name.  Use local IFUNC symbol name string to report unsupported
1337         non-PIC call to IFUNC function.
1338         (elf_i386_relocate_section): Dump local IFUNC name with minfo
1339         when generating R_386_IRELATIVE relocation.
1340         (elf_i386_finish_dynamic_symbol): Likewise.
1341         * elf_x86_64_check_relocs (elf_x86_64_check_relocs): Set local
1342         IFUNC symbol name.
1343         (elf_x86_64_relocate_section): Dump local IFUNC name with minfo
1344         when generating R_X86_64_IRELATIVE relocation.
1345         (elf_x86_64_finish_dynamic_symbol): Likewise.
1346
1347 2017-06-06  Jose E. Marchesi  <jose.marchesi@oracle.com>
1348
1349         * elf.c (setup_group): Make sure BFD sections are created for all
1350         group sections in the input file when processing SHF_GROUP
1351         sections.
1352         (bfd_section_from_shdr): Avoid duplicating logic already
1353         implemented in `setup_group'.
1354
1355 2017-06-06  Daniel Bonniot de Ruisselet  <bonniot@gmail.com>
1356
1357         PR binutils/21546
1358         * peXXigen.c (pe_print_idata): Use the address of the first thunk
1359         if the hint address is zero.
1360
1361 2017-06-06  James Clarke  <jrtc27@jrtc27.com>
1362
1363         PR ld/19579
1364         * elfnn-aarch64.c (elfNN_aarch64_finish_dynamic_symbol): Check
1365         ELF_COMMON_DEF_P for common symbols.
1366
1367 2017-06-06  Andrew Burgess  <andrew.burgess@embecosm.com>
1368
1369         * elf.c (_bfd_elf_make_section_from_shdr): Don't initially mark
1370         SEC_GROUP sections as SEC_EXCLUDE.
1371         (bfd_elf_set_group_contents): Replace use of abort with an assert.
1372         (assign_section_numbers): Use resolve_section_groups flag instead
1373         of relocatable link type.
1374         (_bfd_elf_init_private_section_data): Use resolve_section_groups
1375         flag instead of checking the final_link flag for part of the
1376         checks in here.  Fix white space as a result.
1377         * elflink.c (elf_link_input_bfd): Use resolve_section_groups flag
1378         instead of relocatable link type.
1379         (bfd_elf_final_link): Likewise.
1380
1381 2017-06-06  Jose E. Marchesi  <jose.marchesi@oracle.com>
1382
1383         * elfxx-mips.c (_bfd_mips_elf_relocate_section): Remove unused
1384         variable `bed'.
1385         * elf32-score.c (score_elf_final_link_relocate): Likewise.
1386         (s3_bfd_score_elf_check_relocs): Likewise.
1387         * elf32-score7.c (s7_bfd_score_elf_relocate_section): Likewise.
1388         (score_elf_final_link_relocate): Likewise.
1389         (s7_bfd_score_elf_check_relocs): Likewise.
1390
1391 2017-06-06  Jose E. Marchesi  <jose.marchesi@oracle.com>
1392
1393         * elflink.c (init_reloc_cookie_rels): Remove unused variable
1394         `bed'.
1395
1396 2017-06-06  Maciej W. Rozycki  <macro@imgtec.com>
1397
1398         * elf-bfd.h (RELOC_AGAINST_DISCARDED_SECTION): Subtract `count'
1399         from `reloc_count' rather than decrementing it.
1400         * elf.c (bfd_section_from_shdr): Multiply the adjustment to
1401         `reloc_count' by `int_rels_per_ext_rel'.
1402         * elf32-score.c (score_elf_final_link_relocate): Do not multiply
1403         `reloc_count' by `int_rels_per_ext_rel' for last relocation
1404         entry determination.
1405         (s3_bfd_score_elf_check_relocs): Likewise.
1406         * elf32-score7.c (score_elf_final_link_relocate): Likewise.
1407         (s7_bfd_score_elf_relocate_section): Likewise.
1408         (s7_bfd_score_elf_check_relocs): Likewise.
1409         * elf64-mips.c (mips_elf64_get_reloc_upper_bound): Remove
1410         prototype and function.
1411         (mips_elf64_slurp_one_reloc_table): Do not update `reloc_count'.
1412         (mips_elf64_slurp_reloc_table): Assert that `reloc_count' is
1413         triple rather than once the sum of REL and RELA relocation entry
1414         counts.
1415         (bfd_elf64_get_reloc_upper_bound): Remove macro.
1416         * elflink.c (_bfd_elf_link_read_relocs): Do not multiply
1417         `reloc_count' by `int_rels_per_ext_rel' for internal relocation
1418         storage allocation size determination.
1419         (elf_link_input_bfd): Multiply `.ctors' and `.dtors' section's
1420         size by `int_rels_per_ext_rel'.  Do not multiply `reloc_count'
1421         by `int_rels_per_ext_rel' for last relocation entry
1422         determination.
1423         (bfd_elf_final_link): Do not multiply `reloc_count' by
1424         `int_rels_per_ext_rel' for internal relocation storage
1425         allocation size determination.
1426         (init_reloc_cookie_rels): Do not multiply `reloc_count' by
1427         `int_rels_per_ext_rel' for last relocation entry determination.
1428         (elf_gc_smash_unused_vtentry_relocs): Likewise.
1429         * elfxx-mips.c (_bfd_mips_elf_check_relocs): Likewise.
1430         (_bfd_mips_elf_relocate_section): Likewise.
1431
1432 2017-06-05  Alan Modra  <amodra@gmail.com>
1433
1434         PR 21529
1435         * linker.c (_bfd_generic_link_output_symbols): Handle BSF_GNU_UNIQUE.
1436
1437 2017-06-01  John Baldwin  <jhb@FreeBSD.org>
1438
1439         * elf.c (elfcore_grok_freebsd_psinfo): Use ELF header class to
1440         determine structure sizes.
1441         (elfcore_grok_freebsd_prstatus): Likewise.
1442
1443 2017-06-01  Alan Modra  <amodra@gmail.com>
1444
1445         * elf64-ppc.c (struct ppc_link_hash_table): Add has_plt_localentry0.
1446         (ppc64_elf_merge_symbol_attribute): Merge localentry bits from
1447         dynamic objects.
1448         (is_elfv2_localentry0): New function.
1449         (ppc64_elf_tls_setup): Default params->plt_localentry0.
1450         (plt_stub_size): Adjust size for tls_get_addr_opt stub.
1451         (build_tls_get_addr_stub): Use a simpler stub when r2 is not saved.
1452         (ppc64_elf_size_stubs): Leave stub_type as ppc_stub_plt_call for
1453         optimized localentry:0 stubs.
1454         (ppc64_elf_build_stubs): Save r2 in ELFv2 __glink_PLTresolve.
1455         (ppc64_elf_relocate_section): Leave nop unchanged for optimized
1456         localentry:0 stubs.
1457         (ppc64_elf_finish_dynamic_sections): Set PPC64_OPT_LOCALENTRY in
1458         DT_PPC64_OPT.
1459         * elf64-ppc.h (struct ppc64_elf_params): Add plt_localentry0.
1460
1461 2017-05-30  Casey Smith  <clegg89@gmail.com>
1462
1463         PR ld/21523
1464         * elf32-arm.c (elf32_arm_final_link_relocate): Install an absolute
1465         value when processing the R_ARM_THM_ALU_PREL_11_0 reloc.
1466
1467 2017-05-30  Anton Kolesov  Anton.Kolesov@synopsys.com
1468
1469         * cpu-arc.c (arc_compatible): New function.
1470
1471 2017-05-30  Anton Kolesov  <anton.kolesov@synopsys.com>
1472
1473         * cpu-arc.c (arch_info_struct): Remove duplicate ARC600 entry.
1474
1475 2017-05-30  H.J. Lu  <hongjiu.lu@intel.com>
1476
1477         PR binutils/21519
1478         * bfdio.c (bfd_get_file_size): New function.
1479         * bfd-in2.h: Regenerated.
1480
1481 2017-05-23  Dilian Palauzov  <git-dpa@aegee.org>
1482
1483         * elf32-arc.c (arc_elf_merge_attributes): Add fall through
1484         comments.
1485
1486 2017-05-22  H.J. Lu  <hongjiu.lu@intel.com>
1487
1488         * elf64-x86-64.c (elf_x86_64_link_setup_gnu_properties): Use
1489         dynobj instead of htab->elf.dynobj.
1490
1491 2017-05-19  Maciej W. Rozycki  <macro@imgtec.com>
1492
1493         * elf64-mips.c (mips_elf64_canonicalize_reloc): Remove prototype
1494         and function.
1495         (mips_elf64_canonicalize_dynamic_reloc): Likewise.
1496         (mips_elf64_slurp_one_reloc_table): Set `reloc_count' to the
1497         actual number of internal relocations retrieved.  Adjust
1498         function description.
1499         (bfd_elf64_canonicalize_reloc): Remove macro.
1500         (bfd_elf64_canonicalize_dynamic_reloc): Likewise.
1501
1502 2017-05-19  Jose E. Marchesi  <jose.marchesi@oracle.com>
1503
1504         * archures.c (bfd_mach_sparc_v9m8): Define.
1505         (bfd_mach_sparc_v8plusm8): Likewise.
1506         (bfd_mach_sparc_v9_p): Adjust to M8.
1507         (bfd_mach_sparc_64bit_p): Likewise.
1508         * aoutx.h (machine_type): Handle bfd_mach_sparc_v9m8 and
1509         bfd_mach_sparc_v8plusm8.
1510         * bfd-in2.h: Regenerated.
1511         * cpu-sparc.c (arch_info_struct): Entries for sparc:v9m8 and
1512         sparc:v8plusm8.
1513         * elfxx-sparc.c (_bfd_sparc_elf_object_p): Handle
1514         bfd_mach_sparc_v8plusm8 and bfd_mach_sparc_v9m8 using the new hw
1515         capabilities ONADDSUB, ONMUL, ONDIV, DICTUNP, FPCPSHL, RLE and
1516         SHA3.
1517         * elf32-sparc.c (elf32_sparc_final_write_processing): Handle
1518         bfd_mach_sparc_v8plusm8.
1519
1520 2017-05-19  Alan Modra  <amodra@gmail.com>
1521
1522         * elflink.c (_bfd_elf_gc_mark_extra_sections): Don't keep
1523         debug and special sections when no non-note alloc sections in an
1524         object are kept.
1525
1526 2017-05-18  Alan Modra  <amodra@gmail.com>
1527
1528         * arc-got.h: Don't compare boolean values against TRUE or FALSE.
1529         * elf-m10300.c: Likewise.
1530         * elf.c: Likewise.
1531         * elf32-arc.c: Likewise.
1532         * elf32-bfin.c: Likewise.
1533         * elf32-m68k.c: Likewise.
1534         * elf32-nds32.c: Likewise.
1535         * elf32-tilepro.c: Likewise.
1536         * elflink.c: Likewise.
1537         * elfnn-aarch64.c: Likewise.
1538         * elfnn-riscv.c: Likewise.
1539         * elfxx-tilegx.c: Likewise.
1540         * mach-o.c: Likewise.
1541         * peXXigen.c: Likewise.
1542         * vms-alpha.c: Likewise.
1543         * vms-lib.c: Likewise.
1544
1545 2017-05-17  H.J. Lu  <hongjiu.lu@intel.com>
1546
1547         PR ld/20882
1548         * elflink.c (elf_gc_mark_debug_section): New function.
1549         (_bfd_elf_gc_mark_extra_sections): Mark any debug sections
1550         referenced by kept debug sections.
1551
1552 2017-05-16  Alan Modra  <amodra@gmail.com>
1553
1554         * elf-m10300.c: Rename occurrences of non_ir_ref.
1555         * elf32-arm.c: Likewise.
1556         * elf32-bfin.c: Likewise.
1557         * elf32-cr16.c: Likewise.
1558         * elf32-cris.c: Likewise.
1559         * elf32-d10v.c: Likewise.
1560         * elf32-dlx.c: Likewise.
1561         * elf32-fr30.c: Likewise.
1562         * elf32-frv.c: Likewise.
1563         * elf32-hppa.c: Likewise.
1564         * elf32-i370.c: Likewise.
1565         * elf32-i386.c: Likewise.
1566         * elf32-iq2000.c: Likewise.
1567         * elf32-lm32.c: Likewise.
1568         * elf32-m32c.c: Likewise.
1569         * elf32-m32r.c: Likewise.
1570         * elf32-m68hc1x.c: Likewise.
1571         * elf32-m68k.c: Likewise.
1572         * elf32-mcore.c: Likewise.
1573         * elf32-metag.c: Likewise.
1574         * elf32-microblaze.c: Likewise.
1575         * elf32-moxie.c: Likewise.
1576         * elf32-msp430.c: Likewise.
1577         * elf32-mt.c: Likewise.
1578         * elf32-nios2.c: Likewise.
1579         * elf32-or1k.c: Likewise.
1580         * elf32-ppc.c: Likewise.
1581         * elf32-rl78.c: Likewise.
1582         * elf32-s390.c: Likewise.
1583         * elf32-score.c: Likewise.
1584         * elf32-score7.c: Likewise.
1585         * elf32-sh.c: Likewise.
1586         * elf32-tic6x.c: Likewise.
1587         * elf32-tilepro.c: Likewise.
1588         * elf32-v850.c: Likewise.
1589         * elf32-vax.c: Likewise.
1590         * elf32-xstormy16.c: Likewise.
1591         * elf32-xtensa.c: Likewise.
1592         * elf64-alpha.c: Likewise.
1593         * elf64-hppa.c: Likewise.
1594         * elf64-ia64-vms.c: Likewise.
1595         * elf64-mmix.c: Likewise.
1596         * elf64-ppc.c: Likewise.
1597         * elf64-s390.c: Likewise.
1598         * elf64-sh64.c: Likewise.
1599         * elf64-x86-64.c: Likewise.
1600         * elflink.c: Likewise.
1601         * elfnn-aarch64.c: Likewise.
1602         * elfnn-ia64.c: Likewise.
1603         * elfnn-riscv.c: Likewise.
1604         * elfxx-mips.c: Likewise.
1605         * elfxx-sparc.c: Likewise.
1606         * elfxx-tilegx.c: Likewise.
1607         * linker.c: Likewise.
1608
1609 2017-05-16  Alan Modra  <amodra@gmail.com>
1610
1611         * elf64-ppc.c (add_symbol_adjust): Transfer non_ir_ref_dynamic.
1612         * elflink.c (elf_link_add_object_symbols): Update to use
1613         non_ir_ref_dynamic.
1614         (elf_link_input_bfd): Test non_ir_ref_dynamic in addition to
1615         non_ir_ref.
1616         * linker.c (_bfd_generic_link_add_one_symbol): Likewise.
1617
1618 2017-05-15  Maciej W. Rozycki  <macro@imgtec.com>
1619
1620         * elfxx-mips.c (print_mips_ases): Handle MIPS16e2 ASE.
1621
1622 2017-05-12  H.J. Lu  <hongjiu.lu@intel.com>
1623
1624         * elf32-i386.c (elf_i386_parse_gnu_properties): Merge
1625         GNU_PROPERTY_X86_ISA_1_USED and GNU_PROPERTY_X86_ISA_1_NEEDED
1626         properties.
1627         * elf64-x86-64.c (elf_x86_64_parse_gnu_properties): Likewise.
1628
1629 2017-05-11  H.J. Lu  <hongjiu.lu@intel.com>
1630
1631         * elf64-x86-64.c (elf_x86_64_link_hash_entry): Rename plt_bnd
1632         to plt_second.
1633         (elf_x86_64_link_hash_table): Rename plt_bnd/plt_bnd_eh_frame
1634         to plt_second/plt_second_eh_frame.
1635         (elf_x86_64_link_hash_newfunc): Updated.
1636         (elf_x86_64_allocate_dynrelocs): Likewise.
1637         (elf_x86_64_size_dynamic_sections): Likewise.
1638         (elf_x86_64_relocate_section): Likewise.
1639         (elf_x86_64_finish_dynamic_symbol): Likewise.
1640         (elf_x86_64_finish_dynamic_sections): Likewise.
1641         (elf_x86_64_plt_type): Rename plt_bnd to plt_second.
1642         (elf_x86_64_get_synthetic_symtab): Updated.  Also scan the
1643         .plt.sec section.
1644         (elf_backend_setup_gnu_properties): Updated.  Create the
1645         .plt.sec section instead of the .plt.sec section.
1646
1647 2017-05-11  H.J. Lu  <hongjiu.lu@intel.com>
1648
1649         * elf32-i386.c (elf_i386_allocate_dynrelocs): Partially revert
1650         commit 25070364b0ce33eed46aa5d78ebebbec6accec7e.
1651         * elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): Likewse.
1652
1653 2017-05-10  Jose E. Marchesi  <jose.marchesi@oracle.com>
1654
1655         * elf64-sparc.c (elf64_sparc_set_reloc): New function.
1656         (bfd_elf64_set_reloc): Define.
1657         (elf64_sparc_write_relocs): Use `canon_reloc_count'.
1658
1659 2017-05-10  Jose E. Marchesi  <jose.marchesi@oracle.com>
1660
1661         * targets.c (BFD_JUMP_TABLE_RELOCS): Add NAME##_set_reloc.
1662         (struct bfd_target): New field _bfd_set_reloc.
1663         * bfd.c (bfd_set_reloc): Call backend _set_bfd.
1664         * reloc.c (_bfd_generic_set_reloc): New function.
1665         * coffcode.h (coff_set_reloc): Define to _bfd_generic_set_reloc.
1666         * nlm-target.h (nlm_set_reloc): Likewise.
1667         * coff-rs6000.c (_bfd_xcoff_set_reloc): Likewise.
1668         * aout-tic30.c (MY_set_reloc): Likewise.
1669         * aout-target.h (MY_set_reloc): Likewise.
1670         * elfxx-target.h (bfd_elfNN_set_reloc): Likewise.
1671         * coff-alpha.c (_bfd_ecoff_set_reloc): Likewise.
1672         * mach-o-target.c (bfd_mach_o_set_reloc): Likewise.
1673         * vms-alpha.c (alpha_vms_set_reloc): Likewise.
1674         * aout-adobe.c (aout_32_set_reloc): Likewise.
1675         * bout.c (b_out_set_reloc): Likewise.
1676         * coff-mips.c (_bfd_ecoff_set_reloc): Likewise.
1677         * i386os9k.c (aout_32_set_reloc): Likewise.
1678         * ieee.c (ieee_set_reloc): Likewise.
1679         * oasys.c (oasys_set_reloc): Likewise.
1680         * som.c (som_set_reloc): Likewise.
1681         * versados.c (versados_set_reloc): Likewise.
1682         * coff64-rs6000.c (rs6000_xcoff64_vec): Add
1683         _bfd_generic_set_reloc.
1684         (rs6000_xcoff64_aix_vec): LIkewise.
1685         * libbfd.c (_bfd_norelocs_set_reloc): New function.
1686         * libbfd-in.h: Prototype for _bfd_norelocs_set_reloc.
1687         * i386msdos.c (msdos_set_reloc): Define to
1688         _bfd_norelocs_set_reloc.
1689         * elfcode.h (elf_set_reloc): Define.
1690         * bfd-in2.h: Regenerated.
1691
1692 2017-05-10  H.J. Lu  <hongjiu.lu@intel.com>
1693
1694         PR ld/21481
1695         * elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Use .plt.bnd
1696         for IFUNC function address.
1697
1698 2017-05-10  Claudiu Zissulescu  <claziss@synopsys.com>
1699
1700         * elf32-arc.c (FEATURE_LIST_NAME): Define.
1701         (CONFLICT_LIST): Likewise.
1702         (opcode/arc-attrs.h): Include.
1703         (arc_elf_print_private_bfd_data): Print OSABI v4 flag.
1704         (arc_extract_features): New file.
1705         (arc_stralloc): Likewise.
1706         (arc_elf_merge_attributes): Likewise.
1707         (arc_elf_merge_private_bfd_data): Use object attributes.
1708         (bfd_arc_get_mach_from_attributes): New function.
1709         (arc_elf_object_p): Use object attributes.
1710         (arc_elf_final_write_processing): Likewise.
1711         (elf32_arc_obj_attrs_arg_type): New function.
1712         (elf32_arc_obj_attrs_handle_unknown): Likewise.
1713         (elf32_arc_section_from_shdr): Likewise.
1714         (elf_backend_obj_attrs_vendor): Define.
1715         (elf_backend_obj_attrs_section): Likewise.
1716         (elf_backend_obj_attrs_arg_type): Likewise.
1717         (elf_backend_obj_attrs_section_type): Likewise.
1718         (elf_backend_obj_attrs_handle_unknown): Likewise.
1719         (elf_backend_section_from_shdr): Likewise.
1720
1721 2017-05-09  Andrew Goedhart  <Andrewgoedhart@simplepowersolutions.co.za>
1722
1723         PR ld/21458
1724         * elf32-arm.c (elf32_arm_final_link_relocate): Set the bottom bit
1725         of the value when resolving a R_ARM_THM_ALU_PREL_11_0 relocation
1726         and the destination is a Thumb symbol.
1727
1728 2017-05-08  H.J. Lu  <hongjiu.lu@intel.com>
1729
1730         * elf32-i386.c (elf_i386_get_synthetic_symtab): Add missing
1731         initializer to silence GCC 4.2.
1732         * lf64-x86-64.c (elf_x86_64_get_synthetic_symtab): Likewise.
1733
1734 2017-05-08  H.J. Lu  <hongjiu.lu@intel.com>
1735
1736         * elf64-x86-64.c (PLT_ENTRY_SIZE): Renamed to ...
1737         (LAZY_PLT_ENTRY_SIZE): This.
1738         (NON_LAZY_PLT_ENTRY_SIZE): New.
1739         (elf_x86_64_plt0_entry): Renamed to ...
1740         (elf_x86_64_lazy_plt0_entry): This.
1741         (elf_x86_64_plt_entry): Renamed to ...
1742         (elf_x86_64_lazy_plt_entry): This.
1743         (elf_x86_64_bnd_plt0_entry): Renamed to ...
1744         (elf_x86_64_lazy_bnd_plt0_entry): This.
1745         (elf_x86_64_legacy_plt_entry): Removed.
1746         (elf_x86_64_bnd_plt_entry): Renamed to ...
1747         (elf_x86_64_lazy_bnd_plt_entry): This.
1748         (elf_x86_64_legacy_plt2_entry): Renamed to ...
1749         (elf_x86_64_non_lazy_plt_entry): This.
1750         (elf_x86_64_bnd_plt2_entry): Renamed to ...
1751         (elf_x86_64_non_lazy_bnd_plt_entry): This.
1752         (elf_x86_64_eh_frame_plt): Renamed to ...
1753         (elf_x86_64_eh_frame_lazy_plt): This.
1754         (elf_x86_64_eh_frame_bnd_plt): Renamed to ...
1755         (elf_x86_64_eh_frame_lazy_bnd_plt): This.
1756         (elf_x86_64_eh_frame_plt_got): Renamed to ...
1757         (elf_x86_64_eh_frame_non_lazy_plt): This.
1758         (elf_x86_64_lazy_plt_layout): New.
1759         (elf_x86_64_non_lazy_plt_layout): Likewise.
1760         (elf_x86_64_plt_layout): Likewise.
1761         (elf_x86_64_backend_data): Remove PLT layout information.  Add
1762         os for target system.
1763         (GET_PLT_ENTRY_SIZE): Removed.
1764         (elf_x86_64_lazy_plt): New.
1765         (elf_x86_64_non_lazy_plt): Likewise.
1766         (elf_x86_64_lazy_bnd_plt): Likewise.
1767         (elf_x86_64_non_lazy_bnd_plt): Likewise.
1768         (elf_x86-64_arch_bed): Updated.
1769         (elf_x86_64_link_hash_table): Add plt, lazy_plt and non_lazy_plt.
1770         (elf_x86_64_create_dynamic_sections): Removed.
1771         (elf_x86_64_check_relocs): Don't check elf.dynobj.  Don't call
1772         _bfd_elf_create_ifunc_sections nor _bfd_elf_create_got_section.
1773         (elf_x86-64_adjust_dynamic_symbol): Updated.
1774         (elf_x86_64_allocate_dynrelocs): Updated.  Pass 0 as PLT header
1775         size to _bfd_elf_allocate_ifunc_dyn_relocs and don't allocate
1776         size for PLT0 if there is no PLT0.  Get plt_entry_size from
1777         non_lazy_plt for non-lazy PLT entries.
1778         (elf_x86_64_size_dynamic_sections): Updated.  Get plt_entry_size
1779         from non_lazy_plt for non-lazy PLT entries.
1780         (elf_x86-64_relocate_section): Updated.  Properly get PLT index
1781         if there is no PLT0.
1782         (elf_x86_64_finish_dynamic_symbol): Updated.  Fill the first slot
1783         in the PLT entry with generic PLT layout.  Fill the non-lazy PLT
1784         entries with non-lazy PLT layout.  Don't fill the second and third
1785         slots in the PLT entry if there is no PLT0.
1786         (elf_x86_64_finish_dynamic_sections): Updated.  Don't fill PLT0
1787         if there is no PLT0.  Set sh_entsize on the .plt.got section.
1788         (compare_relocs): New.
1789         (elf_x86_64_plt_type): Likewise.
1790         (elf_x86_64_plt): Likewise.
1791         (elf_x86_64_nacl_plt): New. Forward declaration.
1792         (elf_x86_64_get_plt_sym_val): Removed.
1793         (elf_x86_64_get_synthetic_symtab): Rewrite to check PLT sections
1794         against all dynamic relocations.
1795         (elf_x86_64_link_setup_gnu_properties): New function.
1796         (elf_backend_create_dynamic_sections): Updated.
1797         (elf_backend_setup_gnu_properties): New.
1798         (elf_x86_64_nacl_plt): New.
1799         (elf_x86_64_nacl_arch_bed): Updated.
1800
1801 2017-05-08  H.J. Lu  <hongjiu.lu@intel.com>
1802
1803         * elf32-i386.c (PLT_ENTRY_SIZE): Renamed to ...
1804         (LAZY_PLT_ENTRY_SIZE): This.
1805         (NON_LAZY_PLT_ENTRY_SIZE): New.
1806         (elf_i386_plt0_entry): Renamed to ...
1807         (elf_i386_lazy_plt0_entry): This.
1808         (elf_i386_plt_entry): Renamed to ...
1809         (elf_i386_lazy_plt_entry): This.
1810         (elf_i386_pic_plt0_entry): Renamed to ...
1811         (elf_i386_pic_lazy_plt0_entry): This.
1812         (elf_i386_pic_plt_entry): Renamed to ...
1813         (elf_i386_pic_lazy_plt_entry): This.
1814         (elf_i386_got_plt_entry): Renamed to ...
1815         (elf_i386_non_lazy_plt_entry): This.
1816         (elf_i386_pic_got_plt_entry): Renamed to ...
1817         (elf_i386_pic_non_lazy_plt_entry): This.
1818         (elf_i386_eh_frame_plt): Renamed to ...
1819         (elf_i386_eh_frame_lazy_plt): This.
1820         (elf_i386_eh_frame_plt_got): Renamed to ...
1821         (elf_i386_eh_frame_non_lazy_plt): This.
1822         (elf_i386_plt_layout): Renamed to ...
1823         (elf_i386_lazy_plt_layout): This.  Remove eh_frame_plt_got and
1824         eh_frame_plt_got_size.
1825         (elf_i386_non_lazy_plt_layout): New.
1826         (elf_i386_plt_layout): Likewise.
1827         (elf_i386_non_lazy_plt): Likewise.
1828         (GET_PLT_ENTRY_SIZE): Removed.
1829         (elf_i386_plt): Renamed to ...
1830         (elf_i386_lazy_plt): This.
1831         (elf_i386_backend_data): Remove plt.  Rename is_vxworks to os.
1832         (elf_i386_arch_bed): Updated.
1833         (elf_i386_link_hash_table): Add plt, lazy_plt and non_lazy_plt.
1834         (elf_i386_create_dynamic_sections): Removed.
1835         (elf_i386_check_relocs): Don't check elf.dynobj.  Don't call
1836         _bfd_elf_create_ifunc_sections nor _bfd_elf_create_got_section.
1837         (elf_i386_adjust_dynamic_symbol): Updated.
1838         (elf_i386_allocate_dynrelocs): Updated.  Pass 0 as PLT header
1839         size to _bfd_elf_allocate_ifunc_dyn_relocs and don't allocate
1840         size for PLT0 if there is no PLT0.
1841         (elf_i386_size_dynamic_sections): Updated.  Check whether GOT
1842         output section is discarded only if GOT isn't empty.
1843         (elf_i386_relocate_section): Updated.  Properly get PLT index
1844         if there is no PLT0.
1845         (elf_i386_finish_dynamic_symbol): Updated.  Don't fill the
1846         second and third slots in the PLT entry if there is no PLT0.
1847         (elf_i386_finish_dynamic_sections): Updated.  Don't fill PLT0
1848         if there is no PLT0.  Set sh_entsize on the .plt.got section.
1849         (elf_i386_nacl_plt): Forward declaration.
1850         (elf_i386_get_plt_sym_val): Removed.
1851         (elf_i386_get_synthetic_symtab): Rewrite to check PLT sections
1852         against all dynamic relocations.
1853         (elf_i386_link_setup_gnu_properties): New function.
1854         (elf_backend_create_dynamic_sections): Updated.
1855         (elf_backend_setup_gnu_properties): New.
1856         (elf_i386_nacl_plt): Updated.
1857         (elf_i386_nacl_arch_bed): Likewise.
1858         (elf_i386_vxworks_arch_bed): Likewise.
1859
1860 2017-05-08  Thomas Preud'homme  <thomas.preudhomme@arm.com>
1861
1862         * elflink.c (elf_output_implib): Remove executable flag from import
1863         library bfd.
1864         * elf32-arm.c (elf32_arm_filter_implib_symbols): Assert that the import
1865         library is a relocatable object file.
1866
1867 2017-05-01  Senthil Kumar Selvaraj  <senthil_kumar.selvaraj@atmel.com>
1868
1869         PR ld/21404
1870         * elf32-avr.c (avr_should_move_sym): New function.
1871         (avr_should_reduce_sym_size): Likewise.
1872         (avr_should_increase_sym_size): Likewise.
1873         (elf32_avr_relax_delete_bytes): Adjust symbol values
1874         and sizes by calling new functions.
1875
1876 2017-05-01  Palmer Dabbelt  <palmer@dabbelt.com>
1877
1878         * config.bfd (riscv32-*): Enable rv64.
1879
1880 2017-05-02  Alan Modra  <amodra@gmail.com>
1881
1882         PR 21384
1883         * elflink.c (bfd_elf_link_mark_dynamic_symbol): Test h->non_elf
1884         rather than h->root.type == bfd_link_hash_new.
1885         (bfd_elf_record_link_assignment): Similarly, call
1886         bfd_elf_link_mark_dynamic_symbol when h->non_elf.
1887
1888 2017-04-29  Alan Modra  <amodra@gmail.com>
1889
1890         PR 21432
1891         * reloc.c (reloc_offset_in_range): New function.
1892         (bfd_perform_relocation, bfd_install_relocation): Use it.
1893         (_bfd_final_link_relocate): Likewise.
1894
1895 2017-04-28  H.J. Lu  <hongjiu.lu@intel.com>
1896
1897         * elf32-i386.c (elf_i386_allocate_dynrelocs): Check plt_got
1898         before using .plt.got.
1899         * elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): Likewise.
1900
1901 2017-04-27  H.J. Lu  <hongjiu.lu@intel.com>
1902
1903         * elf64-x86-64.c (elf_x86_64_size_dynamic_sections): Use "="
1904         instead of "+=" to update 0.
1905
1906 2017-04-27  H.J. Lu  <hongjiu.lu@intel.com>
1907
1908         * elf32-i386.c (elf_i386_create_dynamic_sections): Create the
1909         .plt.got section here.
1910         (elf_i386_check_relocs): Don't create the .plt.got section.
1911         * elf64-x86-64.c (elf_x86_64_create_dynamic_sections): Create
1912         the .plt.got and .plt.bnd sections here.
1913         (elf_x86_64_check_relocs): Don't create the .plt.got nor
1914         .plt.bnd sections.
1915
1916 2017-04-27  H.J. Lu  <hongjiu.lu@intel.com>
1917
1918         * elf64-x86-64.c (elf_x86_64_link_hash_entry): Remove
1919         has_bnd_reloc.
1920         (elf_x86_64_link_hash_newfunc): Don't clear has_bnd_reloc.
1921         (elf_x86_64_copy_indirect_symbol): Don't copy has_bnd_reloc.
1922         (elf_x86_64_check_relocs): Don't set has_bnd_reloc.
1923         (elf_x86_64_finish_dynamic_symbol): Check bndplt instead of
1924         has_bnd_reloc.
1925
1926 2017-04-27  H.J. Lu  <hongjiu.lu@intel.com>
1927
1928         * elf-bfd.h (elf_backend_data): Change setup_gnu_properties
1929         to return bfd *.
1930         (_bfd_elf_link_setup_gnu_properties): Return bfd *.
1931         * elf-properties.c (_bfd_elf_link_setup_gnu_properties): Return
1932         the first relocatable ELF input with GNU properties.
1933
1934 2017-04-27  H.J. Lu  <hongjiu.lu@intel.com>
1935
1936         * elf32-i386.c (elf_i386_finish_dynamic_sections): Simplify
1937         VxWorks for non-PIC.
1938
1939 2017-04-27  Alan Modra  <amodra@gmail.com>
1940
1941         * elf-bfd.h (struct elf_backend_data): Make asection param of
1942         elf_backend_eh_frame_address_size const.
1943         (_bfd_elf_eh_frame_address_size): Likewise.
1944         * elf32-m32c.c (_bfd_m32c_elf_eh_frame_address_size): Likewise.
1945         * elf32-msp430.c (elf32_msp430_eh_frame_address_size): Likewise.
1946         * elfxx-mips.c (_bfd_mips_elf_eh_frame_address_size): Likewise.
1947         * elfxx-mips.h (_bfd_mips_elf_eh_frame_address_size): Likewise.
1948         * elf-eh-frame.c (_bfd_elf_eh_frame_address_size): Likewise.
1949         (next_cie_fde_offset): Constify params.
1950         (offset_adjust, adjust_eh_frame_local_symbols): Likewise.
1951
1952 2017-04-27  Alan Modra  <amodra@gmail.com>
1953
1954         * elf-bfd.h (struct eh_cie_fde): Add aug_str_len and aug_data_len.
1955         (_bfd_elf_adjust_eh_frame_global_symbol): Declare.
1956         * elf-eh-frame.c (_bfd_elf_parse_eh_frame): Set aug_str_len and
1957         aug_data_len.
1958         (offset_adjust): New function.
1959         (_bfd_elf_adjust_eh_frame_global_symbol): Likewise.
1960         (adjust_eh_frame_local_symbols): Likewise.
1961         (_bfd_elf_discard_section_eh_frame): Call adjust_eh_frame_local_symbols
1962         after changing anything.  Return true if anything changed.
1963         * elflink.c (bfd_elf_discard_info): If .eh_frame changed, call
1964         _bfd_elf_adjust_eh_frame_global_symbol for globals.
1965
1966 2017-04-27  Alan Modra  <amodra@gmail.com>
1967
1968         * elflink.c (_bfd_elf_link_hash_hide_symbol): Clear dynstr_index
1969         when force_local.
1970
1971 2017-04-27  Alan Modra  <amodra@gmail.com>
1972
1973         * elf32-ppc.c (UNDEFWEAK_NO_DYNAMIC_RELOC): Define.
1974         (ppc_elf_select_plt_layout, ppc_elf_tls_setup): Use it.
1975         (ppc_elf_adjust_dynamic_symbol, allocate_dynrelocs): Likewise.
1976         (ppc_elf_relocate_section): Likewise.  Delete silly optimisation
1977         for undef and undefweak dyn_relocs.
1978         * elf64-ppc.c (UNDEFWEAK_NO_DYNAMIC_RELOC): Define.
1979         (ppc64_elf_adjust_dynamic_symbol, ppc64_elf_tls_setup): Use it.
1980         (allocate_got, allocate_dynrelocs): Likewise.
1981         (ppc64_elf_relocate_section): Likewise.
1982
1983 2017-04-26  H.J. Lu  <hongjiu.lu@intel.com>
1984
1985         * elf32-i386.c (elf_i386_size_dynamic_sections): Alwasys add
1986         DT_PLTRELSZ, DT_PLTREL and DT_JMPREL for .rel.plt section.
1987         * elf64-x86-64.c (elf_x86_64_size_dynamic_sections): Alwasys
1988         add DT_PLTRELSZ, DT_PLTREL and DT_JMPREL for .rela.plt section.
1989
1990 2017-04-26  Nick Clifton  <nickc@redhat.com>
1991
1992         PR binutils/21434
1993         * reloc.c (bfd_perform_relocation): Check for a negative address
1994         in the reloc.
1995
1996 2017-04-26  Maciej W. Rozycki  <macro@imgtec.com>
1997
1998         PR ld/21334
1999         * elf-bfd.h (elf_backend_data): Add `always_renumber_dynsyms'
2000         member.
2001         * elfxx-target.h [!elf_backend_always_renumber_dynsyms]
2002         (elf_backend_always_renumber_dynsyms): Define.
2003         (elfNN_bed): Initialize `always_renumber_dynsyms' member.
2004         * elfxx-mips.h (elf_backend_always_renumber_dynsyms): Define.
2005         * elflink.c (bfd_elf_size_dynamic_sections): Also call
2006         `_bfd_elf_link_renumber_dynsyms' if the backend has requested
2007         it.
2008         (bfd_elf_size_dynsym_hash_dynstr): Likewise.
2009
2010 2017-04-26  Maciej W. Rozycki  <macro@imgtec.com>
2011
2012         * elflink.c (bfd_elf_size_dynamic_sections): Only call
2013         `_bfd_elf_link_renumber_dynsyms' after section GC if dynamic
2014         sections have been created.
2015
2016 2017-04-26  Nick Clifton  <nickc@redhat.com>
2017
2018         PR binutils/21431
2019         * compress.c (bfd_init_section_compress_status): Check the return
2020         value from bfd_malloc.
2021
2022 2017-04-24  H.J. Lu  <hongjiu.lu@intel.com>
2023
2024         * elf64-x86-64.c (elf_x86_64_link_hash_entry): Add
2025         no_finish_dynamic_symbol.
2026         (elf_x86_64_link_hash_newfunc): Set no_finish_dynamic_symbol to
2027         0.
2028         (elf_x86_64_allocate_dynrelocs): If a symbol isn't undefined
2029         weak symbol, don't make it dynamic.
2030         (elf_x86_64_relocate_section): If a symbol isn't dynamic in PIC,
2031         set no_finish_dynamic_symbol and generate R_X86_64_RELATIVE
2032         relocation for GOT reference.
2033         (elf_x86_64_finish_dynamic_symbol): Abort if
2034         no_finish_dynamic_symbol isn't 0.
2035
2036 2017-04-24  H.J. Lu  <hongjiu.lu@intel.com>
2037
2038         PR ld/21402
2039         * elf32-i386.c (elf_i386_allocate_dynrelocs): If a symbol isn't
2040         undefined weak symbol, don't make it dynamic.
2041         (elf_i386_relocate_section): If a symbol isn't dynamic in PIC,
2042         set no_finish_dynamic_symbol and generate R_386_RELATIVE
2043         relocation for R_386_GOT32.
2044
2045 2017-04-24  H.J. Lu  <hongjiu.lu@intel.com>
2046
2047         PR ld/21425
2048         * elf32-i386.c (ELF_MAXPAGESIZE): Set to 0x1000 for VxWorks.
2049
2050 2017-04-23  Alan Modra  <amodra@gmail.com>
2051
2052         PR 21414
2053         * section.c (GLOBAL_SYM_INIT): Make available in bfd.h.
2054         * elf.c (lcomm_sym): New.
2055         (_bfd_elf_large_com_section): Use lcomm_sym section symbol.
2056         * bfd-in2.h: Regenerate.
2057
2058 2017-04-23  Alan Modra  <amodra@gmail.com>
2059
2060         PR 21412
2061         * elf-bfd.h (struct elf_backend_data <get_reloc_section>): Change
2062         parameters and comment.
2063         (_bfd_elf_get_reloc_section): Delete.
2064         (_bfd_elf_plt_get_reloc_section): Declare.
2065         * elf.c (_bfd_elf_plt_get_reloc_section, elf_get_reloc_section):
2066         New functions.  Don't blindly skip over assumed .rel/.rela prefix.
2067         Extracted from..
2068         (_bfd_elf_get_reloc_section): ..here.  Delete.
2069         (assign_section_numbers): Call elf_get_reloc_section.
2070         * elf64-ppc.c (elf_backend_get_reloc_section): Define.
2071         * elfxx-target.h (elf_backend_get_reloc_section): Update.
2072
2073 2017-04-23  Alan Modra  <amodra@gmail.com>
2074
2075         PR 21409
2076         * dwarf2.c (_bfd_dwarf2_find_nearest_line): Don't segfault when
2077         no symbols.
2078
2079 2017-04-21  H.J. Lu  <hongjiu.lu@intel.com>
2080
2081         PR ld/21402
2082         * elf32-i386.c (elf_i386_link_hash_entry): Add
2083         no_finish_dynamic_symbol.
2084         (elf_i386_link_hash_newfunc): Set no_finish_dynamic_symbol to 0.
2085         (elf_i386_allocate_dynrelocs): If a symbol isn't undefined weak
2086         symbol, don't make it dynamic in PIE.
2087         (elf_i386_relocate_section): If a symbol isn't dynamic in PIE,
2088         set no_finish_dynamic_symbol and generate R_386_RELATIVE
2089         relocation for R_386_GOT32
2090         (elf_i386_finish_dynamic_symbol): Abort if no_finish_dynamic_symbol
2091         isn't 0.
2092
2093 2017-04-21  H.J. Lu  <hongjiu.lu@intel.com>
2094
2095         PR ld/19617
2096         PR ld/21086
2097         * elflink.c (elf_link_add_object_symbols): Require
2098         --no-dynamic-linker with -E/--dynamic-list when creating
2099         dynamic sections.
2100
2101 2017-04-20  Maciej W. Rozycki  <macro@imgtec.com>
2102
2103         * elflink.c (_bfd_elf_symbol_refs_local_p): Always return TRUE
2104         if forced local.
2105
2106 2017-04-20  Maciej W. Rozycki  <macro@imgtec.com>
2107
2108         * elfxx-mips.c (_bfd_mips_elf_final_link): Reorder comment about
2109         dynamic symbol sorting.
2110
2111 2017-04-20  H.J. Lu  <hongjiu.lu@intel.com>
2112
2113         PR ld/21382
2114         * elflink.c (elf_link_add_object_symbols): Preserve
2115         dynamic_ref_after_ir_def when restoring the symbol table for
2116         unneeded dynamic object.
2117
2118 2017-04-19  H.J. Lu  <hongjiu.lu@intel.com>
2119
2120         PR ld/21401
2121         * elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Don't abort
2122         on on undefined IFUNC symbol in the second PLT.
2123
2124 2017-04-19  Wedson Almeida Filho  <wedsonaf@gmail.com>
2125
2126         * peXXigen.c (pe_print_reloc): Correct chunk_end.
2127
2128 2017-04-19  Alan Modra  <amodra@gmail.com>
2129
2130         * elflink.c (_bfd_elf_adjust_dynamic_symbol): Hide undefweak
2131         or make dynamic for info->dynamic_undefined_weak 0 and 1.
2132         * elf32-ppc.c:Formatting.
2133         (ensure_undefweak_dynamic): Don't make dynamic when
2134         info->dynamic_undefined_weak is zero.
2135         (allocate_dynrelocs): Discard undefweak dyn_relocs for
2136         info->dynamic_undefined_weak.  Discard undef dyn_relocs when
2137         not default visibility.  Discard undef and undefweak
2138         dyn_relocs earlier.
2139         (ppc_elf_relocate_section): Adjust to suit.
2140         * elf64-ppc.c: Formatting.
2141         (ensure_undefweak_dynamic): Don't make dynamic when
2142         info->dynamic_undefined_weak is zero.
2143         (allocate_dynrelocs): Discard undefweak dyn_relocs for
2144         info->dynamic_undefined_weak.  Discard them earlier.
2145
2146 2017-04-17  H.J. Lu  <hongjiu.lu@intel.com>
2147
2148         PR ld/21389
2149         * elflink.c (bfd_elf_size_dynamic_sections): Get soname index
2150         before generating the version definition section.
2151
2152 2017-04-17  Alan Modra  <amodra@gmail.com>
2153
2154         * elflink.c (_bfd_elf_merge_symbol): Undo dynamic linking
2155         state when a regular object file defines a symbol with
2156         incompatible type to that defined by an earlier shared lib.
2157
2158 2017-04-13  Alan Modra  <amodra@gmail.com>
2159
2160         * coffcode.h: Wrap some overly long _bfd_error_handler args.
2161         * elf.c: Likewise.
2162         * elf32-arm.c: Likewise.
2163         * elf32-i386.c: Likewise.
2164         * elf32-mep.c: Likewise.
2165         * elf64-ia64-vms.c: Likewise.
2166         * elf64-x86-64.c: Likewise.
2167         * elflink.c: Likewise.
2168         * elfnn-ia64.c: Likewise.
2169         * elfxx-mips.c: Likewise.
2170
2171 2017-04-13  Alan Modra  <amodra@gmail.com>
2172
2173         * aoutx.h: Use %B and %A in error messages throughout file.
2174         * aout-cris.c: Likewise.
2175         * archive.c: Likewise.
2176         * binary.c: Likewise.
2177         * coff-rs6000.c: Likewise.
2178         * coff-tic4x.c: Likewise.
2179         * coffcode.h: Likewise.
2180         * coffgen.c: Likewise.
2181         * cofflink.c: Likewise.
2182         * coffswap.h: Likewise.
2183         * cpu-arm.c: Likewise.
2184         * elf-eh-frame.c: Likewise.
2185         * elf-m10300.c: Likewise.
2186         * elf.c: Likewise.
2187         * elf32-arc.c: Likewise.
2188         * elf32-arm.c: Likewise.
2189         * elf32-bfin.c: Likewise.
2190         * elf32-frv.c: Likewise.
2191         * elf32-iq2000.c: Likewise.
2192         * elf32-m32c.c: Likewise.
2193         * elf32-microblaze.c: Likewise.
2194         * elf32-nds32.c: Likewise.
2195         * elf32-rl78.c: Likewise.
2196         * elf32-rx.c: Likewise.
2197         * elf32-score.c: Likewise.
2198         * elf32-score7.c: Likewise.
2199         * elf32-sh64.c: Likewise.
2200         * elf32-v850.c: Likewise.
2201         * elf32-vax.c: Likewise.
2202         * elf32-visium.c: Likewise.
2203         * elf64-ia64-vms.c: Likewise.
2204         * elf64-mmix.c: Likewise.
2205         * elf64-sh64.c: Likewise.
2206         * elfcode.h: Likewise.
2207         * elfnn-aarch64.c: Likewise.
2208         * elfnn-ia64.c: Likewise.
2209         * elfxx-mips.c: Likewise.
2210         * hpux-core.c: Likewise.
2211         * ieee.c: Likewise.
2212         * ihex.c: Likewise.
2213         * linker.c: Likewise.
2214         * merge.c: Likewise.
2215         * mmo.c: Likewise.
2216         * oasys.c: Likewise.
2217         * pdp11.c: Likewise.
2218         * peXXigen.c: Likewise.
2219         * rs6000-core.c: Likewise.
2220         * vms-alpha.c: Likewise.
2221         * xcofflink.c: Likewise.
2222
2223 2017-04-13  Alan Modra  <amodra@gmail.com>
2224
2225         * bfd.c (PRINT_TYPE): Define.
2226         (_doprnt): New function.
2227         (error_handler_internal): Use _doprnt.
2228         * coff-arm.c: Put %A and %B arguments to _bfd_error_handler
2229         calls in their natural order, throughout file.
2230         * coff-mcore.c: Likewise.
2231         * coff-ppc.c: Likewise.
2232         * coff-tic80.c: Likewise.
2233         * cofflink.c: Likewise.
2234         * elf-s390-common.c: Likewise.
2235         * elf.c: Likewise.
2236         * elf32-arm.c: Likewise.
2237         * elf32-i386.c: Likewise.
2238         * elf32-m32r.c: Likewise.
2239         * elf32-msp430.c: Likewise.
2240         * elf32-spu.c: Likewise.
2241         * elf64-ia64-vms.c: Likewise.
2242         * elf64-sparc.c: Likewise.
2243         * elf64-x86-64.c: Likewise.
2244         * elflink.c: Likewise.
2245         * elfnn-aarch64.c: Likewise.
2246         * elfnn-ia64.c: Likewise.
2247         * elfxx-mips.c: Likewise.
2248
2249 2017-04-13  Alan Modra  <amodra@gmail.com>
2250
2251         * elf32-arm.c (arm_type_of_stub): Supply missing args to "long
2252         branch veneers" error.  Fix double space and format message.
2253         * elf32-avr.c (avr_add_stub): Do not pass NULL as %B arg.
2254         * elf64-ppc.c (tocsave_find): Supply missing %B arg.
2255
2256 2017-04-13  Alan Modra  <amodra@gmail.com>
2257
2258         * bfd-in2.h: Regenerate.
2259
2260 2017-04-11  H.J. Lu  <hongjiu.lu@intel.com>
2261
2262         * elf-properties.c (_bfd_elf_parse_gnu_properties): Remove the
2263         extra `\n' in warning/error messages.
2264         * elf32-i386.c (elf_i386_parse_gnu_properties): Likewise.
2265         * elf64-x86-64.c (elf_x86_64_parse_gnu_properties): Likewise.
2266
2267 2017-04-11  H.J. Lu  <hongjiu.lu@intel.com>
2268
2269         * elf-properties.c (_bfd_elf_parse_gnu_properties): Ignore
2270         processor-specific properties with generic ELF target vector.
2271
2272 2017-04-10  Qing Zhao  <qing.zhao@oracle.com>
2273
2274         * elf32-sparc.c (elf_backend_fixup_symbol): New.
2275         * elf64-sparc.c (elf_backend_fixup_symbol): New.
2276         * elfxx-sparc.c (UNDEFINED_WEAK_RESOLVED_TO_ZERO): New.
2277         (_bfd_sparc_elf_link_hash_entry): Add has_got_reloc and
2278         has_non_got_reloc.
2279         (link_hash_newfunc): Initialize has_got_reloc and
2280         has_non_got_reloc.
2281         (_bfd_sparc_elf_size_dynamic_sections): Set interp to .interp
2282         section.
2283         (_bfd_sparc_elf_copy_indirect_symbol): Copy has_got_reloc and
2284         has_non_got_reloc.
2285         (_bfd_sparc_elf_check_relocs): Set has_got_reloc and
2286         has_non_got_reloc.
2287         (_bfd_sparc_elf_fixup_symbol): New function.
2288         (allocate_dynrelocs): Don't allocate space for dynamic
2289         relocations and discard relocations against resolved undefined
2290         weak symbols in executable.  Don't make resolved undefined weak
2291         symbols in executable dynamic.  Keep dynamic non-GOT/non-PLT
2292         relocation against undefined weak symbols in PIE.
2293         (_bfd_sparc_elf_relocate_section): Don't generate dynamic
2294         relocations against resolved undefined weak symbols in PIE
2295         (_bfd_sparc_elf_finish_dynamic_symbol): Keep PLT/GOT entries
2296         without ynamic PLT/GOT relocations for resolved undefined weak
2297         symbols.
2298         Don't generate dynamic relocation against resolved undefined
2299         weak symbol in executable.
2300         (pie_finish_undefweak_symbol): New function.
2301         (_bfd_sparc_elf_finish_dynamic_sections): Call
2302         pie_finish_undefweak_symbol on all symbols in PIE.
2303         * elfxx-sparc.h (_bfd_sparc_elf_link_hash_table): Add interp.
2304         (_bfd_sparc_elf_fixup_symbol): New function.
2305
2306 2017-04-10  Nick Clifton  <nickc@redhat.com>
2307
2308         * config.bfd: Remove ns32k from obsolete list.
2309
2310 2017-04-10  Alan Modra  <amodra@gmail.com>
2311
2312         PR 21287
2313         * elf.c (special_sections_f): Match .fini_array and .fini_array.*.
2314         (special_sections_i): Likewise for .init_array.
2315         (special_sections_p): Likewise for .preinit_array.
2316
2317 2017-04-07  H.J. Lu  <hongjiu.lu@intel.com>
2318
2319         PR ld/19579
2320         PR ld/21306
2321         * elf32-s390.c (elf_s390_finish_dynamic_symbol): Check
2322         ELF_COMMON_DEF_P for common symbols.
2323         * elf64-s390.c (elf_s390_finish_dynamic_symbol): Likewise.
2324         * elf64-x86-64.c (elf_x86_64_relocate_section): Likewise.
2325         * elflink.c (_bfd_elf_merge_symbol): Revert commits
2326         202ac193bbbecc96a4978d1ac3d17148253f9b01 and
2327         07492f668d2173da7a2bda3707ff0985e0f460b6.
2328
2329 2017-04-07  Pedro Alves  <palves@redhat.com>
2330
2331         * opncls.c (bfd_get_debug_link_info): Rename to...
2332         (bfd_get_debug_link_info_1): ... this.  Change type of second
2333         parameter to void pointer.  Adjust.
2334         (bfd_get_debug_link_info): Reimplement on top of
2335         bfd_get_debug_link_info_1.
2336         (separate_debug_file_exists, separate_alt_debug_file_exists):
2337         Change type of second parameter to void pointer.  Adjust.
2338         (get_func_type, check_func_type): Change type of second parameter
2339         to void pointer.
2340         (find_separate_debug_file): Add 'func_data' parameter.  Pass it to
2341         the callback functions instead of passing the address of a local.
2342         (bfd_follow_gnu_debuglink): Pass address of unsigned long local to
2343         find_separate_debug_file.
2344         (get_alt_debug_link_info_shim): Change type of second parameter to
2345         void pointer.  Adjust.
2346         (bfd_follow_gnu_debugaltlink): Adjust to pass NULL to
2347         find_separate_debug_file.
2348         (get_build_id_name, bfd_boolean check_build_id_file): Change type
2349         of second parameter to void pointer.  Adjust.
2350         (bfd_follow_build_id_debuglink): Pass address of bfd_build_id
2351         pointer local to find_separate_debug_file.
2352
2353 2017-04-07  Tristan Gingold  <gingold@gingold-Precision-7510>
2354
2355         * coffgen.c (_bfd_coff_gc_mark_hook): Handle PE weak
2356         external symbols with a definition.
2357         (_bfd_coff_gc_mark_extra_sections): Fix typo.
2358
2359 2017-04-07  Alan Modra  <amodra@gmail.com>
2360
2361         * po/SRC-POTFILES.in: Regenerate.
2362
2363 2017-04-05  Alan Modra  <amodra@gmail.com>
2364
2365         * elf64-ppc.c (ppc64_elf_gc_sweep_hook): Support ELFv2 PLT
2366         reference counting.
2367
2368 2017-04-02  Jon Turney  <jon.turney@dronecode.org.uk>
2369
2370         (_bfd_XXi_swap_aouthdr_out): For clarity, use defines rather than
2371         numbers for DataDirectory entry indicies passed to
2372         add_data_entry().
2373
2374 2017-04-04  H.J. Lu  <hongjiu.lu@intel.com>
2375
2376         * elf.c (get_program_header_size): Add a GNU_MBIND segment for
2377         each GNU_MBIND section and align GNU_MBIND section to page size.
2378         (_bfd_elf_map_sections_to_segments): Create a GNU_MBIND
2379         segment for each GNU_MBIND section.
2380         (_bfd_elf_init_private_section_data): Copy sh_info from input
2381         for GNU_MBIND section.
2382
2383 2017-04-03  Palmer Dabbelt  <palmer@dabbelt.com>
2384
2385         * elfnn-riscv.c (GP_NAME): Delete.
2386         (riscv_global_pointer_value): Change GP_NAME to RISCV_GP_SYMBOL.
2387         (_bfd_riscv_relax_lui): Likewise.
2388
2389 2017-04-04  Nick Clifton  <nickc@redhat.com>
2390
2391         PR binutils/21342
2392         * elflink.c (_bfd_elf_define_linkage_sym): Prevent null pointer
2393         dereference.
2394         (bfd_elf_final_link): Only initialize the extended symbol index
2395         section if there are extended symbol tables to list.
2396
2397 2017-04-03  H.J. Lu  <hongjiu.lu@intel.com>
2398
2399         * Makefile.am (BFD32_BACKENDS): Add elf-properties.lo.
2400         (BFD32_BACKENDS_CFILES): Add elf-properties.c.
2401         * configure.ac (elf): Add elf-properties.lo.
2402         * Makefile.in: Regenerated.
2403         * configure: Likewise.
2404         * elf-bfd.h (elf_property_kind): New.
2405         (elf_property): Likewise.
2406         (elf_property_list): Likewise.
2407         (elf_properties): Likewise.
2408         (_bfd_elf_parse_gnu_properties): Likewise.
2409         (_bfd_elf_get_property): Likewise.
2410         (_bfd_elf_link_setup_gnu_properties): Likewise.
2411         (elf_backend_data): Add parse_gnu_properties, merge_gnu_properties
2412         and setup_gnu_properties.
2413         (elf_obj_tdata): Add properties.
2414         * elf-properties.c: New file.
2415         * elf32-i386.c (elf_i386_parse_gnu_properties): New.
2416         (elf_i386_merge_gnu_properties): Likewise.
2417         (elf_backend_parse_gnu_properties): Likewise.
2418         (elf_backend_merge_gnu_properties): Likewise.
2419         * elf64-x86-64.c (elf_x86_64_parse_gnu_properties): Likewise.
2420         (elf_x86_64_merge_gnu_properties): Likewise.
2421         (elf_backend_parse_gnu_properties): Likewise.
2422         (elf_backend_merge_gnu_properties): Likewise.
2423         * elfxx-target.h (elf_backend_merge_gnu_properties): Likewise.
2424         (elf_backend_parse_gnu_properties): Likewise.
2425         (elf_backend_setup_gnu_properties): Likewise.
2426         (elfNN_bed): Add elf_backend_parse_gnu_properties,
2427         elf_backend_merge_gnu_properties and
2428         elf_backend_setup_gnu_properties.
2429
2430 2017-03-30  Pip Cet  <pipcet@gmail.com>
2431
2432         * elf32-wasm32.c: Add relocation code, two relocs.
2433         * reloc.c: Add wasm32 relocations.
2434         * libbfd.h: Regenerate.
2435         * bfd-in2.h: Regenerate.
2436         * bfd/po/bfd.pot: Regenerate.
2437
2438 2017-03-29  Nick Clifton  <nickc@redhat.com>
2439
2440         PR binutils/18025
2441         * coff-bfd.h (struct coff_section_data): Add new fields:
2442         saved_bias and bias.
2443         * coffgen.c (coff_find_nearest_line_with_names): Cache the bias
2444         computed for PE binaries.
2445         * dwarf2.c (scan_unit_for_symbols): Only warn once about each
2446         missing abbrev.
2447
2448 2017-03-28  Hans-Peter Nilsson  <hp@axis.com>
2449
2450         PR ld/16044
2451         * elf32-cris.c (elf_cris_adjust_gotplt_to_got): Adjust BFD_ASSERT
2452         to handle a local symbol with a hash-symbol-entry; without PLT.
2453         Add BFD_ASSERT for an incidental case with GOT entry present.
2454         (cris_elf_check_relocs): Increment PLT refcount only if the symbol
2455         isn't forced-or-set local.
2456
2457 2017-03-27  Pip Cet  <pipcet@gmail.com>
2458
2459         * wasm-module.c: New file to support WebAssembly modules.
2460         * wasm-module.h: New file to support WebAssembly modules.
2461         * doc/webassembly.texi: Start documenting wasm-module.c.
2462         * config.bfd: Add wasm_vec.
2463         * targets.c: Likewise.
2464         * configure.ac: Likewise.
2465         * Makefile.am: Add entries for wasm-module.c.
2466         * Makefile.in: Regenerate.
2467         * configure: Regenerate.
2468         * po/SRC-POTFILES.in: Regenerate.
2469
2470 2017-03-27  Pip Cet  <pipcet@gmail.com>
2471
2472         * cpu-wasm32.c: New file to support wasm32 architecture.
2473         * elf32-wasm32.c: New file to support wasm32 architecture.
2474         * Makefile.am: Add wasm32 architecture.
2475         * archures.c: Likewise.
2476         * config.bfd: Likewise.
2477         * configure.ac: Likewise.
2478         * targets.c: Likewise.
2479         * Makefile.in: Regenerate.
2480         * bfd-in2.h: Regenerate.
2481         * configure: Regenerate.
2482         * po/SRC-POTFILES.in: Regenerate.
2483
2484 2017-03-20  Alan Modra  <amodra@gmail.com>
2485
2486         PR 21266
2487         * elf64-ppc.c (compare_symbols): Stabilize sort.
2488
2489 2017-03-18  Alan Modra  <amodra@gmail.com>
2490
2491         * elf64-ppc.c (struct ppc_link_hash_table): Add
2492         local_ifunc_resolver and maybe_local_ifunc_resolver.
2493         (ppc_build_one_stub): Set flags on emitting dynamic
2494         relocation to ifunc.
2495         (ppc64_elf_relocate_section): Likewise.
2496         (ppc64_elf_finish_dynamic_symbol): Likewise.
2497         (ppc64_elf_finish_dynamic_sections): Error on DT_TEXTREL with
2498         local dynamic relocs to ifuncs.
2499         * elf32-ppc.c (struct ppc_elf_link_hash_table): Add
2500         local_ifunc_resolver and maybe_local_ifunc_resolver.
2501         (ppc_elf_relocate_section): Set flag on emitting dynamic
2502         relocation to ifuncs.
2503         (ppc_elf_finish_dynamic_symbol): Likewise.
2504         (ppc_elf_finish_dynamic_sections): Error on DT_TEXTREL with local
2505         dynamic relocs to ifuncs.
2506
2507 2017-03-13  Nick Clifton  <nickc@redhat.com>
2508
2509         PR binutils/21202
2510         * reloc.c (BFD_RELOC_AARCH64_TLSDESC_LD64_LO12_NC): Rename to
2511         BFD_RELOC_AARCH64_TLSDESC_LD64_LO12.
2512         (BFD_RELOC_AARCH64_TLSDESC_ADD_LO12_NC): Rename to
2513         BFD_RELOC_AARCH64_TLSDESC_ADD_LO12.
2514         * bfd-in2.h: Regenerate.
2515         * libbfd.h: Regenerate.
2516         * elfnn-aarch64.c (IS_AARCH64_TLS_RELAX_RELOC): Update reloc
2517         names.
2518         (IS_AARCH64_TLSDESC_RELOC): Likewise.
2519         (elfNN_aarch64_howto_table): Likewise.
2520         (aarch64_tls_transition_without_check): Likewise.
2521         (aarch64_reloc_got_type): Likewise.
2522         (elfNN_aarch64_final_link_relocate): Likewise.
2523         (elfNN_aarch64_tls_relax): Likewise.
2524         (elfNN_aarch64_relocate_section): Likewise.
2525         (elfNN_aarch64_gc_sweep_hook): Likewise.
2526         (elfNN_aarch64_check_relocs): Likewise.
2527         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.
2528         (_bfd_aarch64_elf_resolve_relocation): Likewise.
2529
2530 2017-03-11  Alan Modra  <amodra@gmail.com>
2531
2532         * elf32-ppc.c: Remove ATTRIBUTE_UNUSED throughout when function
2533         parameter is in fact used.  Whitespace fixes.
2534         * elf64-ppc.c: Likewise.
2535
2536 2017-03-09  Sam Thursfield  <sam.thursfield@codethink.co.uk>
2537
2538         * rs6000-core.c (CORE_NEW): Simplify macro when
2539         AIX_CORE_DUMPX_CORE and BFD64 are true to avoid compile warning.
2540
2541 2017-03-07  Alan Modra  <amodra@gmail.com>
2542
2543         PR 21224
2544         PR 20519
2545         * elf64-ppc.c (ppc64_elf_relocate_section): Add missing
2546         dyn_relocs check.
2547
2548 2017-03-05  Alan Modra  <amodra@gmail.com>
2549
2550         * elf-bfd.h (struct eh_cie_fde): Add u.cie.per_encoding_aligned8.
2551         * elf-eh-frame.c (size_of_output_cie_fde): Don't align here.
2552         (next_cie_fde_offset): New function.
2553         (_bfd_elf_parse_eh_frame): Set u.cie.per_encoding_aligned8.
2554         (_bfd_elf_discard_section_eh_frame): Align zero terminator to
2555         four bytes.  Align CIEs to four or eight bytes depending on
2556         per_encoding_aligned8.  Align FDEs according to their encoding.
2557         Pad last FDE to output section alignment.
2558         (_bfd_elf_write_section_eh_frame): Adjust to suit.  Remove
2559         assertion.
2560         * elf64-ppc.c (glink_eh_frame_cie): Delete padding.
2561         (ppc64_elf_size_stubs): Pad glink eh_frame as per elf-eh-frame.c.
2562         (ppc64_elf_finish_dynamic_sections): Adjust to suit.
2563
2564 2017-03-02  Martin Bickel  <binutils@ineranves.de>
2565
2566         PR ld/21212
2567         * elf.c (rewrite_elf_program_header): Do not issue a warning for
2568         empty segments which have a zero filesz, but a non-zero memsz.
2569
2570 2017-03-02  Alan Modra  <amodra@gmail.com>
2571
2572         * elf32-ppc.c (ppc_elf_vle_split16): Correct insn mask typo.
2573
2574 2017-02-28  Alan Modra  <amodra@gmail.com>
2575
2576         * elf64-ppc.c (ppc64_elf_ha_reloc): Revert last change.
2577         (ppc64_elf_relocate_section): Likewise.
2578
2579 2017-02-28  Alan Modra  <amodra@gmail.com>
2580
2581         PR 20995
2582         * elf32-nios2.c (nios2_elf32_relocate_section): Use htab
2583         rather than elf32_nios2_hash_table or elf_hash_table.
2584         (create_got_section): Likewise.
2585         (nios2_elf32_finish_dynamic_symbol): Likewise.
2586         (nios2_elf32_adjust_dynamic_symbol): Likewise.
2587         (nios2_elf32_size_dynamic_sections): Likewise.
2588         (nios2_elf32_check_relocs): Delete dynobj, sgot, and srelgot
2589         vars.  Use htab equivalents directly instead.  Don't create
2590         all dynamic sections on needing just the GOT.  Use a goto
2591         rather than a fall-through with reloc test.  Ensure
2592         htab->dynobj is set when making dynamic sreloc section.
2593         (nios2_elf32_finish_dynamic_sections): Delete dynobj, use htab
2594         equivalent directly instead.  Don't segfault on looking for
2595         .dynamic when dynamic sections have not been created.  Don't
2596         segfault on .got.plt being discarded.
2597         (nios2_elf32_size_dynamic_sections): Delete plt and got vars.
2598         Don't set "relocs" on .rela.plt.  Do handle .sbss.  Delete
2599         fixme and another not so relevant comment.
2600         (nios2_elf_add_symbol_hook): Delete dynobj var.  If not
2601         already set, set hash table dynobj on creating .sbss.
2602
2603 2017-02-28  Alan Modra  <amodra@gmail.com>
2604
2605         * reloc.c (BFD_RELOC_PPC_16DX_HA): New.
2606         * elf64-ppc.c (ppc64_elf_howto_raw <R_PPC64_16DX_HA>): New howto.
2607         (ppc64_elf_reloc_type_lookup): Translate new bfd reloc.
2608         (ppc64_elf_ha_reloc): Correct overflow test on REL16DX_HA.
2609         (ppc64_elf_relocate_section): Likewise.
2610         * elf32-ppc.c (ppc_elf_howto_raw <R_PPC_16DX_HA>): New howto.
2611         (ppc_elf_reloc_type_lookup): Translate new bfd reloc.
2612         (ppc_elf_check_relocs): Handle R_PPC_16DX_HA to pacify gcc.
2613         * libbfd.h: Regenerate.
2614         * bfd-in2.h: Regenerate.
2615
2616 2017-02-28  Alan Modra  <amodra@gmail.com>
2617
2618         * elflink.c (_bfd_elf_create_dynamic_sections): Don't make
2619         dynamic .data.rel.ro read-only.
2620         * elf32-arm.c (elf32_arm_finish_dynamic_symbol): Compare section
2621         rather than section flags when deciding where copy reloc goes.
2622         * elf32-cris.c (elf_cris_finish_dynamic_symbol): Likewise.
2623         * elf32-hppa.c (elf32_hppa_finish_dynamic_symbol): Likewise.
2624         * elf32-i386.c (elf_i386_finish_dynamic_symbol): Likewise.
2625         * elf32-metag.c (elf_metag_finish_dynamic_symbol): Likewise.
2626         * elf32-microblaze.c (microblaze_elf_finish_dynamic_symbol): Likewise.
2627         * elf32-nios2.c (nios2_elf32_finish_dynamic_symbol): Likewise.
2628         * elf32-or1k.c (or1k_elf_finish_dynamic_symbol): Likewise.
2629         * elf32-ppc.c (ppc_elf_finish_dynamic_symbol): Likewise.
2630         * elf32-s390.c (elf_s390_finish_dynamic_symbol): Likewise.
2631         * elf32-tic6x.c (elf32_tic6x_finish_dynamic_symbol): Likewise.
2632         * elf32-tilepro.c (tilepro_elf_finish_dynamic_symbol): Likewise.
2633         * elf64-ppc.c (ppc64_elf_finish_dynamic_symbol): Likewise.
2634         * elf64-s390.c (elf_s390_finish_dynamic_symbol): Likewise.
2635         * elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Likewise.
2636         * elfnn-aarch64.c (elfNN_aarch64_finish_dynamic_symbol): Likewise.
2637         * elfnn-riscv.c (riscv_elf_finish_dynamic_symbol): Likewise.
2638         * elfxx-mips.c (_bfd_mips_vxworks_finish_dynamic_symbol): Likewise.
2639         * elfxx-sparc.c (_bfd_sparc_elf_finish_dynamic_symbol): Likewise.
2640         * elfxx-tilegx.c (tilegx_elf_finish_dynamic_symbol): Likewise.
2641
2642 2017-02-28  Maciej W. Rozycki  <macro@imgtec.com>
2643
2644         * elfxx-mips.c (mips_elf_perform_relocation): Also handle the
2645         `jalr $0, $25' instruction encoding.
2646
2647 2017-02-27  Nick Clifton  <nickc@redhat.com>
2648
2649         PR ld/21180
2650         * elf32-microblaze.c (microblaze_elf_finish_dynamic_symbol): Avoid
2651         generating a seg-fault when encountering a symbol that has been
2652         deleted by garbage collection.
2653
2654 2017-02-25  Alan Modra  <amodra@gmail.com>
2655
2656         * elf32-arc.c (struct dynamic_sections): Delete.
2657         (enum dyn_section_types): Delete.
2658         (dyn_section_names): Delete.
2659         (arc_create_dynamic_sections): Delete.
2660         (elf_arc_finish_dynamic_sections): Don't call the above.  Don't
2661         segfault on discarded .rela.plt section.
2662         (elf_arc_size_dynamic_sections): Formatting.  Don't call
2663         arc_create_dynamic_sections.  Don't allocate memory for sections
2664         handled by the generic linker.  Correct code finding relocs in
2665         read-only sections.  Set SEC_EXCLUDE on zero size .got,
2666         .got.plt, and .dynbss sections.  Do set .interp for pies.
2667
2668 2017-02-24  Andrew Waterman  <andrew@sifive.com>
2669
2670         * elfnn-riscv.c (GP_NAME): New macro.
2671         (riscv_global_pointer_value): Use it.
2672         (_bfd_riscv_relax_lui): If symbol and global pointer are in same
2673         output section, consider only that section's alignment.
2674
2675 2017-02-23  Maciej W. Rozycki  <macro@imgtec.com>
2676
2677         * elfxx-mips.h (_bfd_mips_relax_section): Remove prototype.
2678         * elfxx-mips.c (_bfd_mips_relax_section): Remove function.
2679         * elf64-mips.c (bfd_elf64_bfd_relax_section): Remove macro.
2680         * elfn32-mips.c (bfd_elf32_bfd_relax_section): Likewise.
2681
2682 2017-02-23  Maciej W. Rozycki  <macro@imgtec.com>
2683
2684         * elfxx-mips.c (mips_elf_calculate_relocation) <R_MIPS_JALR>
2685         <R_MICROMIPS_JALR>: Discard relocation if `cross_mode_jump_p'
2686         or misaligned.
2687
2688 2017-02-23  Alan Modra  <amodra@gmail.com>
2689
2690         PR 20744
2691         * elf32-ppc.c (ppc_elf_howto_raw): Correct dst_mask on all VLE
2692         16D relocations.
2693         (ppc_elf_vle_split16): Correct field mask and shift for 16D relocs.
2694         (ppc_elf_relocate_section): Correct calculation for VLE SDAREL
2695         relocs.
2696
2697 2017-02-22  Maciej W. Rozycki  <macro@imgtec.com>
2698
2699         PR ld/20828
2700         * elflink.c (bfd_elf_size_dynamic_sections): Move symbol version
2701         processing ahead of the call to `elf_gc_sweep_symbol'.
2702
2703 2017-02-22  Nick Clifton  <nickc@redhat.com>
2704
2705         PR binutils/21193
2706         * opncls.c (bfd_create_gnu_debuglink_section): Give the newly
2707         created section 4-byte alignment.
2708
2709 2017-02-22  Alan Modra  <amodra@gmail.com>
2710
2711         * elf64-ppc.c (ppc64_elf_finish_dynamic_sections): Don't segfault
2712         on .got or .plt output section being discarded by script.
2713         * elf32-ppc.c (ppc_elf_finish_dynamic_sections): Likewise.  Move
2714         vxworks splt temp.
2715
2716 2017-02-21  Alan Modra  <amodra@gmail.com>
2717
2718         * elf64-alpha.c (elf64_alpha_size_dynamic_sections): Only emit
2719         DT_RELA, DT_RELASZ, and DT_RELAENT when DT_RELASZ is non-zero.
2720
2721 2017-02-20  Alan Modra  <amodra@gmail.com>
2722
2723         PR 21181
2724         * elflink.c (bfd_elf_final_link): Make DT_REL/DT_RELA zero
2725         if DT_RELSZ/DT_RELASZ is zero.
2726
2727 2017-02-17  Nick Clifton  <nickc@redhat.com>
2728
2729         * compress.c (bfd_get_full_section_contents): Remember to reduce
2730         compressed size by the sizeof the compression header when
2731         decompressing the contents.
2732
2733 2017-02-17  Pedro Alves  <palves@redhat.com>
2734
2735         * srec.c (Chunk): Rename to ...
2736         (_bfd_srec_len): ... this.
2737         (S3Forced): Rename to ...
2738         (_bfd_srec_forceS3): ... this.
2739         * objcopy.c: Adjust all references.
2740
2741 2017-02-17  Pedro Alves  <palves@redhat.com>
2742
2743         * archive.c (bsd_write_armap): Rename to ...
2744         (_bfd_bsd_write_armap): ... this.
2745         (coff_write_armap): Rename to ...
2746         (_bfd_coff_write_armap): ... this.
2747         * libbfd-in.h (bsd_write_armap): Rename to ...
2748         (_bfd_bsd_write_armap): ... this.
2749         (coff_write_armap): Rename to ...
2750         (_bfd_coff_write_armap): ... this.
2751         * aout-target.h, aout-tic30.c: Adjust all users.
2752         * libbfd.h: Regenerate.
2753
2754 2017-02-17  Pedro Alves  <palves@redhat.com>
2755
2756         * bfd-in.h (bfd_read, bfd_write): Adjust to rename.
2757         (warn_deprecated): Rename to ...
2758         (_bfd_warn_deprecated): ... this.
2759         * libbfd.c (warn_deprecated): Rename to ...
2760         (_bfd_warn_deprecated): ... this.
2761         * bfd-in2.h: Regenerate.
2762
2763 2017-02-17  Pedro Alves  <palves@redhat.com>
2764
2765         * bfdio.c (real_ftell): Rename to ...
2766         (_bfd_real_ftell): ... this.
2767         (real_fseek): Rename to ...
2768         (_bfd_real_fseek): ... this.
2769         (real_fopen): Rename to ...
2770         (_bfd_real_fopen): ... this.
2771         * libbfd-in.h (real_ftell): Rename to ...
2772         (_bfd_real_ftell): ... this.
2773         (real_fseek): Rename to ...
2774         (_bfd_real_fseek): ... this.
2775         (real_fopen): Rename to ...
2776         (_bfd_real_fopen): ... this.
2777         * cache.c, dwarf2.c, opncls.c: Adjust all callers.
2778         * libbfd.h: Regenerate.
2779
2780 2017-02-17  Pedro Alves  <palves@redhat.com>
2781
2782         * dwarf2.c, elf-attrs.c, elf32-nds32.c: Adjust all callers.
2783         * libbfd.c (read_unsigned_leb128): Rename to ...
2784         (_bfd_read_unsigned_leb128): ... this.
2785         (read_signed_leb128): Rename to ...
2786         (_bfd_read_signed_leb128): ... this.
2787         (safe_read_leb128): Rename to ...
2788         (_bfd_safe_read_leb128): ... this.
2789         * libbfd-in.h (read_unsigned_leb128): Rename to ...
2790         (_bfd_read_unsigned_leb128): ... this.
2791         (read_signed_leb128): Rename to ...
2792         (_bfd_read_signed_leb128): ... this.
2793         (safe_read_leb128): Rename to ...
2794         (_bfd_safe_read_leb128): ... this.
2795         * libbfd.h: Renegerate.
2796
2797 2017-02-16  Andrew Burgess  <andrew.burgess@embecosm.com>
2798
2799         * dwarf2.c (_bfd_dwarf2_find_nearest_line): Perform symbol lookup
2800         before trying to fine matching file and line information.
2801
2802 2017-02-16  Andrew Burgess  <andrew.burgess@embecosm.com>
2803
2804         * dwarf2.c (struct dwarf2_debug): Add orig_bfd member.
2805         (_bfd_dwarf2_slurp_debug_info): If stashed debug information does
2806         not match current bfd, then reload debug information.  Record bfd
2807         we're loading debug info for in the stash.  If we have debug
2808         informatin in the cache then perform section placement before
2809         returning.
2810
2811 2017-02-16  Alan Modra  <amodra@gmail.com>
2812
2813         PR 21000
2814         * elf-bfd.h (struct elf_backend_data): Add no_page_alias.
2815         * elfxx-target.h (elf_backend_no_page_alias): Define.
2816         (elfNN_bed): Init new field.
2817         * elf.c (assign_file_positions_for_load_sections): If no_page_alias
2818         ensure PT_LOAD segment starts on a new page.
2819         * elf32-hppa.c (elf_backend_no_page_alias): Define.
2820
2821 2017-02-16  Alan Modra  <amodra@gmail.com>
2822
2823         PR 21132
2824         * elf32-hppa.c (allocate_plt_static): Allocate space for relocs
2825         if pic.
2826
2827 2017-02-16  Jiong Wang <jiong.wang@arm.com>
2828
2829         * bfd.c (BFD_FLAGS_SAVED): Add BFD_LINKER_CREATED.
2830         * bfd-in2.h: Regenerated.
2831
2832 2017-02-15  H.J. Lu  <hongjiu.lu@intel.com>
2833
2834         PR ld/21168
2835         * elf32-i386.c (elf_i386_relocate_section): Allow
2836         "lea foo@GOT, %reg" in PIC.
2837
2838 2017-02-15  H.J. Lu  <hongjiu.lu@intel.com>
2839
2840         PR ld/20244
2841         * elf32-i386.c (elf_i386_relocate_section): Properly get IFUNC
2842         symbol name when reporting R_386_GOT32/R_386_GOT32X relocation
2843         error against local IFUNC symbol without a base register for
2844         PIC.
2845
2846 2017-02-15  Maciej W. Rozycki  <macro@imgtec.com>
2847
2848         * elf32-ppc.c (ppc_elf_check_relocs): Use `%H:' rather than
2849         `%P: %H:' with `info->callbacks->einfo'.
2850         (ppc_elf_relocate_section): Likewise.
2851         * elf64-ppc.c (ppc64_elf_check_relocs): Likewise.
2852         (ppc64_elf_edit_toc): Likewise.
2853         (ppc64_elf_relocate_section): Likewise.
2854
2855 2017-02-14  Alan Modra  <amodra@gmail.com>
2856
2857         * elf64-ppc.c (ppc64_elf_gc_mark_dynamic_ref): Support
2858         --gc-keep-exported, and test versioned field of sym rather than
2859         looking for @ in name.
2860
2861 2017-02-13  Palmer Dabbelt  <palmer@dabbelt.com>
2862
2863         * elfnn-riscv.c (riscv_global_pointer_value): Change _gp to
2864         __global_pointer$.
2865
2866 2017-02-13  Nick Clifton  <nickc@redhat.com>
2867
2868         PR binutils/21151
2869         * dwarf2.c (_bfd_dwarf2_find_nearest_line): Check for an invalid
2870         unit length field.
2871
2872 2017-02-07  Andrew Waterman  <andrew@sifive.com>
2873
2874         * elfnn-riscv.c (riscv_elf_finish_dynamic_sections): Only write PLT
2875         entry size if PLT header is written.
2876
2877 2017-02-06  Sheldon Lobo  <sheldon.lobo@oracle.com>
2878
2879         Fix sparc64 dynamic relocation processing to use the dynamic
2880         symbol count.
2881         * elf64-sparc.c (elf64_sparc_slurp_one_reloc_table): Use 'dynamic'
2882         to determine if bfd_get_symcount() or bfd_get_dynamic_symcount()
2883         should be used.
2884
2885 2017-02-03  Nick Clifton  <nickc@redhat.com>
2886
2887         PR 21096
2888         * coffcode.h (coff_write_object_contents): Enlarge size of
2889         s_name_buf in order to avoid compile time warning about possible
2890         integer truncation.
2891         * elf32-nds32.c (nds32_elf_ex9_import_table): Mask off lower
2892         32-bits of insn value before printing into buffer.
2893
2894 2017-02-02  Maciej W. Rozycki  <macro@imgtec.com>
2895
2896         * elfxx-mips.c (mips_elf_hash_sort_data): Add
2897         `max_local_dynindx'.
2898         (mips_elf_sort_hash_table): Handle it.
2899         (mips_elf_sort_hash_table_f) <GGA_NONE>: For forced local
2900         symbols bump up `max_local_dynindx' rather than
2901         `max_non_got_dynindx'.
2902
2903 2017-02-02  Maciej W. Rozycki  <macro@imgtec.com>
2904
2905         * elfxx-mips.c (mips_elf_hash_sort_data): Convert the
2906         `min_got_dynindx', `max_unref_got_dynindx' and
2907         `max_non_got_dynindx' members to the `bfd_size_type' data type.
2908         (mips_elf_sort_hash_table): Adjust accordingly.
2909
2910 2017-02-02  Maciej W. Rozycki  <macro@imgtec.com>
2911
2912         * elfxx-mips.c (mips_elf_sort_hash_table): Use `htab' throughout
2913         to access the hash table.
2914
2915 2017-02-02  Maciej W. Rozycki  <macro@imgtec.com>
2916
2917         * elfxx-mips.c (mips_elf_sort_hash_table): Move assertion on
2918         non-NULL `htab' to the beginning.
2919
2920 2017-02-02  Maciej W. Rozycki  <macro@imgtec.com>
2921
2922         * elflink.c (elf_gc_sweep): Wrap overlong line.
2923
2924 2017-01-30  Maciej W. Rozycki  <macro@imgtec.com>
2925
2926         * elfxx-mips.h (_bfd_mips_elf_insn32): Rename prototype to...
2927         (_bfd_mips_elf_linker_flags): ... this.  Add another parameter.
2928         * elfxx-mips.c (mips_elf_link_hash_table): Add
2929         `ignore_branch_isa' member.
2930         (mips_elf_perform_relocation): Do not treat an ISA mode mismatch
2931         in branch relocation calculation as an error if
2932         `ignore_branch_isa' has been set.
2933         (_bfd_mips_elf_insn32): Rename to...
2934         (_bfd_mips_elf_linker_flags): ... this.  Rename the `on'
2935         parameter to `insn32' and add an `ignore_branch_isa' parameter.
2936         Handle the new parameter.
2937
2938 2017-01-27  Hans-Peter Nilsson  <hp@axis.com>
2939
2940         * elf32-cris.c (elf_cris_finish_dynamic_symbol): Remove now unused
2941         local variable dynobj.
2942
2943         PR ld/20995
2944         * elf32-cris.c (elf_cris_size_dynamic_sections): Handle sdynrelro.
2945         (elf_cris_adjust_dynamic_symbol): Place variables copied into the
2946         executable from read-only sections into sdynrelro.
2947         (elf_cris_finish_dynamic_symbol): Select sreldynrelro for
2948         dynamic relocs in sdynrelro.
2949         (elf_backend_want_dynrelro): Define.
2950
2951 2017-01-25  Sebastian Huber  <sebastian.huber@embedded-brains.de>
2952
2953         * config.bfd (*-*-rtemsaout*): Mark as removed.
2954
2955 2017-01-25  Sebastian Huber  <sebastian.huber@embedded-brains.de>
2956
2957         * config.bfd (powerpcle-*-rtems*): Do not mark as removed.
2958         (arm-*-rtems*): Move to (arm*-*-eabi*).
2959         (i[3-7]86-*-rtems*): Move to (i[3-7]86-*-elf*).
2960         (m68-*-rtems*): Move to (m68*-*-elf*).
2961
2962 2017-01-25  Sebastian Huber  <sebastian.huber@embedded-brains.de>
2963
2964         * config.bfd (*-*-rtemscoff*): Mark as removed.
2965
2966 2017-01-24  Maciej W. Rozycki  <macro@imgtec.com>
2967
2968         PR ld/20828
2969         * elflink.c (bfd_elf_record_link_assignment): Revert last
2970         change and don't ever clear `forced_local'.  Set `mark'
2971         unconditionally.
2972         (elf_gc_sweep_symbol_info, elf_gc_sweep_symbol): Reorder within
2973         file.
2974         (elf_gc_sweep): Move the call to `elf_gc_sweep_symbol'...
2975         (bfd_elf_size_dynamic_sections): ... here.
2976         * elf32-ppc.c (ppc_elf_tls_setup): Don't clear `forced_local'
2977         and set `mark' instead in `__tls_get_addr_opt' processing.
2978         * elf64-ppc.c (ppc64_elf_tls_setup): Likewise.
2979
2980 2017-01-24  Alan Modra  <amodra@gmail.com>
2981
2982         * elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Merge two cases
2983         where dynamic relocs are preferable.  Allow ifunc too.
2984         (ensure_undefweak_dynamic): New function.
2985         (allocate_dynrelocs): Use it here.  Move plt handling last and
2986         don't make symbols dynamic, simplifying loop.  Only make undef
2987         weak symbols with GOT entries dynamic.  Correct condition
2988         for GOT relocs.  Handle dynamic relocs on ifuncs.  Correct
2989         comments.  Remove goto.
2990         (ppc_elf_relocate_section): Correct test for using dynamic
2991         symbol on GOT relocs.  Rearrange test for emitting GOT relocs
2992         to suit.  Set up explicit tls_index entries and implicit GOT
2993         tls_index entries resolvable at link time for
2994         __tls_get_addr_opt.  Simplify test to clear mem for prelink.
2995         * elf64-ppc.c (allocate_got): Correct condition for GOT relocs.
2996         (ensure_undefweak_dynamic): New function.
2997         (allocate_dynrelocs): Use it here.  Only make undef weak symbols
2998         with GOT entries dynamic.  Remove unnecessary test of
2999         WILL_CALL_FINISH_DYNAMIC_SYMBOL in PLT handling.
3000         (ppc64_elf_relocate_section): Correct test for using dynamic
3001         symbol on GOT relocs.  Rearrange test for emitting GOT relocs
3002         to suit.  Set up explicit tls_index entries and implicit GOT
3003         tls_index entries resolvable at link time for __tls_get_addr_opt.
3004         Simplify expression to clear mem for prelink.
3005
3006 2017-01-23  Yury Norov  <ynorov@caviumnetworks.com>
3007
3008         * elfnn-aarch64.c: Fix relaxations for ILP32 mode.
3009
3010 2017-01-20  Jiong Wang <jiong.wang@arm.com>
3011
3012         * elfnn-aarch64.c (elf_aarch64_hash_symbol): New function.
3013         (elf_backend_hash_symbol): Define.
3014
3015 2017-01-18  Maciej W. Rozycki  <macro@imgtec.com>
3016
3017         PR ld/20828
3018         * elflink.c (bfd_elf_record_link_assignment): Clear any
3019         `forced_local' marking for DSO symbols that are not being
3020         provided.
3021
3022 2017-01-17  Kuan-Lin Chen  <kuanlinchentw@gmail.com>
3023
3024         * elfnn-riscv.c (riscv_elf_object_p): New function.
3025
3026 2017-01-12  H.J. Lu  <hongjiu.lu@intel.com>
3027
3028         PR ld/21038
3029         * elf64-x86-64.c (elf_x86_64_link_hash_table): Add
3030         plt_bnd_eh_frame.
3031         (elf_x86_64_check_relocs): Create .eh_frame section for the
3032         .plt.bnd section.
3033         (elf_x86_64_size_dynamic_sections): Allocate and initialize
3034         .eh_frame section for the .plt.bnd section.
3035         (elf_x86_64_finish_dynamic_sections): Adjust .eh_frame section
3036         for the .plt.bnd section.
3037
3038 2017-01-12  Nick Clifton  <nickc@redhat.com>
3039
3040         PR binutils/20876
3041         * opncls.c (find_separate_debug_file): Add include_dirs
3042         parameter.  Only include the directory part of the bfd's filename
3043         in search paths if include_dirs is true.  Add a couple of extra
3044         locations for looking for debug files.
3045         ( bfd_follow_gnu_debuglink): Update invocation of
3046         find_separate_debug_file.
3047         (bfd_follow_gnu_debugaltlink): Likewise.
3048         (get_build_id): New function: Finds the build-id of the given bfd.
3049         (get_build_id_name): New function: Computes the name of the
3050         separate debug info file for a bfd, based upon its build-id.
3051         (check_build_id_file): New function: Checks to see if a separate
3052         debug info file exists at the given location, and that its
3053         build-id matches that of the original bfd.
3054         (bfd_follow_build_id_debuglink): New function: Finds a separate
3055         debug info file for a given bfd by using the build-id method.
3056         * dwarf2.c (_bfd_dwarf2_slurp_debug_info): Try using the build-id
3057         method of locating a separate debug info file before using the
3058         debuglink method.
3059         * bfd-in2.h: Regenerate.
3060
3061 2017-01-11  H.J. Lu  <hongjiu.lu@intel.com>
3062
3063         PR ld/21038
3064         * elf64-x86-64.c (elf_x86_64_eh_frame_bnd_plt): New.
3065         (elf_x86_64_bnd_arch_bed): Use elf_x86_64_eh_frame_bnd_plt and
3066         elf_x86_64_eh_frame_plt_got.
3067         (elf_x86_64_size_dynamic_sections): Get unwind info from
3068         elf_x86_64_bnd_arch_bed for the BND PLT.
3069
3070 2017-01-11  Jeremy Soller  <jackpot51@gmail.com>
3071
3072         * config.bfd: Add entries for i686-redox and x86_64-redox.
3073
3074 2017-01-10  H.J. Lu  <hongjiu.lu@intel.com>
3075
3076         * elf32-i386.c (elf_i386_check_relocs): Align .eh_frame section
3077         to 4 bytes.
3078         * elf64-x86-64.c (elf_x86_64_create_dynamic_sections): Align
3079         .eh_frame section to 4 bytes for x32.
3080         (elf_x86_64_check_relocs): Likewise.
3081
3082 2017-01-10  H.J. Lu  <hongjiu.lu@intel.com>
3083
3084         PR ld/20830
3085         * elf32-i386.c (elf_i386_eh_frame_plt_got): New.
3086         (PLT_GOT_FDE_LENGTH): Likewise.
3087         (elf_i386_plt_layout): Add eh_frame_plt_got and
3088         eh_frame_plt_got_size.
3089         (elf_i386_plt): Updated.
3090         (elf_i386_link_hash_table): Add plt_got_eh_frame.
3091         (elf_i386_check_relocs): Create .eh_frame section for .plt.got.
3092         (elf_i386_size_dynamic_sections): Allocate and initialize
3093         .eh_frame section for .plt.got.
3094         (elf_i386_finish_dynamic_sections): Adjust .eh_frame section for
3095         .plt.got.
3096         (elf_i386_nacl_plt): Add FIXME for eh_frame_plt_got and
3097         eh_frame_plt_got_size.
3098         * elf64-x86-64.c (elf_x86_64_eh_frame_plt_got): New.
3099         (PLT_GOT_FDE_LENGTH): Likewise.
3100         (elf_x86_64_backend_data): Add eh_frame_plt_got and
3101         eh_frame_plt_got_size.
3102         (elf_x86_64_arch_bed): Updated.
3103         (elf_x86_64_bnd_arch_bed): Add FIXME for eh_frame_plt_got and
3104         eh_frame_plt_got_size.
3105         (elf_x86_64_nacl_arch_bed): Likewise.
3106         (elf_x86_64_link_hash_table): Add plt_got_eh_frame.
3107         (elf_x86_64_check_relocs): Create .eh_frame section for .plt.got.
3108         (elf_x86_64_size_dynamic_sections): Allocate and initialize
3109         .eh_frame section for .plt.got.
3110         (elf_x86_64_finish_dynamic_sections): Adjust .eh_frame section
3111         for .plt.got.
3112
3113 2017-01-10  H.J. Lu  <hongjiu.lu@intel.com>
3114
3115         * elf32-i386.c (elf_i386_size_dynamic_sections): Set
3116         plt_eh_frame->size to eh_frame_plt_size and use eh_frame_plt.
3117
3118 2017-01-09  Nick Clifton  <nickc@redhat.com>
3119
3120         * dwarf2.c (lookup_address_in_function_table): Return early if
3121         there are no functions in the given comp unit, or if the high
3122         address of the last function in the comp unit is less than the
3123         desired address.
3124
3125 2017-01-09  Nick Clifton  <nickc@redhat.com>
3126
3127         PR binutils/21013
3128         * coffgen.c (_bfd_coff_get_external_symbols): Generate an error
3129         message if there are too many symbols to load.
3130
3131 2017-01-04  James Clarke  <jrtc27@jrtc27.com>
3132
3133         * elf64-alpha.c (elf64_alpha_relax_opt_call): Don't set tsec_free
3134         if relocs are cached.
3135
3136 2017-01-03  Rich Felker  <bugdal@aerifal.cx>
3137
3138         PR ld/21017
3139         * elf32-microblaze.c (microblaze_elf_check_relocs): Add an entry
3140         for R_MICROBLAZE_GOTOFF_64.
3141
3142 2017-01-03  Nick Clifton  <nickc@redhat.com>
3143
3144         * mach-o.c (bfd_mach_o_lookup_uuid_command): Fix compile time
3145         warning about using a possibly uninitialised variable.
3146
3147 2017-01-02  Alan Modra  <amodra@gmail.com>
3148
3149         * elf32-hppa.c (ensure_undef_weak_dynamic): New function.
3150         (allocate_plt_static, allocate_dynrelocs): Use it.
3151
3152 2017-01-02  Alan Modra  <amodra@gmail.com>
3153
3154         * elf-hppa.h (elf_hppa_fake_sections): Set SHF_INFO_LINK for
3155         .PARISC.unwind section.
3156
3157 2017-01-02  Alan Modra  <amodra@gmail.com>
3158
3159         PR ld/20989
3160         * elfxx-sparc.c (gdop_relative_offset_ok): New function.
3161         (_bfd_sparc_elf_relocate_section): Use it to validate GOT
3162         indirect to GOT pointer relative code edit.
3163
3164 2017-01-02  Alan Modra  <amodra@gmail.com>
3165
3166         Update year range in copyright notice of all files.
3167
3168 For older changes see ChangeLog-2016
3169 \f
3170 Copyright (C) 2017 Free Software Foundation, Inc.
3171
3172 Copying and distribution of this file, with or without modification,
3173 are permitted in any medium without royalty provided the copyright
3174 notice and this notice are preserved.
3175
3176 Local Variables:
3177 mode: change-log
3178 left-margin: 8
3179 fill-column: 74
3180 version-control: never
3181 End: