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