[bfd][arm] Don't assert on suspicious build attributes in input file
[external/binutils.git] / bfd / ChangeLog
1 2017-06-08  Richard Earnshaw  <rearnsha@arm.com>
2
3         * elf32-arm.c (elf32_arm_merge_eabi_attributes): Remove assertion
4         that the input bfd has Tag_FP_ARCH non-zero if Tag_ABI_HardFP_use
5         is non-zero.  Add clarifying comments.
6
7 2017-06-08  H.J. Lu  <hongjiu.lu@intel.com>
8
9         * elf32-i386.c (elf_i386_check_relocs): Set local IFUNC symbol
10         name.  Use local IFUNC symbol name string to report unsupported
11         non-PIC call to IFUNC function.
12         (elf_i386_relocate_section): Dump local IFUNC name with minfo
13         when generating R_386_IRELATIVE relocation.
14         (elf_i386_finish_dynamic_symbol): Likewise.
15         * elf_x86_64_check_relocs (elf_x86_64_check_relocs): Set local
16         IFUNC symbol name.
17         (elf_x86_64_relocate_section): Dump local IFUNC name with minfo
18         when generating R_X86_64_IRELATIVE relocation.
19         (elf_x86_64_finish_dynamic_symbol): Likewise.
20
21 2017-06-08  Jiong Wang <jiong.wang@arm.com>
22
23         PR ld/21532
24         * elfnn-aarch64.c (ELIMINATE_COPY_RELOCS): Set to 1.
25         (elfNN_aarch64_final_link_relocate): Also propagate relocations to
26         runtime for copy relocation elimination cases.
27         (alias_readonly_dynrelocs): New function.
28         (elfNN_aarch64_adjust_dynamic_symbol): Keep the dynamic relocs instead
29         of generating copy relocation if it is not against read-only sections.
30         (elfNN_aarch64_check_relocs): Likewise.
31
32 2017-06-06  Jose E. Marchesi  <jose.marchesi@oracle.com>
33
34         * elf.c (setup_group): Make sure BFD sections are created for all
35         group sections in the input file when processing SHF_GROUP
36         sections.
37         (bfd_section_from_shdr): Avoid duplicating logic already
38         implemented in `setup_group'.
39
40 2017-06-06  Daniel Bonniot de Ruisselet  <bonniot@gmail.com>
41
42         PR binutils/21546
43         * peXXigen.c (pe_print_idata): Use the address of the first thunk
44         if the hint address is zero.
45
46 2017-06-06  James Clarke  <jrtc27@jrtc27.com>
47
48         PR ld/19579
49         * elfnn-aarch64.c (elfNN_aarch64_finish_dynamic_symbol): Check
50         ELF_COMMON_DEF_P for common symbols.
51
52 2017-06-06  Andrew Burgess  <andrew.burgess@embecosm.com>
53
54         * elf.c (_bfd_elf_make_section_from_shdr): Don't initially mark
55         SEC_GROUP sections as SEC_EXCLUDE.
56         (bfd_elf_set_group_contents): Replace use of abort with an assert.
57         (assign_section_numbers): Use resolve_section_groups flag instead
58         of relocatable link type.
59         (_bfd_elf_init_private_section_data): Use resolve_section_groups
60         flag instead of checking the final_link flag for part of the
61         checks in here.  Fix white space as a result.
62         * elflink.c (elf_link_input_bfd): Use resolve_section_groups flag
63         instead of relocatable link type.
64         (bfd_elf_final_link): Likewise.
65
66 2017-06-06  Jose E. Marchesi  <jose.marchesi@oracle.com>
67
68         * elfxx-mips.c (_bfd_mips_elf_relocate_section): Remove unused
69         variable `bed'.
70         * elf32-score.c (score_elf_final_link_relocate): Likewise.
71         (s3_bfd_score_elf_check_relocs): Likewise.
72         * elf32-score7.c (s7_bfd_score_elf_relocate_section): Likewise.
73         (score_elf_final_link_relocate): Likewise.
74         (s7_bfd_score_elf_check_relocs): Likewise.
75
76 2017-06-06  Jose E. Marchesi  <jose.marchesi@oracle.com>
77
78         * elflink.c (init_reloc_cookie_rels): Remove unused variable
79         `bed'.
80
81 2017-06-06  Maciej W. Rozycki  <macro@imgtec.com>
82
83         * elf-bfd.h (RELOC_AGAINST_DISCARDED_SECTION): Subtract `count'
84         from `reloc_count' rather than decrementing it.
85         * elf.c (bfd_section_from_shdr): Multiply the adjustment to
86         `reloc_count' by `int_rels_per_ext_rel'.
87         * elf32-score.c (score_elf_final_link_relocate): Do not multiply
88         `reloc_count' by `int_rels_per_ext_rel' for last relocation
89         entry determination.
90         (s3_bfd_score_elf_check_relocs): Likewise.
91         * elf32-score7.c (score_elf_final_link_relocate): Likewise.
92         (s7_bfd_score_elf_relocate_section): Likewise.
93         (s7_bfd_score_elf_check_relocs): Likewise.
94         * elf64-mips.c (mips_elf64_get_reloc_upper_bound): Remove
95         prototype and function.
96         (mips_elf64_slurp_one_reloc_table): Do not update `reloc_count'.
97         (mips_elf64_slurp_reloc_table): Assert that `reloc_count' is
98         triple rather than once the sum of REL and RELA relocation entry
99         counts.
100         (bfd_elf64_get_reloc_upper_bound): Remove macro.
101         * elflink.c (_bfd_elf_link_read_relocs): Do not multiply
102         `reloc_count' by `int_rels_per_ext_rel' for internal relocation
103         storage allocation size determination.
104         (elf_link_input_bfd): Multiply `.ctors' and `.dtors' section's
105         size by `int_rels_per_ext_rel'.  Do not multiply `reloc_count'
106         by `int_rels_per_ext_rel' for last relocation entry
107         determination.
108         (bfd_elf_final_link): Do not multiply `reloc_count' by
109         `int_rels_per_ext_rel' for internal relocation storage
110         allocation size determination.
111         (init_reloc_cookie_rels): Do not multiply `reloc_count' by
112         `int_rels_per_ext_rel' for last relocation entry determination.
113         (elf_gc_smash_unused_vtentry_relocs): Likewise.
114         * elfxx-mips.c (_bfd_mips_elf_check_relocs): Likewise.
115         (_bfd_mips_elf_relocate_section): Likewise.
116
117 2017-06-05  Alan Modra  <amodra@gmail.com>
118
119         PR 21529
120         * linker.c (_bfd_generic_link_output_symbols): Handle BSF_GNU_UNIQUE.
121
122 2017-06-01  John Baldwin  <jhb@FreeBSD.org>
123
124         * elf.c (elfcore_grok_freebsd_psinfo): Use ELF header class to
125         determine structure sizes.
126         (elfcore_grok_freebsd_prstatus): Likewise.
127
128 2017-06-01  Alan Modra  <amodra@gmail.com>
129
130         * elf64-ppc.c (struct ppc_link_hash_table): Add has_plt_localentry0.
131         (ppc64_elf_merge_symbol_attribute): Merge localentry bits from
132         dynamic objects.
133         (is_elfv2_localentry0): New function.
134         (ppc64_elf_tls_setup): Default params->plt_localentry0.
135         (plt_stub_size): Adjust size for tls_get_addr_opt stub.
136         (build_tls_get_addr_stub): Use a simpler stub when r2 is not saved.
137         (ppc64_elf_size_stubs): Leave stub_type as ppc_stub_plt_call for
138         optimized localentry:0 stubs.
139         (ppc64_elf_build_stubs): Save r2 in ELFv2 __glink_PLTresolve.
140         (ppc64_elf_relocate_section): Leave nop unchanged for optimized
141         localentry:0 stubs.
142         (ppc64_elf_finish_dynamic_sections): Set PPC64_OPT_LOCALENTRY in
143         DT_PPC64_OPT.
144         * elf64-ppc.h (struct ppc64_elf_params): Add plt_localentry0.
145
146 2017-05-30  Casey Smith  <clegg89@gmail.com>
147
148         PR ld/21523
149         * elf32-arm.c (elf32_arm_final_link_relocate): Install an absolute
150         value when processing the R_ARM_THM_ALU_PREL_11_0 reloc.
151
152 2017-05-30  Anton Kolesov  Anton.Kolesov@synopsys.com
153
154         * cpu-arc.c (arc_compatible): New function.
155
156 2017-05-30  Anton Kolesov  <anton.kolesov@synopsys.com>
157
158         * cpu-arc.c (arch_info_struct): Remove duplicate ARC600 entry.
159
160 2017-05-30  H.J. Lu  <hongjiu.lu@intel.com>
161
162         PR binutils/21519
163         * bfdio.c (bfd_get_file_size): New function.
164         * bfd-in2.h: Regenerated.
165
166 2017-05-23  Dilian Palauzov  <git-dpa@aegee.org>
167
168         * elf32-arc.c (arc_elf_merge_attributes): Add fall through
169         comments.
170
171 2017-05-22  H.J. Lu  <hongjiu.lu@intel.com>
172
173         * elf64-x86-64.c (elf_x86_64_link_setup_gnu_properties): Use
174         dynobj instead of htab->elf.dynobj.
175
176 2017-05-19  Maciej W. Rozycki  <macro@imgtec.com>
177
178         * elf64-mips.c (mips_elf64_canonicalize_reloc): Remove prototype
179         and function.
180         (mips_elf64_canonicalize_dynamic_reloc): Likewise.
181         (mips_elf64_slurp_one_reloc_table): Set `reloc_count' to the
182         actual number of internal relocations retrieved.  Adjust
183         function description.
184         (bfd_elf64_canonicalize_reloc): Remove macro.
185         (bfd_elf64_canonicalize_dynamic_reloc): Likewise.
186
187 2017-05-19  Jose E. Marchesi  <jose.marchesi@oracle.com>
188
189         * archures.c (bfd_mach_sparc_v9m8): Define.
190         (bfd_mach_sparc_v8plusm8): Likewise.
191         (bfd_mach_sparc_v9_p): Adjust to M8.
192         (bfd_mach_sparc_64bit_p): Likewise.
193         * aoutx.h (machine_type): Handle bfd_mach_sparc_v9m8 and
194         bfd_mach_sparc_v8plusm8.
195         * bfd-in2.h: Regenerated.
196         * cpu-sparc.c (arch_info_struct): Entries for sparc:v9m8 and
197         sparc:v8plusm8.
198         * elfxx-sparc.c (_bfd_sparc_elf_object_p): Handle
199         bfd_mach_sparc_v8plusm8 and bfd_mach_sparc_v9m8 using the new hw
200         capabilities ONADDSUB, ONMUL, ONDIV, DICTUNP, FPCPSHL, RLE and
201         SHA3.
202         * elf32-sparc.c (elf32_sparc_final_write_processing): Handle
203         bfd_mach_sparc_v8plusm8.
204
205 2017-05-19  Alan Modra  <amodra@gmail.com>
206
207         * elflink.c (_bfd_elf_gc_mark_extra_sections): Don't keep
208         debug and special sections when no non-note alloc sections in an
209         object are kept.
210
211 2017-05-18  Alan Modra  <amodra@gmail.com>
212
213         * arc-got.h: Don't compare boolean values against TRUE or FALSE.
214         * elf-m10300.c: Likewise.
215         * elf.c: Likewise.
216         * elf32-arc.c: Likewise.
217         * elf32-bfin.c: Likewise.
218         * elf32-m68k.c: Likewise.
219         * elf32-nds32.c: Likewise.
220         * elf32-tilepro.c: Likewise.
221         * elflink.c: Likewise.
222         * elfnn-aarch64.c: Likewise.
223         * elfnn-riscv.c: Likewise.
224         * elfxx-tilegx.c: Likewise.
225         * mach-o.c: Likewise.
226         * peXXigen.c: Likewise.
227         * vms-alpha.c: Likewise.
228         * vms-lib.c: Likewise.
229
230 2017-05-17  H.J. Lu  <hongjiu.lu@intel.com>
231
232         PR ld/20882
233         * elflink.c (elf_gc_mark_debug_section): New function.
234         (_bfd_elf_gc_mark_extra_sections): Mark any debug sections
235         referenced by kept debug sections.
236
237 2017-05-16  Alan Modra  <amodra@gmail.com>
238
239         * elf-m10300.c: Rename occurrences of non_ir_ref.
240         * elf32-arm.c: Likewise.
241         * elf32-bfin.c: Likewise.
242         * elf32-cr16.c: Likewise.
243         * elf32-cris.c: Likewise.
244         * elf32-d10v.c: Likewise.
245         * elf32-dlx.c: Likewise.
246         * elf32-fr30.c: Likewise.
247         * elf32-frv.c: Likewise.
248         * elf32-hppa.c: Likewise.
249         * elf32-i370.c: Likewise.
250         * elf32-i386.c: Likewise.
251         * elf32-iq2000.c: Likewise.
252         * elf32-lm32.c: Likewise.
253         * elf32-m32c.c: Likewise.
254         * elf32-m32r.c: Likewise.
255         * elf32-m68hc1x.c: Likewise.
256         * elf32-m68k.c: Likewise.
257         * elf32-mcore.c: Likewise.
258         * elf32-metag.c: Likewise.
259         * elf32-microblaze.c: Likewise.
260         * elf32-moxie.c: Likewise.
261         * elf32-msp430.c: Likewise.
262         * elf32-mt.c: Likewise.
263         * elf32-nios2.c: Likewise.
264         * elf32-or1k.c: Likewise.
265         * elf32-ppc.c: Likewise.
266         * elf32-rl78.c: Likewise.
267         * elf32-s390.c: Likewise.
268         * elf32-score.c: Likewise.
269         * elf32-score7.c: Likewise.
270         * elf32-sh.c: Likewise.
271         * elf32-tic6x.c: Likewise.
272         * elf32-tilepro.c: Likewise.
273         * elf32-v850.c: Likewise.
274         * elf32-vax.c: Likewise.
275         * elf32-xstormy16.c: Likewise.
276         * elf32-xtensa.c: Likewise.
277         * elf64-alpha.c: Likewise.
278         * elf64-hppa.c: Likewise.
279         * elf64-ia64-vms.c: Likewise.
280         * elf64-mmix.c: Likewise.
281         * elf64-ppc.c: Likewise.
282         * elf64-s390.c: Likewise.
283         * elf64-sh64.c: Likewise.
284         * elf64-x86-64.c: Likewise.
285         * elflink.c: Likewise.
286         * elfnn-aarch64.c: Likewise.
287         * elfnn-ia64.c: Likewise.
288         * elfnn-riscv.c: Likewise.
289         * elfxx-mips.c: Likewise.
290         * elfxx-sparc.c: Likewise.
291         * elfxx-tilegx.c: Likewise.
292         * linker.c: Likewise.
293
294 2017-05-16  Alan Modra  <amodra@gmail.com>
295
296         * elf64-ppc.c (add_symbol_adjust): Transfer non_ir_ref_dynamic.
297         * elflink.c (elf_link_add_object_symbols): Update to use
298         non_ir_ref_dynamic.
299         (elf_link_input_bfd): Test non_ir_ref_dynamic in addition to
300         non_ir_ref.
301         * linker.c (_bfd_generic_link_add_one_symbol): Likewise.
302
303 2017-05-15  Maciej W. Rozycki  <macro@imgtec.com>
304
305         * elfxx-mips.c (print_mips_ases): Handle MIPS16e2 ASE.
306
307 2017-05-12  H.J. Lu  <hongjiu.lu@intel.com>
308
309         * elf32-i386.c (elf_i386_parse_gnu_properties): Merge
310         GNU_PROPERTY_X86_ISA_1_USED and GNU_PROPERTY_X86_ISA_1_NEEDED
311         properties.
312         * elf64-x86-64.c (elf_x86_64_parse_gnu_properties): Likewise.
313
314 2017-05-11  H.J. Lu  <hongjiu.lu@intel.com>
315
316         * elf64-x86-64.c (elf_x86_64_link_hash_entry): Rename plt_bnd
317         to plt_second.
318         (elf_x86_64_link_hash_table): Rename plt_bnd/plt_bnd_eh_frame
319         to plt_second/plt_second_eh_frame.
320         (elf_x86_64_link_hash_newfunc): Updated.
321         (elf_x86_64_allocate_dynrelocs): Likewise.
322         (elf_x86_64_size_dynamic_sections): Likewise.
323         (elf_x86_64_relocate_section): Likewise.
324         (elf_x86_64_finish_dynamic_symbol): Likewise.
325         (elf_x86_64_finish_dynamic_sections): Likewise.
326         (elf_x86_64_plt_type): Rename plt_bnd to plt_second.
327         (elf_x86_64_get_synthetic_symtab): Updated.  Also scan the
328         .plt.sec section.
329         (elf_backend_setup_gnu_properties): Updated.  Create the
330         .plt.sec section instead of the .plt.sec section.
331
332 2017-05-11  H.J. Lu  <hongjiu.lu@intel.com>
333
334         * elf32-i386.c (elf_i386_allocate_dynrelocs): Partially revert
335         commit 25070364b0ce33eed46aa5d78ebebbec6accec7e.
336         * elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): Likewse.
337
338 2017-05-10  Jose E. Marchesi  <jose.marchesi@oracle.com>
339
340         * elf64-sparc.c (elf64_sparc_set_reloc): New function.
341         (bfd_elf64_set_reloc): Define.
342         (elf64_sparc_write_relocs): Use `canon_reloc_count'.
343
344 2017-05-10  Jose E. Marchesi  <jose.marchesi@oracle.com>
345
346         * targets.c (BFD_JUMP_TABLE_RELOCS): Add NAME##_set_reloc.
347         (struct bfd_target): New field _bfd_set_reloc.
348         * bfd.c (bfd_set_reloc): Call backend _set_bfd.
349         * reloc.c (_bfd_generic_set_reloc): New function.
350         * coffcode.h (coff_set_reloc): Define to _bfd_generic_set_reloc.
351         * nlm-target.h (nlm_set_reloc): Likewise.
352         * coff-rs6000.c (_bfd_xcoff_set_reloc): Likewise.
353         * aout-tic30.c (MY_set_reloc): Likewise.
354         * aout-target.h (MY_set_reloc): Likewise.
355         * elfxx-target.h (bfd_elfNN_set_reloc): Likewise.
356         * coff-alpha.c (_bfd_ecoff_set_reloc): Likewise.
357         * mach-o-target.c (bfd_mach_o_set_reloc): Likewise.
358         * vms-alpha.c (alpha_vms_set_reloc): Likewise.
359         * aout-adobe.c (aout_32_set_reloc): Likewise.
360         * bout.c (b_out_set_reloc): Likewise.
361         * coff-mips.c (_bfd_ecoff_set_reloc): Likewise.
362         * i386os9k.c (aout_32_set_reloc): Likewise.
363         * ieee.c (ieee_set_reloc): Likewise.
364         * oasys.c (oasys_set_reloc): Likewise.
365         * som.c (som_set_reloc): Likewise.
366         * versados.c (versados_set_reloc): Likewise.
367         * coff64-rs6000.c (rs6000_xcoff64_vec): Add
368         _bfd_generic_set_reloc.
369         (rs6000_xcoff64_aix_vec): LIkewise.
370         * libbfd.c (_bfd_norelocs_set_reloc): New function.
371         * libbfd-in.h: Prototype for _bfd_norelocs_set_reloc.
372         * i386msdos.c (msdos_set_reloc): Define to
373         _bfd_norelocs_set_reloc.
374         * elfcode.h (elf_set_reloc): Define.
375         * bfd-in2.h: Regenerated.
376
377 2017-05-10  H.J. Lu  <hongjiu.lu@intel.com>
378
379         PR ld/21481
380         * elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Use .plt.bnd
381         for IFUNC function address.
382
383 2017-05-10  Claudiu Zissulescu  <claziss@synopsys.com>
384
385         * elf32-arc.c (FEATURE_LIST_NAME): Define.
386         (CONFLICT_LIST): Likewise.
387         (opcode/arc-attrs.h): Include.
388         (arc_elf_print_private_bfd_data): Print OSABI v4 flag.
389         (arc_extract_features): New file.
390         (arc_stralloc): Likewise.
391         (arc_elf_merge_attributes): Likewise.
392         (arc_elf_merge_private_bfd_data): Use object attributes.
393         (bfd_arc_get_mach_from_attributes): New function.
394         (arc_elf_object_p): Use object attributes.
395         (arc_elf_final_write_processing): Likewise.
396         (elf32_arc_obj_attrs_arg_type): New function.
397         (elf32_arc_obj_attrs_handle_unknown): Likewise.
398         (elf32_arc_section_from_shdr): Likewise.
399         (elf_backend_obj_attrs_vendor): Define.
400         (elf_backend_obj_attrs_section): Likewise.
401         (elf_backend_obj_attrs_arg_type): Likewise.
402         (elf_backend_obj_attrs_section_type): Likewise.
403         (elf_backend_obj_attrs_handle_unknown): Likewise.
404         (elf_backend_section_from_shdr): Likewise.
405
406 2017-05-09  Andrew Goedhart  <Andrewgoedhart@simplepowersolutions.co.za>
407
408         PR ld/21458
409         * elf32-arm.c (elf32_arm_final_link_relocate): Set the bottom bit
410         of the value when resolving a R_ARM_THM_ALU_PREL_11_0 relocation
411         and the destination is a Thumb symbol.
412
413 2017-05-08  H.J. Lu  <hongjiu.lu@intel.com>
414
415         * elf32-i386.c (elf_i386_get_synthetic_symtab): Add missing
416         initializer to silence GCC 4.2.
417         * lf64-x86-64.c (elf_x86_64_get_synthetic_symtab): Likewise.
418
419 2017-05-08  H.J. Lu  <hongjiu.lu@intel.com>
420
421         * elf64-x86-64.c (PLT_ENTRY_SIZE): Renamed to ...
422         (LAZY_PLT_ENTRY_SIZE): This.
423         (NON_LAZY_PLT_ENTRY_SIZE): New.
424         (elf_x86_64_plt0_entry): Renamed to ...
425         (elf_x86_64_lazy_plt0_entry): This.
426         (elf_x86_64_plt_entry): Renamed to ...
427         (elf_x86_64_lazy_plt_entry): This.
428         (elf_x86_64_bnd_plt0_entry): Renamed to ...
429         (elf_x86_64_lazy_bnd_plt0_entry): This.
430         (elf_x86_64_legacy_plt_entry): Removed.
431         (elf_x86_64_bnd_plt_entry): Renamed to ...
432         (elf_x86_64_lazy_bnd_plt_entry): This.
433         (elf_x86_64_legacy_plt2_entry): Renamed to ...
434         (elf_x86_64_non_lazy_plt_entry): This.
435         (elf_x86_64_bnd_plt2_entry): Renamed to ...
436         (elf_x86_64_non_lazy_bnd_plt_entry): This.
437         (elf_x86_64_eh_frame_plt): Renamed to ...
438         (elf_x86_64_eh_frame_lazy_plt): This.
439         (elf_x86_64_eh_frame_bnd_plt): Renamed to ...
440         (elf_x86_64_eh_frame_lazy_bnd_plt): This.
441         (elf_x86_64_eh_frame_plt_got): Renamed to ...
442         (elf_x86_64_eh_frame_non_lazy_plt): This.
443         (elf_x86_64_lazy_plt_layout): New.
444         (elf_x86_64_non_lazy_plt_layout): Likewise.
445         (elf_x86_64_plt_layout): Likewise.
446         (elf_x86_64_backend_data): Remove PLT layout information.  Add
447         os for target system.
448         (GET_PLT_ENTRY_SIZE): Removed.
449         (elf_x86_64_lazy_plt): New.
450         (elf_x86_64_non_lazy_plt): Likewise.
451         (elf_x86_64_lazy_bnd_plt): Likewise.
452         (elf_x86_64_non_lazy_bnd_plt): Likewise.
453         (elf_x86-64_arch_bed): Updated.
454         (elf_x86_64_link_hash_table): Add plt, lazy_plt and non_lazy_plt.
455         (elf_x86_64_create_dynamic_sections): Removed.
456         (elf_x86_64_check_relocs): Don't check elf.dynobj.  Don't call
457         _bfd_elf_create_ifunc_sections nor _bfd_elf_create_got_section.
458         (elf_x86-64_adjust_dynamic_symbol): Updated.
459         (elf_x86_64_allocate_dynrelocs): Updated.  Pass 0 as PLT header
460         size to _bfd_elf_allocate_ifunc_dyn_relocs and don't allocate
461         size for PLT0 if there is no PLT0.  Get plt_entry_size from
462         non_lazy_plt for non-lazy PLT entries.
463         (elf_x86_64_size_dynamic_sections): Updated.  Get plt_entry_size
464         from non_lazy_plt for non-lazy PLT entries.
465         (elf_x86-64_relocate_section): Updated.  Properly get PLT index
466         if there is no PLT0.
467         (elf_x86_64_finish_dynamic_symbol): Updated.  Fill the first slot
468         in the PLT entry with generic PLT layout.  Fill the non-lazy PLT
469         entries with non-lazy PLT layout.  Don't fill the second and third
470         slots in the PLT entry if there is no PLT0.
471         (elf_x86_64_finish_dynamic_sections): Updated.  Don't fill PLT0
472         if there is no PLT0.  Set sh_entsize on the .plt.got section.
473         (compare_relocs): New.
474         (elf_x86_64_plt_type): Likewise.
475         (elf_x86_64_plt): Likewise.
476         (elf_x86_64_nacl_plt): New. Forward declaration.
477         (elf_x86_64_get_plt_sym_val): Removed.
478         (elf_x86_64_get_synthetic_symtab): Rewrite to check PLT sections
479         against all dynamic relocations.
480         (elf_x86_64_link_setup_gnu_properties): New function.
481         (elf_backend_create_dynamic_sections): Updated.
482         (elf_backend_setup_gnu_properties): New.
483         (elf_x86_64_nacl_plt): New.
484         (elf_x86_64_nacl_arch_bed): Updated.
485
486 2017-05-08  H.J. Lu  <hongjiu.lu@intel.com>
487
488         * elf32-i386.c (PLT_ENTRY_SIZE): Renamed to ...
489         (LAZY_PLT_ENTRY_SIZE): This.
490         (NON_LAZY_PLT_ENTRY_SIZE): New.
491         (elf_i386_plt0_entry): Renamed to ...
492         (elf_i386_lazy_plt0_entry): This.
493         (elf_i386_plt_entry): Renamed to ...
494         (elf_i386_lazy_plt_entry): This.
495         (elf_i386_pic_plt0_entry): Renamed to ...
496         (elf_i386_pic_lazy_plt0_entry): This.
497         (elf_i386_pic_plt_entry): Renamed to ...
498         (elf_i386_pic_lazy_plt_entry): This.
499         (elf_i386_got_plt_entry): Renamed to ...
500         (elf_i386_non_lazy_plt_entry): This.
501         (elf_i386_pic_got_plt_entry): Renamed to ...
502         (elf_i386_pic_non_lazy_plt_entry): This.
503         (elf_i386_eh_frame_plt): Renamed to ...
504         (elf_i386_eh_frame_lazy_plt): This.
505         (elf_i386_eh_frame_plt_got): Renamed to ...
506         (elf_i386_eh_frame_non_lazy_plt): This.
507         (elf_i386_plt_layout): Renamed to ...
508         (elf_i386_lazy_plt_layout): This.  Remove eh_frame_plt_got and
509         eh_frame_plt_got_size.
510         (elf_i386_non_lazy_plt_layout): New.
511         (elf_i386_plt_layout): Likewise.
512         (elf_i386_non_lazy_plt): Likewise.
513         (GET_PLT_ENTRY_SIZE): Removed.
514         (elf_i386_plt): Renamed to ...
515         (elf_i386_lazy_plt): This.
516         (elf_i386_backend_data): Remove plt.  Rename is_vxworks to os.
517         (elf_i386_arch_bed): Updated.
518         (elf_i386_link_hash_table): Add plt, lazy_plt and non_lazy_plt.
519         (elf_i386_create_dynamic_sections): Removed.
520         (elf_i386_check_relocs): Don't check elf.dynobj.  Don't call
521         _bfd_elf_create_ifunc_sections nor _bfd_elf_create_got_section.
522         (elf_i386_adjust_dynamic_symbol): Updated.
523         (elf_i386_allocate_dynrelocs): Updated.  Pass 0 as PLT header
524         size to _bfd_elf_allocate_ifunc_dyn_relocs and don't allocate
525         size for PLT0 if there is no PLT0.
526         (elf_i386_size_dynamic_sections): Updated.  Check whether GOT
527         output section is discarded only if GOT isn't empty.
528         (elf_i386_relocate_section): Updated.  Properly get PLT index
529         if there is no PLT0.
530         (elf_i386_finish_dynamic_symbol): Updated.  Don't fill the
531         second and third slots in the PLT entry if there is no PLT0.
532         (elf_i386_finish_dynamic_sections): Updated.  Don't fill PLT0
533         if there is no PLT0.  Set sh_entsize on the .plt.got section.
534         (elf_i386_nacl_plt): Forward declaration.
535         (elf_i386_get_plt_sym_val): Removed.
536         (elf_i386_get_synthetic_symtab): Rewrite to check PLT sections
537         against all dynamic relocations.
538         (elf_i386_link_setup_gnu_properties): New function.
539         (elf_backend_create_dynamic_sections): Updated.
540         (elf_backend_setup_gnu_properties): New.
541         (elf_i386_nacl_plt): Updated.
542         (elf_i386_nacl_arch_bed): Likewise.
543         (elf_i386_vxworks_arch_bed): Likewise.
544
545 2017-05-08  Thomas Preud'homme  <thomas.preudhomme@arm.com>
546
547         * elflink.c (elf_output_implib): Remove executable flag from import
548         library bfd.
549         * elf32-arm.c (elf32_arm_filter_implib_symbols): Assert that the import
550         library is a relocatable object file.
551
552 2017-05-01  Senthil Kumar Selvaraj  <senthil_kumar.selvaraj@atmel.com>
553
554         PR ld/21404
555         * elf32-avr.c (avr_should_move_sym): New function.
556         (avr_should_reduce_sym_size): Likewise.
557         (avr_should_increase_sym_size): Likewise.
558         (elf32_avr_relax_delete_bytes): Adjust symbol values
559         and sizes by calling new functions.
560
561 2017-05-01  Palmer Dabbelt  <palmer@dabbelt.com>
562
563         * config.bfd (riscv32-*): Enable rv64.
564
565 2017-05-02  Alan Modra  <amodra@gmail.com>
566
567         PR 21384
568         * elflink.c (bfd_elf_link_mark_dynamic_symbol): Test h->non_elf
569         rather than h->root.type == bfd_link_hash_new.
570         (bfd_elf_record_link_assignment): Similarly, call
571         bfd_elf_link_mark_dynamic_symbol when h->non_elf.
572
573 2017-04-29  Alan Modra  <amodra@gmail.com>
574
575         PR 21432
576         * reloc.c (reloc_offset_in_range): New function.
577         (bfd_perform_relocation, bfd_install_relocation): Use it.
578         (_bfd_final_link_relocate): Likewise.
579
580 2017-04-28  H.J. Lu  <hongjiu.lu@intel.com>
581
582         * elf32-i386.c (elf_i386_allocate_dynrelocs): Check plt_got
583         before using .plt.got.
584         * elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): Likewise.
585
586 2017-04-27  H.J. Lu  <hongjiu.lu@intel.com>
587
588         * elf64-x86-64.c (elf_x86_64_size_dynamic_sections): Use "="
589         instead of "+=" to update 0.
590
591 2017-04-27  H.J. Lu  <hongjiu.lu@intel.com>
592
593         * elf32-i386.c (elf_i386_create_dynamic_sections): Create the
594         .plt.got section here.
595         (elf_i386_check_relocs): Don't create the .plt.got section.
596         * elf64-x86-64.c (elf_x86_64_create_dynamic_sections): Create
597         the .plt.got and .plt.bnd sections here.
598         (elf_x86_64_check_relocs): Don't create the .plt.got nor
599         .plt.bnd sections.
600
601 2017-04-27  H.J. Lu  <hongjiu.lu@intel.com>
602
603         * elf64-x86-64.c (elf_x86_64_link_hash_entry): Remove
604         has_bnd_reloc.
605         (elf_x86_64_link_hash_newfunc): Don't clear has_bnd_reloc.
606         (elf_x86_64_copy_indirect_symbol): Don't copy has_bnd_reloc.
607         (elf_x86_64_check_relocs): Don't set has_bnd_reloc.
608         (elf_x86_64_finish_dynamic_symbol): Check bndplt instead of
609         has_bnd_reloc.
610
611 2017-04-27  H.J. Lu  <hongjiu.lu@intel.com>
612
613         * elf-bfd.h (elf_backend_data): Change setup_gnu_properties
614         to return bfd *.
615         (_bfd_elf_link_setup_gnu_properties): Return bfd *.
616         * elf-properties.c (_bfd_elf_link_setup_gnu_properties): Return
617         the first relocatable ELF input with GNU properties.
618
619 2017-04-27  H.J. Lu  <hongjiu.lu@intel.com>
620
621         * elf32-i386.c (elf_i386_finish_dynamic_sections): Simplify
622         VxWorks for non-PIC.
623
624 2017-04-27  Alan Modra  <amodra@gmail.com>
625
626         * elf-bfd.h (struct elf_backend_data): Make asection param of
627         elf_backend_eh_frame_address_size const.
628         (_bfd_elf_eh_frame_address_size): Likewise.
629         * elf32-m32c.c (_bfd_m32c_elf_eh_frame_address_size): Likewise.
630         * elf32-msp430.c (elf32_msp430_eh_frame_address_size): Likewise.
631         * elfxx-mips.c (_bfd_mips_elf_eh_frame_address_size): Likewise.
632         * elfxx-mips.h (_bfd_mips_elf_eh_frame_address_size): Likewise.
633         * elf-eh-frame.c (_bfd_elf_eh_frame_address_size): Likewise.
634         (next_cie_fde_offset): Constify params.
635         (offset_adjust, adjust_eh_frame_local_symbols): Likewise.
636
637 2017-04-27  Alan Modra  <amodra@gmail.com>
638
639         * elf-bfd.h (struct eh_cie_fde): Add aug_str_len and aug_data_len.
640         (_bfd_elf_adjust_eh_frame_global_symbol): Declare.
641         * elf-eh-frame.c (_bfd_elf_parse_eh_frame): Set aug_str_len and
642         aug_data_len.
643         (offset_adjust): New function.
644         (_bfd_elf_adjust_eh_frame_global_symbol): Likewise.
645         (adjust_eh_frame_local_symbols): Likewise.
646         (_bfd_elf_discard_section_eh_frame): Call adjust_eh_frame_local_symbols
647         after changing anything.  Return true if anything changed.
648         * elflink.c (bfd_elf_discard_info): If .eh_frame changed, call
649         _bfd_elf_adjust_eh_frame_global_symbol for globals.
650
651 2017-04-27  Alan Modra  <amodra@gmail.com>
652
653         * elflink.c (_bfd_elf_link_hash_hide_symbol): Clear dynstr_index
654         when force_local.
655
656 2017-04-27  Alan Modra  <amodra@gmail.com>
657
658         * elf32-ppc.c (UNDEFWEAK_NO_DYNAMIC_RELOC): Define.
659         (ppc_elf_select_plt_layout, ppc_elf_tls_setup): Use it.
660         (ppc_elf_adjust_dynamic_symbol, allocate_dynrelocs): Likewise.
661         (ppc_elf_relocate_section): Likewise.  Delete silly optimisation
662         for undef and undefweak dyn_relocs.
663         * elf64-ppc.c (UNDEFWEAK_NO_DYNAMIC_RELOC): Define.
664         (ppc64_elf_adjust_dynamic_symbol, ppc64_elf_tls_setup): Use it.
665         (allocate_got, allocate_dynrelocs): Likewise.
666         (ppc64_elf_relocate_section): Likewise.
667
668 2017-04-26  H.J. Lu  <hongjiu.lu@intel.com>
669
670         * elf32-i386.c (elf_i386_size_dynamic_sections): Alwasys add
671         DT_PLTRELSZ, DT_PLTREL and DT_JMPREL for .rel.plt section.
672         * elf64-x86-64.c (elf_x86_64_size_dynamic_sections): Alwasys
673         add DT_PLTRELSZ, DT_PLTREL and DT_JMPREL for .rela.plt section.
674
675 2017-04-26  Nick Clifton  <nickc@redhat.com>
676
677         PR binutils/21434
678         * reloc.c (bfd_perform_relocation): Check for a negative address
679         in the reloc.
680
681 2017-04-26  Maciej W. Rozycki  <macro@imgtec.com>
682
683         PR ld/21334
684         * elf-bfd.h (elf_backend_data): Add `always_renumber_dynsyms'
685         member.
686         * elfxx-target.h [!elf_backend_always_renumber_dynsyms]
687         (elf_backend_always_renumber_dynsyms): Define.
688         (elfNN_bed): Initialize `always_renumber_dynsyms' member.
689         * elfxx-mips.h (elf_backend_always_renumber_dynsyms): Define.
690         * elflink.c (bfd_elf_size_dynamic_sections): Also call
691         `_bfd_elf_link_renumber_dynsyms' if the backend has requested
692         it.
693         (bfd_elf_size_dynsym_hash_dynstr): Likewise.
694
695 2017-04-26  Maciej W. Rozycki  <macro@imgtec.com>
696
697         * elflink.c (bfd_elf_size_dynamic_sections): Only call
698         `_bfd_elf_link_renumber_dynsyms' after section GC if dynamic
699         sections have been created.
700
701 2017-04-26  Nick Clifton  <nickc@redhat.com>
702
703         PR binutils/21431
704         * compress.c (bfd_init_section_compress_status): Check the return
705         value from bfd_malloc.
706
707 2017-04-24  H.J. Lu  <hongjiu.lu@intel.com>
708
709         * elf64-x86-64.c (elf_x86_64_link_hash_entry): Add
710         no_finish_dynamic_symbol.
711         (elf_x86_64_link_hash_newfunc): Set no_finish_dynamic_symbol to
712         0.
713         (elf_x86_64_allocate_dynrelocs): If a symbol isn't undefined
714         weak symbol, don't make it dynamic.
715         (elf_x86_64_relocate_section): If a symbol isn't dynamic in PIC,
716         set no_finish_dynamic_symbol and generate R_X86_64_RELATIVE
717         relocation for GOT reference.
718         (elf_x86_64_finish_dynamic_symbol): Abort if
719         no_finish_dynamic_symbol isn't 0.
720
721 2017-04-24  H.J. Lu  <hongjiu.lu@intel.com>
722
723         PR ld/21402
724         * elf32-i386.c (elf_i386_allocate_dynrelocs): If a symbol isn't
725         undefined weak symbol, don't make it dynamic.
726         (elf_i386_relocate_section): If a symbol isn't dynamic in PIC,
727         set no_finish_dynamic_symbol and generate R_386_RELATIVE
728         relocation for R_386_GOT32.
729
730 2017-04-24  H.J. Lu  <hongjiu.lu@intel.com>
731
732         PR ld/21425
733         * elf32-i386.c (ELF_MAXPAGESIZE): Set to 0x1000 for VxWorks.
734
735 2017-04-23  Alan Modra  <amodra@gmail.com>
736
737         PR 21414
738         * section.c (GLOBAL_SYM_INIT): Make available in bfd.h.
739         * elf.c (lcomm_sym): New.
740         (_bfd_elf_large_com_section): Use lcomm_sym section symbol.
741         * bfd-in2.h: Regenerate.
742
743 2017-04-23  Alan Modra  <amodra@gmail.com>
744
745         PR 21412
746         * elf-bfd.h (struct elf_backend_data <get_reloc_section>): Change
747         parameters and comment.
748         (_bfd_elf_get_reloc_section): Delete.
749         (_bfd_elf_plt_get_reloc_section): Declare.
750         * elf.c (_bfd_elf_plt_get_reloc_section, elf_get_reloc_section):
751         New functions.  Don't blindly skip over assumed .rel/.rela prefix.
752         Extracted from..
753         (_bfd_elf_get_reloc_section): ..here.  Delete.
754         (assign_section_numbers): Call elf_get_reloc_section.
755         * elf64-ppc.c (elf_backend_get_reloc_section): Define.
756         * elfxx-target.h (elf_backend_get_reloc_section): Update.
757
758 2017-04-23  Alan Modra  <amodra@gmail.com>
759
760         PR 21409
761         * dwarf2.c (_bfd_dwarf2_find_nearest_line): Don't segfault when
762         no symbols.
763
764 2017-04-21  H.J. Lu  <hongjiu.lu@intel.com>
765
766         PR ld/21402
767         * elf32-i386.c (elf_i386_link_hash_entry): Add
768         no_finish_dynamic_symbol.
769         (elf_i386_link_hash_newfunc): Set no_finish_dynamic_symbol to 0.
770         (elf_i386_allocate_dynrelocs): If a symbol isn't undefined weak
771         symbol, don't make it dynamic in PIE.
772         (elf_i386_relocate_section): If a symbol isn't dynamic in PIE,
773         set no_finish_dynamic_symbol and generate R_386_RELATIVE
774         relocation for R_386_GOT32
775         (elf_i386_finish_dynamic_symbol): Abort if no_finish_dynamic_symbol
776         isn't 0.
777
778 2017-04-21  H.J. Lu  <hongjiu.lu@intel.com>
779
780         PR ld/19617
781         PR ld/21086
782         * elflink.c (elf_link_add_object_symbols): Require
783         --no-dynamic-linker with -E/--dynamic-list when creating
784         dynamic sections.
785
786 2017-04-20  Maciej W. Rozycki  <macro@imgtec.com>
787
788         * elflink.c (_bfd_elf_symbol_refs_local_p): Always return TRUE
789         if forced local.
790
791 2017-04-20  Maciej W. Rozycki  <macro@imgtec.com>
792
793         * elfxx-mips.c (_bfd_mips_elf_final_link): Reorder comment about
794         dynamic symbol sorting.
795
796 2017-04-20  H.J. Lu  <hongjiu.lu@intel.com>
797
798         PR ld/21382
799         * elflink.c (elf_link_add_object_symbols): Preserve
800         dynamic_ref_after_ir_def when restoring the symbol table for
801         unneeded dynamic object.
802
803 2017-04-19  H.J. Lu  <hongjiu.lu@intel.com>
804
805         PR ld/21401
806         * elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Don't abort
807         on on undefined IFUNC symbol in the second PLT.
808
809 2017-04-19  Wedson Almeida Filho  <wedsonaf@gmail.com>
810
811         * peXXigen.c (pe_print_reloc): Correct chunk_end.
812
813 2017-04-19  Alan Modra  <amodra@gmail.com>
814
815         * elflink.c (_bfd_elf_adjust_dynamic_symbol): Hide undefweak
816         or make dynamic for info->dynamic_undefined_weak 0 and 1.
817         * elf32-ppc.c:Formatting.
818         (ensure_undefweak_dynamic): Don't make dynamic when
819         info->dynamic_undefined_weak is zero.
820         (allocate_dynrelocs): Discard undefweak dyn_relocs for
821         info->dynamic_undefined_weak.  Discard undef dyn_relocs when
822         not default visibility.  Discard undef and undefweak
823         dyn_relocs earlier.
824         (ppc_elf_relocate_section): Adjust to suit.
825         * elf64-ppc.c: Formatting.
826         (ensure_undefweak_dynamic): Don't make dynamic when
827         info->dynamic_undefined_weak is zero.
828         (allocate_dynrelocs): Discard undefweak dyn_relocs for
829         info->dynamic_undefined_weak.  Discard them earlier.
830
831 2017-04-17  H.J. Lu  <hongjiu.lu@intel.com>
832
833         PR ld/21389
834         * elflink.c (bfd_elf_size_dynamic_sections): Get soname index
835         before generating the version definition section.
836
837 2017-04-17  Alan Modra  <amodra@gmail.com>
838
839         * elflink.c (_bfd_elf_merge_symbol): Undo dynamic linking
840         state when a regular object file defines a symbol with
841         incompatible type to that defined by an earlier shared lib.
842
843 2017-04-13  Alan Modra  <amodra@gmail.com>
844
845         * coffcode.h: Wrap some overly long _bfd_error_handler args.
846         * elf.c: Likewise.
847         * elf32-arm.c: Likewise.
848         * elf32-i386.c: Likewise.
849         * elf32-mep.c: Likewise.
850         * elf64-ia64-vms.c: Likewise.
851         * elf64-x86-64.c: Likewise.
852         * elflink.c: Likewise.
853         * elfnn-ia64.c: Likewise.
854         * elfxx-mips.c: Likewise.
855
856 2017-04-13  Alan Modra  <amodra@gmail.com>
857
858         * aoutx.h: Use %B and %A in error messages throughout file.
859         * aout-cris.c: Likewise.
860         * archive.c: Likewise.
861         * binary.c: Likewise.
862         * coff-rs6000.c: Likewise.
863         * coff-tic4x.c: Likewise.
864         * coffcode.h: Likewise.
865         * coffgen.c: Likewise.
866         * cofflink.c: Likewise.
867         * coffswap.h: Likewise.
868         * cpu-arm.c: Likewise.
869         * elf-eh-frame.c: Likewise.
870         * elf-m10300.c: Likewise.
871         * elf.c: Likewise.
872         * elf32-arc.c: Likewise.
873         * elf32-arm.c: Likewise.
874         * elf32-bfin.c: Likewise.
875         * elf32-frv.c: Likewise.
876         * elf32-iq2000.c: Likewise.
877         * elf32-m32c.c: Likewise.
878         * elf32-microblaze.c: Likewise.
879         * elf32-nds32.c: Likewise.
880         * elf32-rl78.c: Likewise.
881         * elf32-rx.c: Likewise.
882         * elf32-score.c: Likewise.
883         * elf32-score7.c: Likewise.
884         * elf32-sh64.c: Likewise.
885         * elf32-v850.c: Likewise.
886         * elf32-vax.c: Likewise.
887         * elf32-visium.c: Likewise.
888         * elf64-ia64-vms.c: Likewise.
889         * elf64-mmix.c: Likewise.
890         * elf64-sh64.c: Likewise.
891         * elfcode.h: Likewise.
892         * elfnn-aarch64.c: Likewise.
893         * elfnn-ia64.c: Likewise.
894         * elfxx-mips.c: Likewise.
895         * hpux-core.c: Likewise.
896         * ieee.c: Likewise.
897         * ihex.c: Likewise.
898         * linker.c: Likewise.
899         * merge.c: Likewise.
900         * mmo.c: Likewise.
901         * oasys.c: Likewise.
902         * pdp11.c: Likewise.
903         * peXXigen.c: Likewise.
904         * rs6000-core.c: Likewise.
905         * vms-alpha.c: Likewise.
906         * xcofflink.c: Likewise.
907
908 2017-04-13  Alan Modra  <amodra@gmail.com>
909
910         * bfd.c (PRINT_TYPE): Define.
911         (_doprnt): New function.
912         (error_handler_internal): Use _doprnt.
913         * coff-arm.c: Put %A and %B arguments to _bfd_error_handler
914         calls in their natural order, throughout file.
915         * coff-mcore.c: Likewise.
916         * coff-ppc.c: Likewise.
917         * coff-tic80.c: Likewise.
918         * cofflink.c: Likewise.
919         * elf-s390-common.c: Likewise.
920         * elf.c: Likewise.
921         * elf32-arm.c: Likewise.
922         * elf32-i386.c: Likewise.
923         * elf32-m32r.c: Likewise.
924         * elf32-msp430.c: Likewise.
925         * elf32-spu.c: Likewise.
926         * elf64-ia64-vms.c: Likewise.
927         * elf64-sparc.c: Likewise.
928         * elf64-x86-64.c: Likewise.
929         * elflink.c: Likewise.
930         * elfnn-aarch64.c: Likewise.
931         * elfnn-ia64.c: Likewise.
932         * elfxx-mips.c: Likewise.
933
934 2017-04-13  Alan Modra  <amodra@gmail.com>
935
936         * elf32-arm.c (arm_type_of_stub): Supply missing args to "long
937         branch veneers" error.  Fix double space and format message.
938         * elf32-avr.c (avr_add_stub): Do not pass NULL as %B arg.
939         * elf64-ppc.c (tocsave_find): Supply missing %B arg.
940
941 2017-04-13  Alan Modra  <amodra@gmail.com>
942
943         * bfd-in2.h: Regenerate.
944
945 2017-04-11  H.J. Lu  <hongjiu.lu@intel.com>
946
947         * elf-properties.c (_bfd_elf_parse_gnu_properties): Remove the
948         extra `\n' in warning/error messages.
949         * elf32-i386.c (elf_i386_parse_gnu_properties): Likewise.
950         * elf64-x86-64.c (elf_x86_64_parse_gnu_properties): Likewise.
951
952 2017-04-11  H.J. Lu  <hongjiu.lu@intel.com>
953
954         * elf-properties.c (_bfd_elf_parse_gnu_properties): Ignore
955         processor-specific properties with generic ELF target vector.
956
957 2017-04-10  Qing Zhao  <qing.zhao@oracle.com>
958
959         * elf32-sparc.c (elf_backend_fixup_symbol): New.
960         * elf64-sparc.c (elf_backend_fixup_symbol): New.
961         * elfxx-sparc.c (UNDEFINED_WEAK_RESOLVED_TO_ZERO): New.
962         (_bfd_sparc_elf_link_hash_entry): Add has_got_reloc and
963         has_non_got_reloc.
964         (link_hash_newfunc): Initialize has_got_reloc and
965         has_non_got_reloc.
966         (_bfd_sparc_elf_size_dynamic_sections): Set interp to .interp
967         section.
968         (_bfd_sparc_elf_copy_indirect_symbol): Copy has_got_reloc and
969         has_non_got_reloc.
970         (_bfd_sparc_elf_check_relocs): Set has_got_reloc and
971         has_non_got_reloc.
972         (_bfd_sparc_elf_fixup_symbol): New function.
973         (allocate_dynrelocs): Don't allocate space for dynamic
974         relocations and discard relocations against resolved undefined
975         weak symbols in executable.  Don't make resolved undefined weak
976         symbols in executable dynamic.  Keep dynamic non-GOT/non-PLT
977         relocation against undefined weak symbols in PIE.
978         (_bfd_sparc_elf_relocate_section): Don't generate dynamic
979         relocations against resolved undefined weak symbols in PIE
980         (_bfd_sparc_elf_finish_dynamic_symbol): Keep PLT/GOT entries
981         without ynamic PLT/GOT relocations for resolved undefined weak
982         symbols.
983         Don't generate dynamic relocation against resolved undefined
984         weak symbol in executable.
985         (pie_finish_undefweak_symbol): New function.
986         (_bfd_sparc_elf_finish_dynamic_sections): Call
987         pie_finish_undefweak_symbol on all symbols in PIE.
988         * elfxx-sparc.h (_bfd_sparc_elf_link_hash_table): Add interp.
989         (_bfd_sparc_elf_fixup_symbol): New function.
990
991 2017-04-10  Nick Clifton  <nickc@redhat.com>
992
993         * config.bfd: Remove ns32k from obsolete list.
994
995 2017-04-10  Alan Modra  <amodra@gmail.com>
996
997         PR 21287
998         * elf.c (special_sections_f): Match .fini_array and .fini_array.*.
999         (special_sections_i): Likewise for .init_array.
1000         (special_sections_p): Likewise for .preinit_array.
1001
1002 2017-04-07  H.J. Lu  <hongjiu.lu@intel.com>
1003
1004         PR ld/19579
1005         PR ld/21306
1006         * elf32-s390.c (elf_s390_finish_dynamic_symbol): Check
1007         ELF_COMMON_DEF_P for common symbols.
1008         * elf64-s390.c (elf_s390_finish_dynamic_symbol): Likewise.
1009         * elf64-x86-64.c (elf_x86_64_relocate_section): Likewise.
1010         * elflink.c (_bfd_elf_merge_symbol): Revert commits
1011         202ac193bbbecc96a4978d1ac3d17148253f9b01 and
1012         07492f668d2173da7a2bda3707ff0985e0f460b6.
1013
1014 2017-04-07  Pedro Alves  <palves@redhat.com>
1015
1016         * opncls.c (bfd_get_debug_link_info): Rename to...
1017         (bfd_get_debug_link_info_1): ... this.  Change type of second
1018         parameter to void pointer.  Adjust.
1019         (bfd_get_debug_link_info): Reimplement on top of
1020         bfd_get_debug_link_info_1.
1021         (separate_debug_file_exists, separate_alt_debug_file_exists):
1022         Change type of second parameter to void pointer.  Adjust.
1023         (get_func_type, check_func_type): Change type of second parameter
1024         to void pointer.
1025         (find_separate_debug_file): Add 'func_data' parameter.  Pass it to
1026         the callback functions instead of passing the address of a local.
1027         (bfd_follow_gnu_debuglink): Pass address of unsigned long local to
1028         find_separate_debug_file.
1029         (get_alt_debug_link_info_shim): Change type of second parameter to
1030         void pointer.  Adjust.
1031         (bfd_follow_gnu_debugaltlink): Adjust to pass NULL to
1032         find_separate_debug_file.
1033         (get_build_id_name, bfd_boolean check_build_id_file): Change type
1034         of second parameter to void pointer.  Adjust.
1035         (bfd_follow_build_id_debuglink): Pass address of bfd_build_id
1036         pointer local to find_separate_debug_file.
1037
1038 2017-04-07  Tristan Gingold  <gingold@gingold-Precision-7510>
1039
1040         * coffgen.c (_bfd_coff_gc_mark_hook): Handle PE weak
1041         external symbols with a definition.
1042         (_bfd_coff_gc_mark_extra_sections): Fix typo.
1043
1044 2017-04-07  Alan Modra  <amodra@gmail.com>
1045
1046         * po/SRC-POTFILES.in: Regenerate.
1047
1048 2017-04-05  Alan Modra  <amodra@gmail.com>
1049
1050         * elf64-ppc.c (ppc64_elf_gc_sweep_hook): Support ELFv2 PLT
1051         reference counting.
1052
1053 2017-04-02  Jon Turney  <jon.turney@dronecode.org.uk>
1054
1055         (_bfd_XXi_swap_aouthdr_out): For clarity, use defines rather than
1056         numbers for DataDirectory entry indicies passed to
1057         add_data_entry().
1058
1059 2017-04-04  H.J. Lu  <hongjiu.lu@intel.com>
1060
1061         * elf.c (get_program_header_size): Add a GNU_MBIND segment for
1062         each GNU_MBIND section and align GNU_MBIND section to page size.
1063         (_bfd_elf_map_sections_to_segments): Create a GNU_MBIND
1064         segment for each GNU_MBIND section.
1065         (_bfd_elf_init_private_section_data): Copy sh_info from input
1066         for GNU_MBIND section.
1067
1068 2017-04-03  Palmer Dabbelt  <palmer@dabbelt.com>
1069
1070         * elfnn-riscv.c (GP_NAME): Delete.
1071         (riscv_global_pointer_value): Change GP_NAME to RISCV_GP_SYMBOL.
1072         (_bfd_riscv_relax_lui): Likewise.
1073
1074 2017-04-04  Nick Clifton  <nickc@redhat.com>
1075
1076         PR binutils/21342
1077         * elflink.c (_bfd_elf_define_linkage_sym): Prevent null pointer
1078         dereference.
1079         (bfd_elf_final_link): Only initialize the extended symbol index
1080         section if there are extended symbol tables to list.
1081
1082 2017-04-03  H.J. Lu  <hongjiu.lu@intel.com>
1083
1084         * Makefile.am (BFD32_BACKENDS): Add elf-properties.lo.
1085         (BFD32_BACKENDS_CFILES): Add elf-properties.c.
1086         * configure.ac (elf): Add elf-properties.lo.
1087         * Makefile.in: Regenerated.
1088         * configure: Likewise.
1089         * elf-bfd.h (elf_property_kind): New.
1090         (elf_property): Likewise.
1091         (elf_property_list): Likewise.
1092         (elf_properties): Likewise.
1093         (_bfd_elf_parse_gnu_properties): Likewise.
1094         (_bfd_elf_get_property): Likewise.
1095         (_bfd_elf_link_setup_gnu_properties): Likewise.
1096         (elf_backend_data): Add parse_gnu_properties, merge_gnu_properties
1097         and setup_gnu_properties.
1098         (elf_obj_tdata): Add properties.
1099         * elf-properties.c: New file.
1100         * elf32-i386.c (elf_i386_parse_gnu_properties): New.
1101         (elf_i386_merge_gnu_properties): Likewise.
1102         (elf_backend_parse_gnu_properties): Likewise.
1103         (elf_backend_merge_gnu_properties): Likewise.
1104         * elf64-x86-64.c (elf_x86_64_parse_gnu_properties): Likewise.
1105         (elf_x86_64_merge_gnu_properties): Likewise.
1106         (elf_backend_parse_gnu_properties): Likewise.
1107         (elf_backend_merge_gnu_properties): Likewise.
1108         * elfxx-target.h (elf_backend_merge_gnu_properties): Likewise.
1109         (elf_backend_parse_gnu_properties): Likewise.
1110         (elf_backend_setup_gnu_properties): Likewise.
1111         (elfNN_bed): Add elf_backend_parse_gnu_properties,
1112         elf_backend_merge_gnu_properties and
1113         elf_backend_setup_gnu_properties.
1114
1115 2017-03-30  Pip Cet  <pipcet@gmail.com>
1116
1117         * elf32-wasm32.c: Add relocation code, two relocs.
1118         * reloc.c: Add wasm32 relocations.
1119         * libbfd.h: Regenerate.
1120         * bfd-in2.h: Regenerate.
1121         * bfd/po/bfd.pot: Regenerate.
1122
1123 2017-03-29  Nick Clifton  <nickc@redhat.com>
1124
1125         PR binutils/18025
1126         * coff-bfd.h (struct coff_section_data): Add new fields:
1127         saved_bias and bias.
1128         * coffgen.c (coff_find_nearest_line_with_names): Cache the bias
1129         computed for PE binaries.
1130         * dwarf2.c (scan_unit_for_symbols): Only warn once about each
1131         missing abbrev.
1132
1133 2017-03-28  Hans-Peter Nilsson  <hp@axis.com>
1134
1135         PR ld/16044
1136         * elf32-cris.c (elf_cris_adjust_gotplt_to_got): Adjust BFD_ASSERT
1137         to handle a local symbol with a hash-symbol-entry; without PLT.
1138         Add BFD_ASSERT for an incidental case with GOT entry present.
1139         (cris_elf_check_relocs): Increment PLT refcount only if the symbol
1140         isn't forced-or-set local.
1141
1142 2017-03-27  Pip Cet  <pipcet@gmail.com>
1143
1144         * wasm-module.c: New file to support WebAssembly modules.
1145         * wasm-module.h: New file to support WebAssembly modules.
1146         * doc/webassembly.texi: Start documenting wasm-module.c.
1147         * config.bfd: Add wasm_vec.
1148         * targets.c: Likewise.
1149         * configure.ac: Likewise.
1150         * Makefile.am: Add entries for wasm-module.c.
1151         * Makefile.in: Regenerate.
1152         * configure: Regenerate.
1153         * po/SRC-POTFILES.in: Regenerate.
1154
1155 2017-03-27  Pip Cet  <pipcet@gmail.com>
1156
1157         * cpu-wasm32.c: New file to support wasm32 architecture.
1158         * elf32-wasm32.c: New file to support wasm32 architecture.
1159         * Makefile.am: Add wasm32 architecture.
1160         * archures.c: Likewise.
1161         * config.bfd: Likewise.
1162         * configure.ac: Likewise.
1163         * targets.c: Likewise.
1164         * Makefile.in: Regenerate.
1165         * bfd-in2.h: Regenerate.
1166         * configure: Regenerate.
1167         * po/SRC-POTFILES.in: Regenerate.
1168
1169 2017-03-20  Alan Modra  <amodra@gmail.com>
1170
1171         PR 21266
1172         * elf64-ppc.c (compare_symbols): Stabilize sort.
1173
1174 2017-03-18  Alan Modra  <amodra@gmail.com>
1175
1176         * elf64-ppc.c (struct ppc_link_hash_table): Add
1177         local_ifunc_resolver and maybe_local_ifunc_resolver.
1178         (ppc_build_one_stub): Set flags on emitting dynamic
1179         relocation to ifunc.
1180         (ppc64_elf_relocate_section): Likewise.
1181         (ppc64_elf_finish_dynamic_symbol): Likewise.
1182         (ppc64_elf_finish_dynamic_sections): Error on DT_TEXTREL with
1183         local dynamic relocs to ifuncs.
1184         * elf32-ppc.c (struct ppc_elf_link_hash_table): Add
1185         local_ifunc_resolver and maybe_local_ifunc_resolver.
1186         (ppc_elf_relocate_section): Set flag on emitting dynamic
1187         relocation to ifuncs.
1188         (ppc_elf_finish_dynamic_symbol): Likewise.
1189         (ppc_elf_finish_dynamic_sections): Error on DT_TEXTREL with local
1190         dynamic relocs to ifuncs.
1191
1192 2017-03-13  Nick Clifton  <nickc@redhat.com>
1193
1194         PR binutils/21202
1195         * reloc.c (BFD_RELOC_AARCH64_TLSDESC_LD64_LO12_NC): Rename to
1196         BFD_RELOC_AARCH64_TLSDESC_LD64_LO12.
1197         (BFD_RELOC_AARCH64_TLSDESC_ADD_LO12_NC): Rename to
1198         BFD_RELOC_AARCH64_TLSDESC_ADD_LO12.
1199         * bfd-in2.h: Regenerate.
1200         * libbfd.h: Regenerate.
1201         * elfnn-aarch64.c (IS_AARCH64_TLS_RELAX_RELOC): Update reloc
1202         names.
1203         (IS_AARCH64_TLSDESC_RELOC): Likewise.
1204         (elfNN_aarch64_howto_table): Likewise.
1205         (aarch64_tls_transition_without_check): Likewise.
1206         (aarch64_reloc_got_type): Likewise.
1207         (elfNN_aarch64_final_link_relocate): Likewise.
1208         (elfNN_aarch64_tls_relax): Likewise.
1209         (elfNN_aarch64_relocate_section): Likewise.
1210         (elfNN_aarch64_gc_sweep_hook): Likewise.
1211         (elfNN_aarch64_check_relocs): Likewise.
1212         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.
1213         (_bfd_aarch64_elf_resolve_relocation): Likewise.
1214
1215 2017-03-11  Alan Modra  <amodra@gmail.com>
1216
1217         * elf32-ppc.c: Remove ATTRIBUTE_UNUSED throughout when function
1218         parameter is in fact used.  Whitespace fixes.
1219         * elf64-ppc.c: Likewise.
1220
1221 2017-03-09  Sam Thursfield  <sam.thursfield@codethink.co.uk>
1222
1223         * rs6000-core.c (CORE_NEW): Simplify macro when
1224         AIX_CORE_DUMPX_CORE and BFD64 are true to avoid compile warning.
1225
1226 2017-03-07  Alan Modra  <amodra@gmail.com>
1227
1228         PR 21224
1229         PR 20519
1230         * elf64-ppc.c (ppc64_elf_relocate_section): Add missing
1231         dyn_relocs check.
1232
1233 2017-03-05  Alan Modra  <amodra@gmail.com>
1234
1235         * elf-bfd.h (struct eh_cie_fde): Add u.cie.per_encoding_aligned8.
1236         * elf-eh-frame.c (size_of_output_cie_fde): Don't align here.
1237         (next_cie_fde_offset): New function.
1238         (_bfd_elf_parse_eh_frame): Set u.cie.per_encoding_aligned8.
1239         (_bfd_elf_discard_section_eh_frame): Align zero terminator to
1240         four bytes.  Align CIEs to four or eight bytes depending on
1241         per_encoding_aligned8.  Align FDEs according to their encoding.
1242         Pad last FDE to output section alignment.
1243         (_bfd_elf_write_section_eh_frame): Adjust to suit.  Remove
1244         assertion.
1245         * elf64-ppc.c (glink_eh_frame_cie): Delete padding.
1246         (ppc64_elf_size_stubs): Pad glink eh_frame as per elf-eh-frame.c.
1247         (ppc64_elf_finish_dynamic_sections): Adjust to suit.
1248
1249 2017-03-02  Martin Bickel  <binutils@ineranves.de>
1250
1251         PR ld/21212
1252         * elf.c (rewrite_elf_program_header): Do not issue a warning for
1253         empty segments which have a zero filesz, but a non-zero memsz.
1254
1255 2017-03-02  Alan Modra  <amodra@gmail.com>
1256
1257         * elf32-ppc.c (ppc_elf_vle_split16): Correct insn mask typo.
1258
1259 2017-02-28  Alan Modra  <amodra@gmail.com>
1260
1261         * elf64-ppc.c (ppc64_elf_ha_reloc): Revert last change.
1262         (ppc64_elf_relocate_section): Likewise.
1263
1264 2017-02-28  Alan Modra  <amodra@gmail.com>
1265
1266         PR 20995
1267         * elf32-nios2.c (nios2_elf32_relocate_section): Use htab
1268         rather than elf32_nios2_hash_table or elf_hash_table.
1269         (create_got_section): Likewise.
1270         (nios2_elf32_finish_dynamic_symbol): Likewise.
1271         (nios2_elf32_adjust_dynamic_symbol): Likewise.
1272         (nios2_elf32_size_dynamic_sections): Likewise.
1273         (nios2_elf32_check_relocs): Delete dynobj, sgot, and srelgot
1274         vars.  Use htab equivalents directly instead.  Don't create
1275         all dynamic sections on needing just the GOT.  Use a goto
1276         rather than a fall-through with reloc test.  Ensure
1277         htab->dynobj is set when making dynamic sreloc section.
1278         (nios2_elf32_finish_dynamic_sections): Delete dynobj, use htab
1279         equivalent directly instead.  Don't segfault on looking for
1280         .dynamic when dynamic sections have not been created.  Don't
1281         segfault on .got.plt being discarded.
1282         (nios2_elf32_size_dynamic_sections): Delete plt and got vars.
1283         Don't set "relocs" on .rela.plt.  Do handle .sbss.  Delete
1284         fixme and another not so relevant comment.
1285         (nios2_elf_add_symbol_hook): Delete dynobj var.  If not
1286         already set, set hash table dynobj on creating .sbss.
1287
1288 2017-02-28  Alan Modra  <amodra@gmail.com>
1289
1290         * reloc.c (BFD_RELOC_PPC_16DX_HA): New.
1291         * elf64-ppc.c (ppc64_elf_howto_raw <R_PPC64_16DX_HA>): New howto.
1292         (ppc64_elf_reloc_type_lookup): Translate new bfd reloc.
1293         (ppc64_elf_ha_reloc): Correct overflow test on REL16DX_HA.
1294         (ppc64_elf_relocate_section): Likewise.
1295         * elf32-ppc.c (ppc_elf_howto_raw <R_PPC_16DX_HA>): New howto.
1296         (ppc_elf_reloc_type_lookup): Translate new bfd reloc.
1297         (ppc_elf_check_relocs): Handle R_PPC_16DX_HA to pacify gcc.
1298         * libbfd.h: Regenerate.
1299         * bfd-in2.h: Regenerate.
1300
1301 2017-02-28  Alan Modra  <amodra@gmail.com>
1302
1303         * elflink.c (_bfd_elf_create_dynamic_sections): Don't make
1304         dynamic .data.rel.ro read-only.
1305         * elf32-arm.c (elf32_arm_finish_dynamic_symbol): Compare section
1306         rather than section flags when deciding where copy reloc goes.
1307         * elf32-cris.c (elf_cris_finish_dynamic_symbol): Likewise.
1308         * elf32-hppa.c (elf32_hppa_finish_dynamic_symbol): Likewise.
1309         * elf32-i386.c (elf_i386_finish_dynamic_symbol): Likewise.
1310         * elf32-metag.c (elf_metag_finish_dynamic_symbol): Likewise.
1311         * elf32-microblaze.c (microblaze_elf_finish_dynamic_symbol): Likewise.
1312         * elf32-nios2.c (nios2_elf32_finish_dynamic_symbol): Likewise.
1313         * elf32-or1k.c (or1k_elf_finish_dynamic_symbol): Likewise.
1314         * elf32-ppc.c (ppc_elf_finish_dynamic_symbol): Likewise.
1315         * elf32-s390.c (elf_s390_finish_dynamic_symbol): Likewise.
1316         * elf32-tic6x.c (elf32_tic6x_finish_dynamic_symbol): Likewise.
1317         * elf32-tilepro.c (tilepro_elf_finish_dynamic_symbol): Likewise.
1318         * elf64-ppc.c (ppc64_elf_finish_dynamic_symbol): Likewise.
1319         * elf64-s390.c (elf_s390_finish_dynamic_symbol): Likewise.
1320         * elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Likewise.
1321         * elfnn-aarch64.c (elfNN_aarch64_finish_dynamic_symbol): Likewise.
1322         * elfnn-riscv.c (riscv_elf_finish_dynamic_symbol): Likewise.
1323         * elfxx-mips.c (_bfd_mips_vxworks_finish_dynamic_symbol): Likewise.
1324         * elfxx-sparc.c (_bfd_sparc_elf_finish_dynamic_symbol): Likewise.
1325         * elfxx-tilegx.c (tilegx_elf_finish_dynamic_symbol): Likewise.
1326
1327 2017-02-28  Maciej W. Rozycki  <macro@imgtec.com>
1328
1329         * elfxx-mips.c (mips_elf_perform_relocation): Also handle the
1330         `jalr $0, $25' instruction encoding.
1331
1332 2017-02-27  Nick Clifton  <nickc@redhat.com>
1333
1334         PR ld/21180
1335         * elf32-microblaze.c (microblaze_elf_finish_dynamic_symbol): Avoid
1336         generating a seg-fault when encountering a symbol that has been
1337         deleted by garbage collection.
1338
1339 2017-02-25  Alan Modra  <amodra@gmail.com>
1340
1341         * elf32-arc.c (struct dynamic_sections): Delete.
1342         (enum dyn_section_types): Delete.
1343         (dyn_section_names): Delete.
1344         (arc_create_dynamic_sections): Delete.
1345         (elf_arc_finish_dynamic_sections): Don't call the above.  Don't
1346         segfault on discarded .rela.plt section.
1347         (elf_arc_size_dynamic_sections): Formatting.  Don't call
1348         arc_create_dynamic_sections.  Don't allocate memory for sections
1349         handled by the generic linker.  Correct code finding relocs in
1350         read-only sections.  Set SEC_EXCLUDE on zero size .got,
1351         .got.plt, and .dynbss sections.  Do set .interp for pies.
1352
1353 2017-02-24  Andrew Waterman  <andrew@sifive.com>
1354
1355         * elfnn-riscv.c (GP_NAME): New macro.
1356         (riscv_global_pointer_value): Use it.
1357         (_bfd_riscv_relax_lui): If symbol and global pointer are in same
1358         output section, consider only that section's alignment.
1359
1360 2017-02-23  Maciej W. Rozycki  <macro@imgtec.com>
1361
1362         * elfxx-mips.h (_bfd_mips_relax_section): Remove prototype.
1363         * elfxx-mips.c (_bfd_mips_relax_section): Remove function.
1364         * elf64-mips.c (bfd_elf64_bfd_relax_section): Remove macro.
1365         * elfn32-mips.c (bfd_elf32_bfd_relax_section): Likewise.
1366
1367 2017-02-23  Maciej W. Rozycki  <macro@imgtec.com>
1368
1369         * elfxx-mips.c (mips_elf_calculate_relocation) <R_MIPS_JALR>
1370         <R_MICROMIPS_JALR>: Discard relocation if `cross_mode_jump_p'
1371         or misaligned.
1372
1373 2017-02-23  Alan Modra  <amodra@gmail.com>
1374
1375         PR 20744
1376         * elf32-ppc.c (ppc_elf_howto_raw): Correct dst_mask on all VLE
1377         16D relocations.
1378         (ppc_elf_vle_split16): Correct field mask and shift for 16D relocs.
1379         (ppc_elf_relocate_section): Correct calculation for VLE SDAREL
1380         relocs.
1381
1382 2017-02-22  Maciej W. Rozycki  <macro@imgtec.com>
1383
1384         PR ld/20828
1385         * elflink.c (bfd_elf_size_dynamic_sections): Move symbol version
1386         processing ahead of the call to `elf_gc_sweep_symbol'.
1387
1388 2017-02-22  Nick Clifton  <nickc@redhat.com>
1389
1390         PR binutils/21193
1391         * opncls.c (bfd_create_gnu_debuglink_section): Give the newly
1392         created section 4-byte alignment.
1393
1394 2017-02-22  Alan Modra  <amodra@gmail.com>
1395
1396         * elf64-ppc.c (ppc64_elf_finish_dynamic_sections): Don't segfault
1397         on .got or .plt output section being discarded by script.
1398         * elf32-ppc.c (ppc_elf_finish_dynamic_sections): Likewise.  Move
1399         vxworks splt temp.
1400
1401 2017-02-21  Alan Modra  <amodra@gmail.com>
1402
1403         * elf64-alpha.c (elf64_alpha_size_dynamic_sections): Only emit
1404         DT_RELA, DT_RELASZ, and DT_RELAENT when DT_RELASZ is non-zero.
1405
1406 2017-02-20  Alan Modra  <amodra@gmail.com>
1407
1408         PR 21181
1409         * elflink.c (bfd_elf_final_link): Make DT_REL/DT_RELA zero
1410         if DT_RELSZ/DT_RELASZ is zero.
1411
1412 2017-02-17  Nick Clifton  <nickc@redhat.com>
1413
1414         * compress.c (bfd_get_full_section_contents): Remember to reduce
1415         compressed size by the sizeof the compression header when
1416         decompressing the contents.
1417
1418 2017-02-17  Pedro Alves  <palves@redhat.com>
1419
1420         * srec.c (Chunk): Rename to ...
1421         (_bfd_srec_len): ... this.
1422         (S3Forced): Rename to ...
1423         (_bfd_srec_forceS3): ... this.
1424         * objcopy.c: Adjust all references.
1425
1426 2017-02-17  Pedro Alves  <palves@redhat.com>
1427
1428         * archive.c (bsd_write_armap): Rename to ...
1429         (_bfd_bsd_write_armap): ... this.
1430         (coff_write_armap): Rename to ...
1431         (_bfd_coff_write_armap): ... this.
1432         * libbfd-in.h (bsd_write_armap): Rename to ...
1433         (_bfd_bsd_write_armap): ... this.
1434         (coff_write_armap): Rename to ...
1435         (_bfd_coff_write_armap): ... this.
1436         * aout-target.h, aout-tic30.c: Adjust all users.
1437         * libbfd.h: Regenerate.
1438
1439 2017-02-17  Pedro Alves  <palves@redhat.com>
1440
1441         * bfd-in.h (bfd_read, bfd_write): Adjust to rename.
1442         (warn_deprecated): Rename to ...
1443         (_bfd_warn_deprecated): ... this.
1444         * libbfd.c (warn_deprecated): Rename to ...
1445         (_bfd_warn_deprecated): ... this.
1446         * bfd-in2.h: Regenerate.
1447
1448 2017-02-17  Pedro Alves  <palves@redhat.com>
1449
1450         * bfdio.c (real_ftell): Rename to ...
1451         (_bfd_real_ftell): ... this.
1452         (real_fseek): Rename to ...
1453         (_bfd_real_fseek): ... this.
1454         (real_fopen): Rename to ...
1455         (_bfd_real_fopen): ... this.
1456         * libbfd-in.h (real_ftell): Rename to ...
1457         (_bfd_real_ftell): ... this.
1458         (real_fseek): Rename to ...
1459         (_bfd_real_fseek): ... this.
1460         (real_fopen): Rename to ...
1461         (_bfd_real_fopen): ... this.
1462         * cache.c, dwarf2.c, opncls.c: Adjust all callers.
1463         * libbfd.h: Regenerate.
1464
1465 2017-02-17  Pedro Alves  <palves@redhat.com>
1466
1467         * dwarf2.c, elf-attrs.c, elf32-nds32.c: Adjust all callers.
1468         * libbfd.c (read_unsigned_leb128): Rename to ...
1469         (_bfd_read_unsigned_leb128): ... this.
1470         (read_signed_leb128): Rename to ...
1471         (_bfd_read_signed_leb128): ... this.
1472         (safe_read_leb128): Rename to ...
1473         (_bfd_safe_read_leb128): ... this.
1474         * libbfd-in.h (read_unsigned_leb128): Rename to ...
1475         (_bfd_read_unsigned_leb128): ... this.
1476         (read_signed_leb128): Rename to ...
1477         (_bfd_read_signed_leb128): ... this.
1478         (safe_read_leb128): Rename to ...
1479         (_bfd_safe_read_leb128): ... this.
1480         * libbfd.h: Renegerate.
1481
1482 2017-02-16  Andrew Burgess  <andrew.burgess@embecosm.com>
1483
1484         * dwarf2.c (_bfd_dwarf2_find_nearest_line): Perform symbol lookup
1485         before trying to fine matching file and line information.
1486
1487 2017-02-16  Andrew Burgess  <andrew.burgess@embecosm.com>
1488
1489         * dwarf2.c (struct dwarf2_debug): Add orig_bfd member.
1490         (_bfd_dwarf2_slurp_debug_info): If stashed debug information does
1491         not match current bfd, then reload debug information.  Record bfd
1492         we're loading debug info for in the stash.  If we have debug
1493         informatin in the cache then perform section placement before
1494         returning.
1495
1496 2017-02-16  Alan Modra  <amodra@gmail.com>
1497
1498         PR 21000
1499         * elf-bfd.h (struct elf_backend_data): Add no_page_alias.
1500         * elfxx-target.h (elf_backend_no_page_alias): Define.
1501         (elfNN_bed): Init new field.
1502         * elf.c (assign_file_positions_for_load_sections): If no_page_alias
1503         ensure PT_LOAD segment starts on a new page.
1504         * elf32-hppa.c (elf_backend_no_page_alias): Define.
1505
1506 2017-02-16  Alan Modra  <amodra@gmail.com>
1507
1508         PR 21132
1509         * elf32-hppa.c (allocate_plt_static): Allocate space for relocs
1510         if pic.
1511
1512 2017-02-16  Jiong Wang <jiong.wang@arm.com>
1513
1514         * bfd.c (BFD_FLAGS_SAVED): Add BFD_LINKER_CREATED.
1515         * bfd-in2.h: Regenerated.
1516
1517 2017-02-15  H.J. Lu  <hongjiu.lu@intel.com>
1518
1519         PR ld/21168
1520         * elf32-i386.c (elf_i386_relocate_section): Allow
1521         "lea foo@GOT, %reg" in PIC.
1522
1523 2017-02-15  H.J. Lu  <hongjiu.lu@intel.com>
1524
1525         PR ld/20244
1526         * elf32-i386.c (elf_i386_relocate_section): Properly get IFUNC
1527         symbol name when reporting R_386_GOT32/R_386_GOT32X relocation
1528         error against local IFUNC symbol without a base register for
1529         PIC.
1530
1531 2017-02-15  Maciej W. Rozycki  <macro@imgtec.com>
1532
1533         * elf32-ppc.c (ppc_elf_check_relocs): Use `%H:' rather than
1534         `%P: %H:' with `info->callbacks->einfo'.
1535         (ppc_elf_relocate_section): Likewise.
1536         * elf64-ppc.c (ppc64_elf_check_relocs): Likewise.
1537         (ppc64_elf_edit_toc): Likewise.
1538         (ppc64_elf_relocate_section): Likewise.
1539
1540 2017-02-14  Alan Modra  <amodra@gmail.com>
1541
1542         * elf64-ppc.c (ppc64_elf_gc_mark_dynamic_ref): Support
1543         --gc-keep-exported, and test versioned field of sym rather than
1544         looking for @ in name.
1545
1546 2017-02-13  Palmer Dabbelt  <palmer@dabbelt.com>
1547
1548         * elfnn-riscv.c (riscv_global_pointer_value): Change _gp to
1549         __global_pointer$.
1550
1551 2017-02-13  Nick Clifton  <nickc@redhat.com>
1552
1553         PR binutils/21151
1554         * dwarf2.c (_bfd_dwarf2_find_nearest_line): Check for an invalid
1555         unit length field.
1556
1557 2017-02-07  Andrew Waterman  <andrew@sifive.com>
1558
1559         * elfnn-riscv.c (riscv_elf_finish_dynamic_sections): Only write PLT
1560         entry size if PLT header is written.
1561
1562 2017-02-06  Sheldon Lobo  <sheldon.lobo@oracle.com>
1563
1564         Fix sparc64 dynamic relocation processing to use the dynamic
1565         symbol count.
1566         * elf64-sparc.c (elf64_sparc_slurp_one_reloc_table): Use 'dynamic'
1567         to determine if bfd_get_symcount() or bfd_get_dynamic_symcount()
1568         should be used.
1569
1570 2017-02-03  Nick Clifton  <nickc@redhat.com>
1571
1572         PR 21096
1573         * coffcode.h (coff_write_object_contents): Enlarge size of
1574         s_name_buf in order to avoid compile time warning about possible
1575         integer truncation.
1576         * elf32-nds32.c (nds32_elf_ex9_import_table): Mask off lower
1577         32-bits of insn value before printing into buffer.
1578
1579 2017-02-02  Maciej W. Rozycki  <macro@imgtec.com>
1580
1581         * elfxx-mips.c (mips_elf_hash_sort_data): Add
1582         `max_local_dynindx'.
1583         (mips_elf_sort_hash_table): Handle it.
1584         (mips_elf_sort_hash_table_f) <GGA_NONE>: For forced local
1585         symbols bump up `max_local_dynindx' rather than
1586         `max_non_got_dynindx'.
1587
1588 2017-02-02  Maciej W. Rozycki  <macro@imgtec.com>
1589
1590         * elfxx-mips.c (mips_elf_hash_sort_data): Convert the
1591         `min_got_dynindx', `max_unref_got_dynindx' and
1592         `max_non_got_dynindx' members to the `bfd_size_type' data type.
1593         (mips_elf_sort_hash_table): Adjust accordingly.
1594
1595 2017-02-02  Maciej W. Rozycki  <macro@imgtec.com>
1596
1597         * elfxx-mips.c (mips_elf_sort_hash_table): Use `htab' throughout
1598         to access the hash table.
1599
1600 2017-02-02  Maciej W. Rozycki  <macro@imgtec.com>
1601
1602         * elfxx-mips.c (mips_elf_sort_hash_table): Move assertion on
1603         non-NULL `htab' to the beginning.
1604
1605 2017-02-02  Maciej W. Rozycki  <macro@imgtec.com>
1606
1607         * elflink.c (elf_gc_sweep): Wrap overlong line.
1608
1609 2017-01-30  Maciej W. Rozycki  <macro@imgtec.com>
1610
1611         * elfxx-mips.h (_bfd_mips_elf_insn32): Rename prototype to...
1612         (_bfd_mips_elf_linker_flags): ... this.  Add another parameter.
1613         * elfxx-mips.c (mips_elf_link_hash_table): Add
1614         `ignore_branch_isa' member.
1615         (mips_elf_perform_relocation): Do not treat an ISA mode mismatch
1616         in branch relocation calculation as an error if
1617         `ignore_branch_isa' has been set.
1618         (_bfd_mips_elf_insn32): Rename to...
1619         (_bfd_mips_elf_linker_flags): ... this.  Rename the `on'
1620         parameter to `insn32' and add an `ignore_branch_isa' parameter.
1621         Handle the new parameter.
1622
1623 2017-01-27  Hans-Peter Nilsson  <hp@axis.com>
1624
1625         * elf32-cris.c (elf_cris_finish_dynamic_symbol): Remove now unused
1626         local variable dynobj.
1627
1628         PR ld/20995
1629         * elf32-cris.c (elf_cris_size_dynamic_sections): Handle sdynrelro.
1630         (elf_cris_adjust_dynamic_symbol): Place variables copied into the
1631         executable from read-only sections into sdynrelro.
1632         (elf_cris_finish_dynamic_symbol): Select sreldynrelro for
1633         dynamic relocs in sdynrelro.
1634         (elf_backend_want_dynrelro): Define.
1635
1636 2017-01-25  Sebastian Huber  <sebastian.huber@embedded-brains.de>
1637
1638         * config.bfd (*-*-rtemsaout*): Mark as removed.
1639
1640 2017-01-25  Sebastian Huber  <sebastian.huber@embedded-brains.de>
1641
1642         * config.bfd (powerpcle-*-rtems*): Do not mark as removed.
1643         (arm-*-rtems*): Move to (arm*-*-eabi*).
1644         (i[3-7]86-*-rtems*): Move to (i[3-7]86-*-elf*).
1645         (m68-*-rtems*): Move to (m68*-*-elf*).
1646
1647 2017-01-25  Sebastian Huber  <sebastian.huber@embedded-brains.de>
1648
1649         * config.bfd (*-*-rtemscoff*): Mark as removed.
1650
1651 2017-01-24  Maciej W. Rozycki  <macro@imgtec.com>
1652
1653         PR ld/20828
1654         * elflink.c (bfd_elf_record_link_assignment): Revert last
1655         change and don't ever clear `forced_local'.  Set `mark'
1656         unconditionally.
1657         (elf_gc_sweep_symbol_info, elf_gc_sweep_symbol): Reorder within
1658         file.
1659         (elf_gc_sweep): Move the call to `elf_gc_sweep_symbol'...
1660         (bfd_elf_size_dynamic_sections): ... here.
1661         * elf32-ppc.c (ppc_elf_tls_setup): Don't clear `forced_local'
1662         and set `mark' instead in `__tls_get_addr_opt' processing.
1663         * elf64-ppc.c (ppc64_elf_tls_setup): Likewise.
1664
1665 2017-01-24  Alan Modra  <amodra@gmail.com>
1666
1667         * elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Merge two cases
1668         where dynamic relocs are preferable.  Allow ifunc too.
1669         (ensure_undefweak_dynamic): New function.
1670         (allocate_dynrelocs): Use it here.  Move plt handling last and
1671         don't make symbols dynamic, simplifying loop.  Only make undef
1672         weak symbols with GOT entries dynamic.  Correct condition
1673         for GOT relocs.  Handle dynamic relocs on ifuncs.  Correct
1674         comments.  Remove goto.
1675         (ppc_elf_relocate_section): Correct test for using dynamic
1676         symbol on GOT relocs.  Rearrange test for emitting GOT relocs
1677         to suit.  Set up explicit tls_index entries and implicit GOT
1678         tls_index entries resolvable at link time for
1679         __tls_get_addr_opt.  Simplify test to clear mem for prelink.
1680         * elf64-ppc.c (allocate_got): Correct condition for GOT relocs.
1681         (ensure_undefweak_dynamic): New function.
1682         (allocate_dynrelocs): Use it here.  Only make undef weak symbols
1683         with GOT entries dynamic.  Remove unnecessary test of
1684         WILL_CALL_FINISH_DYNAMIC_SYMBOL in PLT handling.
1685         (ppc64_elf_relocate_section): Correct test for using dynamic
1686         symbol on GOT relocs.  Rearrange test for emitting GOT relocs
1687         to suit.  Set up explicit tls_index entries and implicit GOT
1688         tls_index entries resolvable at link time for __tls_get_addr_opt.
1689         Simplify expression to clear mem for prelink.
1690
1691 2017-01-23  Yury Norov  <ynorov@caviumnetworks.com>
1692
1693         * elfnn-aarch64.c: Fix relaxations for ILP32 mode.
1694
1695 2017-01-20  Jiong Wang <jiong.wang@arm.com>
1696
1697         * elfnn-aarch64.c (elf_aarch64_hash_symbol): New function.
1698         (elf_backend_hash_symbol): Define.
1699
1700 2017-01-18  Maciej W. Rozycki  <macro@imgtec.com>
1701
1702         PR ld/20828
1703         * elflink.c (bfd_elf_record_link_assignment): Clear any
1704         `forced_local' marking for DSO symbols that are not being
1705         provided.
1706
1707 2017-01-17  Kuan-Lin Chen  <kuanlinchentw@gmail.com>
1708
1709         * elfnn-riscv.c (riscv_elf_object_p): New function.
1710
1711 2017-01-12  H.J. Lu  <hongjiu.lu@intel.com>
1712
1713         PR ld/21038
1714         * elf64-x86-64.c (elf_x86_64_link_hash_table): Add
1715         plt_bnd_eh_frame.
1716         (elf_x86_64_check_relocs): Create .eh_frame section for the
1717         .plt.bnd section.
1718         (elf_x86_64_size_dynamic_sections): Allocate and initialize
1719         .eh_frame section for the .plt.bnd section.
1720         (elf_x86_64_finish_dynamic_sections): Adjust .eh_frame section
1721         for the .plt.bnd section.
1722
1723 2017-01-12  Nick Clifton  <nickc@redhat.com>
1724
1725         PR binutils/20876
1726         * opncls.c (find_separate_debug_file): Add include_dirs
1727         parameter.  Only include the directory part of the bfd's filename
1728         in search paths if include_dirs is true.  Add a couple of extra
1729         locations for looking for debug files.
1730         ( bfd_follow_gnu_debuglink): Update invocation of
1731         find_separate_debug_file.
1732         (bfd_follow_gnu_debugaltlink): Likewise.
1733         (get_build_id): New function: Finds the build-id of the given bfd.
1734         (get_build_id_name): New function: Computes the name of the
1735         separate debug info file for a bfd, based upon its build-id.
1736         (check_build_id_file): New function: Checks to see if a separate
1737         debug info file exists at the given location, and that its
1738         build-id matches that of the original bfd.
1739         (bfd_follow_build_id_debuglink): New function: Finds a separate
1740         debug info file for a given bfd by using the build-id method.
1741         * dwarf2.c (_bfd_dwarf2_slurp_debug_info): Try using the build-id
1742         method of locating a separate debug info file before using the
1743         debuglink method.
1744         * bfd-in2.h: Regenerate.
1745
1746 2017-01-11  H.J. Lu  <hongjiu.lu@intel.com>
1747
1748         PR ld/21038
1749         * elf64-x86-64.c (elf_x86_64_eh_frame_bnd_plt): New.
1750         (elf_x86_64_bnd_arch_bed): Use elf_x86_64_eh_frame_bnd_plt and
1751         elf_x86_64_eh_frame_plt_got.
1752         (elf_x86_64_size_dynamic_sections): Get unwind info from
1753         elf_x86_64_bnd_arch_bed for the BND PLT.
1754
1755 2017-01-11  Jeremy Soller  <jackpot51@gmail.com>
1756
1757         * config.bfd: Add entries for i686-redox and x86_64-redox.
1758
1759 2017-01-10  H.J. Lu  <hongjiu.lu@intel.com>
1760
1761         * elf32-i386.c (elf_i386_check_relocs): Align .eh_frame section
1762         to 4 bytes.
1763         * elf64-x86-64.c (elf_x86_64_create_dynamic_sections): Align
1764         .eh_frame section to 4 bytes for x32.
1765         (elf_x86_64_check_relocs): Likewise.
1766
1767 2017-01-10  H.J. Lu  <hongjiu.lu@intel.com>
1768
1769         PR ld/20830
1770         * elf32-i386.c (elf_i386_eh_frame_plt_got): New.
1771         (PLT_GOT_FDE_LENGTH): Likewise.
1772         (elf_i386_plt_layout): Add eh_frame_plt_got and
1773         eh_frame_plt_got_size.
1774         (elf_i386_plt): Updated.
1775         (elf_i386_link_hash_table): Add plt_got_eh_frame.
1776         (elf_i386_check_relocs): Create .eh_frame section for .plt.got.
1777         (elf_i386_size_dynamic_sections): Allocate and initialize
1778         .eh_frame section for .plt.got.
1779         (elf_i386_finish_dynamic_sections): Adjust .eh_frame section for
1780         .plt.got.
1781         (elf_i386_nacl_plt): Add FIXME for eh_frame_plt_got and
1782         eh_frame_plt_got_size.
1783         * elf64-x86-64.c (elf_x86_64_eh_frame_plt_got): New.
1784         (PLT_GOT_FDE_LENGTH): Likewise.
1785         (elf_x86_64_backend_data): Add eh_frame_plt_got and
1786         eh_frame_plt_got_size.
1787         (elf_x86_64_arch_bed): Updated.
1788         (elf_x86_64_bnd_arch_bed): Add FIXME for eh_frame_plt_got and
1789         eh_frame_plt_got_size.
1790         (elf_x86_64_nacl_arch_bed): Likewise.
1791         (elf_x86_64_link_hash_table): Add plt_got_eh_frame.
1792         (elf_x86_64_check_relocs): Create .eh_frame section for .plt.got.
1793         (elf_x86_64_size_dynamic_sections): Allocate and initialize
1794         .eh_frame section for .plt.got.
1795         (elf_x86_64_finish_dynamic_sections): Adjust .eh_frame section
1796         for .plt.got.
1797
1798 2017-01-10  H.J. Lu  <hongjiu.lu@intel.com>
1799
1800         * elf32-i386.c (elf_i386_size_dynamic_sections): Set
1801         plt_eh_frame->size to eh_frame_plt_size and use eh_frame_plt.
1802
1803 2017-01-09  Nick Clifton  <nickc@redhat.com>
1804
1805         * dwarf2.c (lookup_address_in_function_table): Return early if
1806         there are no functions in the given comp unit, or if the high
1807         address of the last function in the comp unit is less than the
1808         desired address.
1809
1810 2017-01-09  Nick Clifton  <nickc@redhat.com>
1811
1812         PR binutils/21013
1813         * coffgen.c (_bfd_coff_get_external_symbols): Generate an error
1814         message if there are too many symbols to load.
1815
1816 2017-01-04  James Clarke  <jrtc27@jrtc27.com>
1817
1818         * elf64-alpha.c (elf64_alpha_relax_opt_call): Don't set tsec_free
1819         if relocs are cached.
1820
1821 2017-01-03  Rich Felker  <bugdal@aerifal.cx>
1822
1823         PR ld/21017
1824         * elf32-microblaze.c (microblaze_elf_check_relocs): Add an entry
1825         for R_MICROBLAZE_GOTOFF_64.
1826
1827 2017-01-03  Nick Clifton  <nickc@redhat.com>
1828
1829         * mach-o.c (bfd_mach_o_lookup_uuid_command): Fix compile time
1830         warning about using a possibly uninitialised variable.
1831
1832 2017-01-02  Alan Modra  <amodra@gmail.com>
1833
1834         * elf32-hppa.c (ensure_undef_weak_dynamic): New function.
1835         (allocate_plt_static, allocate_dynrelocs): Use it.
1836
1837 2017-01-02  Alan Modra  <amodra@gmail.com>
1838
1839         * elf-hppa.h (elf_hppa_fake_sections): Set SHF_INFO_LINK for
1840         .PARISC.unwind section.
1841
1842 2017-01-02  Alan Modra  <amodra@gmail.com>
1843
1844         PR ld/20989
1845         * elfxx-sparc.c (gdop_relative_offset_ok): New function.
1846         (_bfd_sparc_elf_relocate_section): Use it to validate GOT
1847         indirect to GOT pointer relative code edit.
1848
1849 2017-01-02  Alan Modra  <amodra@gmail.com>
1850
1851         Update year range in copyright notice of all files.
1852
1853 For older changes see ChangeLog-2016
1854 \f
1855 Copyright (C) 2017 Free Software Foundation, Inc.
1856
1857 Copying and distribution of this file, with or without modification,
1858 are permitted in any medium without royalty provided the copyright
1859 notice and this notice are preserved.
1860
1861 Local Variables:
1862 mode: change-log
1863 left-margin: 8
1864 fill-column: 74
1865 version-control: never
1866 End: