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