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