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