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