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