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