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