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