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