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