]> Git Repo - binutils.git/blob - bfd/ChangeLog
PR26423 UBSAN: elf32-arm.c:10237 left shift cannot be represented
[binutils.git] / bfd / ChangeLog
1 2020-09-01  Alan Modra  <[email protected]>
2
3         PR 26423
4         * elf32-arm.c (calculate_group_reloc_mask): Use 3u in shift.
5
6 2020-08-31  Alan Modra  <[email protected]>
7
8         PR 26493
9         * elfnn-riscv.c (riscv_make_plt_header): Cast PLT_HEADER_SIZE to
10         unsigned when using with RISCV_ITYPE.
11         (_bfd_riscv_relax_call): Use an unsigned foff.
12
13 2020-08-31  Alan Modra  <[email protected]>
14
15         PR 26476
16         PR 26477
17         * elfxx-mips.c (CRINFO_CTYPE, CRINFO_RTYPE, CRINFO_DIST2TO),
18         (CRINFO_RELVADDR): Make unsigned.
19         (mips_elf_nullify_got_load): Use unsigned constant when shifting
20         into sign bit.
21
22 2020-08-31  Alan Modra  <[email protected]>
23
24         PR 26466
25         * mep-relocs.pl (emit_apply): Handle HI16S adjustment.  Use "u"
26         variable and rewrite signed overflow check.
27         * elf32-mep.c: Regenerate.
28         (mep_final_link_relocate): Delete "s".
29
30 2020-08-31  Alan Modra  <[email protected]>
31
32         PR 26461
33         * elfxx-ia64.c (ia64_elf_install_value): Make expressions unsigned
34         that might shift values into sign bit.
35
36 2020-08-31  Alan Modra  <[email protected]>
37
38         PR 26445
39         * elf32-csky.c (csky_relocate_contents): Make relocation a bfd_vma,
40         and similarly for variables dealing with overflow.
41
42 2020-08-31  Alan Modra  <[email protected]>
43
44         PR 26442
45         * elf32-crx.c (crx_elf_final_link_relocate): Calculate reloc_bits
46         without undefined behaviour.  Tidy excess casts.
47
48 2020-08-31  Alan Modra  <[email protected]>
49
50         * elf-m10300.c (mn10300_elf_relax_delete_bytes): Calculate
51         alignment from reloc addend after reloc type R_MN10300_ALIGN is
52         found.
53
54 2020-08-30  Alan Modra  <[email protected]>
55
56         PR 26435
57         PR 26436
58         * elf32-cr16.c (cr16_elf_final_link_relocate): Calculate reloc_bits
59         without undefined behaviour.
60
61 2020-08-29  Nick Clifton  <[email protected]>
62
63         PR 26520
64         * dwarf2.c (scan_unit_for_symbols): Add member entries to the
65         variable table.
66
67 2020-08-29  Alan Modra  <[email protected]>
68
69         PR 26459
70         * elfnn-ia64.c (get_dyn_sym_info): Don't bsearch or look at last
71         element when count is zero.  bfd_realloc when shrinking.
72
73 2020-08-28  Alan Modra  <[email protected]>
74
75         PR 26418
76         * ecofflink.c (bfd_ecoff_write_accumulated_debug): Don't write
77         zero size buffers.
78
79 2020-08-28  Alan Modra  <[email protected]>
80
81         PR 26418
82         * ecofflink.c (WRITE): Really don't write zero size chunks.
83
84 2020-08-28  Tuckker  <[email protected]>
85
86         PR 26543
87         * linker.c (bfd_generic_define_common_symbol): Force the alignment
88         to 1 if the section has now alignment requirement.
89
90 2020-08-28  Cooper Qu  <[email protected]>
91
92         * elf32-csky.c (csky_archs): Fix arch names.
93         (csky_find_arch_with_name): New.
94         (elf32_csky_merge_attributes): New.
95         (csky_elf_merge_private_bfd_data): Add process of merge
96         attribute section.
97         (elf32_csky_obj_attrs_arg_type): New.
98         (elf32_csky_obj_attrs_handle_unknown): New.
99         (elf_backend_obj_attrs_vendor): Define.
100         (elf_backend_obj_attrs_section): Define.
101         (elf_backend_obj_attrs_arg_type): Define.
102         (elf_backend_obj_attrs_section_type): Define.
103
104 2020-08-28  Nick Clifton  <[email protected]>
105
106         PR19011
107         * cofflink.c (_bfd_coff_generic_relocate_section): Provide a value
108         for undefined symbols which will not generate extra warning
109         messages about truncated relocs.
110
111 2020-08-28  Nelson Chu  <[email protected]>
112
113         * elfnn-riscv.c (riscv_elf_check_relocs): Treat R_RISCV_CALL
114         and R_RISCV_CALL_PLT as the same in the riscv_elf_check_relocs.
115         (riscv_elf_relocate_section): Remove the R_RISCV_CALL for the
116         unresolved reloc checks.
117
118 2020-08-27  John David Anglin  <[email protected]>
119
120         PR 26356
121         * som.c (som_bfd_copy_private_section_data): Issue error when a
122         subspace is specified without its containing space.
123
124 2020-08-27  Alan Modra  <[email protected]>
125
126         PR 26469
127         * elflink.c: Include limits.h.
128         (CHAR_BIT): Provide fallback define.
129         (set_symbol_value): Correct complex reloc comment.
130         (undefined_reference): Set bfd_error.
131         (BINARY_OP_HEAD, BINARY_OP_TAIL): Split out from..
132         (BINARY_OP): ..this.
133         (eval_symbol): Limit shifts.  Force unsigned for left shift.
134         Catch divide by zero.
135         * configure.ac (AC_CHECK_HEADERS): Combine, sort and add limits.h.
136         * configure: Regenerate.
137         * config.in: Regenerate.
138
139 2020-08-27  Alan Modra  <[email protected]>
140
141         PR 26462
142         * reloc.c (bfd_check_overflow): Return early if zero bitsize.
143
144 2020-08-27  Alan Modra  <[email protected]>
145
146         * elf32-arm.c (elf32_arm_final_link_relocate): Don't segfault
147         on sym_sec not being output.
148
149 2020-08-27  Alan Modra  <[email protected]>
150
151         PR 26416
152         * elf64-alpha.c (elf64_alpha_relax_tls_get_addr): Correct "dynamic".
153
154 2020-08-26  Nick Clifton  <[email protected]>
155
156         PR 26433
157         * elf32-avr.c (avr_final_link_relocate):  Fix undefined shift
158         behaviour.
159         (avr_elf32_load_records_from_section): Use bfd_get_16 and
160         bfd_get_32 to load values from potentially unaligned pointers.
161
162         PR 26416
163         * elf64-alpha.c (elf64_alpha_relax_tls_get_addr): Test for and
164         ignore local symbols.
165         (elf64_alpha_relax_got_load): Do not check for local dynamic
166         symbols.
167         (OP_LDA, OP_LDAH, OP_LDQ, OP_BR, OP_BSR): Use unsigned constant
168         values.
169         (INSN_A) Cast the A parameter to unsigned.
170         (INSN_AB): Define in terms of INSN_A.
171         (INSN_ABC): Likewise.
172         (INSN_ABO): Likewise.
173         (INSN_AD): Likewise.
174
175         PR 26411
176         * elfnn-aarch64.c (elfNN_aarch64_relocate_section): Use an
177         unsigned long constant when creating a mask to test for alignment
178         issues.
179
180 2020-08-26  Alan Modra  <[email protected]>
181
182         PR 26507
183         * elf32-xtensa.c (find_removed_literal): Don't bsearch empty map.
184
185 2020-08-26  Alan Modra  <[email protected]>
186
187         PR 26506
188         * elf32-xtensa.c (elf_xtensa_combine_prop_entries): Return early
189         when section is empty.
190
191 2020-08-26  Alan Modra  <[email protected]>
192
193         PR 26498
194         * elf32-spu.c (find_function_stack_adjust): Use unsigned vars to
195         avoid UB left shift.
196
197 2020-08-26  Alan Modra  <[email protected]>
198
199         PR 26484
200         PR 26485
201         PR 26486
202         PR 26487
203         PR 26488
204         PR 26490
205         * elf64-ppc.c (is_tls_get_addr): Avoid UB &h->elf when h is NULL.
206         (ppc64_elf_tls_setup): Likewise.
207         (branch_reloc_hash_match): Likewise.
208         (build_plt_stub): Likewise.
209         (ppc64_elf_relocate_section): Likewise.
210
211 2020-08-26  Alan Modra  <[email protected]>
212
213         PR 26478
214         * mmo.c (mmo_write_symbols_and_terminator): Don't memcpy empty table.
215
216 2020-08-26  Alan Modra  <[email protected]>
217
218         PR 26475
219         * elfxx-mips.c (_bfd_mips_elf_finish_dynamic_sections): Check
220         sstubs->contents != NULL.
221
222 2020-08-26  Alan Modra  <[email protected]>
223
224         PR 26453
225         * som.c (som_prep_for_fixups): Return early when no symbols.
226
227 2020-08-26  Alan Modra  <[email protected]>
228
229         PR 26418
230         * ecofflink.c (WRITE): Don't write size 0 chunks.
231
232 2020-08-26  Alan Modra  <[email protected]>
233
234         * bfdio.c (bfd_get_file_size): Don't segv on NULL adata.
235
236 2020-08-26  Alan Modra  <[email protected]>
237
238         PR 26415
239         * vms-misc.c (vms_time_t_to_vms_time): Don't use unsigned short vars.
240
241 2020-08-26  David Faust  <[email protected]>
242
243         * archures.c (bfd_mach_xbpf): Define.
244         * bfd-in2.h: Regenerate.
245         * cpu-bpf.c (bfd_xbpf_arch) New.
246         (bfd_bpf_arch) Update next in list field to point to xbpf arch.
247
248 2020-08-26  Alan Modra  <[email protected]>
249
250         * archures.c (bfd_mach_ck860): Define.
251
252 2020-08-25  Mark Wielaard  <[email protected]>
253
254         *  dwarf2.c (struct dwarf2_debug_file): Add dwarf_rnglists_buffer
255         and dwarf_rnglists_size fields.
256         (dwarf_debug_sections): Add debug_rnglists.
257         (dwarf_debug_section_enum): Likewise.
258         (read_debug_rnglists): New function.
259         (read_rangelist): New function to call either read_ranges or
260         read_rnglists. Rename original function to...
261         (read_ranges): ...this.
262         (read_rnglists): New function.
263
264 2020-08-25  Alan Modra  <[email protected]>
265
266         PR 26505
267         * elf32-xstormy16.c (xstormy16_elf_relax_section): Check
268         is_elf_hash_table before accessing elf fields.
269
270 2020-08-25  Alan Modra  <[email protected]>
271
272         PR 26482
273         * coff-rs6000.c (_bfd_xcoff_sizeof_headers): Ignore sections that
274         won't be output.
275
276 2020-08-25  Alan Modra  <[email protected]>
277
278         PR 26463
279         * elf32-m32c.c (m32c_elf_relax_section): Check is_elf_hash_table
280         before accessing elf fields.
281
282 2020-08-25  Alan Modra  <[email protected]>
283
284         PR 26452
285         * som.c (som_compute_checksum): XOR 32-bit words in header,
286         not unsigned long sized words.
287
288 2020-08-25  Alan Modra  <[email protected]>
289
290         PR 26430
291         * elf-nacl.c (nacl_modify_segment_map): Correct alloc size and
292         amount copied for elf_segment_map defined with one element
293         sections array.
294
295 2020-08-25  Alan Modra  <[email protected]>
296
297         PR 26422
298         * elf32-arm.c (elf32_arm_final_link_relocate): Use the appropriate
299         bfd_get_x size function to read addends out of fields.  Apply
300         rightshift adjustment too.  Don't apply the now unnecessary
301         howto->size shift to branch REL addends.  Don't refetch R_ARM_ABS8
302         and R_ARM_ABS16 addends.  Don't refetch thumb branch addends.
303         Correct R_ARM_THM_JUMP6 addend.
304
305 2020-08-25  Alan Modra  <[email protected]>
306
307         PR 26419
308         * elf-m10300.c (mn10300_elf_relax_section): Don't attempt access
309         before start of section.
310
311 2020-08-25  Alan Modra  <[email protected]>
312
313         * elf-m10300.c (elf32_mn10300_hash_table): Test is_elf_hash_table
314         before accessing elf_hash_table_id.
315         * elf32-arc.c (elf_arc_hash_table): Likewise.
316         * elf32-arm.c (elf32_arm_hash_table): Likewise.
317         * elf32-avr.c (avr_link_hash_table): Likewise.
318         * elf32-bfin.c (bfinfdpic_hash_table): Likewise.
319         * elf32-cris.c (elf_cris_hash_table): Likewise.
320         * elf32-csky.c (csky_elf_hash_table): Likewise.
321         * elf32-frv.c (frvfdpic_hash_table): Likewise.
322         * elf32-hppa.c (hppa_link_hash_table): Likewise.
323         * elf32-lm32.c (lm32_elf_hash_table): Likewise.
324         * elf32-m32r.c (m32r_elf_hash_table): Likewise.
325         * elf32-m68hc1x.h (m68hc11_elf_hash_table): Likewise.
326         * elf32-m68k.c (elf_m68k_hash_table): Likewise.
327         * elf32-metag.c (metag_link_hash_table): Likewise.
328         * elf32-microblaze.c (elf32_mb_hash_table): Likewise.
329         * elf32-nds32.h (nds32_elf_hash_table): Likewise.
330         * elf32-or1k.c (or1k_elf_hash_table): Likewise.
331         * elf32-s390.c (elf_s390_hash_table): Likewise.
332         * elf32-sh.c (sh_elf_hash_table): Likewise.
333         * elf32-spu.c (spu_hash_table): Likewise.
334         * elf32-tilepro.c (tilepro_elf_hash_table): Likewise.
335         * elf32-xtensa.c (elf_xtensa_hash_table): Likewise.
336         * elf64-alpha.c (alpha_elf_hash_table): Likewise.
337         * elf64-hppa.c (hppa_link_hash_table): Likewise.
338         * elf64-ia64-vms.c (elf64_ia64_hash_table): Likewise.
339         * elf64-s390.c (elf_s390_hash_table): Likewise.
340         * elfnn-ia64.c (elfNN_ia64_hash_table): Likewise.
341         * elfnn-riscv.c (riscv_elf_hash_table): Likewise.
342         * elfxx-mips.c (mips_elf_hash_table): Likewise.
343         * elfxx-sparc.h (_bfd_sparc_elf_hash_table): Likewise.
344         * elfxx-tilegx.c (tilegx_elf_hash_table): Likewise.
345
346 2020-08-21  Jon Turney  <[email protected]>
347
348         * elf.c (elfcore_grok_win32pstatus): Change name_size to unsigned
349         int. Use '%u' format with  _bfd_error_handler to render it.
350
351 2020-08-25  Alan Modra  <[email protected]>
352
353         PR 26489
354         * elf64-ppc.c (ppc64_elf_size_stubs): Test code_sec->has_toc_reloc
355         and code_sec->makes_toc_func_call before sec_info[code_sec->id].
356
357 2020-08-25  Alan Modra  <[email protected]>
358
359         PR 26492
360         * elf64-ppc.c (ppc_hash_table): Test is_elf_hash_table before
361         accessing elf_hash_table_id.
362
363 2020-08-25  Alan Modra  <[email protected]>
364
365         PR 26483
366         * elf32-ppc.c (ppc_elf_hash_table): Test is_elf_hash_table before
367         accessing elf_hash_table_id.
368
369 2020-08-24  Mark Wielaard  <[email protected]>
370
371         * dwarf2.c (read_attribute_value): Handle DW_FORM_data16.
372         (read_formatted_entries): Likewise. And skip zero entry.
373
374 2020-08-24  Cooper Qu  <[email protected]>
375
376         * bfd-in2.h (bfd_mach_ck860): New.
377         * cpu-csky.c (arch_info_struct): Add item for CK860.
378
379 2020-08-24  Alan Modra  <[email protected]>
380
381         * elf32-ppc.c (ppc_elf_check_relocs): Set has_tls_reloc for
382         high part tprel16 relocs.
383         (ppc_elf_tls_optimize): Sanity check high part tprel16 relocs.
384         Clear do_tls_opt on odd instructions.
385         (ppc_elf_relocate_section): Move TPREL16_HA/LO optimisation later.
386         Don't sanity check them here.
387         * elf64-ppc.c (ppc64_elf_check_relocs): Set has_tls_reloc for
388         high part tprel16 relocs.
389         (ppc64_elf_tls_optimize): Sanity check high part tprel16 relocs.
390         Clear do_tls_opt on odd instructions.
391         (ppc64_elf_relocate_section): Don't sanity check TPREL16_HA.
392
393 2020-08-23  John David Anglin  <[email protected]>
394
395         PR binutils/26357
396         * configure.ac: Disable plugins by default on 32-bit hppa*-*-hpux*.
397         * configure: Regenerate.
398
399 2020-08-22  H.J. Lu  <[email protected]>
400
401         PR ld/26382
402         * elflink.c (elf_link_output_symstrtab): Keep only one '@' for
403         versioned symbols, which are defined in shared objects, in
404         symbol string table.
405
406 2020-08-21  Nick Clifton  <[email protected]>
407
408         * elfnn-aarch64.c (_bfd_aarch64_erratum_835769_scan): Only sort
409         the data map if there are entries in it.
410         (_bfd_aarch64_erratum_843419_scan): Likewise.
411
412 2020-08-21  Jan Beulich  <[email protected]>
413
414         * peXXigen.c (_bfd_XX_bfd_copy_private_bfd_data_common): Check
415         last byte of debug dir, not first.
416
417 2020-08-20  Nick Clifton  <[email protected]>
418
419         PR 26428
420         * bfd.c (bfd_update_compression_header): Also set the sh_addralign
421         field in the ELF header of the compressed sections.
422
423 2020-08-20  Nick Clifton  <[email protected]>
424
425         PR 26406
426         * elf-bfd.h (struct bfd_elf_section_data): Add
427         has_secondary_relocs field.
428         * elf.c (_bfd_elf_copy_special_section_fields): Set the
429         has_secondary_relocs field for sections which have associated
430         secondary relocs.
431         * elfcode.h (elf_write_relocs): Only call write_secondary_relocs
432         on sections which have associated secondary relocs.
433
434 2020-08-15  Alan Modra  <[email protected]>
435
436         * elf32-frv.c (elf32_frv_add_symbol_hook): Set SEC_SMALL_DATA on
437         small common section.
438         * elf32-m32r.c (m32r_elf_add_symbol_hook): Likewise.
439         * elf32-microblaze.c (microblaze_elf_add_symbol_hook): Likewise.
440         * elf32-nds32.c (nds32_elf_add_symbol_hook): Likewise.
441         * elf32-nios2.c (nios2_elf_add_symbol_hook): Likewise.
442         * elf32-ppc.c (ppc_elf_add_symbol_hook): Likewise.
443         * elf32-score.c (s3_bfd_score_elf_add_symbol_hook): Likewise.
444         * elf32-score7.c (s7_bfd_score_elf_add_symbol_hook): Likewise.
445         * elf32-tic6x.c (elf32_tic6x_add_symbol_hook): Likewise.
446         * elf32-v850.c (v850_elf_check_relocs): Likewise.
447         (v850_elf_add_symbol_hook): Likewise.
448         * elf64-alpha.c (elf64_alpha_add_symbol_hook): Likewise.
449         * elf64-ia64-vms.c (elf64_ia64_add_symbol_hook): Likewise.
450         * elfnn-ia64.c (elfNN_ia64_add_symbol_hook): Likewise.
451         * elfxx-mips.c (_bfd_mips_elf_add_symbol_hook): Likewise.
452
453 2020-08-15  Alan Modra  <[email protected]>
454
455         PR 26389
456         * syms.c (bfd_decode_symclass): Choose 'c' for commons only when
457         SEC_SMALL_DATA.
458         * elf32-m32r.c (_bfd_m32r_elf_symbol_processing): Set SEC_SMALL_DATA
459         on small common section.
460         * elf32-score.c (s3_bfd_score_elf_symbol_processing): Likewise.
461         * elf32-score7.c (s7_bfd_score_elf_symbol_processing): Likewise.
462         * elf32-tic6x.c (elf32_tic6x_symbol_processing): Likewise.
463         * elf32-v850.c (v850_elf_symbol_processing): Likewise.
464         * elfxx-mips.c (_bfd_mips_elf_symbol_processing): Likewise.
465         * ecoff.c (ecoff_set_symbol_info, ecoff_link_add_externals): Likewise.
466
467 2020-08-14  Alan Modra  <[email protected]>
468
469         * hash.c (bfd_hash_set_default_size): Use higher_prime_number
470         rather than another copy of primes.  Increase maximum default
471         size allowed.
472
473 2020-08-13  Alan Modra  <[email protected]>
474
475         * config.bfd: Obsolete arm*-*-symbianelf*, and ia64*-*-*.
476
477 2020-08-13  Alan Modra  <[email protected]>
478
479         * elf64-ppc.h (struct ppc64_elf_params): Add no_pcrel_opt.
480         * elf64-ppc.c (ppc64_elf_relocate_section): Disable GOT reloc
481         optimizations when --no-toc-optimize.  Disable R_PPC64_PCREL_OPT
482         optimization when --no-pcrel-optimize.
483
484 2020-08-13  Alan Modra  <[email protected]>
485
486         PR 26348
487         * bfd.c (struct bfd): Add read_only.
488         * elfcode.h (elf_swap_shdr_in): Test both sh_offset and sh_size.
489         Set read_only on warning.
490         (elf_object_p): Sanity check program header alignment.  Set
491         read_only on warning.
492         * bfd-in2.h: Regenerate.
493
494 2020-08-12  Jon Turney  <[email protected]>
495
496         * elf.c (elfcore_grok_win32pstatus): Use unsigned int for
497         win32pstatus note type to avoid signedness comparison warning.
498
499 2020-07-21  Jon Turney  <[email protected]>
500
501         * elf.c (elfcore_grok_win32pstatus): Warn on malformed
502         win32pstatus notes, and return TRUE so we continue rather than
503         stopping as if it was an error.
504
505 2020-07-01  Jon Turney  <[email protected]>
506
507         * elf.c (elfcore_grok_win32pstatus): Handle NOTE_INFO_MODULE64.
508
509 2020-07-11  Jon Turney  <[email protected]>
510
511         * elf.c (elfcore_grok_win32pstatus): Don't apply size constraint
512         for NOTE_INFO_THREAD to all win32pstatus ELF notes, instead apply
513         appropriate size constraint for each win32pstatus note type.
514
515 2020-07-01  Jon Turney  <[email protected]>
516
517         * elf.c (elfcore_grok_win32pstatus): Don't hardcode the size of
518         the Win32 API thread CONTEXT type read from a NOTE_INFO_THREAD
519         win32pstatus note.
520
521 2020-07-11  Jon Turney  <[email protected]>
522
523         * elf.c (NOTE_INFO{_PROCESS,_THREAD,_MODULE}): Define.
524         (elfcore_grok_win32pstatus): Use.
525
526 2020-07-01  Jon Turney  <[email protected]>
527
528         * elf.c (elfcore_grok_win32pstatus): Fix the offset used to read
529         the tid from a win32pstatus NOTE_INFO_THREAD ELF note.  Fix
530         offsets used to read NOTE_INFO_PROCESS.
531
532 2020-08-12  Nick Clifton  <[email protected]>
533
534         * po/ru.po: Updated Russian translation.
535         * po/sr.po: Updated Serbian translation.
536
537 2020-08-07  David Faust  <[email protected]>
538
539         * elf64-bpf.c (bpf_elf_relocate_section): Ensure signed division for
540         DISP16 and DISP32 relocations.
541
542 2020-08-05  David Faust  <[email protected]>
543
544         * elf64-bpf.c (bpf_elf_generic_reloc): New function.
545         (bpf_elf_howto_table): Use it here.
546         (bpf_elf_relocate_section): Use addends recorded in input_bfd for
547         instruction and data relocations.
548
549 2020-08-03  Alan Modra  <[email protected]>
550
551         * vms-lib.c (vms_traverse_index): Sanity check size remaining
552         before accessing vms_idx or vms_elfidx.
553
554 2020-08-03  Alan Modra  <[email protected]>
555
556         PR 26330
557         * elf.c (_bfd_elf_get_symtab_upper_bound): Sanity check symbol table
558         size against file size.  Correct LONG_MAX limit check.
559         (_bfd_elf_get_dynamic_symtab_upper_bound): Likewise.
560         (_bfd_elf_get_reloc_upper_bound): Don't check file size if writing.
561         (_bfd_elf_get_dynamic_reloc_upper_bound): Likewise.
562         * elf64-x86-64-.c (elf_x86_64_get_synthetic_symtab): Use
563         bfd_malloc_and_get_section.
564
565 2020-07-31  Alan Modra  <[email protected]>
566
567         PR 26314
568         * elflink.c (bfd_elf_link_record_dynamic_symbol): Don't allow
569         IR symbols to become dynamic.
570         (elf_link_add_object_symbols): Don't exclude IR symbols when
571         deciding whether an as-needed shared library is needed.
572
573 2020-07-30  Szabolcs Nagy  <[email protected]>
574
575         PR ld/26312
576         * elfnn-aarch64.c (elfNN_aarch64_init_small_plt0_entry): Set sh_entsize
577         to 0.
578         (elfNN_aarch64_finish_dynamic_sections): Remove sh_entsize setting.
579
580 2020-07-30  Rainer Orth  <[email protected]>
581
582         * bfd.m4 (BFD_SYS_PROCFS_H): New macro.
583         (BFD_HAVE_SYS_PROCFS_TYPE): Require BFD_SYS_PROCFS_H.
584         Don't define _STRUCTURED_PROC.
585         (BFD_HAVE_SYS_PROCFS_TYPE_MEMBER): Likewise.
586         * elf.c [HAVE_SYS_PROCFS_H] (_STRUCTURED_PROC): Don't define.
587         * configure.ac: Use BFD_SYS_PROCFS_H to check for <sys/procfs.h>.
588         * configure, config.in: Regenerate.
589         * Makefile.am (AM_CPPFLAGS): Add LARGEFILE_CPPFLAGS.
590         * Makefile.in, doc/Makefile.in: Regenerate.
591
592 2020-07-30  H.J. Lu  <[email protected]>
593
594         * elf-bfd.h (sym_cache): Moved before elf_link_hash_table.
595         (elf_link_hash_table): Add sym_cache.
596         * elf32-arm.c (elf32_arm_link_hash_table): Remove sym_cache.
597         (elf32_arm_check_relocs): Updated.
598         (elf32_arm_size_dynamic_sections): Likewise.
599         * elf32-bfin.c (bfin_link_hash_table): Removed.
600         (bfin_link_hash_newfunc): Updated.
601         (bfin_hash_table): Removed.
602         * elf32-csky.c (csky_elf_link_hash_table): Remove sym_cache.
603         (csky_elf_check_relocs): Updated.
604         * elf32-hppa.c (elf32_hppa_link_hash_table): Remove sym_cache.
605         (elf32_hppa_check_relocs): Updated.
606         * elf32-i386.c (elf_i386_tls_transition): Updated.
607         (elf_i386_convert_load_reloc): Likewise.
608         (elf_i386_check_relocs): Likewise.
609         * elf32-m32r.c (elf_m32r_link_hash_table): Removed.
610         (m32r_elf_hash_table): Updated.
611         (m32r_elf_link_hash_table_create): Likewise.
612         (m32r_elf_create_dynamic_sections): Likewise.
613         (m32r_elf_adjust_dynamic_symbol): Likewise.
614         (allocate_dynrelocs): Likewise.
615         (m32r_elf_size_dynamic_sections): Likewise.
616         (m32r_elf_relocate_section): Likewise.
617         (m32r_elf_finish_dynamic_symbol): Likewise.
618         (m32r_elf_check_relocs): Likewise.
619         * elf32-m68hc1x.h (m68hc11_elf_link_hash_table): Remove
620         sym_cache.
621         * elf32-m68k.c (elf_m68k_link_hash_table): Likewise.
622         (elf_m68k_check_relocs): Updated.
623         * elf32-metag.c (elf_metag_link_hash_table): Remove sym_cache.
624         (elf_metag_check_relocs): Updated.
625         * elf32-microblaze.c (elf32_mb_link_hash_table): Remove sym_sec.
626         (microblaze_elf_check_relocs): Updated.
627         * elf32-nds32.c (nds32_elf_link_hash_table_create): Likewise.
628         (nds32_elf_create_dynamic_sections): Likewise.
629         (nds32_elf_adjust_dynamic_symbol): Likewise.
630         (nds32_elf_check_relocs): Likewise.
631         * elf32-nds32.h (elf_nds32_link_hash_table): Remove sdynbss,
632         srelbss and aym_cache.
633         * elf32-nios2.c (elf32_nios2_link_hash_table): Remove sym_cache.
634         (nios2_elf32_check_relocs): Updated.
635         * elf32-or1k.c (elf_or1k_link_hash_table): Remove sym_sec.
636         (or1k_elf_check_relocs): Updated.
637         * elf32-ppc.c (ppc_elf_check_relocs): Remove sym_cache.
638         (ppc_elf_check_relocs): Updated.
639         * elf32-s390.c (elf_s390_link_hash_table): Remove sym_cache.
640         (elf_s390_check_relocs): Updated.
641         (elf_s390_finish_dynamic_sections): Likewise.
642         * elf32-sh.c (elf_sh_link_hash_table): Remove sdynbss, srelbss
643         and aym_cache.
644         (sh_elf_create_dynamic_sections): Updated.
645         (sh_elf_adjust_dynamic_symbol): Likewise.
646         (sh_elf_size_dynamic_sections): Likewise.
647         (sh_elf_check_relocs): Likewise.
648         * elf32-tic6x.c (elf32_tic6x_link_hash_table): Remove sym_cache.
649         (elf32_tic6x_check_relocs): Updated.
650         * elf32-tilepro.c (tilepro_elf_link_hash_table): Removed.
651         (tilepro_elf_hash_table): Updated.
652         (tilepro_elf_link_hash_table_create): Likewise.
653         (tilepro_elf_check_relocs): Likewise.
654         (tilepro_elf_adjust_dynamic_symbol): Likewise.
655         (allocate_dynrelocs): Likewise.
656         (tilepro_elf_size_dynamic_sections): Likewise.
657         (tilepro_elf_relocate_section): Likewise.
658         (tilepro_elf_finish_dynamic_symbol): Likewise.
659         (tilepro_finish_dyn): Likewise.
660         (tilepro_elf_finish_dynamic_sections): Likewise.
661         * elf64-ppc.c (ppc_link_hash_table): Remove sym_cache.
662         (ppc64_elf_before_check_relocs): Updated.
663         (ppc64_elf_check_relocs): Likewise.
664         * elf64-s390.c (elf_s390_link_hash_table): Remove sym_cache.
665         (elf_s390_check_relocs): Updated.
666         (elf_s390_relocate_section): Likewise.
667         (elf_s390_finish_dynamic_sections): Likewise.
668         * elf64-x86-64.c (elf_x86_64_tls_transition): Likewise.
669         (elf_x86_64_check_relocs): Likewise.
670         * elfnn-aarch64.c (elf_aarch64_link_hash_table): Remove
671         sym_cache.
672         (elfNN_aarch64_check_relocs): Updated.
673         * elfnn-riscv.c (riscv_elf_link_hash_table): Remove sym_cache.
674         (riscv_elf_check_relocs): Updated.
675         * elfxx-mips.c (mips_elf_link_hash_table): Remove sym_cache.
676         (mips_elf_resolve_got_page_ref): Updated.
677         * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Likewise.
678         * elfxx-sparc.h (_bfd_sparc_elf_link_hash_table): Remove
679         sym_cache.
680         * elfxx-tilegx.c (tilegx_elf_link_hash_table): Likewise.
681         (tilegx_elf_check_relocs): Updated.
682         * elfxx-x86.h (elf_x86_link_hash_table): Remove sym_cache.
683
684 2020-07-29  Maciej W. Rozycki  <[email protected]>
685
686         * elflink.c (bfd_elf_final_link): Give local symbols a name if
687         so requested.
688         * elfxx-mips.c (_bfd_mips_elf_name_local_section_symbols): Only
689         return TRUE if making ET_REL output.
690
691 2020-07-29  Maciej W. Rozycki  <[email protected]>
692
693         * elf-bfd.h (elf_backend_data): Add
694         `elf_backend_elfsym_local_is_section' member.
695         * elfxx-target.h (elf_backend_elfsym_local_is_section): New
696         macro.
697         (elfNN_bed): Add `elf_backend_elfsym_local_is_section' member.
698         * elflink.c (bfd_elf_final_link): Use it to determine whether
699         set the `.symtab' section's `sh_info' value to the index of the
700         first non-local or non-section symbol.
701         * elf32-mips.c (mips_elf32_elfsym_local_is_section): New
702         function.
703         (elf_backend_elfsym_local_is_section): New macro.
704         * elfn32-mips.c (mips_elf_n32_elfsym_local_is_section): New
705         function.
706         (elf_backend_elfsym_local_is_section): New macro.
707
708 2020-07-29  Alan Modra  <[email protected]>
709
710         * elflink.c (bfd_elf_final_link): Don't segfault on local dynsyms
711         defined in excluded sections.
712
713 2020-07-28  Alan Modra  <[email protected]>
714
715         * elf.c (assign_section_numbers): Comment.  Don't segfault on
716         discarded sections when setting linked-to section for generic
717         ELF linker.
718         * elflink.c (bfd_elf_match_symbols_in_sections): Allow NULL info.
719
720 2020-07-27  Alan Modra  <[email protected]>
721
722         * xcofflink.c (xcoff_need_ldrel_p): Accept --just-symbols symbols and
723         similar as absolute.
724         (bfd_xcoff_import_symbol): Don't fuss over absolute symbol
725         redefinitions here.
726
727 2020-07-24  Nick Clifton  <[email protected]>
728
729         * config.bfd: Move xc16x target to the obsolete list.
730
731 2020-07-22  Kevin Buettner  <[email protected]>
732
733         * binary.c (binary_get_section_contents): Seek using offset
734         from section's file position.
735
736 2020-07-22  Kevin Buettner  <[email protected]>
737
738         * elf.c (_bfd_elf_make_section_from_phdr): Remove hack for GDB.
739
740 2020-07-22  Max Filippov  <[email protected]>
741
742         PR 26246
743         * elf32-xtensa.c (removed_literal_compare): Use correct pointer
744         type for the first function argument. Rename pointers to reflect
745         that they have distinct types.
746
747 2020-07-20  Alan Modra  <[email protected]>
748
749         * elflink.c (_bfd_elf_gc_keep): Use bfd_is_const_section.
750
751 2020-07-19  Alan Modra  <[email protected]>
752
753         * elf64-ppc.c (struct ppc_link_hash_table): Add has_power10_relocs.
754         (select_alt_stub): New function.
755         (ppc_get_stub_entry): Use it here.
756         (ppc64_elf_check_relocs): Set had_power10_relocs rather than
757         power10_stubs.
758         (ppc64_elf_size_stubs): Clear power10_stubs here instead.  Don't
759         merge notoc stubs with other varieties when power10_stubs is "auto".
760         Instead dup the stub hash table entry.
761         (plt_stub_size, ppc_build_one_stub, ppc_size_one_stub): Adjust
762         tests of power10_stubs.
763
764 2020-07-15  Alan Modra  <[email protected]>
765
766         PR 26239
767         * coffgen.c (_bfd_coff_close_and_cleanup): Free dwarf2 info.
768
769 2020-07-15  Nick Clifton  <[email protected]>
770
771         PR26240
772         * coffgen.c (coff_get_normalized_symtab): Fix off-by-one error in
773         check for aux entries that overflow the buufer.
774
775 2020-07-15  Hans-Peter Nilsson  <[email protected]>
776
777         * elf64-mmix.c (mmix_elf_relax_section): Improve accounting for
778         R_MMIX_PUSHJ_STUBBABLE relocs against undefined symbols.
779
780 2020-07-15  Markus Böck  <[email protected]>
781             Alan Modra  <[email protected]>
782
783         PR 26198
784         * coffgen.c (_bfd_coff_section_already_linked): Allow for plugin
785         objects both before and after normal object files.
786         * elflink.c (_bfd_elf_section_already_linked): Likewise.
787
788 2020-07-10  Alan Modra  <[email protected]>
789
790         * elf64-ppc.h (struct ppc64_elf_params): Add power10_stubs.
791         * elf64-ppc.c (struct ppc_link_hash_table): Delete
792         power10_stubs.
793         (ppc64_elf_check_relocs): Adjust setting of power10_stubs.
794         (plt_stub_size, ppc_build_one_stub, ppc_size_one_stub): Adjust
795         uses of power10_stubs.
796
797 2020-07-09  Alan Modra  <[email protected]>
798
799         * coff-ppc.c: Delete.
800         * pe-ppc.c: Delete.
801         * pei-ppc.c: Delete.
802         * Makefile.am (BFD32_BACKENDS, BFD32_BACKENDS_CFILES): Remove PE PPC.
803         * coffcode.h (coff_set_arch_mach_hook, coff_set_flags): Remove
804         PPCMAGIC code.
805         (coff_write_object_contents): Remove PPC_PE code.
806         * config.bfd: Move powerpcle-pe to removed targets.
807         * configure.ac: Remove powerpc PE entries.
808         * libcoff-in.h (ppc_allocate_toc_section): Delete.
809         (ppc_process_before_allocation): Delete.
810         * peXXigen.c: Remove POWERPC_LE_PE code and comments.
811         * targets.c: Remove powerpc PE vectors.
812         * po/SRC-POTFILES.in: Regenerate.
813         * libcoff.h: Regenerate.
814         * Makefile.in: Regenerate.
815         * configure: Regenerate.
816
817 2020-07-09  Nick Clifton  <[email protected]>
818
819         * po/fr.po: Updated French translation.
820
821 2020-07-07  Alan Modra  <[email protected]>
822
823         * xcofflink.c (xcoff_mark): Don't mark const sections.
824         (bfd_xcoff_record_link_assignment): Add FIXME.
825         (_bfd_xcoff_bfd_final_link): Don't segfault on assorted magic
826         sections being discarded by linker script.
827
828 2020-07-07  Alan Modra  <[email protected]>
829
830         * coff-rs6000.c (xcoff_write_archive_contents_old): Set default
831         time, uid, gid and mode for deterministic archive.
832         (xcoff_write_archive_contents_big): Likewise.
833
834 2020-07-07  Alan Modra  <[email protected]>
835
836         * coffcode.h (coff_classify_symbol): Handle C_HIDEXT and
837         C_AIX_WEAKEXT.
838
839 2020-07-06  Nick Clifton  <[email protected]>
840
841         * po/pt.po: Updated Portuguese translation.
842         * po/uk.po: Updated Ukranian translation.
843
844 2020-07-04  Nick Clifton  <[email protected]>
845
846         * version.m4: Set version to 2.35.50.
847         * configure: Regenerate.
848         * po/bbfd.pot: Regenerate.
849
850 2020-07-04  Nick Clifton  <[email protected]>
851
852         Binutils 2.35 branch created.
853
854 2020-07-01  Alan Modra  <[email protected]>
855
856         PR 26188
857         * coffgen.c (coff_find_nearest_line_with_names): Sanity check
858         raw syment index before dereferencing.
859
860 2020-07-01  Alan Modra  <[email protected]>
861
862         * elf32-i386.c (elf_backend_object_p): Undef for vxworks.
863
864 2020-07-01  Alan Modra  <[email protected]>
865
866         * config.bfd: Obsolete xc16x.
867
868 2020-06-30  H.J. Lu  <[email protected]>
869
870         * archures.c (bfd_mach_i386_nacl): Removed.
871         (bfd_mach_i386_i386_nacl): Likewise.
872         (bfd_mach_x86_64_nacl): Likewise.
873         (bfd_mach_x64_32_nacl): Likewise.
874         * config.bfd: Remove *-*-nacl* targets.
875         * configure.ac: Remove x86 NaCl target vectors.
876         * cpu-i386.c (bfd_arch_i386_onebyte_nop_fill): Removed.
877         (bfd_x64_32_nacl_arch): Likewise.
878         (bfd_x86_64_nacl_arch): Likewise.
879         (bfd_i386_nacl_arch): Likewise.
880         (bfd_x64_32_arch_intel_syntax): Updated.
881         * elf32-i386.c: Don't include "elf-nacl.h".
882         (elf_i386_nacl_plt): Removed.
883         (elf_i386_nacl_plt0_entry): Likewise.
884         (elf_i386_nacl_plt_entry): Likewise.
885         (elf_i386_nacl_pic_plt0_entry): Likewise.
886         (elf_i386_nacl_pic_plt_entry): Likewise.
887         (elf_i386_nacl_eh_frame_plt): Likewise.
888         (elf_i386_nacl_plt): Likewise.
889         (elf32_i386_nacl_elf_object_p): Likewise.
890         (elf_i386_get_synthetic_symtab): Updated.
891         (elf_i386_link_setup_gnu_properties): Likewise.
892         * elf64-x86-64.c: Don't include "elf-nacl.h".
893         (elf_x86_64_nacl_plt): Removed.
894         (elf64_x86_64_nacl_elf_object_p): Likewise.
895         (elf_x86_64_nacl_plt0_entry): Likewise.
896         (elf_x86_64_nacl_plt_entry): Likewise.
897         (elf_x86_64_nacl_eh_frame_plt): Likewise.
898         (elf_x86_64_nacl_plt): Likewise.
899         (elf32_x86_64_nacl_elf_object_p): Likewise.
900         (elf_x86_64_get_synthetic_symtab): Updated.
901         (elf_x86_64_link_setup_gnu_properties): Likewise.
902         * elfxx-x86.c (_bfd_x86_elf_link_setup_gnu_properties): Likewise.
903         * targets.c: Remove x86 NaCl target vectors.
904         * bfd-in2.h: Regenerated.
905         * configure: Likewise.
906
907 2020-06-29  H.J. Lu  <[email protected]>
908
909         * elf32-tic6x.c (elf32_tic6x_size_dynamic_sections): Call
910         _bfd_elf_add_dynamic_tags.
911
912 2020-06-29  Alan Modra  <[email protected]>
913
914         * peXXigen.c (_bfd_XXi_slurp_codeview_record): Properly check
915         return value of bfd_bread.  Don't read more than requested length.
916         Sanity check length.  Properly terminate file name.
917
918 2020-06-29  Alan Modra  <[email protected]>
919
920         * arc-got.h: Use C style comments.
921         * coff-z80.c: Likewise.
922         * elf32-csky.c: Likewise.
923         * peXXigen.c: Likewise.
924         * elf32-m32c.c (m32c_elf_relax_delete_bytes): Remove commented out
925         code.
926
927 2020-06-26  Pat Bernardi  <[email protected]>
928
929         * elf32-m68k.c (m68k_elf_merge_obj_attributes): New function.
930         (elf32_m68k_merge_private_bfd_data): Merge GNU attributes.
931
932 2020-06-26  Alan Modra  <[email protected]>
933
934         * elfxx-riscv.c (struct priv_spec_t, priv_specs),
935         (riscv_get_priv_spec_class, riscv_get_priv_spec_class_from_numbers),
936         (riscv_get_priv_spec_name): Move to..
937         * cpu-riscv.c: ..here.
938         (riscv_get_priv_spec_class_from_numbers): Don't xmalloc temp buffer.
939         Use %u to print unsigned numbers.
940
941 2020-06-24  Andrew Burgess  <[email protected]>
942
943         * cpu-riscv.c (riscv_scan): Don't allow shorter matches using the
944         default architecture.
945
946 2020-06-24  H.J. Lu  <[email protected]>
947
948         PR ld/26083
949         * elf32-csky.c (csky_elf_size_dynamic_sections): Call
950         _bfd_elf_add_dynamic_tags.
951
952 2020-06-24  H.J. Lu  <[email protected]>
953
954         PR ld/26083
955         * elf32-cris.c (elf_cris_size_dynamic_sections): Call
956         _bfd_elf_add_dynamic_tags.
957
958 2020-06-24  Alan Modra  <[email protected]>
959
960         * vms-alpha.c (_bfd_vms_slurp_etir <ETIR__C_OPR_ASH>): Implement
961         shifts without undefined behaviour.
962
963 2020-06-23  H.J. Lu  <[email protected]>
964
965         * elf-bfd.h (elf_link_hash_table): Add dt_pltgot_required and
966         dt_jmprel_required.
967         (_bfd_elf_add_dynamic_tags): New.
968         * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Call
969         _bfd_elf_add_dynamic_tags.
970         * elf32-arc.c (elf_arc_size_dynamic_sections): Likewise.
971         * elf32-bfin.c (elf32_bfinfdpic_size_dynamic_sections): Likewise.
972         * elf32-cr16.c (_bfd_cr16_elf_size_dynamic_sections): Likewise.
973         * elf32-frv.c (elf32_frvfdpic_size_dynamic_sections): Likewise.
974         * elf32-lm32.c (lm32_elf_size_dynamic_sections): Likewise.
975         * elf32-m32r.c (m32r_elf_size_dynamic_sections): Likewise.
976         * elf32-m68k.c (elf_m68k_size_dynamic_sections): Likewise.
977         * elf32-microblaze.c (microblaze_elf_size_dynamic_sections):
978         Likewise.
979         * elf32-nds32.c (nds32_elf_size_dynamic_sections): Likewise.
980         * elf32-nios2.c (nios2_elf32_size_dynamic_sections): Likewise.
981         * elf32-or1k.c (or1k_elf_size_dynamic_sections): Likewise.
982         * elf32-s390.c (elf_s390_size_dynamic_sections): Likewise.
983         * elf32-tilepro.c (tilepro_elf_size_dynamic_sections): Likewise.
984         * elf32-vax.c (elf_vax_size_dynamic_sections): Likewise.
985         * elf64-alpha.c (elf64_alpha_size_dynamic_sections): Likewise.
986         * elf64-s390.c (elf_s390_size_dynamic_sections): Likewise.
987         * elfnn-aarch64.c (elfNN_aarch64_size_dynamic_sections):
988         Likewise.
989         * elfnn-riscv.c (riscv_elf_size_dynamic_sections): Likewise.
990         * elfxx-tilegx.c (tilegx_elf_size_dynamic_sections): Likewise.
991         * elf32-arm.c (elf32_arm_size_dynamic_sections): Call
992         _bfd_elf_maybe_vxworks_add_dynamic_tags.
993         * elf32-ppc.c (ppc_elf_size_dynamic_sections): Likewise.
994         * elfxx-sparc.c (_bfd_sparc_elf_size_dynamic_sections):
995         Likewise.
996         * elfxx-x86.c (_bfd_x86_elf_link_hash_table_create): Likewise.
997         (_bfd_x86_elf_size_dynamic_sections): Likewise.
998         * elfxx-x86.h (elf_x86_link_hash_table): Remove dt_reloc,
999         dt_reloc_sz and dt_reloc_ent.
1000         * elf-vxworks.c (_bfd_elf_maybe_vxworks_add_dynamic_tags): New.
1001         * elf-vxworks.h (_bfd_elf_maybe_vxworks_add_dynamic_tags):
1002         Likewise.
1003         * elf32-hppa.c (elf32_hppa_link_hash_table_create): Set
1004         etab.dt_pltgot_required.
1005         (elf32_hppa_size_dynamic_sections): Call
1006         _bfd_elf_add_dynamic_tags.
1007         * elf32-metag.c (elf_metag_link_hash_table_create): Set
1008         etab.dt_pltgot_required.
1009         (elf_metag_size_dynamic_sections): Call _bfd_elf_add_dynamic_tags.
1010         * elf32-sh.c (sh_elf_link_hash_table_create): Set
1011         root.dt_pltgot_required for FDPIC output.
1012         (sh_elf_size_dynamic_sections): Call
1013         _bfd_elf_maybe_vxworks_add_dynamic_tags.
1014         * elf32-xtensa.c (elf_xtensa_link_hash_table_create): Set
1015         elf.dt_pltgot_required.
1016         (elf_xtensa_size_dynamic_sections): Call
1017         _bfd_elf_add_dynamic_tags.
1018         * elf64-hppa.c (elf64_hppa_hash_table_create): Set
1019         root.dt_pltgot_required.
1020         (elf64_hppa_size_dynamic_sections): Call
1021         _bfd_elf_add_dynamic_tags.
1022         * elfnn-ia64.c (elfNN_ia64_hash_table_create): Set
1023         root.dt_pltgot_required.
1024         (elfNN_ia64_size_dynamic_sections): Set root.dt_jmprel_required
1025         for rel_pltoff_sec.  Call _bfd_elf_add_dynamic_tags.
1026         * elflink.c (_bfd_elf_add_dynamic_tags): New.
1027
1028 2020-06-22  Saagar Jha  <[email protected]>
1029
1030         * mach-o.c: Support the new load commands by reading a linkedit
1031         data command for them.
1032
1033 2020-06-22  Nelson Chu  <[email protected]>
1034
1035         * elfxx-riscv.c (struct priv_spec_t priv_specs[]): Move them from
1036         opcodes/riscv-opc.c to bfd/elfxx-riscv.c, since we need it in linker.
1037         (riscv_get_priv_spec_class): Likewise.
1038         (riscv_get_priv_spec_name): Likewise.
1039         (riscv_get_priv_spec_class_from_numbers): New function, convert
1040         the version numbers into string, then call riscv_get_priv_spec_class
1041         to get the priv spec class.
1042         * elfxx-riscv.h (riscv_get_priv_spec_class): Move forward declaration
1043         from include/opcode/riscv.h to bfd/elfxx-riscv.h.
1044         (riscv_get_priv_spec_name): Likewise.
1045         (riscv_get_priv_spec_class_from_numbers): New forward declaration.
1046         (opcode/riscv.h): Include it in the header rather than elfxx-riscv.c.
1047         * elfnn-riscv.c (riscv_merge_attributes):  Get the priv spec classes
1048         of input and output objects form their priv spec attributes by
1049         riscv_get_priv_spec_class_from_numbers.  Report warning rather than
1050         errors when linking objects with differnet priv spec versions.  We do
1051         know v1.9.1 may have conflicts to other versions, so report the
1052         warning, too.  After that, update the output priv spec version to the
1053         newest one so far.
1054
1055 2020-06-22  Nelson Chu  <[email protected]>
1056
1057         * elfnn-riscv.c (riscv_merge_attributes): Once we meet one of the
1058         priv attributes, we will check the conflicts for all of them (major,
1059         minor and revision), and then set the priv_attrs_merged to TRUE to
1060         indicate that we have handled all of the priv attributes.  Remove
1061         the unused boolean priv_may_conflict, in_priv_zero and out_priv_zero.
1062
1063 2020-06-21  Alan Modra  <[email protected]>
1064
1065         PR 26132
1066         * configure.ac: Disable plugins by default for some targets.
1067         * plugin.c: Comment typo fix.
1068         * configure: Regenerate.
1069
1070 2020-06-19  Nick Clifton  <[email protected]>
1071
1072         * plugin.c (try_load_plugin): Suppress the error message about
1073         being unable to open a plugin if creating a list of viable
1074         plugins.
1075
1076 2020-06-16  Alan Modra  <[email protected]>
1077
1078         * aout-tic30.c: Delete file.
1079         * Makefile.am (BFD32_BACKENDS): Remove aout-tic30.lo.
1080         (BFD32_BACKENDS_CFILES): Remove aout-tic30.c.
1081         * config.bfd (c30-*-*aout*, tic30-*-*aout*): Remove entry.
1082         (xc16x-*-elf): Sort properly.
1083         * configure.ac: Remove tic30_aout_vec.
1084         * targets.c: Likewise.
1085         * Makefile.in: Regenerate.
1086         * configure: Regenerate.
1087         * po/SRC-POTFILES.in: Regenerate.
1088
1089 2020-06-15  Max Filippov  <[email protected]>
1090
1091         * elf32-xtensa.c (XSHAL_ABI, XTHAL_ABI_UNDEFINED)
1092         (XTHAL_ABI_WINDOWED, XTHAL_ABI_CALL0): New macros.
1093         (elf32xtensa_abi): New global variable.
1094         (xtensa_abi_choice): New function.
1095         (elf_xtensa_create_plt_entry): Use xtensa_abi_choice instead of
1096         XSHAL_ABI to select PLT code.
1097
1098 2020-06-15  Roland McGrath  <[email protected]>
1099
1100         * elflink.c (bfd_elf_define_start_stop): Use start_stop_visibility
1101         field of bfd_link_info.
1102
1103 2020-06-15  Alan Modra  <[email protected]>
1104
1105         * config.bfd: Obsolete powerpcle-*-pe targets.
1106
1107 2020-06-15  Alan Modra  <[email protected]>
1108
1109         PR 26103
1110         * elflink.c (elf_link_add_archive_symbols): Exclude undefined
1111         symbols that were defined in discarded sections.
1112         * cofflink.c (coff_link_check_archive_element): Likewise.
1113         (coff_link_add_symbols): Set indx to -3 for symbols defined in
1114         discarded sections.
1115         (_bfd_coff_write_global_sym): Don't emit such symbols.
1116         libcoff-in.h (struct coff_link_hash_entry): Update indx comment.
1117         libcoff.h: Regenerate.
1118
1119 2020-06-11  Alan Modra  <[email protected]>
1120
1121         PR 26107
1122         * pdp11.c (is_stab): Replace legacy "index" function with "strchr".
1123
1124 2020-06-10  H.J. Lu  <[email protected]>
1125
1126         * elfnn-ia64.c (elfNN_ia64_link_hash_table): Remove reltext.
1127         (allocate_dynrel_entries): Set DF_TEXTREL instead of reltext.
1128         (elfNN_ia64_size_dynamic_sections): Check DF_TEXTREL instead
1129         of reltext.
1130
1131 2020-06-10  H.J. Lu  <[email protected]>
1132
1133         PR ld/26094
1134         * elflink.c (bfd_elf_define_start_stop): Handle common symbols.
1135         Clear verinfo.verdef.
1136
1137 2020-06-09  H.J. Lu  <[email protected]>
1138
1139         PR ld/18801
1140         * elf-bfd.h (elf_link_hash_table): Add ifunc_resolvers.
1141         (_bfd_elf_allocate_ifunc_dyn_relocs): Remove the
1142         bfd_boolean * argument.  Set ifunc_resolvers if there are IFUNC
1143         resolvers.
1144         * elf-ifunc.c (_bfd_elf_allocate_ifunc_dyn_relocs): Updated.
1145         Set ifunc_resolvers if there are FUNC resolvers.
1146         * elf64-ppc.c (ppc_link_hash_table): Remove local_ifunc_resolver.
1147         (build_global_entry_stubs_and_plt): Replace local_ifunc_resolver
1148         with elf.ifunc_resolvers.
1149         (write_plt_relocs_for_local_syms): Likewise.
1150         (ppc64_elf_relocate_section): Likewise.
1151         (ppc64_elf_finish_dynamic_sections): Likewise.
1152         * elfnn-aarch64.c (elfNN_aarch64_allocate_ifunc_dynrelocs):
1153         Updated.
1154         * elfxx-x86.c (elf_x86_allocate_dynrelocs): Likewise.
1155         (_bfd_x86_elf_size_dynamic_sections): Check elf.ifunc_resolvers
1156         instead of readonly_dynrelocs_against_ifunc.
1157         * elfxx-x86.h (elf_x86_link_hash_table): Remove
1158         readonly_dynrelocs_against_ifunc.
1159
1160 2020-06-09  Alan Modra  <[email protected]>
1161
1162         * elf64-ppc.c (struct ppc_link_hash_table): Delete
1163         maybe_local_ifunc_resolver field.
1164         (build_global_entry_stubs_and_plt): Set local_ifunc_resolver in
1165         cases where maybe_local_ifunc_resolver was set.
1166         (ppc64_elf_relocate_section): Likewise.
1167         (ppc64_elf_finish_dynamic_sections): Downgrade ifunc with textrel
1168         error to a warning.
1169
1170 2020-06-08  H.J. Lu  <[email protected]>
1171
1172         * elf-bfd.h (elf_link_hash_entry): Add tlsdesc_plt and
1173         tlsdesc_got.
1174         * elf32-arm.c (elf32_arm_link_hash_table): Remove tlsdesc_plt
1175         and dt_tlsdesc_got.
1176         (elf32_arm_size_dynamic_sections): Updated.  Clear
1177         root.tlsdesc_plt for DF_BIND_NOW.
1178         (elf32_arm_finish_dynamic_sections): Updated.
1179         (elf32_arm_output_arch_local_syms): Likewise.
1180         * elf32-nds32.c (nds32_elf_size_dynamic_sections): Updated.
1181         Clear root.tlsdesc_plt for DF_BIND_NOW.
1182         (nds32_elf_finish_dynamic_sections): Updated.
1183         * elf32-nds32.h (elf_nds32_link_hash_table): Remove
1184         dt_tlsdesc_plt and dt_tlsdesc_got.
1185         * elf64-x86-64.c (elf_x86_64_finish_dynamic_sections): Updated.
1186         * elfnn-aarch64.c (elf_aarch64_link_hash_table): Remove
1187         tlsdesc_plt and dt_tlsdesc_got.
1188         (elfNN_aarch64_allocate_dynrelocs): Updated.
1189         (elfNN_aarch64_finish_dynamic_sections): Likewise.
1190         (elfNN_aarch64_size_dynamic_sections): Updated.  Clear
1191         root.tlsdesc_plt for DF_BIND_NOW.  Don't check DF_BIND_NOW
1192         twice.
1193         * elfxx-x86.c (elf_x86_allocate_dynrelocs): Updated.
1194         (_bfd_x86_elf_size_dynamic_sections): Likewise.
1195         (_bfd_x86_elf_finish_dynamic_sections): Likewise.
1196         * elfxx-x86.h (elf_x86_link_hash_table): Remove tlsdesc_plt and
1197         tlsdesc_got.
1198
1199 2020-06-07  H.J. Lu  <[email protected]>
1200
1201         * elf32-tic6x.c (elf32_bed): Defined the default to
1202         elf32_tic6x_bed.
1203
1204 2020-06-07  H.J. Lu  <[email protected]>
1205
1206         * elf64-hppa.c (elf64_hppa_link_hash_table): Remove plt_sec and
1207         plt_rel_sec.
1208         (elf64_hppa_check_relocs): Replace plt_sec/plt_rel_sec with
1209         root.splt/root.srelplt.
1210         (elf64_hppa_create_dynamic_sections): Likewise.
1211         (elf64_hppa_size_dynamic_sections): Likewise.
1212         (elf64_hppa_finish_dynamic_symbol): Likewise.
1213         (elf_hppa_final_link): Likewise.
1214         (elf_hppa_final_link_relocate): Likewise.
1215
1216 2020-06-06  H.J. Lu  <[email protected]>
1217
1218         * elfxx-sparc.c (_bfd_sparc_elf_size_dynamic_sections): Updated.
1219         * elfxx-sparc.h (_bfd_sparc_elf_link_hash_table): Remove
1220         is_vxworks.
1221
1222 2020-06-06  H.J. Lu  <[email protected]>
1223
1224         * elf-bfd.h (elf_target_os): New.
1225         (elf_link_hash_table): Add target_os.
1226         (elf_backend_data): Add target_os.
1227         * elf32-arm.c (elf32_arm_link_hash_table): Remove vxworks_p,
1228         symbian_p and nacl_p.
1229         (create_got_section): Updated.
1230         (elf32_arm_create_dynamic_sections): Likewise.
1231         (arm_type_of_stub): Likewise.
1232         (elf32_arm_create_or_find_stub_sec): Likewise.
1233         (elf32_arm_allocate_plt_entry): Likewise.
1234         (elf32_arm_populate_plt_entry): Likewise.
1235         (elf32_arm_final_link_relocate): Likewise.
1236         (elf32_arm_check_relocs): Likewise.
1237         (allocate_dynrelocs_for_symbol): Likewise.
1238         (elf32_arm_finish_dynamic_symbol): Likewise.
1239         (elf32_arm_finish_dynamic_sections): Likewise.
1240         (elf32_arm_output_plt_map_1): Likewise.
1241         (elf32_arm_output_arch_local_syms): Likewise.
1242         (elf32_arm_add_symbol_hook): Likewise.
1243         (elf32_arm_nacl_link_hash_table_create): Likewise.
1244         (elf32_arm_vxworks_link_hash_table_create): Likewise.
1245         (elf32_arm_symbian_link_hash_table_create): Likewise.
1246         (ELF_TARGET_OS): New.
1247         * elf32-i386.c (elf_i386_arch_bed): Removed.
1248         (elf_backend_arch_data): Likewise.
1249         (elf_i386_solaris_arch_bed): Likewise.
1250         (elf_i386_nacl_arch_bed): Likewise.
1251         (elf_i386_vxworks_arch_bed): Likewise.
1252         (elf_i386_relocate_section): Updated.
1253         (elf_i386_finish_dynamic_sections): Likewise.
1254         (elf_i386_get_synthetic_symtab): Likewise.
1255         (elf_i386_link_setup_gnu_properties): Likewise.
1256         (ELF_TARGET_OS): New.
1257         * elf32-mips.c (ELF_TARGET_OS): New.
1258         * elf32-ppc.c (ppc_elf_link_hash_table): Remove is_vxworks.
1259         (ppc_elf_create_got): Updated.
1260         (ppc_elf_create_dynamic_sections): Likewise.
1261         (ppc_elf_check_relocs): Likewise.
1262         (ppc_elf_adjust_dynamic_symbol): Likewise.
1263         (ppc_elf_size_dynamic_sections): Likewise.
1264         (ppc_elf_relocate_section): Likewise.
1265         (ppc_elf_finish_dynamic_sections): Likewise.
1266         (ppc_elf_vxworks_link_hash_table_create): Likewise.
1267         (ELF_TARGET_OS): New.
1268         * elf32-sh.c (elf_sh_link_hash_table): Remove vxworks_p.
1269         (sh_elf_link_hash_table_create): Updated.
1270         (sh_elf_create_dynamic_sections): Likewise.
1271         (allocate_dynrelocs): Likewise.
1272         (sh_elf_size_dynamic_sections): Likewise.
1273         (sh_elf_relocate_section): Likewise.
1274         (sh_elf_finish_dynamic_symbol): Likewise.
1275         (sh_elf_finish_dynamic_sections): Likewise.
1276         (ELF_TARGET_OS): New.
1277         * elf32-sparc.c (elf32_sparc_vxworks_link_hash_table_create):
1278         Removed.
1279         (bfd_elf32_bfd_link_hash_table_create): Likewise.
1280         (ELF_TARGET_OS): New.
1281         * elf64-x86-64.c (elf_x86_64_arch_bed): Removed.
1282         (elf_x86_64_solaris_arch_bed): Likewise.
1283         (elf_x86_64_nacl_arch_bed): Likewise.
1284         (elf_x86_64_finish_dynamic_sections): Updated.
1285         (elf_x86_64_get_synthetic_symtab): Likewise.
1286         (elf_x86_64_link_setup_gnu_properties): Likewise.
1287         (ELF_TARGET_OS): New.
1288         * elflink.c (_bfd_elf_link_hash_table_init): Initialize
1289         target_o.
1290         * elfxx-mips.c (mips_elf_link_hash_table): Remove is_vxworks.
1291         (MIPS_ELF_REL_DYN_NAME): Updated.
1292         (ELF_MIPS_GP_OFFSET): Likewise.
1293         (mips_elf_create_local_got_entry): Likewise.
1294         (mips_elf_allocate_dynamic_relocations): Likewise.
1295         (mips_elf_count_got_symbols): Likewise.
1296         (is_gott_symbol): Likewise.
1297         (mips_elf_calculate_relocation): Likewise.
1298         (mips_elf_create_dynamic_relocation): Likewise.
1299         (_bfd_mips_elf_check_relocs): Likewise.
1300         (allocate_dynrelocs): Likewise.
1301         (_bfd_mips_elf_adjust_dynamic_symbol): Likewise.
1302         (mips_elf_lay_out_got): Likewise.
1303         (mips_elf_set_plt_sym_value): Likewise.
1304         (_bfd_mips_elf_size_dynamic_sections): Likewise.
1305         (_bfd_mips_elf_finish_dynamic_symbol): Likewise.
1306         (_bfd_mips_elf_finish_dynamic_sections): Likewise.
1307         (_bfd_mips_elf_final_link): Likewise.
1308         (_bfd_mips_init_file_header): Likewise.
1309         * elfxx-sparc.c (_bfd_sparc_elf_create_dynamic_sections):
1310         Likewise.
1311         (allocate_dynrelocs): Likewise.
1312         (_bfd_sparc_elf_size_dynamic_sections): Likewise.
1313         (_bfd_sparc_elf_relocate_section): Likewise.
1314         (_bfd_sparc_elf_finish_dynamic_symbol): Likewise.
1315         (sparc_finish_dyn): Likewise.
1316         (_bfd_sparc_elf_finish_dynamic_sections): Likewise.
1317         * elfxx-target.h (ELF_TARGET_OS): New.
1318         (elfNN_bed): Add ELF_TARGET_OS.
1319         * elfxx-x86.c (elf_x86_allocate_dynrelocs): Updated.
1320         (_bfd_x86_elf_link_hash_table_create): Likewise.
1321         (_bfd_x86_elf_size_dynamic_sections): Likewise.
1322         (_bfd_x86_elf_finish_dynamic_sections): Likewise.
1323         (_bfd_x86_elf_adjust_dynamic_symbol): Likewise.
1324         (_bfd_x86_elf_link_setup_gnu_properties): Likewise.
1325         * elfxx-x86.h (elf_x86_target_os): Removed.
1326         (elf_x86_backend_data): Likewise.
1327         (get_elf_x86_backend_data): Likewise.
1328         (elf_x86_link_hash_table): Remove target_os.
1329
1330 2020-06-06  Alan Modra  <[email protected]>
1331
1332         * reloc.c: Rename
1333         BFD_RELOC_PPC64_GOT_TLSGD34 to BFD_RELOC_PPC64_GOT_TLSGD_PCREL34,
1334         BFD_RELOC_PPC64_GOT_TLSLD34 to BFD_RELOC_PPC64_GOT_TLSLD_PCREL34,
1335         BFD_RELOC_PPC64_GOT_TPREL34 to BFD_RELOC_PPC64_GOT_TPREL_PCREL34,
1336         BFD_RELOC_PPC64_GOT_DTPREL34 to BFD_RELOC_PPC64_GOT_DTPREL_PCREL34.
1337         * elf64-ppc.c: Update throughout for reloc renaming.
1338         (ppc64_elf_reloc_name_lookup): Handle old reloc names.
1339         * libbfd.h: Regenerate.
1340         * bfd-in2.h: Regenerate.
1341
1342 2020-06-05  H.J. Lu  <[email protected]>
1343
1344         PR ld/26080
1345         * elf32-bfin.c (bfinfdpic_relocate_section): Skip non SEC_ALLOC
1346         section.
1347
1348 2020-06-05  Nick Clifton  <[email protected]>
1349
1350         * pdp11.c (aout_link_add_symbols): Fix use before initialisation
1351         bug.
1352
1353 2020-06-05  Nelson Chu  <[email protected]>
1354
1355         * elfnn-riscv.c (riscv_merge_attributes): Add new boolean
1356         priv_may_conflict, in_priv_zero and out_priv_zero to decide
1357         whether the object can be linked according to it's priv
1358         attributes.  The object without any priv spec attributes can
1359         be linked with others.  If the first input object doesn't contain
1360         any priv attributes, then we need to copy the setting from the
1361         next input one.  Also report more detailed error messages to user.
1362
1363 2020-06-04  Stephen Casner  <[email protected]>
1364
1365         Extend pdp11-aout symbol table format to accommodate .stab
1366         symbols and implement correct handling of them.
1367
1368         * pdp11.c (pdp11_external_nlist): Repurposed e_unused to e_desc.
1369         (N_STAB, is_stab): Needed new function is_stab to disambiguate
1370         normal vs. .stab symbol table type values, replacing N_STAB mask.
1371         (translate_from_native_sym_flags): Determine correct section for
1372         different .stab types.
1373         (translate_to_native_sym_flags): Leave .stab types intact.
1374         (translate_symbol_table): Error if symbol indicates overlay;
1375         store desc field from .stab symbols.
1376         (write_syms): Output desc field with symbol.
1377         (aout_link_check_ar_symbols): Skip .stab symbols.
1378         (aout_link_add_symbols): Correctly distinguish .stab symbols.
1379         (aout_link_write_other_symbol): Write 0 for desk and ovly fields.
1380         (aout_link_write_symbols): Write 0 for desk and ovly fields;
1381         correctly distinguish .stab symbols and select calculate their
1382         section and value; and copy desc and ovly fields from input symbol
1383         to output symbol.
1384
1385 2020-06-04  Stephen Casner  <[email protected]>
1386
1387         * aoutx.h (translate_symbol_table): Comment had external and
1388         internal swapped.
1389         * pdp11.c (translate_symbol_table): Likewise.
1390
1391 2020-06-04  H.J. Lu  <[email protected]>
1392
1393         * elfxx-x86.h (elf_x86_link_hash_table): Remove target_id.
1394         (is_x86_elf): Check elf.hash_table_id instead of target_id.
1395         * elfxx-x86.c (_bfd_x86_elf_link_hash_table_create): Updated.
1396
1397 2020-06-04  H.J. Lu  <[email protected]>
1398
1399         PR ld/26080
1400         * elf-m10300.c (mn10300_elf_relocate_section): Resolve relocation
1401         in debug section against symbol defined in shared library to 0.
1402         * elf32-i386.c (elf_i386_check_relocs): Remove SEC_ALLOC check.
1403         * elf32-lm32.c (lm32_elf_check_relocs): Likewise.
1404         * elf32-m32r.c (m32r_elf_check_relocs): Likewise.
1405         * elf32-nds32.c (nds32_elf_check_relocs): Likewise.
1406         * elf32-nios2.c (nios2_elf32_check_relocs): Likewise.
1407         * elf32-or1k.c (or1k_elf_check_relocs): Likewise.
1408         * elf32-ppc.c (ppc_elf_check_relocs): Likewise.
1409         * elf32-sh.c (sh_elf_check_relocs): Likewise.
1410         * elf32-xtensa.c (elf_xtensa_check_relocs): Likewise.
1411         * elf64-alpha.c (elf64_alpha_check_relocs): Likewise.
1412         * elf64-ppc.c (ppc64_elf_check_relocs): Likewise.
1413         * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
1414         * elfxx-mips.c (_bfd_mips_elf_check_relocs): Likewise.
1415         * elf32-vax.c (elf_vax_check_relocs): Set non_got_ref for non-GOT
1416         reference.
1417         (elf_vax_adjust_dynamic_symbol): Generate a copy reloc only if
1418         there is non-GOT reference.
1419         * elflink.c (_bfd_elf_link_check_relocs): Skip non-loaded,
1420         non-alloced sections.
1421
1422 2020-06-03  Stephen Casner  <[email protected]>
1423
1424         Copy several years of fixes from bfd/aoutx.h to bfd/pdp11.c.
1425
1426         * pdp11.c (some_aout_object_p): 4c1534c7a2a - Don't set EXEC_P for
1427         files with relocs.
1428         (aout_get_external_symbols): 6b8f0fd579d - Return if count is zero.
1429         0301ce1486b PR 22306 - Handle stringsize of zero, and error for any
1430         other size that doesn't qcover the header word.
1431         bf82069dce1 PR 23056 - Allocate an extra byte at the end of the
1432         string table, and zero it.
1433         (translate_symbol_table): 0d329c0a83a PR 22887 - Print an error
1434         message and set bfd_error on finding an invalid name string offset.
1435         (add_to_stringtab): INLINE -> inline
1436         (pdp11_aout_swap_reloc_in): 116acb2c268 PR 22887 - Correct r_index
1437         bound check.
1438         (squirt_out_relocs): e2996cc315d PR 20921 - Check for and report
1439         any relocs that could not be recognised.
1440         92744f05809 PR 20929 - Check for relocs without an associated symbol.
1441         (find_nearest_line):  808346fcfcf PR 23055 - Check that the symbol
1442         name exists and is long enough, before attempting to see if it is
1443         for a .o file.
1444         c3864421222 - Correct case for N_SO being the last symbol.
1445         50455f1ab29 PR 20891 - Handle the case where the main file name
1446         and the directory name are both empty.
1447         e82ab856bb4 PR 20892 - Handle the case where function name is empty.
1448         (aout_link_add_symbols): e517df3dbf7 PR 19629 - Check for out of
1449         range string table offsets.
1450         531336e3a0b PR 20909 - Fix off-by-one error in check for an
1451         illegal string offset.
1452         (aout_link_includes_newfunc): Add comment.
1453         (pdp11_aout_link_input_section): ad756e3f9e6 - Return with an error
1454         on unexpected relocation type rather than ASSERT.
1455
1456 2020-06-03  H.J. Lu  <[email protected]>
1457
1458         PR ld/26066
1459         * elf32-nios2.c (nios2_elf32_size_dynamic_sections): Call
1460         _bfd_elf_maybe_set_textrel to set DF_TEXTREL.
1461
1462 2020-06-03  H.J. Lu  <[email protected]>
1463
1464         PR ld/26066
1465         * elf32-nios2.c (nios2_elf32_check_relocs): Skip non-loaded,
1466         non-alloced sections.
1467
1468 2020-06-03  H.J. Lu  <[email protected]>
1469
1470         * elf32-frv.c (elf32_frv_relocate_section): Don't generate
1471         dynamic relocations for non SEC_ALLOC sections.
1472
1473 2020-06-03  Gunther Nikl  <[email protected]>
1474
1475         * aout64.c (BMAGIC, QMAGIC): Do not define.
1476         * aoutx.h (N_IS_BMAGIC, N_SET_QMAGIC): New defines.
1477         (NAME (aout, some_aout_object_p)): Use N_IS_QMAGIC and N_IS_BMAGIC
1478         to check the file format.
1479         (adjust_z_magic): Use N_SET_QMAGIC to set file format.
1480         * i386aout.c (NO_WRITE_HEADER_KLUDGE): Delete define.
1481         * libaout.h (NO_WRITE_HEADER_KLUDGE): Do not define.
1482
1483 2020-06-03  H.J. Lu  <[email protected]>
1484
1485         * elf32-arc.c (elf_arc_relocate_section): Don't generate dynamic
1486         relocations for non SEC_ALLOC sections.
1487
1488 2020-06-03  H.J. Lu  <[email protected]>
1489
1490         * elf-bfd.h (_bfd_elf_maybe_set_textrel): New
1491         * elf32-arm.c (maybe_set_textrel): Removed.
1492         (elf32_arm_size_dynamic_sections): Replace maybe_set_textrel
1493         with _bfd_elf_maybe_set_textrel.
1494         * elf32-csky.c (maybe_set_textrel): Removed.
1495         (csky_elf_size_dynamic_sections): Replace maybe_set_textrel
1496         with _bfd_elf_maybe_set_textrel.
1497         * elf32-hppa.c (maybe_set_textrel): Removed.
1498         (elf32_hppa_size_dynamic_sections): Replace maybe_set_textrel
1499         with _bfd_elf_maybe_set_textrel.
1500         * elf32-lm32.c (maybe_set_textrel): Removed.
1501         (lm32_elf_size_dynamic_sections): Replace maybe_set_textrel
1502         with _bfd_elf_maybe_set_textrel.
1503         * elf32-m32r.c (maybe_set_textrel): Removed.
1504         (m32r_elf_size_dynamic_sections): Replace maybe_set_textrel
1505         with _bfd_elf_maybe_set_textrel.
1506         * elf32-metag.c (maybe_set_textrel): Removed.
1507         (elf_metag_size_dynamic_sections): Replace maybe_set_textrel
1508         with _bfd_elf_maybe_set_textrel.
1509         * elf32-nds32.c (maybe_set_textrel): Removed.
1510         (nds32_elf_size_dynamic_sections): Replace maybe_set_textrel
1511         with _bfd_elf_maybe_set_textrel.
1512         * elf32-or1k.c (maybe_set_textrel): Removed.
1513         (or1k_elf_size_dynamic_sections): Replace maybe_set_textrel
1514         with _bfd_elf_maybe_set_textrel.
1515         * elf32-ppc.c (maybe_set_textrel): Removed.
1516         (ppc_elf_size_dynamic_sections): Replace maybe_set_textrel
1517         with _bfd_elf_maybe_set_textrel.
1518         * elf32-s390.c (maybe_set_textrel): Removed.
1519         (elf_s390_size_dynamic_sections): Replace maybe_set_textrel
1520         with _bfd_elf_maybe_set_textrel.
1521         * elf32-sh.c (maybe_set_textrel): Removed.
1522         (sh_elf_size_dynamic_sections): Replace maybe_set_textrel
1523         with _bfd_elf_maybe_set_textrel.
1524         * elf32-tic6x.c (maybe_set_textrel): Removed.
1525         (elf32_tic6x_size_dynamic_sections): Replace maybe_set_textrel
1526         with _bfd_elf_maybe_set_textrel.
1527         * elf32-tilepro.c (maybe_set_textrel): Removed.
1528         (tilepro_elf_size_dynamic_sections): Replace maybe_set_textrel
1529         with _bfd_elf_maybe_set_textrel.
1530         * elf64-ppc.c (maybe_set_textrel): Removed.
1531         (ppc64_elf_size_dynamic_sections): Replace maybe_set_textrel
1532         with _bfd_elf_maybe_set_textrel.
1533         * elf64-s390.c (maybe_set_textrel): Removed.
1534         (elf_s390_size_dynamic_sections): Replace maybe_set_textrel
1535         with _bfd_elf_maybe_set_textrel.
1536         * elfnn-aarch64.c (maybe_set_textrel): Removed.
1537         (elfNN_aarch64_size_dynamic_sections): Replace maybe_set_textrel
1538         with _bfd_elf_maybe_set_textrel.
1539         * elfnn-riscv.c (maybe_set_textrel): Removed.
1540         (riscv_elf_size_dynamic_sections): Replace maybe_set_textrel
1541         with _bfd_elf_maybe_set_textrel.
1542         * elfxx-sparc.c (maybe_set_textrel): Removed.
1543         (_bfd_sparc_elf_size_dynamic_sections): Replace maybe_set_textrel
1544         with _bfd_elf_maybe_set_textrel.
1545         * elfxx-tilegx.c (maybe_set_textrel): Removed.
1546         (tilegx_elf_size_dynamic_sections): Replace maybe_set_textrel
1547         with _bfd_elf_maybe_set_textrel.
1548         * elfxx-x86.c (maybe_set_textrel): Removed.
1549         (_bfd_x86_elf_size_dynamic_sections): Replace maybe_set_textrel
1550         with _bfd_elf_maybe_set_textrel.
1551         * elflink.c (_bfd_elf_maybe_set_textrel): New.
1552
1553 2020-06-03  H.J. Lu  <[email protected]>
1554
1555         PR ld/26067
1556         * elf32-arm.c (elf32_arm_copy_indirect_symbol): Don't copy
1557         dyn_relocs.
1558         * elf32-csky.c (csky_elf_copy_indirect_symbol): Likewise.
1559         * elf32-hppa.c (elf32_hppa_copy_indirect_symbol): Likewise.
1560         * elf32-metag.c (elf_metag_copy_indirect_symbol): Likewise.
1561         * elf32-microblaze.c (microblaze_elf_copy_indirect_symbol):
1562         Likewise.
1563         * elf32-nds32.c (nds32_elf_copy_indirect_symbol): Likewise.
1564         * elf32-nios2.c (nios2_elf32_copy_indirect_symbol): Likewise.
1565         * elf32-or1k.c (or1k_elf_copy_indirect_symbol): Likewise.
1566         * elf32-s390.c (elf_s390_copy_indirect_symbol): Likewise.
1567         * elf32-sh.c (sh_elf_copy_indirect_symbol): Likewise.
1568         * elf32-tilepro.c (tilepro_elf_copy_indirect_symbol): Likewise.
1569         * elf64-s390.c (elf_s390_copy_indirect_symbol): Likewise.
1570         * elfnn-aarch64.c (elfNN_aarch64_copy_indirect_symbol): Likewise.
1571         * elfnn-riscv.c (riscv_elf_copy_indirect_symbol): Likewise.
1572         * elfxx-sparc.c (_bfd_sparc_elf_copy_indirect_symbol): Likewise.
1573         * elfxx-tilegx.c (tilegx_elf_copy_indirect_symbol): Likewise.
1574         * elfxx-x86.c (_bfd_x86_elf_copy_indirect_symbol): Likewise.
1575         * elf32-lm32.c (lm32_elf_copy_indirect_symbol): Removed.
1576         (elf_backend_copy_indirect_symbol): Likewise.
1577         * elf32-m32r.c (m32r_elf_copy_indirect_symbol): Removed.
1578         (elf_backend_copy_indirect_symbol): Likewise.
1579         * elflink.c (_bfd_elf_link_hash_copy_indirect): Copy dyn_relocs.
1580
1581 2020-06-03  H.J. Lu  <[email protected]>
1582
1583         PR ld/26067
1584         * elf-bfd.h (_bfd_elf_readonly_dynrelocs): New.
1585         * elf32-arm.c (readonly_dynrelocs): Removed.
1586         (maybe_set_textrel): Replace readonly_dynrelocs with
1587         _bfd_elf_readonly_dynrelocs.
1588         * elf32-csky.c (readonly_dynrelocs): Removed.
1589         (maybe_set_textrel): Replace readonly_dynrelocs with
1590         _bfd_elf_readonly_dynrelocs.
1591         *  elf32-hppa.c(readonly_dynrelocs): Removed.
1592         (alias_readonly_dynrelocs): Replace readonly_dynrelocs with
1593         _bfd_elf_readonly_dynrelocs.
1594         (maybe_set_textrel): Likewise.
1595         * elf32-lm32.c (readonly_dynrelocs): Removed.
1596         (lm32_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
1597         with _bfd_elf_readonly_dynrelocs.
1598         (maybe_set_textrel): Likewise.
1599         * elf32-m32r.c (readonly_dynrelocs): Removed.
1600         (m32r_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
1601         with _bfd_elf_readonly_dynrelocs.
1602         (maybe_set_textrel): Likewise.
1603         * elf32-metag.c (readonly_dynrelocs): Removed.
1604         (elf_metag_adjust_dynamic_symbol): Replace readonly_dynrelocs
1605         with _bfd_elf_readonly_dynrelocs.
1606         (maybe_set_textrel): Likewise.
1607         * elf32-microblaze.c (readonly_dynrelocs): Removed.
1608         (microblaze_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
1609         with _bfd_elf_readonly_dynrelocs.
1610         * elf32-nds32.c (readonly_dynrelocs): Removed.
1611         (nds32_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
1612         with _bfd_elf_readonly_dynrelocs.
1613         (maybe_set_textrel): Likewise.
1614         * elf32-or1k.c (readonly_dynrelocs): Removed.
1615         (or1k_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
1616         with _bfd_elf_readonly_dynrelocs.
1617         * elf32-ppc.c (readonly_dynrelocs): Removed.
1618         (alias_readonly_dynrelocs): Replace readonly_dynrelocs with
1619         _bfd_elf_readonly_dynrelocs.
1620         (ppc_elf_adjust_dynamic_symbol): Likewise.
1621         (maybe_set_textrel): Likewise.
1622         * elf32-s390.c (readonly_dynrelocs): Removed.
1623         (elf_s390_adjust_dynamic_symbol): Replace readonly_dynrelocs
1624         with _bfd_elf_readonly_dynrelocs.
1625         (maybe_set_textrel): Likewise.
1626         * elf32-sh.c (readonly_dynrelocs): Removed.
1627         (sh_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs with
1628         _bfd_elf_readonly_dynrelocs.
1629         (maybe_set_textrel): Likewise.
1630         * elf32-tic6x.c (readonly_dynrelocs): Removed.
1631         (maybe_set_textrel): Replace readonly_dynrelocs with
1632         _bfd_elf_readonly_dynrelocs.
1633         * elf32-tilepro.c (readonly_dynrelocs): Removed.
1634         (tilepro_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
1635         with _bfd_elf_readonly_dynrelocs.
1636         (maybe_set_textrel): Likewise.
1637         * elf64-ppc.c (readonly_dynrelocs): Removed.
1638         (alias_readonly_dynrelocs): Replace readonly_dynrelocs with
1639         _bfd_elf_readonly_dynrelocs.
1640         (ppc64_elf_adjust_dynamic_symbol): Likewise.
1641         (maybe_set_textrel): Likewise.
1642         * elf64-s390.c (readonly_dynrelocs): Removed.
1643         (elf_s390_adjust_dynamic_symbol): Replace readonly_dynrelocs
1644         with _bfd_elf_readonly_dynrelocs.
1645         (maybe_set_textrel): Likewise.
1646         * elflink.c (_bfd_elf_readonly_dynrelocs): New.
1647         * elfnn-aarch64.c (readonly_dynrelocs): Removed.
1648         (maybe_set_textrel): Replace readonly_dynrelocs with
1649         _bfd_elf_readonly_dynrelocs.
1650         * elfnn-riscv.c (readonly_dynrelocs): Removed.
1651         (riscv_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
1652         with _bfd_elf_readonly_dynrelocs.
1653         (maybe_set_textrel): Likewise.
1654         * elfxx-sparc.c (readonly_dynrelocs): Removed.
1655         (_bfd_sparc_elf_adjust_dynamic_symbol): Replace
1656         readonly_dynrelocs with _bfd_elf_readonly_dynrelocs.
1657         (maybe_set_textrel): Likewise.
1658         * elfxx-tilegx.c (readonly_dynrelocs): Removed.
1659         (tilegx_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
1660         with _bfd_elf_readonly_dynrelocs.
1661         (maybe_set_textrel): Likewise.
1662         * elfxx-x86.c (readonly_dynrelocs): Removed.
1663         (maybe_set_textrel): Replace readonly_dynrelocs with
1664         _bfd_elf_readonly_dynrelocs.
1665         (_bfd_x86_elf_adjust_dynamic_symbol): Likewise.
1666
1667 2020-06-03  H.J. Lu  <[email protected]>
1668
1669         * elfxx-x86.h (GENERATE_DYNAMIC_RELOCATION_P): Silence
1670         -fsanitize=undefined.
1671
1672 2020-06-03  Alan Modra  <[email protected]>
1673
1674         PR 26069
1675         PR 18758
1676         * peicode.h (pe_ILF_make_a_section): Align data for compilers
1677         other than gcc.
1678         (pe_ILF_build_a_bfd): Likewise.
1679
1680 2020-06-03  Alan Modra  <[email protected]>
1681
1682         PR 26069
1683         * elf.c (_bfd_elf_close_and_cleanup): Free elf_shstrtab for
1684         core files as well as objects.
1685
1686 2020-06-01  H.J. Lu  <[email protected]>
1687
1688         PR ld/26067
1689         * elf-bfd.h (elf_link_hash_entry): Add dyn_relocs after size.
1690         * elf-s390-common.c (s390_elf_allocate_ifunc_dyn_relocs):
1691         Updated.
1692         * elf32-arc.c (elf_arc_link_hash_entry): Remove dyn_relocs.
1693         (elf_arc_link_hash_newfunc): Updated.
1694         * elf32-arm.c (elf32_arm_link_hash_entry): Remove dyn_relocs.
1695         (elf32_arm_link_hash_newfunc): Updated.
1696         (elf32_arm_copy_indirect_symbol): Likewise.
1697         (elf32_arm_check_relocs): Likewise.
1698         (readonly_dynrelocs): Likewise.
1699         (allocate_dynrelocs_for_symbol): Likewise.
1700         * elf32-csky.c (csky_elf_link_hash_entry): Remove dyn_relocs.
1701         (csky_elf_link_hash_newfunc): Updated.
1702         (csky_allocate_dynrelocs): Likewise.
1703         (readonly_dynrelocs): Likewise.
1704         (csky_elf_copy_indirect_symbol): Likewise.
1705         * elf32-hppa.c (elf32_hppa_link_hash_entry): Remove dyn_relocs.
1706         (hppa_link_hash_newfunc): Updated.
1707         (elf32_hppa_copy_indirect_symbol): Likewise.
1708         (elf32_hppa_hide_symbol): Likewise.
1709         (elf32_hppa_adjust_dynamic_symbol): Likewise.
1710         (allocate_dynrelocs): Likewise.
1711         (elf32_hppa_relocate_section): Likewise.
1712         * elf32-i386.c (elf_i386_check_relocs): Likewise.
1713         * elf32-lm32.c (elf_lm32_link_hash_entry): Removed.
1714         (lm32_elf_link_hash_newfunc): Likewise.
1715         (lm32_elf_link_hash_table_create): Updated.
1716         (readonly_dynrelocs): Likewise.
1717         (allocate_dynrelocs): Likewise.
1718         (lm32_elf_copy_indirect_symbol): Likewise.
1719         * elf32-m32r.c (elf_m32r_link_hash_entry): Removed.
1720         (m32r_elf_link_hash_newfunc): Likewise.
1721         (m32r_elf_link_hash_table_create): Updated.
1722         (m32r_elf_copy_indirect_symbol): Likewise.
1723         (allocate_dynrelocs): Likewise.
1724         * elf32-metag.c (elf_metag_link_hash_entry): Remove dyn_relocs.
1725         (metag_link_hash_newfunc): Updated.
1726         (elf_metag_copy_indirect_symbol): Likewise.
1727         (readonly_dynrelocs): Likewise.
1728         (allocate_dynrelocs): Likewise.
1729         * elf32-microblaze.c (elf32_mb_link_hash_entry): Remove
1730         dyn_relocs.
1731         (link_hash_newfunc): Updated.
1732         (microblaze_elf_check_relocs): Likewise.
1733         (microblaze_elf_copy_indirect_symbol): Likewise.
1734         (readonly_dynrelocs): Likewise.
1735         (allocate_dynrelocs): Likewise.
1736         * elf32-nds32.c (elf_nds32_link_hash_entry): Remove dyn_relocs.
1737         (nds32_elf_link_hash_newfunc): Updated.
1738         (nds32_elf_copy_indirect_symbol): Likewise.
1739         (readonly_dynrelocs): Likewise.
1740         (allocate_dynrelocs): Likewise.
1741         (nds32_elf_check_relocs): Likewise.
1742         * elf32-nios2.c (elf32_nios2_link_hash_entry): Remove dyn_relocs.
1743         (link_hash_newfunc): Updated.
1744         (nios2_elf32_copy_indirect_symbol): Likewise.
1745         (nios2_elf32_check_relocs): Likewise.
1746         (allocate_dynrelocs): Likewise.
1747         * elf32-or1k.c (elf_or1k_link_hash_entry): Remove dyn_relocs.
1748         (or1k_elf_link_hash_newfunc): Updated.
1749         (readonly_dynrelocs): Likewise.
1750         (allocate_dynrelocs): Likewise.
1751         (or1k_elf_copy_indirect_symbol): Likewise.
1752         * elf32-ppc.c (ppc_elf_link_hash_entry): Remove dyn_relocs.
1753         (ppc_elf_link_hash_newfunc): Updated.
1754         (ppc_elf_copy_indirect_symbol): Likewise.
1755         (ppc_elf_check_relocs): Likewise.
1756         (readonly_dynrelocs): Likewise.
1757         (ppc_elf_adjust_dynamic_symbol): Likewise.
1758         (allocate_dynrelocs): Likewise.
1759         (ppc_elf_relocate_section): Likewise.
1760         * elf32-s390.c (elf_s390_link_hash_entry): Remove dyn_relocs.
1761         (link_hash_newfunc): Updated.
1762         (elf_s390_copy_indirect_symbol): Likewise.
1763         (readonly_dynrelocs): Likewise.
1764         (elf_s390_adjust_dynamic_symbol): Likewise.
1765         (allocate_dynrelocs): Likewise.
1766         * elf32-sh.c (elf_sh_link_hash_entry): Remove dyn_relocs.
1767         (sh_elf_link_hash_newfunc): Updated.
1768         (readonly_dynrelocs): Likewise.
1769         (allocate_dynrelocs): Likewise.
1770         (sh_elf_copy_indirect_symbol): Likewise.
1771         (sh_elf_check_relocs): Likewise.
1772         * elf32-tic6x.c (elf32_tic6x_link_hash_entry): Removed.
1773         (elf32_tic6x_link_hash_newfunc): Likewise.
1774         (elf32_tic6x_link_hash_table_create): Updated.
1775         (readonly_dynrelocs): Likewise.
1776         (elf32_tic6x_check_relocs): Likewise.
1777         (elf32_tic6x_allocate_dynrelocs): Likewise.
1778         * elf32-tilepro.c (tilepro_elf_link_hash_entry): Remove
1779         dyn_relocs.
1780         (link_hash_newfunc): Updated.
1781         (tilepro_elf_copy_indirect_symbol): Likewise.
1782         (tilepro_elf_check_relocs): Likewise.
1783         (allocate_dynrelocs): Likewise.
1784         * elf64-ppc.c (ppc_link_hash_entry): Remove dyn_relocs.
1785         (ppc64_elf_copy_indirect_symbol): Updated.
1786         (ppc64_elf_check_relocs): Likewise.
1787         (readonly_dynrelocs): Likewise.
1788         (ppc64_elf_adjust_dynamic_symbol): Likewise.
1789         (dec_dynrel_count): Likewise.
1790         (allocate_dynrelocs): Likewise.
1791         (ppc64_elf_relocate_section): Likewise.
1792         * elf64-s390.c (elf_s390_link_hash_entry): Remove dyn_relocs.
1793         (link_hash_newfunc): Updated.
1794         (elf_s390_copy_indirect_symbol): Likewise.
1795         (readonly_dynrelocs): Likewise.
1796         (allocate_dynrelocs): Likewise.
1797         * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
1798         * elfnn-aarch64.c (elf_aarch64_link_hash_entry): Remove
1799         dyn_relocs.
1800         (elfNN_aarch64_link_hash_newfunc): Updated.
1801         (elfNN_aarch64_copy_indirect_symbol): Likewise.
1802         (readonly_dynrelocs): Likewise.
1803         (need_copy_relocation_p): Likewise.
1804         (elfNN_aarch64_allocate_dynrelocs): Likewise.
1805         (elfNN_aarch64_allocate_ifunc_dynrelocs): Likewise.
1806         * elfnn-riscv.c (riscv_elf_link_hash_entry): Remove dyn_relocs.
1807         (link_hash_newfunc): Updated.
1808         (riscv_elf_copy_indirect_symbol): Likewise.
1809         (riscv_elf_check_relocs): Likewise.
1810         (readonly_dynrelocs): Likewise.
1811         (allocate_dynrelocs): Likewise.
1812         * elfxx-sparc.c (_bfd_sparc_elf_link_hash_entry): Remove
1813         dyn_relocs.
1814         (link_hash_newfunc): Updated.
1815         (_bfd_sparc_elf_copy_indirect_symbol): Likewise.
1816         (_bfd_sparc_elf_check_relocs): Likewise.
1817         (readonly_dynrelocs): Likewise.
1818         (allocate_dynrelocs): Likewise.
1819         * elfxx-tilegx.c (tilegx_elf_link_hash_entry): Remove dyn_relocs.
1820         (link_hash_newfunc): Updated.
1821         (tilegx_elf_copy_indirect_symbol): Likewise.
1822         (tilegx_elf_check_relocs): Likewise.
1823         (readonly_dynrelocs): Likewise.
1824         (allocate_dynrelocs): Likewise.
1825         * elfxx-x86.c (elf_x86_allocate_dynrelocs): Likewise.
1826         (readonly_dynrelocs): Likewise.
1827         (_bfd_x86_elf_copy_indirect_symbol): Likewise.
1828         * elfxx-x86.h (elf_x86_link_hash_entry): Remove dyn_relocs.
1829
1830 2020-06-01  Alan Modra  <[email protected]>
1831
1832         * vms-alpha.c (_bfd_vms_slurp_etir): Check bound for the current
1833         command against cmd_length, not the end of record.  For
1834         ETIR__C_STO_IMMR check size against cmd_length, mask repeat count
1835         to 32-bits and break out on zero size.  Add ETIR__C_STC_LP_PSB
1836         cmd_length test.
1837
1838 2020-05-28  David Faust  <[email protected]>
1839
1840         * elf64-bpf.c (bpf_elf_relocate_section): Fix handling of
1841         R_BPF_INSN_{32,64} relocations.
1842
1843 2020-05-28  Stephen Casner  <[email protected]>
1844
1845         * pdp11.c: Implement BRD_RELOC_32 to relocate the low 16 bits of
1846         addreses in .long (used in testsuites) and .stab values.
1847
1848 2020-05-27  H.J. Lu  <[email protected]>
1849
1850         PR ld/22909
1851         * elflink.c (bfd_elf_final_link): Use bfd_link_textrel_check.
1852         Check bfd_link_dll when issue a DT_TEXTREL warning.
1853         * elfxx-x86.c (maybe_set_textrel): Likewise.
1854         (_bfd_x86_elf_size_dynamic_sections): Likewise.
1855
1856 2020-05-26  Nick Clifton  <[email protected]>
1857
1858         * plugin.c (try_load_plugin): Extend error message when a plugin
1859         fails to open.
1860
1861 2020-05-23  Alan Modra  <[email protected]>
1862
1863         * bfdio.c (bfd_get_file_size): Don't segfault on NULL arch_header.
1864
1865 2020-05-22  Alan Modra  <[email protected]>
1866
1867         PR 25882
1868         * elf32-ppc.c (_bfd_elf_ppc_merge_fp_attributes): Don't init FP
1869         attributes from shared libraries, and do not return an error if
1870         they don't match.
1871
1872 2020-05-21  Alan Modra  <[email protected]>
1873
1874         PR 25993
1875         * opncls.c (_bfd_free_cached_info): Keep a copy of the bfd
1876         filename.
1877         (_bfd_delete_bfd): Free the copy.
1878         (_bfd_new_bfd): Free nbfd->memory on error.
1879
1880 2020-05-21  Alan Modra  <[email protected]>
1881
1882         * aoutx.h: Replace "if (x) free (x)" with "free (x)" throughout.
1883         * archive.c, * bfd.c, * bfdio.c, * coff-alpha.c, * coff-ppc.c,
1884         * coff-sh.c, * coff-stgo32.c, * coffcode.h, * coffgen.c,
1885         * cofflink.c, * cpu-arm.c, * doc/chew.c, * dwarf2.c, * ecoff.c,
1886         * ecofflink.c, * elf-eh-frame.c, * elf-m10200.c, * elf-m10300.c,
1887         * elf-strtab.c, * elf.c, * elf32-arc.c, * elf32-arm.c,
1888         * elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c, * elf32-crx.c,
1889         * elf32-epiphany.c, * elf32-ft32.c, * elf32-h8300.c,
1890         * elf32-ip2k.c, * elf32-m32c.c, * elf32-m68hc11.c,
1891         * elf32-m68k.c, * elf32-microblaze.c, * elf32-msp430.c,
1892         * elf32-nds32.c, * elf32-nios2.c, * elf32-ppc.c, * elf32-pru.c,
1893         * elf32-rl78.c, * elf32-rx.c, * elf32-sh.c, * elf32-spu.c,
1894         * elf32-v850.c, * elf32-xtensa.c, * elf64-alpha.c,
1895         * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mips.c
1896         * elf64-mmix.c, * elf64-ppc.c, * elf64-sparc.c, * elfcode.h,
1897         * elflink.c, * elfnn-ia64.c, * elfnn-riscv.c, * elfxx-mips.c,
1898         * elfxx-x86.c, * format.c, * ihex.c, * libbfd.c, * linker.c,
1899         * mmo.c, * opncls.c, * pdp11.c, * peXXigen.c, * pef.c,
1900         * peicode.h, * simple.c, * som.c, * srec.c, * stabs.c, * syms.c,
1901         * targets.c, * vms-lib.c, * xcofflink.c, * xtensa-isa.c: Likewise.
1902
1903 2020-05-20  Nelson Chu  <[email protected]>
1904
1905         * elfxx-riscv.h (riscv_parse_subset_t): Add new callback function
1906         get_default_version.  It is used to find the default version for
1907         the specific extension.
1908         * elfxx-riscv.c (riscv_parsing_subset_version): Remove the parameters
1909         default_major_version and default_minor_version.  Add new bfd_boolean
1910         parameter *use_default_version.  Set it to TRUE if we need to call
1911         the callback rps->get_default_version to find the default version.
1912         (riscv_parse_std_ext): Call rps->get_default_version if we fail to find
1913         the default version in riscv_parsing_subset_version, and then call
1914         riscv_add_subset to add the subset into subset list.
1915         (riscv_parse_prefixed_ext): Likewise.
1916         (riscv_std_z_ext_strtab): Support Zicsr extensions.
1917         * elfnn-riscv.c (riscv_merge_std_ext): Use strcasecmp to compare the
1918         strings rather than characters.
1919         riscv_merge_arch_attr_info): The callback function get_default_version
1920         is only needed for assembler, so set it to NULL int the linker.
1921         * elfxx-riscv.c (riscv_estimate_digit): Remove the static.
1922         * elfxx-riscv.h: Updated.
1923
1924 2020-05-20  Alan Modra  <[email protected]>
1925
1926         PR 25993
1927         * archive.c (_bfd_get_elt_at_filepos): Don't strdup filename,
1928         use bfd_set_filename.
1929         * elfcode.h (_bfd_elf_bfd_from_remote_memory): Likewise.
1930         * mach-o.c (bfd_mach_o_fat_member_init): Likewise.
1931         * opncls.c (bfd_fopen, bfd_openstreamr, bfd_openr_iovec, bfd_openw),
1932         (bfd_create): Likewise.
1933         (_bfd_delete_bfd): Don't free filename.
1934         (bfd_set_filename): Copy filename param to bfd_alloc'd memory,
1935         return pointer to the copy or NULL on alloc fail.
1936         * vms-lib.c (_bfd_vms_lib_get_module): Free newname and test
1937         result of bfd_set_filename.
1938         * bfd-in2.h: Regenerate.
1939
1940 2020-05-20  Alan Modra  <[email protected]>
1941
1942         PR 26011
1943         * elf.c (_bfd_elf_get_reloc_upper_bound): Sanity check reloc
1944         section size against file size.
1945         (_bfd_elf_get_dynamic_reloc_upper_bound): Likewise.
1946
1947 2020-05-19  Gunther Nikl  <[email protected]>
1948
1949         PR 26005
1950         * elf.c (bfd_section_from_shdr): Replace bfd_zmalloc with bfd_malloc
1951         and memset when allocating memory for the sections_being_created
1952         array.
1953
1954 2020-05-19  Stafford Horne  <[email protected]>
1955
1956         * elf32-or1k.c (or1k_elf_finish_dynamic_symbol): Rename srela
1957         to relgot.
1958         (or1k_elf_relocate_section): Access srelgot via
1959         htab->root.srelgot.  Add assertions for srelgot->contents.
1960         Introduce local variable for srelgot to not reuse global
1961         sreloc.
1962         (or1k_elf_relocate_section): Fixup dynamic symbol detection.
1963         (or1k_set_got_and_rela_sizes): New function.
1964         (or1k_initial_exec_offset): New function.
1965         (TLS_GD, TLS_IE, TLS_LD, TLS_LE): Redefine macros as masks.
1966         (or1k_elf_relocate_section): Allow for TLS to handle multiple
1967         model access.
1968         (or1k_elf_check_relocs): Use OR to set TLS access.
1969         (allocate_dynrelocs): Use or1k_set_got_and_rela_sizes to set
1970         sizes.
1971         (or1k_elf_size_dynamic_sections): Use
1972         or1k_set_got_and_rela_sizes to set sizes.
1973         (or1k_elf_relocate_section): Fixup PCREL relocation calculation.
1974         (TCB_SIZE): New macro.
1975         (tpoff): Use TCB_SIZE and alignment to calculate offset.
1976         (allocate_dynrelocs, readonly_dynrelocs, or1k_elf_check_relocs)
1977         (or1k_elf_size_dynamic_sections): Rename p to sec_relocs.
1978         (allocate_dynrelocs): Rename s to splt or sgot based on usage.
1979         (tpoff): Add dynamic boolean argument.
1980         (or1k_elf_relocate_section): Pass dynamic flag to tpoff.
1981
1982 2020-05-19  Siddhesh Poyarekar  <[email protected]>
1983
1984         * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Club
1985         BFD_RELOC_AARCH64_BRANCH19 and BFD_RELOC_AARCH64_TSTBR14
1986         cases with BFD_RELOC_AARCH64_JUMP26.
1987         (elfNN_aarch64_check_relocs): Likewise.
1988
1989 2020-05-19  Alan Modra  <[email protected]>
1990
1991         * aix5ppc-core.c (xcoff64_core_file_matches_executable_p): Use
1992         bfd_get_filename rather than accessing bfd->filename directly.
1993         * aout-target.h (MY (object_p)): Likewise.
1994         * aoutx.h (aout_find_nearest_line, aout_link_write_symbols): Likewise.
1995         * archive.c (find_nested_archive, _bfd_generic_read_ar_hdr_mag),
1996         (_bfd_construct_extended_name_table, _bfd_bsd44_write_ar_hdr),
1997         (_bfd_archive_bsd44_construct_extended_name_table),
1998         (_bfd_write_archive_contents, _bfd_compute_and_write_armap),
1999         (_bfd_bsd_write_armap): Likewise.
2000         * bfd.c (bfd_errmsg, _bfd_doprnt): Likewise.
2001         * cache.c (bfd_open_file): Likewise.
2002         * ecoff.c (_bfd_ecoff_write_armap): Likewise.
2003         * ecofflink.c (bfd_ecoff_debug_accumulate_other): Likewise.
2004         * elf32-bfin.c (bfinfdpic_relocate_section): Likewise.
2005         * elf32-frv.c (elf32_frv_relocate_section): Likewise.
2006         * elf32-hppa.c (elf32_hppa_final_link): Likewise.
2007         * elf32-nds32.c (nds32_elf_output_symbol_hook),
2008         (patch_tls_desc_to_ie): Likewise.
2009         * elf32-spu.c (sort_bfds, print_one_overlay_section),
2010         (spu_elf_auto_overlay): Likewise.
2011         * elf64-hppa.c (elf_hppa_final_link): Likewise.
2012         * elf64-ia64-vms.c (elf64_ia64_size_dynamic_sections): Likewise.
2013         * elfcore.h (elf_core_file_matches_executable_p): Likewise.
2014         * elflink.c (bfd_elf_size_dynamic_sections),
2015         (elf_link_input_bfd): Likewise.
2016         * linker.c (_bfd_generic_link_output_symbols): Likewise.
2017         * mach-o.c (bfd_mach_o_follow_dsym),
2018         (bfd_mach_o_close_and_cleanup): Likewise.
2019         * opncls.c (_bfd_delete_bfd, _maybe_make_executable),
2020         (find_separate_debug_file, get_build_id_name): Likewise.
2021         * pdp11.c (aout_find_nearest_line, aout_link_write_symbols): Likewise.
2022         * plugin.c (bfd_plugin_open_input): Likewise.
2023         * rs6000-core.c (rs6000coff_core_file_matches_executable_p): Likewise.
2024         * som.c (som_write_armap): Likewise.
2025         * srec.c (srec_write_record, srec_write_symbols): Likewise.
2026         * vms-lib.c (_bfd_vms_lib_get_imagelib_file),
2027         (_bfd_vms_lib_write_archive_contents): Likewise.
2028         * xcofflink.c (xcoff_link_add_dynamic_symbols): Likewise.
2029
2030 2020-05-19  Alan Modra  <[email protected]>
2031
2032         PR 25713
2033         * bfdio.c (_bfd_real_fopen): Typo fix.
2034
2035 2020-05-18  Nick Clifton  <[email protected]>
2036
2037         PR 26005
2038         * elf.c (bfd_section_from_shdr): Use bfd_malloc to allocate memory
2039         for the sections_being_created array.
2040
2041 2020-05-18  Alan Modra  <[email protected]>
2042
2043         * ecoff.c (ecoff_slurp_reloc_table): Malloc external_relocs so
2044         they can be freed without also freeing internal_relocs.
2045
2046 2020-05-18  Jaydeep Chauhan  <[email protected]>
2047
2048         PR 25713
2049         * bfdio.c (_bfd_real_fopen): Convert UNIX style sirectory
2050         separators into DOS style when creating a WIN32 fullpath.
2051
2052 2020-05-14  Nelson Chu  <[email protected]>
2053
2054         * elfnn-riscv.c (elfNN_riscv_mkobject):  New function.  We need this
2055         to initialize RISC-V tdata.
2056
2057 2020-05-12  Gunther Nikl  <[email protected]>
2058
2059         * aoutx.h (NAME (aout, swap_std_reloc_out)): Reject an unsupported
2060         relocation size.
2061
2062 2020-05-11  Alan Modra  <[email protected]>
2063
2064         * elf64-ppc.c (xlate_pcrel_opt): Handle lxvp and stxvp.
2065
2066 2020-05-11  Alan Modra  <[email protected]>
2067
2068         * elf64-ppc.c: Rename powerxx to power10 throughout.
2069
2070 2020-05-11  Alan Modra  <[email protected]>
2071
2072         PR 25961
2073         * coffgen.c (coff_get_normalized_symtab): Check that buffer
2074         contains required number of auxents before processing any auxent.
2075         * coffswap.h (coff_swap_aux_in <C_FILE>): Only swap in extended
2076         file name from auxents for PE.
2077
2078 2020-05-04  Gunther Nikl  <[email protected]>
2079
2080         * aout-cris.c (DEFAULT_ARCH): Delete define.
2081         (MY_set_arch_mach): Likewise.
2082         (SET_ARCH_MACH): Use bfd_set_arch_mach with an explicit architecture
2083         of bfd_arch_cris.
2084         (swap_ext_reloc_in): Add casts to r_index extraction. Mask valid bits
2085         of r_type before the shift.
2086
2087 2020-05-04  Wilco Dijkstra  <[email protected]>
2088
2089         PR ld/25665
2090         * elfnn-aarch64.c (group_sections): Copy implementation from
2091         elf32-arm.c.
2092
2093 2020-05-01  Alan Modra  <[email protected]>
2094
2095         PR 25900
2096         * elfnn-riscv.c (_bfd_riscv_relax_section): Check root.type before
2097         accessing root.u.def of symbols.  Also check root.u.def.section
2098         is non-NULL.  Reverse tests so as to make the logic positive.
2099
2100 2020-05-01  Alan Modra  <[email protected]>
2101
2102         PR 25882
2103         * elf32-tic6x.c (elf32_tic6x_merge_attributes): Don't transfer
2104         Tag_ABI_PIC or Tag_ABI_PID from dynamic objects to the output.
2105
2106 2020-05-01  Alan Modra  <[email protected]>
2107
2108         PR 25882
2109         * elf32-bfin.c (elf32_bfin_merge_private_bfd_data): Add FIXME.
2110         * elf32-frv.c (frv_elf_merge_private_bfd_data): Likewise.
2111         * elfxx-mips.c (_bfd_mips_elf_merge_private_bfd_data): Likewise.
2112         * elf32-nds32.c (nds32_elf_merge_private_bfd_data): Likewise.
2113         * elf32-score.c (s3_elf32_score_merge_private_bfd_data): Likewise.
2114         * elf32-score7.c (s7_elf32_score_merge_private_bfd_data): Likewise.
2115         * elf32-sh.c (sh_elf_merge_private_data): Likewise.
2116         * elf32-tic6x.c (elf32_tic6x_merge_attributes): Likewise.
2117         * elf64-ia64-vms.c (elf64_ia64_merge_private_bfd_data): Likewise.
2118         * elfnn-ia64.c (elfNN_ia64_merge_private_bfd_data): Likewise.
2119
2120 2020-05-01  Alan Modra  <[email protected]>
2121
2122         PR 25882
2123         * elf32-ppc.c (ppc_elf_merge_private_bfd_data): Ignore e_flags
2124         from shared libraries.
2125
2126 2020-04-29  Max Filippov  <[email protected]>
2127
2128         * elf32-xtensa.c (relax_section): Don't negate diff_value for
2129         XTENSA_NDIFF relocations. Don't add sign bits whe diff_value
2130         equals 0. Report overflow when the result has negative sign but
2131         all significant bits are zero.
2132
2133 2020-04-29  Gunther Nikl  <[email protected]>
2134
2135         * aoutx.h (swap_std_reloc_out): Special case 64 bit relocations.
2136         (aout_link_reloc_link_order): Likewise. Make r_length an unsigned.
2137
2138 2020-04-28  Alan Modra  <[email protected]>
2139
2140         * vms-alpha.c (_bfd_vms_slurp_etir): Correct divide by zero check.
2141         Emit warning message.
2142
2143 2020-04-27  Tamar Christina  <[email protected]>
2144
2145         * coff-i386.c (COFF_WITH_PE_BIGOBJ): New.
2146         * coff-x86_64.c (COFF_WITH_PE_BIGOBJ): New.
2147         * config.bfd (targ_selvecs): Rename x86_64_pe_be_vec
2148         to x86_64_pe_big_vec as it not a big-endian format.
2149         (vec i386_pe_big_vec): New.
2150         * configure.ac: Likewise.
2151         * targets.c: Likewise.
2152         * configure: Regenerate.
2153         * pe-i386.c (TARGET_SYM_BIG, TARGET_NAME_BIG,
2154         COFF_WITH_PE_BIGOBJ): New.
2155         * pe-x86_64.c (TARGET_SYM_BIG, TARGET_NAME_BIG):
2156         New.
2157         (x86_64_pe_be_vec): Moved.
2158
2159 2020-04-23  Anton Kolesov  <[email protected]>
2160
2161         * elf-bfd.h (elfcore_write_arc_v2): Add prototype.
2162         * elf.c (elfcore_grok_arc_v2): New function.
2163         (elfcore_grok_note): Call the new function to handle the corresponding
2164         note.
2165         (elfcore_write_arc_v2): New function.
2166         (elfcore_write_register_note): Call the new function to handle the
2167         corresponding pseudo-sections.
2168
2169 2020-04-22  Max Filippov  <[email protected]>
2170
2171         PR ld/25861
2172         * bfd-in2.h: Regenerated.
2173         * elf32-xtensa.c (elf_howto_table): New entries for
2174         R_XTENSA_PDIFF{8,16,32} and R_XTENSA_NDIFF{8,16,32}.
2175         (elf_xtensa_reloc_type_lookup, elf_xtensa_do_reloc)
2176         (relax_section): Add cases for R_XTENSA_PDIFF{8,16,32} and
2177         R_XTENSA_NDIFF{8,16,32}.
2178         * libbfd.h (bfd_reloc_code_real_names): Add names for
2179         BFD_RELOC_XTENSA_PDIFF{8,16,32} and
2180         BFD_RELOC_XTENSA_NDIFF{8,16,32}.
2181         * reloc.c: Add documentation for BFD_RELOC_XTENSA_PDIFF{8,16,32}
2182         and BFD_RELOC_XTENSA_NDIFF{8,16,32}.
2183
2184 2020-04-21  Tamar Christina  <[email protected]>
2185
2186         PR binutils/24753
2187         * compress.c (bfd_get_full_section_contents): Exclude sections with no
2188         content.
2189
2190 2020-04-21  H.J. Lu  <[email protected]>
2191
2192         PR ld/25849
2193         * elf-bfd.h (elf_backend_data): Add
2194         elf_backend_strip_zero_sized_dynamic_sections.
2195         (_bfd_elf_strip_zero_sized_dynamic_sections): New prototype.
2196         * elf64-alpha.c (elf_backend_strip_zero_sized_dynamic_sections):
2197         New macro.
2198         * elflink.c (_bfd_elf_strip_zero_sized_dynamic_sections): New
2199         function.
2200         * elfxx-target.h (elf_backend_strip_zero_sized_dynamic_sections):
2201         New macro.
2202         (elfNN_bed): Add elf_backend_strip_zero_sized_dynamic_sections.
2203
2204 2020-04-21  H.J. Lu  <[email protected]>
2205
2206         * elf64-alpha.c (alpha_elf_reloc_entry): Replace reltext with
2207         sec.
2208         (elf64_alpha_check_relocs): Set sec instead of reltext.  Warn
2209         DT_TEXTREL with -M.
2210         (elf64_alpha_calc_dynrel_sizes): Warn DT_TEXTREL with -M.
2211
2212 2020-04-21  Nick Clifton  <[email protected]>
2213
2214         * po/sr.po: Updated Serbian translation.
2215
2216 2020-04-21  Alan Modra  <[email protected]>
2217
2218         * elf32-sh.c (sh_elf_relocate_section): Remove STO_SH5_ISA32
2219         processing.
2220
2221 2020-04-20  Stephen Casner  <[email protected]>
2222
2223         * pdp11.c (N_STAB): Modify value to avoid conflict with N_EXT
2224         causing globals from linker script to be treated as debug symbols.
2225         (translate_symbol_table): Don't sign-extend symbol values from 16
2226         to 64 bits in nm output.
2227
2228 2020-04-20  Alan Modra  <[email protected]>
2229
2230         * elf64-ppc.c (ppc64_elf_size_stubs): Strip relbrlt too.
2231
2232 2020-04-18  Alan Modra  <[email protected]>
2233
2234         * section.c (bfd_is_const_section): Correct test for special
2235         sections.
2236         * bfd-in2.h: Regenerate.
2237
2238 2020-04-17  Alan Modra  <[email protected]>
2239
2240         PR 25842
2241         * elf.c (_bfd_elf_get_symbol_version_string): Don't segfault on
2242         NULL nodename.
2243
2244 2020-04-16  Nick Clifton  <[email protected]>
2245
2246         PR 25803
2247         * elfxx-mips.c (_bfd_mips_elf_adjust_dynamic_symbol): Replace an
2248         abort with a more helpful error message.
2249
2250 2020-04-16  Alan Modra  <[email protected]>
2251
2252         PR 25827
2253         * dwarf2.c (scan_unit_for_symbols): Wrap overlong lines.  Don't
2254         strdup(0).
2255
2256 2020-04-15  Fangrui Song <[email protected]>
2257
2258         PR binutils/24613
2259         * coff-rs6000.c (xcoff_ppc_relocate_section): Change RM_GENERATE_ERROR
2260         to RM_DIAGNOSE plus a check of warn_unresolved_syms.
2261         * coff64-rs6000.c (xcoff_ppc_relocate_section): Likewise.
2262         * elf-bfd.h (_bfd_elf_large_com_section): Likewise.
2263         * elf32-m32r.c (m32r_elf_relocate_section): Likewise.
2264         * elf32-score.c (s3_bfd_score_elf_relocate_section): Likewise.
2265         * elf32-score7.c (s7_bfd_score_elf_relocate_section): Likewise.
2266         * elf32-sh.c (sh_elf_relocate_section): Likewise.
2267         * elf32-spu.c (spu_elf_relocate_section): Likewise.
2268         * elf64-hppa.c (elf64_hppa_relocate_section): Likewise.
2269         * elflink.c (elf_link_output_extsym): Likewise.
2270         * elfxx-mips.c (mips_elf_calculate_relocation): Likewise.
2271
2272 2020-04-15  Alan Modra  <[email protected]>
2273
2274         PR 25823
2275         * peXXigen.c (_bfd_XXi_swap_sym_in <C_SECTION>): Don't use a
2276         pointer into strings that may be freed for section name, always
2277         allocate a new string.
2278
2279 2020-04-14  Juan Manuel Guerrero  <[email protected]>
2280             Jan W. Jagersma  <[email protected]>
2281
2282         * coff-go32.c (COFF_GO32, IMAGE_SCN_LNK_NRELOC_OVFL)
2283         (coff_SWAP_scnhdr_in, coff_SWAP_scnhdr_out): Define.
2284         (_bfd_go32_swap_scnhdr_in, _bfd_go32_swap_scnhdr_out)
2285         (_bfd_go32_mkobject): New functions.
2286         * coff-stgo32.c (IMAGE_SCN_LNK_NRELOC_OVFL)
2287         (coff_SWAP_scnhdr_in, coff_SWAP_scnhdr_out): Define.
2288         (go32exe_mkobject): Call _bfd_go32_mkobject.
2289         * coffcode.h (COFF_WITH_EXTENDED_RELOC_COUNTER): Define.
2290         (coff_set_alignment_hook): Define function for COFF_GO32_EXE
2291         and COFF_GO32.
2292         (coff_write_relocs): Enable extended reloc counter code if
2293         COFF_WITH_EXTENDED_RELOC_COUNTER is defined.  Test for obj_go32.
2294         (coff_write_object_contents): Likewise.  Pad section headers
2295         for COFF_GO32 and COFF_GO32EXE.  Use bfd_coff_swap_scnhdr_out
2296         instead of coff_swap_scnhdr_out.
2297         * cofflink.c (_bfd_coff_final_link): Test also for obj_go32 to
2298         enable extended reloc counter.
2299         * coffswap.h: (coff_swap_scnhdr_in, coff_swap_scnhdr_out):
2300         Declare with ATTRIBUTE_UNUSED.
2301         * libcoff-in.h: (struct coff_tdata): New field go32.
2302         (obj_go32): Define.
2303         * libcoff.h: Regenerate.
2304
2305 2020-04-14  Fangrui Song  <[email protected]>
2306
2307         PR gas/25768
2308         * elf.c (assign_section_numbers): Always set .stab sh_entsize to
2309         12.
2310
2311 2020-04-14  Stephen Casner  <[email protected]>
2312
2313         PR ld/25677
2314         * pdp11.c: Add implementation of --imagic option.
2315         (adjust_o_magic): Fix objcopy --extract-symbol test.
2316         * libaout.h (enum aout_magic): Add i_magic.
2317
2318 2020-04-07  Rainer Orth  <[email protected]>
2319             Nick Clifton  <[email protected]>
2320
2321         * elf32-sparc.c (sparc_final_write_processing): Fix whitespace.
2322         <0>: Ignore.
2323         <default>: Error rather than abort.
2324
2325 2020-04-03  H.J. Lu  <[email protected]>
2326
2327         PR ld/25767
2328         * elf.c (_bfd_elf_fixup_group_sections): Remove zero-sized
2329         relocation section from section group.
2330
2331 2020-04-02  Jan W. Jagersma  <[email protected]>
2332
2333         * bfdio.c (bfd_bread, bfd_tell, bfd_seek, bfd_mmap): Always add
2334         bfd->origin to file offset.
2335         * bfdwin.c (bfd_get_file_window): Likewise.
2336         * bfd.c: Clarify the use of the bfd->origin field.
2337         * bfd-in2.h: Regenerate.
2338         * coff-i386.c: Don't include go32exe.h. Allow overriding
2339         coff_write_object_contents via COFF_WRITE_CONTENTS.
2340         * coff-stgo32.c (go32exe_cleanup, go32exe_mkobject)
2341         (go32exe_write_object_contents): New functions.
2342         (go32exe_temp_stub, go32exe_temp_stub_size): New static globals.
2343         (COFF_WRITE_CONTENTS, GO32EXE_DEFAULT_STUB_SIZE): Define.
2344         (create_go32_stub): Remove check for 2k size limit.  Read stub
2345         from go32exe_temp_stub if present.
2346         (go32_stubbed_coff_bfd_copy_private_bfd_data): Allocate and
2347         copy variable-length stub.
2348         (go32_check_format): Read stub to go32exe_temp_stub, set
2349         origin, return go32exe_cleanup.
2350         (adjust_filehdr_in_post, adjust_filehdr_out_pre)
2351         (adjust_filehdr_out_post, adjust_scnhdr_in_post)
2352         (adjust_scnhdr_out_pre, adjust_scnhdr_out_post)
2353         (adjust_aux_in_post, adjust_aux_out_pre, adjust_aux_out_post):
2354         Remove functions and their associated #defines.
2355         * coffcode.h (coff_mkobject_hook): Remove stub copying code.
2356         * libcoff-in.h: (struct coff_tdata): New field stub_size.
2357         Rename field go32stub to stub.
2358         * libcoff.h: Regenerate.
2359         * coff-stgo32.c (go32_check_format): Rename to...
2360         (go32exe_check_format): ...this.
2361         (go32_stubbed_coff_bfd_copy_private_bfd_data): Rename to...
2362         (go32exe_copy_private_bfd_data): ...this.
2363         (stub_bytes): Rename to...
2364         (go32exe_default_stub): ...this.
2365         (create_go32_stub): Rename to...
2366         (go32exe_create_stub): ...this.
2367         * coff-stgo32.c (go32exe_copy_private_bfd_data): Avoid realloc
2368         when possible.
2369
2370 2020-04-01  H.J. Lu  <[email protected]>
2371
2372         PR ld/25749
2373         PR ld/25754
2374         * elf32-i386.c (elf_i386_convert_load_reloc): Convert load
2375         relocation to R_386_32 for relocation against non-preemptible
2376         absolute symbol.
2377         (elf_i386_check_relocs): Call _bfd_elf_x86_valid_reloc_p.  Don't
2378         allocate dynamic relocation for non-preemptible absolute symbol.
2379         (elf_i386_relocate_section): Pass sec to
2380         GENERATE_DYNAMIC_RELOCATION_P.
2381         * elf64-x86-64.c (R_X86_64_converted_reloc_bit): Moved.
2382         (elf_x86_64_convert_load_reloc): Covert load relocation to
2383         R_X86_64_32S or R_X86_64_32 for relocation against non-preemptible
2384         absolute symbol.  Don't convert to R_X86_64_32S nor R_X86_64_32
2385         for non-preemptible absolute symbol if they overflow.
2386         (elf_x86_64_check_relocs): Call _bfd_elf_x86_valid_reloc_p.  Set
2387         tls_type for GOT slot to GOT_ABS for non-preemptible absolute
2388         symbol.  Don't allocate dynamic relocation for non-preemptible
2389         absolute symbol.
2390         (elf_x86_64_relocate_section): Don't generate relative relocation
2391         for GOTPCREL relocations aganst local absolute symbol.  Pass sec
2392         to GENERATE_DYNAMIC_RELOCATION_P.
2393         * elfxx-x86.c (elf_x86_allocate_dynrelocs): No dynamic relocation
2394         against non-preemptible absolute symbol.
2395         (_bfd_elf_x86_valid_reloc_p): New function.
2396         (_bfd_x86_elf_size_dynamic_sections): No dynamic relocation for
2397         GOT_ABS GOT slot.
2398         * elfxx-x86.h (GENERATE_DYNAMIC_RELOCATION_P): Add an SEC
2399         argument.  Don't generate dynamic relocation against
2400         non-preemptible absolute symbol.
2401         (ABS_SYMBOL_P): New.
2402         (GENERATE_RELATIVE_RELOC_P): Don't generate relative relocation
2403         against non-preemptible absolute symbol.
2404         (GOT_ABS): New.
2405         (R_X86_64_converted_reloc_bit): New.  Moved from elf64-x86-64.c.
2406         (_bfd_elf_x86_valid_reloc_p): New.
2407
2408 2020-04-01  Tamar Christina  <[email protected]>
2409
2410         PR ld/16017
2411         * elf32-arm.c (elf32_arm_populate_plt_entry): Set LSB of the PLT0
2412         address in the GOT if in thumb only mode.
2413
2414 2020-04-01  Tamar Christina  <[email protected]>
2415
2416         * elf32-arm.c (elf32_thumb2_plt_entry): Fix PC-rel offset.
2417
2418 2020-04-01  Hans-Peter Nilsson  <[email protected]>
2419
2420         * mmo.c (mmo_scan): Create .text section only when needed, not
2421         from the start.
2422
2423 2020-03-31  Alan Modra  <[email protected]>
2424
2425         * coff-alpha.c (alpha_ecoff_get_elt_at_filepos): Correct bfd_bread
2426         return value check.
2427
2428 2020-03-31  Alan Modra  <[email protected]>
2429
2430         * vms-alpha.c (image_write): Check bounds for sections without
2431         contents too.  Error on non-zero write to section without
2432         contents.
2433         (_bfd_vms_slurp_etir): Check return of image_write* functions.
2434
2435 2020-03-31  Alan Modra  <[email protected]>
2436
2437         * tekhex.c (pass_over): Check is_eof before reading buffer.
2438
2439 2020-03-30  Nick Clifton  <[email protected]>
2440
2441         PR binutils/pr25662
2442         * libcoff-in.h (struct pe_tdata): Rename the insert_timestamp
2443         field to timestamp and make it an integer.
2444         * libcoff.h: Regenerate.
2445         * peXXigen.c (_bfd_XXi_only_swap_filehdr_out): Test the timestamp
2446         field in the pe_data structure rather than the insert_timestamp
2447         field.
2448
2449 2020-03-30  Alan Modra  <[email protected]>
2450
2451         PR 25745
2452         * elf64-ppc.c (ppc64_elf_build_stubs): Use asprintf to form
2453         statistics message.
2454
2455 2020-03-26  Nick Clifton  <[email protected]>
2456
2457         * cofflink.c (bfd_coff_get_internal_extra_pe_aouthdr): Delete.
2458         * libbfd-in.h (bfd_coff_get_internal_extra_pe_aouthdr): Remove
2459         prototype.
2460         * libbfd.h: Regenerate.
2461
2462 2020-03-26  Alan Modra  <[email protected]>
2463
2464         * i386msdos.c (msdos_object_p): Catch -1 return from bfd_bread.
2465
2466 2020-03-26  Alan Modra  <[email protected]>
2467
2468         * vms-alpha.c (dst_define_location): Limit size of dst_ptr_offsets
2469         array.
2470         (_bfd_vms_slurp_object_records): Rename "err" to "ok".
2471
2472 2020-03-25  Nick Clifton  <[email protected]>
2473
2474         * cofflink.c (bfd_coff_get_internal_extra_pe_aouthdr): New
2475         function.
2476         * libbfd-in.h (bfd_coff_get_internal_extra_pe_aouthdr): Prototype.
2477         * libbfd.h: Regenerate.
2478
2479 2020-03-25  Shahab Vahedi  <[email protected]>
2480
2481         * elf32-arc.c (PRINT_DEBUG_RELOC_INFO_BEFORE): Use the
2482         correct field name in the output string.
2483
2484 2020-03-25  Alan Modra  <[email protected]>
2485
2486         PR 25662
2487         * elf.c (assign_file_positions_for_load_sections): Adjust offset
2488         for SHT_NOBITS section if first in segment.
2489
2490 2020-03-24  H.J. Lu  <[email protected]>
2491
2492         PR binutils/25708
2493         * elf-bfd.h (_bfd_elf_get_symbol_version_name): Renamed to ...
2494         (_bfd_elf_get_symbol_version_string): This.
2495         * elf.c (_bfd_elf_get_symbol_version_name): Renamed to ...
2496         (_bfd_elf_get_symbol_version_string): This.
2497         (bfd_elf_print_symbol): Pass TRUE to
2498         _bfd_elf_get_symbol_version_string.
2499         * libbfd-in.h (_bfd_nosymbols_get_symbol_version_string): Add a
2500         bfd_boolean argument.
2501         * syms.c (_bfd_nosymbols_get_symbol_version_string): Likewise.
2502         * targets.c  (_bfd_get_symbol_version_string): Likewise.
2503         (bfd_get_symbol_version_string): Likewise.
2504         * bfd-in2.h: Regenerated.
2505
2506 2020-03-24  Nick Clifton  <[email protected]>
2507             Jaydeep Chauhan  <[email protected]>
2508
2509         PR 25713
2510         * bfdio.c (_bfd_real_fopen): Add code to handle long filenames on
2511         Win32 systems.
2512
2513 2020-03-24  Nick Clifton  <[email protected]>
2514
2515         PR 25681
2516         * elf.c (_bfd_elf_map_sections_to_segments): When looking for a
2517         segment to use for PT_GNU_RELRO, ignore empty sections in a
2518         segment's current list.
2519
2520 2020-03-24  H.J. Lu  <[email protected]>
2521
2522         PR binutils/25717
2523         * elf-bfd.h (elf_obj_tdata): Change num_group to unsigned int.
2524
2525 2020-03-24  H.J. Lu  <[email protected]>
2526
2527         PR binutils/25708
2528         * elf-bfd.h (_bfd_elf_get_symbol_version_name): New.
2529         * elf.c (_bfd_elf_get_symbol_version_name): New function.  Based
2530         on the previous _bfd_elf_get_symbol_version_string.
2531         (_bfd_elf_get_symbol_version_string): Use it.
2532
2533 2020-03-24  Alan Modra  <[email protected]>
2534
2535         * archive.c (_bfd_generic_read_ar_hdr_mag): Sanity check extended
2536         name size.  Use bfd_malloc rather than bfd_zmalloc, clearing just
2537         struct areltdata.
2538
2539 2020-03-23  Sebastian Huber  <[email protected]>
2540
2541         * elflink.c (_bfd_elf_tls_setup): Mention .tdata in comment.
2542
2543 2020-03-23  Alan Modra  <[email protected]>
2544
2545         * ecoff.c (_bfd_ecoff_slurp_armap): Sanity check parsed_size and
2546         symbol count.  Allocate an extra byte to ensure name strings
2547         are terminated.  Sanity check name offsets.  Release memory on
2548         error return.
2549
2550 2020-03-23  Alan Modra  <[email protected]>
2551
2552         * i386msdos.c (msdos_object_p): Don't access e_lfanew when that
2553         field hasn't been read.  Remove unnecessary casts.
2554
2555 2020-03-22  Alan Modra  <[email protected]>
2556
2557         * coff64-rs6000.c (xcoff64_slurp_armap): Ensure size is large
2558         enough to read number of symbols.
2559
2560 2020-03-20  H.J. Lu  <[email protected]>
2561
2562         * configure.ac (HAVE_EXECUTABLE_SUFFIX): Removed.
2563         (EXECUTABLE_SUFFIX): Likewise.
2564         * config.in: Regenerated.
2565         * configure: Likewise.
2566         * plugin.c (bfd_plugin_close_and_cleanup): Defined as
2567         _bfd_generic_close_and_cleanup.
2568         (plugin_list_entry): Remove resolution_file, resolution_option,
2569         real_bfd, real_nsyms, real_syms, lto_nsyms, lto_syms, gcc,
2570         lto_wrapper, gcc_env and initialized,
2571         (need_lto_wrapper_p): Removed.
2572         (get_lto_wrapper): Likewise.
2573         (setup_lto_wrapper_env): Likewise.
2574         (register_all_symbols_read): Likewise.
2575         (egister_cleanup): Likewise.
2576         (get_symbols): Likewise.
2577         (add_input_file): Likewise.
2578         (bfd_plugin_set_program_name): Remove need_lto_wrapper.
2579         (add_symbols): Updated.
2580         (try_claim): Likewise.
2581         (try_load_plugin): Likewise.
2582         (bfd_plugin_canonicalize_symtab): Likewise.
2583         * plugin.h (bfd_plugin_set_program_name): Remove int argument.
2584         (plugin_data_struct): Remove real_bfd, real_nsyms and real_syms.
2585
2586 2020-03-19  H.J. Lu  <[email protected]>
2587
2588         PR binutils/25640
2589         * plugin.c (plugin_list_entry): Add has_symbol_type.
2590         (add_symbols_v2): New function.
2591         (bfd_plugin_open_input): Don't invoke LTO wrapper if LTO plugin
2592         provides symbol type.
2593         (try_load_plugin): Add LDPT_ADD_SYMBOLS_V2.
2594         (bfd_plugin_canonicalize_symtab): Use LTO plugin symbol type if
2595         available.
2596
2597 2020-03-20  Alan Modra  <[email protected]>
2598
2599         * coff-rs6000.c (_bfd_xcoff_slurp_armap): Ensure size is large
2600         enough to read number of symbols.
2601
2602 2020-03-20  Alan Modra  <[email protected]>
2603
2604         * elf.c (_bfd_elf_setup_sections): Don't test known non-NULL
2605         backend functions for NULL before calling.
2606         (copy_special_section_fields, _bfd_elf_copy_private_bfd_data),
2607         (bfd_section_from_shdr, assign_section_numbers): Likewise.
2608         * elfcode.h (elf_write_relocs, elf_slurp_reloc_table): Likewise.
2609         * elfnn-ia64.c (ignore_errors): New function.
2610         (elf_backend_link_order_error_handler): Redefine as ignore_errors.
2611
2612 2020-03-19  Nick Clifton  <[email protected]>
2613
2614         PR 25676
2615         * dwarf2.c (struct varinfo): Add unit_offset field to record the
2616         location of the varinfo in the unit's debug info data.  Change the
2617         type of the stack field to a boolean.
2618         (lookup_var_by_offset): New function.  Returns the varinfo
2619         structure for the variable described at the given offset in the
2620         unit's debug info.
2621         (scan_unit_for_symbols): Add support for variables which have the
2622         DW_AT_specification attribute.
2623
2624 2020-03-19  Nick Clifton  <[email protected]>
2625
2626         PR 25699
2627         * elf.c (bfd_elf_set_group_contents): Replace assertion with an
2628         error return.
2629
2630 2020-03-19  Sebastian Huber  <[email protected]>
2631
2632         * elfxx-riscv.c (riscv_parse_subset): Don't use C99.
2633
2634 2020-03-18  Nick Clifton  <[email protected]>
2635
2636         PR 25673
2637         * elf.c (_bfd_elf_write_secondary_reloc_section): Fix illegal
2638         memory access when processing a corrupt secondary reloc section.
2639
2640 2020-03-18  Christophe Lyon  <[email protected]>
2641
2642         * elf32-arm.c (arm_build_one_stub): Emit a fatal error message
2643         instead of calling abort.
2644         * elf32-csky.c (csky_build_one_stub): Likewise.
2645         * elf32-hppa.c (hppa_build_one_stub): Likewise.
2646         * elf32-m68hc11.c (m68hc11_elf_build_one_stub): Likewise.
2647         * elf32-m68hc12.c (m68hc12_elf_build_one_stub): Likewise.
2648         * elf32-metag.c (metag_build_one_stub): Likewise.
2649         * elf32-nios2.c (nios2_build_one_stub): Likewise.
2650         * elf64-ppc.c (ppc_build_one_stub): Likewise.
2651         (ppc_size_one_stub): Likewise.
2652         * elfnn-aarch64.c (aarch64_build_one_stub): Likewise.
2653
2654 2020-03-17  Nick Clifton  <[email protected]>
2655
2656         PR 25688
2657         * elf.c (_bfd_elf_copy_special_section_fields): Replace assertions
2658         with error messages.
2659
2660 2020-03-17  Nick Clifton  <[email protected]>
2661
2662         PR 25687
2663         * elf.c (_bfd_elf_slurp_secondary_reloc_section): Remove redundant
2664         free.  Add free on another failure path.
2665
2666 2020-03-16  Alan Modra  <[email protected]>
2667
2668         PR 25675
2669         * elf.c (elf_sort_segments): Don't call bfd_octets_per_byte unless
2670         we have a non-zero section count.  Do lma comparison in octets.
2671
2672 2020-03-16  Alan Modra  <[email protected]>
2673
2674         * vms-alpha.c (dst_restore_location): Validate index into
2675         dst_ptr_offsets array before accessing.  Return status.
2676         (dst_retrieve_location): Similarly, making "loc" parameter a
2677         pointer to return value.
2678         (_bfd_vms_slurp_etir): Update calls to above functions.
2679
2680 2020-03-14  Kamil Rytarowski  <[email protected]>
2681
2682         * configure.ac: Include netbsd-core.lo for all NetBSD arm and mips
2683         targets.
2684         * configure: Regenerated.
2685
2686 2020-03-14  Alan Modra  <[email protected]>
2687
2688         * section.c (BFD_FAKE_SECTIONS): Formatting.
2689         * bfd-in2.h: Regenerate.
2690
2691 2020-03-13  Kamil Rytarowski  <[email protected]>
2692
2693         * elf.c (elfcore_grok_netbsd_note): Add support for
2694         NT_NETBSDCORE_LWPSTATUS notes.
2695
2696 2020-03-13  Christophe Lyon  <[email protected]>
2697
2698         * bfd-in2.h: Regenerate.
2699         * section.c (asection): Add already_assigned field.
2700         (BFD_FAKE_SECTION): Add default initializer for it.
2701         * ecoff.c (bfd_debug_section): Initialize already_assigned field.
2702         * elf32-arm.c (arm_build_one_stub): Add support for
2703         non_contiguous_regions.
2704         * elf32-csky.c (csky_build_one_stub): Likewise.
2705         * elf32-hppa.c (hppa_build_one_stub): Likewise.
2706         * elf32-m68hc11.c (m68hc11_elf_build_one_stub): Likewise.
2707         * elf32-m68hc12.c (m68hc12_elf_build_one_stub): Likewise.
2708         * elf32-metag.c (metag_build_one_stub): Likewise.
2709         * elf32-nios2.c (nios2_build_one_stub): Likewise.
2710         * elf64-ppc.c (ppc_build_one_stub): Likewise.
2711         (ppc_size_one_stub): Likewise.
2712         * elfnn-aarch64.c (aarch64_build_one_stub): Likewise.
2713         * elflink.c (elf_link_input_bfd): Likewise.
2714
2715 2020-03-13  H.J. Lu  <[email protected]>
2716
2717         PR ld/24920
2718         * elf-linker-x86.h (elf_linker_x86_params): Add
2719         static_before_all_inputs and has_dynamic_linker.
2720         * elfxx-x86.c (_bfd_x86_elf_link_setup_gnu_properties): Report
2721         dynamic input objects if -static is passed at command-line
2722         before all input files without --dynamic-linker unless
2723         --no-dynamic-linker is used.
2724
2725 2020-03-13  Kamil Rytarowski  <[email protected]>
2726
2727         * elf.c (elfcore_grok_netbsd_note): Add support for aarch64.
2728
2729 2020-03-13  Christian Eggers  <[email protected]>
2730
2731         * bfd.c (bfd_record_phdr): New local "opb".  Fix assignment of
2732         "p_paddr" from "at".
2733         * elfcode.h (bfd_from_remote_memory): Add units to several
2734         parameters.  New local "opb".  Fix usage of p_align.  Fix
2735         calculation of "localbase" from "ehdr_vma" and "p_vaddr".  Fix
2736         call of target_read_memory.
2737         * elflink.c (elf_fixup_link_order): Fix scope of "s" local.  Fix
2738         calculation of "offset" and "output_offset".
2739         (bfd_elf_final_link): New local "opb".  Fix calculation of "size"
2740         from "offset" and fix calculation of "end" from "vma+size".  Fix
2741         comparison between "sh_addr" and "vma"/"output_offset".
2742         (bfd_elf_discard_info): Fix calculation of "eh_alignment".
2743         * elf-bfd.h (struct elf_link_hash_table): Add unit to tls_size
2744         member.
2745         * elf.c (_bfd_elf_map_sections_to_segments): Add unit (bytes/
2746         octets) to "wrap_to2 and "phdr_size" locals.  Fix calculation of
2747         "wrap_to" value.  Add unit (bytes) to phdr_lma variable.  Fix
2748         assignment of p_paddr from phdr_lma.  Fix comparison between
2749         "lma+size" and "next->lma".
2750         (elf_sort_segments): Fix assignment from p_paddr to lma.
2751         (assign_file_positions_for_load_sections): Add unit (bytes) to
2752         local "align".  Fix calculation of local "off_adjust".  Fix
2753         calculation of local "filehdr_vaddr".
2754         (assign_file_positions_for_non_load_sections): New local "opb".
2755         Fix calculation of "end" from "p_size". Fix comparison between
2756         "vma+SECTION_SIZE" and "start".  Fix calculation of "p_memsz"
2757         from "end" and "p_vaddr".
2758         (rewrite_elf_program_header): Fix comparison between p_vaddr and
2759         vma.  Fix assignment to p_paddr from lma.  Fix comparison between
2760         p_paddr and lma.  Fix assignment to p_paddr from lma.
2761         * merge.c (sec_merge_emit): New local "opb". Convert
2762         "alignment_power" to octets.
2763         (_bfd_add_merge_section): New locals "alignment_power" and
2764         "opb".  Fix comparison between "alignment_power" and
2765         "sizeof(align)".
2766         (_bfd_merge_sections): New local "opb".  Divide size by opb
2767         before checking align mask.
2768
2769 2020-03-13  Christian Eggers  <[email protected]>
2770
2771         * elf.c (_bfd_elf_make_section_from_shdr): Introduce new temp
2772         opb.  Divide Elf_Internal_Shdr::sh_addr by opb when setting
2773         section LMA/VMA.
2774         (_bfd_elf_make_section_from_phdr): Similarly.
2775         (elf_fake_sections): Fix calculation of
2776         Elf_Internal_shdr::sh_addr from section VMA.
2777         (_bfd_elf_map_sections_to_segments): Fix mixup between octets
2778         and bytes.
2779         (assign_file_positions_for_load_sections): Fix calculations of
2780         Elf_Internal_shdr::p_vaddr and p_paddr from section LMA/VMA.  Fix
2781         comparison between program header address and section LMA.
2782         (assign_file_positions_for_non_load_sections): Likewise.
2783         (rewrite_elf_program_header): Likewise.  Introduce new temp opb.
2784         (IS_CONTAINED_BY_VMA): Add parameter opb.
2785         (IS_CONTAINED_BY_LMA,IS_SECTION_IN_INPUT_SEGMENT,
2786         INCLUDE_SECTION_IN_SEGMENT): Likewise.
2787         (copy_elf_program_header): Update call to ELF_SECTION_IN_SEGMENT.
2788         Fix calculations of p_addr_valid and p_vaddr_offset.
2789         * elflink.c (elf_link_add_object_symbols): Multiply section VMA
2790         with octets per byte when comparing against p_vaddr.
2791
2792 2020-03-11  Alan Modra  <[email protected]>
2793
2794         * som.c (setup_sections): Sanity check subspace.name.
2795
2796 2020-03-11  Alan Modra  <[email protected]>
2797
2798         * elf64-ppc.c (ppc64_elf_inline_plt): Do increment rel in for loop.
2799
2800 2020-03-10  Alan Modra  <[email protected]>
2801
2802         PR 25648
2803         * ihex.c (ihex_write_object_contents): Don't assume ordering of
2804         addresses here.
2805
2806 2020-03-09  Alan Modra  <[email protected]>
2807
2808         * wasm-module.c (wasm_scan): Sanity check file name length
2809         before allocating memory.  Move common section setup code.  Do
2810         without bfd_tell to calculate section size.
2811
2812 2020-03-06  Nick Clifton  <[email protected]>
2813
2814         * elf.c (_bfd_elf_set_section_contents): Replace call to abort
2815         with error messages and failure return values.
2816
2817 2020-03-05  Max Filippov  <[email protected]>
2818
2819         * elf32-xtensa.c (shrink_dynamic_reloc_sections): Shrink dynamic
2820         relocation sections for any removed reference to a dynamic symbol.
2821
2822 2020-03-05  Nick Clifton  <[email protected]>
2823
2824         * elf-bfd.h (struct elf_backend_data): Add new fields:
2825         init_secondary_reloc_section, slurp_secondary_reloc_section,
2826         write_secondary_reloc_section.
2827         (_bfd_elf_init_secondary_reloc_section): Prototype.
2828         (_bfd_elf_slurp_secondary_reloc_section): Prototype.
2829         (_bfd_elf_write_secondary_reloc_section): Prototype.
2830         * elf.c ( bfd_section_from_shdr): Invoke the new
2831         init_secondary_reloc_section backend function, if defined, when a
2832         second reloc section is encountered.
2833         (swap_out_syms): Invoke the new symbol_section_index function, if
2834         defined, when computing the section index of an OS/PROC specific
2835         symbol.
2836         (_bfd_elf_init_secondary_reloc_section): New function.
2837         (_bfd_elf_slurp_secondary_reloc_section): New function.
2838         (_bfd_elf_write_secondary_reloc_section): New function.
2839         (_bfd_elf_copy_special_section_fields): New function.
2840         * elfcode.h (elf_write_relocs): Invoke the new
2841         write_secondary_relocs function, if defined, in order to emit
2842         secondary relocs.
2843         (elf_slurp_reloc_table): Invoke the new slurp_secondary_relocs
2844         function, if defined, in order to read in secondary relocs.
2845         * elfxx-target.h (elf_backend_copy_special_section_fields):
2846         Provide a non-NULL default definition.
2847         (elf_backend_init_secondary_reloc_section): Likewise.
2848         (elf_backend_slurp_secondary_reloc_section): Likewise.
2849         (elf_backend_write_secondary_reloc_section): Likewise.
2850         (struct elf_backend_data elfNN_bed): Add initialisers for the new
2851         fields.
2852         * configure.ac (score_elf32_[bl]e_vec): Add elf64.lo
2853         * configure: Regenerate.
2854
2855 2020-03-05  Alan Modra  <[email protected]>
2856
2857         * archive64.c (_bfd_archive_64_bit_slurp_armap): Check parsed_size
2858         against file size before allocating memory.  Use bfd_alloc rather
2859         than bfd_zalloc for carsym/strings memory.
2860
2861 2020-03-04  Alan Modra  <[email protected]>
2862
2863         * elf.c (elf_fake_sections): Ensure sh_addralign is such that
2864         sh_addr mod sh_addalign is zero.
2865
2866 2020-03-04  Alan Modra  <[email protected]>
2867
2868         * format.c (bfd_check_format_matches): Call cleanup on error exit.
2869
2870 2020-03-03  Alan Modra  <[email protected]>
2871
2872         * format.c (struct bfd_preserve): Add cleanup field.
2873         (bfd_preserve_save): Add cleanup param and save.
2874         (bfd_preserve_restore): Return cleanup.
2875         (bfd_preserve_finish): Call the cleanup for the discarded match.
2876         (bfd_check_format_matches): Pass cleanup to bfd_preserve_save,
2877         and clear when preserving a match.  Restore cleanup too when
2878         restoring that match.
2879
2880 2020-03-02  Alan Modra  <[email protected]>
2881
2882         * cisco-core.c (cisco_core_file_p): Return bfd_cleanup.
2883         * hpux-core.c (hpux_core_core_file_p): Update prototype.
2884         * sco5-core.c (sco5_core_file_p): Return bfd_cleanup.
2885         (core_sco5_vec): Correct initialisers.
2886
2887 2020-03-02  Alan Modra  <[email protected]>
2888
2889         * aix386-core.c (aix386_core_file_p): Return bfd_cleanup.
2890         * aix5ppc-core.c (xcoff64_core_p): Likewise.
2891         * cisco-core.c (cisco_core_file_validate): Likewise.
2892         * hppabsd-core.c (hppabsd_core_core_file_p): Likewise.
2893         * hpux-core.c (hpux_core_core_file_p): Likewise.
2894         * irix-core.c (irix_core_core_file_p): Likewise.
2895         * lynx-core.c (lynx_core_file_p): Likewise.
2896         * netbsd-core.c (netbsd_core_file_p): Likewise.
2897         * osf-core.c (osf_core_core_file_p): Likewise.
2898         * ptrace-core.c (ptrace_unix_core_file_p): Likewise.
2899         * sco5-core.c (sco5_core_file_p): Likewise.
2900
2901 2020-03-02  H.J. Lu  <[email protected]>
2902
2903         * trad-core.c (trad_unix_core_file_p): Return bfd_cleanup.
2904
2905 2020-03-02  Alan Modra  <[email protected]>
2906
2907         * targets.c (bfd_cleanup): New typedef.
2908         (struct bfd <_bfd_check_format>): Return a bfd_cleanup.
2909         * libbfd-in.h (_bfd_no_cleanup): Define.
2910         * format.c (bfd_reinit): Add cleanup parameter, call it.
2911         (bfd_check_format_matches): Set cleanup from _bfd_check_format
2912         call and pass to bfd_reinit.  Delete temp, use abfd->xvec instead.
2913         * aout-target.h (callback, object_p): Return bfd_cleanup.
2914         * aout-tic30.c (tic30_aout_callback, tic30_aout_object_p): Likewise.
2915         * archive.c (bfd_generic_archive_p): Likewise.
2916         * binary.c (binary_object_p): Likewise.
2917         * coff-alpha.c (alpha_ecoff_object_p): Likewise.
2918         * coff-ia64.c (ia64coff_object_p): Likewise.
2919         * coff-rs6000.c (_bfd_xcoff_archive_p, rs6000coff_core_p): Likewise.
2920         * coff-sh.c (coff_small_object_p): Likewise.
2921         * coff-stgo32.c (go32_check_format): Likewise.
2922         * coff64-rs6000.c (xcoff64_archive_p, rs6000coff_core_p),
2923         (xcoff64_core_p): Likewise.
2924         * coffgen.c (coff_real_object_p, coff_object_p): Likewise.
2925         * elf-bfd.h (bfd_elf32_object_p, bfd_elf32_core_file_p),
2926         (bfd_elf64_object_p, bfd_elf64_core_file_p): Likewise.
2927         * elfcode.h (elf_object_p): Likewise.
2928         * elfcore.h (elf_core_file_p): Likewise.
2929         * i386msdos.c (msdos_object_p): Likewise.
2930         * ihex.c (ihex_object_p): Likewise.
2931         * libaout.h (some_aout_object_p): Likewise.
2932         * libbfd-in.h (bfd_generic_archive_p, _bfd_dummy_target),
2933         (_bfd_vms_lib_alpha_archive_p, _bfd_vms_lib_ia64_archive_p): Likewise.
2934         * libbfd.c (_bfd_dummy_target): Likewise.
2935         * libcoff-in.h (coff_object_p): Likewise.
2936         * mach-o-aarch64.c (bfd_mach_o_arm64_object_p),
2937         (bfd_mach_o_arm64_core_p): Likewise.
2938         * mach-o-arm.c (bfd_mach_o_arm_object_p),
2939         (bfd_mach_o_arm_core_p): Likewise.
2940         * mach-o-i386.c (bfd_mach_o_i386_object_p),
2941         (bfd_mach_o_i386_core_p): Likewise.
2942         * mach-o-x86-64.c (bfd_mach_o_x86_64_object_p),
2943         (bfd_mach_o_x86_64_core_p): Likewise.
2944         * mach-o.c (bfd_mach_o_header_p, bfd_mach_o_gen_object_p),
2945         (bfd_mach_o_gen_core_p, bfd_mach_o_fat_archive_p): Likewise.
2946         * mach-o.h (bfd_mach_o_object_p, bfd_mach_o_core_p),
2947         (bfd_mach_o_fat_archive_p, bfd_mach_o_header_p): Likewise.
2948         * mmo.c (mmo_object_p): Likewise.
2949         * pef.c (bfd_pef_object_p, bfd_pef_xlib_object_p): Likewise.
2950         * peicode.h (coff_real_object_p, pe_ILF_object_p),
2951         (pe_bfd_object_p): Likewise.
2952         * plugin.c (ld_plugin_object_p, bfd_plugin_object_p): Likewise.
2953         * ppcboot.c (ppcboot_object_p): Likewise.
2954         * rs6000-core.c (rs6000coff_core_p): Likewise.
2955         * som.c (som_object_setup, som_object_p): Likewise.
2956         * srec.c (srec_object_p, symbolsrec_object_p): Likewise.
2957         * tekhex.c (tekhex_object_p): Likewise.
2958         * vms-alpha.c (alpha_vms_object_p): Likewise.
2959         * vms-lib.c (_bfd_vms_lib_archive_p, _bfd_vms_lib_alpha_archive_p),
2960         (_bfd_vms_lib_ia64_archive_p, _bfd_vms_lib_txt_archive_p): Likewise.
2961         * wasm-module.c (wasm_object_p): Likewise.
2962         * xsym.c (bfd_sym_object_p): Likewise.
2963         * xsym.h (bfd_sym_object_p): Likewise.
2964         * aoutx.h (some_aout_object_p): Likewise, and callback parameter
2965         return type.
2966         * pdp11.c (some_aout_object_p): Likewise.
2967         * plugin.c (register_ld_plugin_object_p): Update object_p
2968         parameter type.
2969         * plugin.h (register_ld_plugin_object_p): Likewise.
2970         * bfd-in2.h: Regenerate.
2971         * libbfd.h: Regenerate.
2972         * libcoff.h: Regenerate.
2973
2974 2020-03-02  Alan Modra  <[email protected]>
2975
2976         * coff-alpha.c (alpha_ecoff_le_vec): Add SEC_SMALL_DATA to
2977         applicable section flags.
2978         * coff-mips.c (mips_ecoff_le_vec, mips_ecoff_be_vec): Likewise.
2979         (mips_ecoff_bele_vec): Likewise.
2980         * coffcode.h (sec_to_styp_flags): Set SEC_SMALL_DATA for .sdata
2981         and .sbss sections.
2982         * ecoff.c (_bfd_ecoff_new_section_hook): Likewise.
2983         (_bfd_ecoff_styp_to_sec_flags): Likewise.
2984
2985 2020-03-02  Alan Modra  <[email protected]>
2986
2987         * elf32-m32r.c (m32r_elf_section_flags): New function.
2988         (elf_backend_section_flags): Define.
2989         * elf32-nds32.c (nds32_elf_section_flags): New function.
2990         (elf_backend_section_flags): Define.
2991         * elf32-ppc.c (ppc_elf_section_from_shdr): Set SEC_SMALL_DATA for
2992         .sbss and .sdata sections.
2993         * elf32-v850.c (v850_elf_section_from_shdr): Set SEC_SMALL_DATA
2994         for SHF_V850_GPREL sections.
2995         * elf64-alpha.c (elf64_alpha_section_from_shdr): Delete outdated
2996         FIXME.
2997         * elf64-hppa.c (elf64_hppa_section_from_shdr): Set SEC_SMALL_DATA
2998         for SHF_PARISC_SHORT sections.
2999         * elf64-ppc.c (ppc64_elf_section_flags): New function.
3000         (elf_backend_section_flags): Define.
3001         * elfxx-mips.c (_bfd_mips_elf_section_from_shdr): Set SEC_SMALL_DATA
3002         for SHF_MIPS_GPREL sections.  Delete FIXME.
3003
3004 2020-03-02  Alan Modra  <[email protected]>
3005
3006         * elf-bfd.h (elf_backend_section_flags): Remove flagword* param.
3007         * elf.c (_bfd_elf_make_section_from_shdr): Set section flags before
3008         calling elf_backend_section_flags with adjusted params.  Use
3009         newsect->flags past that point.
3010         (_bfd_elf_new_section_hook): Always set sh_type and sh_flags for
3011         special sections.
3012         (_bfd_elf_init_private_section_data): Allow normal sh_type sections
3013         to have their type overridden, and all sh_flags but processor and
3014         os specific.
3015         * elf32-arm.c (elf32_arm_section_flags): Adjust for changed params.
3016         * elf32-mep.c (mep_elf_section_flags): Likewise.
3017         * elf32-nios2.c (nios2_elf32_section_flags): Likewise.
3018         * elf64-alpha.c (elf64_alpha_section_flags): Likewise.
3019         * elf64-ia64-vms.c (elf64_ia64_section_flags): Likewise.
3020         * elfnn-ia64.c (elfNN_ia64_section_flags): Likewise.
3021         * elfnn-aarch64.c (elfNN_aarch64_size_stubs): Exclude the linker
3022         stub BFD and non-aarch64 input files when scanning for stubs.
3023
3024 2020-03-02  Alan Modra  <[email protected]>
3025
3026         * coff-alpha.c (alpha_ecoff_get_elt_at_filepos): Provide an upper
3027         limit to decompressed element size.
3028
3029 2020-03-02  Alan Modra  <[email protected]>
3030
3031         * vms-lib.c (vms_traverse_index): Add recur_count param and
3032         update calls.  Fail on excessive recursion.
3033
3034 2020-03-02  Alan Modra  <[email protected]>
3035
3036         * vms-alpha.c (vms_get_remaining_object_record): Use
3037         bfd_realloc_or_free rather than bfd_realloc.
3038         (add_symbol_entry, vector_grow1, alpha_vms_slurp_relocs): Likewise.
3039         (dst_define_location, parse_module): Likewise, and check realloc
3040         return status before using memory.  Return status from function
3041         adjusting all callers.
3042
3043 2020-02-28  Alan Modra  <[email protected]>
3044
3045         * vms-lib.c (_bfd_vms_lib_archive_p): Free memory on error paths.
3046
3047 2020-02-28  Alan Modra  <[email protected]>
3048
3049         * vms-alpha.c (alpha_vms_object_p): Use _bfd_malloc_and_read.
3050         Remove duplicate undersize check.
3051
3052 2020-02-27  Alan Modra  <[email protected]>
3053
3054         PR 24511
3055         * mmo.c (mmo_scan): Set SEC_DATA for .data.
3056
3057 2020-02-27  Alan Modra  <[email protected]>
3058
3059         PR 24511
3060         * syms.c (stt): Trim off all but 'e', 'i' and 'p' entries.
3061         (coff_section_type): Adjust comment.
3062         (decode_section_type): Likewise.  Call coff_section_type before
3063         decode_section_type.
3064         (bfd_decode_symclass): Use 'c' for common sections other than
3065         the standard one.
3066
3067 2020-02-27  Alan Modra  <[email protected]>
3068
3069         * coff-rs6000.c (_bfd_xcoff_read_ar_hdr): Put all data in one
3070         malloc'd block.
3071
3072 2020-02-27  Alan Modra  <[email protected]>
3073
3074         * bfd.c (bfd_stat_arch_elt): Use vector of containing archive,
3075         if file is an archive element.
3076         * bfd-in2.h: Regenerate.
3077
3078 2020-02-26  Alan Modra  <[email protected]>
3079
3080         * archive.c (do_slurp_bsd_armap): Increase minimum parsed_size, and
3081         bfd_set_error on failing test.  Don't bother changing bfd_error on
3082         file read error.  Check symdef_count is multiple of BSD_SYMDEF_SIZE.
3083         Check sym name is within string buffer.  Use size_t for some vars.
3084         (do_slurp_coff_armap): Use size_t for some variables, fix size of
3085         int_buf.  Don't change bfd_error on file read error.  Use
3086         _bfd_mul_overflow when calculating carsym buffer size.  Reorder
3087         calculations to catch overflows before they occur.  malloc and
3088         free raw armap rather than using bfd_alloc.  Read raw armap before
3089         allocating carsym+strings buffer.
3090         (_bfd_slurp_extended_name_table): Localize variables.  Check
3091         name size against file size.
3092
3093 2020-02-26  Alan Modra  <[email protected]>
3094
3095         * vms-lib.c (vms_lib_read_index): Release correct buffer.
3096
3097 2020-02-26  Alan Modra  <[email protected]>
3098
3099         * elf32-rx.c (rx_elf_relocate_section): Use bfd_malloc rather than
3100         malloc.  Check for NULL return from bfd_malloc.
3101         (rx_table_find, rx_table_map): Likewise.
3102         (rx_set_section_contents): Check bfd_alloc return.
3103         (rx_dump_symtab): Don't alloc internal_syms or external_syms.
3104
3105 2020-02-26  Alan Modra  <[email protected]>
3106
3107         * aoutx.h: Indent labels correctly.  Format error strings.
3108         * archive.c: Likewise.
3109         * archive64.c: Likewise.
3110         * coff-arm.c: Likewise.
3111         * coff-rs6000.c: Likewise.
3112         * coff-stgo32.c: Likewise.
3113         * cpu-arm.c: Likewise.
3114         * dwarf2.c: Likewise.
3115         * elf-ifunc.c: Likewise.
3116         * elf-properties.c: Likewise.
3117         * elf-s390-common.c: Likewise.
3118         * elf-strtab.c: Likewise.
3119         * elf.c: Likewise.
3120         * elf32-arm.c: Likewise.
3121         * elf32-bfin.c: Likewise.
3122         * elf32-cr16.c: Likewise.
3123         * elf32-csky.c: Likewise.
3124         * elf32-i386.c: Likewise.
3125         * elf32-m68k.c: Likewise.
3126         * elf32-msp430.c: Likewise.
3127         * elf32-nds32.c: Likewise.
3128         * elf32-nios2.c: Likewise.
3129         * elf32-pru.c: Likewise.
3130         * elf32-xtensa.c: Likewise.
3131         * elf64-ia64-vms.c: Likewise.
3132         * elf64-x86-64.c: Likewise.
3133         * elfcode.h: Likewise.
3134         * elfcore.h: Likewise.
3135         * elflink.c: Likewise.
3136         * elfnn-aarch64.c: Likewise.
3137         * elfnn-ia64.c: Likewise.
3138         * elfnn-riscv.c: Likewise.
3139         * elfxx-mips.c: Likewise.
3140         * elfxx-sparc.c: Likewise.
3141         * elfxx-x86.c: Likewise.
3142         * i386lynx.c: Likewise.
3143         * merge.c: Likewise.
3144         * pdp11.c: Likewise.
3145         * plugin.c: Likewise.
3146         * reloc.c: Likewise.
3147
3148 2020-02-26  Alan Modra  <[email protected]>
3149
3150         PR 25593
3151         * elf-bfd.h (struct elf_link_hash_table): Rename "loaded" to
3152         "dyn_loaded".
3153         (bfd_elf_add_dt_needed_tag): Declare.
3154         * elf-strtab.c (_bfd_elf_strtab_restore): Handle NULL buf.
3155         * elflink.c (bfd_elf_add_dt_needed_tag): Make global and rename
3156         from elf_add_dt_needed_tag.  Remove soname and doit param.
3157         (elf_link_add_object_symbols): Don't use elf_add_dt_needed_tag
3158         to see whether as-needed lib is already loaded, use dyn_loaded
3159         list instead.  When saving and restoring around as-needed lib
3160         handle possibility that dynstr has not been initialised.  Don't
3161         add DT_NEEDED tags here.  Limit dyn_loaded list to dynamic libs.
3162         Mark libs loaded via DT_NEEDED entries of other libs with
3163         DYN_NO_NEEDED if they should not be mentioned in DT_NEEDED of
3164         the output.
3165         (elf_link_check_versioned_symbol): Remove now unneccesary
3166         DYNAMIC check when traversing dyn_loaded list.
3167
3168 2020-02-26  Alan Modra  <[email protected]>
3169
3170         * bfdio.c (bfd_get_file_size): Ignore bogus archive element sizes.
3171
3172 2020-02-25  H.J. Lu  <[email protected]>
3173
3174         PR binutils/25584
3175         * plugin.c (need_lto_wrapper_p): New.
3176         (bfd_plugin_set_program_name): Add an int argument to set
3177         need_lto_wrapper_p.
3178         (get_lto_wrapper): Return FALSE if need_lto_wrapper_p isn't
3179         set.
3180         * plugin.h (bfd_plugin_set_program_name): Add an int argument.
3181
3182 2020-02-24  Alan Modra  <[email protected]>
3183
3184         * vms-lib.c (_bfd_vms_lib_archive_p): Correct overflow checks.
3185
3186 2020-02-24  Alan Modra  <[email protected]>
3187
3188         * vms-lib.c (struct carsym_mem): Add limit.
3189         (vms_add_index): Heed limit.
3190         (vms_traverse_index): Catch buffer overflows.  Remove outdated fixme.
3191         (vms_lib_read_index): Set up limit.  Catch 32-bit overflow.
3192         Always return actual number read.
3193         (_bfd_vms_lib_archive_p): Catch buffer overflows.  Replace
3194         assertion with error exit.
3195
3196 2020-02-22  Alan Modra  <[email protected]>
3197
3198         PR 25585
3199         * elf.c (assign_file_positions_for_load_sections): Continue linking
3200         on "PHDR segment not covered by LOAD segment" errors.
3201
3202 2020-02-21  Alan Modra  <[email protected]>
3203
3204         * mach-o.c (bfd_mach_o_canonicalize_relocs): Fix ineffective
3205         overflow check.
3206         (bfd_mach_o_canonicalize_reloc): Likewise.
3207         (bfd_mach_o_canonicalize_dynamic_reloc): Likewise.  Sanity check
3208         counts and offsets against file size.
3209         (bfd_mach_o_build_dysymtab): Fix ineffective overflow check.
3210         (bfd_mach_o_mangle_sections): Remove unnecessary overflow check.
3211         (bfd_mach_o_read_symtab_symbols): Sanity check count and offset
3212         against file size.  Delete symbol table error message.
3213         (bfd_mach_o_read_dysymtab): Sanity check counts and offsets
3214         against file size.
3215         (bfd_mach_o_read_symtab): Likewise.
3216         (bfd_mach_o_read_command): Pass file size.
3217         (bfd_mach_o_scan): Sanity check command count against file size.
3218
3219 2020-02-21  Alan Modra  <[email protected]>
3220
3221         PR 25569
3222         * aoutx.h (adjust_o_magic, adjust_z_magic, adjust_n_magic): Use
3223         "text", "data" and "bss" section pointer vars.  Don't update
3224         section size, just exec header sizes.
3225         (adjust_sizes_and_vmas): Don't update text section size.  Set
3226         initial exec header a_text.  Print exec headers sizes.
3227         * pdp11.c (adjust_o_magic, adjust_z_magic, adjust_n_magic),
3228         (adjust_sizes_and_vmas): Similarly.  Formatting.
3229         (final_link): Correct final file extension.
3230
3231 2020-02-20  Nick Clifton  <[email protected]>
3232
3233         * elf-bfd.h (struct elf_backend_data): Add symbol_section_index
3234         callback.
3235         * elfxx-target.h (elf_backend_symbol_section_index): Provide
3236         default definition.
3237         (elfNN_bed): Initialise the symbol_section_index field.
3238         * elf.c (swap_out_syms): Call symbol_section_index, if defined, on
3239         OS and PROC specific section indicies.  Warn if converting other
3240         reserved incidies to SHN_ABS.
3241
3242 2020-02-19  Sergey Belyashov  <[email protected]>
3243
3244         PR 25537
3245         * cpu-z80.c: Add machine type compatibility checking.
3246
3247 2020-02-19  H.J. Lu  <[email protected]>
3248
3249         PR binutils/25355
3250         * plugin.c (plugin_list_entry): Remove handle.
3251         (try_load_plugin): Call dlclose before return.
3252
3253 2020-02-19  Alan Modra  <[email protected]>
3254
3255         * libbfd-in.h (_bfd_constant_p): Define.
3256         (_bfd_alloc_and_read, _bfd_malloc_and_read): Check read size against
3257         file size before allocating memory.
3258         * coffgen.c (_bfd_coff_get_external_symbols): Remove file size check.
3259         * elf.c (bfd_elf_get_str_section): Likewise.
3260         (_bfd_elf_slurp_version_tables): Likewise.
3261         * libbfd.h: Regenerate.
3262
3263 2020-02-19  Alan Modra  <[email protected]>
3264
3265         * libbfd-in.h (_bfd_alloc_and_read, _bfd_malloc_and_read): New.
3266         * aoutx.h (aout_get_external_symbols): Replace calls to
3267         bfd_[m]alloc and bfd_bread with call to _bfd_[m]alloc_and_read.
3268         (slurp_reloc_table): Likewise.
3269         * archive.c (do_slurp_bsd_armap): Likewise.
3270         (do_slurp_coff_armap): Likewise.
3271         * archive64.c (_bfd_archive_64_bit_slurp_armap): Likewise.
3272         * coff-rs6000.c (_bfd_xcoff_slurp_armap): Likewise.
3273         * coff64-rs6000.c (xcoff64_slurp_armap): Likewise.
3274         * coffcode.h (coff_set_arch_mach_hook, buy_and_read): Likewise.
3275         * coffgen.c (coff_real_object_p, coff_object_p, build_debug_section),
3276         (_bfd_coff_get_external_symbols): Likewise.
3277         * ecoff.c (ecoff_slurp_symbolic_header),
3278         (_bfd_ecoff_slurp_symbolic_info, ecoff_slurp_reloc_table),
3279         (_bfd_ecoff_slurp_armap, ecoff_link_add_object_symbols, READ),
3280         (ecoff_indirect_link_order): Likewise.
3281         * elf.c (bfd_elf_get_str_section, setup_group, elf_read_notes),
3282         (_bfd_elf_slurp_version_tables): Likewise.
3283         * elf32-m32c.c (m32c_elf_relax_section): Likewise.
3284         * elf32-rl78.c (rl78_elf_relax_section): Likewise.
3285         * elf32-rx.c (elf32_rx_relax_section): Likewise.
3286         * elf64-alpha.c (READ): Likewise.
3287         * elf64-mips.c (mips_elf64_slurp_one_reloc_table): Likewise.
3288         * elf64-sparc.c (elf64_sparc_slurp_one_reloc_table): Likewise.
3289         * elfcode.h (elf_slurp_symbol_table),
3290         (elf_slurp_reloc_table_from_section): Likewise.
3291         * elflink.c (elf_link_add_object_symbols),
3292         (elf_link_check_versioned_symbol): Likewise.
3293         * elfxx-mips.c (READ): Likewise.
3294         * i386lynx.c (slurp_reloc_table): Likewise.
3295         * lynx-core.c (lynx_core_file_p): Likewise.
3296         * mach-o.c (bfd_mach_o_canonicalize_relocs),
3297         (bfd_mach_o_read_symtab_strtab, bfd_mach_o_alloc_and_read),
3298         (bfd_mach_o_read_prebound_dylib, bfd_mach_o_read_dyld_content
3299         * pdp11.c (aout_get_external_symbols, slurp_reloc_table
3300         * pef.c (bfd_pef_print_loader_section, bfd_pef_scan_start_address),
3301         (bfd_pef_parse_symbols): Likewise.
3302         * peicode.h (pe_ILF_object_p, pe_bfd_object_p
3303         * som.c (setup_sections, som_slurp_string_table),
3304         (som_slurp_reloc_table, som_bfd_count_ar_symbols),
3305         (som_bfd_fill_in_ar_symbols): Likewise.
3306         * vms-alpha.c (module_find_nearest_line, evax_bfd_print_dst),
3307         (evax_bfd_print_image): Likewise.
3308         * vms-lib.c (_bfd_vms_lib_archive_p): Likewise.
3309         * wasm-module.c (wasm_scan): Likewise.
3310         * xcofflink.c (xcoff_link_add_symbols): Likewise.
3311         * xsym.c (bfd_sym_read_name_table),
3312         (bfd_sym_print_type_information_table_entry): Likewise.
3313         * libbfd.h: Regenerate.
3314
3315 2020-02-19  Alan Modra  <[email protected]>
3316
3317         * aoutx.h (slurp_reloc_table): Allocate reloc_cache after
3318         reading external relocs.
3319         * ecoff.c (ecoff_slurp_reloc_table): Likewise.
3320         * archive.c (_bfd_write_archive_contents): Don't twiddle bfd_error
3321         after bfd_bread.
3322         * archive64.c (_bfd_archive_64_bit_slurp_armap): Remove unnecessary
3323         bfd_release.
3324         * elf32-m32c.c (m32c_offset_for_reloc): Make shndx_buf a bfd_byte*.
3325         (m32c_elf_relax_section): Likewise.
3326         * elf32-rl78.c (rl78_offset_for_reloc): Likewise.
3327         (rl78_elf_relax_section): Likewise.
3328         * elf32-rx.c (rx_offset_for_reloc): Likewise.
3329         (elf32_rx_relax_section): Likewise.
3330         * mach-o.c (bfd_mach_o_alloc_and_read): Move earlier with better
3331         parameter types and use..
3332         (bfd_mach_o_read_dylinker, bfd_mach_o_read_dylib),
3333         (bfd_mach_o_read_fvmlib, bfd_mach_o_read_str): ..in these functions.
3334         * peicode.h (pe_bfd_object_p): Don't zero the part of opthdr
3335         being read from file, just the extra.
3336         * som.c (som_slurp_symbol_table): Allocate internal symbol buffer
3337         after reading external syms.  Free on failure.
3338
3339 2020-02-19  Alan Modra  <[email protected]>
3340
3341         * coffcode.h (buy_and_read, coff_slurp_line_table),
3342         (coff_slurp_symbol_table, coff_slurp_reloc_table): Replace
3343         bfd_[z][m]alloc2 calls with _bfd_mul_overflow followed by the
3344         corresponding bfd_alloc call.  Adjust variables to suit.
3345         * coffgen.c (_bfd_coff_get_external_symbols): Likewise.
3346         * ecoff.c (_bfd_ecoff_slurp_symbolic_info),
3347         (_bfd_ecoff_slurp_symbol_table, READ): Likewise.
3348         * elf.c (bfd_elf_get_elf_syms, setup_group, bfd_section_from_shdr),
3349         (swap_out_syms, _bfd_elf_slurp_version_tables): Likewise.
3350         * elf32-m32c.c (m32c_elf_relax_section): Likewise.
3351         * elf32-rl78.c (rl78_elf_relax_section): Likewise.
3352         * elf32-rx.c (elf32_rx_relax_section): Likewise.
3353         * elf64-alpha.c (READ): Likewise.
3354         * elfcode.h (elf_object_p, elf_write_relocs, elf_write_shdrs_and_ehdr),
3355         (elf_slurp_symbol_table, elf_slurp_reloc_table),
3356         (bfd_from_remote_memory): Likewise.
3357         * elfcore.h (core_find_build_id): Likewise.
3358         * elfxx-mips.c (READ): Likewise.
3359         * mach-o.c (bfd_mach_o_mangle_sections),
3360         (bfd_mach_o_read_symtab_symbols, bfd_mach_o_read_thread),
3361         (bfd_mach_o_read_dysymtab, bfd_mach_o_flatten_sections),
3362         (bfd_mach_o_scan, bfd_mach_o_fat_archive_p): Likewise.
3363         * som.c (setup_sections, som_prep_for_fixups)
3364         (som_build_and_write_symbol_table, som_slurp_symbol_table),
3365         (som_slurp_reloc_table, som_bfd_count_ar_symbols),
3366         (som_bfd_fill_in_ar_symbols, som_slurp_armap),
3367         (som_bfd_ar_write_symbol_stuff): Likewise.
3368         * vms-alpha.c (vector_grow1): Likewise.
3369         * vms-lib.c (vms_add_index): Likewise.
3370         * wasm-module.c (wasm_scan_name_function_section): Likewise.
3371         * libbfd.c (bfd_malloc2, bfd_realloc2, bfd_zmalloc2): Delete.
3372         * opncls.c (bfd_alloc2, bfd_zalloc2): Delete.
3373         * libbfd-in.h (bfd_malloc2, bfd_realloc2, bfd_zmalloc2),
3374         (bfd_alloc2, bfd_zalloc2): Delete.
3375         (_bfd_mul_overflow): Define.
3376         * libbfd.h: Regenerate.
3377
3378 2020-02-19  Alan Modra  <[email protected]>
3379
3380         * elf.c (bfd_section_from_shdr): Use bfd_zalloc rather than
3381         bfd_zalloc2.
3382         (assign_section_numbers): Likewise.
3383         (elf_map_symbols): Likewise, and bfd_alloc rather than bfd_alloc2.
3384         (_bfd_elf_map_sections_to_segments): Use bfd_malloc rather than
3385         bfd_malloc2, size_t amt, and unsigned tls_count.
3386         (rewrite_elf_program_header): Use bfd_malloc and size_t amt.
3387         * elflink.c (elf_create_symbuf): Use bfd_malloc.
3388         (elf_output_implib): Use bfd_alloc.
3389
3390 2020-02-19  Alan Modra  <[email protected]>
3391
3392         * bfd.c (struct bfd): Move format and direction to other
3393         bitfields.  Add "size".
3394         * bfdio.c (bfd_get_size): Cache size when not writing file.
3395         * opncls.c (bfd_get_debug_link_info_1): Allow for bfd_get_size
3396         returning zero, ie. unknown.
3397         (bfd_get_alt_debug_link_info): Likewise.
3398         * bfd-in2.h: Regenerate.
3399
3400 2020-02-19  Alan Modra  <[email protected]>
3401
3402         * coffgen.c (_bfd_coff_get_external_symbols): Don't call
3403         bfd_get_file_size twice.
3404         (_bfd_coff_read_string_table): Allow for bfd_get_file_size
3405         zero, ie. unknown, return.
3406         * elf-attrs.c (_bfd_elf_parse_attributes): Likewise.
3407         * elfcode.h (elf_swap_shdr_in): Likewise.
3408         (elf_object_p): Don't call bfd_get_file_size twice and correct
3409         file size check.
3410
3411 2020-02-19  Alan Modra  <[email protected]>
3412
3413         * mach-o.c (bfd_mach_o_flatten_sections): Return a bfd_boolean,
3414         FALSE if memory alloc fails.  Adjust calls.
3415         * som.c (som_prep_for_fixups): Likewise.
3416         * vms-alpha.c (alpha_vms_add_fixup_lp, alpha_vms_add_fixup_ca),
3417         (alpha_vms_add_fixup_qr, alpha_vms_add_fixup_lr),
3418         (alpha_vms_add_lw_reloc, alpha_vms_add_qw_reloc): Likewise.
3419         * som.c (som_build_and_write_symbol_table): Return via error_return
3420         on seek failure.
3421         * vms-alpha.c (VEC_APPEND): Adjust for vector_grow1 changes.
3422         (VEC_APPEND_EL): Delete.
3423         (vector_grow1): Return pointer to element.  Catch overflow.
3424         Return NULL on memory allocation failure.
3425         (alpha_vms_add_fixup_lp): Replace VEC_APPEND_EL with VEC_APPEND.
3426         (alpha_vms_add_fixup_ca): Likewise.
3427         (alpha_vms_link_add_object_symbols): Check VEC_APPEND result
3428         before using.
3429         * elf.c (bfd_section_from_shdr): Check bfd_zalloc2 result.
3430
3431 2020-02-19  Alan Modra  <[email protected]>
3432
3433         * aix386-core.c (aix386_core_file_p): Use size_t for "amt".
3434         * aout-target.h (object_p): Likewise.
3435         * aout-tic30.c (tic30_aout_object_p): Likewise.
3436         * aoutx.h (some_aout_object_p, mkobject, make_empty_symbol),
3437         (emit_stringtab, write_syms, link_hash_table_create),
3438         (aout_link_write_other_symbol): Likewise.
3439         * archive.c (_bfd_generic_mkarchive, bfd_generic_archive_p),
3440         (bfd_ar_hdr_from_filesystem, _bfd_write_archive_contents),
3441         (_bfd_compute_and_write_armap): Likewise.
3442         * archures.c (bfd_arch_list): Likewise.
3443         * bfd.c (bfd_record_phdr): Likewise.
3444         * binary.c (binary_canonicalize_symtab): Likewise.
3445         * cisco-core.c (cisco_core_file_validate): Likewise.
3446         * coff-arm.c (coff_arm_link_hash_table_create, find_thumb_glue),
3447         (find_arm_glue, record_arm_to_thumb_glue),
3448         (record_thumb_to_arm_glue): Likewise.
3449         * coff-ppc.c (ppc_coff_link_hash_table_create, record_toc),
3450         (ppc_allocate_toc_section): Likewise.
3451         * coff-rs6000.c (_bfd_xcoff_mkobject, _bfd_xcoff_archive_p): Likewise.
3452         * coff-sh.c (sh_relax_section): Likewise.
3453         * coff64-rs6000.c (xcoff64_archive_p): Likewise.
3454         * coffcode.h (handle_COMDAT, coff_new_section_hook),
3455         (coff_set_alignment_hook, coff_mkobject),
3456         (coff_compute_section_file_positions): Likewise.
3457         * coffgen.c (coff_make_empty_symbol, coff_bfd_make_debug_symbol),
3458         (coff_find_nearest_line_with_names),
3459         ( bfd_coff_set_symbol_class): Likewise.
3460         * cofflink.c (_bfd_coff_link_hash_table_create),
3461         (_bfd_coff_link_input_bfd): Likewise.
3462         * dwarf1.c (alloc_dwarf1_unit, alloc_dwarf1_func): Likewise.
3463         * dwarf2.c (read_abbrevs, read_attribute_value, add_line_info),
3464         (build_line_info_table, sort_line_sequences),
3465         (line_info_add_include_dir, line_info_add_file_name),
3466         (decode_line_info, scan_unit_for_symbols, parse_comp_unit),
3467         (place_sections, _bfd_dwarf2_slurp_debug_info): Likewise.
3468         * ecoff.c (_bfd_ecoff_mkobject, _bfd_ecoff_make_empty_symbol),
3469         (_bfd_ecoff_find_nearest_line),
3470         (_bfd_ecoff_bfd_link_hash_table_create): Likewise.
3471         * ecofflink.c (bfd_ecoff_debug_init): Likewise.
3472         * elf-hppa.h (_bfd_elf_hppa_gen_reloc_type): Likewise.
3473         * elf-m10300.c (mn10300_elf_relax_section),
3474         (elf32_mn10300_link_hash_table_create): Likewise.
3475         * elf-strtab.c (_bfd_elf_strtab_init): Likewise.
3476         * elf.c (make_mapping, copy_elf_program_header): Likewise.
3477         * elf32-arm.c (elf32_arm_link_hash_table_create),
3478         (elf32_arm_setup_section_lists, elf32_arm_check_relocs),
3479         (elf32_arm_new_section_hook): Likewise.
3480         * elf32-avr.c (elf_avr_new_section_hook),
3481         (elf32_avr_link_hash_table_create, get_local_syms),
3482         (elf32_avr_setup_section_lists): Likewise.
3483         * elf32-bfin.c (bfinfdpic_elf_link_hash_table_create),
3484         (bfin_link_hash_table_create): Likewise.
3485         * elf32-cr16.c (elf32_cr16_link_hash_table_create): Likewise.
3486         * elf32-cris.c (elf_cris_link_hash_table_create): Likewise.
3487         * elf32-csky.c (csky_elf_link_hash_table_create),
3488         (csky_elf_check_relocs, elf32_csky_setup_section_lists): Likewise.
3489         * elf32-frv.c (frvfdpic_elf_link_hash_table_create): Likewise.
3490         * elf32-hppa.c (elf32_hppa_link_hash_table_create),
3491         (elf32_hppa_setup_section_lists, get_local_syms): Likewise.
3492         * elf32-i386.c (elf_i386_check_relocs): Likewise.
3493         * elf32-lm32.c (lm32_elf_link_hash_table_create): Likewise.
3494         * elf32-m32r.c (m32r_elf_link_hash_table_create),
3495         (m32r_elf_check_relocs): Likewise.
3496         * elf32-m68hc1x.c (m68hc11_elf_hash_table_create),
3497         (elf32_m68hc11_setup_section_lists),
3498         (elf32_m68hc11_size_stubs): Likewise.
3499         * elf32-m68k.c (elf_m68k_link_hash_table_create): Likewise.
3500         * elf32-metag.c (elf_metag_link_hash_table_create),
3501         (elf_metag_setup_section_lists): Likewise.
3502         * elf32-microblaze.c (microblaze_elf_link_hash_table_create),
3503         (microblaze_elf_check_relocs): Likewise.
3504         * elf32-nds32.c (nds32_elf_link_hash_table_create),
3505         (nds32_elf_check_relocs): Likewise.
3506         * elf32-nios2.c (nios2_elf32_setup_section_lists),
3507         (get_local_syms, nios2_elf32_check_relocs),
3508         (nios2_elf32_link_hash_table_create): Likewise.
3509         * elf32-or1k.c (or1k_elf_link_hash_table_create),
3510         (or1k_elf_check_relocs): Likewise.
3511         * elf32-ppc.c (ppc_elf_modify_segment_map, update_plt_info): Likewise.
3512         * elf32-pru.c (pru_elf32_link_hash_table_create): Likewise.
3513         * elf32-s390.c (elf_s390_link_hash_table_create),
3514         (elf_s390_check_relocs): Likewise.
3515         * elf32-score.c (score_elf_create_got_section),
3516         (s3_elf32_score_new_section_hook),
3517         (elf32_score_link_hash_table_create): Likewise.
3518         * elf32-score7.c (score_elf_create_got_section),
3519         (s7_elf32_score_new_section_hook): Likewise.
3520         * elf32-sh.c (sh_elf_link_hash_table_create),
3521         (sh_elf_check_relocs): Likewise.
3522         * elf32-tic6x.c (elf32_tic6x_link_hash_table_create),
3523         (elf32_tic6x_new_section_hook, elf32_tic6x_check_relocs): Likewise.
3524         * elf32-tilepro.c (tilepro_elf_link_hash_table_create),
3525         (tilepro_elf_check_relocs): Likewise.
3526         * elf32-v850.c (remember_hi16s_reloc): Likewise.
3527         * elf32-vax.c (elf_vax_link_hash_table_create): Likewise.
3528         * elf32-xtensa.c (elf_xtensa_link_hash_table_create),
3529         (elf_xtensa_new_section_hook): Likewise.
3530         * elf64-alpha.c (elf64_alpha_bfd_link_hash_table_create),
3531         (get_got_entry, elf64_alpha_check_relocs): Likewise.
3532         * elf64-hppa.c (elf64_hppa_hash_table_create): Likewise.
3533         * elf64-ia64-vms.c (elf64_ia64_object_p): Likewise.
3534         * elf64-mmix.c (mmix_elf_new_section_hook): Likewise.
3535         * elf64-ppc.c (ppc64_elf_new_section_hook),
3536         (ppc64_elf_link_hash_table_create, update_local_sym_info),
3537         (update_plt_info, ppc64_elf_check_relocs): Likewise.
3538         * elf64-s390.c (elf_s390_link_hash_table_create),
3539         (elf_s390_check_relocs): Likewise.
3540         * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
3541         * elflink.c (bfd_elf_link_record_local_dynamic_symbol),
3542         (_bfd_elf_link_find_version_dependencies, elf_link_add_object_symbols),
3543         (elf_link_add_archive_symbols, compute_bucket_count),
3544         (bfd_elf_size_dynsym_hash_dynstr, _bfd_elf_link_hash_table_create),
3545         (bfd_elf_get_bfd_needed_list, elf_link_swap_symbols_out),
3546         (bfd_elf_final_link): Likewise.
3547         * elfnn-aarch64.c (elfNN_aarch64_link_hash_table_create),
3548         (elfNN_aarch64_setup_section_lists, elfNN_aarch64_check_relocs),
3549         (elfNN_aarch64_new_section_hook): Likewise.
3550         * elfnn-ia64.c (elfNN_ia64_object_p): Likewise.
3551         * elfnn-riscv.c (riscv_elf_link_hash_table_create),
3552         (riscv_elf_check_relocs): Likewise.
3553         * elfxx-mips.c (_bfd_mips_elf_new_section_hook),
3554         (_bfd_mips_elf_add_symbol_hook, _bfd_mips_elf_check_relocs),
3555         (_bfd_mips_elf_modify_segment_map, _bfd_mips_elf_set_section_contents),
3556         (_bfd_mips_elf_link_hash_table_create): Likewise.
3557         * elfxx-sparc.c (_bfd_sparc_elf_link_hash_table_create),
3558         (_bfd_sparc_elf_check_relocs),
3559         (_bfd_sparc_elf_new_section_hook): Likewise.
3560         * elfxx-tilegx.c (tilegx_elf_link_hash_table_create),
3561         (tilegx_elf_check_relocs): Likewise.
3562         * elfxx-x86.c (_bfd_x86_elf_link_hash_table_create): Likewise.
3563         * format.c (bfd_check_format_matches): Likewise.
3564         * hash.c (_bfd_stringtab_init): Likewise.
3565         * ihex.c (ihex_scan): Likewise.
3566         * irix-core.c (irix_core_core_file_p): Likewise.
3567         * linker.c (bfd_wrapped_link_hash_lookup),
3568         (_bfd_generic_link_hash_table_create),
3569         (_bfd_generic_reloc_link_order): Likewise.
3570         * lynx-core.c (lynx_core_file_p): Likewise.
3571         * netbsd-core.c (netbsd_core_file_p): Likewise.
3572         * osf-core.c (osf_core_core_file_p): Likewise.
3573         * pdp11.c (some_aout_object_p, mkobject, make_empty_symbol),
3574         (link_hash_table_create, aout_link_write_other_symbol): Likewise.
3575         * peXXigen.c (_bfd_XX_bfd_copy_private_section_data): Likewise.
3576         * peicode.h (pe_mkobject): Likewise.
3577         * ppcboot.c (ppcboot_mkobject, ppcboot_canonicalize_symtab): Likewise.
3578         * ptrace-core.c (ptrace_unix_core_file_p): Likewise.
3579         * sco5-core.c (read_uarea): Likewise.
3580         * som.c (hppa_som_gen_reloc_type, som_object_p, som_prep_headers),
3581         (som_write_fixups, som_write_space_strings, som_write_symbol_strings),
3582         (som_finish_writing, som_canonicalize_symtab, som_new_section_hook),
3583         (som_bfd_copy_private_section_data, bfd_som_set_section_attributes),
3584         (bfd_som_attach_aux_hdr, som_write_armap): Likewise.
3585         * srec.c (srec_scan): Likewise.
3586         * syms.c (_bfd_generic_make_empty_symbol): Likewise.
3587         * targets.c (bfd_target_list): Likewise.
3588         * tekhex.c (first_phase, tekhex_sizeof_headers): Likewise.
3589         * trad-core.c (trad_unix_core_file_p): Likewise.
3590         * vms-alpha.c (vms_initialize, alpha_vms_bfd_link_hash_table_create),
3591         (vms_new_section_hook): Likewise.
3592         * wasm-module.c (wasm_make_empty_symbol): Likewise.
3593         * xcofflink.c (xcoff_get_section_contents),
3594         (_bfd_xcoff_bfd_link_hash_table_create, xcoff_set_import_path),
3595         (xcoff_find_function, bfd_xcoff_link_record_set, xcoff_build_ldsym),
3596         (bfd_xcoff_size_dynamic_sections, xcoff_link_input_bfd): Likewise.
3597
3598 2020-02-19  Alan Modra  <[email protected]>
3599
3600         * elfxx-riscv.c (riscv_multi_letter_ext_valid_p): Don't use C99.
3601
3602 2020-02-13  H.J. Lu  <[email protected]>
3603
3604         * plugin.c (try_load_plugin): Make plugin_list_iter an argument
3605         and use it if it isn't NULL.  Remove has_plugin_p argument.  Add
3606         a build_list_p argument.  Don't search plugin_list.  Short circuit
3607         when building the plugin list.
3608         (has_plugin): Renamed to has_plugin_list.
3609         (bfd_plugin_set_plugin): Don't set has_plugin.
3610         (bfd_plugin_specified_p): Check plugin_list instead.
3611         (build_plugin_list): New function.
3612         (load_plugin): Call build_plugin_list and use plugin_list.
3613
3614 2020-02-11  H.J. Lu  <[email protected]>
3615
3616         PR binutils/25355
3617         * plugin.c (try_claim): Always clean up for LTO wrapper.
3618         (try_load_plugin): Treat each object as independent.  Create a
3619         copy for plugin name.
3620
3621 2020-02-11  Nick Clifton  <[email protected]>
3622
3623         * elf32-msp430.c (msp430_final_link_relocate): Always use longs
3624         for addresses in print statements.
3625         (msp430_elf_relax_delete_bytes): Likewise.
3626         (msp430_elf_relax_add_words): Likewise.
3627         (msp430_elf_relax_section): Likewise.
3628
3629 2020-02-11  H.J. Lu  <[email protected]>
3630
3631         * plugin.c (add_symbols): Clear plugin_data memory.
3632
3633 2020-02-10  H.J. Lu  <[email protected]>
3634
3635         PR binutils/25355
3636         * configure.ac (HAVE_EXECUTABLE_SUFFIX): New AC_DEFINE.
3637         (EXECUTABLE_SUFFIX): Likewise.
3638         * config.in: Regenerated.
3639         * configure: Likewise.
3640         * plugin.c (bfd_plugin_close_and_cleanup): Removed.
3641         (plugin_list_entry): Add all_symbols_read, cleanup_handler,
3642         gcc, lto_wrapper, resolution_file, resolution_option, gcc_env,
3643         real_bfd, real_nsyms, real_syms, lto_nsyms and lto_syms.
3644         (get_lto_wrapper): New.
3645         (setup_lto_wrapper_env): Likewise.
3646         (current_plugin): Likewise.
3647         (register_all_symbols_read): Likewise.
3648         (register_cleanup): Likewise.
3649         (get_symbols): Likewise.
3650         (add_input_file): Likewise.
3651         (bfd_plugin_close_and_cleanup): Likewise.
3652         (claim_file): Removed.
3653         (register_claim_file): Set current_plugin->claim_file.
3654         (add_symbols): Make a copy of LTO symbols.  Set lto_nsyms and
3655         lto_syms in current_plugin.
3656         (try_claim): Use current_plugin->claim_file.  Call LTO plugin
3657         all_symbols_read handler.  Copy real symbols to plugin_data.
3658         Call LTO plugin cleanup handler.  Clean up for LTO wrapper.
3659         (try_load_plugin): Don't reuse the previous plugin for LTO
3660         wrapper.  Set up GCC LTO wrapper if possible.  Don't set
3661         plugin_list_iter->claim_file.
3662         (bfd_plugin_canonicalize_symtab): Use real LTO symbols if
3663         possible.
3664         * plugin.h (plugin_data_struct): Add real_bfd, real_nsyms and
3665         real_syms.
3666
3667 2020-02-10  Jozef Lawrynowicz  <[email protected]>
3668
3669         * elf32-msp430.c (msp430_elf_relax_section): Before relaxing a branch,
3670         check if previous instruction matches a conditional jump inserted
3671         earlier. Invert conditional jump and delete branch in this case.
3672
3673 2020-02-10  Jozef Lawrynowicz  <[email protected]>
3674
3675         * elf32-msp430.c (msp430_elf_relax_add_two_words): Rename to
3676         msp430_elf_relax_add_words. Support insertion of either one or two
3677         words.
3678         (msp430_elf_relax_section): Catch opcode of 0x3c00 when relocation
3679         needs to be grown. Handle insertion of branch instruction to replace
3680         jump.
3681
3682 2020-02-10  Jozef Lawrynowicz  <[email protected]>
3683
3684         * elf32-msp430.c (msp430_final_link_relocate): Add printf statements for
3685         debugging relocations.
3686         (msp430_elf_relax_delete_bytes): Likewise.
3687         (msp430_elf_relax_add_two_words): Likewise.
3688         (msp430_elf_relax_section): Likewise.
3689
3690 2020-02-10  Alan Modra  <[email protected]>
3691
3692         * archures.c: Wrap overlong z80 comments.
3693         * bfd-in2.h: Regenerate.
3694
3695 2020-02-07  Sergey Belyashov  <[email protected]>
3696
3697         PR 25469
3698         * archures.c: Add GBZ80 and Z80N machine values.
3699         * reloc.c: Add BFD_RELOC_Z80_16_BE.
3700         * coff-z80.c: Add support for new reloc.
3701         * coffcode.h: Add support for new machine values.
3702         * cpu-z80.c: Add support for new machine names.
3703         * elf32-z80.c: Add support for new reloc.
3704         * bfd-in2.h: Regenerate.
3705         * libbfd.h: Regenerate.
3706
3707 2020-02-07  Nick Clifton  <[email protected]>
3708
3709         PR 23932
3710         * elf.c (rewrite_elf_program_header): Do not complain if no
3711         sections are mapped to a segment.
3712
3713 2020-02-06  H.J. Lu  <[email protected]>
3714
3715         PR ld/25490
3716         * elflink.c (_bfd_elf_gc_mark_extra_sections): Issue an error
3717         for garbage collection on __patchable_function_entries section
3718         without linked-to section.
3719
3720 2020-02-06  H.J. Lu  <[email protected]>
3721
3722         PR gas/25381
3723         * bfd-in2.h: Regenerated.
3724         * elflink.c (_bfd_elf_gc_mark_extra_sections): Call mark_hook
3725         on section if gc_mark of any of its linked-to sections is set
3726         and don't set gc_mark again.
3727         * section.c (asection): Add linked_to_symbol_name to map_head
3728         union.
3729
3730 2020-02-06  Maciej W. Rozycki  <[email protected]>
3731
3732         * elf32-v850.c (v850_elf_relax_section): Fix the index used for
3733         reporting an unrecognized instruction with R_V850_LONGJUMP.
3734
3735 2020-02-05  Alan Modra  <[email protected]>
3736
3737         * elf64-ppc.c (ppc_stub_plt_branch): Match comment with reality.
3738
3739 2020-02-04  Alan Modra  <[email protected]>
3740
3741         * elf32-ppc.c (ppc_elf_relocate_section): After applying
3742         R_PPC_VLE_ADDR20, goto copy_reloc.
3743
3744 2020-02-02  H.J. Lu  <[email protected]>
3745
3746         * bfd-in2.h: Regenerated.
3747         * section.c (SEC_ASSEMBLER_SECTION_ID): Fix a typo in comments.
3748
3749 2020-02-02  H.J. Lu  <[email protected]>
3750
3751         PR gas/25380
3752         * bfd-in2.h: Regenerated.
3753         * ecoff.c (bfd_debug_section): Add section_id.
3754         * section.c (bfd_section): Add section_id.
3755         (SEC_ASSEMBLER_SECTION_ID): New.
3756         (BFD_FAKE_SECTION): Add section_id.
3757
3758 2020-02-01  Nick Clifton  <[email protected]>
3759
3760         * config.bfd: Move the c30-aout and tic30-aout targets onto the
3761         obsolete list.
3762
3763 2020-01-31  Sandra Loosemore  <[email protected]>
3764
3765         * elf-eh-frame.c (_bfd_elf_write_section_eh_frame): DW_EH_PE_datarel
3766         encodings are relative to the GOT on nios2, too.
3767
3768 2020-01-31  Alan Modra  <[email protected]>
3769
3770         * Makefile.am (elf32-target.h, elf64-target.h): Don't use a temp
3771         file.  Use $< and $@ in rules.
3772         (elf32-aarch64.c, elf64-aarch64.c): Likewise.
3773         (elf32-ia64.c, elf64-ia64.c): Likewise.
3774         (elf32-riscv.c, elf64-riscv.c): Likewise.
3775         (peigen.c, pepigen.c, pex64igen.c): Likewise.
3776         (elf32-aarch64.c, elf64-aarch64.c): Don't emit $srcdir on #line.
3777         (elf32-riscv.c, elf64-riscv.c): Likewise, and use $(SED).
3778         (elf32-ia64.c, elf64-ia64.c): Do emit #line.
3779         (peigen.c, pepigen.c, pex64igen.c): Likewise.
3780         * Makefile.in: Regenerate.
3781
3782 2020-01-31  Alan Modra  <[email protected]>
3783
3784         PR 4110
3785         * elf.c (setup_group): Don't clear entire section contents,
3786         just the padding after group flags.  Release alloc'd memory
3787         after a seek or read failure.
3788
3789 2020-01-16  Jon Turney  <[email protected]>
3790
3791         * peXXigen.c (pe_is_repro): New function.
3792         (_bfd_XX_print_private_bfd_data_common): Note timestamp is
3793         actually a build hash if PE_IMAGE_DEBUG_TYPE_REPRO is present.
3794
3795 2020-01-16  Jon Turney  <[email protected]>
3796
3797         * peXXigen.c (debug_type_names): Add names for new debug data type
3798         values.
3799
3800 2020-01-16  Jon Turney  <[email protected]>
3801
3802         * peXXigen.c (pe_print_debugdata): Fix the iteration variable for
3803         inner loop.  Fix a memory leak.
3804
3805 2020-01-30  Alan Modra  <[email protected]>
3806
3807         * coffgen.c (coff_real_object_p): Don't clear obj_coff_keep_syms
3808         or obj_coff_keep_strings here.
3809         (coff_get_normalized_symtab): Free external syms directly.
3810         * xcofflink.c (xcoff_link_input_bfd): Restore obj_coff_keep_syms
3811         on error exit path.
3812
3813 2020-01-27  Jim Wilson  <[email protected]>
3814
3815         * cpu-riscv.c (riscv_scan): New.
3816         (N): Change bfd_default_scan to riscv_scan.
3817
3818 2020-01-27  Andreas Schwab  <[email protected]>
3819
3820         * Makefile.am (ALL_MACHINES): Remove cpu-plugin.lo.
3821         (ALL_MACHINES_CFILES): Remove cpu-plugin.c.
3822         * Makefile.in: Regenerate.
3823         * cpu-plugin.c: Remove.
3824         * archures.c (enum bfd_architecture): Remove bfd_arch_plugin.
3825         (bfd_plugin_arch): Remove declaration.
3826         * bfd-in2.h: Regenerate.
3827         * po/SRC-POTFILES.in: Regenerate.
3828
3829 2020-01-27  H.J. Lu  <[email protected]>
3830             Alan Modra  <[email protected]>
3831
3832         PR ld/25458
3833         * elflink.c (_bfd_elf_gc_mark_rsec): Mark all weak aliases.
3834
3835 2020-01-24  Jim Wilson  <[email protected]>
3836
3837         * elfxx-riscv.c (riscv_get_prefix_class): Format s case like others.
3838         (riscv_parse_prefixed_ext): Fix s extension comment and reword to
3839         avoid over long line.
3840
3841 2020-01-24  Nick Clifton  <[email protected]>
3842
3843         PR 25447
3844         * coffgen.c (_bfd_coff_close_and_cleanup): Do not clear the keep
3845         syms and keep strings flags as these may have been set in order to
3846         prevent a bogus call to free.
3847
3848 2020-01-23  Nick Clifton  <[email protected]>
3849
3850         * po/fr.po: Updated French translation.
3851
3852 2020-01-23  Alan Modra  <[email protected]>
3853
3854         PR 25444
3855         * elf.c (assign_file_positions_for_load_sections): Avoid divide
3856         by zero when p_align is zero.
3857
3858 2020-01-22  Maxim Blinov  <[email protected]>
3859
3860         * bfd/elfnn-riscv.c (riscv_skip_prefix): New.
3861         (riscv_prefix_cmp): Likewise.
3862         (riscv_non_std_ext_p): Deleted.
3863         (riscv_std_sv_ext_p): Likewise.
3864         (riscv_non_std_sv_ext_p): Likewise.
3865         (riscv_merge_non_std_and_sv_ext): Rename to...
3866         (riscv_merge_multi_letter_ext): and modified to use riscv_prefix_cmp.
3867         (riscv_merge_arch_attr_info): Replace 3 calls to
3868         riscv_merge_non_std_and_sv_ext with single call to
3869         riscv_merge_multi_letter_ext.
3870         * bfd/elfxx-riscv.c (riscv_parse_std_ext): Break if we
3871         encounter a 'z' prefix.
3872         (riscv_get_prefix_class): New function, return prefix class based
3873         on first few characters of input string.
3874         (riscv_parse_config): New structure to factor out minor differences
3875         in extension class parsing behaviour.
3876         (riscv_parse_sv_or_non_std_ext): Rename to...
3877         (riscv_parse_prefixed_ext): and parameterise with
3878         riscv_parse_config.
3879         (riscv_std_z_ext_strtab, riscv_std_s_ext_strtab): New.
3880         (riscv_multi_letter_ext_valid_p): New.
3881         (riscv_ext_x_valid_p, riscv_ext_z_valid_p, riscv_ext_s_valid_p): New.
3882         (riscv_parse_subset): Delegate all non-single-letter parsing work
3883         to riscv_parse_prefixed_ext.
3884         * bfd/elfxx-riscv.h (riscv_isa_ext_class): New type.
3885         (riscv_get_prefix_class): Declare.
3886
3887 2020-01-22  Alan Modra  <[email protected]>
3888
3889         * elf64-ppc.c (struct ppc_link_hash_table): Add tga_group.
3890         (ppc64_elf_archive_symbol_lookup): Extract __tls_get_addr_opt for
3891         __tls_get_addr_desc.
3892         (ppc64_elf_size_stubs): Add section for linker generated
3893         __tls_get_addr_desc wrapper function.  Loop at least once if
3894         generating this function.
3895         (emit_tga_desc, emit_tga_desc_eh_frame): New functions.
3896         (ppc64_elf_build_stubs): Generate __tls_get_addr_desc.
3897
3898 2020-01-22  Alan Modra  <[email protected]>
3899
3900         * elf64-ppc.h (struct ppc64_elf_params): Add no_tls_get_addr_regsave.
3901         * elf64-ppc.c (struct ppc_link_hash_table): Add tga_desc and
3902         tga_desc_fd.
3903         (is_tls_get_addr): Match tga_desc and tga_desc_df too.
3904         (STDU_R1_0R1, ADDI_R1_R1): Define.
3905         (tls_get_addr_prologue, tls_get_addr_epilogue): New functions.
3906         (ppc64_elf_tls_setup): Set up tga_desc and tga_desc_fd.  Indirect
3907         tga_desc_fd to opt_fd, and tga_desc to opt.  Set
3908         no_tls_get_addr_regsave.
3909         (branch_reloc_hash_match): Add hash3 and hash4.
3910         (ppc64_elf_tls_optimize): Handle tga_desc_fd and tga_desc too.
3911         (ppc64_elf_size_dynamic_sections): Likewise.
3912         (ppc64_elf_relocate_section): Likewise.
3913         (plt_stub_size, build_plt_stub): Likewise.  Size regsave
3914         __tls_get_addr stub.
3915         (build_tls_get_addr_stub): Build regsave __tls_get_addr stub and
3916         eh_frame.
3917         (ppc_size_one_stub): Handle tga_desc_fd and tga_desc too.  Size
3918         eh_frame for regsave __tls_get_addr.
3919
3920 2020-01-22  Alan Modra  <[email protected]>
3921
3922         * elf64-ppc.c (ppc64_elf_size_stubs): Correct condition under
3923         which __tls_get_addr calls will be eliminated.
3924
3925 2020-01-20  Nick Clifton  <[email protected]>
3926
3927         * po/pt.po: Updates Portuguese translation.
3928         * po/ru.po: Updated Russian translation.
3929         * po/uk.po: Updated Ukranian translation.
3930
3931 2020-01-20  H.J. Lu  <[email protected]>
3932
3933         PR ld/25416
3934         * elf64-x86-64.c (elf_x86_64_check_tls_transition): Support
3935         "rex leal x@tlsdesc(%rip), %reg" and "call *x@tlsdesc(%eax)" in
3936         X32 mode.
3937         (elf_x86_64_relocate_section): In x32 mode, for GDesc -> LE
3938         transition, relax "rex leal x@tlsdesc(%rip), %reg" to
3939         "rex movl $x@tpoff, %reg", for GDesc -> IE transition, relax
3940         "rex leal x@tlsdesc(%rip), %reg" to
3941         "rex movl x@gottpoff(%rip), %eax".  For both transitions, relax
3942         "call *(%eax)" to "nopl (%rax)".
3943
3944 2020-01-20  Alan Modra  <[email protected]>
3945
3946         * elf64-ppc.c (LD_R11_0R3, CMPDI_R11_0, STD_R11_0R1, LD_R11_0R1),
3947         (MTLR_R11): Don't define.
3948         (LD_R0_0R3, CMPDI_R0_0): Define.
3949         (build_tls_get_addr_stub): Don't use r11 in stub.
3950
3951 2020-01-20  Alan Modra  <[email protected]>
3952
3953         * elf64-ppc.c (ppc_elf_hash_entry): New function, use throughout file.
3954         (defined_sym_val, is_tls_get_addr): Likewise.
3955
3956 2020-01-18  Nick Clifton  <[email protected]>
3957
3958         * version.m4 (BFD_VERSION): Set to 2.34.50.
3959         * configure: Regenerate.
3960         * po/bfd.pot: Regenerate.
3961
3962 2020-01-18  Nick Clifton  <[email protected]>
3963
3964         Binutils 2.34 branch created.
3965
3966 2020-01-17  Christian Biesinger  <[email protected]>
3967
3968         * coff-arm.c: Fix spelling error (seperate).
3969         * elfxx-riscv.c (riscv_parse_sv_or_non_std_ext): Fix spelling
3970         error (seperate).
3971         * sysdep.h (strnlen): Fix spelling error (seperate).
3972
3973 2020-01-15  Lars Brinkhoff  <[email protected]>
3974
3975         PR 20694
3976         * pdp11.c (TARGET_PAGE_SIZE): Set to 8192.
3977
3978 2020-01-15  Alan Modra  <[email protected]>
3979
3980         PR 25384
3981         * elf64-ppc.c (ELIMINATE_COPY_RELOCS): Update comment.
3982         (ppc64_elf_adjust_dynamic_symbol): Don't allow .dynbss copies
3983         of function symbols unless dot symbols are present.  Do warn
3984         whenever one is created, regardles of whether a PLT entry is
3985         also emitted for the function symbol.
3986
3987 2020-01-14  Alan Modra  <[email protected]>
3988
3989         * som.c (som_bfd_count_ar_symbols): Error when file position
3990         of symbols on chains is not strictly increasing.
3991
3992 2020-01-14  Alan Modra  <[email protected]>
3993
3994         * vms.h (VMS_DEBUG): Define as 0.
3995         * vms-alpha.c (image_write): Move debug output after bounds check.
3996         Tidy bounds check.
3997         (_bfd_vms_slurp_eihd): Warning fix.
3998         (_bfd_vms_slurp_etir): Init variables to avoid bogus warnings.
3999
4000 2020-01-13  Alan Modra  <[email protected]>
4001
4002         * vms-alpha.c (_bfd_vms_slurp_egsd): Ensure minimum size even
4003         for "ignored" records.
4004
4005 2020-01-13  Alan Modra  <[email protected]>
4006
4007         * wasm-module.c (wasm_scan_name_function_section): Formatting.
4008         Delete asect name check.  Move asect NULL check to wasm_object_p.
4009         Correct bounds check of sizes against end.  Replace uses of
4010         bfd_zalloc with bfd_alloc, zeroing only necessary bytes.  Use
4011         just one bfd_release.
4012         (wasm_scan): Don't use malloc/strdup for section names,
4013         bfd_alloc instead.  Simplify code prefixing section name.
4014         Formatting.  Don't attempt to free memory here..
4015         (wasm_object_p): ..do so here.
4016
4017 2020-01-10  Szabolcs Nagy  <[email protected]>
4018
4019         PR ld/22269
4020         * elf32-arm.c (elf32_arm_final_link_relocate): Use
4021         UNDEFWEAK_NO_DYNAMIC_RELOC.
4022         (allocate_dynrelocs_for_symbol): Likewise.
4023
4024 2020-01-10  Tamar Christina  <[email protected]>
4025
4026         PR 25210
4027         * elfnn-aarch64.c (_bfd_aarch64_create_stub_section): Remove elfclass.
4028
4029 2020-01-10  Alan Modra  <[email protected]>
4030
4031         * coff-alpha.c (alpha_ecoff_object_p): Calculate size in bfd_size_type.
4032
4033 2020-01-09  Nick Clifton  <[email protected]>
4034
4035         PR 25221
4036         * bfd.c (bfd_convert_section_contents): Check for a compress
4037         header size that is larger than the actual section size.
4038
4039 2020-01-08  Alan Modra  <[email protected]>
4040
4041         PR 25351
4042         * elflink.c (bfd_elf_final_link): Call _bfd_fix_excluded_sec_syms
4043         after removing sections.
4044
4045 2020-01-06  Jim Wilson  <[email protected]>
4046
4047         PR 25205
4048         * elfnn-riscv.c (riscv_elf_relocate_section) <R_RISCV_CALL>: Add
4049         check for !bfd_link_pic (info).
4050         <R_RISCV_CALL_PLT>: Move next to R_RISCV_CALL.
4051         <R_RISCV_JAL>: Add comment.
4052         (_bfd_riscv_relax_section): For plt.offset check, add check for
4053         bfd_link_pic (info).  Add comment.
4054
4055 2020-01-06  Alan Modra  <[email protected]>
4056
4057         * format.c (bfd_check_format_matches): Ignore bfd_error on target
4058         match failures.  Don't init to bfd_error_wrong_format before
4059         calling _bfd_check_format.
4060
4061 2020-01-06  Alan Modra  <[email protected]>
4062
4063         * vms-alpha.c (_bfd_vms_push, _bfd_vms_pop): Return pass/fail
4064         status rather than exiting on stack overflow or underflow.
4065         (_bfd_vms_slurp_etir): Adjust to suit.
4066
4067 2020-01-06  Alan Modra  <[email protected]>
4068
4069         * som.c (som_bfd_fill_in_ar_symbols): Bounds check som_dict index.
4070
4071 2020-01-06  Alan Modra  <[email protected]>
4072
4073         * mach-o.c (bfd_mach_o_read_dylinker): Don't read past end of
4074         command.  Check name offset is within command.
4075         (bfd_mach_o_read_dylib, bfd_mach_o_read_prebound_dylib),
4076         (bfd_mach_o_read_prebind_cksum, bfd_mach_o_read_twolevel_hints),
4077         (bfd_mach_o_read_fvmlib, bfd_mach_o_read_dysymtab),
4078         (bfd_mach_o_read_symtab, bfd_mach_o_read_uuid),
4079         (bfd_mach_o_read_linkedit, bfd_mach_o_read_str),
4080         (bfd_mach_o_read_dyld_info, bfd_mach_o_read_version_min),
4081         (bfd_mach_o_read_encryption_info, bfd_mach_o_read_source_version),
4082         (bfd_mach_o_read_encryption_info_64, bfd_mach_o_read_main),
4083         (bfd_mach_o_read_note, bfd_mach_o_read_build_version),
4084         (bfd_mach_o_read_segment): Similarly.
4085         (bfd_mach_o_read_thread): Properly bound check thread struct.
4086         Don't repeat checks on second loop.
4087         (bfd_mach_o_read_command): Fail on invalid command length.
4088
4089 2020-01-04  Alan Modra  <[email protected]>
4090
4091         * format.c (bfd_check_format_matches): Add preserve_match.
4092         Save initial bfd state in "preserve", matched bfd state in
4093         "preserve_match".  Save just the first match.  Release
4094         bfd_alloc memory.  Restore and finish preserved state as
4095         appropriate on all function exit paths.
4096
4097 2020-01-04  Alan Modra  <[email protected]>
4098
4099         * mmo.c (mmo_mkobject): Allocate tdata with bfd_zalloc.
4100
4101 2020-01-04  Alan Modra  <[email protected]>
4102
4103         * coffgen.c (coff_real_object_p): Free malloc'd memory on target
4104         match too.
4105
4106 2020-01-03  Nick Clifton  <[email protected]>
4107
4108         PR 25307
4109         (bfd_pef_parse_function_stubs): Correct the test that ensures that
4110         there is enough data remaining in the code buffer before
4111         attempting to read a function stub.
4112
4113 2020-01-03  Nick Clifton  <[email protected]>
4114
4115         PR 25308
4116         * elf-properties.c (_bfd_elf_convert_gnu_properties): Check the
4117         return value from bfd_malloc.
4118         * elf32-arm.c (bfd_elf32_arm_vfp11_fix_veneer_locations): Likewise.
4119         (bfd_elf32_arm_stm32l4xx_fix_veneer_locations): Likewise.
4120         (elf32_arm_filter_cmse_symbols): Likewise.
4121         (elf32_arm_write_section): Likewise.
4122         * mach-o.c (bfd_mach_o_core_fetch_environment): Likewise.
4123         (bfd_mach_o_follow_dsym): Likewise.
4124         * pef.c (bfd_pef_print_loader_section): Likewise.
4125         (bfd_pef_scan_start_address): Likewise.
4126         (bfd_pef_parse_function_stubs): Likewise.
4127         (bfd_pef_parse_symbols): Likewise.
4128
4129 2020-01-03  Sergei Trofimovich  <[email protected]>
4130
4131         * elfnn-ia64.c (elfNN_ia64_merge_private_bfd_data): don't fail
4132         on binary inputs ld/PR25316.
4133         (is_ia64_elf): new helper to filter on ia64 objects.
4134
4135 2020-01-03  Jan Beulich  <[email protected]>
4136
4137         * mach-o.c (cpusubtype, bfd_mach_o_header_p): Insert underscore
4138         in parameter names.
4139         (bfd_mach_o_scan): Insert underscore in two variable names.
4140
4141 2020-01-02  Sergey Belyashov  <[email protected]>
4142
4143         * Makefile.am: Add z80-elf target support.
4144         * configure.ac: Likewise.
4145         * targets.c: Likewise.
4146         * Makefile.in: Regenerate.
4147         * configure: Regenerate.
4148         * config.bfd: Add z80-elf target support and new arches: ez80 and
4149         z180.
4150         * elf32-z80.c: New file.
4151         * archures.c: Add new z80 architectures: eZ80 and Z180.
4152         * coffcode.h: Likewise.
4153         * cpu-z80.c: Likewise.
4154         * coff-z80.c: Add new relocations for Z80 target and local label
4155         check.
4156         * reloc.c: Add new relocs.
4157         * bfd-in2.h: Regenerate.
4158         * libbfd.h: Regenerate.
4159
4160 2020-01-02  Tamar Christina  <[email protected]>
4161
4162         PR 25210
4163         PR 24753
4164         * elfnn-aarch64.c (_bfd_aarch64_create_stub_section): Set ELF class.
4165
4166 2020-01-01  Alan Modra  <[email protected]>
4167
4168         Update year range in copyright notice of all files.
4169
4170 For older changes see ChangeLog-2019
4171 \f
4172 Copyright (C) 2020 Free Software Foundation, Inc.
4173
4174 Copying and distribution of this file, with or without modification,
4175 are permitted in any medium without royalty provided the copyright
4176 notice and this notice are preserved.
4177
4178 Local Variables:
4179 mode: change-log
4180 left-margin: 8
4181 fill-column: 74
4182 version-control: never
4183 End:
This page took 0.260561 seconds and 4 git commands to generate.