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