Fixes illegal memory access errors and arithmetic overflows when running strip on...
[external/binutils.git] / bfd / ChangeLog
1 2015-02-26  Nick Clifton  <nickc@redhat.com>
2
3         PR binutils/17512
4         * coffcode.h (coff_compute_section_file_positions): Report
5         negative page sizes.
6         * elf.c (elf_fake_sections): Handle excessive alignmment powers.
7         (assign_file_positions_for_non_load_sections): Replace assertion
8         with an error message.
9         (rewrite_elf_program_header): Handle excessive segment
10         alignments.
11         * mach-o.c (bfd_mach_o_read_section_32): Likewise.
12         (bfd_mach_o_read_section_64): Likewise.
13         * peXXigen.c (_bfd_XX_bfd_copy_private_bfd_data_common): Use %B to
14         print a bfd name, not %A.
15
16 2015-02-26  Alan Modra  <amodra@gmail.com>
17
18         * elf64-ppc.c (plt_stub_size, build_plt_stub): Don't build
19         thread-safe stubs for iplt.
20         (build_tls_get_addr_stub): Restore r2 immediately after call.
21
22 2015-02-26  Terry Guo  <terry.guo@arm.com>
23
24         * elf32-arm.c (elf32_arm_merge_eabi_attributes): Update how we
25         merge Tag_ABI_HardFP_use.
26
27 2015-02-26  Alan Modra  <amodra@gmail.com>
28
29         * elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Heed -z nocopyreloc.
30         Use text relocs rather than giving an error on trying to use
31         .dynbss for protected shared lib vars.
32         * elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Likewise.
33
34 2015-02-25  Andrew Burgess  <andrew.burgess@embecosm.com>
35
36         * elf32-avr.c (struct elf_avr_section_data): New structure.
37         (struct avr_relax_info): New structure.
38         (elf_avr_new_section_hook): New function.
39         (struct elf_avr_section_data): Add relax_info.
40         (get_avr_relax_info): New function.
41         (init_avr_relax_info): New function.
42         (elf32_avr_relax_delete_bytes): Find next property record before
43         deleting bytes.  When deleting don't move bytes beyond the next
44         property record.
45         (avr_elf32_assign_records_to_section): New function.
46         (avr_property_record_compare): New function.
47         (avr_load_all_property_sections): New function.
48         (elf32_avr_relax_section): Load property data.  After relaxing the
49         section, move any .align directives that have enough deleted bytes
50         before them.
51         (bfd_elf32_new_section_hook): Define.
52
53 2015-02-25  Andrew Burgess  <andrew.burgess@embecosm.com>
54
55         * elf32-avr.h (struct avr_property_header): New strucure.
56         (avr_elf32_load_property_records): Declare.
57         (avr_elf32_property_record_name): Declare.
58         * elf32-avr.c: Add bfd_stdint.h include.
59         (retrieve_local_syms): New function.
60         (get_elf_r_symndx_section): New function.
61         (get_elf_r_symndx_offset): New function.
62         (internal_reloc_compare): New function.
63         (struct avr_find_section_data): New structure.
64         (avr_is_section_for_address): New function.
65         (avr_find_section_for_address): New function.
66         (avr_elf32_load_records_from_section): New function.
67         (avr_elf32_load_property_records): New function.
68         (avr_elf32_property_record_name): New function.
69
70 2015-02-25  Andrew Burgess  <andrew.burgess@embecosm.com>
71
72         * elf32-avr.h (AVR_PROPERTY_RECORD_SECTION_NAME): Define.
73         (AVR_PROPERTY_RECORDS_VERSION): Define.
74         (AVR_PROPERTY_SECTION_HEADER_SIZE): Define.
75         (struct avr_property_record): New structure.
76
77 2015-02-24  Nick Clifton  <nickc@redhat.com>
78
79         * elf32-v850.c (v850_set_note): New function.  Creates a Renesas
80         style note entry.
81         (v850_elf_make_note_section): New function.  Creates a note
82         section.
83         (v850_elf_create_sections): New function.  Create a note section
84         if one is not already present.
85         (v850_elf_set_note): New function.  Adds a note to a bfd.
86         (v850_elf_copy_private_bfd_data): New function.  Copies V850
87         notes.
88         (v850_elf_merge_notes): New function.  Merges V850 notes.
89         (print_v850_note): New function.  Displays a V850 note.
90         (v850_elf_print_notes): New function. Displays all notes attached
91         to a bfd.
92         (v850_elf_merge_private_bfd_data): Call v850_elf_merge_notes.
93         (v850_elf_print_private_bfd_data): Call v850_elf_print_notes.
94         (v850_elf_fake_sections): Set the type of the V850 note section.
95         * bfd-in.h (v850_elf_create_sections): Add prototype.
96         (v850_elf_set_note): Add prototype.
97         * bfd-in2.h: Regenerate.
98
99 2015-02-24  Nick Clifton  <nickc@redhat.com>
100
101         * configure.ac (AC_CHECK_HEADERS): Add wctype.h.
102         * configure: Regenerate.
103         * config.in: Regenerate.
104         * peXXigen.c: Include wctype.h if HAVE_WCTYPE_H is defined.
105         (u16_mbtowc): Use wint_t types if HAVE_WCTYPE_H is defined.
106         (rsrc_cmp): Use towlower instead of wcsncasecmp if HAVE_WCTYPE_H
107         is defined.
108
109 2015-02-24  Nick Clifton  <nickc@redhat.com>
110
111         * pdp11.c (set_section_contents): Pad the .text and .data sections
112         to their aligned sizes.
113
114 2015-02-23  Yoshinori Sato <ysato@users.sourceforge.jp>
115
116         * config.bfd: Add h8300-*-linux.
117         * configure.ac: Add h8300_elf32_linux_vec.
118         * configure: Regenerate.
119         * elf32-h8300.c: Likewise.
120         * targets.c(_bfd_target_vector): Likewise.
121
122 2015-02-23  Nick Clifton  <nickc@redhat.com>
123
124         PR 17914
125         * cpu-w65.c: Correct typos in license notice.
126
127         PR 17940
128         * elf32-msp430.c (msp430_elf_relax_delete_bytes): Adjust debug
129         symbols at end of sections.  Adjust function sizes.
130
131 2015-02-20  Andreas Arnez  <arnez@linux.vnet.ibm.com>
132
133         * elf-bfd.h (elfcore_write_s390_vxrs_low): Add prototype.
134         (elfcore_write_s390_vxrs_high): Likewise.
135         * elf.c (elfcore_grok_s390_vxrs_low): New function.
136         (elfcore_grok_s390_vxrs_high): New function.
137         (elfcore_grok_note): Call them.
138         (elfcore_write_s390_vxrs_low): New function.
139         (elfcore_write_s390_vxrs_high): New function.
140         (elfcore_write_register_note): Call them.
141
142 2015-02-19  Branko Drevensek  <branko.drevensek@gmail.com>
143
144         PR 17995
145         * verilog.c (verilog_write_record): Correct buffer size.
146
147 2015-02-19  Alan Modra  <amodra@gmail.com>
148
149         * elflink.c (_bfd_elf_define_linkage_sym): Set 'bed' earlier.
150
151 2015-02-19  Alan Modra  <amodra@gmail.com>
152
153         PR ld/4317
154         * elflink.c (elf_link_input_bfd): Drop undefined local syms.
155         (elf_link_output_extsym): Drop local and global undefined syms.
156         Tidy.  Expand comment.
157
158 2015-02-17  Alan Modra  <amodra@gmail.com>
159
160         PR ld/17975
161         * elflink.c (struct elf_outext_info): Remove need_second_pass
162         and second_pass.
163         (elf_link_output_extsym): Delete code handling second forced
164         local pass.  Move code emitting NULL STT_FILE symbol later, so
165         that it can be omitted if forced local is stripped.  Don't
166         emit the NULL STT_FILE if no file symbols have been output.
167         (bfd_elf_final_link): Remove second forced local pass.
168         * elf32-ppc.c (add_stub_sym): Set linker_def on linker syms.
169         (ppc_elf_size_dynamic_sections): Likewise.
170         * elf64-ppc.c (ppc_build_one_stub): Likewise.
171         (build_global_entry_stubs): Likewise.
172         (ppc64_elf_build_stubs): Likewise.
173
174 2015-02-16  H.J. Lu  <hongjiu.lu@intel.com>
175
176         PR ld/17975
177         * elflink.c (elf_link_output_extsym): Only check filesym_count
178         when outputting a NULL FILE symbol.  Set second_pass_sym to
179         h->forced_local && !h->root.linker_def.
180
181 2015-02-15  H.J. Lu  <hongjiu.lu@intel.com>
182
183         * elf32-i386.c (elf_i386_always_size_sections): Set root.linker_def
184         on _TLS_MODULE_BASE_.
185         * elf64-x86-64.c (elf_x86_64_always_size_sections): Likewise.
186
187 2015-02-15  Alan Modra  <amodra@gmail.com>
188
189         * dwarf2.c (read_rangelist): Correct buffer overflow check
190         Whitespace throughout file.
191
192 2015-02-14  Alan Modra  <amodra@gmail.com>
193
194         PR ld/17973
195         * bfd.c (struct bfd): Add lto_output.
196         * linker.c (_bfd_handle_already_linked): Explicitly test for
197         objects added by the lto plugin.
198         * opncls.c (_bfd_new_bfd_contained_in): Copy lto_output and
199         no_export flags from archive.
200         * archive.c (open_nested_file): New function, setting lto_output
201         and no_export, extracted from..
202         (find_nested_archive): ..here.  Flip params.  Rename from
203         _bfd_find_nested_archive.
204         (_bfd_get_elt_at_filepos): Correct var typo.  Use open_nested_file.
205         (_bfd_look_for_bfd_in_cache): Copy no_export.
206         * elflink.c (elf_link_add_object_symbols): Remove now unnecessary
207         my_archive->no_export test.
208         (elf_link_input_bfd): Drop existing lto_output STT_FILE syms.
209         Don't use the file name when adding lto_output STT_FILE sym.
210         * bfd-in2.h: Regenerate.
211
212 2015-02-13  Alan Modra  <amodra@gmail.com>
213
214         PR binutils/17512
215         * elf64-ppc.c (opd_entry_value): Tighten offset check.  Remove
216         now redundant assert.
217
218 2015-02-12  Nick Clifton  <nickc@redhat.com>
219
220         PR binutils/17512
221         * dwarf.c (read_1_byte, read_1_signed_byte, read_2_bytes)
222         (read_4_bytes, read_8_bytes, read_n_bytes, read_string)
223         (read_indirect_string, read_alt_indirect_string)
224         (read_alt_indirect_ref, read_address, read_abbrevs)
225         (read_attribute_value, read_attribute, decode_line_info)
226         (find_abstract_instance_name, read_rangelist)
227         (scan_unit_for_symbols, parse_comp_unit)
228         (_bfd_dwarf2_find_nearest_line): Harden DWARF reading code.  Pass
229         end pointers to reading functions and check for offsets taking
230         pointers out of range.  Replace calls to read_*_leb128 with calls
231         to safe_read_leb128.
232
233         (* elf64-ppc.c (opd_entry_value): Add a check for an overlarge
234         offset.
235         * syms.c (_bfd_stab_section_find_nearest_line): Add checks for
236         computed file_name address being before the start of the string
237         table.
238
239 2015-02-11  H.J. Lu  <hongjiu.lu@intel.com>
240
241         PR ld/17878
242         * bfd.c (bfd_plugin_format): New.
243         (bfd): Add plugin_format and plugin_dummy_bfd.
244         * plugin.c (try_load_plugin): Take a pointer to bfd_boolean
245         argument to return TRUE if any plugin is found.  Set plugin_format.
246         (has_plugin): New.
247         (bfd_plugin_target_p): New.
248         (bfd_plugin_specified_p): Likewise.
249         (bfd_plugin_target_p): Likewise.
250         (register_ld_plugin_object_p): Likewise.
251         (bfd_plugin_set_plugin): Set has_plugin.
252         (load_plugin): Cache try_load_plugin result.
253         (bfd_plugin_object_p): Try ld_plugin_object_p first.  Check
254         plugin_format.
255         * plugin.h (bfd_plugin_target_p): New.
256         (bfd_plugin_specified_p): Likewise.
257         (register_ld_plugin_object_p): Likewise.
258         * bfd-in2.h: Regenerated.
259
260 2015-02-11  Pedro Alves  <palves@redhat.com>
261
262         * libbfd-in.h [__cplusplus]: Open extern "C" scope.
263         * libcoff-in.h [__cplusplus]: Open extern "C" scope.
264         * libbfd.h: Regenerate.
265         * libcoff.h: Regenerate.
266
267         * elf-bfd.h [__cplusplus]: Wrap in extern "C".
268         * mach-o.h [__cplusplus]: Wrap in extern "C".
269         * som.h [__cplusplus]: Wrap in extern "C".
270
271 2015-02-10  Nick Clifton  <nickc@redhat.com>
272
273         PR binutils/17512
274         * coffcode.h (styp_to_sec_flags): Use an unsigned long type to
275         hold the flag bits.
276         * peXXigen.c (pe_print_reloc): Use unsigned types to hold the
277         size and number of relocs.
278         (pe_print_debugdata): Use a 32-bit aligned buffer to store the
279         codeview record.
280         * versados.c (process_otr): Check the esdid value before using it
281         to access the EDATA.
282
283 2015-02-09  Ed Maste  <emaste@freebsd.org>
284
285         * elf32-i386.c (elf_i386_get_plt_sym_val): Avoid incrementing
286         uninitialized and unused variable.
287         * elf64-x86-64.c (elf_x86_64_get_plt_sym_val): Likewise.
288
289 2015-02-09  Alan Modra  <amodra@gmail.com>
290
291         * elf32-ppc.c (ppc_elf_relocate_section): Don't segfault on NULL
292         tls_sec.
293         * elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
294         * elflink.c (elf_link_output_extsym): Don't assert on NULL tls_sec.
295
296 2015-02-09  Alan Modra  <amodra@gmail.com>
297
298         * elflink.c: Whitespace, formatting fixes.
299         (elf_link_input_bfd): Clarify comment.
300         (elf_link_output_extsym): Exclude symbols in linker created
301         sections when testing for plugin symbols.
302
303 2015-02-07  H.J. Lu  <hongjiu.lu@intel.com>
304
305         PR ld/17935
306         * elf32-i386.c (elf_i386_readonly_dynrelocs): Also issue a
307         warning for relocation in readonly section for -z text.
308         (elf_i386_size_dynamic_sections): Likewise.
309         * elf64-x86-64.c (elf_x86_64_readonly_dynrelocs): Likewise.
310         (elf_x86_64_size_dynamic_sections): Likewise.
311
312 2015-02-06  H.J. Lu  <hongjiu.lu@intel.com>
313
314         PR ld/12365
315         PR ld/14272
316         * elflink.c (_bfd_elf_fix_symbol_flags): Revert the last change.
317         (elf_link_input_bfd): Mark the plugin symbol undefined if it is
318         referenced from a non-IR file.
319
320 2015-02-06  Nick Clifton  <nickc@redhat.com>
321
322         PR binutils/17512
323         * peXXigen.c (rsrc_print_resource_entries): Add range check for
324         addresses that wrap around the address space.
325         (rsrc_parse_entry): Likewise.
326
327 2015-02-03  H.J. Lu  <hongjiu.lu@intel.com>
328
329         PR ld/12365
330         PR ld/14272
331         * elflink.c (_bfd_elf_fix_symbol_flags): Mark the plugin symbol
332         undefined if it is referenced from a non-IR file.
333
334 2015-02-03  Nick Clifton  <nickc@redhat.com>
335
336         PR binutils/17512
337         * ecoff.c: Use bfd_alloc2 to allocate space for structure arrays.
338         (_bfd_ecoff_slurp_symbol_table): Check for a negative symbol
339         index or an out of range fdr index.
340         * elf-m10300.c (mn10300_info_to_howto): Fix typo in error message.
341         * elf32-arc.c (arc_info_to_howto_rel): Likewise.
342         * elf32-avr.c (avr_info_to_howto_rela): Likewise.
343         * elf32-cr16.c (elf_cr16_info_to_howto): Likewise.
344         * elf32-cr16c.c (elf_cr16c_info_to_howto_rel): Likewise.
345         * elf32-cris.c (cris_info_to_howto_rela): Likewise.
346         * elf32-crx.c (elf_crx_info_to_howto): Likewise.
347         * elf32-d10v.c (d10v_info_to_howto_rel): Likewise.
348         * elf32-d30v.c (d30v_info_to_howto_rel): Likewise.
349         * elf32-epiphany.c (epiphany_info_to_howto_rela): Likewise.
350         * elf32-fr30.c (fr30_info_to_howto_rela): Likewise.
351         * elf32-frv.c (frv_info_to_howto_rela): Likewise.
352         * elf32-i370.c (i370_elf_info_to_howto): Likewise.
353         * elf32-i960.c (elf32_i960_info_to_howto_rel): Likewise.
354         * elf32-ip2k.c (ip2k_info_to_howto_rela): Likewise.
355         * elf32-iq2000.c (iq2000_info_to_howto_rela): Likewise.
356         * elf32-lm32.c (lm32_info_to_howto_rela): Likewise.
357         * elf32-m32c.c (m32c_info_to_howto_rela): Likewise.
358         * elf32-m32r.c (m32r_info_to_howto_rel): Likewise.
359         * elf32-m68hc11.c (m68hc11_info_to_howto_rel): Likewise.
360         * elf32-m68hc12.c (m68hc11_info_to_howto_rel): Likewise.
361         * elf32-mcore.c (mcore_elf_info_to_howto): Likewise.
362         * elf32-mep.c (mep_info_to_howto_rela): Likewise.
363         * elf32-metag.c (metag_info_to_howto_rela): Likewise.
364         * elf32-microblaze.c (microblaze_elf_info_to_howto): Likewise.
365         * elf32-moxie.c (moxie_info_to_howto_rela): Likewise.
366         * elf32-msp430.c (msp430_info_to_howto_rela): Likewise.
367         * elf32-mt.c (mt_info_to_howto_rela): Likewise.
368         * elf32-nds32.c (nds32_info_to_howto_rel): Likewise.
369         * elf32-or1k.c (or1k_info_to_howto_rela): Likewise.
370         * elf32-pj.c (pj_elf_info_to_howto): Likewise.
371         * elf32-ppc.c (ppc_elf_info_to_howto): Likewise.
372         * elf32-rl78.c (rl78_info_to_howto_rela): Likewise.
373         * elf32-rx.c (rx_info_to_howto_rela): Likewise.
374         * elf32-sh.c (sh_elf_info_to_howto): Likewise.
375         * elf32-spu.c (spu_elf_info_to_howto): Likewise.
376         * elf32-v850.c (v850_elf_perform_relocation): Likewise.
377         * elf32-vax.c (rtype_to_howto): Likewise.
378         * elf32-visium.c (visium_info_to_howto_rela): Likewise.
379         * elf32-xgate.c (xgate_info_to_howto_rel): Likewise.
380         * elf32-xtensa.c (elf_xtensa_info_to_howto_rela): Likewise.
381         * elf64-alpha.c (elf64_alpha_info_to_howto): Likewise.
382         * elf64-mmix.c (mmix_info_to_howto_rela): Likewise.
383         * mach-o.c: Use bfd_alloc2 to allocate space for structure arrays.
384         (bfd_mach_o_canonicalize_one_reloc): Fix check on out
385         of range symbol indicies.
386         (bfd_mach_o_canonicalize_relocs): Check for out of range alloc.
387         (bfd_mach_o_canonicalize_dynamic_reloc): Likewise.
388         (bfd_mach_o_build_dysymtab): Likewise.
389         (bfd_mach_o_write_symtab_content): Set the string table size to
390         zero upon error.
391         (bfd_mach_o_read_symtab_symbols): Reset the nsyms value if the
392         read fails.
393         * peXXigen.c (pe_print_edata):  Check for numeric overflow in edt
394         fields.
395         * tekhex.c (first_phase): Check for src pointer reaching end of
396         buffer.
397
398 2015-02-03  Will Newton  <will.newton@linaro.org>
399
400         * elfnn-aarch64.c (elfNN_aarch64_finish_dynamic_symbol):
401         Set st_value to zero for undefined symbols if the reference
402         is weak or pointer_equality_needed is FALSE.
403
404         * elf32-arm.c (elf32_arm_finish_dynamic_symbol): Improve
405           comment discussing why we clear st_value for some symbols.
406
407 2015-02-02  Kuan-Lin Chen  <kuanlinchentw@gmail.com>
408
409         * elf32-nds32.c (nds32_get_section_contents): Add one more argument.
410         (nds32_elf_relocate_section): Do not relocate R_NDS32_LONGJUMP7.
411
412 2015-01-29  Alan Modra  <amodra@gmail.com>
413
414         * elf64-ppc.c (ppc64_elf_relocate_section): Correct GOT_TLSLD
415         optimization.  Tidy mask for GOT_TLSGD optimization.
416         * elf32-ppc.c (ppc_elf_relocate_section): Likewise.  Correct
417         location of nop zapping high insn too.
418
419 2015-01-28  Alan Modra  <amodra@gmail.com>
420
421         * elf64-ppc.h (struct ppc64_elf_params): Add "object_in_toc".
422         * elf64-ppc.c (ppc64_elf_add_symbol_hook): Assume that global symbols
423         in .toc indicate xlc compiled code that might require a rw .toc.
424
425 2015-01-28  James Bowman  <james.bowman@ftdichip.com>
426
427         * Makefile.am: Add FT32 files.
428         * archures.c (enum bfd_architecture): Add bfd_arch_ft32.
429         (bfd_mach_ft32): Define.
430         (bfd_ft32_arch): Declare.
431         (bfd_archures_list): Add bfd_ft32_arch.
432         * config.bfd: Handle FT32.
433         * configure.ac: Likewise.
434         * cpu-ft32.c: New file.
435         * elf32-ft32.c: New file.
436         * reloc.c (BFD_RELOC_FT32_10, BFD_RELOC_FT32_20, BFD_RELOC_FT32_17,
437         BFD_RELOC_FT32_18): Define.
438         * targets.c (_bfd_target_vector): Add ft32_elf32_vec.
439         * bfd-in2.h: Regenerate.
440         * libbfd.h: Regenerate.
441         * Makefile.in: Regenerate.
442         * configure: Regenerate.
443         * po/SRC-POTFILES.in: Regenerate.
444
445 2015-01-27  Nick Clifton  <nickc@redhat.com>
446
447         PR binutils/17512
448         * pdp11.c (aout_get_external_symbols): Return false if there are
449         no symbols.
450
451         * dwarf2.c (concat_filename): Check for an empty directory table.
452         (scan_unit_for_symbols): Check for reading off the end of the
453         unit.
454         (parse_comp_unit): Check for a DW_AT_comp_dir attribute with a
455         non-string form.
456         * elf64-ppc.c (opd_entry_value): Fail if there are no relocs
457         available.
458
459 2015-01-26  Kuan-Lin Chen  <kuanlinchentw@gmail.com>
460
461         * elf32-nds32.c (nds32_elf_pick_relax): Fix again setting.
462
463 2015-01-22  DJ Delorie  <dj@redhat.com>
464
465         * elf32-m32c.c (m32c_apply_reloc_24): New.
466         (m32c_elf_howto_table): Use it for R_M32C_24.
467         (m32c_elf_relocate_section): Handle R_M32C_24 specially.
468
469 2015-01-22  Nick Clifton  <nickc@redhat.com>
470
471         PR binutils/17512
472         * coffcode.h (handle_COMDAT): When searching for the section
473         symbol, make sure that there is space left in the symbol table.
474         * vms-alpha.c (_bfd_vms_slurp_ehdr): Add range checks.
475
476 2015-01-21  Nick Clifton  <nickc@redhat.com>
477
478         PR binutils/17512
479         * coffcode.h (coff_set_arch_mach_hook): Check return value from
480         bfd_malloc.
481         (coff_slurp_line_table): Return FALSE if the line number
482         information was corrupt.
483         (coff_slurp_symbol_table): Return FALSE if the symbol information
484         was corrupt.
485         * mach-o.c (bfd_mach_o_bfd_copy_private_header_data): Always
486         initialise the fields of the dyld_info structure.
487         (bfd_mach_o_build_exec_seg_command): Replace assertion with an
488         error message and a return value.
489         (bfd_mach_o_layout_commands): Change the function to boolean.
490         Return FALSE if the function fails.
491         (bfd_mach_o_build_commands): Fail if bfd_mach_o_layout_commands
492         fails.
493         (bfd_mach_o_read_command): Fail if an unrecognised command is
494         encountered.
495         * peXXigen.c (_bfd_XXi_swap_aouthdr_in): Set bfd_error if the
496         read fails.
497         (slurp_symtab): Check the return from bfd_malloc.
498         (_bfd_XX_bfd_copy_private_bfd_data_common): Fail if the copy
499         encountered an error.
500         (_bfd_XXi_final_link_postscript): Fail if a section could not be
501         copied.
502         * peicode.h (pe_bfd_object_p): Fail if the header could not be
503         swapped in.
504         * tekhex.c (first_phase): Fail if the section is too big.
505         * versados.c (struct esdid): Add content_size field.
506         (process_otr): Use and check the new field.
507         (versados_get_section_contents): Check that the section exists and
508         that the requested data is available.
509
510 2015-01-20  Chung-Lin Tang  <cltang@codesourcery.com>
511
512         * elf32-nios2.c (elf_backend_default_execstack): Define as 0.
513
514 2015-01-20  Alan Modra  <amodra@gmail.com>
515
516         PR ld/17615
517         * elf64-ppc.c (ppc64_elf_gc_mark_dynamic_ref): Don't drop
518         ELF_COMMON_DEF syms.
519
520 2015-01-19  Alan Modra  <amodra@gmail.com>
521
522         PR ld/17615
523         * elf-bfd.h (ELF_COMMON_DEF_P): Note that this might be true for
524         linker script assignments too.
525         * elflink.c (elf_gc_sweep_symbol): Don't drop ELF_COMMON_DEF syms.
526         (bfd_elf_gc_mark_dynamic_ref_symbol): Similarly.
527
528 2015-01-19  Alan Modra  <amodra@gmail.com>
529
530         * elf32-bfin.c (bfin_bfd_reloc_type_lookup): Correct loop iteration
531         to allow return of first howto.
532         * elf32-fr30.c (fr30_reloc_type_lookup): Likewise.
533         * elf32-m32c.c (m32c_reloc_type_lookup): Likewise.
534         * elf32-moxie.c (moxie_reloc_type_lookup): Likewise.
535         * elf32-or1k.c (or1k_reloc_type_lookup): Likewise.
536         * elf32-rl78.c (rl78_reloc_type_lookup): Likewise.
537         * elf32-rx.c (rx_reloc_type_lookup): Likewise.
538         * elf32-tilepro.c (tilepro_reloc_type_lookup): Likewise.
539         * elf32-xstormy16.c (xstormy16_reloc_type_lookup): Likewise.
540         * elfxx-tilegx.c (tilegx_reloc_type_lookup): Likewise.
541         * elf32-nios2.c (nios2_reloc_map): Add mapping for R_NIOS2_NONE.
542         * elf32-spu.c (spu_elf_bfd_to_reloc_type): Allow return of R_SPU_NONE.
543         (spu_elf_reloc_type_lookup): Adjust to suit.
544
545 2015-01-19  Alan Modra  <amodra@gmail.com>
546
547         * bfd-in.h (bfd_get_section_limit_octets): New define, extracted from..
548         (bfd_get_section_limit): ..here.
549         * reloc.c (bfd_perform_relocation): Correct bfd_reloc_outofrange check.
550         (bfd_install_relocation, _bfd_final_link_relocate): Add same check here.
551         * elf32-sh.c (sh_elf_reloc): Correct bfd_reloc_outofrange check.
552         * elf32-ppc.c (ppc_elf_addr16_ha_reloc): Remove duplicated
553         bfd_reloc_outofrange check.
554         * bfd-in2.h: Regenerate.
555
556         * cpu-ns32k.c (_bfd_do_ns32k_reloc_contents): Return bfd_reloc_ok
557         on zero size relocs.
558         * ecoff.c (ecoff_reloc_link_order): Likewise.
559         * elf32-nds32.c (nds32_relocate_contents): Likewise.
560         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.
561
562         * reloc.c (_bfd_relocate_contents): Don't bomb on zero size relocs.
563         (_bfd_clear_contents): Likewise.
564         * elfxx-mips.c (mips_elf_obtain_contents): Likewise.
565         (mips_elf_perform_relocation): Likewise.
566
567         * aoutx.h (aout_link_reloc_link_order): Allow for NULL return
568         from malloc on zero size alloc.
569         * cofflink.c (_bfd_coff_reloc_link_order): Likewise.
570         * elflink.c (elf_reloc_link_order): Likewise.
571         * linker.c (_bfd_generic_reloc_link_order): Likewise.
572         * pdp11.c (aout_link_reloc_link_order): Likewise.
573         * xcofflink.c (xcoff_reloc_link_order): Likewise.
574
575         * aoutx.h (howto_table_ext): Ensure NONE relocs have size 3,
576         bitsize 0, and complain_overflow_dont.
577         * coff-sparc.c (coff_sparc_howto_table): Likewise.
578         * elf-hppa.h (elf_hppa_howto_table): Likewise.
579         * elf-m10200.c (elf_mn10200_howto_table): Likewise.
580         * elf-m10300.c (elf_mn10300_howto_table): Likewise.
581         * elf32-arc.c (elf_arc_howto_table): Likewise.
582         * elf32-arm.c (elf32_arm_howto_table_1): Likewise.
583         * elf32-avr.c (elf_avr_howto_table): Likewise.
584         * elf32-bfin.c (bfin_howto_table): Likewise.
585         * elf32-cr16.c (cr16_elf_howto_table): Likewise.
586         * elf32-cris.c (cris_elf_howto_table): Likewise.
587         * elf32-crx.c (crx_elf_howto_table): Likewise.
588         * elf32-d10v.c (elf_d10v_howto_table): Likewise.
589         * elf32-d30v.c (elf_d30v_howto_table): Likewise.
590         * elf32-dlx.c (dlx_elf_howto_table): Likewise.
591         * elf32-epiphany.c (epiphany_elf_howto_table): Likewise.
592         * elf32-fr30.c (fr30_elf_howto_table): Likewise.
593         * elf32-frv.c (elf32_frv_howto_table): Likewise.
594         * elf32-h8300.c (h8_elf_howto_table): Likewise.
595         * elf32-i370.c (i370_elf_howto_raw): Likewise.
596         * elf32-i386.c (elf_howto_table): Likewise.
597         * elf32-i860.c (elf32_i860_howto_table): Likewise.
598         * elf32-i960.c (elf32_i960_relocate): Likewise.
599         * elf32-ip2k.c (ip2k_elf_howto_table): Likewise.
600         * elf32-iq2000.c (iq2000_elf_howto_table): Likewise.
601         * elf32-lm32.c (lm32_elf_howto_table): Likewise.
602         * elf32-m32c.c (m32c_elf_howto_table): Likewise.
603         * elf32-m32r.c (m32r_elf_howto_table): Likewise.
604         * elf32-m68hc11.c (elf_m68hc11_howto_table): Likewise.
605         * elf32-m68hc12.c (elf_m68hc11_howto_table): Likewise.
606         * elf32-m68k.c (howto_table): Likewise.
607         * elf32-mcore.c (mcore_elf_howto_raw): Likewise.
608         * elf32-mep.c (mep_elf_howto_table): Likewise.
609         * elf32-metag.c (elf_metag_howto_table): Likewise.
610         * elf32-microblaze.c (microblaze_elf_howto_raw): Likewise.
611         * elf32-mips.c (elf_mips_howto_table_rel): Likewise.
612         * elf32-moxie.c (moxie_elf_howto_table): Likewise.
613         * elf32-msp430.c (elf_msp430_howto_table): Likewise.
614         * elf32-mt.c (mt_elf_howto_table): Likewise.
615         * elf32-nds32.c (nds32_elf_howto_table): Likewise.
616         * elf32-nios2.c (elf_nios2_howto_table_rel): Likewise.
617         * elf32-or1k.c (or1k_elf_howto_table): Likewise.
618         * elf32-pj.c (pj_elf_howto_table): Likewise.
619         * elf32-ppc.c (ppc_elf_howto_raw): Likewise.
620         * elf32-rl78.c (rl78_elf_howto_table): Likewise.
621         * elf32-rx.c (rx_elf_howto_table): Likewise.
622         * elf32-s390.c (elf_howto_table): Likewise.
623         * elf32-score.c (elf32_score_howto_table): Likewise.
624         * elf32-score7.c (elf32_score_howto_table): Likewise.
625         * elf32-sh-relocs.h (R_SH_NONE): Likewise.
626         * elf32-spu.c (elf_howto_table): Likewise.
627         * elf32-tic6x.c (elf32_tic6x_howto_table): Likewise.
628         * elf32-tilepro.c (tilepro_elf_howto_table): Likewise.
629         * elf32-v850.c (v850_elf_howto_table): Likewise.
630         * elf32-vax.c (howto_table): Likewise.
631         * elf32-visium.c (visium_elf_howto_table): Likewise.
632         * elf32-xc16x.c (xc16x_elf_howto_table): Likewise.
633         * elf32-xgate.c (elf_xgate_howto_table): Likewise.
634         * elf32-xstormy16.c (xstormy16_elf_howto_table): Likewise.
635         * elf32-xtensa.c (elf_howto_table): Likewise.
636         * elf64-alpha.c (elf64_alpha_howto_table): Likewise.
637         * elf64-mips.c (mips_elf64_howto_table_rel): Likewise.
638         * elf64-mmix.c (elf_mmix_howto_table): Likewise.
639         * elf64-ppc.c (ppc64_elf_howto_raw): Likewise.
640         * elf64-s390.c (elf_howto_table): Likewise.
641         * elf64-sh64.c (sh_elf64_howto_table): Likewise.
642         * elf64-x86-64.c (x86_64_elf_howto_table): Likewise.
643         * elfn32-mips.c (elf_mips_howto_table_rel): Likewise.
644         * elfnn-aarch64.c (elfNN_aarch64_howto_table): Likewise.
645         (elfNN_aarch64_howto_none): Likewise.
646         * elfxx-ia64.c (ia64_howto_table): Likewise.
647         * elfxx-sparc.c (_bfd_sparc_elf_howto_table): Likewise.
648         * elfxx-tilegx.c (tilegx_elf_howto_table): Likewise.
649         * nlm32-sparc.c (nlm32_sparc_howto_table): Likewise.
650
651 2015-01-15  H.J. Lu  <hongjiu.lu@intel.com>
652
653         PR ld/17847
654         * elf64-x86-64.c (elf_x86_64_relocate_section): Don't complain
655         about -fPIC if the symbol is undefined when building executable.
656
657 2015-01-15  Nick Clifton  <nickc@redhat.com>
658
659         PR binutils/17512
660         * elf-m10300.c (mn10300_info_to_howto): Replace assertion with an
661         error message.  Never return an invalid howto pointer.
662         * elf32-cr16.c (cr16_info_to_howto): Likewise.
663         * elf32-crx.c (elf_crx_info_to_howto): Likewise.
664         * elf32-i370.c (i370_elf_info_to_howto): Likewise.
665         * elf32-mcore.c (mcore_elf_info_to_howto): Likewise.
666         * elf32-microblaze.c (microblaze_elf_info_to_howto): Likewise.
667         * elf32-mips.c (mips_elf32_rtype_to_howto): Likewise.
668         * elf32-pj.c (pj_elf_info_to_howto): Likewise.
669         * elf32-ppc.c (ppc_elf_info_to_howto): Likewise.
670         * elf32-spu.c (spu_elf_info_to_howto): Likewise.
671         * elf32-v850.c (v850_elf_info_to_howto_rela): Likewise.
672         * elf32-vax.c (rtype_to_howto): Likewise.
673         * elf64-alpha.c (elf64_alpha_info_to_howto): Likewise.
674         * elf64-mips.c (mips_elf64_rtype_to_howto): Likewise.
675         * elfn32-mips.c (sh_elf_info_to_howto): Likewise.
676         * elf32-sh.c (sh_elf_info_to_howto): Likewise.
677         (sh_elf_reloc): Check that the reloc is in range.
678         * reloc.c (bfd_perform_relocation): Check that the section is big
679         enough for the entire reloc.
680         (bfd_generic_get_relocated_section_contents): Report unexpected
681         return values from perform_reloc.
682
683 2015-01-15  Nick Clifton  <nickc@redhat.com>
684
685         * elf32-msp430.c (msp430_elf_relax_section): Skip unhandled
686         relocs.  Include PC-relative adjustment for R_MSP430X_ABS16
687         relaxation.
688
689 2015-01-15  Alan Modra  <amodra@gmail.com>
690
691         * elflink.c (_bfd_elf_link_omit_section_dynsym): Return true for
692         any output section matching a linker created dynobj section.
693
694 2015-01-15  Alan Modra  <amodra@gmail.com>
695
696         PR 17842
697         * elflink.c (elf_link_output_sym): Assert elf_onesymtab set.
698         (bfd_elf_final_link): Always create a symbol table when emit_relocs.
699         Don't assign symtab file position unless symbols will be output.
700         Merge blocks with condition in common.  Don't call
701         elf_backend_output_arch_local_syms or elf_backend_output_arch_syms
702         unless other symbols are output.  Move assignment of symtab_shndx
703         file position.  Localize variable.
704
705 2015-01-14  Jiong Wang  <jiong.wang@arm.com>
706
707         * elf32-arm.c (elf32_arm_final_link_relocate): Reject R_ARM_32/_NOI when
708         trying to defer them to runtime.
709
710 2015-01-13  Thomas Preud'homme <thomas.preudhomme@arm.com>
711
712         * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Use SYMBOLIC_BIND
713         to check if a symbol should be bound symbolically.
714
715 2015-01-13  Jiong Wang  <jiong.wang@arm.com>
716
717         * elfnn-aarch64.c: (elfNN_aarch64_howto_table): Enable overflow check
718         for TLSLE_MOVW_TPREL_G2.
719
720 2015-01-13  Jiong Wang  <jiong.wang@arm.com>
721
722         PR ld/17415
723         * elfnn-aarch64.c (elfNN_aarch64_howto_table): Mark
724         R_AARCH64_TLSLE_ADD_TPREL_HI12 as complain_overflow_unsigned.
725         * elfxx-aarch64.c (_bfd_aarch64_elf_resolve_relocation): Correct the
726         bit mask.
727
728 2015-01-12  Terry Guo  <terry.guo@arm.com>
729
730         * elflink.c (_bfd_elf_gc_mark_debug_special_section_group): New
731         function.
732         (_bfd_elf_gc_mark_extra_sections): Use it.
733
734 2015-01-11  H.J. Lu  <hongjiu.lu@intel.com>
735
736         PR ld/17827
737         * elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): For PIE,
738         only discard space for pc-relative relocs symbols which turn
739         out to need copy relocs.
740
741 2015-01-09  Nick Clifton  <nickc@redhat.com>
742
743         * tekhex.c (getvalue): Fix thinko in test for correct extraction
744         of value.
745         (getsym): Return false if there was not enough data to extract the
746         symbol.
747
748 2015-01-09  Anthony Green  <green@moxielogic.com>
749
750         * elf32-moxie.c (ELF_MACHINE_ALT1): Define.
751
752 2015-01-08  Nick Clifton  <nickc@redhat.com>
753
754         * elf32-msp430.c (msp430_elf_relax_section): Add relaxation of
755         16-bit absolute BR instructions to 10-bit pc-relative JMP
756         instructions.
757
758 2015-01-08  Nick Clifton  <nickc@redhat.com>
759
760         PR binutils/17512
761         * coffcode.h (coff_slurp_symbol_table): Return false if we failed
762         to load the line table.
763         * elf.c (_bfd_elf_map_sections_to_segments): Enforce a minimum
764         maxpagesize of 1.
765         * peXXigen.c (_bfd_XX_bfd_copy_private_bfd_data_common): Fail if
766         the Data Directory Size is too large.
767
768 2015-01-06  H.J. Lu  <hongjiu.lu@intel.com>
769
770         PR binutils/17512
771         * elf32-i386.c (elf_i386_get_plt_sym_val): Skip unknown relocation.
772         * elf64-x86-64.c (elf_x86_64_get_plt_sym_val): Likewise.
773
774 2015-01-06  Nick Clifton  <nickc@redhat.com>
775
776         PR binutils/17512
777         * mach-o.c (bfd_mach_o_read_symtab_strtab): Zero terminate the
778         string table.
779
780         * reloc.c (bfd_get_reloc_size): Handle a reloc size of -1.
781         (bfd_perform_relocation): Include the size of the reloc in the
782         test for an out of range relocation.
783         (bfd_generic_get_relocated_section_contents): Remove reloc range
784         test.
785
786         * coff-i860.c (CALC_ADDEND): Always set an addend value.
787         * tekhex.c (getvalue): Add an end pointer parameter.  Use it to
788         avoid reading off the end of the buffer.
789         (getsym): Likewise.
790         (first_phase): Likewise.
791         (pass_over): Pass an end pointer to the invoked function.
792
793 2015-01-05  H.J. Lu  <hongjiu.lu@intel.com>
794
795         PR binutils/17512
796         * elf32-i386.c (elf_i386_get_plt_sym_val): Return NULL on corrupt
797         input.
798         * elf64-x86-64.c (elf_x86_64_get_plt_sym_val): Likewise.
799
800 2015-01-05  Nick Clifton  <nickc@redhat.com>
801
802         PR binutils/17512
803         * archive.c (do_slurp_bsd_armap): Make sure that the parsed sized
804         is at least big enough for the header to be read.
805         * elf32-i386.c (elf_i386_get_plt_sym_val): Skip unknown relocs.
806         * mach-o.c (bfd_mach_o_get_synthetic_symtab): Add range checks.
807         (bfd_mach_o_read_command): Prevetn duplicate error messages about
808         unrecognized commands.
809         * syms.c (_bfd_stab_section_find_nearest_line): Add range checks
810         when indexing into the string table.
811
812 2015-01-01  Alan Modra  <amodra@gmail.com>
813
814         Update year range in copyright notice of all files.
815
816 For older changes see ChangeLog-2014
817 \f
818 Copyright (C) 2015 Free Software Foundation, Inc.
819
820 Copying and distribution of this file, with or without modification,
821 are permitted in any medium without royalty provided the copyright
822 notice and this notice are preserved.
823
824 Local Variables:
825 mode: change-log
826 left-margin: 8
827 fill-column: 74
828 version-control: never
829 End: