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