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