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