S/390: ifunc: Fix function pointers to hidden ifunc symbols.
[external/binutils.git] / bfd / ChangeLog
1 2015-10-22  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
2
3         * elf32-s390.c (elf_s390_adjust_dynamic_symbol): Set the PLT
4         reference counters for local IFUNC calls.
5         * elf64-s390.c (elf_s390_adjust_dynamic_symbol): Likewise.
6
7 2015-10-22  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
8
9         * elf32-s390.c (elf_s390_check_relocs): Fallthrough to the PLT
10         slot allocating code for GOTOFF relocs on ifunc symbols.
11         (elf_s390_gc_sweep_hook): Decrement plt refcount for GOTOFF relocs
12         on ifunc symbols.
13         (elf_s390_relocate_section): Redirect a GOTOFF reloc to an iplt
14         slot.
15
16 2015-10-22  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
17
18         PR ld/18841
19         * elf32-s390.c (elf_s390_reloc_type_class): Return
20         reloc_class_ifunc for ifunc symbols.
21         * elf64-s390.c (elf_s390_reloc_type_class): Likewise.
22
23 2015-10-22  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
24
25         * elf32-s390.c (elf_s390_finish_dynamic_symbol): Call
26         elf_s390_finish_ifunc_symbol only for actually defined symbols.
27         * elf64-s390.c (elf_s390_finish_dynamic_symbol): Likewise.
28
29 2015-10-22  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
30
31         * elf-s390-common.c (s390_elf_allocate_ifunc_dyn_relocs): Remove
32         `head' parameter.
33         * elf32-s390.c (allocate_dynrelocs): Don't use last parameter.
34         * elf64-s390.c (allocate_dynrelocs): Don't use last parameter.
35
36 2015-10-20  Hans-Peter Nilsson  <hp@bitrange.com>
37
38         * mmo.c (mmo_write_symbols_and_terminator): Correct printed value
39         of Main in error message.
40
41 2015-10-18  Doug Evans  <xdje42@gmail.com>
42
43         * targets.c (bfd_flavour_name): "MMO" is spelled "mmo".
44
45 2015-10-17  Alan Modra  <amodra@gmail.com>
46
47         * elf64-ppc.c (ppc64_elf_size_stubs): Correct __glink_PLTresolve
48         eh_frame FDE for ELFv1.
49
50 2015-10-16  H.J. Lu  <hongjiu.lu@intel.com>
51
52         * elf32-i386.c (elf_i386_convert_mov_to_lea): Check if symbol
53         is defined.
54         * elf64-x86-64.c (elf_x86_64_convert_mov_to_lea): Likewise.
55
56 2015-10-16  H.J. Lu  <hongjiu.lu@intel.com>
57
58         * elf32-i386.c (elf_i386_convert_mov_to_lea): Don't check
59         def_regular.
60         * elf64-x86-64.c (elf_x86_64_convert_mov_to_lea): Likewise.
61
62 2015-10-15  H.J. Lu  <hongjiu.lu@intel.com>
63
64         * elflink.c (_bfd_elf_merge_symbol): Fix typos in comments
65
66 2015-10-15  Alan Modra  <amodra@gmail.com>
67
68         * elf32-v850.c (v850_elf_copy_private_bfd_data): Remove assertion
69         that input and output .note.renesas sections are same size.
70         Instead, only copy input to output if they are.
71
72 2015-10-15  Riku Voipio  <riku.voipio@iki.fi>
73
74         PR ld/19123
75         * elfcore.h (elf_core_file_p): Use the file_ptr type to hold the
76         offset for bfd_seek.
77         * elfcode.h (elf_object_p): Likewise.
78
79 2015-10-14  Rich Felker  <dalias@libc.org>
80
81         PR ld/19091
82         * elf32-sh.c (sh_elf_size_dynamic_sections): Always emit
83         DT_PLTGOT for FDPIC output.
84
85 2015-10-13  Alan Modra  <amodra@gmail.com>
86
87         * elf.c (_bfd_elf_map_sections_to_segments): Don't set
88         PT_GNU_RELRO p_flags.
89         (assign_file_positions_for_non_load_sections): Set PT_GNU_RELRO
90         flags to PF_R here.
91
92 2015-10-12  H.J. Lu  <hongjiu.lu@intel.com>
93
94         PR ld/19073
95         * elflink.c (_bfd_elf_add_default_symbol): Skip the unversioned
96         definition after the default version.
97
98 2015-10-12  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
99
100         PR ld/19083
101         * elf32-s390.c (elf_s390_gc_sweep_hook): Do not reduce got
102         refcount for relocs not really requiring a got slot.
103         * elf64-s390.c (elf_s390_gc_sweep_hook): Likewise.
104
105 2015-10-11  John David Anglin  <danglin@gcc.gnu.org>
106
107         * elf-hppa.h (elf_hppa_action_discarded): Ignore relocations in
108         .data.rel.ro.local.
109
110 2015-10-07  Cupertino Miranda  <cmiranda@synopsys.com>
111
112         * archures.c: Remove support for older ARC. Added support for new
113         ARC cpus (ARC600, ARC601, ARC700, ARCV2).
114         * bfd-in2.h: Likewise.
115         * config.bfd: Likewise.
116         * cpu-arc.c: Likewise.
117         * elf32-arc.c: Totally changed file with a refactored
118         inplementation of the ARC port.
119         * libbfd.h: Added ARC specific relocation types.
120         * reloc.c: Likewise.
121
122 2015-10-06  H.J. Lu  <hongjiu.lu@intel.com>
123
124         * bfd.c (bfd_update_compression_header): Clear the ch_reserved
125         field in 64-bit output.
126         (bfd_convert_section_contents): Likewise.
127
128 2015-10-05  H.J. Lu  <hongjiu.lu@intel.com>
129
130         PR ld/18914
131         * elflink.c (elf_link_add_object_symbols): Don't re-export a
132         symbol if it isn't undefined.
133
134 2015-10-04  H.J. Lu  <hongjiu.lu@intel.com>
135
136         * config.bfd (targ_selvecs, targ64_selvecs): Add iamcu_elf32_vec,
137         i386_pei_vec and x86_64_pei_vec for Solaris2/x86.
138
139 2015-10-02  Renlin Li  <renlin.li@arm.com>
140
141         * elfnn-aarch64.c (IS_AARCH64_TLS_RELAX_RELOC): Add
142         TLSIE_MOVW_GOTTPREL_G1.
143         (aarch64_tls_transition_without_check): Add
144         TLSIE_MOVW_GOTTPREL_G1 to TLSLE_MOVW_TPREL_G2
145         transition for local symbol.
146         (elfNN_aarch64_tls_relax): Add a argument to pass tp offset.
147         Add TLSIE_MOVW_GOTTPREL_G1 relaxation.
148         (elfNN_aarch64_relocate_section): Call elfNN_aarch64_tls_relax
149         with new argument.
150
151 2015-10-02  Renlin Li  <renlin.li@arm.com>
152
153         * elfnn-aarch64.c (aarch64_tls_transition_without_check):  Add
154         relax transitions for TLSDESC_ADD, TLSDESC_LDR, TLSDESC_OFF_G0_NC,
155         TLSDESC_OFF_G1.
156         (aarch64_tls_transition_without_check): Add relaxation support.
157         (aarch64_reloc_got_type): Add support.
158         (elfNN_aarch64_final_link_relocate): Likewise.
159         (elfNN_aarch64_tls_relax): Likewise.
160         (elfNN_aarch64_relocate_section): Likewise.
161         (elfNN_aarch64_gc_sweep_hook): Likewise.
162         (elfNN_aarch64_check_relocs): Likewise.
163         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.
164         (_bfd_aarch64_elf_resolve_relocation): Likewise.
165
166 2015-10-02  Renlin Li  <renlin.li@arm.com>
167
168         * elfnn-aarch64.c (elfNN_aarch64_howto_table): Check overflow for
169         BFD_RELOC_AARCH64_TLSDESC_OFF_G1.
170
171 2015-10-02  Renlin Li  <renlin.li@arm.com>
172
173         * elfnn-aarch64.c(IS_AARCH64_TLS_RELAX_RELOC):
174         Add relaxation support for TLSGD_MOVW_G0_NC and TLSGD_MOVW_G1.
175         (aarch64_tls_transition_without_check): Likewise
176         (elfNN_aarch64_tls_relax): Likwise.
177
178 2015-10-02  Renlin Li  <renlin.li@arm.com>
179
180         * elfnn-aarch64.c (elfNN_aarch64_check_relocs): Create GOT section
181         for TLSLE_MOVW_TPREL_G(1, 1_NC, 2) relocation.
182
183 2015-10-02  Renlin Li  <renlin.li@arm.com>
184
185         * reloc.c: Make AARCH64_TLSIE_MOVW_GOTTPREL_G1 and
186         AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC defined in alphabetical order.
187         * libbfd.h: Regenerate.
188         * bfd-in2.h: Likewise.
189         * elfnn-aarch64.c (elfNN_aarch64_howto_table): Make
190         TLSIE_MOVW_GOTTPREL_G1 check overflow.
191         (aarch64_reloc_got_type): Add support for TLSIE_MOVW_GOTTPREL_G1
192         and TLSIE_MOVW_GOTTPREL_G0_NC.
193         (elfNN_aarch64_final_link_relocate): Likewise.
194         (elfNN_aarch64_relocate_section): Likewise.
195         (elfNN_aarch64_gc_sweep_hook): Likewise.
196         (elfNN_aarch64_check_relocs): Likewise.
197         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.
198         (_bfd_aarch64_elf_resolve_relocation): Likewise.
199
200 2015-10-02  Renlin Li  <renlin.li@arm.com>
201
202         * elfnn-aarch64.c (aarch64_reloc_got_type): Add
203         BFD_RELOC_AARCH64_TLSGD_MOVW_G0_NC support.
204         (elfNN_aarch64_final_link_relocate): Likewise.
205         (elfNN_aarch64_relocate_section): Likewise.
206         (elfNN_aarch64_gc_sweep_hook): Likewise.
207         (elfNN_aarch64_check_relocs): Likewise.
208         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.
209         (_bfd_aarch64_elf_resolve_relocation): Likewise.
210
211 2015-10-02  Renlin Li  <renlin.li@arm.com>
212
213         * reloc.c (BFD_RELOC_AARCH64_TLSGD_MOVW_G0_NC): New entry.
214         * elfnn-aarch64.c (elfNN_aarch64_howto_table): New entry for
215         BFD_RELOC_AARCH64_TLSGD_MOVW_G0_NC.
216         * libbfd.h: Regenerate.
217         * bfd-in2.h: Likewise
218
219 2015-10-02  Renlin Li  <renlin.li@arm.com>
220
221         * elfnn-aarch64.c (aarch64_reloc_got_type): Add
222         BFD_RELOC_AARCH64_TLSGD_MOVW_G1 support.
223         (elfNN_aarch64_final_link_relocate): Likewise.
224         (elfNN_aarch64_relocate_section): Likewise.
225         (elfNN_aarch64_gc_sweep_hook): Likewise.
226         (elfNN_aarch64_check_relocs): Likewise.
227         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.
228         (_bfd_aarch64_elf_resolve_relocation): Likewise.
229
230 2015-10-02  Renlin Li  <renlin.li@arm.com>
231
232         * reloc.c (BFD_RELOC_AARCH64_TLSGD_MOVW_G1): New entry.
233         * elfnn-aarch64.c (elfNN_aarch64_howto_table): New entry for
234         BFD_RELOC_AARCH64_TLSGD_MOVW_G1.
235         * bfd-in2.h: Regenerate.
236         * libbfd.h: Likewise.
237
238 2015-10-02  Renlin Li  <renlin.li@arm.com>
239
240         * elfnn-aarch64.c (aarch64_reloc_got_type): Add
241         BFD_RELOC_AARCH64_MOVW_GOTOFF_G0_NC support.
242         (elfNN_aarch64_final_link_relocate): Likewise.
243         (elfNN_aarch64_gc_sweep_hook): Likewise.
244         (elfNN_aarch64_check_relocs): Likewise.
245         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.
246         (_bfd_aarch64_elf_resolve_relocation): Likewise.
247
248 2015-10-02  Renlin Li  <renlin.li@arm.com>
249
250         * reloc.c (BFD_RELOC_AARCH64_MOVW_GOTOFF_G0_NC): New.
251         * elfnn-aarch64.c (elfNN_aarch64_howto_table): New entry
252         MOVW_GOTOFF_G0_NC.
253         * libbfd.h: Regnerate.
254         * bfd-in2.h: Regenerate.
255
256 2015-10-02  Renlin Li  <renlin.li@arm.com>
257
258         * elfnn-aarch64.c (aarch64_reloc_got_type): Add support
259         for BFD_RELOC_AARCH64_MOVW_GOTOFF_G1.
260         (elfNN_aarch64_gc_sweep_hook): Likewise.
261         (elfNN_aarch64_check_relocs): Likewise
262         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.
263         (_bfd_aarch64_elf_resolve_relocation): Likewise
264         (elfNN_aarch64_final_link_relocate): Likewise
265
266 2015-010-02  Renlin Li  <renlin.li@arm.com>
267
268         * reloc.c (BFD_RELOC_AARCH64_MOVW_GOTOFF_G1): New.
269         * elfnn-aarch64.c (elfNN_aarch64_howto_table): New entry for
270         MOVW_GOTOFF_G1.
271         * libbfd.h: Regenerate.
272         * bfd-in2.h: Regenerate.
273
274 2015-10-02  Renlin Li  <renlin.li@arm.com>
275
276         * elfnn-aarch64.c (aarch64_reloc_got_type): Add
277         BFD_RELOC_AARCH64_LD_64_GOTOFF_LO15 support.
278         (elfNN_aarch64_gc_sweep_hook): Likewise.
279         (elfNN_aarch64_check_relocs): Likewise
280         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.
281         (_bfd_aarch64_elf_resolve_relocation): Likewise
282         (elfNN_aarch64_final_link_relocate): Calculate offset within GOT.
283
284 2015-10-02  Renlin Li  <renlin.li@arm.com>
285
286         * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Change if to
287         switch statement.
288
289 2015-10-01  H.J. Lu  <hongjiu.lu@intel.com>
290
291         PR ld/19031
292         * elf64-x86-64.c (elf_x86_64_check_relocs): Set
293         pointer_equality_needed for R_X86_64_PC32 reloc in non-code
294         sections.
295
296 2015-10-01  Renlin Li  <renlin.li@arm.com>
297
298         * elfnn-aarch64.c (elfNN_aarch64_output_plt_map): Remove.
299         (elfNN_aarch64_output_arch_local_syms): Emit AARCH64_MAP_INSN once.
300
301 2015-10-01  Kaz Kojima  <kkojima@rr.iij4u.or.jp>
302
303         * config.bfd (targ_selvecs): Remove sh_elf32_vec and
304         sh_elf32_le_vec from sh*-*-linux cases.
305
306 2015-10-01  Alan Modra  <amodra@gmail.com>
307
308         PR ld/19013
309         * elflink.c (_bfd_elf_merge_sections): Revert last change.
310
311 2015-09-30  H.J. Lu  <hongjiu.lu@intel.com>
312
313         PR ld/19031
314         * elf32-i386.c (elf_i386_check_relocs): Set
315         pointer_equality_needed for R_386_PC32 reloc in non-code
316         sections.
317
318 2015-09-30  H.J. Lu  <hongjiu.lu@intel.com>
319
320         PR ld/19013
321         * elflink.c (_bfd_elf_merge_sections): Only merge input bfds
322         that have the compatible ELF machine code with the output bfd.
323
324 2015-09-30  Alan Modra  <amodra@gmail.com>
325
326         PR ld/19013
327         * elflink.c (_bfd_elf_merge_sections): Only merge input bfds that
328         will be handled by elf_link_input_bfd.  Rename abfd param to obfd.
329
330 2015-09-30  Rich Felker  <dalias@libc.org>
331
332         * config.bfd (targ_selvecs): Add fdpic and misc targets
333         for sh*-*-linux*.
334
335 2015-09-29  Andrew Stubbs  <ams@codesourcery.com>
336             H.J. Lu  <hongjiu.lu@intel.com>
337
338         PR binutils/19020
339         * bfd.c (bfd_convert_section_contents): Add ptr_size parameter.
340         * bfd-in2.h: Regenerated.
341
342 2015-08-11  Peter Zotov  <whitequark@whitequark.org>
343
344         PR ld/18759
345         * elf32-or1k.c (R_OR1K_32_PCREL): Set pcrel_offset to TRUE.
346         (R_OR1K_16_PCREL): Likewise.
347         (R_OR1K_8_PCREL): Likewise.
348
349 2015-09-23  Nick Clifton  <nickc@redhat.com>
350
351         * bout.c (b_out_slurp_reloc_table): Cast constant to unsigned in
352         order to avoid problems with left shifting negative values.
353         (abs32code): Likewise.
354         * mach-o.c (FILE_ALIGN): Likewise.
355         * coff-rs6000.c (xcoff_debug_sections): Delete unused static
356         array.
357         * elf32-visium.c (visium_reloc_map): Likewise.
358         * elf32-arm.c (elf32_arm_final_link_relocate): Remove useless
359         calls to abs function.
360         * elf32-frv.c (_frvfdpic_relax_tls_entries): Likewise.
361         * elf32-score.c (score_elf_final_link_relocate): Likewise.
362         * elf32-score7.c (score_elf_final_link_relocate): Likewise.
363         * elf32-i860.c (i860_howto_pc26_reloc): Use multiplication instead
364         of shifting to create a negative mask.
365         * elf32-msp430.c (elf_backend_special_sections): Define.
366         * elfxx-mips.c (got_ofst_reloc_p): Delete unused function.
367         (got_hi16_reloc_p): Delete unused function.
368         * ppcboot.c (ppcboot_bfd_print_private_bfd_data): Fix test of
369         partition name.
370
371 2015-09-23  Nick Clifton  <nickc@redhat.com>
372
373         PR binutils/15835
374         * elf-bfd.h (struct elf_section_list): New structure.
375         (struct elf_obj_tdata): Replace symtab_shndx_hdr with
376         symtab_shndx_list.  Delete symtab_shndx_section.
377         (elf_symtab_shndx): Replace macro with elf_symtab_shndx_list.
378         * elf.c (bfd_elf_get_syms): If symtab index sections are present,
379         scan them for the section that matches the provided symbol table.
380         (bfd_section_from_shdr): Record all SHT_SYMTAB_SHNDX sections.
381         (assign_section_numbers): Use the first symtab index table in the
382         list.
383         (_bfd_elf_compute_section_file_positions): Replace use of
384         symtab_shndx_hdr with use of symtab_shndx_list.
385         (find_section_in_list): New function.
386         (assign_file_postions_except_relocs): Use new function.
387         (_bfd_elf_copy_private_symbol_data): Likewise.
388         (swap_out_syms): Handle multiple symbol table index sections.
389         * elf32-m32c.c (m32c_elf_relax_section): Replace use of
390         symtab_shndx_hdr with use of symtab_shndx_list.
391         * elf32-rl78.c (rl78_elf_relax_section): Likewise.
392         * elf32-rx.c (rx_relax_section): Likewise.
393         * elf32-v850.c (v850_elf_relax_delete_bytes): Likewise.
394         * elflink.c (bfd_elf_final_link): Likewise.
395
396 2015-09-21  H.J. Lu  <hongjiu.lu@intel.com>
397
398         * bfd.c (bfd_update_compression_header): Use bfd_put_32 on
399         ch_type.
400         (bfd_check_compression_header): Use bfd_get_32 on ch_type.
401         (bfd_convert_section_contents): Use bfd_get_32 and bfd_put_32
402         on ch_type.
403
404 2015-09-20  Rich Felker  <dalias@libc.org>
405
406         * elflink.c (_bfd_elf_link_create_dynamic_sections): Don't create
407         .interp when info->nointerp.
408         (bfd_elf_size_dynamic_sections): Adjust assert.
409         * elf32-arm.c (elf32_arm_size_dynamic_sections): Don't size .interp
410         when info->nointerp.
411         * elf32-bfin.c (elf32_bfinfdpic_size_dynamic_sections): Likewise.
412         * elf32-cr16.c (_bfd_cr16_elf_size_dynamic_sections): Likewise.
413         * elf32-cris.c (elf_cris_size_dynamic_sections): Likewise.
414         * elf32-frv.c (elf32_frvfdpic_size_dynamic_sections): Likewise.
415         * elf32-hppa.c (elf32_hppa_size_dynamic_sections): Likewise.
416         * elf32-i370.c (i370_elf_size_dynamic_sections): Likewise.
417         * elf32-i386.c (elf_i386_size_dynamic_sections): Likewise.
418         * elf32-lm32.c (lm32_elf_size_dynamic_sections): Likewise.
419         * elf32-m32r.c (m32r_elf_size_dynamic_sections): Likewise.
420         * elf32-m68k.c (elf_m68k_size_dynamic_sections): Likewise.
421         * elf32-metag.c (elf_metag_size_dynamic_sections): Likewise.
422         * elf32-nds32.c (nds32_elf_size_dynamic_sections): Likewise.
423         * elf32-nios2.c (nios2_elf32_size_dynamic_sections): Likewise.
424         * elf32-or1k.c (or1k_elf_size_dynamic_sections): Likewise.
425         * elf32-ppc.c (ppc_elf_size_dynamic_sections): Likewise.
426         * elf32-s390.c (elf_s390_size_dynamic_sections): Likewise.
427         * elf32-score.c (s3_bfd_score_elf_size_dynamic_sections): Likewise.
428         * elf32-score7.c (s7_bfd_score_elf_size_dynamic_sections): Likewise.
429         * elf32-sh.c (sh_elf_size_dynamic_sections): Likewise.
430         * elf32-tic6x.c (elf32_tic6x_size_dynamic_sections): Likewise.
431         * elf32-tilepro.c (tilepro_elf_size_dynamic_sections): Likewise.
432         * elf32-vax.c (elf_vax_size_dynamic_sections): Likewise.
433         * elf32-xtensa.c (elf_xtensa_size_dynamic_sections): Likewise.
434         * elf64-alpha.c (elf64_alpha_size_dynamic_sections): Likewise.
435         * elf64-hppa.c (elf64_hppa_size_dynamic_sections): Likewise.
436         * elf64-ppc.c (ppc64_elf_size_dynamic_sections): Likewise.
437         * elf64-s390.c (elf_s390_size_dynamic_sections): Likewise.
438         * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise.
439         * elf64-x86-64.c (elf_x86_64_size_dynamic_sections): Likewise.
440         * elfnn-aarch64.c (elfNN_aarch64_size_dynamic_sections): Likewise.
441         * elfnn-ia64.c (elfNN_ia64_size_dynamic_sections): Likewise.
442         * elfxx-mips.c (_bfd_mips_elf_size_dynamic_sections): Likewise.
443         * elfxx-sparc.c (_bfd_sparc_elf_size_dynamic_sections): Likewise.
444         * elfxx-tilegx.c (tilegx_elf_size_dynamic_sections): Likewise.
445
446 2015-09-18  Doug Evans  <xdje42@gmail.com>
447
448         * targets.c (enum bfd_flavour): Add comment.
449         (bfd_flavour_name): New function.
450         * bfd-in2.h: Regenerate.
451
452 2015-09-18  Alan Modra  <amodra@gmail.com>
453
454         * elf64-ppc.h (struct ppc64_elf_params <tls_get_addr_opt>): Rename
455         from no_tls_get_addr_opt.
456         * elf64-ppc.c: Update for rename and inversion of tls_get_addr_opt.
457         (ppc64_elf_tls_setup): Set tls_get_addr_opt to 0 only when at
458         default of -1.
459
460 2015-09-17  Alan Modra  <amodra@gmail.com>
461
462         PR 18867
463         * elflink.c (elf_link_adjust_relocs): Correct start of insertion
464         sort main loop.
465
466 2015-09-16  Alan Modra  <amodra@gmail.com>
467
468         PR 18867
469         * elflink.c (elf_link_adjust_relocs): Modify insertion sort to
470         insert a run.  Return status in case of malloc failure.
471         Adjust callers.
472
473 2015-09-15  Max Filippov  <jcmvbkbc@gmail.com>
474
475         * elf32-xtensa.c (elf_xtensa_be_plt_entry)
476         (elf_xtensa_le_plt_entry): Emit 'entry' instruction only for
477         windowed ABI.
478         (elf_xtensa_create_plt_entry): Generate 'l32r' offsets and fix
479         up instructions according to ABI.
480
481 2015-09-14  Rich Felker  <dalias@libc.org>
482
483         * elf32-sh.c (sh_elf_relocate_section): Set EF_SH_PIC flag
484         instead of clearing it on cross-section relocations.
485         (sh_elf_merge_private_data): Clear EF_SH_PIC flag by default.
486
487 2015-09-12  Helge Deller  <deller@gmx.de>
488
489         PR ld/18514
490         * elf32-hppa.c (elf32_hppa_finish_dynamic_sections): Set .plt entry
491         size to 0.
492
493 2015-09-09  Jiong Wang  <jiong.wang@arm.com>
494
495         * elfnn-aarch64.c (IS_AARCH64_TLS_RELAX_RELOC): Sort alphabetically.
496
497 2015-09-09  Jiong Wang  <jiong.wang@arm.com>
498
499         * elfnn-aarch64.c (aarch64_tls_transition_without_check): Support three
500         TLS local dynamic traditional relocations types.
501         (elfNN_aarch64_tls_relax): Support TLS local dynamic traditional to
502         local executable relaxation.
503
504 2015-09-03  H.J. Lu  <hongjiu.lu@intel.com>
505
506         * elf64-x86-64.c (elf_x86_64_convert_mov_to_lea): Remove
507         convert_mov_to_lea.
508
509 2015-09-02  H.J. Lu  <hongjiu.lu@intel.com>
510
511         * elf32-i386.c (R_386_irelative): Renamed to ...
512         (R_386_ext2): This.
513         (R_386_vt_offset): Updated.
514         (elf_i386_rtype_to_howto): Likewise.
515         (elf_i386_relocate_section): Likewise.
516
517 2015-09-01  H.J. Lu  <hongjiu.lu@intel.com>
518
519         PR ld/18900
520         * elf32-i386.c (elf_i386_link_hash_entry): Add
521         func_pointer_refcount.
522         (elf_i386_link_hash_newfunc): Clear func_pointer_refcount.
523         (elf_i386_get_local_sym_hash): Likewise.
524         (elf_i386_copy_indirect_symbol): Also copy
525         func_pointer_refcount.
526         (elf_i386_check_relocs): Increment func_pointer_refcount.
527         (elf_i386_gc_sweep_hook): Decrement func_pointer_refcount.
528         (elf_i386_allocate_dynrelocs): Don't create the PLT entry if
529         there are only function pointer relocations which can be
530         resolved at run-time.  Keep dynanamic relocations for run-time
531         function pointer initialization.
532         (elf_i386_relocate_section): Copy dynamic function pointer
533         relocations.
534         * elf64-x86-64.c (elf_x86_64_link_hash_entry): Add
535         func_pointer_refcount.
536         (elf_x86_64_link_hash_newfunc): Clear func_pointer_refcount.
537         (elf_x86_64_get_local_sym_hash): Likewise.
538         (elf_x86_64_copy_indirect_symbol): Also copy
539         func_pointer_refcount.
540         (elf_x86_64_check_relocs): Increment func_pointer_refcount.
541         (elf_x86_64_gc_sweep_hook): Decrement func_pointer_refcount.
542         (elf_x86_64_allocate_dynrelocs): Don't create the PLT entry if
543         there are only function pointer relocations which can be
544         resolved at run-time.  Keep dynanamic relocations for run-time
545         function pointer initialization.
546         (elf_x86_64_relocate_section): Copy dynamic function pointer
547         relocations.
548
549 2015-09-01  Alan Modra  <amodra@gmail.com>
550
551         * elf64-ppc.c (ppc64_elf_maybe_function_sym): Adjust symbol value
552         if .opd section has been edited.
553
554 2015-09-01  Alan Modra  <amodra@gmail.com>
555
556         PR 18878
557         * elf64-ppc.c (ARRAY_SIZE): Define.  Use throughout.
558         (enum ppc_stub_type): Add ppc_stub_save_res.
559         (struct map_stub): Add "next" and "needs_save_res".
560         (struct ppc_link_hash_entry): Add "save_res" flag.
561         (struct ppc_link_hash_table): Add "group".
562         (sfpr_define): Add stub_sec param.  Define symbol in stub_sec if
563         stub_sec is non-null.  Set "save_res".
564         (save_res_funcs): Make file scope, rename from funcs.  Adjust uses.
565         (ppc64_elf_adjust_dynamic_symbol): Prohibit plt call to save_res syms.
566         (ppc_build_one_stub): Handle ppc_stub_save_res.
567         (ppc_size_one_stub): Set stub type to ppc_size_one_stub on finding
568         stub for linker defined save_res sym.
569         (group_sections): Init new fields of struct map_stub.
570         (ppc64_elf_size_stubs): Reserve space for save/restore func copy.
571         (ppc64_elf_build_stubs): Copy save/restore funcs to groups.  Emit
572         alias syms too.
573         (ppc64_elf_relocate_section): Set destination for ppc_stub_save_res.
574
575 2015-08-31  Alan Modra  <amodra@gmail.com>
576
577         * elf64-ppc.c (get_r2off): Return -1 on error.
578         (ppc_build_one_stub): Adjust for get_r2off change.  Don't emit
579         addi r2,r2,0 on r2off stubs when the low 16-bit delta is zero.
580         (ppc_size_one_stub): Corresponding size changes for r2off stubs.
581         Add condition in test for -R objects.
582
583 2015-08-31  Alan Modra  <amodra@gmail.com>
584
585         * section.c (section_id): Make file scope.
586         (bfd_get_next_section_id): New function.
587         * elf64-ppc.c (struct map_stub): Remove toc_off field.  Move decl.
588         (struct ppc_stub_hash_entry): Delete stub_sec and id_sec.  Add
589         group.  Update all uses.
590         (struct ppc_link_hash_table): Delete top_id, top_index, and
591         input_list.  Add sec_info_arr_size.  Rename stub_group to
592         sec_info, and make group info indirect.  Update stub_group refs
593         throughout file.
594         (ppc_add_stub): Don't look for stub_sec on link_sec stub_group
595         entry.
596         (ppc_build_one_stub): Delete FIXME.
597         (ppc64_elf_setup_section_lists): Size htab->sec_info for all
598         sections, not just input sections.  Don't create htab->input_list.
599         (ppc64_elf_next_input_section): Update to use sec_info union as
600         list pointer.
601         (PREV_SEC): Delete.
602         (group_sections): Pass "info" param rather than "htab".  Iterate
603         over output sections rather than input_list.  Use sec_info union
604         as list pointers.  Alloc atruct map_stub, and return fail status.
605         * bfd-in2.h: Regenerate.
606
607 2015-08-31  Alan Modra  <amodra@gmail.com>
608
609         * elflink.c (elf_sort_symbol): Use correctly sized type for
610         calculating signed section->id difference.
611         (elf_link_add_object_symbols): Likewise.
612         * pef.c (bfd_pef_scan_start_address): Warning fix.
613         * vms-alpha.c (vms_new_section_hook): Likewise.
614
615 2015-08-31  Alan Modra  <amodra@gmail.com>
616
617         * elf32-nds32.c (nds32_convert_32_to_16_alu1): Warning fix.
618         (find_relocs_at_address_addr): Make "reloc_type" an enum.
619         (nds32_elf_relax_delete_blanks): Warning fix.
620         (nds32_elf_relax_loadstore): Correct loop bound.
621
622 2015-08-31  Alan Modra  <amodra@gmail.com>
623
624         * section.c (struct bfd_section): Make "id" and "index" unsigned.
625         * coff-rs6000.c (_bfd_xcoff_sizeof_headers): Adjust local var to suit.
626         * elf.c (elf_map_symbols): Likewise.
627         * elf64-ppc.c (sym_exists_at): Make "id" param unsigned.
628         (struct ppc_link_hash_table): Make "top_id" and "top_index" unsigned.
629         (ppc64_elf_setup_section_lists): Ditto for local vars.
630         * elf32-arm.c: Similarly to elf64-ppc.c.
631         * elf32-avr.c: Likewise.
632         * elf32-hppa.c: Likewise.
633         * elf32-m68hc1x.c: Likewise.
634         * elf32-metag.c: Likewise.
635         * elf32-nios2.c: Likewise.
636         * elfnn-aarch64.c: Likewise.
637         * simple.c (struct saved_offsets): Make "section_count" unsigned.
638         * bfd-in2.h: Regenerate.
639
640 2015-08-27  Alan Modra  <amodra@gmail.com>
641
642         PR 18867
643         * elf64-alpha.c (elf64_alpha_sort_relocs_p): New function.
644         (elf_backend_sort_relocs_p): Define.
645
646 2015-08-26  Alan Modra  <amodra@gmail.com>
647
648         PR 18867
649         * elflink.c (cmp_ext32l_r_offset, cmp_ext32b_r_offset): Delete.
650         (cmp_ext64l_r_offset, cmp_ext64b_r_offset): Delete.
651         (ext32l_r_offset, ext32b_r_offset, ext64l_r_offset, ext64b_r_offset):
652         New functions.
653         (elf_link_adjust_relocs): Use an insertion sort to sort relocs.
654
655 2015-08-26  Matthew Fortune  <matthew.fortune@imgtec.com>
656
657         PR ld/18401
658         * elfxx-mips.c (bfd_mips_isa_ext_mach): New function: Converts an
659         ISA value to a bfd machine number.
660         (bfd_mips_isa_ext): Update the ISA level and revision if
661         necessary.  Use mips_mach_extends_p to decide if the ISA extension
662         needs to be set.
663         (_bfd_mips_elf_merge_private_bfd_data): Allow the ISA extension to
664         be inferred from the ABI setting.  Set the ISA level from the
665         maximum of the incoming and outgoing ISA levels.
666
667 2015-08-25  Nick Clifton  <nickc@redhat.com>
668
669         PR binutils/18854
670         * elf.c (bfd_section_from_shdr): Replace assertions with warnings
671         about multiple symbol tables.
672
673 2015-08-25  Renlin Li  <renlin.li@arm.com>
674
675         * reloc.c (BFD_RELOC_AARCH64_LD64_GOTOFF_LO15): Use LP64 instead of
676         ILP64.
677         * bfd-in2.h: Regenerate.
678
679 2015-08-22  Alan Modra  <amodra@gmail.com>
680
681         * elf.c (_bfd_elf_slurp_version_tables): Always init vd_nodename.
682         Don't copy fields not set by _bfd_elf_swap_verdef_in.
683
684 2015-08-19  Jiong Wang  <jiong.wang@arm.com>
685
686         * elfnn-aarch64.c (IS_AARCH64_TLS_RELOC): Recognize new relocation
687         types, including BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12,
688         BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC,
689         BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12,
690         BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC,
691         BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12,
692         BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC,
693         BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12,
694         BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC.
695         (elfNN_aarch64_final_link_relocate): Likewise.
696         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.
697         (_bfd_aarch64_elf_resolve_relocation): Likewise.
698
699 2015-08-19  Jiong Wang  <jiong.wang@arm.com>
700
701         * reloc.c (BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12,
702         BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC,
703         BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12,
704         BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC,
705         BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12,
706         BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC.
707         BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12,
708         BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC): New entries.
709         * elfnn-aarch64.c (elfNN_aarch64_howto_table): Likewise.
710         * bfd-in2.h: Regenerate.
711         * libbfd.h: Regenerate.
712
713 2015-08-19  Jiong Wang  <jiong.wang@arm.com>
714
715         PR ld/18276
716         * elfnn-aarch64.c (IS_AARCH64_TLS_RELOC): Recognize new relocation
717         types, including BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_HI12,
718         BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0,
719         BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0_NC,
720         BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1,
721         BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1_NC,
722         BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G2.
723         (elfNN_aarch64_final_link_relocate): Likewise.
724         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.
725         (_bfd_aarch64_elf_resolve_relocation): Likewise.
726
727 2015-08-19  Jiong Wang  <jiong.wang@arm.com>
728
729         * reloc.c (BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_HI12,
730         BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0,
731         BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0_NC,
732         BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1,
733         BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1_NC,
734         BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G2): New entries.
735         * elfnn-aarch64.c (elfNN_aarch64_howto_table): Likewise.
736         * bfd-in2.h: Regenerate.
737         * libbfd.h: Regenerate.
738
739 2015-08-19  Jiong Wang  <jiong.wang@arm.com>
740
741         * elfnn-aarch64.c (IS_AARCH64_TLS_RELOC): Recognize
742         BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12_NC.
743         (aarch64_reloc_got_type): Likewise.
744         (elfNN_aarch64_final_link_relocate): Likewise.
745         (elfNN_aarch64_relocate_section): Likewise.
746         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.
747         (_bfd_aarch64_elf_resolve_relocation): Likewise.
748
749 2015-08-19  Jiong Wang  <jiong.wang@arm.com>
750
751         * reloc.c (BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12_NC): New entry.
752         * bfd-in2.h: Regenerate.
753         * libbfd.h: Regenerate.
754         * elfnn-aarch64.c (elfNN_aarch64_howto_table): New entry for
755         BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12_NC.
756
757 2015-08-19  Alan Modra  <amodra@gmail.com>
758
759         * elf-s390-common.c: Simplify expressions using
760         bfd_linke_executable, bfd_link_pie and bfd_link_pic.
761         * elf32-arm.c: Likewise.
762         * elf32-bfin.c: Likewise.
763         * elf32-frv.c: Likewise.
764         * elf32-m68k.c: Likewise.
765         * elf32-nios2.c: Likewise.
766         * elf32-ppc.c: Likewise.
767         * elf32-s390.c: Likewise.
768         * elf32-sh.c: Likewise.
769         * elf64-alpha.c: Likewise.
770         * elf64-ppc.c: Likewise.
771         * elf64-s390.c: Likewise.
772         * elflink.c: Likewise.
773
774 2015-08-18  Jiong Wang  <jiong.wang@arm.com>
775
776         * elfnn-aarch64.c (aarch64_reloc_got_type): Delete useless check.
777         (elfNN_aarch64_relocate_section): Likewise.
778         (elfNN_aarch64_gc_sweep_hook): Likewise.
779         (elfNN_aarch64_check_relocs): Likewise.
780
781 2015-08-18  H.J. Lu  <hongjiu.lu@intel.com>
782
783         PR ld/18841
784         * elf-bfd.h (elf_link_hash_table): Add dynsym.
785         * elf32-i386.c (elf_i386_reloc_type_class): Return
786         reloc_class_ifunc for relocation against STT_GNU_IFUNC symbol.
787         * elf64-x86-64.c (elf_x86_64_reloc_type_class): Likewise.
788         * elflink.c (_bfd_elf_link_create_dynamic_sections): Set dynsym.
789         (bfd_elf_size_dynsym_hash_dynstr): Use dynsym.
790         (elf_final_link_info): Remove dynsym_sec.
791         (elf_link_output_extsym): Replace dynsym_sec with dynsym.
792         (bfd_elf_final_link): Remove reference to dynsym_sec.  Replace
793         dynsym_sec with dynsym.
794
795 2015-08-18  H.J. Lu  <hongjiu.lu@intel.com>
796
797         * bfd/aoutx.h: Replace shared, executable, relocatable and pie
798         fields with bfd_link_executable, bfd_link_dll,
799         bfd_link_relocatable, bfd_link_pic and bfd_link_pie.
800         * bfd/bout.c: Likewise.
801         * bfd/coff-alpha.c: Likewise.
802         * bfd/coff-arm.c: Likewise.
803         * bfd/coff-i386.c: Likewise.
804         * bfd/coff-i960.c: Likewise.
805         * bfd/coff-m68k.c: Likewise.
806         * bfd/coff-mcore.c: Likewise.
807         * bfd/coff-mips.c: Likewise.
808         * bfd/coff-ppc.c: Likewise.
809         * bfd/coff-rs6000.c: Likewise.
810         * bfd/coff-sh.c: Likewise.
811         * bfd/coff-tic80.c: Likewise.
812         * bfd/coff-x86_64.c: Likewise.
813         * bfd/coff64-rs6000.c: Likewise.
814         * bfd/coffgen.c: Likewise.
815         * bfd/cofflink.c: Likewise.
816         * bfd/ecoff.c: Likewise.
817         * bfd/ecofflink.c: Likewise.
818         * bfd/elf-bfd.h: Likewise.
819         * bfd/elf-eh-frame.c: Likewise.
820         * bfd/elf-ifunc.c: Likewise.
821         * bfd/elf-m10200.c: Likewise.
822         * bfd/elf-m10300.c: Likewise.
823         * bfd/elf-s390-common.c: Likewise.
824         * bfd/elf-vxworks.c: Likewise.
825         * bfd/elf.c: Likewise.
826         * bfd/elf32-arm.c: Likewise.
827         * bfd/elf32-avr.c: Likewise.
828         * bfd/elf32-bfin.c: Likewise.
829         * bfd/elf32-cr16.c: Likewise.
830         * bfd/elf32-cr16c.c: Likewise.
831         * bfd/elf32-cris.c: Likewise.
832         * bfd/elf32-crx.c: Likewise.
833         * bfd/elf32-d10v.c: Likewise.
834         * bfd/elf32-dlx.c: Likewise.
835         * bfd/elf32-epiphany.c: Likewise.
836         * bfd/elf32-fr30.c: Likewise.
837         * bfd/elf32-frv.c: Likewise.
838         * bfd/elf32-ft32.c: Likewise.
839         * bfd/elf32-h8300.c: Likewise.
840         * bfd/elf32-hppa.c: Likewise.
841         * bfd/elf32-i370.c: Likewise.
842         * bfd/elf32-i386.c: Likewise.
843         * bfd/elf32-i860.c: Likewise.
844         * bfd/elf32-ip2k.c: Likewise.
845         * bfd/elf32-iq2000.c: Likewise.
846         * bfd/elf32-lm32.c: Likewise.
847         * bfd/elf32-m32c.c: Likewise.
848         * bfd/elf32-m32r.c: Likewise.
849         * bfd/elf32-m68hc11.c: Likewise.
850         * bfd/elf32-m68hc1x.c: Likewise.
851         * bfd/elf32-m68k.c: Likewise.
852         * bfd/elf32-mcore.c: Likewise.
853         * bfd/elf32-mep.c: Likewise.
854         * bfd/elf32-metag.c: Likewise.
855         * bfd/elf32-microblaze.c: Likewise.
856         * bfd/elf32-moxie.c: Likewise.
857         * bfd/elf32-msp430.c: Likewise.
858         * bfd/elf32-mt.c: Likewise.
859         * bfd/elf32-nds32.c: Likewise.
860         * bfd/elf32-nios2.c: Likewise.
861         * bfd/elf32-or1k.c: Likewise.
862         * bfd/elf32-ppc.c: Likewise.
863         * bfd/elf32-rl78.c: Likewise.
864         * bfd/elf32-rx.c: Likewise.
865         * bfd/elf32-s390.c: Likewise.
866         * bfd/elf32-score.c: Likewise.
867         * bfd/elf32-score7.c: Likewise.
868         * bfd/elf32-sh-symbian.c: Likewise.
869         * bfd/elf32-sh.c: Likewise.
870         * bfd/elf32-sh64.c: Likewise.
871         * bfd/elf32-spu.c: Likewise.
872         * bfd/elf32-tic6x.c: Likewise.
873         * bfd/elf32-tilepro.c: Likewise.
874         * bfd/elf32-v850.c: Likewise.
875         * bfd/elf32-vax.c: Likewise.
876         * bfd/elf32-visium.c: Likewise.
877         * bfd/elf32-xc16x.c: Likewise.
878         * bfd/elf32-xstormy16.c: Likewise.
879         * bfd/elf32-xtensa.c: Likewise.
880         * bfd/elf64-alpha.c: Likewise.
881         * bfd/elf64-hppa.c: Likewise.
882         * bfd/elf64-ia64-vms.c: Likewise.
883         * bfd/elf64-mmix.c: Likewise.
884         * bfd/elf64-ppc.c: Likewise.
885         * bfd/elf64-s390.c: Likewise.
886         * bfd/elf64-sh64.c: Likewise.
887         * bfd/elf64-x86-64.c: Likewise.
888         * bfd/elflink.c: Likewise.
889         * bfd/elfnn-aarch64.c: Likewise.
890         * bfd/elfnn-ia64.c: Likewise.
891         * bfd/elfxx-mips.c: Likewise.
892         * bfd/elfxx-sparc.c: Likewise.
893         * bfd/elfxx-tilegx.c: Likewise.
894         * bfd/i386linux.c: Likewise.
895         * bfd/linker.c: Likewise.
896         * bfd/m68klinux.c: Likewise.
897         * bfd/pdp11.c: Likewise.
898         * bfd/pe-mips.c: Likewise.
899         * bfd/peXXigen.c: Likewise.
900         * bfd/reloc.c: Likewise.
901         * bfd/reloc16.c: Likewise.
902         * bfd/sparclinux.c: Likewise.
903         * bfd/sunos.c: Likewise.
904         * bfd/vms-alpha.c: Likewise.
905         * bfd/xcofflink.c: Likewise.
906
907 2015-08-18  Alan Modra  <amodra@gmail.com>
908
909         PR 18667
910         * Makefile.am: Use $(SED) in place of sed throughout.
911         * Makefile.in: Regenerate.
912
913 2015-08-18  Alan Modra  <amodra@gmail.com>
914
915         * elf64-ppc.c (ppc64_elf_func_desc_adjust): Don't redefine .TOC.
916         if already defined, and set linker_def.
917         (ppc64_elf_set_toc): Use .TOC. value if defined other than by
918         the backend.
919
920 2015-08-14  Alan Modra  <amodra@gmail.com>
921
922         PR ld/18759
923         * elf32-or1k.c: Revert 2015-08-11 change.
924
925 2015-08-13  H.J. Lu  <hongjiu.lu@intel.com>
926
927         PR ld/18801
928         * elf32-i386.c (elf_i386_size_dynamic_sections): Issue an error
929         for read-only segment with dynamic IFUNC relocations.
930         * elf64-x86-64.c (elf_x86_64_size_dynamic_sections): Likewise.
931
932 2015-08-12  Simon Dardis  <simon.dardis@imgtec.com>
933
934         * elfxx-mips.c (STUB_MOVE): Change to use 'or' only.
935         (mips_o32_exec_plt0_entry, mips_n32_exec_plt0_entry,
936         mips_n64_exec_plt0_entry, micromips_insn32_o32_exec_plt0_entry):
937         Update to use 'or' instead of 'addu/daddu'.
938         (_bfd_mips_elf_finish_dynamic_symbol): Update usage of STUB_MOVE.
939         (move_insns_32): Reorder table.
940
941 2015-08-11  H.J. Lu  <hongjiu.lu@intel.com>
942
943         * elf32-i386.c (elf_i386_relocate_section): Properly skip IFUNC
944         relocations in debug sections.
945         * elf64-x86-64.c (elf_x86_64_relocate_section): Likewise.
946
947 2015-08-11  Jiong Wang  <jiong.wang@arm.com>
948
949         * elfnn-aarch64.c (elfNN_aarch64_relocate_section): Improve warning
950         message for R_AARCH64_LD64_GOTPAGE_LO15/R_AARCH64_LD32_GOTPAGE_LO14.
951
952 2015-08-11  Jiong Wang  <jiong.wang@arm.com>
953
954         * elfnn-aarch64.c (IS_AARCH64_TLS_RELAX_RELOC): New.
955         (aarch64_can_relax_tls): Use the new IS_AARCH64_TLS_RELAX_RELOC.
956
957 2015-08-11  Jiong Wang  <jiong.wang@arm.com>
958
959         * bfd/elfnn-aarch64.c (aarch64_type_of_stub): New parameter "sym_sec".
960         Loose the check for symbol from ABS section.
961         (elfNN_aarch64_size_stubs): Pass sym_sec.
962
963 2015-08-11  Jiong Wang  <jiong.wang@arm.com>
964
965         PR ld/18668
966         * elfnn-aarch64.c (aarch64_type_of_stub): Update destination for
967         calls go through plt stub.
968         (elfNN_aarch64_final_link_relocate): Adjust code logic for CALL26,
969         JUMP26 relocation to support inserting veneer for call to plt stub.
970
971 2015-08-11  Jiong Wang  <jiong.wang@arm.com>
972
973         * elfnn-aarch64.c (IS_AARCH64_TLS_RELOC): Recognize
974         BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12.
975         (aarch64_reloc_got_type): Likewise.
976         (elfNN_aarch64_final_link_relocate): Likewise.
977         (elfNN_aarch64_relocate_section): Likewise.
978         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.
979         (_bfd_aarch64_elf_resolve_relocation): Likewise.
980
981 2015-08-11  Jiong Wang  <jiong.wang@arm.com>
982
983         * reloc.c (BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12): New entry.
984         * bfd-in2.h: Regenerate.
985         * libbfd.h: Regenerate.
986         * elfnn-aarch64.c (elfNN_aarch64_howto_table): New entry for
987         BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12.
988
989 2015-08-11  Jiong Wang  <jiong.wang@arm.com>
990
991         * elfnn-aarch64.c (IS_AARCH64_TLS_RELOC): Recognize
992         BFD_RELOC_AARCH64_TLSLD_ADD_LO12_NC.
993         (aarch64_reloc_got_type): Likewise.
994         (elfNN_aarch64_final_link_relocate): Likewise.
995         (elfNN_aarch64_relocate_section): Likewise.
996         (elfNN_aarch64_gc_sweep_hook): Likewise.
997         (elfNN_aarch64_check_relocs): Likewise.
998         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.
999         (_bfd_aarch64_elf_resolve_relocation): Likewise.
1000
1001 2015-08-11  Jiong Wang  <jiong.wang@arm.com>
1002
1003         * reloc.c (BFD_RELOC_AARCH64_TLSLD_ADD_LO12_NC): New entry.
1004         * bfd-in2.h: Regenerate.
1005         * libbfd.h: Regenerate.
1006         * elfnn-aarch64.c (elfNN_aarch64_howto_table): New entry for
1007         BFD_RELOC_AARCH64_TLSLD_ADD_LO12_NC.
1008
1009 2015-08-11  Jiong Wang  <jiong.wang@arm.com>
1010
1011         * elfnn-aarch64.c (IS_AARCH64_TLS_RELOC): Recognize
1012         BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21.
1013         (aarch64_reloc_got_type): Likewise.
1014         (elfNN_aarch64_final_link_relocate): Likewise.
1015         (elfNN_aarch64_relocate_section): Likewise.
1016         (elfNN_aarch64_gc_sweep_hook): Likewise.
1017         (elfNN_aarch64_check_relocs): Likewise.
1018         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.
1019         (_bfd_aarch64_elf_resolve_relocation): Likewise.
1020
1021 2015-08-11  Jiong Wang  <jiong.wang@arm.com>
1022
1023         * reloc.c (BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21): New entry.
1024         * bfd-in2.h: Regenerate.
1025         * libbfd.h: Regenerate.
1026         * elfnn-aarch64.c (elfNN_aarch64_howto_table): New entry for
1027         BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21.
1028
1029 2015-08-11  H.J. Lu  <hongjiu.lu@intel.com>
1030
1031         PR ld/18808
1032         * elf32-i386.c (elf_i386_relocate_section): Skip IFUNC
1033         relocations in debug sections.
1034         * elf64-x86-64.c (elf_x86_64_relocate_section): Likewise.
1035
1036 2015-08-11  Peter Zotov  <whitequark@whitequark.org>
1037
1038         PR ld/18759
1039         * elf32-or1k.c (R_OR1K_32_PCREL): Set pcrel_offset to TRUE.
1040         (R_OR1K_16_PCREL): Likewise.
1041         (R_OR1K_8_PCREL): Likewise.
1042
1043 2015-08-11  Nick Clifton  <nickc@redhat.com>
1044
1045         PR binutils/18747
1046         * coff-sh.c (_bfd_sh_align_load_span): Fix typo when setting
1047         opcode count.
1048
1049         PR binutils/18758
1050         * elf.c (_bfd_elf_setup_sections): Add checks for corrupt section
1051         group information.
1052         * peicode.h (pe_ILF_make_a_section): Ensure alignment of the
1053         used_by_bfd pointer.
1054         (pe_ILF_build_a_bfd): Ensure alignment of vars.data pointer.
1055
1056 2015-08-11  H.J. Lu  <hongjiu.lu@intel.com>
1057
1058         * elf.c (_bfd_elf_copy_private_bfd_data): Fix a typo.
1059
1060 2015-08-10  H.J. Lu  <hongjiu.lu@intel.com>
1061
1062         * elf-bfd.h (elf_symbol_version): New enum.
1063         (elf_link_hash_entry): Replace hidden with versioned.
1064         * elflink.c (_bfd_elf_merge_symbol): Don't look for symbol
1065         version if the symbol is unversioned.  Initialize versioned.
1066         (_bfd_elf_add_default_symbol): Don't look for symbol version
1067         if the symbol is unversioned or hidden.  Initialize versioned.
1068         (elf_collect_hash_codes): Don't look for symbol version if the
1069         symbol is unversioned.
1070         (elf_collect_gnu_hash_codes): Likewise.
1071         (bfd_elf_gc_mark_dynamic_ref_symbol): Likewise.
1072         (_bfd_elf_link_hash_copy_indirect): Check versioned instead of
1073         hidden.
1074         (elf_link_output_extsym): Likewise.
1075
1076 2015-08-07  H.J. Lu  <hongjiu.lu@intel.com>
1077
1078         PR binutils/18785
1079         * elf.c (_bfd_elf_copy_private_bfd_data): When copying the
1080         sh_link and sh_info fields in stripped section headers, we also
1081         check if the sh_type, sh_flags, sh_addralign and sh_entsize
1082         fields of the output section match the output.  Since
1083         --only-keep-debug turns all non-debug sections into SHT_NOBITS
1084         sections, the output SHT_NOBITS type matches any input type.
1085
1086 2015-08-07  H.J. Lu  <hongjiu.lu@intel.com>
1087
1088         PR ld/18720
1089         * elflink.c (_bfd_elf_merge_symbol): Add a parameter to indicate
1090         if the new symbol matches the existing one.  The new hidden
1091         versioned symbol matches the existing symbol if they have the
1092         same symbol version. Update the existing symbol only if they
1093         match.
1094         (_bfd_elf_add_default_symbol): Update call to
1095         _bfd_elf_merge_symbol.
1096         (_bfd_elf_link_assign_sym_version): Don't set the hidden field
1097         here.
1098         (elf_link_add_object_symbols): Override a definition only if the
1099         new symbol matches the existing one.
1100         (_bfd_elf_link_hash_copy_indirect): Don't copy any references to
1101         the hidden versioned symbol.
1102         (elf_link_output_extsym): Bind a symbol locally when linking
1103         executable if it is locally defined, hidden versioned, not
1104         referenced by shared library and not exported.  Turn on
1105         VERSYM_HIDDEN only if the hidden versioned symbol is defined
1106         locally.
1107
1108 2015-08-05  Nick Clifton  <nickc@redhat.com>
1109
1110         * elf.c (_bfd_elf_copy_private_bfd_data): Copy the sh_link and
1111         sh_info fields of sections whose type has been changed to
1112         SHT_NOBITS.
1113
1114 2015-08-04  Yuriy M. Kaminskiy"  <yumkam@gmail.com>
1115             Tyler Hicks  <tyhicks@canonical.com>
1116
1117         PR binutils/18750
1118         * ihex.c (ihex_scan): Fixes incorrect escape sequence in error message
1119         and stack overflow when char is signed and \200-\376 was in place of hex
1120         digit; also fixes \377 was handled as EOF instead of "incorrect character".
1121         (ihex_read_section): Changed for consistency.
1122         (ihex_bad_byte): Prevent (now impossible to trigger) stack
1123         overflow and incorrect escape sequence handling.
1124         * srec.c (srec_bad_byte): Likewise.
1125
1126 2015-08-03  Hans-Peter Nilsson  <hp@axis.com>
1127
1128         * elf32-cris.c (cris_elf_relocate_section)
1129         (elf_cris_finish_dynamic_symbol, cris_elf_check_relocs)
1130         (elf_cris_discard_excess_dso_dynamics): Use SYMBOLIC_BIND, not
1131         just link_info->symbolic, to check if a symbol should be bound
1132         symbolically.
1133
1134 2015-07-30  H.J. Lu  <hongjiu.lu@intel.com>
1135
1136         PR ld/18735
1137         * elflink.c (_bfd_elf_add_default_symbol): Add the default
1138         symbol if not performing a relocatable link.
1139         (elf_link_add_object_symbols): Adjust the default symbol if
1140         not performing a relocatable link.
1141
1142 2015-07-29  H.J. Lu  <hongjiu.lu@intel.com>
1143
1144         * elflink.c (elf_link_add_object_symbols): Remove
1145         !info->relocatable check for info->executable.  Add
1146         !info->relocatable check for !info->executable.
1147         (elf_link_output_extsym): Remove
1148         !info->relocatable check for info->executable.
1149
1150 2015-07-29  Hans-Peter Nilsson  <hp@bitrange.com>
1151
1152         * mmo.c (mmo_write_symbols_and_terminator): Skip symbol-type
1153         assignment loop for bfd plugin objects.
1154
1155 2015-07-28  Alan Modra  <amodra@gmail.com>
1156
1157         * elf.c (_bfd_elf_map_sections_to_segments): Do not make a new
1158         segment for loaded sections after nonloaded sections if the
1159         sections are on the same page.
1160
1161 2015-07-28  Iain Buclaw  <ibuclaw@gdcproject.org>
1162
1163         * configure.in: Add asprintf and vasprintf to AC_CHECK_DECLS.
1164         * config.in, configure: Regenerate.
1165
1166 2015-07-27  H.J. Lu  <hongjiu.lu@intel.com>
1167
1168         * configure: Regenerated.
1169
1170 2015-07-27  Nick Clifton  <nickc@redhat.com>
1171
1172         * elf32-msp430.c (uses_large_model): New function.
1173         (msp430_elf_eh_frame_address_size): New function.
1174         (elf_backend_eh_frame_address_size): Define.
1175
1176 2015-07-27  Szabolcs Nagy  <szabolcs.nagy@arm.com>
1177
1178         PR ld/18705
1179         * elfnn-aarch64.c (elf_backend_extern_protected_data): Define.
1180
1181 2015-07-27  Szabolcs Nagy  <szabolcs.nagy@arm.com>
1182
1183         PR ld/18705
1184         * elf32-arm.c (elf_backend_extern_protected_data): Define.
1185
1186 2015-07-25  H.J. Lu  <hongjiu.lu@intel.com>
1187
1188         PR ld/18718
1189         * elflink.c (elf_link_output_extsym): Check symbol version
1190         section check only if not linking executable, the symbol is
1191         referenced by shared library or not locally defined.
1192
1193 2015-07-25  Thomas Preud'homme  <thomas.preudhomme@arm.com>
1194
1195         * elf32-arm.c (elf32_arm_final_link_relocate): Use SYMBOLIC_BIND to
1196         check if a symbol should be bound symbolically.
1197         * elf32-hppa.c (elf32_hppa_check_relocs,
1198         elf32_hppa_adjust_dynamic_symbol, elf32_hppa_relocate_section,
1199         elf32_hppa_finish_dynamic_symbol): Likewise.
1200         * elf32-m68k.c (elf_m68k_check_relocs,
1201         elf_m68k_relocate_section): Likewise.
1202         * elf32-nios2.c (nios2_elf32_relocate_section,
1203         nios2_elf32_check_relocs, allocate_dynrelocs): Likewise.
1204         * elf32-tic6x.c (elf32_tic6x_finish_dynamic_symbol,
1205         elf32_tic6x_relocate_section): Likewise.
1206
1207 2015-07-24  Alan Modra  <amodra@gmail.com>
1208
1209         * elf.c (_bfd_elf_assign_file_positions_for_non_load): Use .rela
1210         prefix for reloc section corresponding to rela section associated
1211         with renamed debug section.
1212
1213 2015-07-24  Alan Modra  <amodra@gmail.com>
1214
1215         * section.c (bfd_get_section_by_name_if): Iterate over entire hash
1216         chain.
1217
1218 2015-07-23  Joseph Myers  <joseph@codesourcery.com>
1219
1220         * elfxx-mips.c (_bfd_mips_elf_finish_dynamic_sections)
1221         <DT_MIPS_RLD_MAP_REL>: Add target address to host address
1222         difference, not to host pointer.
1223
1224 2015-07-22  Alan Modra  <amodra@gmail.com>
1225
1226         * elf64-ppc.c (opd_entry_value): Remove assertion.  Instead,
1227         return -1 if symbol referenced is not defined.  Tidy.
1228
1229 2015-07-20  Alan Modra  <amodra@gmail.com>
1230
1231         * po/SRC-POTFILES.in: Regenerate.
1232
1233 2015-07-17  Jiong Wang  <jiong.wang@arm.com>
1234
1235         * elfnn-aarch64.c (IS_AARCH64_TLS_RELOC): Sort alphabetically.
1236         (IS_AARCH64_TLSDESC_RELOC): Sort alphabetically.
1237
1238 2015-07-16  Jiong Wang  <jiong.wang@arm.com>
1239
1240         * elfnn-aarch64.c (IS_AARCH64_TLS_RELOC): Recognize
1241         BFD_RELOC_AARCH64_TLSLD_ADR_PREL21.
1242         (aarch64_reloc_got_type): Ditto.
1243         (elfNN_aarch64_final_link_relocate): Ditto.
1244         (elfNN_aarch64_relocate_section): Ditto.
1245         (elfNN_aarch64_gc_sweep_hook): Ditto.
1246         (elfNN_aarch64_check_relocs): Ditto.
1247         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Ditto.
1248         (_bfd_aarch64_elf_resolve_relocation): Ditto.
1249
1250 2015-07-16  Jiong Wang  <jiong.wang@arm.com>
1251
1252         * reloc.c (BFD_RELOC_AARCH64_TLSLD_ADR_PREL21): New entry.
1253         * bfd-in2.h: Regenerate.
1254         * libbfd.h: Regenerate.
1255         * elfnn-aarch64.c (elfNN_aarch64_howto_table): New entry for
1256         BFD_RELOC_AARCH64_TLSLD_ADR_PREL21.
1257
1258 2015-07-10  H.J. Lu  <hongjiu.lu@intel.com>
1259
1260          PR binutils/18656
1261          * bfd.c (bfd_convert_section_size): New function.
1262          (bfd_convert_section_contents): Likewise.
1263          * bfd-in2.h: Regenerated.
1264
1265 2015-07-09  Catherine Moore  <clm@codesourcery.com>
1266
1267         * elflink.c (bfd_elf_size_dynamic_sections): Call to
1268         _bfd_elf_maybe_strip_eh_frame_hdr should be before
1269         bed->elf_backend_size_dynamic_sections.
1270
1271 2015-07-08  Pitchumani Sivanupandi <pitchumani.s@atmel.com>
1272
1273         * elf32-avr.c: Add 32 bit PC relative relocation for AVR target.
1274
1275 2015-07-05  Richard Sandiford  <richard.sandiford@arm.com>
1276
1277         * elf64-ppc.c (toc_adjusting_stub_needed): Use the symbol value
1278         plus addend rather than the original st_value when looking up
1279         entries in opd->adjust.
1280
1281 2015-07-03   Kai Tietz  <ktietz@redhat.com>
1282              Nick Clifton  <nickc@redhat.com>
1283
1284         PR ld/11539
1285         * coffcode.h (coff_bfd_gc_sections): Define default
1286         to bfd_coff_gc_sections function.
1287         (coff_gc_mark_hook_fn): New type.
1288         * coffgen.c (init_reloc_cookie): Copy and adjust coff
1289         related code about gc-sections from elflink.c to here.
1290         (fini_reloc_cookie): Likewise.
1291         (init_reloc_cookie_rels): Likewise.
1292         (fini_reloc_cookie_rels): Likewise.
1293         (init_reloc_cookie_for_section): Likewise.
1294         (fini_reloc_cookie_for_section): Likewise.
1295         (_bfd_coff_gc_mark_hook): Likewise.
1296         (_bfd_coff_gc_mark_rsec): Likewise.
1297         (_bfd_coff_gc_mark_reloc): Likewise.
1298         (_bfd_coff_gc_mark): Likewise.
1299         (_bfd_coff_gc_mark_extra_sections): Likewise.
1300         (coff_gc_sweep_symbol_info): Likewise.
1301         (coff_gc_sweep_symbol): Likewise.
1302         (gc_sweep_hook_fn): Likewise.
1303         (coff_gc_sweep): Likewise.
1304         (bfd_coff_gc_sections): Likewise.
1305         (_bfd_coff_gc_keep): Likewise.
1306         * libcoff-in.h (coff_reloc_cookie): New struct.
1307         (bfd_coff_gc_sections): New prototype.
1308         * libcoff.h: Regenerate.
1309
1310 2015-07-01  Sandra Loosemore  <sandra@codesourcery.com>
1311             Cesar Philippidis  <cesar@codesourcery.com>
1312
1313         * bfd-in2.h: Regenerated.
1314         * elf32-nios2.c (elf_nios2_howto_table_rel): Rename to...
1315         (elf_nios2_r1_howto_table_rel): This.
1316         (elf_nios2_r2_howto_table_rel): New.
1317         (BFD_IS_R2): New.
1318         (lookup_howto): Add ABFD parameter.  Adjust to look up in either
1319         the R1 or R2 relocation table, as determined by ABFD.
1320         (nios2_reloc_map): Add R2 relocations.
1321         (nios2_elf32_bfd_reloc_type_lookup): Do lookup using lookup_howto.
1322         Pass it the ABFD parameter.
1323         (nios2_elf32_bfd_reloc_name_lookup): Use ABFD to decide whether to
1324         return an R1 or R2 relocation.
1325         (nios2_elf32_info_to_howto): Do lookup using lookup_howto.
1326         Pass it the ABFD parameter.
1327         (nios2_elf32_do_call26_relocate): Check for alignment on a 4-byte
1328         boundary.
1329         (nios2_elf32_relocate_section): Adjust call to lookup_howto.
1330         * libbfd.h: Regenerated.
1331         * reloc.c (BFD_RELOC_NIOS2_R2_S12): New.
1332         (BFD_RELOC_NIOS2_R2_I10_1_PCREL): New.
1333         (BFD_RELOC_NIOS2_R2_T1I7_1_PCREL): New.
1334         (BFD_RELOC_NIOS2_R2_T1I7_2): New.
1335         (BFD_RELOC_NIOS2_R2_T2I4): New.
1336         (BFD_RELOC_NIOS2_R2_T2I4_1): New.
1337         (BFD_RELOC_NIOS2_R2_T2I4_2): New.
1338         (BFD_RELOC_NIOS2_R2_X1I7_2): New.
1339         (BFD_RELOC_NIOS2_R2_X2L5): New.
1340         (BFD_RELOC_NIOS2_R2_F1I5_2): New.
1341         (BFD_RELOC_NIOS2_R2_L5I4X1): New.
1342         (BFD_RELOC_NIOS2_R2_T1X1I6): New.
1343         (BFD_RELOC_NIOS2_R2_T1X1I6_2): New.
1344
1345 2015-07-01  Sandra Loosemore  <sandra@codesourcery.com>
1346             Cesar Philippidis  <cesar@codesourcery.com>
1347
1348         * archures.c (bfd_mach_nios2r1, bfd_mach_nios2r2): New.
1349         * bfd-in2.h: Regenerated.
1350         * cpu-nios2.c (nios2_compatible): New.
1351         (N): Use nios2_compatible instead of bfd_default_compatible.
1352         (NIOS2R1_NEXT, NIOS2R2_NEXT): Define.
1353         (arch_info_struct): New.
1354         (bfd_nios2_arch): Chain to NIOS2R1_NEXT.
1355         * elf32-nios2.c (is_nios2_elf): New.
1356         (nios2_elf32_merge_private_bfd_data): New.
1357         (nios2_elf32_object_p): New.
1358         (bfd_elf32_bfd_merge_private_bfd_data): Define.
1359         (elf_backend_object_p): Define.
1360
1361 2015-07-01  H.J. Lu  <hongjiu.lu@intel.com>
1362
1363         * elf64-x86-64.c (elf_x86_64_convert_mov_to_lea): Refactor.
1364
1365 2015-06-30  Nick Clifton  <nickc@redhat.com>
1366
1367         PR binutils/18570
1368         * elf-attrs.c (obj_attr_size): Use an unsigned int type for the tag.
1369         (write_obj_attribute): Likewise.
1370         (elf_new_obj_attr): Likewise.
1371         (bfd_elf_get_obj_attr_int): Likewise.
1372         (bfd_elf_add_obj_attr_int): Likewise.
1373         (bfd_elf_add_obj_attr_string): Likewise.
1374         (bfd_elf_add_obj_attr_int_string): Likewise.
1375         (gnu_obj_attrs_arg_type): Likewise.
1376         (_bfd_elf_obj_attrs_arg_type): Likewise.
1377         (_bfd_elf_parse_attributes): Likewise.
1378         (_bfd_elf_merge_unknown_attribute_list): Likewise.
1379         * elf-bfd.h (struct obj_attribute_list): Likewise.
1380         Update prototypes.
1381
1382 2015-06-28  H.J. Lu  <hongjiu.lu@intel.com>
1383
1384         * bfd-in.h (compressed_debug_section_type): Remove
1385         COMPRESS_DEBUG_ZLIB.
1386         * bfd-in2.h : Regenerated.
1387
1388 2015-06-26  Matthew Fortune  <matthew.fortune@imgtec.com>
1389
1390         * elfxx-mips.c (_bfd_mips_elf_create_dynamic_sections): Use executable
1391         instead of !shared to indicate an application vs shared library.
1392         (_bfd_mips_elf_size_dynamic_sections): Likewise.
1393         (_bfd_mips_elf_finish_dynamic_sections): Handle DT_MIPS_RLD_MAP_REL.
1394         (_bfd_mips_elf_get_target_dtag): Likewise.
1395
1396 2015-06-25  DJ Delorie  <dj@redhat.com>
1397
1398         * elf32-msp430.c (msp430_final_link_relocate): Fix comments.  Fix
1399         REL loads to match RELA stores.
1400
1401 2015-06-25  H.J. Lu  <hongjiu.lu@intel.com>
1402
1403         * elf.c (_bfd_elf_compute_section_file_positions): Don't
1404         initialize sh_size for .shstrtab here.
1405
1406 2015-06-25  H.J. Lu  <hongjiu.lu@intel.com>
1407
1408         PR gas/18451
1409         * elf-bfd.h (elf_sym_strtab): New.
1410         (elf_link_hash_table): Add strtabcount, strtabsize and
1411         strtab.
1412         (_bfd_elf_stringtab_init): Removed.
1413         * elf.c (_bfd_elf_stringtab_init): Removed.
1414         (_bfd_elf_compute_section_file_positions): Replace
1415         bfd_strtab_hash/_bfd_elf_stringtab_init/_bfd_stringtab_free/
1416         _bfd_stringtab_size with
1417         elf_strtab_hash/_bfd_elf_strtab_init/_bfd_elf_strtab_free/
1418         _bfd_elf_strtab_size.  Use _bfd_elf_strtab_add,
1419         _bfd_elf_strtab_finalize and _bfd_elf_strtab_offset to get
1420         st_name.
1421         (swap_out_syms): Likewise.
1422         * elflink.c (elf_final_link_info): Replace bfd_strtab_hash
1423         with elf_strtab_hash.  Remove symbuf, symbuf_count,
1424         symbuf_size and shndxbuf_size.
1425         (elf_link_flush_output_syms): Removed.
1426         (elf_link_output_sym): Renamed to ...
1427         (elf_link_output_symstrtab): This.  Replace _bfd_stringtab_add
1428         with _bfd_elf_strtab_add.  Don't flush symbols to the file nor
1429         swap out symbols.
1430         (elf_link_swap_symbols_out): New.
1431         (elf_link_output_extsym): Replace elf_link_output_sym with
1432         elf_link_output_symstrtab.
1433         (elf_link_input_bfd): Likewise.
1434         (elf_final_link_free): Replace _bfd_stringtab_free with
1435         _bfd_elf_strtab_free.  Remove symbuf.
1436         (bfd_elf_final_link): Replace _bfd_elf_stringtab_init with
1437         _bfd_elf_strtab_init.  Don't set symbuf, symbuf_count,
1438         symbuf_size nor shndxbuf_size.  Initialize strtabsize and
1439         strtab.  Initialize symshndxbuf to -1 when number of sections
1440         >= 64K.  Replace elf_link_output_sym/elf_link_output_sym with
1441         elf_link_output_symstrtab/elf_link_output_symstrtab. Don't
1442         call elf_link_flush_output_syms.  Call _bfd_elf_strtab_finalize
1443         and elf_link_swap_symbols_out.  Replace _bfd_stringtab_size
1444         and _bfd_stringtab_emit with _bfd_elf_strtab_size and
1445         _bfd_elf_strtab_emit.
1446
1447 2015-06-24  H.J. Lu  <hongjiu.lu@intel.com>
1448
1449         * elf64-x86-64.c (elf_x86_64_convert_mov_to_lea): Silence older
1450         GCC warning.
1451
1452 2015-06-24  H.J. Lu  <hongjiu.lu@intel.com>
1453
1454         * elf32-i386.c (elf_i386_allocate_dynrelocs): Always allocate
1455         space for the first .plt entry.
1456         (elf_i386_size_dynamic_sections): Always add DT_PLTGOT for .plt
1457         section.  Add DT_PLTRELSZ, DT_PLTREL and DT_JMPREL only if
1458         there are PLT relocations.
1459         * elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): Always
1460         allocate space for the first .plt entry.
1461         (elf_x86_64_size_dynamic_sections): Always add DT_PLTGOT for
1462         .plt section.  Add DT_PLTRELSZ, DT_PLTREL and DT_JMPREL only if
1463         there are PLT relocations.
1464
1465 2015-06-24  H.J. Lu  <hongjiu.lu@intel.com>
1466
1467         PR ld/18591
1468         * elf64-x86-64.c (elf_x86_64_convert_mov_to_lea): Don't convert
1469         R_X86_64_GOTPCREL to R_X86_64_PC32 if it will cause relocation
1470         overflow.
1471
1472 2015-06-23  Jiong Wang  <jiong.wang@arm.com>
1473
1474         * elfnn-aarch64.c (aarch64_readonly_dynrelocs): New function.
1475         (elfNN_aarch64_size_dynamic_sections): Traverse hash table to check
1476         relocations against read-only sections.
1477
1478 2015-06-18  Nick Clifton  <nickc@redhat.com>
1479
1480         PR 18481
1481         * elf32-arm.c (R_ARM_TLS_LE32): Set the special function to NULL.
1482
1483 2015-06-15  Jon Turney  <jon.turney@dronecode.org.uk>
1484
1485         * bfd.c: Change struct bfd_build_id to use bfd_size_type.
1486         * bfd-in2.h : Regenerate.
1487
1488 2015-06-16  Alan Modra  <amodra@gmail.com>
1489
1490         * elf32-ppc.c (ppc_elf_relocate_section): Correct binary search of
1491         dynamic relocs.
1492
1493 2015-06-10  Jon Turney  <jon.turney@dronecode.org.uk>
1494
1495         * elf-bfd.h : Remove struct elf_build_id.
1496         * bfd.c : Add struct bfd_build_id.
1497         * bfd-in2.h: Regenerate.
1498         * elf.c (elfobj_grok_gnu_build_id): Update to use bfd_build_id.
1499         * libpei.h: Add protoype and macros for
1500         bfd_XXi_slurp_codeview_record.
1501         * peXXigen.c (_bfd_XXi_slurp_codeview_record): Make public
1502         * peicode.h (pe_bfd_read_buildid): Add.
1503         (pe_bfd_object_p): Use pe_bfd_read_buildid().
1504
1505 2015-06-15  Renlin Li  <renlin.li@arm.com>
1506
1507         * reloc.c (BFD_RELOC_AARCH64_LD64_GOTOFF_LO15): New entry.
1508         * bfd-in2.h: Regenerate.
1509         * libbfd.h: Regenerate.
1510         * elfnn-aarch64.c (elfNN_aarch64_howto_table): New entry for
1511         BFD_RELOC_AARCH64_LD64_GOTOFF_LO15.
1512
1513 2015-06-15  Alan Modra  <amodra@gmail.com>
1514
1515         * cofflink.c (_bfd_coff_generic_relocate_section): Revert
1516         2014-03-26 change.  Call _bfd_clear_contents for relocs against
1517         local and global symbols defined in discarded input sections.
1518
1519 2015-06-05  Nick Clifton  <nickc@redhat.com>
1520
1521         * elf32-msp430.c (rl78_sym_diff_handler): New function.
1522         (msp430_howto_table): Use the new function for the SYM_DIFF reloc.
1523         (msp430x_howto_table): Likewise.
1524
1525 2015-06-05  Alan Modra  <amodra@gmail.com>
1526
1527         * elf64-ppc.c (ppc_elf_relocate_section): Move dynamic text
1528         relocs with insns moved by --ppc476-workaround.  Correct
1529         output of REL16 relocs.
1530
1531 2015-06-01  Jiong Wang  <jiong.wang@arm.com>
1532
1533         * elfnn-aarch64.c (aarch64_reloc_got_type): Support
1534         BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14.
1535         (elfNN_aarch64_final_link_relocate): Ditto.
1536         (elfNN_aarch64_gc_swap_hook): Ditto.
1537         (elfNN_aarch64_check_relocs): Ditto.
1538         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Ditto.
1539
1540 2015-06-01  Jiong Wang  <jiong.wang@arm.com>
1541
1542         * reloc.c (BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14): New entry.
1543         * bfd-in2.h: Regenerate.
1544         * libbfd.h: Regenerate.
1545         * elfnn-aarch64.c (elfNN_aarch64_howto_table): New entry for
1546         BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14.
1547
1548 2015-06-01  Jiong Wang  <jiong.wang@arm.com>
1549
1550         * elfnn-aarch64.c (elfNN_aarch64_howto_table): Set overflow type to
1551         complain_overflow_unsigned for BFD_RELOC_AARCH64_TLSLE_ADD_LO12.
1552         * elfxx-aarch64.c (_bfd_aarch64_elf_resolve_relocation): Don't use
1553         PGOFF for BFD_RELOC_AARCH64_TLSLE_ADD_LO12.
1554
1555 2015-06-01  Jiong Wang  <jiong.wang@arm.com>
1556
1557         * elfnn-aarch64.c (aarch64_reloc_got_type): Support
1558         BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15.
1559         (elfNN_aarch64_final_link_relocate): Ditto.
1560         (elfNN_aarch64_gc_swap_hook): Ditto.
1561         (elfNN_aarch64_check_relocs): Ditto.
1562         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Ditto.
1563
1564 2015-06-01  Jiong Wang  <jiong.wang@arm.com>
1565
1566         * reloc.c (BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15): New entry.
1567         * bfd-in2.h: Regenerate.
1568         * libbfd.h: Regenerate.
1569         * elfnn-aarch64.c (elfNN_aarch64_howto_table): New entry for
1570         BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15.
1571
1572 2015-05-28  Catherine Moore  <clm@codesourcery.com>
1573             Bernd Schmidt <bernds@codesourcery.com>
1574             Paul Brook <paul@codesourcery.com>
1575
1576         bfd/
1577         * bfd-in2.h: Regenerated.
1578         * elf-bfd.h (DWARF2_EH_HDR, COMPACT_EH_HDR): Define.
1579         (COMPACT_EH_CANT_UNWIND_OPCODE): Define.
1580         (dwarf_eh_frame_hdr_info): Move dwarf-specific fields from
1581         eh_frame_hdr_info.
1582         (compact_eh_frame_hdr_info): Declare.
1583         (eh_frame_hdr_info):  Redeclare with union for dwarf-specific
1584         fields and compact-eh fields.
1585         (elf_backend_data): Add cant_unwind_opcode and compact_eh_encoding.
1586         (bfd_elf_section_data): Add eh_frame_entry_field.
1587         (elf_section_eh_frame_entry): Define.
1588         (bfd_elf_parse_eh_frame_entries): Declare.
1589         (_bfd_elf_parse_eh_frame_entry): Declare.
1590         (_bfd_elf_end_eh_frame_parsing): Declare.
1591         (_bfd_elf_write_section_eh_frame_entry): Declare.
1592         (_bfd_elf_eh_frame_entry_present): Declare.
1593         (_bfd_elf_section_for_symbol): Declare.
1594         * elf-eh-frame.c (bfd_elf_discard_eh_frame_entry): New function.
1595         (bfd_elf_record_eh_frame_entry): New function.
1596         (_bfd_elf_parse_eh_frame_entry): New function.
1597         (_bfd_elf_parse_eh_frame): Update hdr_info field references.
1598         (cmp_eh_frame_hdr): New function.
1599         (add_eh_frame_hdr_terminator): New function.
1600         (_bfd_elf_end_eh_frame_parsing): New function.
1601         (find_merged_cie): Update hdr_info field references.
1602         (_bfd_elf_discard_section_eh_frame): Likewise.
1603         (_bfd_elf_discard_section_eh_frame_hdr): Add Compact EH support.
1604         (_bfd_elf_eh_frame_entry_present): New function.
1605         (_bfd_elf_maybe_strip_eh_frame_hdr): Add Compact EH support.
1606         (_bfd_elf_write_section_eh_frame_entry): New function.
1607         (_bfd_elf_write_section_eh_frame): Update hdr_info field references.
1608         (_bfd_elf_fixup_eh_frame_hdr): New function.
1609         (write_compact_eh_frame_hdr): New function.
1610         (write_dwarf_eh_frame_hdr): New function.
1611         (_bfd_elf_write_section_eh_frame_hdr): Add Compact EH support.
1612         * elflink.c (_bfd_elf_section_for_symbol): New function.
1613         (elf_section_ignore_discarded_relocs): Add Compact EH support.
1614         (elf_link_input_bfd): Likewise.
1615         (bfd_elf_final_link): Likewise.
1616         (_bfd_elf_gc_mark): Likewise.
1617         (bfd_elf_parse_eh_frame_entries): New function.
1618         (bfd_elf_gc_sections): Add Compact EH support.
1619         (bfd_elf_discard_info): Likewise.
1620         * elfxx-mips.c: Include dwarf2.h.
1621         (_bfd_mips_elf_compact_eh_encoding): New function.
1622         (_bfd_mips_elf_cant_unwind_opcode): New function.
1623         * elfxx-mips.h (_bfd_mips_elf_compact_eh_encoding): Declare.
1624         (_bfd_mips_elf_cant_unwind_opcode): Declare.
1625         (elf_backend_compact_eh_encoding): Define.
1626         (elf_backend_cant_unwind_opcode): Define.
1627         * elfxx-target.h (elf_backend_compact_eh_encoding): Provide default.
1628         (elf_backend_cant_unwind_opcode): Provide default.
1629         (elf_backend_data elfNN_bed): Add elf_backend_compact_eh_encoding and
1630         elf_backend_cant_unwind_opcode.
1631         * section.c (SEC_INFO_TYPE_EH_FRAME_ENTRY): Add definition.
1632
1633 2015-05-27  H.J. Lu  <hongjiu.lu@intel.com>
1634
1635         PR binutils/18458
1636         * elf32-i386.c (elf_i386_check_relocs): Create .plt.got section
1637         for now binding only if pointer equality isn't needed.
1638         (elf_i386_allocate_dynrelocs): Use .plt.got section for now
1639         binding only if pointer equality isn't needed.
1640         * elf64-x86-64.c (elf_x86_64_check_relocs): Create .plt.got
1641         section for now binding only if pointer equality isn't needed.
1642         (elf_x86_64_allocate_dynrelocs): Use .plt.got section for now
1643         binding only if pointer equality isn't needed.
1644
1645 2015-05-26  H.J. Lu  <hongjiu.lu@intel.com>
1646
1647         PR binutils/18437
1648         * elf32-i386.c (elf_i386_get_plt_sym_val): Skip extra relocations
1649         in .rel.plt/.rela.plt.
1650         * elf64-x86-64.c (elf_x86_64_get_plt_sym_val): Likewise.
1651
1652 2015-05-19  Jiong Wang  <jiong.wang@arm.com>
1653
1654         * elfnn-aarch64.c (aarch64_tls_transition_without_check): Sort
1655         relocation case labels alphabetically.
1656         (elfNN_aarch64_final_link_relocate): Ditto.
1657         (elfNN_aarch64_tls_relax): Ditto.
1658         (elfNN_aarch64_relocate_section): Ditto.
1659         (elfNN_aarch64_gc_sweep_hook): Ditto.
1660         (elfNN_aarch64_check_relocs): Ditto.
1661         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Ditto.
1662         (_bfd_aarch64_elf_resolve_relocation): Ditto.
1663
1664 2015-05-18  Jiong Wang  <jiong.wang@arm.com>
1665
1666         * elfnn-aarch64.c (elfNN_aarch64_adjust_dynamic_symbol): Rewrite
1667         comments.
1668
1669 2015-05-16  H.J. Lu  <hongjiu.lu@intel.com>
1670
1671         * elf32-i386.c (elf_i386_check_relocs): Create .plt.got section
1672         for now binding.
1673         (elf_i386_allocate_dynrelocs): Use .plt.got section for now
1674         binding.
1675         * elf64-x86-64.c (elf_x86_64_check_relocs): Create .plt.got
1676         section for now binding.
1677         (elf_x86_64_allocate_dynrelocs): Use .plt.got section for now
1678         binding.
1679
1680 2015-05-14  H.J. Lu  <hongjiu.lu@intel.com>
1681
1682         * bfd.c (bfd_update_compression_header): Also write the zlib
1683         header if the SHF_COMPRESSED bit cleared..
1684         (bfd_check_compression_header): Return the uncompressed size.
1685         * compress.c (decompress_contents): Don't skip the zlib header.
1686         (bfd_compress_section_contents): Properly handle ELFCOMPRESS_ZLIB,
1687         which doesn't have the zlib header.
1688         (bfd_init_section_decompress_status): Likewise.
1689         (bfd_get_full_section_contents): Updated.
1690         (bfd_is_section_compressed): Likewise.
1691         (bfd_is_section_compressed_with_header): Return the uncompressed
1692         size.
1693         * elf.c (_bfd_elf_make_section_from_shdr): Updated.
1694         * bfd-in2.h: Regenerated.
1695
1696 2015-05-14  Jiong Wang  <jiong.wang@arm.com>
1697
1698         * elfnn-aarch64.c (elfNN_aarch64_relocate_section): Remove overflow
1699         check restrictions.
1700
1701 2015-05-14  Max Filippov  <jcmvbkbc@gmail.com>
1702
1703         * elf32-xtensa.c (elf_xtensa_gc_sweep_hook): Treat PLT reference
1704         as GOT reference when plt.refcount is not positive.
1705
1706 2015-05-12  H.J. Lu  <hongjiu.lu@intel.com>
1707
1708         * elf32-i386.c (elf_i386_allocate_dynrelocs): Allocate space
1709         for the first .plt entry only if needed.
1710         * elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): Likewise.
1711
1712 2015-05-11  H.J. Lu  <hongjiu.lu@intel.com>
1713
1714         * Makefile.am (ALL_MACHINES): Add cpu-iamcu.lo.
1715         (ALL_MACHINES_CFILES): Likewise.
1716         * archures.c (bfd_mach_iamcu): New.
1717         (bfd_mach_i386_iamcu): Likewise.
1718         (bfd_mach_i386_iamcu_intel_syntax): Likewise.
1719         (bfd_iamcu_arch): Likewise.
1720         (bfd_archures_list): Add &bfd_iamcu_arch.
1721         * config.bfd (targ_selvecs): Add iamcu_elf32_vec to
1722         i386_elf32_vec.
1723         (targ_archs): Add bfd_iamcu_arch if needed.
1724         * configure.ac: Support iamcu_elf32_vec.
1725         * cpu-iamcu.c: New file.
1726         * elf32-i386.c (elf32_iamcu_elf_object_p): New function.
1727         Add support for iamcu_elf32_vec and elf32_iamcu_bed.
1728         * targets.c (iamcu_elf32_vec): New.
1729         (_bfd_target_vector): Add iamcu_elf32_vec.
1730         * Makefile.in: Regenerated.
1731         * bfd-in2.h: Likewise.
1732         * configure: Likewise.
1733
1734 2015-05-11  H.J. Lu  <hongjiu.lu@intel.com>
1735
1736         * elfcode.h (elf_object_p): Replace EM_486 with EM_IAMCU.
1737
1738 2015-05-10  H.J. Lu  <hongjiu.lu@intel.com>
1739
1740         * elf32-i386.c (elf_i386_convert_mov_to_lea): Replace input_bfd
1741         and output_bfd with abfd.
1742         * elf64-x86-64.c (elf_x86_64_convert_mov_to_lea): Likewise.
1743
1744 2015-05-06  Toni Spets  <toni.spets@iki.fi>
1745
1746         PR ld/18372
1747         * peXXigen.c (rsrc_process_section): Skip discarded resource
1748         sections.
1749
1750 2015-05-01  H.J. Lu  <hongjiu.lu@intel.com>
1751
1752         * config.bfd: Support i[3-7]86-*-elf*.
1753
1754 2015-04-30  H.J. Lu  <hongjiu.lu@intel.com>
1755
1756         * elf32-i386.c (elf_backend_post_process_headers): Undef for
1757         Solaris 2.
1758
1759 2015-04-30  Nick Clifton  <nickc@redhat.com>
1760
1761         PR 18317
1762         * elf32-mep.c (MEPREL): Use bfd_elf_generic_reloc instead of
1763         mep_reloc.
1764         (mep_reloc): Delete unused function.
1765
1766 2015-04-29  Nick Clifton  <nickc@redhat.com>
1767
1768         PR 17099
1769         * coff-i386.c (coff_i386_rtype_to_howto): Allow absolute PCRLONG
1770         relocs.
1771
1772 2015-04-27  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
1773
1774         * elf-s390-common.c (elf_s390_merge_obj_attributes): New function.
1775         * elf32-s390.c (elf32_s390_merge_private_bfd_data): Call
1776         elf_s390_merge_obj_attributes.
1777         * elf64-s390.c (elf64_s390_merge_private_bfd_data): New function.
1778
1779 2015-04-24  Jiong Wang  <jiong.wang@arm.com>
1780
1781         PR ld/18270
1782         * elfnn-aarch64.c (elfNN_aarch64_size_dynamic): Count local symbol for
1783         GOT_NORMAL for both sgot/srelgot section.
1784         (elfNN_aarch64_final_link_relocate): Relocate against GOT entry address
1785         and generate necessary runtime relocation for GOT entry.
1786
1787 2015-04-24  H.J. Lu  <hongjiu.lu@intel.com>
1788
1789         PR binutils/18209
1790         * archive.c (_bfd_get_elt_at_filepos): Copy is_linker_input.
1791
1792 2015-04-24  Jiong Wang  <jiong.wang@arm.com>
1793
1794         * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Reject
1795         PC-relative relocation for external symbol.
1796
1797 2015-04-24  Nick Clifton  <nickc@redhat.com>
1798
1799         PR 18313
1800         * compress.c (decompress_contents): Zero initialse the z_stream
1801         structure.
1802
1803 2015-04-24  Nick Clifton  <nickc@redhat.com>
1804
1805         * elf.c (_bfd_elf_is_local_label_name): Extend test for assembler
1806         local labels to include local labels with a numeric suffix and
1807         fake symbols.
1808
1809 2015-04-24  H.J. Lu  <hongjiu.lu@intel.com>
1810
1811         PR binutils/18316
1812         * section.c (SEC_MEP_VLIW): New.
1813         * bfd-in2.h: Regenerated.
1814
1815 2015-04-23  H.J. Lu  <hongjiu.lu@intel.com>
1816
1817         PR ld/18277
1818         * compress.c (bfd_compress_section_contents): Remove the
1819         write_compress argument.
1820         (bfd_init_section_compress_status): Updated.
1821         (bfd_compress_section): Likewise.
1822         * elf.c (_bfd_elf_set_reloc_sh_name): New.
1823         (_bfd_elf_init_reloc_shdr): Add delay_st_name_p.  Set sh_name
1824         to (unsigned int) -1 if delay_st_name_p is TRUE.  Use
1825         _bfd_elf_set_reloc_sh_name.
1826         (elf_fake_sections): Don't rename DWARF debug section for
1827         linker output if it will be compressed.  Instead, set
1828         delay_st_name_p to TRUE and pass it to _bfd_elf_init_reloc_shdr.
1829         (assign_section_numbers): Call _bfd_elf_strtab_addref only if
1830         sh_name != (unsigned int) -1.  Don't finalize nor assign
1831         shstrtab section here.  Delay setting output section names to
1832         _bfd_elf_write_object_contents.
1833         (_bfd_elf_compute_section_file_positions): Update comments on
1834         sh_offset for shstrtab section.
1835         (assign_file_positions_for_non_load_sections): Set sh_offset to
1836         -1 for shstrtab section.
1837         (assign_file_positions_except_relocs): Likewise.
1838         (_bfd_elf_assign_file_positions_for_non_load): Set up sh_name
1839         when compressing DWARF debug sections.  Place shstrtab section
1840         after DWARF debug sections have been compressed.
1841         (_bfd_elf_write_object_contents): Setting sh_name for output
1842         sections.
1843
1844 2015-04-23  H.J. Lu  <hongjiu.lu@intel.com>
1845
1846         PR binutils/18209
1847         * bfd.c (bfd): Add is_linker_input.
1848         * elf.c (convert_debug_to_zdebug): New.
1849         (convert_zdebug_to_debug): Likewise.
1850         (_bfd_elf_make_section_from_shdr): Don't convert .debug_* to
1851         .zdebug_* here.  Use convert_zdebug_to_debug.  Set SEC_ELF_RENAME.
1852         (_bfd_elf_init_reloc_shdr): Pass a pointer to section name
1853         instead of a pointer to section.
1854         (elf_fake_sections): Rename the section name if SEC_ELF_RENAME
1855         is set.
1856         * section.c (SEC_ELF_RENAME): New.
1857         * bfd-in2.h: Regenerated.
1858
1859 2015-04-23  Alan Modra  <amodra@gmail.com>
1860
1861         * elf64-ppc.c (TOC_BASE_ALIGN): Define.
1862         (ppc64_elf_next_toc_section): Align multi-got toc base.
1863         (ppc64_elf_set_toc): Likewise initial toc base and .TOC. symbol.
1864
1865 2015-04-22  H.J. Lu  <hongjiu.lu@intel.com>
1866
1867         PR ld/18289
1868         * elf32-i386.c (elf_i386_link_hash_entry): Add gotoff_ref.
1869         (elf_i386_link_hash_newfunc): Initialize gotoff_ref to 0.
1870         (elf_i386_create_dynamic_sections): Always allow copy relocs for
1871         building executables.
1872         (elf_i386_copy_indirect_symbol): Also copy gotoff_ref.
1873         (elf_i386_check_relocs): Set gotoff_ref for R_386_GOTOFF.
1874         (elf_i386_adjust_dynamic_symbol): Also allocate copy relocs for
1875         PIE and R_386_GOTOFF.
1876         (elf_i386_relocate_section): Allow R_386_GOTOFF in executable.
1877
1878 2015-04-20  H.J. Lu  <hongjiu.lu@intel.com>
1879
1880         * elf.c (assign_section_numbers): Always set up sh_name.
1881
1882 2015-04-20  H.J. Lu  <hongjiu.lu@intel.com>
1883
1884         * elf.c (assign_file_positions_for_non_load_sections): Iterate
1885         sections by pointer.
1886         (_bfd_elf_assign_file_positions_for_non_load): Likewise.
1887
1888 2015-04-14  H.J. Lu  <hongjiu.lu@intel.com>
1889
1890         * bfd-in.h (compressed_debug_section_type): New.
1891         * compress.c (bfd_compress_section_contents): Add an argument
1892         for linker write compression and always generate .zdebug_*
1893         section when linking.
1894         (bfd_init_section_compress_status): Pass FALSE to
1895         bfd_compress_section_contents.
1896         (bfd_compress_section): New function.
1897         * elf.c (elf_fake_sections): For linking, set SEC_ELF_COMPRESS
1898         on DWARF debug sections if COMPRESS_DEBUG is set and rename
1899         section if COMPRESS_DEBUG_GABI_ZLIB isn't set.
1900         (assign_file_positions_for_non_load_sections): Set sh_offset
1901         to -1 if SEC_ELF_COMPRESS is set.
1902         (assign_file_positions_except_relocs): Likwise.
1903         (_bfd_elf_assign_file_positions_for_relocs): Renamed to ...
1904         (_bfd_elf_assign_file_positions_for_non_load): This.  Change
1905         return time to bfd_boolean.  Compress the section if
1906         SEC_ELF_COMPRESS is set.
1907         (_bfd_elf_write_object_contents): Updated.
1908         (_bfd_elf_set_section_contents): Write section contents to
1909         the buffer if SEC_ELF_COMPRESS is set.
1910         * merge.c: Include "elf-bfd.h".
1911         (sec_merge_emit): Add arguments for contents and offset.  Write
1912         to contents with offset if contents isn't NULL.
1913         (_bfd_write_merged_section): Write section contents to the
1914         buffer if SEC_ELF_COMPRESS is set.  Pass contents and
1915         output_offset to sec_merge_emit.
1916         * elflink.c (bfd_elf_final_link): Allocate the buffer for
1917         output section contents if SEC_ELF_COMPRESS is set.
1918         * section.c (SEC_ELF_COMPRESS): New.
1919         * bfd-in2.h: Regenerated.
1920
1921 2015-04-15  Alan Modra  <amodra@gmail.com>
1922
1923         * elf32-rl78.c (rl78_elf_relocate_section): Typo fix.
1924
1925 2015-04-14  Nick Clifton  <nickc@redhat.com>
1926
1927         * elf32-rl78.c (RL78_OP_REL): New macro.
1928         (rl78_elf_howto_table): Use it for complex relocs.
1929         (get_symbol_value): Handle the cases when the info or status
1930         arguments are NULL.
1931         (get_romstart): Cache the status returned by get_symbol_value.
1932         (get_ramstart): Likewise.
1933         (RL78_STACK_PUSH): Generate an error message if the stack
1934         overflows.
1935         (RL78_STACK_POP): Likewise for underflows.
1936         (rl78_compute_complex_reloc): New function.  Contains the basic
1937         processing code for all RL78 complex relocs.
1938         (rl78_special_reloc): New function.  Provides special reloc
1939         handling for complex relocs.
1940         (rl78_elf_relocate_section): Use rl78_compute_complex_reloc.
1941         (rl78_offset_for_reloc): Likewise.
1942
1943 2015-04-14  H.J. Lu  <hongjiu.lu@intel.com>
1944
1945         PR ld/pr17709
1946         * elflink.c (_bfd_elf_adjust_dynamic_copy): Check
1947         info->extern_protected_data when warning copy relocs against
1948         protected symbols.
1949         (_bfd_elf_symbol_refs_local_p): Check info->extern_protected_data
1950         when checking protected non-function symbols.
1951
1952 2015-04-13  John Baldwin  <jhb@FreeBSD.org>
1953
1954         * elf.c (elfcore_grok_note): Recognize NT_X86_XSTATE on
1955         FreeBSD.
1956         (elfcore_write_xstatereg): Use correct note name on FreeBSD.
1957
1958 2015-04-13  H.J. Lu  <hongjiu.lu@intel.com>
1959
1960         PR ld/18250
1961         * elflink.c (elf_link_is_defined_archive_symbol): Return FALSE
1962         if the object has been claimed by plugin.
1963
1964 2015-04-11  H.J. Lu  <hongjiu.lu@intel.com>
1965
1966         * elf32-i386.c (elf_i386_relocate_section): Replace SYMBOLIC_BIND
1967         with SYMBOL_REFERENCES_LOCAL when checking R_386_GOTOFF against
1968         protected data symbol when building shared library.
1969         * elf64-x86-64.c (elf_x86_64_relocate_section): Check
1970         R_X86_64_GOTOFF64 against undefined symbol and replace
1971         SYMBOLIC_BIND with SYMBOL_REFERENCES_LOCAL when checking
1972         R_X86_64_GOTOFF64 against protected data symbol when building
1973         shared library.
1974
1975 2015-04-10  H.J. Lu  <hongjiu.lu@intel.com>
1976
1977         PR ld/pr17709
1978         * elf32-i386.c (elf_i386_relocate_section): Also check R_386_GOTOFF
1979         against protected data symbol when building shared library.
1980         * elf64-x86-64.c (elf_x86_64_relocate_section): Also check
1981         R_X86_64_GOTOFF64 against protected data symbol when building
1982         shared library.
1983
1984 2015-04-10  H.J. Lu  <hongjiu.lu@intel.com>
1985
1986         PR ld/pr15228
1987         PR ld/pr17709
1988         * elf-bfd.h (elf_backend_data): Add extern_protected_data.
1989         * elf32-i386.c (elf_backend_extern_protected_data): New.
1990         Defined to 1.
1991         * elf64-x86-64.c (elf_backend_extern_protected_data): Likewise.
1992         * elflink.c (_bfd_elf_adjust_dynamic_copy): Don't error on
1993         copy relocs against protected symbols if extern_protected_data
1994         is true.
1995         (_bfd_elf_symbol_refs_local_p): Don't return true on protected
1996         non-function symbols if extern_protected_data is true.
1997         * elfxx-target.h (elf_backend_extern_protected_data): New.
1998         Default to 0.
1999         (elfNN_bed): Initialize extern_protected_data with
2000         elf_backend_extern_protected_data.
2001
2002 2015-04-10  H.J. Lu  <hongjiu.lu@intel.com>
2003
2004         * compress.c (bfd_compress_section_contents): Replace bfd_malloc
2005         and free with bfd_alloc and bfd_release on compressed buffer.
2006         Release buffer if compressed section isn't smaller.
2007
2008 2015-04-10  Alan Modra  <amodra@gmail.com>
2009
2010         PR ld/18222
2011         * elflink.c (_bfd_elf_adjust_dynamic_copy): Don't report an error
2012         on adding a protected visibility variable to .dynbss.
2013
2014 2015-04-10  Alan Modra  <amodra@gmail.com>
2015
2016         Revert 2015-03-05  H.J. Lu  <hongjiu.lu@intel.com>
2017         PR ld/pr15228
2018         PR ld/pr17709
2019         * elf-bfd.h (elf_backend_data): Delete extern_protected_data.
2020         * elf32-i386.c (elf_backend_extern_protected_data): Delete.
2021         * elf64-x86-64.c (elf_backend_extern_protected_data): Likewise.
2022         * elflink.c (_bfd_elf_adjust_dynamic_copy): Remove
2023         extern_protected_data test.
2024         (_bfd_elf_symbol_refs_local_p): Likewise.
2025         * elfxx-target.h (elf_backend_extern_protected_data): Delete.
2026         (elfNN_bed): Delete elf_backend_extern_protected_data init.
2027
2028 2015-04-09  H.J. Lu  <hongjiu.lu@intel.com>
2029
2030         * compress.c (bfd_compress_section_contents): Update comments.
2031         (bfd_init_section_decompress_status): Likewise.
2032         (bfd_init_section_compress_status): Likewise.
2033
2034 2015-04-09  H.J. Lu  <hongjiu.lu@intel.com>
2035
2036         * elfxx-target.h (TARGET_BIG_SYM): Add BFD_COMPRESS_GABI to
2037         object_flags.
2038         (TARGET_LITTLE_SYM): Likewise.
2039
2040 2015-04-09  Max Filippov  <jcmvbkbc@gmail.com>
2041
2042         * elf32-xtensa.c (splay-tree.h): include header.
2043         (text_action_struct): drop next pointer.
2044         (text_action_list_struct): drop head pointer, add count and
2045         tree fields.
2046         (find_fill_action): instead of linear search in text_action_list
2047         search in the tree.
2048         (text_action_compare, action_first, action_next): new functions.
2049         (text_action_add, text_action_add_literal): instead of linear
2050         search and insertion insert new node into the tree.
2051         (removed_by_actions): pass additional parameter: action_list,
2052         use it to traverse the tree.
2053         (offset_with_removed_text): pass additional action_list parameter
2054         to removed_by_actions.
2055         (map_action_fn_context): new typedef.
2056         (map_action_fn_context_struct): new structure.
2057         (map_action_fn): new function.
2058         (map_removal_by_action): use splay_tree_foreach to build map.
2059         (find_insn_action): replace linear search in text_action_list
2060         with series of splay_tree_lookups.
2061         (print_action, print_action_list_fn): new functions.
2062         (print_action_list): use splay_tree_foreach.
2063         (init_xtensa_relax_info): drop action_list.head initialization.
2064         Initialize the tree.
2065         (compute_text_actions): use non-zero action_list_count instead of
2066         non-NULL action list.
2067         (xlate_map_context): new typedef.
2068         (xlate_map_context_struct): new structure.
2069         (xlate_map_fn): new function.
2070         (build_xlate_map): use splay_tree_foreach to build map.
2071         (action_remove_bytes_fn): new function.
2072         (relax_section): use zero action_list_count instead of NULL
2073         action list. Use splay_tree_foreach to count final section size.
2074         Drop unused variable 'removed'.
2075
2076 2015-04-09  Max Filippov  <jcmvbkbc@gmail.com>
2077
2078         * elf32-xtensa.c (removed_literal_map_entry): new typedef.
2079         (removed_literal_map_entry_struct): new structure.
2080         (removed_literal_list_struct): add new fields: n_map and map.
2081         (map_removed_literal, removed_literal_compare): new functions.
2082         (find_removed_literal): build index array for literals ordered
2083         by VMA, use binary search to find removed literal.
2084
2085 2015-04-09  Max Filippov  <jcmvbkbc@gmail.com>
2086
2087         * elf32-xtensa.c (removal_by_action_entry_struct,
2088         removal_by_action_map_struct): new structures.
2089         (removal_by_action_entry, removal_by_action_map): new typedefs.
2090         (text_action_list_struct): add new field: map.
2091         (map_removal_by_action, removed_by_actions_map,
2092         offset_with_removed_text_map): new functions.
2093         (relax_section): replace offset_with_removed_text with
2094         offset_with_removed_text_map.
2095         (translate_reloc, relax_property_section, relax_section_symbols):
2096         replace removed_by_actions with removed_by_actions_map.
2097
2098 2015-04-09  Max Filippov  <jcmvbkbc@gmail.com>
2099
2100         * elf32-xtensa.c (reloc_range_list, reloc_range_list_entry,
2101         reloc_range): new typedef.
2102         (reloc_range_list_struct, reloc_range_list_entry_struct,
2103         reloc_range_struct): new structures.
2104         (reloc_range_compare, build_reloc_ranges,
2105         reloc_range_list_append, reloc_range_list_remove,
2106         reloc_range_list_update_range, free_reloc_range_list): new
2107         functions.
2108         (compute_text_actions): precompute relocation opcodes before the
2109         loop. Add relevant_relocs variable, initialize it before the
2110         loop, pass it to the check_section_ebb_pcrels_fit.
2111         (check_section_ebb_pcrels_fit): add new parameter:
2112         relevant_relocs. Update address range in the relevant_relocs if
2113         it's non-NULL and iterate only over relevant relocations.
2114
2115 2015-04-09  Nick Clifton  <nickc@redhat.com>
2116
2117         * elf32-rx.c (describe_flags): Report the settings of the string
2118         insn using bits.
2119         (rx_elf_merge_private_bfd_data): Handle merging of the string insn
2120         using bits.
2121
2122 2015-04-08  H.J. Lu  <hongjiu.lu@intel.com>
2123
2124         * compress.c (bfd_compress_section_contents): Work around a GCC
2125         uninitialized warning bug fixed in GCC 4.7.
2126
2127 2015-04-08  H.J. Lu  <hongjiu.lu@intel.com>
2128
2129         * archive.c (_bfd_get_elt_at_filepos): Also copy BFD_COMPRESS_GABI
2130         bit.
2131         * bfd.c (bfd::flags): Increase size to 18 bits.
2132         (BFD_COMPRESS_GABI): New.
2133         (BFD_FLAGS_SAVED): Add BFD_COMPRESS_GABI.
2134         (BFD_FLAGS_FOR_BFD_USE_MASK): Likewise.
2135         (bfd_update_compression_header): New fuction.
2136         (bfd_check_compression_header): Likewise.
2137         (bfd_get_compression_header_size): Likewise.
2138         (bfd_is_section_compressed_with_header): Likewise.
2139         * compress.c (MAX_COMPRESSION_HEADER_SIZE): New.
2140         (bfd_compress_section_contents): Return the uncompressed size if
2141         the full section contents is compressed successfully.  Support
2142         converting from/to .zdebug* sections.
2143         (bfd_get_full_section_contents): Call
2144         bfd_get_compression_header_size to get compression header size.
2145         (bfd_is_section_compressed): Renamed to ...
2146         (bfd_is_section_compressed_with_header): This.  Add a pointer
2147         argument to return compression header size.
2148         (bfd_is_section_compressed): Use it.
2149         (bfd_init_section_decompress_status): Call
2150         bfd_get_compression_header_size to get compression header size.
2151         Return FALSE if uncompressed section size is 0.
2152         * elf.c (_bfd_elf_make_section_from_shdr): Support converting
2153         from/to .zdebug* sections.
2154         * bfd-in2.h: Regenerated.
2155
2156 2015-04-07  Alan Modra  <amodra@gmail.com>
2157
2158         * elf.c (_bfd_elf_get_reloc_section): Allow for .got.plt being
2159         mapped to output .got section.
2160
2161 2015-04-07  Alan Modra  <amodra@gmail.com>
2162
2163         * elf32-ppc.c (struct ppc_elf_link_hash_entry): Add has_addr16_ha
2164         and has_addr16_lo.  Make has_sda_refs a bitfield.
2165         (ppc_elf_check_relocs): Set new flags.
2166         (ppc_elf_link_hash_table_create): Update default_params.
2167         (ppc_elf_adjust_dynamic_symbol): Clear protected_def in cases
2168         where we won't be making .dynbss entries or editing code.  Set
2169         params->pic_fixup when we'll edit code for protected var access.
2170         (allocate_dynrelocs): Allocate got entry for edited code and
2171         discard dyn_relocs.
2172         (struct ppc_elf_relax_info): Add picfixup_size.
2173         (ppc_elf_relax_section): Rename struct one_fixup to struct
2174         one_branch_fixup.  Rename fixups to branch_fixups.  Size space for
2175         pic fixups.
2176         (ppc_elf_relocate_section): Edit non-PIC accessing protected
2177         visibility variables to PIC.  Don't emit dyn_relocs for code
2178         we've edited.
2179         * elf32-ppc.h (struct ppc_elf_params): Add pic_fixup.
2180
2181 2015-04-07  Nick Clifton  <nickc@redhat.com>
2182
2183         * elf.c (_bfd_elf_is_local_label_name): Treat assembler generated
2184         local labels as local.
2185
2186 2015-04-06  H.J. Lu  <hongjiu.lu@intel.com>
2187
2188         * compress.c (get_uncompressed_size): Removed.
2189         (bfd_compress_section_contents): Use bfd_putb64 to write
2190         uncompressed section size.
2191         (bfd_init_section_decompress_status): Replace
2192         get_uncompressed_size with bfd_getb64.
2193
2194 2015-04-04  H.J. Lu  <hongjiu.lu@intel.com>
2195
2196         * elf.c (_bfd_elf_init_private_section_data): Also preserve the
2197         SHF_COMPRESSED bit if not decompress.
2198
2199 2015-04-04  H.J. Lu  <hongjiu.lu@intel.com>
2200
2201         * compress.c (get_uncompressed_size): New.  Extracted from ...
2202         (bfd_init_section_decompress_status): This.  Use it.
2203
2204 2015-04-02  Andrew Turner  <andrew@freebsd.org>
2205
2206         * config.bfd: Add aarch64-*-freebsd* target triple.
2207
2208 2015-04-02  H.J. Lu  <hongjiu.lu@intel.com>
2209
2210         * configure: Regenerated.
2211
2212 2015-04-01  Tejas Belagod  <tejas.belagod@arm.com>
2213             Marcus Shawcroft  <marcus.shawcroft@arm.com>
2214             Jiong Wang  <jiong.wang@arm.com>
2215
2216         * bfd-in.h (bfd_elf64_aarch64_set_options)
2217         (bfd_elf32_aarch64_set_options): Add parameter.
2218         * bfd-in2.h: Regenerated.
2219         * elfnn-aarch64.c (aarch64_erratum_843419_stub)
2220         (_bfd_aarch64_adrp_p, _bfd_aarch64_erratum_843419_sequence_p)
2221         (_bfd_aarch64_erratum_843419_stub_name)
2222         (_bfd_aarch64_erratum_843419_fixup)
2223         (_bfd_aarch64_erratum_843419_scan)
2224         (_bfd_aarch64_erratum_843419_branch_to_stub)
2225         (_bfd_aarch64_erratum_843419_p): Define.
2226         (enum elf_aarch64_stub_type): Define
2227         aarch64_stub_erratum_843419_veneer.
2228         (struct elf_aarch64_stub_hash_entry): Define adrp_offset.
2229         (struct elf_aarch64_link_hash_table): Define fix_erratum_843419
2230         and fix_erratum_843419_adr.
2231         (stub_hash_newfunc): Initialize adrp_offset;
2232         (_bfd_aarch64_add_stub_entry_after): Define.
2233         (aarch64_map_one_stub, aarch64_build_one_stub)
2234         (aarch64_size_one_stub): Handle
2235         aarch64_stub_erratum_843419_veneer.
2236         (_bfd_aarch64_resize_stubs): Round stub section size.
2237         (elfNN_aarch64_size_stubs): Add scan for 843419.
2238         (bfd_elfNN_aarch64_set_options): Add parameter. Initialize
2239         fix_erratum_843419 and fix_erratum_843419_adr.
2240         (struct erratum_835769_branch_to_stub_data): Add info.
2241         (elfNN_aarch64_write_section): Initialise info.  Handle 843419.
2242         (elfNN_aarch64_size_dynamic_sections): Handle 843419.
2243         * elfxx-aarch64.c (_bfd_aarch64_decode_adrp_imm)
2244         (_bfd_aarch64_sign_extend): Define.
2245         (reencode_adr_imm): Remove static. Rename to:
2246         (_bfd_aarch64_reencode_adr_imm): Define.
2247         (_bfd_aarch64_elf_put_addend): Call _bfd_aarch64_reencode_adr_imm.
2248         * elfxx-aarch64.h (AARCH64_ADR_OP, AARCH64_ADRP_OP)
2249         (AARCH64_ADRP_OP_MASK, _bfd_aarch64_sign_extend)
2250         (_bfd_aarch64_decode_adrp_imm, _bfd_aarch64_reencode_adr_imm):
2251         Define.
2252
2253 2015-04-01  H.J. Lu  <hongjiu.lu@intel.com>
2254
2255         * configure: Regenerated.
2256
2257 2015-03-31  Ed Schouten  <ed@nuxi.nl>
2258
2259         * config.bfd (targ_defvec): Set to x86_64_elf64_cloudabi_vec
2260         for x86_64-*-cloudabi*.
2261         * configure.ac: Handle x86_64_elf64_cloudabi_vec.
2262         * configure: Regenerated.
2263         * elf64-x86-64.c (TARGET_LITTLE_SYM): Support x86_64-*-cloudabi*.
2264         (TARGET_LITTLE_NAME): Likewise.
2265         (ELF_OSABI): Likewise.
2266         (elf64_bed): Likewise.
2267         * targets.c (x86_64_elf64_cloudabi_vec): New.
2268         (_bfd_target_vector): Add x86_64_elf64_cloudabi_vec.
2269
2270 2015-03-31  H.J. Lu  <hongjiu.lu@intel.com>
2271
2272         * configure.ac: Revert the AM_ZLIB change.
2273         * Makefile.in: Regenerated.
2274         * aclocal.m4: Likewise.
2275         * configure: Likewise.
2276         * doc/Makefile.in: Likewise.
2277
2278 2015-03-30  H.J. Lu  <hongjiu.lu@intel.com>
2279
2280         PR ld/18169
2281         * elf-bfd.h (elf_backend_data): Add get_reloc_section.
2282         (_bfd_elf_get_reloc_section): New.
2283         * elf.c (_bfd_elf_get_reloc_section): Likewise.
2284         (assign_section_numbers): Call get_reloc_section to look up the
2285         section the relocs apply.
2286         * elfxx-target.h (elf_backend_get_reloc_section): Likewise.
2287         (elfNN_bed): Initialize get_reloc_section with
2288         elf_backend_get_reloc_section.
2289
2290 2015-03-29  H.J. Lu  <hongjiu.lu@intel.com>
2291
2292         * Makefile.am (ZLIB): New.
2293         (ZLIBINC): Likewise.
2294         (AM_CFLAGS): Add $(ZLIBINC).
2295         (libbfd_la_LIBADD): Add $(ZLIB).
2296         * compress.c: Don't check HAVE_ZLIB_H to include <zlib.h>.
2297         (decompress_contents): Don't check HAVE_ZLIB_H.
2298         (bfd_compress_section_contents): Likewise.
2299         (bfd_get_full_section_contents): Likewise.
2300         (bfd_init_section_decompress_status): Likewise.
2301         (bfd_init_section_compress_status): Likewise.
2302         * configure.ac (AM_ZLIB): Removed.
2303         (zlibdir): New.  AC_SUBST.
2304         (zlibinc): Likewise.
2305         Add --with-system-zlib.
2306         * Makefile.in: Regenerated.
2307         * acinclude.m4: Likewise.
2308         * config.in: Likewise.
2309         * configure: Likewise.
2310         * doc/Makefile.in: Likewise.
2311
2312 2015-03-27  Alan Modra  <amodra@gmail.com>
2313
2314         PR ld/15228
2315         PR ld/18167
2316         * elflink.c (elf_merge_st_other): Add "sec" parameter.  Don't set
2317         protected_def when symbol section is read-only.  Adjust all calls.
2318         * elf-bfd.h (struct elf_link_hash_entry): Update protected_def comment.
2319
2320 2015-03-26  Tejas Belagod  <tejas.belagod@arm.com>
2321
2322         * elfnn-aarch64.c (aarch64_build_one_stub): Replace the call to generic
2323         _bfd_final_link_relocate with aarch64_relocate.
2324
2325 2015-03-26  H.J. Lu  <hongjiu.lu@intel.com>
2326
2327         PR ld/18160
2328         * elflink.c (elf_gc_sweep): Skip if relocation is incompatible.
2329         (bfd_elf_gc_sections): Likewise.
2330
2331 2015-03-25  Marcus Shawcroft  <marcus.shawcroft@arm.com>
2332
2333         * elfnn-aarch64.c (_bfd_aarch64_resize_stubs): Adjust stub section
2334         size for initial branch.
2335         (elfNN_aarch64_build_stubs): Write initial branch.
2336         _bfd_aarch64_decode_(elfNN_aarch64_output_arch_local_syms): Write
2337         mapping symbol on initial branch.
2338
2339 2015-03-25  Marcus Shawcroft  <marcus.shawcroft@arm.com>
2340
2341         * elfnn-aarch64.c (_bfd_aarch64_erratum_835769_scan):
2342         Update erratum count.
2343
2344 2015-03-25  Senthil Kumar Selvaraj  <senthil_kumar.selvaraj@atmel.com>
2345
2346         * elflink.c (_bfd_elf_gc_mark_extra_sections): Don't break on
2347         first matching debug section.
2348
2349 2015-03-24  H.J. Lu  <hongjiu.lu@intel.com>
2350
2351         PR gas/18087
2352         * compress.c (bfd_compress_section_contents): Don't write the
2353         zlib header and set contents as well as compress_status if
2354         compression didn't make the section smaller.
2355         (bfd_init_section_compress_status): Don't check compression
2356         size here.
2357
2358 2015-03-24  Nick Clifton  <nickc@redhat.com>
2359
2360         PR binutils/17512
2361         * coffgen.c (coff_get_normalized_symtab): Fix test for out of
2362         range auxillary sections.
2363
2364 2015-03-24  Marcus Shawcroft  <marcus.shawcroft@arm.com>
2365
2366         * elfnn-aarch64.c (_bfd_aarch64_create_or_find_stub_sec): Factor
2367         code into:
2368         (_bfd_aarch64_get_stub_for_link_section): Define.
2369
2370 2015-03-24  Marcus Shawcroft  <marcus.shawcroft@arm.com>
2371
2372         * elfnn-aarch64.c (_bfd_aarch64_create_or_find_stub_sec): Adjust
2373         update of section_group[].stub_sec.
2374
2375 2015-03-24  Marcus Shawcroft  <marcus.shawcroft@arm.com>
2376
2377         * elfnn-aarch64.c (struct aarch64_erratum_835769_fix) Remove.
2378         (erratum_835769_scan) Drop fix_table_size_p and fixes_p arguments.
2379         Delete fixes, fix_table_size and associated code.  Call
2380         _bfd_aarch64_add_stub_entry_in_group. Rename to...
2381         (bfd_aarch64_erratum_835769_scan): Define.
2382         (elfNN_aarch64_size_stubs): Delete erratum_835769_fixes,
2383         erratum_835769_fix_table_size, i and associated code.  Relocate
2384         call to _bfd_aarch64_erratum_835769_scan.  Delete adhoc stub size
2385         correction.  Delete construction of stub entry from
2386         erratum_835769_fixes array.
2387
2388 2015-03-24  Marcus Shawcroft  <marcus.shawcroft@arm.com>
2389
2390         * elfnn-aarch64.c (elfNN_aarch64_size_stubs): Use
2391         _bfd_aarch64_add_stub_entry_in_group.
2392
2393 2015-03-24  Alan Modra  <amodra@gmail.com>
2394
2395         * elf64-ppc.c (ppc64_elf_relocate_section): Report overflow to
2396         stubs, even those for undefined weak symbols.  Otherwise, don't
2397         report relocation overflow on branches to undefined strong
2398         symbols.  Fix memory leak.
2399         * elf32-ppc.c (ppc_elf_relocate_section): Don't report relocation
2400         overflow on branches to undefined strong symbols.
2401
2402 2015-03-23  Keith Seitz  <keiths@redhat.com>
2403
2404         * elfnn-aarch64.c (_bfd_aarch64_create_or_find_stub_sec): Add
2405         missing ';'.
2406
2407 2015-03-23  Marcus Shawcroft  <marcus.shawcroft@arm.com>
2408
2409         * elfnn-aarch64.c (erratum_835769_scan): Factor stub name
2410         construction into...
2411         (_bfd_aarch64_erratum_835769_stub_name): Define.
2412
2413 2015-03-23  Marcus Shawcroft  <marcus.shawcroft@arm.com>
2414
2415         * elfnn-aarch64.c (elfNN_aarch64_size_stubs): Factor out
2416         stub resize code into...
2417         (bfd_aarch64_resize_stubs): Define.
2418
2419 2015-03-23  Marcus Shawcroft  <marcus.shawcroft@arm.com>
2420
2421         * elfnn-aarch64.c (_bfd_aarch64_create_or_find_stub_sec): Factor stub
2422         creation code into...
2423         (bfd_aarch64_create_stub_section): Define.
2424
2425 2015-03-23  Marcus Shawcroft  <marcus.shawcroft@arm.com>
2426
2427         * elfnn-aarch64.c (_bfd_aarch64_create_or_find_stub_sec): Rename
2428         from elf_aarch64_create_or_find_stub_sec.
2429         (_bfd_aarch64_add_stub_entry_in_group): Rename from
2430         elfNN_aarch64_add_stub.  Call
2431         _bfd_aarch64_create_or_find_stub_sec.
2432         (elfNN_aarch64_size_stubs, elfNN_aarch64_size_stubs): Call
2433         _bfd_aarch64_add_stub_entry_in_group.
2434
2435 2015-03-23  Marcus Shawcroft  <marcus.shawcroft@arm.com>
2436
2437         * elfnn-aarch64.c (erratum_835769_scan) Add comment.  Reverse
2438         sense of boolean return.
2439         (elfNN_aarch64_size_stubs): Adjust for above.
2440
2441 2015-03-23  Marcus Shawcroft  <marcus.shawcroft@arm.com>
2442
2443         * elfnn-aarch64.c (elf_aarch64_create_or_find_stub_sec):
2444         Remove unused parameter.
2445         (elfNN_aarch64_size_stubs): Adjust for above.
2446
2447 2015-03-23  Marcus Shawcroft  <marcus.shawcroft@arm.com>
2448
2449         * elfnn-aarch64.c (elfNN_aarch64_size_stubs): Remove bfd_indx.
2450
2451 2015-03-23  Marcus Shawcroft  <marcus.shawcroft@arm.com>
2452
2453         * elfnn-aarch64.c (aarch64_erratum_835769_fixes)
2454         (num_aarch64_erratum_835769_fixes): Remove.
2455         (elfNN_aarch64_size_stubs): Remove assignments to above.
2456
2457 2015-03-23  Marcus Shawcroft  <marcus.shawcroft@arm.com>
2458
2459         * elfnn-aarch64.c (aarch64_mem_op_p): Update comment. Rename rtn
2460         to rt2.
2461         (aarch64_erratum_seqeunce): Rename rtn to rt2.
2462
2463 2015-03-23  Marcus Shawcroft  <marcus.shawcroft@arm.com>
2464
2465         * elfnn-aarch64.c (elfNN_aarch64_write_section): Adjust layout.
2466
2467 2015-03-19  Nick Clifton  <nickc@redhat.com>
2468
2469         * elf32-rl78.c (rl78_cpu_name): New function.  Prints the name of
2470         the RL78 core based upon the flags.
2471         (rl78_elf_merge_private_bfd_data): Handle merging of G13 and G14
2472         flags.
2473         (rl78_elf_print_private_bfd_data): Use rl78_cpu_name.
2474         (elf32_rl78_machine): Always return bfd_mach_rl78.
2475
2476 2015-03-19  Nick Clifton  <nickc@redhat.com>
2477
2478         PR 18078
2479         * compress.c (bfd_compress_section_contents): Do not define this
2480         function if it is not used.
2481
2482 2015-03-18  H.J. Lu  <hongjiu.lu@intel.com>
2483
2484         * compress.c (bfd_compress_section_contents): Make it static.
2485         * bfd/bfd-in2.h: Regenerated.
2486
2487 2015-03-18  Eric Youngdale  <eyoungdale@ptc.com>
2488
2489         PR ld/16598
2490         * peicode.h (pe_ILF_build_a_bfd): Add support for creating relocs
2491         suitable for the AMD64.
2492
2493 2015-03-18  Jon Turney  <jon.turney@dronecode.org.uk>
2494             Nick Clifton  <nickc@redhat.com>
2495
2496         PR binutils/18087
2497         * coffgen.c (make_a_section_from_file): Only prepend a z to a
2498         debug section's name if the section was actually compressed.
2499         * elf.c (_bfd_elf_make_section_from_shdr): Likewise.
2500         * compress.c (bfd_init_section_compress_status): Do not compress
2501         the section if doing so would make it bigger.  In such cases leave
2502         the section alone and return COMPRESS_SECTION_NONE.
2503
2504 2015-03-17  Alan Modra  <amodra@gmail.com>
2505
2506         * elf64-ppc.c (ppc64_elf_get_synthetic_symtab): Return count of 0
2507         on nothing to do, before malloc of returned symbol array.
2508
2509 2015-03-16  Nick Clifton  <nickc@redhat.com>
2510
2511         * elf32-rx.c (elf32_rx_relax_delete_bytes): If the relocs are not
2512         stored in the elf_section_data structure then load them as
2513         necessary.
2514
2515 2015-03-14  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
2516
2517         * elf-s390-common.c (elf_s390_elf_sort_relocs_p): Don't sort
2518         relocs against code sections.
2519         * elf32-s390.c: Define elf_backend_sort_relocs_p.
2520         * elf64-s390.c: Likewise.
2521
2522 2015-03-11  Alan Modra  <amodra@gmail.com>
2523
2524         * elf32-ppc.c (ppc_elf_get_synthetic_symtab): Examine stubs in
2525         reverse order.  Account for larger size of __tls_get_addr_opt stub.
2526
2527 2015-03-10  Yuri Gribov  <y.gribov@samsung.arm>
2528
2529         PR ld/16572
2530         * elf32-arm.c (elf32_arm_final_link_relocate): Remove support for
2531         ELF_ARM_HASENTRY.
2532         (elf32_arm_print_private_bfd_data): Likewise.
2533
2534 2015-03-06  Nick Clifton  <nickc@redhat.com>
2535
2536         PR binutils/17765
2537         * elflink.c (put_value): Like previous delta, but for the 32-bit
2538         case.
2539
2540 2015-03-05  Nick Clifton  <nickc@redhat.com>
2541
2542         PR binutils/17765
2543         * elflink.c (put_value): Avoid using an undefined shift
2544         operation.
2545
2546 2015-03-05  H.J. Lu  <hongjiu.lu@intel.com>
2547
2548         PR ld/pr15228
2549         PR ld/pr17709
2550         * elf-bfd.h (elf_backend_data): Add extern_protected_data.
2551         * elf32-i386.c (elf_backend_extern_protected_data): New.
2552         Defined to 1.
2553         * elf64-x86-64.c (elf_backend_extern_protected_data): Likewise.
2554         * elflink.c (_bfd_elf_adjust_dynamic_copy): Don't error on
2555         copy relocs against protected symbols if extern_protected_data
2556         is true.
2557         (_bfd_elf_symbol_refs_local_p): Don't return true on protected
2558         non-function symbols if extern_protected_data is true.
2559         * elfxx-target.h (elf_backend_extern_protected_data): New.
2560         Default to 0.
2561         (elfNN_bed): Initialize extern_protected_data with
2562         elf_backend_extern_protected_data.
2563
2564 2015-03-05  Nick Clifton  <nickc@redhat.com>
2565
2566         PR binutils/18025
2567         * coffgen.c (coff_find_nearest_line_with_names): If the dwarf2
2568         lookup fails, check for an address bias in the dwarf info, and if
2569         one exists, retry the lookup with the biased value.
2570         * dwarf2.c (_bfd_dwarf2_find_symbol_bias): New function.
2571         Determines if a bias exists bewteen the addresses of functions
2572         based on DWARF information vs symbol table information.
2573         * libbfd-in.h (_bfd_dwarf2_find_symbol_bias): Prototype.
2574         * libbfd.h: Regenerate.
2575
2576 2015-03-04  Marcus Shawcroft  <marcus.shawcroft@arm.com>
2577
2578         * elfxx-aarch64.c (decode_add_imm, decode_movw_imm)
2579         (decode_tst_branch_ofs_14, decode_ld_lit_ofs_19)
2580         (decode_cond_branch_ofs_19, decode_branch_ofs_26): Remove.
2581
2582 2015-03-04  Marcus Shawcroft  <marcus.shawcroft@arm.com>
2583
2584         * elfnn-aarch64.c (aarch64_build_one_stub): Call abort.
2585         (aarch64_size_one_stub): Likewise.
2586         (aarch64_map_one_stub): Likewise.
2587
2588 2015-03-04  Andreas Arnez  <arnez@linux.vnet.ibm.com>
2589
2590         * cpu-s390.c (N): New macro.
2591         (bfd_s390_31_arch): New.  Define only if default target word size
2592         is 64 bits.  Otherwise define...
2593         (bfd_390_64_arch): ...this.  Make static.
2594         (bfd_s390_arch): Define according to the default target word size.
2595         Let the 'next' field point to the alternate arch.
2596
2597 2015-03-04  Richard Sandiford  <richard.sandiford@arm.com>
2598
2599         PR gas/17843
2600         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Expect
2601         R_AARCH64_TLSLE_MOVW_TPREL_G0_NC and R_AARCH64_TLSLE_MOVW_TPREL_G1_NC
2602         to be used with MOVK rather than MOVZ.
2603
2604 2015-03-03  DJ Delorie  <dj@redhat.com>
2605
2606         * elf32-rl78.c (rl78_elf_relax_section): Only relax ADDR16's if
2607         there's a symbol.
2608
2609 2015-02-28  Alan Modra  <amodra@gmail.com>
2610
2611         * elf32-ppc.c (ppc_elf_tls_setup): Set no_tls_get_addr_opt if
2612         not PLT_NEW.
2613
2614 2015-02-27  H.J. Lu  <hongjiu.lu@intel.com>
2615
2616         * elf32-i386.c (need_convert_mov_to_lea): New.
2617         (elf_i386_check_relocs): Set need_convert_mov_to_lea if needed.
2618         (elf_i386_convert_mov_to_lea): Return TRUE if
2619         need_convert_mov_to_lea is unset.
2620         * elf64-x86-64.c (need_convert_mov_to_lea): New.
2621         (elf_x86_64_check_relocs): Set need_convert_mov_to_lea if needed.
2622         (elf_x86_64_convert_mov_to_lea): Return TRUE if
2623         need_convert_mov_to_lea is unset.
2624
2625 2015-02-27  Nick Clifton  <nickc@redhat.com>
2626
2627         PR binutils/17910
2628         * coffgen.c (_bfd_coff_internal_syment_name): Only check for
2629         string length overflow when the string table length is actually
2630         set.
2631
2632 2015-02-27  Marcus Shawcroft  <marcus.shawcroft@arm.com>
2633
2634         * bfd/bfd-in2.h: Regenerate.
2635         * bfd/libbfd.h: Regenerate.
2636
2637 2015-02-26  Marcus Shawcroft  <marcus.shawcroft@arm.com>
2638
2639         * elfnn-aarch64.c (elfNN_aarch64_howto_table): Fix
2640         TLSDESC_LD_PREL19 field width and masks.
2641         (aarch64_tls_transition_without_check)
2642         (aarch64_reloc_got_type, elfNN_aarch64_final_link_relocate)
2643         (elfNN_aarch64_tls_relax, elfNN_aarch64_relocate_section)
2644         (elfNN_aarch64_gc_sweep_hook, elfNN_aarch64_check_relocs): Handle
2645         BFD_RELOC_AARCH64_TLSDESC_LD_PREL19.
2646         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend)
2647         (_bfd_aarch64_elf_resolve_relocation): Likewise.
2648
2649 2015-02-26  Marcus Shawcroft  <marcus.shawcroft@arm.com>
2650
2651         * elfnn-aarch64.c (IS_AARCH64_TLSDESC_RELOC): Reorder R_TYPE
2652         tests.
2653         (aarch64_tls_transition_without_check)
2654         (aarch64_reloc_got_type, elfNN_aarch64_final_link_relocate)
2655         (elfNN_aarch64_tls_relax, elfNN_aarch64_relocate_section)
2656         (elfNN_aarch64_gc_sweep_hook, elfNN_aarch64_check_relocs): Handle
2657         BFD_RELOC_AARCH64_TLSDESC_ADR_PREL21.
2658         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend)
2659         (_bfd_aarch64_elf_resolve_relocation): Likewise.
2660         * reloc.c (BFD_RELOC_AARCH64_TLSGD_ADR_PREL21): Define.
2661
2662 2015-02-26  Marcus Shawcroft  <marcus.shawcroft@arm.com>
2663
2664         * elfnn-aarch64.c (IS_AARCH64_TLS_RELOC)
2665         (elfNN_aarch64_howto_table, aarch64_tls_transition_without_check)
2666         (aarch64_reloc_got_type, elfNN_aarch64_final_link_relocate)
2667         (elfNN_aarch64_tls_relax, elfNN_aarch64_relocate_section)
2668         (elfNN_aarch64_gc_sweep_hook, elfNN_aarch64_check_relocs): Handle
2669         BFD_RELOC_AARCH64_TLSGD_ADR_PREL21.
2670         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend)
2671         (_bfd_aarch64_elf_resolve_relocation): Likewise.
2672         * reloc.c (BFD_RELOC_AARCH64_TLSGD_ADR_PREL21): Define.
2673
2674 2015-02-26  Marcus Shawcroft  <marcus.shawcroft@arm.com>
2675
2676         * elfnn-aarch64.c: (TLSIE_LD_GOTTREL_PREL19): Fix HOWTO bit field width.
2677         (aarch64_tls_transition_without_check, aarch64_reloc_got_type)
2678         (elfNN_aarch64_final_link_relocate, elfNN_aarch64_tls_relax)
2679         (elfNN_aarch64_relocate_section, elfNN_aarch64_gc_sweep_hook)
2680         (elfNN_aarch64_check_relocs): Handle
2681         BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_PREL19.
2682
2683         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend)
2684         (_bfd_aarch64_elf_resolve_relocation): Likewise.
2685
2686 2015-02-26  Marcus Shawcroft  <marcus.shawcroft@arm.com>
2687
2688         * elfnn-aarch64.c: (TLSDESC_CALL): Fix HOWTO bit field width.
2689
2690 2015-02-26  Marcus Shawcroft  <marcus.shawcroft@arm.com>
2691
2692         * elfnn-aarch64.c (TLSLE_MOVW_TPREL_G2)
2693         (TLSLE_MOVW_TPREL_G1, TLSLE_MOVW_TPREL_G1_NC)
2694         (TLSLE_MOVW_TPREL_G0, TLSLE_MOVW_TPREL_G0_NC): Fix bit field
2695         width.
2696
2697 2015-02-26  Marcus Shawcroft  <marcus.shawcroft@arm.com>
2698
2699         * elfnn-aarch64.c: (TLSIE_MOVW_GOTTPREL_G0_NC): Fix HOWTO bit
2700         field width.
2701
2702 2015-02-26  Nick Clifton  <nickc@redhat.com>
2703
2704         PR binutils/17512
2705         * coffcode.h (coff_compute_section_file_positions): Report
2706         negative page sizes.
2707         * elf.c (elf_fake_sections): Handle excessive alignmment powers.
2708         (assign_file_positions_for_non_load_sections): Replace assertion
2709         with an error message.
2710         (rewrite_elf_program_header): Handle excessive segment
2711         alignments.
2712         * mach-o.c (bfd_mach_o_read_section_32): Likewise.
2713         (bfd_mach_o_read_section_64): Likewise.
2714         * peXXigen.c (_bfd_XX_bfd_copy_private_bfd_data_common): Use %B to
2715         print a bfd name, not %A.
2716
2717 2015-02-26  Alan Modra  <amodra@gmail.com>
2718
2719         * elf64-ppc.c (plt_stub_size, build_plt_stub): Don't build
2720         thread-safe stubs for iplt.
2721         (build_tls_get_addr_stub): Restore r2 immediately after call.
2722
2723 2015-02-26  Terry Guo  <terry.guo@arm.com>
2724
2725         * elf32-arm.c (elf32_arm_merge_eabi_attributes): Update how we
2726         merge Tag_ABI_HardFP_use.
2727
2728 2015-02-26  Alan Modra  <amodra@gmail.com>
2729
2730         * elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Heed -z nocopyreloc.
2731         Use text relocs rather than giving an error on trying to use
2732         .dynbss for protected shared lib vars.
2733         * elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Likewise.
2734
2735 2015-02-25  Andrew Burgess  <andrew.burgess@embecosm.com>
2736
2737         * elf32-avr.c (struct elf_avr_section_data): New structure.
2738         (struct avr_relax_info): New structure.
2739         (elf_avr_new_section_hook): New function.
2740         (struct elf_avr_section_data): Add relax_info.
2741         (get_avr_relax_info): New function.
2742         (init_avr_relax_info): New function.
2743         (elf32_avr_relax_delete_bytes): Find next property record before
2744         deleting bytes.  When deleting don't move bytes beyond the next
2745         property record.
2746         (avr_elf32_assign_records_to_section): New function.
2747         (avr_property_record_compare): New function.
2748         (avr_load_all_property_sections): New function.
2749         (elf32_avr_relax_section): Load property data.  After relaxing the
2750         section, move any .align directives that have enough deleted bytes
2751         before them.
2752         (bfd_elf32_new_section_hook): Define.
2753
2754 2015-02-25  Andrew Burgess  <andrew.burgess@embecosm.com>
2755
2756         * elf32-avr.h (struct avr_property_header): New strucure.
2757         (avr_elf32_load_property_records): Declare.
2758         (avr_elf32_property_record_name): Declare.
2759         * elf32-avr.c: Add bfd_stdint.h include.
2760         (retrieve_local_syms): New function.
2761         (get_elf_r_symndx_section): New function.
2762         (get_elf_r_symndx_offset): New function.
2763         (internal_reloc_compare): New function.
2764         (struct avr_find_section_data): New structure.
2765         (avr_is_section_for_address): New function.
2766         (avr_find_section_for_address): New function.
2767         (avr_elf32_load_records_from_section): New function.
2768         (avr_elf32_load_property_records): New function.
2769         (avr_elf32_property_record_name): New function.
2770
2771 2015-02-25  Andrew Burgess  <andrew.burgess@embecosm.com>
2772
2773         * elf32-avr.h (AVR_PROPERTY_RECORD_SECTION_NAME): Define.
2774         (AVR_PROPERTY_RECORDS_VERSION): Define.
2775         (AVR_PROPERTY_SECTION_HEADER_SIZE): Define.
2776         (struct avr_property_record): New structure.
2777
2778 2015-02-24  Nick Clifton  <nickc@redhat.com>
2779
2780         * elf32-v850.c (v850_set_note): New function.  Creates a Renesas
2781         style note entry.
2782         (v850_elf_make_note_section): New function.  Creates a note
2783         section.
2784         (v850_elf_create_sections): New function.  Create a note section
2785         if one is not already present.
2786         (v850_elf_set_note): New function.  Adds a note to a bfd.
2787         (v850_elf_copy_private_bfd_data): New function.  Copies V850
2788         notes.
2789         (v850_elf_merge_notes): New function.  Merges V850 notes.
2790         (print_v850_note): New function.  Displays a V850 note.
2791         (v850_elf_print_notes): New function. Displays all notes attached
2792         to a bfd.
2793         (v850_elf_merge_private_bfd_data): Call v850_elf_merge_notes.
2794         (v850_elf_print_private_bfd_data): Call v850_elf_print_notes.
2795         (v850_elf_fake_sections): Set the type of the V850 note section.
2796         * bfd-in.h (v850_elf_create_sections): Add prototype.
2797         (v850_elf_set_note): Add prototype.
2798         * bfd-in2.h: Regenerate.
2799
2800 2015-02-24  Nick Clifton  <nickc@redhat.com>
2801
2802         * configure.ac (AC_CHECK_HEADERS): Add wctype.h.
2803         * configure: Regenerate.
2804         * config.in: Regenerate.
2805         * peXXigen.c: Include wctype.h if HAVE_WCTYPE_H is defined.
2806         (u16_mbtowc): Use wint_t types if HAVE_WCTYPE_H is defined.
2807         (rsrc_cmp): Use towlower instead of wcsncasecmp if HAVE_WCTYPE_H
2808         is defined.
2809
2810 2015-02-24  Nick Clifton  <nickc@redhat.com>
2811
2812         * pdp11.c (set_section_contents): Pad the .text and .data sections
2813         to their aligned sizes.
2814
2815 2015-02-23  Yoshinori Sato <ysato@users.sourceforge.jp>
2816
2817         * config.bfd: Add h8300-*-linux.
2818         * configure.ac: Add h8300_elf32_linux_vec.
2819         * configure: Regenerate.
2820         * elf32-h8300.c: Likewise.
2821         * targets.c(_bfd_target_vector): Likewise.
2822
2823 2015-02-23  Nick Clifton  <nickc@redhat.com>
2824
2825         PR 17914
2826         * cpu-w65.c: Correct typos in license notice.
2827
2828         PR 17940
2829         * elf32-msp430.c (msp430_elf_relax_delete_bytes): Adjust debug
2830         symbols at end of sections.  Adjust function sizes.
2831
2832 2015-02-20  Andreas Arnez  <arnez@linux.vnet.ibm.com>
2833
2834         * elf-bfd.h (elfcore_write_s390_vxrs_low): Add prototype.
2835         (elfcore_write_s390_vxrs_high): Likewise.
2836         * elf.c (elfcore_grok_s390_vxrs_low): New function.
2837         (elfcore_grok_s390_vxrs_high): New function.
2838         (elfcore_grok_note): Call them.
2839         (elfcore_write_s390_vxrs_low): New function.
2840         (elfcore_write_s390_vxrs_high): New function.
2841         (elfcore_write_register_note): Call them.
2842
2843 2015-02-19  Branko Drevensek  <branko.drevensek@gmail.com>
2844
2845         PR 17995
2846         * verilog.c (verilog_write_record): Correct buffer size.
2847
2848 2015-02-19  Alan Modra  <amodra@gmail.com>
2849
2850         * elflink.c (_bfd_elf_define_linkage_sym): Set 'bed' earlier.
2851
2852 2015-02-19  Alan Modra  <amodra@gmail.com>
2853
2854         PR ld/4317
2855         * elflink.c (elf_link_input_bfd): Drop undefined local syms.
2856         (elf_link_output_extsym): Drop local and global undefined syms.
2857         Tidy.  Expand comment.
2858
2859 2015-02-17  Alan Modra  <amodra@gmail.com>
2860
2861         PR ld/17975
2862         * elflink.c (struct elf_outext_info): Remove need_second_pass
2863         and second_pass.
2864         (elf_link_output_extsym): Delete code handling second forced
2865         local pass.  Move code emitting NULL STT_FILE symbol later, so
2866         that it can be omitted if forced local is stripped.  Don't
2867         emit the NULL STT_FILE if no file symbols have been output.
2868         (bfd_elf_final_link): Remove second forced local pass.
2869         * elf32-ppc.c (add_stub_sym): Set linker_def on linker syms.
2870         (ppc_elf_size_dynamic_sections): Likewise.
2871         * elf64-ppc.c (ppc_build_one_stub): Likewise.
2872         (build_global_entry_stubs): Likewise.
2873         (ppc64_elf_build_stubs): Likewise.
2874
2875 2015-02-16  H.J. Lu  <hongjiu.lu@intel.com>
2876
2877         PR ld/17975
2878         * elflink.c (elf_link_output_extsym): Only check filesym_count
2879         when outputting a NULL FILE symbol.  Set second_pass_sym to
2880         h->forced_local && !h->root.linker_def.
2881
2882 2015-02-15  H.J. Lu  <hongjiu.lu@intel.com>
2883
2884         * elf32-i386.c (elf_i386_always_size_sections): Set root.linker_def
2885         on _TLS_MODULE_BASE_.
2886         * elf64-x86-64.c (elf_x86_64_always_size_sections): Likewise.
2887
2888 2015-02-15  Alan Modra  <amodra@gmail.com>
2889
2890         * dwarf2.c (read_rangelist): Correct buffer overflow check
2891         Whitespace throughout file.
2892
2893 2015-02-14  Alan Modra  <amodra@gmail.com>
2894
2895         PR ld/17973
2896         * bfd.c (struct bfd): Add lto_output.
2897         * linker.c (_bfd_handle_already_linked): Explicitly test for
2898         objects added by the lto plugin.
2899         * opncls.c (_bfd_new_bfd_contained_in): Copy lto_output and
2900         no_export flags from archive.
2901         * archive.c (open_nested_file): New function, setting lto_output
2902         and no_export, extracted from..
2903         (find_nested_archive): ..here.  Flip params.  Rename from
2904         _bfd_find_nested_archive.
2905         (_bfd_get_elt_at_filepos): Correct var typo.  Use open_nested_file.
2906         (_bfd_look_for_bfd_in_cache): Copy no_export.
2907         * elflink.c (elf_link_add_object_symbols): Remove now unnecessary
2908         my_archive->no_export test.
2909         (elf_link_input_bfd): Drop existing lto_output STT_FILE syms.
2910         Don't use the file name when adding lto_output STT_FILE sym.
2911         * bfd-in2.h: Regenerate.
2912
2913 2015-02-13  Alan Modra  <amodra@gmail.com>
2914
2915         PR binutils/17512
2916         * elf64-ppc.c (opd_entry_value): Tighten offset check.  Remove
2917         now redundant assert.
2918
2919 2015-02-12  Nick Clifton  <nickc@redhat.com>
2920
2921         PR binutils/17512
2922         * dwarf.c (read_1_byte, read_1_signed_byte, read_2_bytes)
2923         (read_4_bytes, read_8_bytes, read_n_bytes, read_string)
2924         (read_indirect_string, read_alt_indirect_string)
2925         (read_alt_indirect_ref, read_address, read_abbrevs)
2926         (read_attribute_value, read_attribute, decode_line_info)
2927         (find_abstract_instance_name, read_rangelist)
2928         (scan_unit_for_symbols, parse_comp_unit)
2929         (_bfd_dwarf2_find_nearest_line): Harden DWARF reading code.  Pass
2930         end pointers to reading functions and check for offsets taking
2931         pointers out of range.  Replace calls to read_*_leb128 with calls
2932         to safe_read_leb128.
2933
2934         (* elf64-ppc.c (opd_entry_value): Add a check for an overlarge
2935         offset.
2936         * syms.c (_bfd_stab_section_find_nearest_line): Add checks for
2937         computed file_name address being before the start of the string
2938         table.
2939
2940 2015-02-11  H.J. Lu  <hongjiu.lu@intel.com>
2941
2942         PR ld/17878
2943         * bfd.c (bfd_plugin_format): New.
2944         (bfd): Add plugin_format and plugin_dummy_bfd.
2945         * plugin.c (try_load_plugin): Take a pointer to bfd_boolean
2946         argument to return TRUE if any plugin is found.  Set plugin_format.
2947         (has_plugin): New.
2948         (bfd_plugin_target_p): New.
2949         (bfd_plugin_specified_p): Likewise.
2950         (bfd_plugin_target_p): Likewise.
2951         (register_ld_plugin_object_p): Likewise.
2952         (bfd_plugin_set_plugin): Set has_plugin.
2953         (load_plugin): Cache try_load_plugin result.
2954         (bfd_plugin_object_p): Try ld_plugin_object_p first.  Check
2955         plugin_format.
2956         * plugin.h (bfd_plugin_target_p): New.
2957         (bfd_plugin_specified_p): Likewise.
2958         (register_ld_plugin_object_p): Likewise.
2959         * bfd-in2.h: Regenerated.
2960
2961 2015-02-11  Pedro Alves  <palves@redhat.com>
2962
2963         * libbfd-in.h [__cplusplus]: Open extern "C" scope.
2964         * libcoff-in.h [__cplusplus]: Open extern "C" scope.
2965         * libbfd.h: Regenerate.
2966         * libcoff.h: Regenerate.
2967
2968         * elf-bfd.h [__cplusplus]: Wrap in extern "C".
2969         * mach-o.h [__cplusplus]: Wrap in extern "C".
2970         * som.h [__cplusplus]: Wrap in extern "C".
2971
2972 2015-02-10  Nick Clifton  <nickc@redhat.com>
2973
2974         PR binutils/17512
2975         * coffcode.h (styp_to_sec_flags): Use an unsigned long type to
2976         hold the flag bits.
2977         * peXXigen.c (pe_print_reloc): Use unsigned types to hold the
2978         size and number of relocs.
2979         (pe_print_debugdata): Use a 32-bit aligned buffer to store the
2980         codeview record.
2981         * versados.c (process_otr): Check the esdid value before using it
2982         to access the EDATA.
2983
2984 2015-02-09  Ed Maste  <emaste@freebsd.org>
2985
2986         * elf32-i386.c (elf_i386_get_plt_sym_val): Avoid incrementing
2987         uninitialized and unused variable.
2988         * elf64-x86-64.c (elf_x86_64_get_plt_sym_val): Likewise.
2989
2990 2015-02-09  Alan Modra  <amodra@gmail.com>
2991
2992         * elf32-ppc.c (ppc_elf_relocate_section): Don't segfault on NULL
2993         tls_sec.
2994         * elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
2995         * elflink.c (elf_link_output_extsym): Don't assert on NULL tls_sec.
2996
2997 2015-02-09  Alan Modra  <amodra@gmail.com>
2998
2999         * elflink.c: Whitespace, formatting fixes.
3000         (elf_link_input_bfd): Clarify comment.
3001         (elf_link_output_extsym): Exclude symbols in linker created
3002         sections when testing for plugin symbols.
3003
3004 2015-02-07  H.J. Lu  <hongjiu.lu@intel.com>
3005
3006         PR ld/17935
3007         * elf32-i386.c (elf_i386_readonly_dynrelocs): Also issue a
3008         warning for relocation in readonly section for -z text.
3009         (elf_i386_size_dynamic_sections): Likewise.
3010         * elf64-x86-64.c (elf_x86_64_readonly_dynrelocs): Likewise.
3011         (elf_x86_64_size_dynamic_sections): Likewise.
3012
3013 2015-02-06  H.J. Lu  <hongjiu.lu@intel.com>
3014
3015         PR ld/12365
3016         PR ld/14272
3017         * elflink.c (_bfd_elf_fix_symbol_flags): Revert the last change.
3018         (elf_link_input_bfd): Mark the plugin symbol undefined if it is
3019         referenced from a non-IR file.
3020
3021 2015-02-06  Nick Clifton  <nickc@redhat.com>
3022
3023         PR binutils/17512
3024         * peXXigen.c (rsrc_print_resource_entries): Add range check for
3025         addresses that wrap around the address space.
3026         (rsrc_parse_entry): Likewise.
3027
3028 2015-02-03  H.J. Lu  <hongjiu.lu@intel.com>
3029
3030         PR ld/12365
3031         PR ld/14272
3032         * elflink.c (_bfd_elf_fix_symbol_flags): Mark the plugin symbol
3033         undefined if it is referenced from a non-IR file.
3034
3035 2015-02-03  Nick Clifton  <nickc@redhat.com>
3036
3037         PR binutils/17512
3038         * ecoff.c: Use bfd_alloc2 to allocate space for structure arrays.
3039         (_bfd_ecoff_slurp_symbol_table): Check for a negative symbol
3040         index or an out of range fdr index.
3041         * elf-m10300.c (mn10300_info_to_howto): Fix typo in error message.
3042         * elf32-arc.c (arc_info_to_howto_rel): Likewise.
3043         * elf32-avr.c (avr_info_to_howto_rela): Likewise.
3044         * elf32-cr16.c (elf_cr16_info_to_howto): Likewise.
3045         * elf32-cr16c.c (elf_cr16c_info_to_howto_rel): Likewise.
3046         * elf32-cris.c (cris_info_to_howto_rela): Likewise.
3047         * elf32-crx.c (elf_crx_info_to_howto): Likewise.
3048         * elf32-d10v.c (d10v_info_to_howto_rel): Likewise.
3049         * elf32-d30v.c (d30v_info_to_howto_rel): Likewise.
3050         * elf32-epiphany.c (epiphany_info_to_howto_rela): Likewise.
3051         * elf32-fr30.c (fr30_info_to_howto_rela): Likewise.
3052         * elf32-frv.c (frv_info_to_howto_rela): Likewise.
3053         * elf32-i370.c (i370_elf_info_to_howto): Likewise.
3054         * elf32-i960.c (elf32_i960_info_to_howto_rel): Likewise.
3055         * elf32-ip2k.c (ip2k_info_to_howto_rela): Likewise.
3056         * elf32-iq2000.c (iq2000_info_to_howto_rela): Likewise.
3057         * elf32-lm32.c (lm32_info_to_howto_rela): Likewise.
3058         * elf32-m32c.c (m32c_info_to_howto_rela): Likewise.
3059         * elf32-m32r.c (m32r_info_to_howto_rel): Likewise.
3060         * elf32-m68hc11.c (m68hc11_info_to_howto_rel): Likewise.
3061         * elf32-m68hc12.c (m68hc11_info_to_howto_rel): Likewise.
3062         * elf32-mcore.c (mcore_elf_info_to_howto): Likewise.
3063         * elf32-mep.c (mep_info_to_howto_rela): Likewise.
3064         * elf32-metag.c (metag_info_to_howto_rela): Likewise.
3065         * elf32-microblaze.c (microblaze_elf_info_to_howto): Likewise.
3066         * elf32-moxie.c (moxie_info_to_howto_rela): Likewise.
3067         * elf32-msp430.c (msp430_info_to_howto_rela): Likewise.
3068         * elf32-mt.c (mt_info_to_howto_rela): Likewise.
3069         * elf32-nds32.c (nds32_info_to_howto_rel): Likewise.
3070         * elf32-or1k.c (or1k_info_to_howto_rela): Likewise.
3071         * elf32-pj.c (pj_elf_info_to_howto): Likewise.
3072         * elf32-ppc.c (ppc_elf_info_to_howto): Likewise.
3073         * elf32-rl78.c (rl78_info_to_howto_rela): Likewise.
3074         * elf32-rx.c (rx_info_to_howto_rela): Likewise.
3075         * elf32-sh.c (sh_elf_info_to_howto): Likewise.
3076         * elf32-spu.c (spu_elf_info_to_howto): Likewise.
3077         * elf32-v850.c (v850_elf_perform_relocation): Likewise.
3078         * elf32-vax.c (rtype_to_howto): Likewise.
3079         * elf32-visium.c (visium_info_to_howto_rela): Likewise.
3080         * elf32-xgate.c (xgate_info_to_howto_rel): Likewise.
3081         * elf32-xtensa.c (elf_xtensa_info_to_howto_rela): Likewise.
3082         * elf64-alpha.c (elf64_alpha_info_to_howto): Likewise.
3083         * elf64-mmix.c (mmix_info_to_howto_rela): Likewise.
3084         * mach-o.c: Use bfd_alloc2 to allocate space for structure arrays.
3085         (bfd_mach_o_canonicalize_one_reloc): Fix check on out
3086         of range symbol indicies.
3087         (bfd_mach_o_canonicalize_relocs): Check for out of range alloc.
3088         (bfd_mach_o_canonicalize_dynamic_reloc): Likewise.
3089         (bfd_mach_o_build_dysymtab): Likewise.
3090         (bfd_mach_o_write_symtab_content): Set the string table size to
3091         zero upon error.
3092         (bfd_mach_o_read_symtab_symbols): Reset the nsyms value if the
3093         read fails.
3094         * peXXigen.c (pe_print_edata):  Check for numeric overflow in edt
3095         fields.
3096         * tekhex.c (first_phase): Check for src pointer reaching end of
3097         buffer.
3098
3099 2015-02-03  Will Newton  <will.newton@linaro.org>
3100
3101         * elfnn-aarch64.c (elfNN_aarch64_finish_dynamic_symbol):
3102         Set st_value to zero for undefined symbols if the reference
3103         is weak or pointer_equality_needed is FALSE.
3104
3105         * elf32-arm.c (elf32_arm_finish_dynamic_symbol): Improve
3106           comment discussing why we clear st_value for some symbols.
3107
3108 2015-02-02  Kuan-Lin Chen  <kuanlinchentw@gmail.com>
3109
3110         * elf32-nds32.c (nds32_get_section_contents): Add one more argument.
3111         (nds32_elf_relocate_section): Do not relocate R_NDS32_LONGJUMP7.
3112
3113 2015-01-29  Alan Modra  <amodra@gmail.com>
3114
3115         * elf64-ppc.c (ppc64_elf_relocate_section): Correct GOT_TLSLD
3116         optimization.  Tidy mask for GOT_TLSGD optimization.
3117         * elf32-ppc.c (ppc_elf_relocate_section): Likewise.  Correct
3118         location of nop zapping high insn too.
3119
3120 2015-01-28  Alan Modra  <amodra@gmail.com>
3121
3122         * elf64-ppc.h (struct ppc64_elf_params): Add "object_in_toc".
3123         * elf64-ppc.c (ppc64_elf_add_symbol_hook): Assume that global symbols
3124         in .toc indicate xlc compiled code that might require a rw .toc.
3125
3126 2015-01-28  James Bowman  <james.bowman@ftdichip.com>
3127
3128         * Makefile.am: Add FT32 files.
3129         * archures.c (enum bfd_architecture): Add bfd_arch_ft32.
3130         (bfd_mach_ft32): Define.
3131         (bfd_ft32_arch): Declare.
3132         (bfd_archures_list): Add bfd_ft32_arch.
3133         * config.bfd: Handle FT32.
3134         * configure.ac: Likewise.
3135         * cpu-ft32.c: New file.
3136         * elf32-ft32.c: New file.
3137         * reloc.c (BFD_RELOC_FT32_10, BFD_RELOC_FT32_20, BFD_RELOC_FT32_17,
3138         BFD_RELOC_FT32_18): Define.
3139         * targets.c (_bfd_target_vector): Add ft32_elf32_vec.
3140         * bfd-in2.h: Regenerate.
3141         * libbfd.h: Regenerate.
3142         * Makefile.in: Regenerate.
3143         * configure: Regenerate.
3144         * po/SRC-POTFILES.in: Regenerate.
3145
3146 2015-01-27  Nick Clifton  <nickc@redhat.com>
3147
3148         PR binutils/17512
3149         * pdp11.c (aout_get_external_symbols): Return false if there are
3150         no symbols.
3151
3152         * dwarf2.c (concat_filename): Check for an empty directory table.
3153         (scan_unit_for_symbols): Check for reading off the end of the
3154         unit.
3155         (parse_comp_unit): Check for a DW_AT_comp_dir attribute with a
3156         non-string form.
3157         * elf64-ppc.c (opd_entry_value): Fail if there are no relocs
3158         available.
3159
3160 2015-01-26  Kuan-Lin Chen  <kuanlinchentw@gmail.com>
3161
3162         * elf32-nds32.c (nds32_elf_pick_relax): Fix again setting.
3163
3164 2015-01-22  DJ Delorie  <dj@redhat.com>
3165
3166         * elf32-m32c.c (m32c_apply_reloc_24): New.
3167         (m32c_elf_howto_table): Use it for R_M32C_24.
3168         (m32c_elf_relocate_section): Handle R_M32C_24 specially.
3169
3170 2015-01-22  Nick Clifton  <nickc@redhat.com>
3171
3172         PR binutils/17512
3173         * coffcode.h (handle_COMDAT): When searching for the section
3174         symbol, make sure that there is space left in the symbol table.
3175         * vms-alpha.c (_bfd_vms_slurp_ehdr): Add range checks.
3176
3177 2015-01-21  Nick Clifton  <nickc@redhat.com>
3178
3179         PR binutils/17512
3180         * coffcode.h (coff_set_arch_mach_hook): Check return value from
3181         bfd_malloc.
3182         (coff_slurp_line_table): Return FALSE if the line number
3183         information was corrupt.
3184         (coff_slurp_symbol_table): Return FALSE if the symbol information
3185         was corrupt.
3186         * mach-o.c (bfd_mach_o_bfd_copy_private_header_data): Always
3187         initialise the fields of the dyld_info structure.
3188         (bfd_mach_o_build_exec_seg_command): Replace assertion with an
3189         error message and a return value.
3190         (bfd_mach_o_layout_commands): Change the function to boolean.
3191         Return FALSE if the function fails.
3192         (bfd_mach_o_build_commands): Fail if bfd_mach_o_layout_commands
3193         fails.
3194         (bfd_mach_o_read_command): Fail if an unrecognised command is
3195         encountered.
3196         * peXXigen.c (_bfd_XXi_swap_aouthdr_in): Set bfd_error if the
3197         read fails.
3198         (slurp_symtab): Check the return from bfd_malloc.
3199         (_bfd_XX_bfd_copy_private_bfd_data_common): Fail if the copy
3200         encountered an error.
3201         (_bfd_XXi_final_link_postscript): Fail if a section could not be
3202         copied.
3203         * peicode.h (pe_bfd_object_p): Fail if the header could not be
3204         swapped in.
3205         * tekhex.c (first_phase): Fail if the section is too big.
3206         * versados.c (struct esdid): Add content_size field.
3207         (process_otr): Use and check the new field.
3208         (versados_get_section_contents): Check that the section exists and
3209         that the requested data is available.
3210
3211 2015-01-20  Chung-Lin Tang  <cltang@codesourcery.com>
3212
3213         * elf32-nios2.c (elf_backend_default_execstack): Define as 0.
3214
3215 2015-01-20  Alan Modra  <amodra@gmail.com>
3216
3217         PR ld/17615
3218         * elf64-ppc.c (ppc64_elf_gc_mark_dynamic_ref): Don't drop
3219         ELF_COMMON_DEF syms.
3220
3221 2015-01-19  Alan Modra  <amodra@gmail.com>
3222
3223         PR ld/17615
3224         * elf-bfd.h (ELF_COMMON_DEF_P): Note that this might be true for
3225         linker script assignments too.
3226         * elflink.c (elf_gc_sweep_symbol): Don't drop ELF_COMMON_DEF syms.
3227         (bfd_elf_gc_mark_dynamic_ref_symbol): Similarly.
3228
3229 2015-01-19  Alan Modra  <amodra@gmail.com>
3230
3231         * elf32-bfin.c (bfin_bfd_reloc_type_lookup): Correct loop iteration
3232         to allow return of first howto.
3233         * elf32-fr30.c (fr30_reloc_type_lookup): Likewise.
3234         * elf32-m32c.c (m32c_reloc_type_lookup): Likewise.
3235         * elf32-moxie.c (moxie_reloc_type_lookup): Likewise.
3236         * elf32-or1k.c (or1k_reloc_type_lookup): Likewise.
3237         * elf32-rl78.c (rl78_reloc_type_lookup): Likewise.
3238         * elf32-rx.c (rx_reloc_type_lookup): Likewise.
3239         * elf32-tilepro.c (tilepro_reloc_type_lookup): Likewise.
3240         * elf32-xstormy16.c (xstormy16_reloc_type_lookup): Likewise.
3241         * elfxx-tilegx.c (tilegx_reloc_type_lookup): Likewise.
3242         * elf32-nios2.c (nios2_reloc_map): Add mapping for R_NIOS2_NONE.
3243         * elf32-spu.c (spu_elf_bfd_to_reloc_type): Allow return of R_SPU_NONE.
3244         (spu_elf_reloc_type_lookup): Adjust to suit.
3245
3246 2015-01-19  Alan Modra  <amodra@gmail.com>
3247
3248         * bfd-in.h (bfd_get_section_limit_octets): New define, extracted from..
3249         (bfd_get_section_limit): ..here.
3250         * reloc.c (bfd_perform_relocation): Correct bfd_reloc_outofrange check.
3251         (bfd_install_relocation, _bfd_final_link_relocate): Add same check here.
3252         * elf32-sh.c (sh_elf_reloc): Correct bfd_reloc_outofrange check.
3253         * elf32-ppc.c (ppc_elf_addr16_ha_reloc): Remove duplicated
3254         bfd_reloc_outofrange check.
3255         * bfd-in2.h: Regenerate.
3256
3257         * cpu-ns32k.c (_bfd_do_ns32k_reloc_contents): Return bfd_reloc_ok
3258         on zero size relocs.
3259         * ecoff.c (ecoff_reloc_link_order): Likewise.
3260         * elf32-nds32.c (nds32_relocate_contents): Likewise.
3261         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.
3262
3263         * reloc.c (_bfd_relocate_contents): Don't bomb on zero size relocs.
3264         (_bfd_clear_contents): Likewise.
3265         * elfxx-mips.c (mips_elf_obtain_contents): Likewise.
3266         (mips_elf_perform_relocation): Likewise.
3267
3268         * aoutx.h (aout_link_reloc_link_order): Allow for NULL return
3269         from malloc on zero size alloc.
3270         * cofflink.c (_bfd_coff_reloc_link_order): Likewise.
3271         * elflink.c (elf_reloc_link_order): Likewise.
3272         * linker.c (_bfd_generic_reloc_link_order): Likewise.
3273         * pdp11.c (aout_link_reloc_link_order): Likewise.
3274         * xcofflink.c (xcoff_reloc_link_order): Likewise.
3275
3276         * aoutx.h (howto_table_ext): Ensure NONE relocs have size 3,
3277         bitsize 0, and complain_overflow_dont.
3278         * coff-sparc.c (coff_sparc_howto_table): Likewise.
3279         * elf-hppa.h (elf_hppa_howto_table): Likewise.
3280         * elf-m10200.c (elf_mn10200_howto_table): Likewise.
3281         * elf-m10300.c (elf_mn10300_howto_table): Likewise.
3282         * elf32-arc.c (elf_arc_howto_table): Likewise.
3283         * elf32-arm.c (elf32_arm_howto_table_1): Likewise.
3284         * elf32-avr.c (elf_avr_howto_table): Likewise.
3285         * elf32-bfin.c (bfin_howto_table): Likewise.
3286         * elf32-cr16.c (cr16_elf_howto_table): Likewise.
3287         * elf32-cris.c (cris_elf_howto_table): Likewise.
3288         * elf32-crx.c (crx_elf_howto_table): Likewise.
3289         * elf32-d10v.c (elf_d10v_howto_table): Likewise.
3290         * elf32-d30v.c (elf_d30v_howto_table): Likewise.
3291         * elf32-dlx.c (dlx_elf_howto_table): Likewise.
3292         * elf32-epiphany.c (epiphany_elf_howto_table): Likewise.
3293         * elf32-fr30.c (fr30_elf_howto_table): Likewise.
3294         * elf32-frv.c (elf32_frv_howto_table): Likewise.
3295         * elf32-h8300.c (h8_elf_howto_table): Likewise.
3296         * elf32-i370.c (i370_elf_howto_raw): Likewise.
3297         * elf32-i386.c (elf_howto_table): Likewise.
3298         * elf32-i860.c (elf32_i860_howto_table): Likewise.
3299         * elf32-i960.c (elf32_i960_relocate): Likewise.
3300         * elf32-ip2k.c (ip2k_elf_howto_table): Likewise.
3301         * elf32-iq2000.c (iq2000_elf_howto_table): Likewise.
3302         * elf32-lm32.c (lm32_elf_howto_table): Likewise.
3303         * elf32-m32c.c (m32c_elf_howto_table): Likewise.
3304         * elf32-m32r.c (m32r_elf_howto_table): Likewise.
3305         * elf32-m68hc11.c (elf_m68hc11_howto_table): Likewise.
3306         * elf32-m68hc12.c (elf_m68hc11_howto_table): Likewise.
3307         * elf32-m68k.c (howto_table): Likewise.
3308         * elf32-mcore.c (mcore_elf_howto_raw): Likewise.
3309         * elf32-mep.c (mep_elf_howto_table): Likewise.
3310         * elf32-metag.c (elf_metag_howto_table): Likewise.
3311         * elf32-microblaze.c (microblaze_elf_howto_raw): Likewise.
3312         * elf32-mips.c (elf_mips_howto_table_rel): Likewise.
3313         * elf32-moxie.c (moxie_elf_howto_table): Likewise.
3314         * elf32-msp430.c (elf_msp430_howto_table): Likewise.
3315         * elf32-mt.c (mt_elf_howto_table): Likewise.
3316         * elf32-nds32.c (nds32_elf_howto_table): Likewise.
3317         * elf32-nios2.c (elf_nios2_howto_table_rel): Likewise.
3318         * elf32-or1k.c (or1k_elf_howto_table): Likewise.
3319         * elf32-pj.c (pj_elf_howto_table): Likewise.
3320         * elf32-ppc.c (ppc_elf_howto_raw): Likewise.
3321         * elf32-rl78.c (rl78_elf_howto_table): Likewise.
3322         * elf32-rx.c (rx_elf_howto_table): Likewise.
3323         * elf32-s390.c (elf_howto_table): Likewise.
3324         * elf32-score.c (elf32_score_howto_table): Likewise.
3325         * elf32-score7.c (elf32_score_howto_table): Likewise.
3326         * elf32-sh-relocs.h (R_SH_NONE): Likewise.
3327         * elf32-spu.c (elf_howto_table): Likewise.
3328         * elf32-tic6x.c (elf32_tic6x_howto_table): Likewise.
3329         * elf32-tilepro.c (tilepro_elf_howto_table): Likewise.
3330         * elf32-v850.c (v850_elf_howto_table): Likewise.
3331         * elf32-vax.c (howto_table): Likewise.
3332         * elf32-visium.c (visium_elf_howto_table): Likewise.
3333         * elf32-xc16x.c (xc16x_elf_howto_table): Likewise.
3334         * elf32-xgate.c (elf_xgate_howto_table): Likewise.
3335         * elf32-xstormy16.c (xstormy16_elf_howto_table): Likewise.
3336         * elf32-xtensa.c (elf_howto_table): Likewise.
3337         * elf64-alpha.c (elf64_alpha_howto_table): Likewise.
3338         * elf64-mips.c (mips_elf64_howto_table_rel): Likewise.
3339         * elf64-mmix.c (elf_mmix_howto_table): Likewise.
3340         * elf64-ppc.c (ppc64_elf_howto_raw): Likewise.
3341         * elf64-s390.c (elf_howto_table): Likewise.
3342         * elf64-sh64.c (sh_elf64_howto_table): Likewise.
3343         * elf64-x86-64.c (x86_64_elf_howto_table): Likewise.
3344         * elfn32-mips.c (elf_mips_howto_table_rel): Likewise.
3345         * elfnn-aarch64.c (elfNN_aarch64_howto_table): Likewise.
3346         (elfNN_aarch64_howto_none): Likewise.
3347         * elfxx-ia64.c (ia64_howto_table): Likewise.
3348         * elfxx-sparc.c (_bfd_sparc_elf_howto_table): Likewise.
3349         * elfxx-tilegx.c (tilegx_elf_howto_table): Likewise.
3350         * nlm32-sparc.c (nlm32_sparc_howto_table): Likewise.
3351
3352 2015-01-15  H.J. Lu  <hongjiu.lu@intel.com>
3353
3354         PR ld/17847
3355         * elf64-x86-64.c (elf_x86_64_relocate_section): Don't complain
3356         about -fPIC if the symbol is undefined when building executable.
3357
3358 2015-01-15  Nick Clifton  <nickc@redhat.com>
3359
3360         PR binutils/17512
3361         * elf-m10300.c (mn10300_info_to_howto): Replace assertion with an
3362         error message.  Never return an invalid howto pointer.
3363         * elf32-cr16.c (cr16_info_to_howto): Likewise.
3364         * elf32-crx.c (elf_crx_info_to_howto): Likewise.
3365         * elf32-i370.c (i370_elf_info_to_howto): Likewise.
3366         * elf32-mcore.c (mcore_elf_info_to_howto): Likewise.
3367         * elf32-microblaze.c (microblaze_elf_info_to_howto): Likewise.
3368         * elf32-mips.c (mips_elf32_rtype_to_howto): Likewise.
3369         * elf32-pj.c (pj_elf_info_to_howto): Likewise.
3370         * elf32-ppc.c (ppc_elf_info_to_howto): Likewise.
3371         * elf32-spu.c (spu_elf_info_to_howto): Likewise.
3372         * elf32-v850.c (v850_elf_info_to_howto_rela): Likewise.
3373         * elf32-vax.c (rtype_to_howto): Likewise.
3374         * elf64-alpha.c (elf64_alpha_info_to_howto): Likewise.
3375         * elf64-mips.c (mips_elf64_rtype_to_howto): Likewise.
3376         * elfn32-mips.c (sh_elf_info_to_howto): Likewise.
3377         * elf32-sh.c (sh_elf_info_to_howto): Likewise.
3378         (sh_elf_reloc): Check that the reloc is in range.
3379         * reloc.c (bfd_perform_relocation): Check that the section is big
3380         enough for the entire reloc.
3381         (bfd_generic_get_relocated_section_contents): Report unexpected
3382         return values from perform_reloc.
3383
3384 2015-01-15  Nick Clifton  <nickc@redhat.com>
3385
3386         * elf32-msp430.c (msp430_elf_relax_section): Skip unhandled
3387         relocs.  Include PC-relative adjustment for R_MSP430X_ABS16
3388         relaxation.
3389
3390 2015-01-15  Alan Modra  <amodra@gmail.com>
3391
3392         * elflink.c (_bfd_elf_link_omit_section_dynsym): Return true for
3393         any output section matching a linker created dynobj section.
3394
3395 2015-01-15  Alan Modra  <amodra@gmail.com>
3396
3397         PR 17842
3398         * elflink.c (elf_link_output_sym): Assert elf_onesymtab set.
3399         (bfd_elf_final_link): Always create a symbol table when emit_relocs.
3400         Don't assign symtab file position unless symbols will be output.
3401         Merge blocks with condition in common.  Don't call
3402         elf_backend_output_arch_local_syms or elf_backend_output_arch_syms
3403         unless other symbols are output.  Move assignment of symtab_shndx
3404         file position.  Localize variable.
3405
3406 2015-01-14  Jiong Wang  <jiong.wang@arm.com>
3407
3408         * elf32-arm.c (elf32_arm_final_link_relocate): Reject R_ARM_32/_NOI when
3409         trying to defer them to runtime.
3410
3411 2015-01-13  Thomas Preud'homme <thomas.preudhomme@arm.com>
3412
3413         * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Use SYMBOLIC_BIND
3414         to check if a symbol should be bound symbolically.
3415
3416 2015-01-13  Jiong Wang  <jiong.wang@arm.com>
3417
3418         * elfnn-aarch64.c: (elfNN_aarch64_howto_table): Enable overflow check
3419         for TLSLE_MOVW_TPREL_G2.
3420
3421 2015-01-13  Jiong Wang  <jiong.wang@arm.com>
3422
3423         PR ld/17415
3424         * elfnn-aarch64.c (elfNN_aarch64_howto_table): Mark
3425         R_AARCH64_TLSLE_ADD_TPREL_HI12 as complain_overflow_unsigned.
3426         * elfxx-aarch64.c (_bfd_aarch64_elf_resolve_relocation): Correct the
3427         bit mask.
3428
3429 2015-01-12  Terry Guo  <terry.guo@arm.com>
3430
3431         * elflink.c (_bfd_elf_gc_mark_debug_special_section_group): New
3432         function.
3433         (_bfd_elf_gc_mark_extra_sections): Use it.
3434
3435 2015-01-11  H.J. Lu  <hongjiu.lu@intel.com>
3436
3437         PR ld/17827
3438         * elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): For PIE,
3439         only discard space for pc-relative relocs symbols which turn
3440         out to need copy relocs.
3441
3442 2015-01-09  Nick Clifton  <nickc@redhat.com>
3443
3444         * tekhex.c (getvalue): Fix thinko in test for correct extraction
3445         of value.
3446         (getsym): Return false if there was not enough data to extract the
3447         symbol.
3448
3449 2015-01-09  Anthony Green  <green@moxielogic.com>
3450
3451         * elf32-moxie.c (ELF_MACHINE_ALT1): Define.
3452
3453 2015-01-08  Nick Clifton  <nickc@redhat.com>
3454
3455         * elf32-msp430.c (msp430_elf_relax_section): Add relaxation of
3456         16-bit absolute BR instructions to 10-bit pc-relative JMP
3457         instructions.
3458
3459 2015-01-08  Nick Clifton  <nickc@redhat.com>
3460
3461         PR binutils/17512
3462         * coffcode.h (coff_slurp_symbol_table): Return false if we failed
3463         to load the line table.
3464         * elf.c (_bfd_elf_map_sections_to_segments): Enforce a minimum
3465         maxpagesize of 1.
3466         * peXXigen.c (_bfd_XX_bfd_copy_private_bfd_data_common): Fail if
3467         the Data Directory Size is too large.
3468
3469 2015-01-06  H.J. Lu  <hongjiu.lu@intel.com>
3470
3471         PR binutils/17512
3472         * elf32-i386.c (elf_i386_get_plt_sym_val): Skip unknown relocation.
3473         * elf64-x86-64.c (elf_x86_64_get_plt_sym_val): Likewise.
3474
3475 2015-01-06  Nick Clifton  <nickc@redhat.com>
3476
3477         PR binutils/17512
3478         * mach-o.c (bfd_mach_o_read_symtab_strtab): Zero terminate the
3479         string table.
3480
3481         * reloc.c (bfd_get_reloc_size): Handle a reloc size of -1.
3482         (bfd_perform_relocation): Include the size of the reloc in the
3483         test for an out of range relocation.
3484         (bfd_generic_get_relocated_section_contents): Remove reloc range
3485         test.
3486
3487         * coff-i860.c (CALC_ADDEND): Always set an addend value.
3488         * tekhex.c (getvalue): Add an end pointer parameter.  Use it to
3489         avoid reading off the end of the buffer.
3490         (getsym): Likewise.
3491         (first_phase): Likewise.
3492         (pass_over): Pass an end pointer to the invoked function.
3493
3494 2015-01-05  H.J. Lu  <hongjiu.lu@intel.com>
3495
3496         PR binutils/17512
3497         * elf32-i386.c (elf_i386_get_plt_sym_val): Return NULL on corrupt
3498         input.
3499         * elf64-x86-64.c (elf_x86_64_get_plt_sym_val): Likewise.
3500
3501 2015-01-05  Nick Clifton  <nickc@redhat.com>
3502
3503         PR binutils/17512
3504         * archive.c (do_slurp_bsd_armap): Make sure that the parsed sized
3505         is at least big enough for the header to be read.
3506         * elf32-i386.c (elf_i386_get_plt_sym_val): Skip unknown relocs.
3507         * mach-o.c (bfd_mach_o_get_synthetic_symtab): Add range checks.
3508         (bfd_mach_o_read_command): Prevetn duplicate error messages about
3509         unrecognized commands.
3510         * syms.c (_bfd_stab_section_find_nearest_line): Add range checks
3511         when indexing into the string table.
3512
3513 2015-01-01  Alan Modra  <amodra@gmail.com>
3514
3515         Update year range in copyright notice of all files.
3516
3517 For older changes see ChangeLog-2014
3518 \f
3519 Copyright (C) 2015 Free Software Foundation, Inc.
3520
3521 Copying and distribution of this file, with or without modification,
3522 are permitted in any medium without royalty provided the copyright
3523 notice and this notice are preserved.
3524
3525 Local Variables:
3526 mode: change-log
3527 left-margin: 8
3528 fill-column: 74
3529 version-control: never
3530 End: