PR25993, read of freed memory
[deliverable/binutils-gdb.git] / bfd / ChangeLog
1 2020-05-20 Alan Modra <amodra@gmail.com>
2
3 PR 25993
4 * archive.c (_bfd_get_elt_at_filepos): Don't strdup filename,
5 use bfd_set_filename.
6 * elfcode.h (_bfd_elf_bfd_from_remote_memory): Likewise.
7 * mach-o.c (bfd_mach_o_fat_member_init): Likewise.
8 * opncls.c (bfd_fopen, bfd_openstreamr, bfd_openr_iovec, bfd_openw),
9 (bfd_create): Likewise.
10 (_bfd_delete_bfd): Don't free filename.
11 (bfd_set_filename): Copy filename param to bfd_alloc'd memory,
12 return pointer to the copy or NULL on alloc fail.
13 * vms-lib.c (_bfd_vms_lib_get_module): Free newname and test
14 result of bfd_set_filename.
15 * bfd-in2.h: Regenerate.
16
17 2020-05-20 Alan Modra <amodra@gmail.com>
18
19 PR 26011
20 * elf.c (_bfd_elf_get_reloc_upper_bound): Sanity check reloc
21 section size against file size.
22 (_bfd_elf_get_dynamic_reloc_upper_bound): Likewise.
23
24 2020-05-19 Gunther Nikl <gnikl@justmail.de>
25
26 PR 26005
27 * elf.c (bfd_section_from_shdr): Replace bfd_malloc + memset with
28 bfd_zmalloc to allocate memory for the sections_being_created array.
29
30 2020-05-19 Stafford Horne <shorne@gmail.com>
31
32 * elf32-or1k.c (or1k_elf_finish_dynamic_symbol): Rename srela
33 to relgot.
34 (or1k_elf_relocate_section): Access srelgot via
35 htab->root.srelgot. Add assertions for srelgot->contents.
36 Introduce local variable for srelgot to not reuse global
37 sreloc.
38 (or1k_elf_relocate_section): Fixup dynamic symbol detection.
39 (or1k_set_got_and_rela_sizes): New function.
40 (or1k_initial_exec_offset): New function.
41 (TLS_GD, TLS_IE, TLS_LD, TLS_LE): Redefine macros as masks.
42 (or1k_elf_relocate_section): Allow for TLS to handle multiple
43 model access.
44 (or1k_elf_check_relocs): Use OR to set TLS access.
45 (allocate_dynrelocs): Use or1k_set_got_and_rela_sizes to set
46 sizes.
47 (or1k_elf_size_dynamic_sections): Use
48 or1k_set_got_and_rela_sizes to set sizes.
49 (or1k_elf_relocate_section): Fixup PCREL relocation calculation.
50 (TCB_SIZE): New macro.
51 (tpoff): Use TCB_SIZE and alignment to calculate offset.
52 (allocate_dynrelocs, readonly_dynrelocs, or1k_elf_check_relocs)
53 (or1k_elf_size_dynamic_sections): Rename p to sec_relocs.
54 (allocate_dynrelocs): Rename s to splt or sgot based on usage.
55 (tpoff): Add dynamic boolean argument.
56 (or1k_elf_relocate_section): Pass dynamic flag to tpoff.
57
58 2020-05-19 Siddhesh Poyarekar <siddesh.poyarekar@arm.com>
59
60 * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Club
61 BFD_RELOC_AARCH64_BRANCH19 and BFD_RELOC_AARCH64_TSTBR14
62 cases with BFD_RELOC_AARCH64_JUMP26.
63 (elfNN_aarch64_check_relocs): Likewise.
64
65 2020-05-19 Alan Modra <amodra@gmail.com>
66
67 * aix5ppc-core.c (xcoff64_core_file_matches_executable_p): Use
68 bfd_get_filename rather than accessing bfd->filename directly.
69 * aout-target.h (MY (object_p)): Likewise.
70 * aoutx.h (aout_find_nearest_line, aout_link_write_symbols): Likewise.
71 * archive.c (find_nested_archive, _bfd_generic_read_ar_hdr_mag),
72 (_bfd_construct_extended_name_table, _bfd_bsd44_write_ar_hdr),
73 (_bfd_archive_bsd44_construct_extended_name_table),
74 (_bfd_write_archive_contents, _bfd_compute_and_write_armap),
75 (_bfd_bsd_write_armap): Likewise.
76 * bfd.c (bfd_errmsg, _bfd_doprnt): Likewise.
77 * cache.c (bfd_open_file): Likewise.
78 * ecoff.c (_bfd_ecoff_write_armap): Likewise.
79 * ecofflink.c (bfd_ecoff_debug_accumulate_other): Likewise.
80 * elf32-bfin.c (bfinfdpic_relocate_section): Likewise.
81 * elf32-frv.c (elf32_frv_relocate_section): Likewise.
82 * elf32-hppa.c (elf32_hppa_final_link): Likewise.
83 * elf32-nds32.c (nds32_elf_output_symbol_hook),
84 (patch_tls_desc_to_ie): Likewise.
85 * elf32-spu.c (sort_bfds, print_one_overlay_section),
86 (spu_elf_auto_overlay): Likewise.
87 * elf64-hppa.c (elf_hppa_final_link): Likewise.
88 * elf64-ia64-vms.c (elf64_ia64_size_dynamic_sections): Likewise.
89 * elfcore.h (elf_core_file_matches_executable_p): Likewise.
90 * elflink.c (bfd_elf_size_dynamic_sections),
91 (elf_link_input_bfd): Likewise.
92 * linker.c (_bfd_generic_link_output_symbols): Likewise.
93 * mach-o.c (bfd_mach_o_follow_dsym),
94 (bfd_mach_o_close_and_cleanup): Likewise.
95 * opncls.c (_bfd_delete_bfd, _maybe_make_executable),
96 (find_separate_debug_file, get_build_id_name): Likewise.
97 * pdp11.c (aout_find_nearest_line, aout_link_write_symbols): Likewise.
98 * plugin.c (bfd_plugin_open_input): Likewise.
99 * rs6000-core.c (rs6000coff_core_file_matches_executable_p): Likewise.
100 * som.c (som_write_armap): Likewise.
101 * srec.c (srec_write_record, srec_write_symbols): Likewise.
102 * vms-lib.c (_bfd_vms_lib_get_imagelib_file),
103 (_bfd_vms_lib_write_archive_contents): Likewise.
104 * xcofflink.c (xcoff_link_add_dynamic_symbols): Likewise.
105
106 2020-05-19 Alan Modra <amodra@gmail.com>
107
108 PR 25713
109 * bfdio.c (_bfd_real_fopen): Typo fix.
110
111 2020-05-18 Nick Clifton <nickc@redhat.com>
112
113 PR 26005
114 * elf.c (bfd_section_from_shdr): Use bfd_malloc to allocate memory
115 for the sections_being_created array.
116
117 2020-05-18 Alan Modra <amodra@gmail.com>
118
119 * ecoff.c (ecoff_slurp_reloc_table): Malloc external_relocs so
120 they can be freed without also freeing internal_relocs.
121
122 2020-05-18 Jaydeep Chauhan <jaydeepchauhan1494@gmail.com>
123
124 PR 25713
125 * bfdio.c (_bfd_real_fopen): Convert UNIX style sirectory
126 separators into DOS style when creating a WIN32 fullpath.
127
128 2020-05-14 Nelson Chu <nelson.chu@sifive.com>
129
130 * elfnn-riscv.c (elfNN_riscv_mkobject): New function. We need this
131 to initialize RISC-V tdata.
132
133 2020-05-12 Gunther Nikl <gnikl@justmail.de>
134
135 * aoutx.h (NAME (aout, swap_std_reloc_out)): Reject an unsupported
136 relocation size.
137
138 2020-05-11 Alan Modra <amodra@gmail.com>
139
140 * elf64-ppc.c (xlate_pcrel_opt): Handle lxvp and stxvp.
141
142 2020-05-11 Alan Modra <amodra@gmail.com>
143
144 * elf64-ppc.c: Rename powerxx to power10 throughout.
145
146 2020-05-11 Alan Modra <amodra@gmail.com>
147
148 PR 25961
149 * coffgen.c (coff_get_normalized_symtab): Check that buffer
150 contains required number of auxents before processing any auxent.
151 * coffswap.h (coff_swap_aux_in <C_FILE>): Only swap in extended
152 file name from auxents for PE.
153
154 2020-05-04 Gunther Nikl <gnikl@justmail.de>
155
156 * aout-cris.c (DEFAULT_ARCH): Delete define.
157 (MY_set_arch_mach): Likewise.
158 (SET_ARCH_MACH): Use bfd_set_arch_mach with an explicit architecture
159 of bfd_arch_cris.
160 (swap_ext_reloc_in): Add casts to r_index extraction. Mask valid bits
161 of r_type before the shift.
162
163 2020-05-04 Wilco Dijkstra <wdijkstr@arm.com>
164
165 PR ld/25665
166 * elfnn-aarch64.c (group_sections): Copy implementation from
167 elf32-arm.c.
168
169 2020-05-01 Alan Modra <amodra@gmail.com>
170
171 PR 25900
172 * elfnn-riscv.c (_bfd_riscv_relax_section): Check root.type before
173 accessing root.u.def of symbols. Also check root.u.def.section
174 is non-NULL. Reverse tests so as to make the logic positive.
175
176 2020-05-01 Alan Modra <amodra@gmail.com>
177
178 PR 25882
179 * elf32-tic6x.c (elf32_tic6x_merge_attributes): Don't transfer
180 Tag_ABI_PIC or Tag_ABI_PID from dynamic objects to the output.
181
182 2020-05-01 Alan Modra <amodra@gmail.com>
183
184 PR 25882
185 * elf32-bfin.c (elf32_bfin_merge_private_bfd_data): Add FIXME.
186 * elf32-frv.c (frv_elf_merge_private_bfd_data): Likewise.
187 * elfxx-mips.c (_bfd_mips_elf_merge_private_bfd_data): Likewise.
188 * elf32-nds32.c (nds32_elf_merge_private_bfd_data): Likewise.
189 * elf32-score.c (s3_elf32_score_merge_private_bfd_data): Likewise.
190 * elf32-score7.c (s7_elf32_score_merge_private_bfd_data): Likewise.
191 * elf32-sh.c (sh_elf_merge_private_data): Likewise.
192 * elf32-tic6x.c (elf32_tic6x_merge_attributes): Likewise.
193 * elf64-ia64-vms.c (elf64_ia64_merge_private_bfd_data): Likewise.
194 * elfnn-ia64.c (elfNN_ia64_merge_private_bfd_data): Likewise.
195
196 2020-05-01 Alan Modra <amodra@gmail.com>
197
198 PR 25882
199 * elf32-ppc.c (ppc_elf_merge_private_bfd_data): Ignore e_flags
200 from shared libraries.
201
202 2020-04-29 Max Filippov <jcmvbkbc@gmail.com>
203
204 * elf32-xtensa.c (relax_section): Don't negate diff_value for
205 XTENSA_NDIFF relocations. Don't add sign bits whe diff_value
206 equals 0. Report overflow when the result has negative sign but
207 all significant bits are zero.
208
209 2020-04-29 Gunther Nikl <gnikl@justmail.de>
210
211 * aoutx.h (swap_std_reloc_out): Special case 64 bit relocations.
212 (aout_link_reloc_link_order): Likewise. Make r_length an unsigned.
213
214 2020-04-28 Alan Modra <amodra@gmail.com>
215
216 * vms-alpha.c (_bfd_vms_slurp_etir): Correct divide by zero check.
217 Emit warning message.
218
219 2020-04-27 Tamar Christina <tamar.christina@arm.com>
220
221 * coff-i386.c (COFF_WITH_PE_BIGOBJ): New.
222 * coff-x86_64.c (COFF_WITH_PE_BIGOBJ): New.
223 * config.bfd (targ_selvecs): Rename x86_64_pe_be_vec
224 to x86_64_pe_big_vec as it not a big-endian format.
225 (vec i386_pe_big_vec): New.
226 * configure.ac: Likewise.
227 * targets.c: Likewise.
228 * configure: Regenerate.
229 * pe-i386.c (TARGET_SYM_BIG, TARGET_NAME_BIG,
230 COFF_WITH_PE_BIGOBJ): New.
231 * pe-x86_64.c (TARGET_SYM_BIG, TARGET_NAME_BIG):
232 New.
233 (x86_64_pe_be_vec): Moved.
234
235 2020-04-23 Anton Kolesov <anton.kolesov@synopsys.com>
236
237 * elf-bfd.h (elfcore_write_arc_v2): Add prototype.
238 * elf.c (elfcore_grok_arc_v2): New function.
239 (elfcore_grok_note): Call the new function to handle the corresponding
240 note.
241 (elfcore_write_arc_v2): New function.
242 (elfcore_write_register_note): Call the new function to handle the
243 corresponding pseudo-sections.
244
245 2020-04-22 Max Filippov <jcmvbkbc@gmail.com>
246
247 PR ld/25861
248 * bfd-in2.h: Regenerated.
249 * elf32-xtensa.c (elf_howto_table): New entries for
250 R_XTENSA_PDIFF{8,16,32} and R_XTENSA_NDIFF{8,16,32}.
251 (elf_xtensa_reloc_type_lookup, elf_xtensa_do_reloc)
252 (relax_section): Add cases for R_XTENSA_PDIFF{8,16,32} and
253 R_XTENSA_NDIFF{8,16,32}.
254 * libbfd.h (bfd_reloc_code_real_names): Add names for
255 BFD_RELOC_XTENSA_PDIFF{8,16,32} and
256 BFD_RELOC_XTENSA_NDIFF{8,16,32}.
257 * reloc.c: Add documentation for BFD_RELOC_XTENSA_PDIFF{8,16,32}
258 and BFD_RELOC_XTENSA_NDIFF{8,16,32}.
259
260 2020-04-21 Tamar Christina <tamar.christina@arm.com>
261
262 PR binutils/24753
263 * compress.c (bfd_get_full_section_contents): Exclude sections with no
264 content.
265
266 2020-04-21 H.J. Lu <hongjiu.lu@intel.com>
267
268 PR ld/25849
269 * elf-bfd.h (elf_backend_data): Add
270 elf_backend_strip_zero_sized_dynamic_sections.
271 (_bfd_elf_strip_zero_sized_dynamic_sections): New prototype.
272 * elf64-alpha.c (elf_backend_strip_zero_sized_dynamic_sections):
273 New macro.
274 * elflink.c (_bfd_elf_strip_zero_sized_dynamic_sections): New
275 function.
276 * elfxx-target.h (elf_backend_strip_zero_sized_dynamic_sections):
277 New macro.
278 (elfNN_bed): Add elf_backend_strip_zero_sized_dynamic_sections.
279
280 2020-04-21 H.J. Lu <hongjiu.lu@intel.com>
281
282 * elf64-alpha.c (alpha_elf_reloc_entry): Replace reltext with
283 sec.
284 (elf64_alpha_check_relocs): Set sec instead of reltext. Warn
285 DT_TEXTREL with -M.
286 (elf64_alpha_calc_dynrel_sizes): Warn DT_TEXTREL with -M.
287
288 2020-04-21 Nick Clifton <nickc@redhat.com>
289
290 * po/sr.po: Updated Serbian translation.
291
292 2020-04-21 Alan Modra <amodra@gmail.com>
293
294 * elf32-sh.c (sh_elf_relocate_section): Remove STO_SH5_ISA32
295 processing.
296
297 2020-04-20 Stephen Casner <casner@acm.org>
298
299 * pdp11.c (N_STAB): Modify value to avoid conflict with N_EXT
300 causing globals from linker script to be treated as debug symbols.
301 (translate_symbol_table): Don't sign-extend symbol values from 16
302 to 64 bits in nm output.
303
304 2020-04-20 Alan Modra <amodra@gmail.com>
305
306 * elf64-ppc.c (ppc64_elf_size_stubs): Strip relbrlt too.
307
308 2020-04-18 Alan Modra <amodra@gmail.com>
309
310 * section.c (bfd_is_const_section): Correct test for special
311 sections.
312 * bfd-in2.h: Regenerate.
313
314 2020-04-17 Alan Modra <amodra@gmail.com>
315
316 PR 25842
317 * elf.c (_bfd_elf_get_symbol_version_string): Don't segfault on
318 NULL nodename.
319
320 2020-04-16 Nick Clifton <nickc@redhat.com>
321
322 PR 25803
323 * elfxx-mips.c (_bfd_mips_elf_adjust_dynamic_symbol): Replace an
324 abort with a more helpful error message.
325
326 2020-04-16 Alan Modra <amodra@gmail.com>
327
328 PR 25827
329 * dwarf2.c (scan_unit_for_symbols): Wrap overlong lines. Don't
330 strdup(0).
331
332 2020-04-15 Fangrui Song <maskray@google.com>
333
334 PR binutils/24613
335 * coff-rs6000.c (xcoff_ppc_relocate_section): Change RM_GENERATE_ERROR
336 to RM_DIAGNOSE plus a check of warn_unresolved_syms.
337 * coff64-rs6000.c (xcoff_ppc_relocate_section): Likewise.
338 * elf-bfd.h (_bfd_elf_large_com_section): Likewise.
339 * elf32-m32r.c (m32r_elf_relocate_section): Likewise.
340 * elf32-score.c (s3_bfd_score_elf_relocate_section): Likewise.
341 * elf32-score7.c (s7_bfd_score_elf_relocate_section): Likewise.
342 * elf32-sh.c (sh_elf_relocate_section): Likewise.
343 * elf32-spu.c (spu_elf_relocate_section): Likewise.
344 * elf64-hppa.c (elf64_hppa_relocate_section): Likewise.
345 * elflink.c (elf_link_output_extsym): Likewise.
346 * elfxx-mips.c (mips_elf_calculate_relocation): Likewise.
347
348 2020-04-15 Alan Modra <amodra@gmail.com>
349
350 PR 25823
351 * peXXigen.c (_bfd_XXi_swap_sym_in <C_SECTION>): Don't use a
352 pointer into strings that may be freed for section name, always
353 allocate a new string.
354
355 2020-04-14 Juan Manuel Guerrero <juan.guerrero@gmx.de>
356 Jan W. Jagersma <jwjagersma@gmail.com>
357
358 * coff-go32.c (COFF_GO32, IMAGE_SCN_LNK_NRELOC_OVFL)
359 (coff_SWAP_scnhdr_in, coff_SWAP_scnhdr_out): Define.
360 (_bfd_go32_swap_scnhdr_in, _bfd_go32_swap_scnhdr_out)
361 (_bfd_go32_mkobject): New functions.
362 * coff-stgo32.c (IMAGE_SCN_LNK_NRELOC_OVFL)
363 (coff_SWAP_scnhdr_in, coff_SWAP_scnhdr_out): Define.
364 (go32exe_mkobject): Call _bfd_go32_mkobject.
365 * coffcode.h (COFF_WITH_EXTENDED_RELOC_COUNTER): Define.
366 (coff_set_alignment_hook): Define function for COFF_GO32_EXE
367 and COFF_GO32.
368 (coff_write_relocs): Enable extended reloc counter code if
369 COFF_WITH_EXTENDED_RELOC_COUNTER is defined. Test for obj_go32.
370 (coff_write_object_contents): Likewise. Pad section headers
371 for COFF_GO32 and COFF_GO32EXE. Use bfd_coff_swap_scnhdr_out
372 instead of coff_swap_scnhdr_out.
373 * cofflink.c (_bfd_coff_final_link): Test also for obj_go32 to
374 enable extended reloc counter.
375 * coffswap.h: (coff_swap_scnhdr_in, coff_swap_scnhdr_out):
376 Declare with ATTRIBUTE_UNUSED.
377 * libcoff-in.h: (struct coff_tdata): New field go32.
378 (obj_go32): Define.
379 * libcoff.h: Regenerate.
380
381 2020-04-14 Fangrui Song <maskray@google.com>
382
383 PR gas/25768
384 * elf.c (assign_section_numbers): Always set .stab sh_entsize to
385 12.
386
387 2020-04-14 Stephen Casner <casner@acm.org>
388
389 PR ld/25677
390 * pdp11.c: Add implementation of --imagic option.
391 (adjust_o_magic): Fix objcopy --extract-symbol test.
392 * libaout.h (enum aout_magic): Add i_magic.
393
394 2020-04-07 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
395 Nick Clifton <nickc@redhat.com>
396
397 * elf32-sparc.c (sparc_final_write_processing): Fix whitespace.
398 <0>: Ignore.
399 <default>: Error rather than abort.
400
401 2020-04-03 H.J. Lu <hongjiu.lu@intel.com>
402
403 PR ld/25767
404 * elf.c (_bfd_elf_fixup_group_sections): Remove zero-sized
405 relocation section from section group.
406
407 2020-04-02 Jan W. Jagersma <jwjagersma@gmail.com>
408
409 * bfdio.c (bfd_bread, bfd_tell, bfd_seek, bfd_mmap): Always add
410 bfd->origin to file offset.
411 * bfdwin.c (bfd_get_file_window): Likewise.
412 * bfd.c: Clarify the use of the bfd->origin field.
413 * bfd-in2.h: Regenerate.
414 * coff-i386.c: Don't include go32exe.h. Allow overriding
415 coff_write_object_contents via COFF_WRITE_CONTENTS.
416 * coff-stgo32.c (go32exe_cleanup, go32exe_mkobject)
417 (go32exe_write_object_contents): New functions.
418 (go32exe_temp_stub, go32exe_temp_stub_size): New static globals.
419 (COFF_WRITE_CONTENTS, GO32EXE_DEFAULT_STUB_SIZE): Define.
420 (create_go32_stub): Remove check for 2k size limit. Read stub
421 from go32exe_temp_stub if present.
422 (go32_stubbed_coff_bfd_copy_private_bfd_data): Allocate and
423 copy variable-length stub.
424 (go32_check_format): Read stub to go32exe_temp_stub, set
425 origin, return go32exe_cleanup.
426 (adjust_filehdr_in_post, adjust_filehdr_out_pre)
427 (adjust_filehdr_out_post, adjust_scnhdr_in_post)
428 (adjust_scnhdr_out_pre, adjust_scnhdr_out_post)
429 (adjust_aux_in_post, adjust_aux_out_pre, adjust_aux_out_post):
430 Remove functions and their associated #defines.
431 * coffcode.h (coff_mkobject_hook): Remove stub copying code.
432 * libcoff-in.h: (struct coff_tdata): New field stub_size.
433 Rename field go32stub to stub.
434 * libcoff.h: Regenerate.
435 * coff-stgo32.c (go32_check_format): Rename to...
436 (go32exe_check_format): ...this.
437 (go32_stubbed_coff_bfd_copy_private_bfd_data): Rename to...
438 (go32exe_copy_private_bfd_data): ...this.
439 (stub_bytes): Rename to...
440 (go32exe_default_stub): ...this.
441 (create_go32_stub): Rename to...
442 (go32exe_create_stub): ...this.
443 * coff-stgo32.c (go32exe_copy_private_bfd_data): Avoid realloc
444 when possible.
445
446 2020-04-01 H.J. Lu <hongjiu.lu@intel.com>
447
448 PR ld/25749
449 PR ld/25754
450 * elf32-i386.c (elf_i386_convert_load_reloc): Convert load
451 relocation to R_386_32 for relocation against non-preemptible
452 absolute symbol.
453 (elf_i386_check_relocs): Call _bfd_elf_x86_valid_reloc_p. Don't
454 allocate dynamic relocation for non-preemptible absolute symbol.
455 (elf_i386_relocate_section): Pass sec to
456 GENERATE_DYNAMIC_RELOCATION_P.
457 * elf64-x86-64.c (R_X86_64_converted_reloc_bit): Moved.
458 (elf_x86_64_convert_load_reloc): Covert load relocation to
459 R_X86_64_32S or R_X86_64_32 for relocation against non-preemptible
460 absolute symbol. Don't convert to R_X86_64_32S nor R_X86_64_32
461 for non-preemptible absolute symbol if they overflow.
462 (elf_x86_64_check_relocs): Call _bfd_elf_x86_valid_reloc_p. Set
463 tls_type for GOT slot to GOT_ABS for non-preemptible absolute
464 symbol. Don't allocate dynamic relocation for non-preemptible
465 absolute symbol.
466 (elf_x86_64_relocate_section): Don't generate relative relocation
467 for GOTPCREL relocations aganst local absolute symbol. Pass sec
468 to GENERATE_DYNAMIC_RELOCATION_P.
469 * elfxx-x86.c (elf_x86_allocate_dynrelocs): No dynamic relocation
470 against non-preemptible absolute symbol.
471 (_bfd_elf_x86_valid_reloc_p): New function.
472 (_bfd_x86_elf_size_dynamic_sections): No dynamic relocation for
473 GOT_ABS GOT slot.
474 * elfxx-x86.h (GENERATE_DYNAMIC_RELOCATION_P): Add an SEC
475 argument. Don't generate dynamic relocation against
476 non-preemptible absolute symbol.
477 (ABS_SYMBOL_P): New.
478 (GENERATE_RELATIVE_RELOC_P): Don't generate relative relocation
479 against non-preemptible absolute symbol.
480 (GOT_ABS): New.
481 (R_X86_64_converted_reloc_bit): New. Moved from elf64-x86-64.c.
482 (_bfd_elf_x86_valid_reloc_p): New.
483
484 2020-04-01 Tamar Christina <tamar.christina@arm.com>
485
486 PR ld/16017
487 * elf32-arm.c (elf32_arm_populate_plt_entry): Set LSB of the PLT0
488 address in the GOT if in thumb only mode.
489
490 2020-04-01 Tamar Christina <tamar.christina@arm.com>
491
492 * elf32-arm.c (elf32_thumb2_plt_entry): Fix PC-rel offset.
493
494 2020-04-01 Hans-Peter Nilsson <hp@bitrange.com>
495
496 * mmo.c (mmo_scan): Create .text section only when needed, not
497 from the start.
498
499 2020-03-31 Alan Modra <amodra@gmail.com>
500
501 * coff-alpha.c (alpha_ecoff_get_elt_at_filepos): Correct bfd_bread
502 return value check.
503
504 2020-03-31 Alan Modra <amodra@gmail.com>
505
506 * vms-alpha.c (image_write): Check bounds for sections without
507 contents too. Error on non-zero write to section without
508 contents.
509 (_bfd_vms_slurp_etir): Check return of image_write* functions.
510
511 2020-03-31 Alan Modra <amodra@gmail.com>
512
513 * tekhex.c (pass_over): Check is_eof before reading buffer.
514
515 2020-03-30 Nick Clifton <nickc@redhat.com>
516
517 PR binutils/pr25662
518 * libcoff-in.h (struct pe_tdata): Rename the insert_timestamp
519 field to timestamp and make it an integer.
520 * libcoff.h: Regenerate.
521 * peXXigen.c (_bfd_XXi_only_swap_filehdr_out): Test the timestamp
522 field in the pe_data structure rather than the insert_timestamp
523 field.
524
525 2020-03-30 Alan Modra <amodra@gmail.com>
526
527 PR 25745
528 * elf64-ppc.c (ppc64_elf_build_stubs): Use asprintf to form
529 statistics message.
530
531 2020-03-26 Nick Clifton <nickc@redhat.com>
532
533 * cofflink.c (bfd_coff_get_internal_extra_pe_aouthdr): Delete.
534 * libbfd-in.h (bfd_coff_get_internal_extra_pe_aouthdr): Remove
535 prototype.
536 * libbfd.h: Regenerate.
537
538 2020-03-26 Alan Modra <amodra@gmail.com>
539
540 * i386msdos.c (msdos_object_p): Catch -1 return from bfd_bread.
541
542 2020-03-26 Alan Modra <amodra@gmail.com>
543
544 * vms-alpha.c (dst_define_location): Limit size of dst_ptr_offsets
545 array.
546 (_bfd_vms_slurp_object_records): Rename "err" to "ok".
547
548 2020-03-25 Nick Clifton <nickc@redhat.com>
549
550 * cofflink.c (bfd_coff_get_internal_extra_pe_aouthdr): New
551 function.
552 * libbfd-in.h (bfd_coff_get_internal_extra_pe_aouthdr): Prototype.
553 * libbfd.h: Regenerate.
554
555 2020-03-25 Shahab Vahedi <shahab@synopsys.com>
556
557 * elf32-arc.c (PRINT_DEBUG_RELOC_INFO_BEFORE): Use the
558 correct field name in the output string.
559
560 2020-03-25 Alan Modra <amodra@gmail.com>
561
562 PR 25662
563 * elf.c (assign_file_positions_for_load_sections): Adjust offset
564 for SHT_NOBITS section if first in segment.
565
566 2020-03-24 H.J. Lu <hongjiu.lu@intel.com>
567
568 PR binutils/25708
569 * elf-bfd.h (_bfd_elf_get_symbol_version_name): Renamed to ...
570 (_bfd_elf_get_symbol_version_string): This.
571 * elf.c (_bfd_elf_get_symbol_version_name): Renamed to ...
572 (_bfd_elf_get_symbol_version_string): This.
573 (bfd_elf_print_symbol): Pass TRUE to
574 _bfd_elf_get_symbol_version_string.
575 * libbfd-in.h (_bfd_nosymbols_get_symbol_version_string): Add a
576 bfd_boolean argument.
577 * syms.c (_bfd_nosymbols_get_symbol_version_string): Likewise.
578 * targets.c (_bfd_get_symbol_version_string): Likewise.
579 (bfd_get_symbol_version_string): Likewise.
580 * bfd-in2.h: Regenerated.
581
582 2020-03-24 Nick Clifton <nickc@redhat.com>
583 Jaydeep Chauhan <jaydeepchauhan1494@gmail.com>
584
585 PR 25713
586 * bfdio.c (_bfd_real_fopen): Add code to handle long filenames on
587 Win32 systems.
588
589 2020-03-24 Nick Clifton <nickc@redhat.com>
590
591 PR 25681
592 * elf.c (_bfd_elf_map_sections_to_segments): When looking for a
593 segment to use for PT_GNU_RELRO, ignore empty sections in a
594 segment's current list.
595
596 2020-03-24 H.J. Lu <hongjiu.lu@intel.com>
597
598 PR binutils/25717
599 * elf-bfd.h (elf_obj_tdata): Change num_group to unsigned int.
600
601 2020-03-24 H.J. Lu <hongjiu.lu@intel.com>
602
603 PR binutils/25708
604 * elf-bfd.h (_bfd_elf_get_symbol_version_name): New.
605 * elf.c (_bfd_elf_get_symbol_version_name): New function. Based
606 on the previous _bfd_elf_get_symbol_version_string.
607 (_bfd_elf_get_symbol_version_string): Use it.
608
609 2020-03-24 Alan Modra <amodra@gmail.com>
610
611 * archive.c (_bfd_generic_read_ar_hdr_mag): Sanity check extended
612 name size. Use bfd_malloc rather than bfd_zmalloc, clearing just
613 struct areltdata.
614
615 2020-03-23 Sebastian Huber <sebastian.huber@embedded-brains.de>
616
617 * elflink.c (_bfd_elf_tls_setup): Mention .tdata in comment.
618
619 2020-03-23 Alan Modra <amodra@gmail.com>
620
621 * ecoff.c (_bfd_ecoff_slurp_armap): Sanity check parsed_size and
622 symbol count. Allocate an extra byte to ensure name strings
623 are terminated. Sanity check name offsets. Release memory on
624 error return.
625
626 2020-03-23 Alan Modra <amodra@gmail.com>
627
628 * i386msdos.c (msdos_object_p): Don't access e_lfanew when that
629 field hasn't been read. Remove unnecessary casts.
630
631 2020-03-22 Alan Modra <amodra@gmail.com>
632
633 * coff64-rs6000.c (xcoff64_slurp_armap): Ensure size is large
634 enough to read number of symbols.
635
636 2020-03-20 H.J. Lu <hongjiu.lu@intel.com>
637
638 * configure.ac (HAVE_EXECUTABLE_SUFFIX): Removed.
639 (EXECUTABLE_SUFFIX): Likewise.
640 * config.in: Regenerated.
641 * configure: Likewise.
642 * plugin.c (bfd_plugin_close_and_cleanup): Defined as
643 _bfd_generic_close_and_cleanup.
644 (plugin_list_entry): Remove resolution_file, resolution_option,
645 real_bfd, real_nsyms, real_syms, lto_nsyms, lto_syms, gcc,
646 lto_wrapper, gcc_env and initialized,
647 (need_lto_wrapper_p): Removed.
648 (get_lto_wrapper): Likewise.
649 (setup_lto_wrapper_env): Likewise.
650 (register_all_symbols_read): Likewise.
651 (egister_cleanup): Likewise.
652 (get_symbols): Likewise.
653 (add_input_file): Likewise.
654 (bfd_plugin_set_program_name): Remove need_lto_wrapper.
655 (add_symbols): Updated.
656 (try_claim): Likewise.
657 (try_load_plugin): Likewise.
658 (bfd_plugin_canonicalize_symtab): Likewise.
659 * plugin.h (bfd_plugin_set_program_name): Remove int argument.
660 (plugin_data_struct): Remove real_bfd, real_nsyms and real_syms.
661
662 2020-03-19 H.J. Lu <hongjiu.lu@intel.com>
663
664 PR binutils/25640
665 * plugin.c (plugin_list_entry): Add has_symbol_type.
666 (add_symbols_v2): New function.
667 (bfd_plugin_open_input): Don't invoke LTO wrapper if LTO plugin
668 provides symbol type.
669 (try_load_plugin): Add LDPT_ADD_SYMBOLS_V2.
670 (bfd_plugin_canonicalize_symtab): Use LTO plugin symbol type if
671 available.
672
673 2020-03-20 Alan Modra <amodra@gmail.com>
674
675 * coff-rs6000.c (_bfd_xcoff_slurp_armap): Ensure size is large
676 enough to read number of symbols.
677
678 2020-03-20 Alan Modra <amodra@gmail.com>
679
680 * elf.c (_bfd_elf_setup_sections): Don't test known non-NULL
681 backend functions for NULL before calling.
682 (copy_special_section_fields, _bfd_elf_copy_private_bfd_data),
683 (bfd_section_from_shdr, assign_section_numbers): Likewise.
684 * elfcode.h (elf_write_relocs, elf_slurp_reloc_table): Likewise.
685 * elfnn-ia64.c (ignore_errors): New function.
686 (elf_backend_link_order_error_handler): Redefine as ignore_errors.
687
688 2020-03-19 Nick Clifton <nickc@redhat.com>
689
690 PR 25676
691 * dwarf2.c (struct varinfo): Add unit_offset field to record the
692 location of the varinfo in the unit's debug info data. Change the
693 type of the stack field to a boolean.
694 (lookup_var_by_offset): New function. Returns the varinfo
695 structure for the variable described at the given offset in the
696 unit's debug info.
697 (scan_unit_for_symbols): Add support for variables which have the
698 DW_AT_specification attribute.
699
700 2020-03-19 Nick Clifton <nickc@redhat.com>
701
702 PR 25699
703 * elf.c (bfd_elf_set_group_contents): Replace assertion with an
704 error return.
705
706 2020-03-19 Sebastian Huber <sebastian.huber@embedded-brains.de>
707
708 * elfxx-riscv.c (riscv_parse_subset): Don't use C99.
709
710 2020-03-18 Nick Clifton <nickc@redhat.com>
711
712 PR 25673
713 * elf.c (_bfd_elf_write_secondary_reloc_section): Fix illegal
714 memory access when processing a corrupt secondary reloc section.
715
716 2020-03-18 Christophe Lyon <christophe.lyon@linaro.org>
717
718 * elf32-arm.c (arm_build_one_stub): Emit a fatal error message
719 instead of calling abort.
720 * elf32-csky.c (csky_build_one_stub): Likewise.
721 * elf32-hppa.c (hppa_build_one_stub): Likewise.
722 * elf32-m68hc11.c (m68hc11_elf_build_one_stub): Likewise.
723 * elf32-m68hc12.c (m68hc12_elf_build_one_stub): Likewise.
724 * elf32-metag.c (metag_build_one_stub): Likewise.
725 * elf32-nios2.c (nios2_build_one_stub): Likewise.
726 * elf64-ppc.c (ppc_build_one_stub): Likewise.
727 (ppc_size_one_stub): Likewise.
728 * elfnn-aarch64.c (aarch64_build_one_stub): Likewise.
729
730 2020-03-17 Nick Clifton <nickc@redhat.com>
731
732 PR 25688
733 * elf.c (_bfd_elf_copy_special_section_fields): Replace assertions
734 with error messages.
735
736 2020-03-17 Nick Clifton <nickc@redhat.com>
737
738 PR 25687
739 * elf.c (_bfd_elf_slurp_secondary_reloc_section): Remove redundant
740 free. Add free on another failure path.
741
742 2020-03-16 Alan Modra <amodra@gmail.com>
743
744 PR 25675
745 * elf.c (elf_sort_segments): Don't call bfd_octets_per_byte unless
746 we have a non-zero section count. Do lma comparison in octets.
747
748 2020-03-16 Alan Modra <amodra@gmail.com>
749
750 * vms-alpha.c (dst_restore_location): Validate index into
751 dst_ptr_offsets array before accessing. Return status.
752 (dst_retrieve_location): Similarly, making "loc" parameter a
753 pointer to return value.
754 (_bfd_vms_slurp_etir): Update calls to above functions.
755
756 2020-03-14 Kamil Rytarowski <n54@gmx.com>
757
758 * configure.ac: Include netbsd-core.lo for all NetBSD arm and mips
759 targets.
760 * configure: Regenerated.
761
762 2020-03-14 Alan Modra <amodra@gmail.com>
763
764 * section.c (BFD_FAKE_SECTIONS): Formatting.
765 * bfd-in2.h: Regenerate.
766
767 2020-03-13 Kamil Rytarowski <n54@gmx.com>
768
769 * elf.c (elfcore_grok_netbsd_note): Add support for
770 NT_NETBSDCORE_LWPSTATUS notes.
771
772 2020-03-13 Christophe Lyon <christophe.lyon@linaro.org>
773
774 * bfd-in2.h: Regenerate.
775 * section.c (asection): Add already_assigned field.
776 (BFD_FAKE_SECTION): Add default initializer for it.
777 * ecoff.c (bfd_debug_section): Initialize already_assigned field.
778 * elf32-arm.c (arm_build_one_stub): Add support for
779 non_contiguous_regions.
780 * elf32-csky.c (csky_build_one_stub): Likewise.
781 * elf32-hppa.c (hppa_build_one_stub): Likewise.
782 * elf32-m68hc11.c (m68hc11_elf_build_one_stub): Likewise.
783 * elf32-m68hc12.c (m68hc12_elf_build_one_stub): Likewise.
784 * elf32-metag.c (metag_build_one_stub): Likewise.
785 * elf32-nios2.c (nios2_build_one_stub): Likewise.
786 * elf64-ppc.c (ppc_build_one_stub): Likewise.
787 (ppc_size_one_stub): Likewise.
788 * elfnn-aarch64.c (aarch64_build_one_stub): Likewise.
789 * elflink.c (elf_link_input_bfd): Likewise.
790
791 2020-03-13 H.J. Lu <hongjiu.lu@intel.com>
792
793 PR ld/24920
794 * elf-linker-x86.h (elf_linker_x86_params): Add
795 static_before_all_inputs and has_dynamic_linker.
796 * elfxx-x86.c (_bfd_x86_elf_link_setup_gnu_properties): Report
797 dynamic input objects if -static is passed at command-line
798 before all input files without --dynamic-linker unless
799 --no-dynamic-linker is used.
800
801 2020-03-13 Kamil Rytarowski <n54@gmx.com>
802
803 * elf.c (elfcore_grok_netbsd_note): Add support for aarch64.
804
805 2020-03-13 Christian Eggers <ceggers@gmx.de>
806
807 * bfd.c (bfd_record_phdr): New local "opb". Fix assignment of
808 "p_paddr" from "at".
809 * elfcode.h (bfd_from_remote_memory): Add units to several
810 parameters. New local "opb". Fix usage of p_align. Fix
811 calculation of "localbase" from "ehdr_vma" and "p_vaddr". Fix
812 call of target_read_memory.
813 * elflink.c (elf_fixup_link_order): Fix scope of "s" local. Fix
814 calculation of "offset" and "output_offset".
815 (bfd_elf_final_link): New local "opb". Fix calculation of "size"
816 from "offset" and fix calculation of "end" from "vma+size". Fix
817 comparison between "sh_addr" and "vma"/"output_offset".
818 (bfd_elf_discard_info): Fix calculation of "eh_alignment".
819 * elf-bfd.h (struct elf_link_hash_table): Add unit to tls_size
820 member.
821 * elf.c (_bfd_elf_map_sections_to_segments): Add unit (bytes/
822 octets) to "wrap_to2 and "phdr_size" locals. Fix calculation of
823 "wrap_to" value. Add unit (bytes) to phdr_lma variable. Fix
824 assignment of p_paddr from phdr_lma. Fix comparison between
825 "lma+size" and "next->lma".
826 (elf_sort_segments): Fix assignment from p_paddr to lma.
827 (assign_file_positions_for_load_sections): Add unit (bytes) to
828 local "align". Fix calculation of local "off_adjust". Fix
829 calculation of local "filehdr_vaddr".
830 (assign_file_positions_for_non_load_sections): New local "opb".
831 Fix calculation of "end" from "p_size". Fix comparison between
832 "vma+SECTION_SIZE" and "start". Fix calculation of "p_memsz"
833 from "end" and "p_vaddr".
834 (rewrite_elf_program_header): Fix comparison between p_vaddr and
835 vma. Fix assignment to p_paddr from lma. Fix comparison between
836 p_paddr and lma. Fix assignment to p_paddr from lma.
837 * merge.c (sec_merge_emit): New local "opb". Convert
838 "alignment_power" to octets.
839 (_bfd_add_merge_section): New locals "alignment_power" and
840 "opb". Fix comparison between "alignment_power" and
841 "sizeof(align)".
842 (_bfd_merge_sections): New local "opb". Divide size by opb
843 before checking align mask.
844
845 2020-03-13 Christian Eggers <ceggers@gmx.de>
846
847 * elf.c (_bfd_elf_make_section_from_shdr): Introduce new temp
848 opb. Divide Elf_Internal_Shdr::sh_addr by opb when setting
849 section LMA/VMA.
850 (_bfd_elf_make_section_from_phdr): Similarly.
851 (elf_fake_sections): Fix calculation of
852 Elf_Internal_shdr::sh_addr from section VMA.
853 (_bfd_elf_map_sections_to_segments): Fix mixup between octets
854 and bytes.
855 (assign_file_positions_for_load_sections): Fix calculations of
856 Elf_Internal_shdr::p_vaddr and p_paddr from section LMA/VMA. Fix
857 comparison between program header address and section LMA.
858 (assign_file_positions_for_non_load_sections): Likewise.
859 (rewrite_elf_program_header): Likewise. Introduce new temp opb.
860 (IS_CONTAINED_BY_VMA): Add parameter opb.
861 (IS_CONTAINED_BY_LMA,IS_SECTION_IN_INPUT_SEGMENT,
862 INCLUDE_SECTION_IN_SEGMENT): Likewise.
863 (copy_elf_program_header): Update call to ELF_SECTION_IN_SEGMENT.
864 Fix calculations of p_addr_valid and p_vaddr_offset.
865 * elflink.c (elf_link_add_object_symbols): Multiply section VMA
866 with octets per byte when comparing against p_vaddr.
867
868 2020-03-11 Alan Modra <amodra@gmail.com>
869
870 * som.c (setup_sections): Sanity check subspace.name.
871
872 2020-03-11 Alan Modra <amodra@gmail.com>
873
874 * elf64-ppc.c (ppc64_elf_inline_plt): Do increment rel in for loop.
875
876 2020-03-10 Alan Modra <amodra@gmail.com>
877
878 PR 25648
879 * ihex.c (ihex_write_object_contents): Don't assume ordering of
880 addresses here.
881
882 2020-03-09 Alan Modra <amodra@gmail.com>
883
884 * wasm-module.c (wasm_scan): Sanity check file name length
885 before allocating memory. Move common section setup code. Do
886 without bfd_tell to calculate section size.
887
888 2020-03-06 Nick Clifton <nickc@redhat.com>
889
890 * elf.c (_bfd_elf_set_section_contents): Replace call to abort
891 with error messages and failure return values.
892
893 2020-03-05 Max Filippov <jcmvbkbc@gmail.com>
894
895 * elf32-xtensa.c (shrink_dynamic_reloc_sections): Shrink dynamic
896 relocation sections for any removed reference to a dynamic symbol.
897
898 2020-03-05 Nick Clifton <nickc@redhat.com>
899
900 * elf-bfd.h (struct elf_backend_data): Add new fields:
901 init_secondary_reloc_section, slurp_secondary_reloc_section,
902 write_secondary_reloc_section.
903 (_bfd_elf_init_secondary_reloc_section): Prototype.
904 (_bfd_elf_slurp_secondary_reloc_section): Prototype.
905 (_bfd_elf_write_secondary_reloc_section): Prototype.
906 * elf.c ( bfd_section_from_shdr): Invoke the new
907 init_secondary_reloc_section backend function, if defined, when a
908 second reloc section is encountered.
909 (swap_out_syms): Invoke the new symbol_section_index function, if
910 defined, when computing the section index of an OS/PROC specific
911 symbol.
912 (_bfd_elf_init_secondary_reloc_section): New function.
913 (_bfd_elf_slurp_secondary_reloc_section): New function.
914 (_bfd_elf_write_secondary_reloc_section): New function.
915 (_bfd_elf_copy_special_section_fields): New function.
916 * elfcode.h (elf_write_relocs): Invoke the new
917 write_secondary_relocs function, if defined, in order to emit
918 secondary relocs.
919 (elf_slurp_reloc_table): Invoke the new slurp_secondary_relocs
920 function, if defined, in order to read in secondary relocs.
921 * elfxx-target.h (elf_backend_copy_special_section_fields):
922 Provide a non-NULL default definition.
923 (elf_backend_init_secondary_reloc_section): Likewise.
924 (elf_backend_slurp_secondary_reloc_section): Likewise.
925 (elf_backend_write_secondary_reloc_section): Likewise.
926 (struct elf_backend_data elfNN_bed): Add initialisers for the new
927 fields.
928 * configure.ac (score_elf32_[bl]e_vec): Add elf64.lo
929 * configure: Regenerate.
930
931 2020-03-05 Alan Modra <amodra@gmail.com>
932
933 * archive64.c (_bfd_archive_64_bit_slurp_armap): Check parsed_size
934 against file size before allocating memory. Use bfd_alloc rather
935 than bfd_zalloc for carsym/strings memory.
936
937 2020-03-04 Alan Modra <amodra@gmail.com>
938
939 * elf.c (elf_fake_sections): Ensure sh_addralign is such that
940 sh_addr mod sh_addalign is zero.
941
942 2020-03-04 Alan Modra <amodra@gmail.com>
943
944 * format.c (bfd_check_format_matches): Call cleanup on error exit.
945
946 2020-03-03 Alan Modra <amodra@gmail.com>
947
948 * format.c (struct bfd_preserve): Add cleanup field.
949 (bfd_preserve_save): Add cleanup param and save.
950 (bfd_preserve_restore): Return cleanup.
951 (bfd_preserve_finish): Call the cleanup for the discarded match.
952 (bfd_check_format_matches): Pass cleanup to bfd_preserve_save,
953 and clear when preserving a match. Restore cleanup too when
954 restoring that match.
955
956 2020-03-02 Alan Modra <amodra@gmail.com>
957
958 * cisco-core.c (cisco_core_file_p): Return bfd_cleanup.
959 * hpux-core.c (hpux_core_core_file_p): Update prototype.
960 * sco5-core.c (sco5_core_file_p): Return bfd_cleanup.
961 (core_sco5_vec): Correct initialisers.
962
963 2020-03-02 Alan Modra <amodra@gmail.com>
964
965 * aix386-core.c (aix386_core_file_p): Return bfd_cleanup.
966 * aix5ppc-core.c (xcoff64_core_p): Likewise.
967 * cisco-core.c (cisco_core_file_validate): Likewise.
968 * hppabsd-core.c (hppabsd_core_core_file_p): Likewise.
969 * hpux-core.c (hpux_core_core_file_p): Likewise.
970 * irix-core.c (irix_core_core_file_p): Likewise.
971 * lynx-core.c (lynx_core_file_p): Likewise.
972 * netbsd-core.c (netbsd_core_file_p): Likewise.
973 * osf-core.c (osf_core_core_file_p): Likewise.
974 * ptrace-core.c (ptrace_unix_core_file_p): Likewise.
975 * sco5-core.c (sco5_core_file_p): Likewise.
976
977 2020-03-02 H.J. Lu <hongjiu.lu@intel.com>
978
979 * trad-core.c (trad_unix_core_file_p): Return bfd_cleanup.
980
981 2020-03-02 Alan Modra <amodra@gmail.com>
982
983 * targets.c (bfd_cleanup): New typedef.
984 (struct bfd <_bfd_check_format>): Return a bfd_cleanup.
985 * libbfd-in.h (_bfd_no_cleanup): Define.
986 * format.c (bfd_reinit): Add cleanup parameter, call it.
987 (bfd_check_format_matches): Set cleanup from _bfd_check_format
988 call and pass to bfd_reinit. Delete temp, use abfd->xvec instead.
989 * aout-target.h (callback, object_p): Return bfd_cleanup.
990 * aout-tic30.c (tic30_aout_callback, tic30_aout_object_p): Likewise.
991 * archive.c (bfd_generic_archive_p): Likewise.
992 * binary.c (binary_object_p): Likewise.
993 * coff-alpha.c (alpha_ecoff_object_p): Likewise.
994 * coff-ia64.c (ia64coff_object_p): Likewise.
995 * coff-rs6000.c (_bfd_xcoff_archive_p, rs6000coff_core_p): Likewise.
996 * coff-sh.c (coff_small_object_p): Likewise.
997 * coff-stgo32.c (go32_check_format): Likewise.
998 * coff64-rs6000.c (xcoff64_archive_p, rs6000coff_core_p),
999 (xcoff64_core_p): Likewise.
1000 * coffgen.c (coff_real_object_p, coff_object_p): Likewise.
1001 * elf-bfd.h (bfd_elf32_object_p, bfd_elf32_core_file_p),
1002 (bfd_elf64_object_p, bfd_elf64_core_file_p): Likewise.
1003 * elfcode.h (elf_object_p): Likewise.
1004 * elfcore.h (elf_core_file_p): Likewise.
1005 * i386msdos.c (msdos_object_p): Likewise.
1006 * ihex.c (ihex_object_p): Likewise.
1007 * libaout.h (some_aout_object_p): Likewise.
1008 * libbfd-in.h (bfd_generic_archive_p, _bfd_dummy_target),
1009 (_bfd_vms_lib_alpha_archive_p, _bfd_vms_lib_ia64_archive_p): Likewise.
1010 * libbfd.c (_bfd_dummy_target): Likewise.
1011 * libcoff-in.h (coff_object_p): Likewise.
1012 * mach-o-aarch64.c (bfd_mach_o_arm64_object_p),
1013 (bfd_mach_o_arm64_core_p): Likewise.
1014 * mach-o-arm.c (bfd_mach_o_arm_object_p),
1015 (bfd_mach_o_arm_core_p): Likewise.
1016 * mach-o-i386.c (bfd_mach_o_i386_object_p),
1017 (bfd_mach_o_i386_core_p): Likewise.
1018 * mach-o-x86-64.c (bfd_mach_o_x86_64_object_p),
1019 (bfd_mach_o_x86_64_core_p): Likewise.
1020 * mach-o.c (bfd_mach_o_header_p, bfd_mach_o_gen_object_p),
1021 (bfd_mach_o_gen_core_p, bfd_mach_o_fat_archive_p): Likewise.
1022 * mach-o.h (bfd_mach_o_object_p, bfd_mach_o_core_p),
1023 (bfd_mach_o_fat_archive_p, bfd_mach_o_header_p): Likewise.
1024 * mmo.c (mmo_object_p): Likewise.
1025 * pef.c (bfd_pef_object_p, bfd_pef_xlib_object_p): Likewise.
1026 * peicode.h (coff_real_object_p, pe_ILF_object_p),
1027 (pe_bfd_object_p): Likewise.
1028 * plugin.c (ld_plugin_object_p, bfd_plugin_object_p): Likewise.
1029 * ppcboot.c (ppcboot_object_p): Likewise.
1030 * rs6000-core.c (rs6000coff_core_p): Likewise.
1031 * som.c (som_object_setup, som_object_p): Likewise.
1032 * srec.c (srec_object_p, symbolsrec_object_p): Likewise.
1033 * tekhex.c (tekhex_object_p): Likewise.
1034 * vms-alpha.c (alpha_vms_object_p): Likewise.
1035 * vms-lib.c (_bfd_vms_lib_archive_p, _bfd_vms_lib_alpha_archive_p),
1036 (_bfd_vms_lib_ia64_archive_p, _bfd_vms_lib_txt_archive_p): Likewise.
1037 * wasm-module.c (wasm_object_p): Likewise.
1038 * xsym.c (bfd_sym_object_p): Likewise.
1039 * xsym.h (bfd_sym_object_p): Likewise.
1040 * aoutx.h (some_aout_object_p): Likewise, and callback parameter
1041 return type.
1042 * pdp11.c (some_aout_object_p): Likewise.
1043 * plugin.c (register_ld_plugin_object_p): Update object_p
1044 parameter type.
1045 * plugin.h (register_ld_plugin_object_p): Likewise.
1046 * bfd-in2.h: Regenerate.
1047 * libbfd.h: Regenerate.
1048 * libcoff.h: Regenerate.
1049
1050 2020-03-02 Alan Modra <amodra@gmail.com>
1051
1052 * coff-alpha.c (alpha_ecoff_le_vec): Add SEC_SMALL_DATA to
1053 applicable section flags.
1054 * coff-mips.c (mips_ecoff_le_vec, mips_ecoff_be_vec): Likewise.
1055 (mips_ecoff_bele_vec): Likewise.
1056 * coffcode.h (sec_to_styp_flags): Set SEC_SMALL_DATA for .sdata
1057 and .sbss sections.
1058 * ecoff.c (_bfd_ecoff_new_section_hook): Likewise.
1059 (_bfd_ecoff_styp_to_sec_flags): Likewise.
1060
1061 2020-03-02 Alan Modra <amodra@gmail.com>
1062
1063 * elf32-m32r.c (m32r_elf_section_flags): New function.
1064 (elf_backend_section_flags): Define.
1065 * elf32-nds32.c (nds32_elf_section_flags): New function.
1066 (elf_backend_section_flags): Define.
1067 * elf32-ppc.c (ppc_elf_section_from_shdr): Set SEC_SMALL_DATA for
1068 .sbss and .sdata sections.
1069 * elf32-v850.c (v850_elf_section_from_shdr): Set SEC_SMALL_DATA
1070 for SHF_V850_GPREL sections.
1071 * elf64-alpha.c (elf64_alpha_section_from_shdr): Delete outdated
1072 FIXME.
1073 * elf64-hppa.c (elf64_hppa_section_from_shdr): Set SEC_SMALL_DATA
1074 for SHF_PARISC_SHORT sections.
1075 * elf64-ppc.c (ppc64_elf_section_flags): New function.
1076 (elf_backend_section_flags): Define.
1077 * elfxx-mips.c (_bfd_mips_elf_section_from_shdr): Set SEC_SMALL_DATA
1078 for SHF_MIPS_GPREL sections. Delete FIXME.
1079
1080 2020-03-02 Alan Modra <amodra@gmail.com>
1081
1082 * elf-bfd.h (elf_backend_section_flags): Remove flagword* param.
1083 * elf.c (_bfd_elf_make_section_from_shdr): Set section flags before
1084 calling elf_backend_section_flags with adjusted params. Use
1085 newsect->flags past that point.
1086 (_bfd_elf_new_section_hook): Always set sh_type and sh_flags for
1087 special sections.
1088 (_bfd_elf_init_private_section_data): Allow normal sh_type sections
1089 to have their type overridden, and all sh_flags but processor and
1090 os specific.
1091 * elf32-arm.c (elf32_arm_section_flags): Adjust for changed params.
1092 * elf32-mep.c (mep_elf_section_flags): Likewise.
1093 * elf32-nios2.c (nios2_elf32_section_flags): Likewise.
1094 * elf64-alpha.c (elf64_alpha_section_flags): Likewise.
1095 * elf64-ia64-vms.c (elf64_ia64_section_flags): Likewise.
1096 * elfnn-ia64.c (elfNN_ia64_section_flags): Likewise.
1097 * elfnn-aarch64.c (elfNN_aarch64_size_stubs): Exclude the linker
1098 stub BFD and non-aarch64 input files when scanning for stubs.
1099
1100 2020-03-02 Alan Modra <amodra@gmail.com>
1101
1102 * coff-alpha.c (alpha_ecoff_get_elt_at_filepos): Provide an upper
1103 limit to decompressed element size.
1104
1105 2020-03-02 Alan Modra <amodra@gmail.com>
1106
1107 * vms-lib.c (vms_traverse_index): Add recur_count param and
1108 update calls. Fail on excessive recursion.
1109
1110 2020-03-02 Alan Modra <amodra@gmail.com>
1111
1112 * vms-alpha.c (vms_get_remaining_object_record): Use
1113 bfd_realloc_or_free rather than bfd_realloc.
1114 (add_symbol_entry, vector_grow1, alpha_vms_slurp_relocs): Likewise.
1115 (dst_define_location, parse_module): Likewise, and check realloc
1116 return status before using memory. Return status from function
1117 adjusting all callers.
1118
1119 2020-02-28 Alan Modra <amodra@gmail.com>
1120
1121 * vms-lib.c (_bfd_vms_lib_archive_p): Free memory on error paths.
1122
1123 2020-02-28 Alan Modra <amodra@gmail.com>
1124
1125 * vms-alpha.c (alpha_vms_object_p): Use _bfd_malloc_and_read.
1126 Remove duplicate undersize check.
1127
1128 2020-02-27 Alan Modra <amodra@gmail.com>
1129
1130 PR 24511
1131 * mmo.c (mmo_scan): Set SEC_DATA for .data.
1132
1133 2020-02-27 Alan Modra <amodra@gmail.com>
1134
1135 PR 24511
1136 * syms.c (stt): Trim off all but 'e', 'i' and 'p' entries.
1137 (coff_section_type): Adjust comment.
1138 (decode_section_type): Likewise. Call coff_section_type before
1139 decode_section_type.
1140 (bfd_decode_symclass): Use 'c' for common sections other than
1141 the standard one.
1142
1143 2020-02-27 Alan Modra <amodra@gmail.com>
1144
1145 * coff-rs6000.c (_bfd_xcoff_read_ar_hdr): Put all data in one
1146 malloc'd block.
1147
1148 2020-02-27 Alan Modra <amodra@gmail.com>
1149
1150 * bfd.c (bfd_stat_arch_elt): Use vector of containing archive,
1151 if file is an archive element.
1152 * bfd-in2.h: Regenerate.
1153
1154 2020-02-26 Alan Modra <amodra@gmail.com>
1155
1156 * archive.c (do_slurp_bsd_armap): Increase minimum parsed_size, and
1157 bfd_set_error on failing test. Don't bother changing bfd_error on
1158 file read error. Check symdef_count is multiple of BSD_SYMDEF_SIZE.
1159 Check sym name is within string buffer. Use size_t for some vars.
1160 (do_slurp_coff_armap): Use size_t for some variables, fix size of
1161 int_buf. Don't change bfd_error on file read error. Use
1162 _bfd_mul_overflow when calculating carsym buffer size. Reorder
1163 calculations to catch overflows before they occur. malloc and
1164 free raw armap rather than using bfd_alloc. Read raw armap before
1165 allocating carsym+strings buffer.
1166 (_bfd_slurp_extended_name_table): Localize variables. Check
1167 name size against file size.
1168
1169 2020-02-26 Alan Modra <amodra@gmail.com>
1170
1171 * vms-lib.c (vms_lib_read_index): Release correct buffer.
1172
1173 2020-02-26 Alan Modra <amodra@gmail.com>
1174
1175 * elf32-rx.c (rx_elf_relocate_section): Use bfd_malloc rather than
1176 malloc. Check for NULL return from bfd_malloc.
1177 (rx_table_find, rx_table_map): Likewise.
1178 (rx_set_section_contents): Check bfd_alloc return.
1179 (rx_dump_symtab): Don't alloc internal_syms or external_syms.
1180
1181 2020-02-26 Alan Modra <amodra@gmail.com>
1182
1183 * aoutx.h: Indent labels correctly. Format error strings.
1184 * archive.c: Likewise.
1185 * archive64.c: Likewise.
1186 * coff-arm.c: Likewise.
1187 * coff-rs6000.c: Likewise.
1188 * coff-stgo32.c: Likewise.
1189 * cpu-arm.c: Likewise.
1190 * dwarf2.c: Likewise.
1191 * elf-ifunc.c: Likewise.
1192 * elf-properties.c: Likewise.
1193 * elf-s390-common.c: Likewise.
1194 * elf-strtab.c: Likewise.
1195 * elf.c: Likewise.
1196 * elf32-arm.c: Likewise.
1197 * elf32-bfin.c: Likewise.
1198 * elf32-cr16.c: Likewise.
1199 * elf32-csky.c: Likewise.
1200 * elf32-i386.c: Likewise.
1201 * elf32-m68k.c: Likewise.
1202 * elf32-msp430.c: Likewise.
1203 * elf32-nds32.c: Likewise.
1204 * elf32-nios2.c: Likewise.
1205 * elf32-pru.c: Likewise.
1206 * elf32-xtensa.c: Likewise.
1207 * elf64-ia64-vms.c: Likewise.
1208 * elf64-x86-64.c: Likewise.
1209 * elfcode.h: Likewise.
1210 * elfcore.h: Likewise.
1211 * elflink.c: Likewise.
1212 * elfnn-aarch64.c: Likewise.
1213 * elfnn-ia64.c: Likewise.
1214 * elfnn-riscv.c: Likewise.
1215 * elfxx-mips.c: Likewise.
1216 * elfxx-sparc.c: Likewise.
1217 * elfxx-x86.c: Likewise.
1218 * i386lynx.c: Likewise.
1219 * merge.c: Likewise.
1220 * pdp11.c: Likewise.
1221 * plugin.c: Likewise.
1222 * reloc.c: Likewise.
1223
1224 2020-02-26 Alan Modra <amodra@gmail.com>
1225
1226 PR 25593
1227 * elf-bfd.h (struct elf_link_hash_table): Rename "loaded" to
1228 "dyn_loaded".
1229 (bfd_elf_add_dt_needed_tag): Declare.
1230 * elf-strtab.c (_bfd_elf_strtab_restore): Handle NULL buf.
1231 * elflink.c (bfd_elf_add_dt_needed_tag): Make global and rename
1232 from elf_add_dt_needed_tag. Remove soname and doit param.
1233 (elf_link_add_object_symbols): Don't use elf_add_dt_needed_tag
1234 to see whether as-needed lib is already loaded, use dyn_loaded
1235 list instead. When saving and restoring around as-needed lib
1236 handle possibility that dynstr has not been initialised. Don't
1237 add DT_NEEDED tags here. Limit dyn_loaded list to dynamic libs.
1238 Mark libs loaded via DT_NEEDED entries of other libs with
1239 DYN_NO_NEEDED if they should not be mentioned in DT_NEEDED of
1240 the output.
1241 (elf_link_check_versioned_symbol): Remove now unneccesary
1242 DYNAMIC check when traversing dyn_loaded list.
1243
1244 2020-02-26 Alan Modra <amodra@gmail.com>
1245
1246 * bfdio.c (bfd_get_file_size): Ignore bogus archive element sizes.
1247
1248 2020-02-25 H.J. Lu <hongjiu.lu@intel.com>
1249
1250 PR binutils/25584
1251 * plugin.c (need_lto_wrapper_p): New.
1252 (bfd_plugin_set_program_name): Add an int argument to set
1253 need_lto_wrapper_p.
1254 (get_lto_wrapper): Return FALSE if need_lto_wrapper_p isn't
1255 set.
1256 * plugin.h (bfd_plugin_set_program_name): Add an int argument.
1257
1258 2020-02-24 Alan Modra <amodra@gmail.com>
1259
1260 * vms-lib.c (_bfd_vms_lib_archive_p): Correct overflow checks.
1261
1262 2020-02-24 Alan Modra <amodra@gmail.com>
1263
1264 * vms-lib.c (struct carsym_mem): Add limit.
1265 (vms_add_index): Heed limit.
1266 (vms_traverse_index): Catch buffer overflows. Remove outdated fixme.
1267 (vms_lib_read_index): Set up limit. Catch 32-bit overflow.
1268 Always return actual number read.
1269 (_bfd_vms_lib_archive_p): Catch buffer overflows. Replace
1270 assertion with error exit.
1271
1272 2020-02-22 Alan Modra <amodra@gmail.com>
1273
1274 PR 25585
1275 * elf.c (assign_file_positions_for_load_sections): Continue linking
1276 on "PHDR segment not covered by LOAD segment" errors.
1277
1278 2020-02-21 Alan Modra <amodra@gmail.com>
1279
1280 * mach-o.c (bfd_mach_o_canonicalize_relocs): Fix ineffective
1281 overflow check.
1282 (bfd_mach_o_canonicalize_reloc): Likewise.
1283 (bfd_mach_o_canonicalize_dynamic_reloc): Likewise. Sanity check
1284 counts and offsets against file size.
1285 (bfd_mach_o_build_dysymtab): Fix ineffective overflow check.
1286 (bfd_mach_o_mangle_sections): Remove unnecessary overflow check.
1287 (bfd_mach_o_read_symtab_symbols): Sanity check count and offset
1288 against file size. Delete symbol table error message.
1289 (bfd_mach_o_read_dysymtab): Sanity check counts and offsets
1290 against file size.
1291 (bfd_mach_o_read_symtab): Likewise.
1292 (bfd_mach_o_read_command): Pass file size.
1293 (bfd_mach_o_scan): Sanity check command count against file size.
1294
1295 2020-02-21 Alan Modra <amodra@gmail.com>
1296
1297 PR 25569
1298 * aoutx.h (adjust_o_magic, adjust_z_magic, adjust_n_magic): Use
1299 "text", "data" and "bss" section pointer vars. Don't update
1300 section size, just exec header sizes.
1301 (adjust_sizes_and_vmas): Don't update text section size. Set
1302 initial exec header a_text. Print exec headers sizes.
1303 * pdp11.c (adjust_o_magic, adjust_z_magic, adjust_n_magic),
1304 (adjust_sizes_and_vmas): Similarly. Formatting.
1305 (final_link): Correct final file extension.
1306
1307 2020-02-20 Nick Clifton <nickc@redhat.com>
1308
1309 * elf-bfd.h (struct elf_backend_data): Add symbol_section_index
1310 callback.
1311 * elfxx-target.h (elf_backend_symbol_section_index): Provide
1312 default definition.
1313 (elfNN_bed): Initialise the symbol_section_index field.
1314 * elf.c (swap_out_syms): Call symbol_section_index, if defined, on
1315 OS and PROC specific section indicies. Warn if converting other
1316 reserved incidies to SHN_ABS.
1317
1318 2020-02-19 Sergey Belyashov <sergey.belyashov@gmail.com>
1319
1320 PR 25537
1321 * cpu-z80.c: Add machine type compatibility checking.
1322
1323 2020-02-19 H.J. Lu <hongjiu.lu@intel.com>
1324
1325 PR binutils/25355
1326 * plugin.c (plugin_list_entry): Remove handle.
1327 (try_load_plugin): Call dlclose before return.
1328
1329 2020-02-19 Alan Modra <amodra@gmail.com>
1330
1331 * libbfd-in.h (_bfd_constant_p): Define.
1332 (_bfd_alloc_and_read, _bfd_malloc_and_read): Check read size against
1333 file size before allocating memory.
1334 * coffgen.c (_bfd_coff_get_external_symbols): Remove file size check.
1335 * elf.c (bfd_elf_get_str_section): Likewise.
1336 (_bfd_elf_slurp_version_tables): Likewise.
1337 * libbfd.h: Regenerate.
1338
1339 2020-02-19 Alan Modra <amodra@gmail.com>
1340
1341 * libbfd-in.h (_bfd_alloc_and_read, _bfd_malloc_and_read): New.
1342 * aoutx.h (aout_get_external_symbols): Replace calls to
1343 bfd_[m]alloc and bfd_bread with call to _bfd_[m]alloc_and_read.
1344 (slurp_reloc_table): Likewise.
1345 * archive.c (do_slurp_bsd_armap): Likewise.
1346 (do_slurp_coff_armap): Likewise.
1347 * archive64.c (_bfd_archive_64_bit_slurp_armap): Likewise.
1348 * coff-rs6000.c (_bfd_xcoff_slurp_armap): Likewise.
1349 * coff64-rs6000.c (xcoff64_slurp_armap): Likewise.
1350 * coffcode.h (coff_set_arch_mach_hook, buy_and_read): Likewise.
1351 * coffgen.c (coff_real_object_p, coff_object_p, build_debug_section),
1352 (_bfd_coff_get_external_symbols): Likewise.
1353 * ecoff.c (ecoff_slurp_symbolic_header),
1354 (_bfd_ecoff_slurp_symbolic_info, ecoff_slurp_reloc_table),
1355 (_bfd_ecoff_slurp_armap, ecoff_link_add_object_symbols, READ),
1356 (ecoff_indirect_link_order): Likewise.
1357 * elf.c (bfd_elf_get_str_section, setup_group, elf_read_notes),
1358 (_bfd_elf_slurp_version_tables): Likewise.
1359 * elf32-m32c.c (m32c_elf_relax_section): Likewise.
1360 * elf32-rl78.c (rl78_elf_relax_section): Likewise.
1361 * elf32-rx.c (elf32_rx_relax_section): Likewise.
1362 * elf64-alpha.c (READ): Likewise.
1363 * elf64-mips.c (mips_elf64_slurp_one_reloc_table): Likewise.
1364 * elf64-sparc.c (elf64_sparc_slurp_one_reloc_table): Likewise.
1365 * elfcode.h (elf_slurp_symbol_table),
1366 (elf_slurp_reloc_table_from_section): Likewise.
1367 * elflink.c (elf_link_add_object_symbols),
1368 (elf_link_check_versioned_symbol): Likewise.
1369 * elfxx-mips.c (READ): Likewise.
1370 * i386lynx.c (slurp_reloc_table): Likewise.
1371 * lynx-core.c (lynx_core_file_p): Likewise.
1372 * mach-o.c (bfd_mach_o_canonicalize_relocs),
1373 (bfd_mach_o_read_symtab_strtab, bfd_mach_o_alloc_and_read),
1374 (bfd_mach_o_read_prebound_dylib, bfd_mach_o_read_dyld_content
1375 * pdp11.c (aout_get_external_symbols, slurp_reloc_table
1376 * pef.c (bfd_pef_print_loader_section, bfd_pef_scan_start_address),
1377 (bfd_pef_parse_symbols): Likewise.
1378 * peicode.h (pe_ILF_object_p, pe_bfd_object_p
1379 * som.c (setup_sections, som_slurp_string_table),
1380 (som_slurp_reloc_table, som_bfd_count_ar_symbols),
1381 (som_bfd_fill_in_ar_symbols): Likewise.
1382 * vms-alpha.c (module_find_nearest_line, evax_bfd_print_dst),
1383 (evax_bfd_print_image): Likewise.
1384 * vms-lib.c (_bfd_vms_lib_archive_p): Likewise.
1385 * wasm-module.c (wasm_scan): Likewise.
1386 * xcofflink.c (xcoff_link_add_symbols): Likewise.
1387 * xsym.c (bfd_sym_read_name_table),
1388 (bfd_sym_print_type_information_table_entry): Likewise.
1389 * libbfd.h: Regenerate.
1390
1391 2020-02-19 Alan Modra <amodra@gmail.com>
1392
1393 * aoutx.h (slurp_reloc_table): Allocate reloc_cache after
1394 reading external relocs.
1395 * ecoff.c (ecoff_slurp_reloc_table): Likewise.
1396 * archive.c (_bfd_write_archive_contents): Don't twiddle bfd_error
1397 after bfd_bread.
1398 * archive64.c (_bfd_archive_64_bit_slurp_armap): Remove unnecessary
1399 bfd_release.
1400 * elf32-m32c.c (m32c_offset_for_reloc): Make shndx_buf a bfd_byte*.
1401 (m32c_elf_relax_section): Likewise.
1402 * elf32-rl78.c (rl78_offset_for_reloc): Likewise.
1403 (rl78_elf_relax_section): Likewise.
1404 * elf32-rx.c (rx_offset_for_reloc): Likewise.
1405 (elf32_rx_relax_section): Likewise.
1406 * mach-o.c (bfd_mach_o_alloc_and_read): Move earlier with better
1407 parameter types and use..
1408 (bfd_mach_o_read_dylinker, bfd_mach_o_read_dylib),
1409 (bfd_mach_o_read_fvmlib, bfd_mach_o_read_str): ..in these functions.
1410 * peicode.h (pe_bfd_object_p): Don't zero the part of opthdr
1411 being read from file, just the extra.
1412 * som.c (som_slurp_symbol_table): Allocate internal symbol buffer
1413 after reading external syms. Free on failure.
1414
1415 2020-02-19 Alan Modra <amodra@gmail.com>
1416
1417 * coffcode.h (buy_and_read, coff_slurp_line_table),
1418 (coff_slurp_symbol_table, coff_slurp_reloc_table): Replace
1419 bfd_[z][m]alloc2 calls with _bfd_mul_overflow followed by the
1420 corresponding bfd_alloc call. Adjust variables to suit.
1421 * coffgen.c (_bfd_coff_get_external_symbols): Likewise.
1422 * ecoff.c (_bfd_ecoff_slurp_symbolic_info),
1423 (_bfd_ecoff_slurp_symbol_table, READ): Likewise.
1424 * elf.c (bfd_elf_get_elf_syms, setup_group, bfd_section_from_shdr),
1425 (swap_out_syms, _bfd_elf_slurp_version_tables): Likewise.
1426 * elf32-m32c.c (m32c_elf_relax_section): Likewise.
1427 * elf32-rl78.c (rl78_elf_relax_section): Likewise.
1428 * elf32-rx.c (elf32_rx_relax_section): Likewise.
1429 * elf64-alpha.c (READ): Likewise.
1430 * elfcode.h (elf_object_p, elf_write_relocs, elf_write_shdrs_and_ehdr),
1431 (elf_slurp_symbol_table, elf_slurp_reloc_table),
1432 (bfd_from_remote_memory): Likewise.
1433 * elfcore.h (core_find_build_id): Likewise.
1434 * elfxx-mips.c (READ): Likewise.
1435 * mach-o.c (bfd_mach_o_mangle_sections),
1436 (bfd_mach_o_read_symtab_symbols, bfd_mach_o_read_thread),
1437 (bfd_mach_o_read_dysymtab, bfd_mach_o_flatten_sections),
1438 (bfd_mach_o_scan, bfd_mach_o_fat_archive_p): Likewise.
1439 * som.c (setup_sections, som_prep_for_fixups)
1440 (som_build_and_write_symbol_table, som_slurp_symbol_table),
1441 (som_slurp_reloc_table, som_bfd_count_ar_symbols),
1442 (som_bfd_fill_in_ar_symbols, som_slurp_armap),
1443 (som_bfd_ar_write_symbol_stuff): Likewise.
1444 * vms-alpha.c (vector_grow1): Likewise.
1445 * vms-lib.c (vms_add_index): Likewise.
1446 * wasm-module.c (wasm_scan_name_function_section): Likewise.
1447 * libbfd.c (bfd_malloc2, bfd_realloc2, bfd_zmalloc2): Delete.
1448 * opncls.c (bfd_alloc2, bfd_zalloc2): Delete.
1449 * libbfd-in.h (bfd_malloc2, bfd_realloc2, bfd_zmalloc2),
1450 (bfd_alloc2, bfd_zalloc2): Delete.
1451 (_bfd_mul_overflow): Define.
1452 * libbfd.h: Regenerate.
1453
1454 2020-02-19 Alan Modra <amodra@gmail.com>
1455
1456 * elf.c (bfd_section_from_shdr): Use bfd_zalloc rather than
1457 bfd_zalloc2.
1458 (assign_section_numbers): Likewise.
1459 (elf_map_symbols): Likewise, and bfd_alloc rather than bfd_alloc2.
1460 (_bfd_elf_map_sections_to_segments): Use bfd_malloc rather than
1461 bfd_malloc2, size_t amt, and unsigned tls_count.
1462 (rewrite_elf_program_header): Use bfd_malloc and size_t amt.
1463 * elflink.c (elf_create_symbuf): Use bfd_malloc.
1464 (elf_output_implib): Use bfd_alloc.
1465
1466 2020-02-19 Alan Modra <amodra@gmail.com>
1467
1468 * bfd.c (struct bfd): Move format and direction to other
1469 bitfields. Add "size".
1470 * bfdio.c (bfd_get_size): Cache size when not writing file.
1471 * opncls.c (bfd_get_debug_link_info_1): Allow for bfd_get_size
1472 returning zero, ie. unknown.
1473 (bfd_get_alt_debug_link_info): Likewise.
1474 * bfd-in2.h: Regenerate.
1475
1476 2020-02-19 Alan Modra <amodra@gmail.com>
1477
1478 * coffgen.c (_bfd_coff_get_external_symbols): Don't call
1479 bfd_get_file_size twice.
1480 (_bfd_coff_read_string_table): Allow for bfd_get_file_size
1481 zero, ie. unknown, return.
1482 * elf-attrs.c (_bfd_elf_parse_attributes): Likewise.
1483 * elfcode.h (elf_swap_shdr_in): Likewise.
1484 (elf_object_p): Don't call bfd_get_file_size twice and correct
1485 file size check.
1486
1487 2020-02-19 Alan Modra <amodra@gmail.com>
1488
1489 * mach-o.c (bfd_mach_o_flatten_sections): Return a bfd_boolean,
1490 FALSE if memory alloc fails. Adjust calls.
1491 * som.c (som_prep_for_fixups): Likewise.
1492 * vms-alpha.c (alpha_vms_add_fixup_lp, alpha_vms_add_fixup_ca),
1493 (alpha_vms_add_fixup_qr, alpha_vms_add_fixup_lr),
1494 (alpha_vms_add_lw_reloc, alpha_vms_add_qw_reloc): Likewise.
1495 * som.c (som_build_and_write_symbol_table): Return via error_return
1496 on seek failure.
1497 * vms-alpha.c (VEC_APPEND): Adjust for vector_grow1 changes.
1498 (VEC_APPEND_EL): Delete.
1499 (vector_grow1): Return pointer to element. Catch overflow.
1500 Return NULL on memory allocation failure.
1501 (alpha_vms_add_fixup_lp): Replace VEC_APPEND_EL with VEC_APPEND.
1502 (alpha_vms_add_fixup_ca): Likewise.
1503 (alpha_vms_link_add_object_symbols): Check VEC_APPEND result
1504 before using.
1505 * elf.c (bfd_section_from_shdr): Check bfd_zalloc2 result.
1506
1507 2020-02-19 Alan Modra <amodra@gmail.com>
1508
1509 * aix386-core.c (aix386_core_file_p): Use size_t for "amt".
1510 * aout-target.h (object_p): Likewise.
1511 * aout-tic30.c (tic30_aout_object_p): Likewise.
1512 * aoutx.h (some_aout_object_p, mkobject, make_empty_symbol),
1513 (emit_stringtab, write_syms, link_hash_table_create),
1514 (aout_link_write_other_symbol): Likewise.
1515 * archive.c (_bfd_generic_mkarchive, bfd_generic_archive_p),
1516 (bfd_ar_hdr_from_filesystem, _bfd_write_archive_contents),
1517 (_bfd_compute_and_write_armap): Likewise.
1518 * archures.c (bfd_arch_list): Likewise.
1519 * bfd.c (bfd_record_phdr): Likewise.
1520 * binary.c (binary_canonicalize_symtab): Likewise.
1521 * cisco-core.c (cisco_core_file_validate): Likewise.
1522 * coff-arm.c (coff_arm_link_hash_table_create, find_thumb_glue),
1523 (find_arm_glue, record_arm_to_thumb_glue),
1524 (record_thumb_to_arm_glue): Likewise.
1525 * coff-ppc.c (ppc_coff_link_hash_table_create, record_toc),
1526 (ppc_allocate_toc_section): Likewise.
1527 * coff-rs6000.c (_bfd_xcoff_mkobject, _bfd_xcoff_archive_p): Likewise.
1528 * coff-sh.c (sh_relax_section): Likewise.
1529 * coff64-rs6000.c (xcoff64_archive_p): Likewise.
1530 * coffcode.h (handle_COMDAT, coff_new_section_hook),
1531 (coff_set_alignment_hook, coff_mkobject),
1532 (coff_compute_section_file_positions): Likewise.
1533 * coffgen.c (coff_make_empty_symbol, coff_bfd_make_debug_symbol),
1534 (coff_find_nearest_line_with_names),
1535 ( bfd_coff_set_symbol_class): Likewise.
1536 * cofflink.c (_bfd_coff_link_hash_table_create),
1537 (_bfd_coff_link_input_bfd): Likewise.
1538 * dwarf1.c (alloc_dwarf1_unit, alloc_dwarf1_func): Likewise.
1539 * dwarf2.c (read_abbrevs, read_attribute_value, add_line_info),
1540 (build_line_info_table, sort_line_sequences),
1541 (line_info_add_include_dir, line_info_add_file_name),
1542 (decode_line_info, scan_unit_for_symbols, parse_comp_unit),
1543 (place_sections, _bfd_dwarf2_slurp_debug_info): Likewise.
1544 * ecoff.c (_bfd_ecoff_mkobject, _bfd_ecoff_make_empty_symbol),
1545 (_bfd_ecoff_find_nearest_line),
1546 (_bfd_ecoff_bfd_link_hash_table_create): Likewise.
1547 * ecofflink.c (bfd_ecoff_debug_init): Likewise.
1548 * elf-hppa.h (_bfd_elf_hppa_gen_reloc_type): Likewise.
1549 * elf-m10300.c (mn10300_elf_relax_section),
1550 (elf32_mn10300_link_hash_table_create): Likewise.
1551 * elf-strtab.c (_bfd_elf_strtab_init): Likewise.
1552 * elf.c (make_mapping, copy_elf_program_header): Likewise.
1553 * elf32-arm.c (elf32_arm_link_hash_table_create),
1554 (elf32_arm_setup_section_lists, elf32_arm_check_relocs),
1555 (elf32_arm_new_section_hook): Likewise.
1556 * elf32-avr.c (elf_avr_new_section_hook),
1557 (elf32_avr_link_hash_table_create, get_local_syms),
1558 (elf32_avr_setup_section_lists): Likewise.
1559 * elf32-bfin.c (bfinfdpic_elf_link_hash_table_create),
1560 (bfin_link_hash_table_create): Likewise.
1561 * elf32-cr16.c (elf32_cr16_link_hash_table_create): Likewise.
1562 * elf32-cris.c (elf_cris_link_hash_table_create): Likewise.
1563 * elf32-csky.c (csky_elf_link_hash_table_create),
1564 (csky_elf_check_relocs, elf32_csky_setup_section_lists): Likewise.
1565 * elf32-frv.c (frvfdpic_elf_link_hash_table_create): Likewise.
1566 * elf32-hppa.c (elf32_hppa_link_hash_table_create),
1567 (elf32_hppa_setup_section_lists, get_local_syms): Likewise.
1568 * elf32-i386.c (elf_i386_check_relocs): Likewise.
1569 * elf32-lm32.c (lm32_elf_link_hash_table_create): Likewise.
1570 * elf32-m32r.c (m32r_elf_link_hash_table_create),
1571 (m32r_elf_check_relocs): Likewise.
1572 * elf32-m68hc1x.c (m68hc11_elf_hash_table_create),
1573 (elf32_m68hc11_setup_section_lists),
1574 (elf32_m68hc11_size_stubs): Likewise.
1575 * elf32-m68k.c (elf_m68k_link_hash_table_create): Likewise.
1576 * elf32-metag.c (elf_metag_link_hash_table_create),
1577 (elf_metag_setup_section_lists): Likewise.
1578 * elf32-microblaze.c (microblaze_elf_link_hash_table_create),
1579 (microblaze_elf_check_relocs): Likewise.
1580 * elf32-nds32.c (nds32_elf_link_hash_table_create),
1581 (nds32_elf_check_relocs): Likewise.
1582 * elf32-nios2.c (nios2_elf32_setup_section_lists),
1583 (get_local_syms, nios2_elf32_check_relocs),
1584 (nios2_elf32_link_hash_table_create): Likewise.
1585 * elf32-or1k.c (or1k_elf_link_hash_table_create),
1586 (or1k_elf_check_relocs): Likewise.
1587 * elf32-ppc.c (ppc_elf_modify_segment_map, update_plt_info): Likewise.
1588 * elf32-pru.c (pru_elf32_link_hash_table_create): Likewise.
1589 * elf32-s390.c (elf_s390_link_hash_table_create),
1590 (elf_s390_check_relocs): Likewise.
1591 * elf32-score.c (score_elf_create_got_section),
1592 (s3_elf32_score_new_section_hook),
1593 (elf32_score_link_hash_table_create): Likewise.
1594 * elf32-score7.c (score_elf_create_got_section),
1595 (s7_elf32_score_new_section_hook): Likewise.
1596 * elf32-sh.c (sh_elf_link_hash_table_create),
1597 (sh_elf_check_relocs): Likewise.
1598 * elf32-tic6x.c (elf32_tic6x_link_hash_table_create),
1599 (elf32_tic6x_new_section_hook, elf32_tic6x_check_relocs): Likewise.
1600 * elf32-tilepro.c (tilepro_elf_link_hash_table_create),
1601 (tilepro_elf_check_relocs): Likewise.
1602 * elf32-v850.c (remember_hi16s_reloc): Likewise.
1603 * elf32-vax.c (elf_vax_link_hash_table_create): Likewise.
1604 * elf32-xtensa.c (elf_xtensa_link_hash_table_create),
1605 (elf_xtensa_new_section_hook): Likewise.
1606 * elf64-alpha.c (elf64_alpha_bfd_link_hash_table_create),
1607 (get_got_entry, elf64_alpha_check_relocs): Likewise.
1608 * elf64-hppa.c (elf64_hppa_hash_table_create): Likewise.
1609 * elf64-ia64-vms.c (elf64_ia64_object_p): Likewise.
1610 * elf64-mmix.c (mmix_elf_new_section_hook): Likewise.
1611 * elf64-ppc.c (ppc64_elf_new_section_hook),
1612 (ppc64_elf_link_hash_table_create, update_local_sym_info),
1613 (update_plt_info, ppc64_elf_check_relocs): Likewise.
1614 * elf64-s390.c (elf_s390_link_hash_table_create),
1615 (elf_s390_check_relocs): Likewise.
1616 * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
1617 * elflink.c (bfd_elf_link_record_local_dynamic_symbol),
1618 (_bfd_elf_link_find_version_dependencies, elf_link_add_object_symbols),
1619 (elf_link_add_archive_symbols, compute_bucket_count),
1620 (bfd_elf_size_dynsym_hash_dynstr, _bfd_elf_link_hash_table_create),
1621 (bfd_elf_get_bfd_needed_list, elf_link_swap_symbols_out),
1622 (bfd_elf_final_link): Likewise.
1623 * elfnn-aarch64.c (elfNN_aarch64_link_hash_table_create),
1624 (elfNN_aarch64_setup_section_lists, elfNN_aarch64_check_relocs),
1625 (elfNN_aarch64_new_section_hook): Likewise.
1626 * elfnn-ia64.c (elfNN_ia64_object_p): Likewise.
1627 * elfnn-riscv.c (riscv_elf_link_hash_table_create),
1628 (riscv_elf_check_relocs): Likewise.
1629 * elfxx-mips.c (_bfd_mips_elf_new_section_hook),
1630 (_bfd_mips_elf_add_symbol_hook, _bfd_mips_elf_check_relocs),
1631 (_bfd_mips_elf_modify_segment_map, _bfd_mips_elf_set_section_contents),
1632 (_bfd_mips_elf_link_hash_table_create): Likewise.
1633 * elfxx-sparc.c (_bfd_sparc_elf_link_hash_table_create),
1634 (_bfd_sparc_elf_check_relocs),
1635 (_bfd_sparc_elf_new_section_hook): Likewise.
1636 * elfxx-tilegx.c (tilegx_elf_link_hash_table_create),
1637 (tilegx_elf_check_relocs): Likewise.
1638 * elfxx-x86.c (_bfd_x86_elf_link_hash_table_create): Likewise.
1639 * format.c (bfd_check_format_matches): Likewise.
1640 * hash.c (_bfd_stringtab_init): Likewise.
1641 * ihex.c (ihex_scan): Likewise.
1642 * irix-core.c (irix_core_core_file_p): Likewise.
1643 * linker.c (bfd_wrapped_link_hash_lookup),
1644 (_bfd_generic_link_hash_table_create),
1645 (_bfd_generic_reloc_link_order): Likewise.
1646 * lynx-core.c (lynx_core_file_p): Likewise.
1647 * netbsd-core.c (netbsd_core_file_p): Likewise.
1648 * osf-core.c (osf_core_core_file_p): Likewise.
1649 * pdp11.c (some_aout_object_p, mkobject, make_empty_symbol),
1650 (link_hash_table_create, aout_link_write_other_symbol): Likewise.
1651 * peXXigen.c (_bfd_XX_bfd_copy_private_section_data): Likewise.
1652 * peicode.h (pe_mkobject): Likewise.
1653 * ppcboot.c (ppcboot_mkobject, ppcboot_canonicalize_symtab): Likewise.
1654 * ptrace-core.c (ptrace_unix_core_file_p): Likewise.
1655 * sco5-core.c (read_uarea): Likewise.
1656 * som.c (hppa_som_gen_reloc_type, som_object_p, som_prep_headers),
1657 (som_write_fixups, som_write_space_strings, som_write_symbol_strings),
1658 (som_finish_writing, som_canonicalize_symtab, som_new_section_hook),
1659 (som_bfd_copy_private_section_data, bfd_som_set_section_attributes),
1660 (bfd_som_attach_aux_hdr, som_write_armap): Likewise.
1661 * srec.c (srec_scan): Likewise.
1662 * syms.c (_bfd_generic_make_empty_symbol): Likewise.
1663 * targets.c (bfd_target_list): Likewise.
1664 * tekhex.c (first_phase, tekhex_sizeof_headers): Likewise.
1665 * trad-core.c (trad_unix_core_file_p): Likewise.
1666 * vms-alpha.c (vms_initialize, alpha_vms_bfd_link_hash_table_create),
1667 (vms_new_section_hook): Likewise.
1668 * wasm-module.c (wasm_make_empty_symbol): Likewise.
1669 * xcofflink.c (xcoff_get_section_contents),
1670 (_bfd_xcoff_bfd_link_hash_table_create, xcoff_set_import_path),
1671 (xcoff_find_function, bfd_xcoff_link_record_set, xcoff_build_ldsym),
1672 (bfd_xcoff_size_dynamic_sections, xcoff_link_input_bfd): Likewise.
1673
1674 2020-02-19 Alan Modra <amodra@gmail.com>
1675
1676 * elfxx-riscv.c (riscv_multi_letter_ext_valid_p): Don't use C99.
1677
1678 2020-02-13 H.J. Lu <hongjiu.lu@intel.com>
1679
1680 * plugin.c (try_load_plugin): Make plugin_list_iter an argument
1681 and use it if it isn't NULL. Remove has_plugin_p argument. Add
1682 a build_list_p argument. Don't search plugin_list. Short circuit
1683 when building the plugin list.
1684 (has_plugin): Renamed to has_plugin_list.
1685 (bfd_plugin_set_plugin): Don't set has_plugin.
1686 (bfd_plugin_specified_p): Check plugin_list instead.
1687 (build_plugin_list): New function.
1688 (load_plugin): Call build_plugin_list and use plugin_list.
1689
1690 2020-02-11 H.J. Lu <hongjiu.lu@intel.com>
1691
1692 PR binutils/25355
1693 * plugin.c (try_claim): Always clean up for LTO wrapper.
1694 (try_load_plugin): Treat each object as independent. Create a
1695 copy for plugin name.
1696
1697 2020-02-11 Nick Clifton <nickc@redhat.com>
1698
1699 * elf32-msp430.c (msp430_final_link_relocate): Always use longs
1700 for addresses in print statements.
1701 (msp430_elf_relax_delete_bytes): Likewise.
1702 (msp430_elf_relax_add_words): Likewise.
1703 (msp430_elf_relax_section): Likewise.
1704
1705 2020-02-11 H.J. Lu <hongjiu.lu@intel.com>
1706
1707 * plugin.c (add_symbols): Clear plugin_data memory.
1708
1709 2020-02-10 H.J. Lu <hongjiu.lu@intel.com>
1710
1711 PR binutils/25355
1712 * configure.ac (HAVE_EXECUTABLE_SUFFIX): New AC_DEFINE.
1713 (EXECUTABLE_SUFFIX): Likewise.
1714 * config.in: Regenerated.
1715 * configure: Likewise.
1716 * plugin.c (bfd_plugin_close_and_cleanup): Removed.
1717 (plugin_list_entry): Add all_symbols_read, cleanup_handler,
1718 gcc, lto_wrapper, resolution_file, resolution_option, gcc_env,
1719 real_bfd, real_nsyms, real_syms, lto_nsyms and lto_syms.
1720 (get_lto_wrapper): New.
1721 (setup_lto_wrapper_env): Likewise.
1722 (current_plugin): Likewise.
1723 (register_all_symbols_read): Likewise.
1724 (register_cleanup): Likewise.
1725 (get_symbols): Likewise.
1726 (add_input_file): Likewise.
1727 (bfd_plugin_close_and_cleanup): Likewise.
1728 (claim_file): Removed.
1729 (register_claim_file): Set current_plugin->claim_file.
1730 (add_symbols): Make a copy of LTO symbols. Set lto_nsyms and
1731 lto_syms in current_plugin.
1732 (try_claim): Use current_plugin->claim_file. Call LTO plugin
1733 all_symbols_read handler. Copy real symbols to plugin_data.
1734 Call LTO plugin cleanup handler. Clean up for LTO wrapper.
1735 (try_load_plugin): Don't reuse the previous plugin for LTO
1736 wrapper. Set up GCC LTO wrapper if possible. Don't set
1737 plugin_list_iter->claim_file.
1738 (bfd_plugin_canonicalize_symtab): Use real LTO symbols if
1739 possible.
1740 * plugin.h (plugin_data_struct): Add real_bfd, real_nsyms and
1741 real_syms.
1742
1743 2020-02-10 Jozef Lawrynowicz <jozef.l@mittosystems.com>
1744
1745 * elf32-msp430.c (msp430_elf_relax_section): Before relaxing a branch,
1746 check if previous instruction matches a conditional jump inserted
1747 earlier. Invert conditional jump and delete branch in this case.
1748
1749 2020-02-10 Jozef Lawrynowicz <jozef.l@mittosystems.com>
1750
1751 * elf32-msp430.c (msp430_elf_relax_add_two_words): Rename to
1752 msp430_elf_relax_add_words. Support insertion of either one or two
1753 words.
1754 (msp430_elf_relax_section): Catch opcode of 0x3c00 when relocation
1755 needs to be grown. Handle insertion of branch instruction to replace
1756 jump.
1757
1758 2020-02-10 Jozef Lawrynowicz <jozef.l@mittosystems.com>
1759
1760 * elf32-msp430.c (msp430_final_link_relocate): Add printf statements for
1761 debugging relocations.
1762 (msp430_elf_relax_delete_bytes): Likewise.
1763 (msp430_elf_relax_add_two_words): Likewise.
1764 (msp430_elf_relax_section): Likewise.
1765
1766 2020-02-10 Alan Modra <amodra@gmail.com>
1767
1768 * archures.c: Wrap overlong z80 comments.
1769 * bfd-in2.h: Regenerate.
1770
1771 2020-02-07 Sergey Belyashov <sergey.belyashov@gmail.com>
1772
1773 PR 25469
1774 * archures.c: Add GBZ80 and Z80N machine values.
1775 * reloc.c: Add BFD_RELOC_Z80_16_BE.
1776 * coff-z80.c: Add support for new reloc.
1777 * coffcode.h: Add support for new machine values.
1778 * cpu-z80.c: Add support for new machine names.
1779 * elf32-z80.c: Add support for new reloc.
1780 * bfd-in2.h: Regenerate.
1781 * libbfd.h: Regenerate.
1782
1783 2020-02-07 Nick Clifton <nickc@redhat.com>
1784
1785 PR 23932
1786 * elf.c (rewrite_elf_program_header): Do not complain if no
1787 sections are mapped to a segment.
1788
1789 2020-02-06 H.J. Lu <hongjiu.lu@intel.com>
1790
1791 PR ld/25490
1792 * elflink.c (_bfd_elf_gc_mark_extra_sections): Issue an error
1793 for garbage collection on __patchable_function_entries section
1794 without linked-to section.
1795
1796 2020-02-06 H.J. Lu <hongjiu.lu@intel.com>
1797
1798 PR gas/25381
1799 * bfd-in2.h: Regenerated.
1800 * elflink.c (_bfd_elf_gc_mark_extra_sections): Call mark_hook
1801 on section if gc_mark of any of its linked-to sections is set
1802 and don't set gc_mark again.
1803 * section.c (asection): Add linked_to_symbol_name to map_head
1804 union.
1805
1806 2020-02-06 Maciej W. Rozycki <macro@wdc.com>
1807
1808 * elf32-v850.c (v850_elf_relax_section): Fix the index used for
1809 reporting an unrecognized instruction with R_V850_LONGJUMP.
1810
1811 2020-02-05 Alan Modra <amodra@gmail.com>
1812
1813 * elf64-ppc.c (ppc_stub_plt_branch): Match comment with reality.
1814
1815 2020-02-04 Alan Modra <amodra@gmail.com>
1816
1817 * elf32-ppc.c (ppc_elf_relocate_section): After applying
1818 R_PPC_VLE_ADDR20, goto copy_reloc.
1819
1820 2020-02-02 H.J. Lu <hongjiu.lu@intel.com>
1821
1822 * bfd-in2.h: Regenerated.
1823 * section.c (SEC_ASSEMBLER_SECTION_ID): Fix a typo in comments.
1824
1825 2020-02-02 H.J. Lu <hongjiu.lu@intel.com>
1826
1827 PR gas/25380
1828 * bfd-in2.h: Regenerated.
1829 * ecoff.c (bfd_debug_section): Add section_id.
1830 * section.c (bfd_section): Add section_id.
1831 (SEC_ASSEMBLER_SECTION_ID): New.
1832 (BFD_FAKE_SECTION): Add section_id.
1833
1834 2020-02-01 Nick Clifton <nickc@redhat.com>
1835
1836 * config.bfd: Move the c30-aout and tic30-aout targets onto the
1837 obsolete list.
1838
1839 2020-01-31 Sandra Loosemore <sandra@codesourcery.com>
1840
1841 * elf-eh-frame.c (_bfd_elf_write_section_eh_frame): DW_EH_PE_datarel
1842 encodings are relative to the GOT on nios2, too.
1843
1844 2020-01-31 Alan Modra <amodra@gmail.com>
1845
1846 * Makefile.am (elf32-target.h, elf64-target.h): Don't use a temp
1847 file. Use $< and $@ in rules.
1848 (elf32-aarch64.c, elf64-aarch64.c): Likewise.
1849 (elf32-ia64.c, elf64-ia64.c): Likewise.
1850 (elf32-riscv.c, elf64-riscv.c): Likewise.
1851 (peigen.c, pepigen.c, pex64igen.c): Likewise.
1852 (elf32-aarch64.c, elf64-aarch64.c): Don't emit $srcdir on #line.
1853 (elf32-riscv.c, elf64-riscv.c): Likewise, and use $(SED).
1854 (elf32-ia64.c, elf64-ia64.c): Do emit #line.
1855 (peigen.c, pepigen.c, pex64igen.c): Likewise.
1856 * Makefile.in: Regenerate.
1857
1858 2020-01-31 Alan Modra <amodra@gmail.com>
1859
1860 PR 4110
1861 * elf.c (setup_group): Don't clear entire section contents,
1862 just the padding after group flags. Release alloc'd memory
1863 after a seek or read failure.
1864
1865 2020-01-16 Jon Turney <jon.turney@dronecode.org.uk>
1866
1867 * peXXigen.c (pe_is_repro): New function.
1868 (_bfd_XX_print_private_bfd_data_common): Note timestamp is
1869 actually a build hash if PE_IMAGE_DEBUG_TYPE_REPRO is present.
1870
1871 2020-01-16 Jon Turney <jon.turney@dronecode.org.uk>
1872
1873 * peXXigen.c (debug_type_names): Add names for new debug data type
1874 values.
1875
1876 2020-01-16 Jon Turney <jon.turney@dronecode.org.uk>
1877
1878 * peXXigen.c (pe_print_debugdata): Fix the iteration variable for
1879 inner loop. Fix a memory leak.
1880
1881 2020-01-30 Alan Modra <amodra@gmail.com>
1882
1883 * coffgen.c (coff_real_object_p): Don't clear obj_coff_keep_syms
1884 or obj_coff_keep_strings here.
1885 (coff_get_normalized_symtab): Free external syms directly.
1886 * xcofflink.c (xcoff_link_input_bfd): Restore obj_coff_keep_syms
1887 on error exit path.
1888
1889 2020-01-27 Jim Wilson <jimw@sifive.com>
1890
1891 * cpu-riscv.c (riscv_scan): New.
1892 (N): Change bfd_default_scan to riscv_scan.
1893
1894 2020-01-27 Andreas Schwab <schwab@suse.de>
1895
1896 * Makefile.am (ALL_MACHINES): Remove cpu-plugin.lo.
1897 (ALL_MACHINES_CFILES): Remove cpu-plugin.c.
1898 * Makefile.in: Regenerate.
1899 * cpu-plugin.c: Remove.
1900 * archures.c (enum bfd_architecture): Remove bfd_arch_plugin.
1901 (bfd_plugin_arch): Remove declaration.
1902 * bfd-in2.h: Regenerate.
1903 * po/SRC-POTFILES.in: Regenerate.
1904
1905 2020-01-27 H.J. Lu <hongjiu.lu@intel.com>
1906 Alan Modra <amodra@gmail.com>
1907
1908 PR ld/25458
1909 * elflink.c (_bfd_elf_gc_mark_rsec): Mark all weak aliases.
1910
1911 2020-01-24 Jim Wilson <jimw@sifive.com>
1912
1913 * elfxx-riscv.c (riscv_get_prefix_class): Format s case like others.
1914 (riscv_parse_prefixed_ext): Fix s extension comment and reword to
1915 avoid over long line.
1916
1917 2020-01-24 Nick Clifton <nickc@redhat.com>
1918
1919 PR 25447
1920 * coffgen.c (_bfd_coff_close_and_cleanup): Do not clear the keep
1921 syms and keep strings flags as these may have been set in order to
1922 prevent a bogus call to free.
1923
1924 2020-01-23 Nick Clifton <nickc@redhat.com>
1925
1926 * po/fr.po: Updated French translation.
1927
1928 2020-01-23 Alan Modra <amodra@gmail.com>
1929
1930 PR 25444
1931 * elf.c (assign_file_positions_for_load_sections): Avoid divide
1932 by zero when p_align is zero.
1933
1934 2020-01-22 Maxim Blinov <maxim.blinov@embecosm.com>
1935
1936 * bfd/elfnn-riscv.c (riscv_skip_prefix): New.
1937 (riscv_prefix_cmp): Likewise.
1938 (riscv_non_std_ext_p): Deleted.
1939 (riscv_std_sv_ext_p): Likewise.
1940 (riscv_non_std_sv_ext_p): Likewise.
1941 (riscv_merge_non_std_and_sv_ext): Rename to...
1942 (riscv_merge_multi_letter_ext): and modified to use riscv_prefix_cmp.
1943 (riscv_merge_arch_attr_info): Replace 3 calls to
1944 riscv_merge_non_std_and_sv_ext with single call to
1945 riscv_merge_multi_letter_ext.
1946 * bfd/elfxx-riscv.c (riscv_parse_std_ext): Break if we
1947 encounter a 'z' prefix.
1948 (riscv_get_prefix_class): New function, return prefix class based
1949 on first few characters of input string.
1950 (riscv_parse_config): New structure to factor out minor differences
1951 in extension class parsing behaviour.
1952 (riscv_parse_sv_or_non_std_ext): Rename to...
1953 (riscv_parse_prefixed_ext): and parameterise with
1954 riscv_parse_config.
1955 (riscv_std_z_ext_strtab, riscv_std_s_ext_strtab): New.
1956 (riscv_multi_letter_ext_valid_p): New.
1957 (riscv_ext_x_valid_p, riscv_ext_z_valid_p, riscv_ext_s_valid_p): New.
1958 (riscv_parse_subset): Delegate all non-single-letter parsing work
1959 to riscv_parse_prefixed_ext.
1960 * bfd/elfxx-riscv.h (riscv_isa_ext_class): New type.
1961 (riscv_get_prefix_class): Declare.
1962
1963 2020-01-22 Alan Modra <amodra@gmail.com>
1964
1965 * elf64-ppc.c (struct ppc_link_hash_table): Add tga_group.
1966 (ppc64_elf_archive_symbol_lookup): Extract __tls_get_addr_opt for
1967 __tls_get_addr_desc.
1968 (ppc64_elf_size_stubs): Add section for linker generated
1969 __tls_get_addr_desc wrapper function. Loop at least once if
1970 generating this function.
1971 (emit_tga_desc, emit_tga_desc_eh_frame): New functions.
1972 (ppc64_elf_build_stubs): Generate __tls_get_addr_desc.
1973
1974 2020-01-22 Alan Modra <amodra@gmail.com>
1975
1976 * elf64-ppc.h (struct ppc64_elf_params): Add no_tls_get_addr_regsave.
1977 * elf64-ppc.c (struct ppc_link_hash_table): Add tga_desc and
1978 tga_desc_fd.
1979 (is_tls_get_addr): Match tga_desc and tga_desc_df too.
1980 (STDU_R1_0R1, ADDI_R1_R1): Define.
1981 (tls_get_addr_prologue, tls_get_addr_epilogue): New functions.
1982 (ppc64_elf_tls_setup): Set up tga_desc and tga_desc_fd. Indirect
1983 tga_desc_fd to opt_fd, and tga_desc to opt. Set
1984 no_tls_get_addr_regsave.
1985 (branch_reloc_hash_match): Add hash3 and hash4.
1986 (ppc64_elf_tls_optimize): Handle tga_desc_fd and tga_desc too.
1987 (ppc64_elf_size_dynamic_sections): Likewise.
1988 (ppc64_elf_relocate_section): Likewise.
1989 (plt_stub_size, build_plt_stub): Likewise. Size regsave
1990 __tls_get_addr stub.
1991 (build_tls_get_addr_stub): Build regsave __tls_get_addr stub and
1992 eh_frame.
1993 (ppc_size_one_stub): Handle tga_desc_fd and tga_desc too. Size
1994 eh_frame for regsave __tls_get_addr.
1995
1996 2020-01-22 Alan Modra <amodra@gmail.com>
1997
1998 * elf64-ppc.c (ppc64_elf_size_stubs): Correct condition under
1999 which __tls_get_addr calls will be eliminated.
2000
2001 2020-01-20 Nick Clifton <nickc@redhat.com>
2002
2003 * po/pt.po: Updates Portuguese translation.
2004 * po/ru.po: Updated Russian translation.
2005 * po/uk.po: Updated Ukranian translation.
2006
2007 2020-01-20 H.J. Lu <hongjiu.lu@intel.com>
2008
2009 PR ld/25416
2010 * elf64-x86-64.c (elf_x86_64_check_tls_transition): Support
2011 "rex leal x@tlsdesc(%rip), %reg" and "call *x@tlsdesc(%eax)" in
2012 X32 mode.
2013 (elf_x86_64_relocate_section): In x32 mode, for GDesc -> LE
2014 transition, relax "rex leal x@tlsdesc(%rip), %reg" to
2015 "rex movl $x@tpoff, %reg", for GDesc -> IE transition, relax
2016 "rex leal x@tlsdesc(%rip), %reg" to
2017 "rex movl x@gottpoff(%rip), %eax". For both transitions, relax
2018 "call *(%eax)" to "nopl (%rax)".
2019
2020 2020-01-20 Alan Modra <amodra@gmail.com>
2021
2022 * elf64-ppc.c (LD_R11_0R3, CMPDI_R11_0, STD_R11_0R1, LD_R11_0R1),
2023 (MTLR_R11): Don't define.
2024 (LD_R0_0R3, CMPDI_R0_0): Define.
2025 (build_tls_get_addr_stub): Don't use r11 in stub.
2026
2027 2020-01-20 Alan Modra <amodra@gmail.com>
2028
2029 * elf64-ppc.c (ppc_elf_hash_entry): New function, use throughout file.
2030 (defined_sym_val, is_tls_get_addr): Likewise.
2031
2032 2020-01-18 Nick Clifton <nickc@redhat.com>
2033
2034 * version.m4 (BFD_VERSION): Set to 2.34.50.
2035 * configure: Regenerate.
2036 * po/bfd.pot: Regenerate.
2037
2038 2020-01-18 Nick Clifton <nickc@redhat.com>
2039
2040 Binutils 2.34 branch created.
2041
2042 2020-01-17 Christian Biesinger <cbiesinger@google.com>
2043
2044 * coff-arm.c: Fix spelling error (seperate).
2045 * elfxx-riscv.c (riscv_parse_sv_or_non_std_ext): Fix spelling
2046 error (seperate).
2047 * sysdep.h (strnlen): Fix spelling error (seperate).
2048
2049 2020-01-15 Lars Brinkhoff <lars@nocrew.org>
2050
2051 PR 20694
2052 * pdp11.c (TARGET_PAGE_SIZE): Set to 8192.
2053
2054 2020-01-15 Alan Modra <amodra@gmail.com>
2055
2056 PR 25384
2057 * elf64-ppc.c (ELIMINATE_COPY_RELOCS): Update comment.
2058 (ppc64_elf_adjust_dynamic_symbol): Don't allow .dynbss copies
2059 of function symbols unless dot symbols are present. Do warn
2060 whenever one is created, regardles of whether a PLT entry is
2061 also emitted for the function symbol.
2062
2063 2020-01-14 Alan Modra <amodra@gmail.com>
2064
2065 * som.c (som_bfd_count_ar_symbols): Error when file position
2066 of symbols on chains is not strictly increasing.
2067
2068 2020-01-14 Alan Modra <amodra@gmail.com>
2069
2070 * vms.h (VMS_DEBUG): Define as 0.
2071 * vms-alpha.c (image_write): Move debug output after bounds check.
2072 Tidy bounds check.
2073 (_bfd_vms_slurp_eihd): Warning fix.
2074 (_bfd_vms_slurp_etir): Init variables to avoid bogus warnings.
2075
2076 2020-01-13 Alan Modra <amodra@gmail.com>
2077
2078 * vms-alpha.c (_bfd_vms_slurp_egsd): Ensure minimum size even
2079 for "ignored" records.
2080
2081 2020-01-13 Alan Modra <amodra@gmail.com>
2082
2083 * wasm-module.c (wasm_scan_name_function_section): Formatting.
2084 Delete asect name check. Move asect NULL check to wasm_object_p.
2085 Correct bounds check of sizes against end. Replace uses of
2086 bfd_zalloc with bfd_alloc, zeroing only necessary bytes. Use
2087 just one bfd_release.
2088 (wasm_scan): Don't use malloc/strdup for section names,
2089 bfd_alloc instead. Simplify code prefixing section name.
2090 Formatting. Don't attempt to free memory here..
2091 (wasm_object_p): ..do so here.
2092
2093 2020-01-10 Szabolcs Nagy <szabolcs.nagy@arm.com>
2094
2095 PR ld/22269
2096 * elf32-arm.c (elf32_arm_final_link_relocate): Use
2097 UNDEFWEAK_NO_DYNAMIC_RELOC.
2098 (allocate_dynrelocs_for_symbol): Likewise.
2099
2100 2020-01-10 Tamar Christina <tamar.christina@arm.com>
2101
2102 PR 25210
2103 * elfnn-aarch64.c (_bfd_aarch64_create_stub_section): Remove elfclass.
2104
2105 2020-01-10 Alan Modra <amodra@gmail.com>
2106
2107 * coff-alpha.c (alpha_ecoff_object_p): Calculate size in bfd_size_type.
2108
2109 2020-01-09 Nick Clifton <nickc@redhat.com>
2110
2111 PR 25221
2112 * bfd.c (bfd_convert_section_contents): Check for a compress
2113 header size that is larger than the actual section size.
2114
2115 2020-01-08 Alan Modra <amodra@gmail.com>
2116
2117 PR 25351
2118 * elflink.c (bfd_elf_final_link): Call _bfd_fix_excluded_sec_syms
2119 after removing sections.
2120
2121 2020-01-06 Jim Wilson <jimw@sifive.com>
2122
2123 PR 25205
2124 * elfnn-riscv.c (riscv_elf_relocate_section) <R_RISCV_CALL>: Add
2125 check for !bfd_link_pic (info).
2126 <R_RISCV_CALL_PLT>: Move next to R_RISCV_CALL.
2127 <R_RISCV_JAL>: Add comment.
2128 (_bfd_riscv_relax_section): For plt.offset check, add check for
2129 bfd_link_pic (info). Add comment.
2130
2131 2020-01-06 Alan Modra <amodra@gmail.com>
2132
2133 * format.c (bfd_check_format_matches): Ignore bfd_error on target
2134 match failures. Don't init to bfd_error_wrong_format before
2135 calling _bfd_check_format.
2136
2137 2020-01-06 Alan Modra <amodra@gmail.com>
2138
2139 * vms-alpha.c (_bfd_vms_push, _bfd_vms_pop): Return pass/fail
2140 status rather than exiting on stack overflow or underflow.
2141 (_bfd_vms_slurp_etir): Adjust to suit.
2142
2143 2020-01-06 Alan Modra <amodra@gmail.com>
2144
2145 * som.c (som_bfd_fill_in_ar_symbols): Bounds check som_dict index.
2146
2147 2020-01-06 Alan Modra <amodra@gmail.com>
2148
2149 * mach-o.c (bfd_mach_o_read_dylinker): Don't read past end of
2150 command. Check name offset is within command.
2151 (bfd_mach_o_read_dylib, bfd_mach_o_read_prebound_dylib),
2152 (bfd_mach_o_read_prebind_cksum, bfd_mach_o_read_twolevel_hints),
2153 (bfd_mach_o_read_fvmlib, bfd_mach_o_read_dysymtab),
2154 (bfd_mach_o_read_symtab, bfd_mach_o_read_uuid),
2155 (bfd_mach_o_read_linkedit, bfd_mach_o_read_str),
2156 (bfd_mach_o_read_dyld_info, bfd_mach_o_read_version_min),
2157 (bfd_mach_o_read_encryption_info, bfd_mach_o_read_source_version),
2158 (bfd_mach_o_read_encryption_info_64, bfd_mach_o_read_main),
2159 (bfd_mach_o_read_note, bfd_mach_o_read_build_version),
2160 (bfd_mach_o_read_segment): Similarly.
2161 (bfd_mach_o_read_thread): Properly bound check thread struct.
2162 Don't repeat checks on second loop.
2163 (bfd_mach_o_read_command): Fail on invalid command length.
2164
2165 2020-01-04 Alan Modra <amodra@gmail.com>
2166
2167 * format.c (bfd_check_format_matches): Add preserve_match.
2168 Save initial bfd state in "preserve", matched bfd state in
2169 "preserve_match". Save just the first match. Release
2170 bfd_alloc memory. Restore and finish preserved state as
2171 appropriate on all function exit paths.
2172
2173 2020-01-04 Alan Modra <amodra@gmail.com>
2174
2175 * mmo.c (mmo_mkobject): Allocate tdata with bfd_zalloc.
2176
2177 2020-01-04 Alan Modra <amodra@gmail.com>
2178
2179 * coffgen.c (coff_real_object_p): Free malloc'd memory on target
2180 match too.
2181
2182 2020-01-03 Nick Clifton <nickc@redhat.com>
2183
2184 PR 25307
2185 (bfd_pef_parse_function_stubs): Correct the test that ensures that
2186 there is enough data remaining in the code buffer before
2187 attempting to read a function stub.
2188
2189 2020-01-03 Nick Clifton <nickc@redhat.com>
2190
2191 PR 25308
2192 * elf-properties.c (_bfd_elf_convert_gnu_properties): Check the
2193 return value from bfd_malloc.
2194 * elf32-arm.c (bfd_elf32_arm_vfp11_fix_veneer_locations): Likewise.
2195 (bfd_elf32_arm_stm32l4xx_fix_veneer_locations): Likewise.
2196 (elf32_arm_filter_cmse_symbols): Likewise.
2197 (elf32_arm_write_section): Likewise.
2198 * mach-o.c (bfd_mach_o_core_fetch_environment): Likewise.
2199 (bfd_mach_o_follow_dsym): Likewise.
2200 * pef.c (bfd_pef_print_loader_section): Likewise.
2201 (bfd_pef_scan_start_address): Likewise.
2202 (bfd_pef_parse_function_stubs): Likewise.
2203 (bfd_pef_parse_symbols): Likewise.
2204
2205 2020-01-03 Sergei Trofimovich <siarheit@google.com>
2206
2207 * elfnn-ia64.c (elfNN_ia64_merge_private_bfd_data): don't fail
2208 on binary inputs ld/PR25316.
2209 (is_ia64_elf): new helper to filter on ia64 objects.
2210
2211 2020-01-03 Jan Beulich <jbeulich@suse.com>
2212
2213 * mach-o.c (cpusubtype, bfd_mach_o_header_p): Insert underscore
2214 in parameter names.
2215 (bfd_mach_o_scan): Insert underscore in two variable names.
2216
2217 2020-01-02 Sergey Belyashov <sergey.belyashov@gmail.com>
2218
2219 * Makefile.am: Add z80-elf target support.
2220 * configure.ac: Likewise.
2221 * targets.c: Likewise.
2222 * Makefile.in: Regenerate.
2223 * configure: Regenerate.
2224 * config.bfd: Add z80-elf target support and new arches: ez80 and
2225 z180.
2226 * elf32-z80.c: New file.
2227 * archures.c: Add new z80 architectures: eZ80 and Z180.
2228 * coffcode.h: Likewise.
2229 * cpu-z80.c: Likewise.
2230 * coff-z80.c: Add new relocations for Z80 target and local label
2231 check.
2232 * reloc.c: Add new relocs.
2233 * bfd-in2.h: Regenerate.
2234 * libbfd.h: Regenerate.
2235
2236 2020-01-02 Tamar Christina <tamar.christina@arm.com>
2237
2238 PR 25210
2239 PR 24753
2240 * elfnn-aarch64.c (_bfd_aarch64_create_stub_section): Set ELF class.
2241
2242 2020-01-01 Alan Modra <amodra@gmail.com>
2243
2244 Update year range in copyright notice of all files.
2245
2246 For older changes see ChangeLog-2019
2247 \f
2248 Copyright (C) 2020 Free Software Foundation, Inc.
2249
2250 Copying and distribution of this file, with or without modification,
2251 are permitted in any medium without royalty provided the copyright
2252 notice and this notice are preserved.
2253
2254 Local Variables:
2255 mode: change-log
2256 left-margin: 8
2257 fill-column: 74
2258 version-control: never
2259 End:
This page took 0.080016 seconds and 4 git commands to generate.