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