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