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