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