Remove an abort in the bfd library and add a check for an integer overflow when mappi...
[external/binutils.git] / bfd / ChangeLog
1 2018-11-30  Nick Clifton  <nickc@redhat.com>
2
3         PR 23932
4         * elf.c (IS_CONTAINED_BY_LMA): Add a check for a negative section
5         size.
6         (rewrite_elf_program_header): If no sections are mapped into a
7         segment return an error.
8
9 2018-11-30  Alan Modra  <amodra@gmail.com>
10
11         PR 23937
12         * elf64-ppc.c (write_plt_relocs_for_local_syms): Don't add local
13         entry offset for ifuncs.
14
15 2018-11-29  H.J. Lu  <hongjiu.lu@intel.com>
16
17         PR ld/23929
18         * elf-properties.c (_bfd_elf_link_setup_gnu_properties): Don't
19         merge .note.gnu.property section in IR inputs.
20
21 2018-11-27  Thomas Preud'homme  <thomas.preudhomme@linaro.org>
22
23         * cpu-arm.c (processors): Add processors known to GAS but missing here
24         and reindent.
25         (bfd_arm_update_notes): Add comment explaining why the list of
26         architectures in the switch should not be updated.
27         (architectures): Likewise.
28
29 2018-11-27  Maciej W. Rozycki  <macro@linux-mips.org>
30
31         * elfxx-mips.c (_bfd_mips_elf_check_relocs) <R_MIPS16_HI16>
32         <R_MIPS_HI16, R_MIPS_HIGHER, R_MIPS_HIGHEST, R_MICROMIPS_HI16>
33         <R_MICROMIPS_HIGHER, R_MICROMIPS_HIGHEST>: Also accept an
34         absolute symbol in PIC code.
35
36 2018-11-27  Maciej W. Rozycki  <macro@linux-mips.org>
37
38         * elfxx-mips.c (_bfd_mips_elf_check_relocs) <R_MIPS16_26>
39         <R_MIPS_26, R_MICROMIPS_26_S1>: Use `info->callbacks->einfo'
40         rather than `_bfd_error_handler' to report refused relocations
41         in PIC code and continue processing.  Fix error message: `can
42         not' -> `cannot'.
43
44 2018-11-27  H.J. Lu  <hongjiu.lu@intel.com>
45
46         PR binutils/23919
47         * compress.c (bfd_is_section_compressed_with_header): Initialize
48         *uncompressed_align_pow_p to 0.
49
50 2018-11-27  Tamar Christina  <tamar.christina@arm.com>
51
52         PR ld/23904
53         * elfnn-aarch64.c (_bfd_aarch64_adrp_p): Use existing constants.
54         (_bfd_aarch64_erratum_843419_branch_to_stub): Use _bfd_aarch64_adrp_p.
55         (struct erratum_835769_branch_to_stub_clear_data): New.
56         (_bfd_aarch64_erratum_843419_clear_stub): New.
57         (clear_erratum_843419_entry): New.
58         (elfNN_aarch64_tls_relax): Use it.
59         (elfNN_aarch64_relocate_section): Pass input_section.
60         (aarch64_map_one_stub): Handle branch type none as valid.
61
62 2018-11-27  Mark Wielaard  <mark@klomp.org>
63
64         PR binutils/23919
65         * bfd.c (bfd_update_compression_header): Explicitly set alignment.
66         (bfd_check_compression_header): Add uncompressed_alignment_power
67         argument. Check ch_addralign is a power of 2.
68         * bfd-in2.h: Regenerated.
69         * compress.c (bfd_compress_section_contents): Get and set
70         orig_uncompressed_alignment_pow if section is decompressed.
71         (bfd_is_section_compressed_with_header): Add and get
72         uncompressed_align_pow_p argument.
73         (bfd_is_section_compressed): Add uncompressed_align_power argument
74         to bfd_is_section_compressed_with_header call.
75         (bfd_init_section_decompress_status): Get and set
76         uncompressed_alignment_power.
77         * elf.c (_bfd_elf_make_section_from_shdr): Add
78         uncompressed_align_power argument to
79         bfd_is_section_compressed_with_header call.
80
81 2018-11-21  Jozef Lawrynowicz  <jozef.l@mittosystems.com>
82
83         * elf32-msp430.c (elf32_msp430_merge_mspabi_attributes): Do not
84         error when .MSP430.attributes section is missing from objects
85         created by LTO.
86
87 2018-11-13  Jim Wilson  <jimw@sifive.com>
88
89         * elfnn-riscv.c (riscv_float_abi_string): New.
90         (_bfd_riscv_elf_merge_private_bfd_data): Use it for error message.
91
92 2018-11-09  Bernhard M. Wiedemann  <bwiedemann@suse.de>
93
94         * peXXigen.c (_bfd_XXi_only_swap_filehdr_out): Correct comment
95         concerning timestamp insertion.
96
97 2018-11-09  Cupertino Miranda  <cmiranda@synopsys.com>
98
99         * arc-got.h (arc_got_entry_type_for_reloc): Changed to
100         correct static TLS relocs.
101         * elf32-arc.c (elf_arc_check_relocs): Introduced warning to
102         TLS relocs which require -fPIC.
103         (arc_create_forced_local_got_entries_for_tls): Created.
104         Traverses list of GOT entries to be resolved statically
105         when needed.
106         (elf_arc_finish_dynamic_sections): Changed. Calls
107         arc_create_forced_local_got_entries_for_tls for each known
108         possibly GOT symbol.
109
110 2018-11-09  rhn  <sowaac.rhn@porcupinefactory.org>
111
112         PR 23699
113         * ihex.c (ihex_write_object_contents): Check for sign extended
114         addresses that cannot be supported in the ihex format.
115
116 2018-11-09  Claudiu Zissulescu  <claziss@synopsys.com>
117
118         * arc-got.h (arc_get_local_got_ents): Revamp it; use
119         elf_local_got_ents to store the local got list.
120         (get_got_entry_list_for_symbo): Restructure it.
121         * elf32-arc.c (elf_arc_relocate_section): Correct the call to
122         get_got_entry_list_for_symbol.
123
124 2018-11-07  Nick Clifton  <nickc@redhat.com>
125
126         * po/fr.po: Updated French translation.
127         * po/pt.po: Updated Portuguese translation.
128
129 2018-11-06  Roman Bolshakov <r.bolshakov@yadro.com>
130             Saagar Jha  <saagar@saagarjha.com>
131
132         * mach-o.h: Add new enums for BFD_MACH_O_PLATFORM_MACOS,
133         BFD_MACH_O_PLATFORM_IOS, BFD_MACH_O_PLATFORM_TVOS,
134         BFD_MACH_O_PLATFORM_WATCHOS, BFD_MACH_O_PLATFORM_BRIDGEOS,
135         BFD_MACH_O_TOOL_CLANG, BFD_MACH_O_TOOL_SWIFT, BFD_MACH_O_TOOL_LD.
136         (struct bfd_mach_o_note_command): New.
137         (struct bfd_mach_o_build_version_tool): New.
138         (struct bfd_mach_o_build_version_command): New.
139         (bfd_mach_o_read_version_min): Don't split version into
140         a few fields. Rename reserved to sdk.
141         * mach-o.c (bfd_mach_o_read_version_min): Don't split version into a
142         few fields. Rename reserved to sdk.
143         (bfd_mach_o_read_command): Handle LC_VERSION_MIN_TVOS, LC_NOTE,
144         LC_BUILD_VERSION.
145         (bfd_mach_o_read_note): New.
146         (bfd_mach_o_read_build_version): New.
147
148 2018-11-07  Yoshinori Sato  <ysato@users.sourceforge.jp>
149
150         * config.bfd: Add rx-*-linux.
151         * congigure.ac: Likewise.
152         * elf32-rx.c (rx_linux_object_p): New function.
153         (TARGET_LITTLE_SYM, TARGET_LITTLE_NAME)
154         (elf_backend_object_p, elf32_bed): Define rx-*-linux.
155         * targets.c: Add rx_elf32_linux_le_vec.
156         * configure: Regenerate.
157
158 2018-11-06  Romain Margheriti  <lilrom13@gmail.com>
159
160         PR 23742
161         * mach-o.c (bfd_mach_o_read_command): Accept and ignore
162         BFD_MACH_O_LC_LINKER_OPTIONS and BFD_MACH_O_LC_BUILD_VERSION
163         commands.
164
165 2018-11-02  Alan Modra  <amodra@gmail.com>
166
167         PR 23850
168         * elf.c (bfd_section_from_shdr): Treat SHF_ALLOC SHT_REL* sections
169         in an executable or shared library as normal sections.
170
171 2018-10-31  Renlin Li  <renlin.li@arm.com>
172
173         * elfnn-aarch64.c (elfNN_aarch64_check_relocs): Don't create got
174         section for Local Exec TLS model.
175
176 2018-10-24  H.J. Lu  <hongjiu.lu@intel.com>
177
178         PR ld/23818
179         * elflink.c (_bfd_elf_link_assign_sym_version): Hide symbols
180         defined in discarded input sections.
181
182 2018-10-24  Alan Modra  <amodra@gmail.com>
183
184         * elf32-arm.c (elf32_arm_size_stubs): Ignore as-needed libs that
185         were not needed.
186
187 2018-10-23  Alan Modra  <amodra@gmail.com>
188
189         PR 23806
190         * merge.c (_bfd_add_merge_section): Don't attempt to merge
191         sections with ridiculously large alignments.
192
193 2018-10-23  Alan Modra  <amodra@gmail.com>
194
195         PR 23805
196         * elflink.c (elf_link_input_bfd): Don't segfault on finding
197         STT_TLS symbols without any TLS sections.  Instead, change the
198         symbol type to STT_NOTYPE.
199
200 2018-10-23  Alan Modra  <amodra@gmail.com>
201
202         PR 23804
203         * merge.c (_bfd_add_merge_section): Don't attempt to merge
204         sections where size is not a multiple of entsize.
205
206 2018-10-20  Alan Modra  <amodra@gmail.com>
207
208         PR 23788
209         * elf.c (section_match): Don't require a size match for SHT_SYMTAB
210         or SHT_STRTAB.
211
212 2018-10-17  Alan Modra  <amodra@gmail.com>
213
214         PR 23653
215         * elflink.c (_bfd_elf_link_create_dynstrtab): Match elf_object_id
216         too when choosing dynobj.
217
218 2018-10-16  Alan Modra  <amodra@gmail.com>
219
220         * peXXigen.c (_bfd_XX_bfd_copy_private_bfd_data_common): Simplify
221         PE_DEBUG_DATA size checks.
222
223 2018-10-16  Alan Modra  <amodra@gmail.com>
224
225         PR 23781
226         * peXXigen.c (_bfd_XX_bfd_copy_private_bfd_data_common): Free data
227         before returning.
228
229 2018-10-16  Alan Modra  <amodra@gmail.com>
230
231         PR 23534
232         * init.c (bfd_init): Return an unsigned int.
233         bfd-in2.h: Regenerate.
234
235 2018-10-15  Alan Modra  <amodra@gmail.com>
236
237         PR 23534
238         * init.c (BFD_INIT_MAGIC): Define.
239         (bfd_init): Return BFD_INIT_MAGIC.
240         bfd-in2.h: Regenerate.
241
242 2018-10-13  Alan Modra  <amodra@gmail.com>
243
244         PR 23770
245         PR 23425
246         * reloc.c (_bfd_clear_contents): Replace "location" param with
247         "buf" and "off".  Bounds check "off".  Return status.
248         * cofflink.c (_bfd_coff_generic_relocate_section): Update
249         _bfd_clear_contents call.
250         * elf-bfd.h (RELOC_AGAINST_DISCARDED_SECTION): Likewise.
251         * elf32-arc.c (elf_arc_relocate_section): Likewise.
252         * elf32-i386.c (elf_i386_relocate_section): Likewise.
253         * elf32-metag.c (metag_final_link_relocate): Likewise.
254         * elf32-nds32.c (nds32_elf_get_relocated_section_contents): Likewise.
255         * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
256         * elf32-visium.c (visium_elf_relocate_section): Likewise.
257         * elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
258         * elf64-x86-64.c *(elf_x86_64_relocate_section): Likewise.
259         * libbfd-in.h (_bfd_clear_contents): Update prototype.
260         * libbfd.h: Regenerate.
261
262 2018-10-09  Egeyar Bagcioglu  <egeyar.bagcioglu@oracle.com>
263
264         * elflink.c (elf_link_output_extsym): Do not place symbols into a
265         discarded .dynsym.
266
267 2018-10-08  H.J. Lu  <hongjiu.lu@intel.com>
268
269         PR ld/23428
270         * elfxx-x86.c (_bfd_x86_elf_link_setup_gnu_properties): Don't
271         add GNU_PROPERTY_X86_FEATURE_2_NEEDED to force program header
272         in non-code PT_LOAD segment.
273
274 2018-10-08  Alan Modra  <amodra@gmail.com>
275
276         * elf-nacl.c (nacl_modify_segment_map): Cope with header PT_LOAD
277         lacking sections.
278         * elf.c (_bfd_elf_map_sections_to_segments): Assume file and
279         program headers are required when info->load_phdrs.  Reorganize
280         code handling program headers.  Generate a mapping without
281         sections just for file and program headers when -z separate-code
282         would indicate they should be on a different page to the first
283         section.
284
285 2018-10-08  Alan Modra  <amodra@gmail.com>
286
287         * elf.c (assign_file_positions_for_load_sections): Set p_vaddr
288         from m->p_vaddr_offset for segments without sections.  Invert
289         sign of p_vaddr_offset.
290         (rewrite_elf_program_header, copy_elf_program_header): Save
291         old segment p_vaddr to p_vaddr_offset.  Invert sign of
292         p_vaddr_offset.
293
294 2018-10-08  Alan Modra  <amodra@gmail.com>
295
296         * elf.c (get_program_header_size): Don't count PT_INTERP if
297         .interp is empty.
298         (_bfd_elf_map_sections_to_segments): Don't create PT_INTERP if
299         .interp is empty.
300
301 2018-10-08  Alan Modra  <amodra@gmail.com>
302
303         * elf32-spu.c (spu_elf_modify_segment_map): Don't insert
304         overlays before segment containing headers.
305
306 2018-10-08  Alan Modra  <amodra@gmail.com>
307
308         * elf.c (make_mapping): Cope with zero size array at end of
309         struct elf_segment_map.
310         (_bfd_elf_map_sections_to_segments): Likewise.
311         (rewrite_elf_program_header, copy_elf_program_header): Likewise.
312         (_bfd_elf_map_sections_to_segments): Rename phdr_index to hdr_index.
313
314 2018-10-05  Alan Modra  <amodra@gmail.com>
315
316         * elf32-spu.c (spu_elf_create_sections): Make .note.spu_name
317         SHT_NOTE.
318
319 2018-10-05  Richard Henderson  <rth@twiddle.net>
320
321         * bfd-in2.h: Regenerated.
322         * elf32-or1k.c: (or1k_elf_howto_table): Fix formatting for
323         R_OR1K_PLT26, Add R_OR1K_PCREL_PG21, R_OR1K_GOT_PG21,
324         R_OR1K_TLS_GD_PG21, R_OR1K_TLS_LDM_PG21, R_OR1K_TLS_IE_PG21,
325         R_OR1K_LO13, R_OR1K_GOT_LO13, R_OR1K_TLS_GD_LO13, R_OR1K_TLS_LDM_LO13,
326         R_OR1K_TLS_IE_LO13, R_OR1K_SLO13, R_OR1K_PLTA26.
327         (or1k_reloc_map): Add BFD_RELOC_OR1K_PCREL_PG21,
328         BFD_RELOC_OR1K_GOT_PG21, BFD_RELOC_OR1K_TLS_GD_PG21,
329         BFD_RELOC_OR1K_TLS_LDM_PG21, BFD_RELOC_OR1K_TLS_IE_PG21,
330         BFD_RELOC_OR1K_LO13, BFD_RELOC_OR1K_GOT_LO13,
331         BFD_RELOC_OR1K_TLS_GD_LO13, BFD_RELOC_OR1K_TLS_GD_LO13,
332         BFD_RELOC_OR1K_TLS_LDM_LO13, BFD_RELOC_OR1K_TLS_IE_LO13,
333         BFD_RELOC_OR1K_SLO13, BFD_RELOC_OR1K_PLTA26.
334         (elf_or1k_link_hash_table): Add field saw_plta.
335         (or1k_final_link_relocate): Add value calculations for new relocations.
336         (or1k_elf_relocate_section): Add section relocations for new
337         relocations.
338         (or1k_write_plt_entry): New function.
339         (or1k_elf_finish_dynamic_sections): Add support for PLTA relocations
340         using new l.adrp instruction.  Cleanup PLT relocation code generation.
341         * libbfd.h: Regenerated.
342         * reloc.c: Add BFD_RELOC_OR1K_PCREL_PG21, BFD_RELOC_OR1K_LO13,
343         BFD_RELOC_OR1K_SLO13, BFD_RELOC_OR1K_GOT_PG21, BFD_RELOC_OR1K_GOT_LO13,
344         BFD_RELOC_OR1K_PLTA26, BFD_RELOC_OR1K_TLS_GD_PG21,
345         BFD_RELOC_OR1K_TLS_GD_LO13, BFD_RELOC_OR1K_TLS_LDM_PG21,
346         BFD_RELOC_OR1K_TLS_LDM_LO13, BFD_RELOC_OR1K_TLS_IE_PG21,
347         BFD_RELOC_OR1K_TLS_IE_LO13.
348
349 2018-10-05  Richard Henderson  <rth@twiddle.net>
350
351         * elf32-or1k.c (or1k_elf_relocate_section): Add error for unknown
352         relocations.  Add error for non zero addend with plt and got
353         relocations.  Add error for got and plt references against dynamic, non
354         local, symbols.  Add error when linking non shared liraries with
355         flag_pic.
356
357 2018-10-05  Richard Henderson  <rth@twiddle.net>
358             Stafford Horne  <shorne@gmail.com>
359
360         * bfd-in2.h: Regenerated.
361         * elf32-or1k.c (N_ONES): New macro.
362         (or1k_elf_howto_table): Fix R_OR1K_PLT26 to complain on overflow.
363         Add definitions for R_OR1K_TLS_TPOFF, R_OR1K_TLS_DTPOFF,
364         R_OR1K_TLS_DTPMOD, R_OR1K_AHI16, R_OR1K_GOTOFF_AHI16,
365         R_OR1K_TLS_IE_AHI16, R_OR1K_TLS_LE_AHI16, R_OR1K_SLO16,
366         R_OR1K_GOTOFF_SLO16, R_OR1K_TLS_LE_SLO16.
367         (or1k_reloc_map): Add entries for BFD_RELOC_HI16_S,
368         BFD_RELOC_LO16_GOTOFF, BFD_RELOC_HI16_GOTOFF, BFD_RELOC_HI16_S_GOTOFF,
369         BFD_RELOC_OR1K_TLS_IE_AHI16, BFD_RELOC_OR1K_TLS_LE_AHI16,
370         BFD_RELOC_OR1K_SLO16, BFD_RELOC_OR1K_GOTOFF_SLO16,
371         BFD_RELOC_OR1K_TLS_LE_SLO16.
372         (or1k_reloc_type_lookup): Change search loop to start ad index 0 and
373         also check results before returning.
374         (or1k_reloc_name_lookup): Simplify loop to use R_OR1K_max as index
375         limit.
376         (or1k_final_link_relocate): New function.
377         (or1k_elf_relocate_section): Add support for new AHI and SLO
378         relocations.  Use or1k_final_link_relocate instead of generic
379         _bfd_final_link_relocate.
380         (or1k_elf_check_relocs): Add support for new AHI and SLO relocations.
381         * reloc.c: Add new enums for BFD_RELOC_OR1K_SLO16,
382         BFD_RELOC_OR1K_GOTOFF_SLO16, BFD_RELOC_OR1K_TLS_IE_AHI16,
383         BFD_RELOC_OR1K_TLS_IE_AHI16, BFD_RELOC_OR1K_TLS_LE_AHI16,
384         BFD_RELOC_OR1K_TLS_LE_SLO16.  Remove unused BFD_RELOC_OR1K_GOTOFF_HI16
385         and BFD_RELOC_OR1K_GOTOFF_LO16.
386         * libbfd.h: Regenerated.
387
388 2018-10-04  Jim Wilson  <jimw@sifive.com>
389
390         * elfnn-riscv.c (riscv_elf_size_dynamic_sections): In dynobj->sections
391         loop, handle htab->sdyntdata section.
392
393 2018-10-04  Jose E. Marchesi  <jose.marchesi@oracle.com>
394
395         * elf64-sparc.c (elf64_sparc_output_arch_syms): Do notcorrect the
396         impact of STT_REGISTER symbols in the dynsym sh_info here...
397         * elfxx-sparc.c (_bfd_sparc_elf_finish_dynamic_sections): ...but
398         do it here.
399
400 2018-10-03  H.J. Lu  <hongjiu.lu@intel.com>
401
402         PR ld/23658
403         * elf.c (get_program_header_size): Put all adjacent SHT_NOTE
404         sections with the same section alignment into a single PT_NOTE
405         segment.  Check SHT_NOTE section type instead of section name.
406         (_bfd_elf_map_sections_to_segments): Likewise.
407
408 2018-10-03  Millan Wolff  <mail@milianw.de>
409
410         PR 23715
411         * dwarf2.c (find_abstract_instance): Allow recursive invocations
412         of find_abstract_instance to override the name variable.
413
414 2018-10-03  Nick Clifton  <nickc@redhat.com>
415
416         * po/pt.po: Updated Portuguese translation.
417
418 2018-10-01  Cupertino Miranda <cmiranda@synopsys.com>
419
420         * arc-got.h (relocate_fix_got_relocs_for_got_info): Changed. Take TLS
421         section alignment in consideration for this relocation. Fixed TCB_SIZE
422         offset size to include section alignment.
423         (get_got_entry_list_for_symbol): Changed.
424         * elf32-arc.c (FINAL_SECTSTART): Added this formula macro.
425         (ARC_TLS_DTPOFF) Updated reloc to use new created macro instead.
426         (arc_special_overflow_checks): Fixed TCB_SIZE offsize to include
427         section alignment.
428         (elf_arc_check_relocs): Changed.
429         (elf_arc_finish_dynamic_symbol) Return FALSE in case arc_htab is NULL.
430         (struct elf_arc_link_hash_entry): Moved and changed.
431         (elf_arc_link_hash_newfunc): Changed.
432         (arc_elf_link_hash_table_create): Removed old initializations.
433         (elf_arc_relocate_section, elf_arc_finish_dynamic_symbol): Changed.
434
435 2018-09-28  H.J. Lu  <hongjiu.lu@intel.com>
436
437         * elf-properties.c (_bfd_elf_link_setup_gnu_properties): Use
438         elfclass instead of bed->s->elfclass.
439
440 2018-09-27  Jim Wilson  <jimw@sifive.com>
441
442         * elfnn-riscv.c (riscv_init_pcgp_relocs): Add explanatory comment.
443         (riscv_free_pcgp_relocs, riscv_record_pcgp_reloc): Likewise.
444         (riscv_find_pcgp_hi_reloc, riscv_reocrd_pcgp_lo_reloc): Likewise.
445         (riscv_find_pcgp_lo_reloc): Likewise.
446         (riscv_delete_pcgp_hi_reloc, riscv_use_pcgp_hi_reloc): Delete.
447         (riscv_delete_pcgp_lo_reloc): Likewise.
448         (_bfd_riscv_relax_pc): Don't call riscv_use_pcgp_hi_reloc. Replace
449         calls to riscv_delete_pcgp_lo_reloc and riscv_delete_pcgp_hi_reloc
450         with TRUE.  Mark abfd arg as ATTRIBUTE_UNUSED.
451
452 2018-09-25  Jim Wilson  <jimw@sifive.com>
453
454         * elfnn-riscv.c (riscv_make_plt_header): New arg output_bfd.  Change
455         return type to bfd_boolean.  If EF_RISCV_RVE call _bfd_error_handler
456         and return FALSE.  Return TRUE at end.
457         (riscv_make_plt_entry): Likewise.
458         (riscv_elf_finish_dynamic_symbol): Update call to riscv_make_plt_entry.
459         (riscv_elf_finish_dynamic_sections): Update call to
460         riscv_make_plt_header.
461
462 2018-09-24  Jim Wilson  <jimw@sifive.com>
463
464         * elfnn-riscv.c (_bfd_riscv_relax_pc) <R_RISCV_PCREL_LO12_I>: New local
465         hi_sec_off which is symbol address with addend subtracted.  Use in
466         riscv_find_pcgp_hi_reloc and riscv_record_pcgp_lo_reloc calls.
467
468         * elfnn-riscv.c (riscv_resolve_pcrel_lo_relocs): Add check for reloc
469         overflow with addend.  Use reloc_dangerous instead of reloc_overflow.
470         Add strings for the two errors handled here.
471         (riscv_elf_relocate_section) In case R_RISCV_PCREL_LO12_I, rewrite
472         comment.  Only give error with addend when used with section symbol.
473         In case bfd_reloc_dangerous, update error string.
474
475 2018-09-24  Jozef Lawrynowicz  <jozef.l@mittosystems.com>
476
477         PR gdb/20948
478         * elf.c (_bfd_elf_write_object_contents): Return from function
479         early if abfd->direction == both_direction.
480
481 2018-09-21  Simon Marchi  <simon.marchi@ericsson.com>
482
483         * configure.ac: Check for fls.
484         * elf32-nds32.c (fls): Only define if !HAVE_FLS.
485         * config.in: Re-generate.
486         * configure: Re-generate.
487
488 2018-09-20  Maciej W. Rozycki  <macro@linux-mips.org>
489
490         * config.bfd <rs6000-*-aix5.[01], rs6000-*-aix[5-9]*>: Remove
491         duplicate `case' selectors.
492
493 2018-09-20  Nelson Chu <nelson.chu1990@gmail.com>
494
495         * elf32-nds32.c (nds32_elf_relax_loadstore):
496         Remove the unused target features.
497         (bfd_elf32_nds32_set_target_option): Remove the unused parameters.
498         (nds32_elf_relax_piclo12, nds32_elf_relax_letlslo12,
499         nds32_elf_relax_letlsadd, nds32_elf_relax_letlsls,
500         nds32_elf_relax_pltgot_suff, nds32_elf_relax_got_suff
501         nds32_elf_relax_gotoff_suff, calculate_plt_memory_address,
502         calculate_plt_offset, calculate_got_memory_address,
503         nds32_elf_check_dup_relocs): Removed.
504         All callers changed.
505         * elf32-nds32.h: Remove the unused macros and defines.
506         (elf_nds32_link_hash_table): Remove the unused variable.
507         (bfd_elf32_nds32_set_target_option): Update prototype.
508         (nds32_elf_ex9_init): Removed.
509         * elf32-nds32.c (nds32_convert_32_to_16): Updated.
510         * elf32-nds32.c (HOWTO2, HOWTO3): Define new HOWTO macros
511         to initialize array nds32_elf_howto_table in any order
512         without lots of EMPTY_HOWTO.
513         (nds32_reloc_map): Updated.
514         * reloc.c: Add BFD_RELOC_NDS32_LSI.
515         * bfd-in2.h: Regenerated.
516         * bfd/libbfd.h: Regenerated.
517         * elf32-nds32.c (nds32_elf_relax_howto_table): Add R_NDS32_LSI.
518         (nds32_reloc_map): Likewise.
519         (nds32_elf_relax_flsi): New function.
520         (nds32_elf_relax_section): Support floating load/store relaxation.
521         * elf32-nds32.c (NDS32_GUARD_SEC_P, elf32_nds32_local_gp_offset):
522         New macro.
523         (struct elf_nds32_link_hash_entry): New `offset_to_gp' field.
524         (struct elf_nds32_obj_tdata): New `offset_to_gp' and `hdr_size' fields.
525         (elf32_nds32_allocate_local_sym_info, nds32_elf_relax_guard,
526         nds32_elf_is_target_special_symbol, nds32_elf_maybe_function_sym):
527         New functions.
528         (nds32_info_to_howto_rel): Add BFD_ASSERT.
529         (bfd_elf32_bfd_reloc_type_table_lookup, nds32_elf_link_hash_newfunc,
530         nds32_elf_link_hash_table_create, nds32_elf_relocate_section,
531         nds32_elf_relax_loadstore, nds32_elf_relax_lo12, nds32_relax_adjust_label,
532         bfd_elf32_nds32_set_target_option, nds32_fag_mark_relax): Updated.
533         (nds32_elf_final_sda_base): Improve it to find the better gp value.
534         (insert_nds32_elf_blank): Must consider `len' when inserting blanks.
535         * elf32-nds32.h (bfd_elf32_nds32_set_target_option): Update prototype.
536         (struct elf_nds32_link_hash_table): Add new variable `hyper_relax'.
537         * elf32-nds32.c (elf32_nds32_allocate_dynrelocs): New function.
538         (create_got_section): Likewise.
539         (allocate_dynrelocs, nds32_elf_size_dynamic_sections,
540         nds32_elf_relocate_section, nds32_elf_finish_dynamic_symbol): Updated.
541         (nds32_elf_check_relocs): Fix the issue that the shared library may
542         has TEXTREL entry in the dynamic section.
543         (nds32_elf_create_dynamic_sections): Enable to call readonly_dynrelocs
544         since the TEXTREL issue is fixed in the nds32_elf_check_relocs.
545         (nds32_elf_finish_dynamic_sections): Update and add DT_RELASZ
546         dynamic entry.
547         (calculate_offset): Remove the unused parameter `pic_ext_target' and
548         related codes.
549         All callers changed.
550         (elf_backend_dtrel_excludes_plt): Disable it temporarily since it
551         will cause some errors for our test cases.
552         * elf32-nds32.c (nds32_elf_merge_private_bfd_data): Allow to link the
553         generic object.
554         * reloc.c: Add TLS relocations.
555         * libbfd.h: Regenerated.
556         * bfd-in2.h: Regenerated.
557         * elf32-nds32.h (struct section_id_list_t): New.
558         (elf32_nds32_lookup_section_id, elf32_nds32_check_relax_group,
559         elf32_nds32_unify_relax_group, nds32_elf_unify_tls_model):
560         New prototypes.
561         (elf32_nds32_compute_jump_table_size, elf32_nds32_local_tlsdesc_gotent):
562         New macro.
563         (nds32_insertion_sort, bfd_elf32_nds32_set_target_option,
564         elf_nds32_link_hash_table): Updated.
565         * elf32-nds32.c (enum elf_nds32_tls_type): New.
566         (struct elf32_nds32_relax_group_t, struct relax_group_list_t): New.
567         (elf32_nds32_add_dynreloc, patch_tls_desc_to_ie, get_tls_type,
568         fls, ones32, list_insert, list_insert_sibling, dump_chain,
569         elf32_nds32_check_relax_group, elf32_nds32_lookup_section_id,
570         elf32_nds32_unify_relax_group, nds32_elf_unify_tls_model): New functions.
571         (elf_nds32_obj_tdata): Add new fields.
572         (elf32_nds32_relax_group_ptr, nds32_elf_local_tlsdesc_gotent): New macros.
573         (nds32_elf_howto_table): Add TLS relocations.
574         (nds32_reloc_map): Likewise.
575         (nds32_elf_copy_indirect_symbol, nds32_elf_size_dynamic_sections,
576         nds32_elf_finish_dynamic_symbol, elf32_nds32_allocate_local_sym_info,
577         nds32_elf_relocate_section, bfd_elf32_nds32_set_target_option,
578         nds32_elf_check_relocs, allocate_dynrelocs): Updated.
579         (nds32_elf_relax_section): Call nds32_elf_unify_tls_model.
580         (dtpoff_base): Rename it to `gottpof' and then update it.
581
582 2018-09-20  Alan Modra  <amodra@gmail.com>
583
584         PR 23685
585         * peXXigen.c (pe_print_edata): Correct export address table
586         overflow checks.  Check dataoff against section size too.
587
588 2018-09-20  Alan Modra  <amodra@gmail.com>
589
590         PR 23686
591         * dwarf2.c (read_section): Error when attempting to malloc
592         "(bfd_size_type) -1".
593         * syms.c (_bfd_stab_section_find_nearest_line): Bounds check
594         function_name.  Bounds check reloc address.  Formatting.  Ensure
595         .stabstr zero terminated.
596
597 2018-09-18  Nick Clifton  <nickc@redhat.com>
598
599         PR 23657
600         * elfcode.h (elf_swap_shdr_in): Generate a warning message if an
601         ELF section has contents and size larger than the file size.
602
603 2018-09-14  Maciej W. Rozycki  <macro@mips.com>
604
605         PR ld/21375
606         * elfxx-mips.h (_bfd_mips_elf_hide_symbol): New prototype.
607         (_bfd_mips_elf_linker_flags): Update prototype.
608         * elf32-mips.c (elf_backend_hide_symbol): New macro.
609         * elf64-mips.c (elf_backend_hide_symbol): Likewise.
610         * elfn32-mips.c (elf_backend_hide_symbol): Likewise.
611         * elfxx-mips.c (mips_elf_link_hash_table): Add
612         `use_absolute_zero' and `gnu_target' members.
613         (mips_elf_record_global_got_symbol): Call
614         `_bfd_mips_elf_hide_symbol' rather than
615         `_bfd_elf_link_hash_hide_symbol'.
616         (mips_use_local_got_p): Return FALSE if the symbol is absolute.
617         (mips_elf_obtain_contents): Reorder function.
618         (mips_elf_nullify_got_load): New function.
619         (mips_elf_calculate_relocation): Add `contents' parameter.
620         Nullify GOT loads or if it is not possible, then redirect GOT
621         relocations to the `__gnu_absolute_zero' symbol, for references
622         that are supposed to resolve to zero.
623         (mips_elf_define_absolute_zero): New function.
624         (_bfd_mips_elf_check_relocs): Prepare for arrangements made in
625         `mips_elf_calculate_relocation' for references made via the GOT
626         that are supposed to resolve to zero.
627         (_bfd_mips_elf_hide_symbol): New function.
628         (_bfd_mips_elf_linker_flags): Add the `gnu_target' parameter,
629         set the `gnu_target' member of the MIPS hash table.
630         (MIPS_LIBC_ABI_ABSOLUTE): New enumeration constant.
631         (_bfd_mips_post_process_headers): Use it.
632
633 2018-09-14  Maciej W. Rozycki  <macro@mips.com>
634
635         * elfxx-mips.c (mips_elf_store_contents): New function...
636         (mips_elf_perform_relocation): ... factored out from here.
637
638 2018-09-14  Lifang Xia <lifang_xia@c-sky.com>
639
640         * elf32-csky.c (csky_elf_howto_table): Fill special_function of
641         R_CKCORE_PCREL32.
642         (csky_elf_relocate_section): Add R_CKCORE_PCREL32 process.
643
644 2018-09-14  Alan Modra  <amodra@gmail.com>
645
646         PR 23425
647         * reloc.c (bfd_generic_get_relocated_section_contents): Zero reloc
648         fields in debug sections when reloc is against an undefined symbol
649         and called from bfd_simple_get_relocated_section_contents or
650         similar.
651         * dwarf2.c (find_abstract_instance): Return true for zero offset
652         DW_FORM_ref_addr without returning values.
653
654 2018-09-06  Alan Modra  <amodra@gmail.com>
655
656         PR 23570
657         * elf32-avr.c (elf_avr_special_sections): New.
658         (elf_backend_special_sections): Define.
659
660 2018-09-04  Jose E. Marchesi  <jose.marchesi@oracle.com>
661
662         * elfxx-sparc.c (_bfd_sparc_elf_info_to_howto): Do not issue an
663         error when an invalid relocation is passed;  this is already done
664         by `_bfd_sparc_elf_info_to_howto_ptr'.
665
666 2018-09-04  Jose E. Marchesi  <jose.marchesi@oracle.com>
667
668         * elf64-sparc.c (elf64_sparc_slurp_one_reloc_table): Issue an
669         error when an invalid symbol index is retrieved in ELF64_R_SYM of
670         a relocation seen in an input file.
671
672 2018-09-03  Jozef Lawrynowicz <jozef.l@mittosystems.com>
673             Alan Modra  <amodra@gmail.com>
674
675         PR 23595
676         elf.c (copy_elf_program_header): When first segment contains
677         only the headers and SHT_NOBITS sections, use segment p_filesz
678         to calculate header and padding size.  Use filepos of the first
679         section otherwise.
680
681 2018-08-31  H.J. Lu  <hongjiu.lu@intel.com>
682
683         PR ld/23600
684         * archures.c (bfd_arch_get_compatible): Allow an IR object with
685         unknown architecture.
686
687 2018-08-31  Alan Modra  <amodra@gmail.com>
688
689         * elf64-ppc.c (num_relocs_for_offset): New function.
690         (emit_relocs_for_offset): New function.
691         (use_global_in_relocs): New function, split out from..
692         (ppc_build_one_stub): ..here.  Output relocations for notoc stubs.
693         (ppc_size_one_stub): Calculate reloc count for notoc stubs.
694         (ppc64_elf_size_stubs): Don't count undefined syms in stub_globals.
695
696 2018-08-31  Alan Modra  <amodra@gmail.com>
697
698         * reloc.c (BFD_RELOC_PPC64_REL16_HIGH, BFD_RELOC_PPC64_REL16_HIGHA),
699         (BFD_RELOC_PPC64_REL16_HIGHER, BFD_RELOC_PPC64_REL16_HIGHERA),
700         (BFD_RELOC_PPC64_REL16_HIGHEST, BFD_RELOC_PPC64_REL16_HIGHESTA):
701         Define.
702         * elf64-ppc.c (ppc64_elf_howto_raw): Add new REL16 howtos.
703         (ppc64_elf_reloc_type_lookup): Translate new REL16 relocs.
704         (ppc64_elf_check_relocs, ppc64_elf_relocate_section): Handle them.
705         * bfd-in2.h: Regenerate.
706         * libbfd.h: Regenerate.
707
708 2018-08-31  Alan Modra  <amodra@gmail.com>
709
710         * elf64-ppc.c: Correct _notoc stub comments.
711         (ppc_build_one_stub): Simplify output of branch for notoc
712         long branch stub.  Don't include label offset of 8 bytes in
713         "off" calculation for notoc plt stub.  Don't emit insns to get pc.
714         (build_offset): Emit insns to get pc here instead.
715         (size_offset): Add 4 extra insns.
716         (plt_stub_size): Adjust for "off" and size_offset changes.
717         (ppc_size_one_stub): Rearrange code into a switch, duplicating
718         some to better match ppc_build_one_stub.
719
720 2018-08-29  Chenghua Xu  <paul.hua.gm@gmail.com>
721
722         * archures.c (bfd_architecture): New machine
723         bfd_mach_mips_gs264e.
724         * bfd-in2.h (bfd_architecture): Likewise.
725         * cpu-mips.c (enum I_xxx): Likewise.
726         (arch_info_struct): Likewise.
727         * elfxx-mips.c (_bfd_elf_mips_mach): Handle
728         E_MIPS_MACH_GS264E.
729         (mips_set_isa_flags): Likewise.
730         (mips_mach_extensions): Map bfd_mach_mips_gs264e to
731         bfd_mach_mips_gs464e extension.
732
733 2018-08-29  Chenghua Xu  <paul.hua.gm@gmail.com>
734
735         * archures.c (bfd_architecture): New machine
736         bfd_mach_mips_gs464e.
737         * bfd-in2.h (bfd_architecture): Likewise.
738         * cpu-mips.c (enum I_xxx): Likewise.
739         (arch_info_struct): Likewise.
740         * elfxx-mips.c (_bfd_elf_mips_mach): Handle
741         E_MIPS_MACH_GS464E.
742         (mips_set_isa_flags): Likewise.
743         (mips_mach_extensions): Map bfd_mach_mips_gs464e to
744         bfd_mach_mips_gs464 extension.
745
746 2018-08-29  Chenghua Xu  <paul.hua.gm@gmail.com>
747
748         * archures.c (bfd_architecture): Rename
749         bfd_mach_mips_loongson_3a to bfd_mach_mips_gs464.
750         * bfd-in2.h (bfd_architecture): Likewise.
751         * cpu-mips.c (enum I_xxx): Likewise.
752         (arch_info_struct): Likewise.
753         * elfxx-mips.c (_bfd_elf_mips_mach): Likewise.
754         (mips_set_isa_flags): Likewise.
755         (mips_mach_extensions): Likewise.
756         (bfd_mips_isa_ext_mach): Likewise.
757         (bfd_mips_isa_ext): Likewise.
758         (print_mips_isa_ext): Delete AFL_EXT_LOONGSON_3A.
759
760 2018-08-29  Chenghua Xu  <paul.hua.gm@gmail.com>
761
762         * elfxx-mips.c (print_mips_ases): Add Loongson EXT2 extension.
763
764 2018-08-29  Chenghua Xu  <paul.hua.gm@gmail.com>
765
766          * elfxx-mips.c (infer_mips_abiflags): Use ases instead of
767          isa_ext for infer ABI flags.
768          (print_mips_ases): Add Loongson EXT extension.
769
770 2018-08-29  Chenghua Xu  <paul.hua.gm@gmail.com>
771
772         * elfxx-mips.c (print_mips_ases): Add CAM extension.
773
774 2018-08-27  H.J. Lu  <hongjiu.lu@intel.com>
775
776         * elfxx-x86.c (_bfd_x86_elf_parse_gnu_properties): Don't mask
777         out the GNU_PROPERTY_X86_UINT32_VALID bit.
778
779 2018-08-25  H.J. Lu  <hongjiu.lu@intel.com>
780
781         PR ld/23499
782         * elf.c (_bfd_elf_get_symbol_version_string): Return
783         _("<corrupt>") for corrupt symbol version info.
784
785 2018-08-24  H.J. Lu  <hongjiu.lu@intel.com>
786
787         * elfxx-x86.c (_bfd_x86_elf_parse_gnu_properties): Handle
788         X86_COMPAT_ISA_1_USED, X86_COMPAT_ISA_1_NEEDED,
789         X86_UINT32_AND_LO, X86_UINT32_AND_HI, X86_UINT32_OR_LO,
790         X86_UINT32_OR_HI, X86_UINT32_OR_AND_LO and X86_UINT32_OR_AND_HI
791         instead of X86_ISA_1_USED, X86_ISA_1_NEEDED and X86_FEATURE_1_AND.
792         (_bfd_x86_elf_merge_gnu_properties): Likewise.
793         (_bfd_x86_elf_link_setup_gnu_properties): Add X86_FEATURE_2_NEEDED
794         instead of X86_ISA_1_NEEDED.
795         (_bfd_x86_elf_link_fixup_gnu_properties): Handle
796         X86_COMPAT_ISA_1_USED, X86_COMPAT_ISA_1_NEEDED, X86_UINT32_AND_LO,
797         X86_UINT32_AND_HI, X86_UINT32_OR_LO, X86_UINT32_OR_HI,
798         X86_UINT32_OR_AND_LO and X86_UINT32_OR_AND_HI instead of
799         X86_ISA_1_USED, X86_ISA_1_NEEDED and X86_FEATURE_1_AND.
800
801 2018-08-24  H.J. Lu  <hongjiu.lu@intel.com>
802
803         * elfxx-x86.c (_bfd_x86_elf_parse_gnu_properties): Mask out the
804         GNU_PROPERTY_X86_UINT32_VALID bit.
805         (_bfd_x86_elf_link_fixup_gnu_properties): Set the
806         GNU_PROPERTY_X86_UINT32_VALID bit for non-relocatable output.
807
808 2018-08-23  Zenith423  <zenith432@users.sourceforge.net>
809
810         PR 23460
811         * plugin.c (struct plugin_list_entry): New structure.
812         (plugin_list): New variable.
813         (try_load_plugin): Place opened plugins on a list.  Ensure that
814         the refcount in the dynamic loader is kept at 1.
815
816 2018-08-23  Alan Modra  <amodra@gmail.com>
817
818         * elf64-ppc.c (ppc64_elf_relocate_section): Revise "call lacks
819         nop" error message.
820
821 2018-08-23  Nick Clifton  <nickc@redhat.com>
822
823         * elf64-hppa.c (elf_hppa_final_link_relocate): Replace unworkable
824         code with an assertion.
825
826 2018-08-23  Nick Clifton  <nickc@redhat.com>
827
828         PR 23061
829         * coffgen.c (coff_pointerize_aux): Add table_end parameter.  Use
830         it to prevent walking off the end of the table.
831         (coff_get_normalized_symtab): Pass internal_end pointer to
832         coff_pointerize_aux.
833
834 2018-08-23  Alan Modra  <amodra@gmail.com>
835
836         * elf64-ppc.c (ppc64_elf_relocate_section): Don't miss clearing
837         unresolved_reloc on ppc_stub_plt_call_notoc.
838
839 2018-08-22  H.J. Lu  <hongjiu.lu@intel.com>
840
841         PR ld/23536
842         * development.sh (experimental): New.
843
844 2018-08-22  Helge Deller  <deller@gmx.de>
845         Nick Clifton  <nickc@redhat.com>
846
847         * elf-hppa.h (elf_hppa_fake_sections): Use SHT_PARISC_UNWIND as
848         the section type of the .PARISC.unwind section on 64-bit binaries
849         and SHT_PROGBITS for 32-bit binaries.  Add a comment about it.
850         Add comment about the sh_entsize value.
851
852 2018-08-22  Rafeal Auler  <rafaelauler@gmail.com>
853
854         PR 23560
855         * elfnn-aarch64.c (elfNN_aarch64_size_stubs): Always update the
856         stub's target, since it may have been changed after the layout.
857
858 2018-08-21  John Darington  <john@darrington.wattle.id.au>
859
860         * elf32-s12z.c (opru18_reloc): New function.
861         (elf_s12z_howto_table): Adjust Howto according to new knowledge.
862
863 2018-08-21  mephi42  <mephi42@gmail.com>
864
865         PR binutils/23315
866         * mach-o.c (bfd_mach_o_mangle_symbols): Update n_type even if
867         data is already considered filled.
868
869 2018-08-21  Alan Modra  <amodra@gmail.com>
870
871         * elf64-ppc.c (HOW): Define.
872         (ONES): Delete.
873         (ppc64_elf_howto_raw): Use HOW to initialize entries.
874         * elf32-ppc.c (HOW): Define.
875         (ppc_elf_howto_raw): Use HOW to initialize entries, updating
876         R_PPC_VLE_REL15 and R_PPC_VLE_REL24 to use bitpos=0.
877
878 2018-08-21  Alan Modra  <amodra@gmail.com>
879
880         * reloc.c (reloc_howto_type): Typedef.
881         (bfd_symbol): Delete forward declaration.
882         (struct reloc_howto_struct): Add "negate" field.  Make "size",
883         "bitsize", "rightshift", "bitpos", "complain_on_overflow",
884         "pc_relative", "partial_inplace", and "pcrel_offset" bitfields.
885         Rearrange for better packing.  Revise comments.
886         (HOWTO): Map to rearranged reloc_howto_struct.
887         (bfd_get_reloc_size): Delete now unused cases.
888         (read_reloc, write_reloc): Likewise.
889         (apply_reloc, _bfd_relocate_contents): Test howto->negate
890         rather than howto->size < 0 for negated relocation values.
891         * coff-rs6000.c (xcoff_complain_overflow_bitfield_func): Avoid
892         signed/unsigned warning.
893         (xcoff_ppc_relocate_section): Delete "condition is always false"
894         code.
895         * coff64-rs6000.c (xcoff64_ppc_relocate_section): Likewise.
896         * cpu-ns32k.c (do_ns32k_reloc): Adjust to suit reloc_howto_struct
897         changes.
898         * vms-alpha.c (_bfd_vms_write_etir, alpha_vms_slurp_relocs): Use
899         size 16 for ALPHA_R_LINKAGE.
900         (alpha_howto_table <ALPHA_R_LINKAGE>): Set encoded size and
901         bitsize to zero.
902         * bfd-in.h (reloc_howto_type): Delete.
903         * bfd-in2.h: Regenerate.
904
905 2018-08-21  Alan Modra  <amodra@gmail.com>
906
907         * reloc.c (HOWTO): Revise comment.
908         (NEWHOWTO, HOWTO_PREPARE): Delete.
909         * coff-arm.c (coff_arm_reloc_type_lookup): Replace const struc
910         reloc_howto_struct with reloc_howto_type.
911         * ns32knetbsd.c (MY_bfd_reloc_type_lookup): Likewise.
912         * vms-alpha.c (alpha_vms_bfd_reloc_type_lookup): Likewise.
913         * elf-hppa.h (HOW): Define.
914         (elf_hppa_howto_table): Use it to simplify this table, correcting
915         name of R_PARISC_LTOFF16WF, R_PARISC_LTOFF_FPTR64, and
916         R_PARISC_LTOFF_FPTR16DF.
917         * elf32-mep.c (MEPREL): Use HOWTO.
918         * bfd-in2.h: Regenerate.
919
920 2018-08-20  Alan Modra  <amodra@gmail.com>
921
922         * mmo.c (valid_mmo_symbol_character_set): Initialize and make
923         array const.
924         (mmo_init): Don't init valid_mmo_symbol_character_set.
925
926 2018-08-20  Alan Modra  <amodra@gmail.com>
927
928         * rs6000-core.c (CORE_COMMONSZ): Balance parentheses in expression.
929
930 2018-08-17  H.J. Lu  <hongjiu.lu@intel.com>
931
932         PR ld/23515
933         * elf-bfd.h (elf_backend_data): Add fixup_gnu_properties.
934         * elf-properties.c (_bfd_elf_link_setup_gnu_properties): Call
935         backend fixup_gnu_properties if it isn't NULL.  Discard
936         .note.gnu.property section if all properties have been removed.
937         * elfxx-target.h (elf_backend_fixup_gnu_properties): New.
938         (elfNN_bed): Initialize fixup_gnu_properties.
939         * elfxx-x86.c (_bfd_x86_elf_link_fixup_gnu_properties): New
940         function.
941         * elfxx-x86.h (_bfd_x86_elf_link_fixup_gnu_properties): New
942         prototype.
943         (elf_backend_fixup_gnu_properties): New.
944
945 2018-08-16  Alan Modra  <amodra@gmail.com>
946
947         * elf64-ppc.c: Correct ppc_stub_long_branch_notoc example.
948         Formatting.
949
950 2018-08-12  H.J. Lu  <hongjiu.lu@intel.com>
951
952         PR binutils/23494
953         * Makefile.am (BFD32_LIBS): Add elf-properties.lo.
954         (BFD32_LIBS_CFILES): Add elf-properties.c.
955         (BFD32_BACKENDS): Remove elf-properties.lo.
956         (BFD32_BACKENDS_CFILES): Remove elf-properties.c.
957         * configure.ac (elf): Remove elf-properties.lo.
958         * Makefile.in: Regenerated.
959         * configure: Likewise.
960
961 2018-08-11  H.J. Lu  <hongjiu.lu@intel.com>
962
963         PR ld/23428
964         * elfxx-x86.c (_bfd_x86_elf_link_setup_gnu_properties): Don't
965         add X86_ISA_1_NEEDED property only if existing properties won't
966         be removed.
967
968 2018-08-11  Alan Modra  <amodra@gmail.com>
969
970         * reloc.c (bfd_get_reloc_size): Sort switch.
971         (read_reloc, write_reloc, apply_reloc): New functions.
972         (bfd_perform_relocation, bfd_install_relocation): Use apply_reloc.
973         (_bfd_relocate_contents): Use read_reloc and write_reloc.
974         (_bfd_clear_contents): Likewise.
975
976 2018-08-11  John Darrington  <john@darrington.wattle.id.au>
977
978         * reloc.c (_bfd_relocate_contents): Handle 3 byte relocs.
979         (_bfd_clear_contents): Likewise.
980         (bfd_perform_relocation): Likewise.
981         (bfd_install_relocation): Likewise.
982
983 2018-08-10  H.J. Lu  <hongjiu.lu@intel.com>
984
985         PR ld/23499
986         * elflink.c (bfd_elf_record_link_assignment): Always clear
987         h->verinfo.verdef when overriding a dynamic definition.
988
989 2018-08-10  H.J. Lu  <hongjiu.lu@intel.com>
990
991         PR binutils/23494
992         * elf-properties.c (elf_get_gnu_property_section_size): Always
993         use align_size as pr_datasz for GNU_PROPERTY_STACK_SIZE.
994         (elf_write_gnu_properties): Likewise.
995
996 2018-08-08  H.J. Lu  <hongjiu.lu@intel.com>
997
998         PR binutils/23494
999         * bfd.c (bfd_convert_section_size): Check BFD_DECOMPRESS after
1000         calling _bfd_elf_convert_gnu_property_size to convert
1001         .note.gnu.property section size.
1002         (bfd_convert_section_contents): Check BFD_DECOMPRESS after
1003         calling _bfd_elf_convert_gnu_properties to convert
1004         .note.gnu.property section.
1005         * elf-bfd.h (_bfd_elf_convert_gnu_property_size): New prototype.
1006         (_bfd_elf_convert_gnu_properties): Likewise.
1007         * elf-properties.c (elf_get_gnu_property_section_size): New
1008         function.
1009         (elf_write_gnu_properties): Likewise.
1010         (_bfd_elf_convert_gnu_property_size): Likewise.
1011         (_bfd_elf_convert_gnu_properties): Likewise.
1012         (_bfd_elf_link_setup_gnu_properties): Use
1013         elf_get_gnu_property_section_size and elf_write_gnu_properties.
1014
1015 2018-08-08  H.J. Lu  <hongjiu.lu@intel.com>
1016
1017         PR ld/23486
1018         * elfxx-x86.c (_bfd_x86_elf_merge_gnu_properties): Remove
1019         GNU_PROPERTY_X86_ISA_1_USED if an input file doesn't have it.
1020         (_bfd_x86_elf_link_setup_gnu_properties): Adding the
1021         GNU_PROPERTY_X86_ISA_1_NEEDED, instead of
1022         GNU_PROPERTY_X86_ISA_1_USED, property.
1023
1024 2018-08-07  Alan Modra  <amodra@gmail.com>
1025
1026         * elf64-ppc.c (struct map_stub): Delete tls_get_addr_opt_bctrl.
1027         Add lr_restore, eh_size and eh_base.
1028         (eh_advance, eh_advance_size): New functions.
1029         (build_tls_get_addr_stub): Emit EH info for stub.
1030         (ppc_build_one_stub): Likewise for _notoc stubs.
1031         (ppc_size_one_stub): Size EH info for stub.
1032         (group_sections): Init new map_stub fields.
1033         (stub_eh_frame_size): Delete.
1034         (ppc64_elf_size_stubs): Size EH info for stubs.  Set up dummy EH
1035         program for stubs.
1036         (ppc64_elf_build_stubs): Reinit new map_stub fields.  Set FDE
1037         offset to stub section here..
1038         (ppc64_elf_finish_dynamic_sections): ..rather than here.
1039
1040 2018-08-07  Alan Modra  <amodra@gmail.com>
1041
1042         * elf64-ppc.c (ppc64_elf_relocate_section): Don't skip first
1043         instruction of __tls_get_addr_opt stub.
1044         (plt_stub_size): Omit ALWAYS_EMIT_R2SAVE condition when
1045         dealing with __tls_get_addr_opt stub.
1046         (build_tls_get_addr_stub, ppc_size_one_stub): Likewise.
1047
1048 2018-08-06  Claudiu Zissulescu  <claziss@synopsys.com>
1049
1050         * elf32-arc.c (arc_elf_merge_private_bfd_data): Complain about
1051         efalgs only when in/out exists.
1052         (elf32_arc_section_from_shdr): Don't complain about 0x0c
1053         section type.  It is mwdt compiler specific.
1054
1055 2018-08-06  Claudiu Zissulescu  <claziss@synopsys.com>
1056
1057         * elf32-arc.c (arc_elf_merge_attributes): Fix merge attributes.
1058
1059 2018-08-06  Claudiu Zissulescu  <claziss@synopsys.com>
1060
1061         * elf32-arc.c (arc_elf_merge_attributes): Handle
1062         Tag_ARC_ATR_version.
1063
1064 2018-08-05  Alan Modra  <amodra@gmail.com>
1065
1066         * elf64-ppc.c (ADDI_R12_R11, ADDI_R12_R12, LIS_R12),
1067         (ADDIS_R12_R11, ORIS_R12_R12_0, ORI_R12_R12_0),
1068         (SLDI_R12_R12_32, LDX_R12_R11_R12, ADD_R12_R11_R12): Define.
1069         (ppc64_elf_howto_raw): Add R_PPC64_REL24_NOTOC entry.
1070         (ppc64_elf_reloc_type_lookup): Support R_PPC64_REL24_NOTOC.
1071         (ppc_stub_type): Add ppc_stub_long_branch_notoc,
1072         ppc_stub_long_branch_both, ppc_stub_plt_branch_notoc,
1073         ppc_stub_plt_branch_both, ppc_stub_plt_call_notoc, and
1074         ppc_stub_plt_call_both.
1075         (is_branch_reloc): Add R_PPC64_REL24_NOTOC.
1076         (build_offset, size_offset): New functions.
1077         (plt_stub_size): Support plt_call_notoc and plt_call_both.
1078         (ppc_build_one_stub, ppc_size_one_stub): Support new stubs.
1079         (toc_adjusting_stub_needed): Handle R_PPC64_REL24_NOTOC.
1080         (ppc64_elf_size_stubs): Likewise, and new stubs.
1081         (ppc64_elf_build_stubs, ppc64_elf_relocate_section): Likewise.
1082         * reloc.c: Add BFD_RELOC_PPC64_REL24_NOTOC.
1083         * bfd-in2.h: Regenerate.
1084         * libbfd.h: Regenerate.
1085
1086 2018-08-05  Alan Modra  <amodra@gmail.com>
1087
1088         * elf64-ppc.c (ppc_build_one_stub): Lose "_r2off" in stub symbols.
1089
1090 2018-08-02  Jim Wilson  <jimw@sifive.com>
1091
1092         * elfnn-riscv.c (riscv_elf_create_dynamic_sections): For .tdata.dyn,
1093         add SEC_LINKER_CREATED flag.
1094
1095 2018-08-01  Nick Clifton  <nickc@redhat.com>
1096
1097         * coff-rs6000.c (_bfd_xcoff_put_ldsymbol_name): Suppress warnings
1098         about potentially truncated strncpy operations.
1099         (_bfd_xcoff_put_symbol_name): Likewise.
1100
1101         * elf32-avr.c (avr_stub_name): Check for a NULL return from
1102         bfd_malloc.
1103
1104 2018-08-01  Zenith  <zenith432@users.sourceforge.net>
1105
1106         PR 23460
1107         * plugin.c (bfd_plugin_open_input): Close file descriptor if the
1108         call to fstat fails.
1109         (try_claim): Always close the file descriptor at the end of the
1110         function.
1111         (try_load_plugin): If a plugin has already been registered, then
1112         skip the dlopen and onload steps and go straight to claiming the
1113         file.  If these is an error, close the plugin.
1114
1115 2018-08-01  Alan Modra  <amodra@gmail.com>
1116
1117         * elf64-ppc.c (plt_stub_pad): Delay plt_stub_size call until needed.
1118         (ppc_build_one_stub): Don't set stub_offset, instead assert that
1119         it is sane.  Don't adjust stub_offset for alignment.  Adjust size
1120         calculation.  Use "targ" temp when calculating offsets.
1121         (ppc_size_one_stub): Set stub_offset here.  Use "targ" temp when
1122         calculating offsets.  Adjust for alignment before setting
1123         tls_get_addr_opt_bctrl.
1124
1125 2018-08-01  Alan Modra  <amodra@gmail.com>
1126
1127         * po/SRC-POTFILES.in: Regenerate.
1128
1129 2018-07-30  Nick Clifton  <nickc@redhat.com>
1130
1131         PR 22706
1132         * elf32-sh.c (sh_elf_relocate_section): When processing
1133         translation relocs, fail if the relocation offset is too small.
1134         Replace BFD_ASSERTs with more helpful error messages.
1135
1136 2018-07-30  Andrew Jenner  <andrew@codesourcery.com>
1137
1138         * Makefile.am (ALL_MACHINES, ALL_MACHINES_CFILES): Add C-SKY.
1139         (BFD32_BACKENDS, BFD_BACKENDS_CFILES): Likewise.
1140         * Makefile.in: Regenerated.
1141         * archures.c (enum bfd_architecture): Add bfd_arch_csky and
1142         related bfd_mach defines.
1143         (bfd_csky_arch): Declare.
1144         (bfd_archures_list): Add C-SKY.
1145         * bfd-in.h (elf32_csky_build_stubs): Declare.
1146         (elf32_csky_size_stubs): Declare.
1147         (elf32_csky_next_input_section: Declare.
1148         (elf32_csky_setup_section_lists): Declare.
1149         * bfd-in2.h: Regenerated.
1150         * config.bfd: Add C-SKY.
1151         * configure.ac: Likewise.
1152         * configure: Regenerated.
1153         * cpu-csky.c: New file.
1154         * elf-bfd.h (enum elf_target_id): Add C-SKY.
1155         * elf32-csky.c: New file.
1156         * libbfd.h: Regenerated.
1157         * reloc.c: Add C-SKY relocations.
1158         * targets.c (csky_elf32_be_vec, csky_elf32_le_vec): Declare.
1159         (_bfd_target_vector): Add C-SKY target vector entries.
1160
1161 2018-07-27  John Darrington  <john@darrington.wattle.id.au>
1162
1163         * elf32-s12z.c (ELF_TARGET_ID): Don't define.
1164
1165 2018-07-27  John Darrington  <john@darrington.wattle.id.au>
1166
1167         * libbfd.c (bfd_getb24, bfd_getl24): New functions.
1168         (bfd_get_24, bfd_put_24): New macros.
1169         * bfd-in2.h: Regenerate.
1170
1171 2018-07-27  John Darrington  <john@darrington.wattle.id.au>
1172
1173         * elf32-s12z.c (s12z_elf_set_mach_from_flags): Remove comment.
1174
1175 2018-07-26  Alan Modra  <amodra@gmail.com>
1176
1177         * elf64-ppc.c (ppc64_elf_size_stubs): Use a ppc_stub_long_branch_r2off
1178         for calls to symbols with STO_PPC64_LOCAL_MASK bits set to 1.
1179
1180 2018-07-25  Alan Modra  <amodra@gmail.com>
1181
1182         * elf32-ppc.c (ppc_elf_relax_section): Ignore common or undef locals.
1183         Avoid trashing toff with added when used as a symbol index.
1184         Ignore R_PPC_PLTREL24 addends in unused example code.  Avoid
1185         creating unnecessary fixups when relocatable.
1186
1187 2018-07-25  Alan Modra  <amodra@gmail.com>
1188
1189         * elf32-arm.c (elf32_arm_nabi_write_core_note): Disable
1190         -Wstringop-truncation warning for gcc-8.0 too.
1191         * elf32-ppc.c (ppc_elf_write_core_note): Likewise.
1192         * elf64-ppc.c (ppc64_elf_write_core_note): Likewise.
1193         * elfxx-aarch64.c (_bfd_aarch64_elf_write_core_note): Likewise.
1194         * elf32-s390.c (elf_s390_write_core_note): Comment fix.
1195         * elf64-s390.c (elf_s390_write_core_note): Likewise.
1196
1197 2018-07-24  Alan Modra  <amodra@gmail.com>
1198
1199         PR 23430
1200         * dwarf2.c (dwarf_debug_section_enum): Fix comment typo.
1201         * elf.c (bfd_section_from_shdr, elf_sort_sections): Likewise.
1202
1203 2018-07-23  Max Filippov  <jcmvbkbc@gmail.com>
1204
1205         * elf32-xtensa.c (elf_xtensa_finish_dynamic_sections): Move
1206         relocation sections consistency check to always check both
1207         .rela.dyn and .rela.plt when they exist. Rearrange variable
1208         definition and assignment places.
1209
1210 2018-07-23  Max Filippov  <jcmvbkbc@gmail.com>
1211
1212         * elf32-xtensa.c (shrink_dynamic_reloc_sections): Shrink dynamic
1213         relocations section for dynamic undefined weak symbols when
1214         linking a shared object.
1215
1216 2018-07-23  Tom Tromey  <tom@tromey.com>
1217
1218         * elf.c (bfd_get_elf_phdrs): Don't call memcpy with size 0.
1219
1220 2018-07-21  Eric Botcazou  <ebotcazou@adacore.com>
1221
1222         * elf32-arm.c (elf32_arm_final_link_relocate) <R_ARM_GOT32>: Small
1223         cleanup for the case of a global symbol that binds locally.  Also
1224         install a value in the GOT slot in the case of a local symbol in
1225         a non-PIC link.
1226
1227 2018-07-20  H.J. Lu  <hongjiu.lu@intel.com>
1228
1229         PR ld/23428
1230         * elfxx-x86.c (_bfd_x86_elf_link_setup_gnu_properties): If the
1231         separate code program header is needed, make sure that the first
1232         read-only PT_LOAD segment has no code by adding a
1233         GNU_PROPERTY_X86_ISA_1_USED note.
1234
1235 2018-07-20  Chenghua Xu  <paul.hua.gm@gmail.com>
1236             Maciej W. Rozycki  <macro@mips.com>
1237
1238         * elfxx-mips.c (print_mips_ases): Add MMI extension.
1239
1240 2018-07-20  Maciej W. Rozycki  <macro@mips.com>
1241
1242         * elfxx-mips.c (_bfd_mips_elf_size_dynamic_sections): Do not
1243         create DT_REL, DT_RELSZ or DT_RELENT dynamic entries if the
1244         dynamic relocation section will be discarded from output.
1245         (_bfd_mips_elf_finish_dynamic_sections) <DT_RELSZ>: Assert that
1246         the dynamic relocation section will be retained in output.
1247
1248 2018-07-18  Maciej W. Rozycki  <macro@mips.com>
1249
1250         * xcofflink.c (xcoff_write_global_symbol): Fix symbol type
1251         checks for defined weak symbols.
1252
1253 2018-07-17  Maciej W. Rozycki  <macro@mips.com>
1254
1255         * elf32-nds32.c (nds32_elf_relax_loadstore): Use
1256         `bfd_is_abs_symbol' rather than `bfd_is_abs_section' in checking
1257         whether the symbol is absolute.
1258         (nds32_elf_relax_lo12): Likewise.
1259         * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Likewise.
1260         (elfNN_aarch64_check_relocs): Likewise.
1261         * xcofflink.c (xcoff_need_ldrel_p): Likewise.
1262         (bfd_xcoff_import_symbol): Likewise.
1263         (xcoff_write_global_symbol): Likewise.
1264
1265 2018-07-17  Maciej W. Rozycki  <macro@mips.com>
1266
1267         * linker.c (bfd_is_abs_symbol): New macro.
1268         * bfd-in2.h: Regenerate.
1269
1270 2018-07-16  Edjunior Barbosa Machado  <emachado@linux.vnet.ibm.com>
1271
1272         * elf-bfd.h (elfcore_write_ppc_tar): Add prototype.
1273         (elfcore_write_ppc_ppr): Likewise.
1274         (elfcore_write_ppc_dscr): Likewise.
1275         (elfcore_write_ppc_ebb): Likewise.
1276         (elfcore_write_ppc_pmu): Likewise.
1277         (elfcore_write_ppc_tm_cgpr): Likewise.
1278         (elfcore_write_ppc_tm_cfpr): Likewise.
1279         (elfcore_write_ppc_tm_cvmx): Likewise.
1280         (elfcore_write_ppc_tm_cvsx): Likewise.
1281         (elfcore_write_ppc_tm_spr): Likewise.
1282         (elfcore_write_ppc_tm_ctar): Likewise.
1283         (elfcore_write_ppc_tm_cppr): Likewise.
1284         (elfcore_write_ppc_tm_cdscr): Likewise.
1285         * elf.c (elfcore_write_ppc_tar): New function.
1286         (elfcore_write_ppc_ppr): Likewise.
1287         (elfcore_write_ppc_dscr): Likewise.
1288         (elfcore_write_ppc_ebb): Likewise.
1289         (elfcore_write_ppc_pmu): Likewise.
1290         (elfcore_write_ppc_tm_cgpr): Likewise.
1291         (elfcore_write_ppc_tm_cfpr): Likewise.
1292         (elfcore_write_ppc_tm_cvmx): Likewise.
1293         (elfcore_write_ppc_tm_cvsx): Likewise.
1294         (elfcore_write_ppc_tm_spr): Likewise.
1295         (elfcore_write_ppc_tm_ctar): Likewise.
1296         (elfcore_write_ppc_tm_cppr): Likewise.
1297         (elfcore_write_ppc_tm_cdscr): Likewise.
1298         (elfcore_write_register_note): Call them.
1299         (elfcore_grok_ppc_tar): New function.
1300         (elfcore_grok_ppc_ppr): Likewise.
1301         (elfcore_grok_ppc_dscr): Likewise.
1302         (elfcore_grok_ppc_ebb): Likewise.
1303         (elfcore_grok_ppc_pmu): Likewise.
1304         (elfcore_grok_ppc_tm_cgpr): Likewise.
1305         (elfcore_grok_ppc_tm_cfpr): Likewise.
1306         (elfcore_grok_ppc_tm_cvmx): Likewise.
1307         (elfcore_grok_ppc_tm_cvsx): Likewise.
1308         (elfcore_grok_ppc_tm_spr): Likewise.
1309         (elfcore_grok_ppc_tm_ctar): Likewise.
1310         (elfcore_grok_ppc_tm_cppr): Likewise.
1311         (elfcore_grok_ppc_tm_cdscr): Likewise.
1312         (elfcore_grok_note): Call them.
1313
1314 2018-07-11  Maciej W. Rozycki  <macro@mips.com>
1315
1316         * elfxx-mips.c (mips_tls_got_relocs): Use `bfd_link_dll' rather
1317         than `!bfd_link_pic' in determining the dynamic symbol index.
1318         Avoid the index of -1.
1319         (mips_elf_initialize_tls_slots): Likewise.  Flatten code by
1320         moving `dyn' to the beginning of the function block.
1321
1322 2018-07-11  Maciej W. Rozycki  <macro@mips.com>
1323             Rich Felker  <bugdal@aerifal.cx>
1324
1325         PR ld/22570
1326         * elfxx-mips.c (mips_tls_got_relocs): Use `bfd_link_dll' rather
1327         than `bfd_link_pic' to determine whether dynamic relocations are
1328         to be produced.
1329         (mips_elf_initialize_tls_slots): Likewise.
1330
1331 2018-07-10  Maciej W. Rozycki  <macro@mips.com>
1332
1333         * elflink.c (bfd_elf_final_link): Rename `remove' local variable
1334         to `remove_section'.
1335
1336 2018-07-10  Alan Modra  <amodra@gmail.com>
1337
1338         * elf32-xgate.h: Delete.
1339         * elf32-xgate.c: Delete unnecessary forward declarations, add two
1340         that are now needed.
1341         (xgate_elf_bfd_link_hash_table_create)
1342         (xgate_elf_bfd_link_hash_table_free)
1343         (xgate_elf_set_mach_from_flags, struct xgate_scan_param)
1344         (stub_hash_newfunc, elf32_xgate_add_symbol_hook)
1345         (elf32_xgate_setup_section_lists, elf32_xgate_size_stubs)
1346         (elf32_xgate_build_stubs, elf32_xgate_check_relocs)
1347         (elf32_xgate_relocate_section, _bfd_xgate_elf_set_private_flags)
1348         (elf32_xgate_post_process_headers): Delete.
1349         (elf32_xgate_backend_symbol_processing): New function.
1350         (xgate_elf_ignore_reloc, xgate_elf_special_reloc)
1351         (_bfd_xgate_elf_print_private_bfd_data): Make static.
1352         (ELF_TARGET_ID, elf_info_to_howto, elf_backend_check_relocs)
1353         (elf_backend_relocate_section, elf_backend_object_p)
1354         (elf_backend_final_write_processing, elf_backend_can_gc_sections)
1355         (elf_backend_post_process_headers, elf_backend_add_symbol_hook)
1356         (bfd_elf32_bfd_link_hash_table_create)
1357         (bfd_elf32_bfd_set_private_flags)
1358         (xgate_stub_hash_lookup): Don't define.
1359         (elf_backend_symbol_processing): Define.
1360         * elf-bfd.h (elf_target_id): Delete XGATE_ELF_DATA.
1361
1362 2018-07-09  Maciej W. Rozycki  <macro@mips.com>
1363
1364         * elfxx-mips.c (_bfd_mips_elf_adjust_dynamic_symbol): Don't set
1365         `->needs_lazy_stub' if the stubs output section is the absolute
1366         section.
1367
1368 2018-07-09  H.J. Lu  <hongjiu.lu@intel.com>
1369
1370         PR ld/23388
1371         * configure.ac: Use changequote for "i[3-7]86-*-linux-*".
1372         * configure: Regenerated.
1373
1374 2018-07-09  Alan Modra  <amodra@gmail.com>
1375
1376         * elf32-m68hc1x.c (elf32_m68hc11_post_process_headers): Call
1377         _bfd_elf_post_process_headers.
1378
1379 2018-07-06  Max Filippov  <jcmvbkbc@gmail.com>
1380
1381         * elf32-xtensa.c (elf_xtensa_allocate_dynrelocs): Don't allocate
1382         space for dynamic relocation for undefined weak symbol.
1383         (elf_xtensa_relocate_section): Don't emit R_XTENSA_RELATIVE
1384         relocation for undefined weak symbols.
1385         (shrink_dynamic_reloc_sections): Don't shrink dynamic relocation
1386         section for relocations against undefined weak symbols.
1387
1388 2018-07-06  Alan Hayward  <alan.hayward@arm.com>
1389
1390         * elf.c (elfcore_grok_aarch_sve): New function.
1391         (elfcore_grok_note): Check for Aarch64 SVE.
1392         (elfcore_write_aarch_sve): New function.
1393         (elfcore_write_register_note): Check for Aarch64 SVE.
1394         * elf-bfd.h(elfcore_grok_aarch_sve): New declaration.
1395
1396 2018-07-06  Alan Modra  <amodra@gmail.com>
1397
1398         * elf32-arm.c (elf32_arm_nabi_write_core_note): Don't use
1399         DIAGNOTIC_PUSH and DIAGNOSTIC_POP unconditionally.
1400         * elf32-ppc.c (ppc_elf_write_core_note): Likewise.
1401         * elf32-s390.c (elf_s390_write_core_note): Likewise.
1402         * elf64-ppc.c (ppc64_elf_write_core_note): Likewise.
1403         * elf64-s390.c (elf_s390_write_core_note): Likewise.
1404         * elfxx-aarch64.c (_bfd_aarch64_elf_write_core_note): Likewise.
1405
1406 2018-07-05  Jim Wilson  <jimw@sifive.com>
1407
1408         * config.bfd (riscv32*-*-*): Renamed from riscv32-*-*.
1409         (riscv64*-*-*): Likewise.
1410         (riscv-*-*): Add as an alias for riscv32*-*-*.
1411
1412 2018-07-05  H.J. Lu  <hongjiu.lu@intel.com>
1413
1414         PR ld/23372
1415         * elfxx-x86.c (_bfd_x86_elf_merge_gnu_properties): Remove x86
1416         ISA properties with empty bits.
1417
1418 2018-07-05  Nick Clifton  <nickc@redhat.com>
1419
1420         * po/ru.po: Updated Russian translation.
1421
1422 2018-07-05  Alan Modra  <amodra@gmail.com>
1423
1424         * elf-bfd.h (_bfd_elf_ppc_merge_fp_attributes): Update prototype.
1425         * elf32-ppc.c (_bfd_elf_ppc_merge_fp_attributes): Return error
1426         on mismatch.  Remove "warning: " from messages.  Track last bfd
1427         used to set tags.
1428         (ppc_elf_merge_obj_attributes): Likewise.  Handle status from
1429         _bfd_elf_ppc_merge_fp_attributes.
1430         * elf64-ppc.c (ppc64_elf_merge_private_bfd_data): Handle status
1431         from _bfd_elf_ppc_merge_fp_attributes.
1432
1433 2018-07-04  H.J. Lu  <hongjiu.lu@intel.com>
1434
1435         * Makefile.am (bfdinclude_HEADERS): Add $(INCDIR)/diagnostics.h.
1436         * Makefile.in: Regenerated.
1437
1438 2018-07-03  Alan Modra  <amodra@gmail.com>
1439
1440         * elflink.c (bfd_elf_final_link): Remove zero size .gnu.attributes
1441         sections.
1442
1443 2018-07-03  Alan Modra  <amodra@gmail.com>
1444
1445         * elf-bfd.h (ATTR_TYPE_FLAG_ERROR, ATTR_TYPE_HAS_ERROR): Define.
1446         * elf-attrs.c (is_default_attr): Handle ATTR_TYPE_HAS_ERROR.
1447         * elf32-ppc.c (_bfd_elf_ppc_merge_fp_attributes): Use
1448         ATTR_TYPE_FLAG_INT_VAL.  Set ATTR_TYPE_HAS_ERROR on finding
1449         incompatible attribute.
1450         (ppc_elf_merge_obj_attributes): Likewise.  Return
1451         _bfd_elf_merge_object_attributes result.
1452         * elf64-ppc.c (ppc64_elf_merge_private_bfd_data): Return
1453         _bfd_elf_merge_object_attributes result.
1454
1455 2018-07-03  Alan Modra  <amodra@gmail.com>
1456
1457         PR 17550
1458         * elflink.c (_bfd_elf_fix_symbol_flags): Hide dynamic symbols
1459         in discarded sections.
1460
1461 2018-07-02  Maciej W. Rozycki  <macro@mips.com>
1462
1463         * elfxx-mips.c (_bfd_mips_elf_create_dynamic_sections): Set
1464         `mark' for symbols created from `mips_elf_dynsym_rtproc_names'
1465         list.
1466
1467 2018-07-02  Maciej W. Rozycki  <macro@mips.com>
1468
1469         * elf64-mips.c (micromips_elf64_howto_table_rel): Add
1470         R_MICROMIPS_HI0_LO16, R_MICROMIPS_TLS_GD, R_MICROMIPS_TLS_LDM,
1471         R_MICROMIPS_TLS_DTPREL_HI16, R_MICROMIPS_TLS_DTPREL_LO16,
1472         R_MICROMIPS_TLS_GOTTPREL, R_MICROMIPS_TLS_TPREL_HI16,
1473         R_MICROMIPS_TLS_TPREL_LO16, R_MICROMIPS_GPREL7_S2 and
1474         R_MICROMIPS_PC23_S2 relocation entries.
1475         (micromips_elf64_howto_table_rela): Likewise.
1476         (micromips_reloc_map): Likewise.
1477         * elfn32-mips.c (elf_micromips_howto_table_rel): Likewise.
1478         (elf_micromips_howto_table_rela): Likewise.
1479         (micromips_reloc_map): Likewise.
1480
1481 2018-07-02  H.J. Lu  <hongjiu.lu@intel.com>
1482
1483         PR ld/23324
1484         * elf64-x86-64.c (elf_x86_64_relocate_section): Clear the
1485         R_X86_64_converted_reloc_bit bit.
1486
1487 2018-07-02  Jeff Muizelaar  <jrmuizel@gmail.com>
1488             Tom Tromey  <tom@tromey.com>
1489
1490         PR 13157
1491         PR 21787
1492         * mach-o.c (bfd_mach_o_fat_close_and_cleanup): New function.
1493         (bfd_mach_o_close_and_cleanup): Redefine.
1494         * archive.c (_bfd_unlink_from_archive_parent): New function,
1495         extracted from..
1496         (_bfd_archive_close_and_cleanup): ..here.
1497         (bfd_generic_archive_p): Do not clear archive's format.
1498         * libbfd-in.h (_bfd_unlink_from_archive_parent): Declare.
1499         * libbfd.h: Regenerate.
1500
1501 2018-07-02  Thomas Preud'homme  <thomas.preudhomme@arm.com>
1502
1503         * archures.c (bfd_mach_arm_5TEJ, bfd_mach_arm_6, bfd_mach_arm_6KZ,
1504         bfd_mach_arm_6T2, bfd_mach_arm_6K, bfd_mach_arm_7, bfd_mach_arm_6M,
1505         bfd_mach_arm_6SM, bfd_mach_arm_7EM, bfd_mach_arm_8, bfd_mach_arm_8R,
1506         bfd_mach_arm_8M_BASE, bfd_mach_arm_8M_MAIN): Define.
1507         * bfd-in2.h: Regenerate.
1508         * cpu-arm.c (arch_info_struct): Add entries for above new
1509         bfd_mach_arm values.
1510         * elf32-arm.c (bfd_arm_get_mach_from_attributes): Add Tag_CPU_arch to
1511         bfd_mach_arm mapping logic for pre Armv4 and Armv5TEJ and later
1512         architectures.  Force assert failure for any new Tag_CPU_arch value.
1513
1514 2018-07-02  Thomas Preud'homme  <thomas.preudhomme@arm.com>
1515
1516         * doc/bfdint.texi: Use command-line consistently when used in a
1517         compount word.
1518         * doc/bfdsumm.texi: Likewise.
1519
1520 2018-06-29  Maciej W. Rozycki  <macro@mips.com>
1521
1522         * elfxx-mips.c (allocate_dynrelocs): Remove extraneous symbol
1523         visibility check made for undefined weak symbols.
1524
1525 2018-06-26  Nick Clifton  <nickc@redhat.com>
1526
1527         * po/uk.po: Updated Ukranian translation.
1528
1529 2018-06-25  Nick Clifton  <nickc@redhat.com>
1530
1531         * elfnn-aarch64.c (_bfd_aarch64_erratum_835769_stub_name): Check
1532         for malloc returning NULL.
1533         (_bfd_aarch64_erratum_843419_fixup): Check for
1534         _bfd_aarch64_erratum_835769_stub_name returning NULL.
1535
1536 2018-06-24  Nick Clifton  <nickc@redhat.com>
1537
1538         * po/bfd.pot: Regenerate.
1539
1540 2018-06-24  Nick Clifton  <nickc@redhat.com>
1541
1542         * version.m4: Update version string to 2.31.51.
1543         * configure: Regenerate.
1544
1545 2018-06-24  Nick Clifton  <nickc@redhat.com>
1546
1547         2.31 branch created.
1548
1549 2018-06-21  Maciej W. Rozycki  <macro@mips.com>
1550
1551         * elfxx-mips.c (_bfd_mips_elf_compact_eh_encoding)
1552         (_bfd_mips_elf_cant_unwind_opcode): Correct formatting.
1553
1554 2018-06-21  Maciej W. Rozycki  <macro@mips.com>
1555
1556         * elfxx-mips.c (_bfd_mips_post_process_headers): Keep
1557         EI_ABIVERSION setting together.
1558
1559 2018-06-21  Maciej W. Rozycki  <macro@mips.com>
1560
1561         * elfxx-mips.c (MIPS_LIBC_ABI_DEFAULT, MIPS_LIBC_ABI_MIPS_PLT)
1562         (MIPS_LIBC_ABI_UNIQUE, MIPS_LIBC_ABI_MIPS_O32_FP64)
1563         (MIPS_LIBC_ABI_MAX): New enumeration constants.
1564         (_bfd_mips_post_process_headers): Use them in place of magic
1565         numbers.
1566
1567 2018-06-21  Jim Wilson  <jimw@sifive.com>
1568
1569         * elfnn-riscv.c (riscv_elf_finish_dynamic_symbol): Update comment.
1570         Use SYMBOL_REFERENCES_LOCAL.  Add asserts for h->got.offset.
1571
1572 2018-06-21  Alan Modra  <amodra@gmail.com>
1573
1574         * doc/Makefile.am (AUTOMAKE_OPTIONS): Add "foreign".
1575         * doc/Makefile.in: Regenerate.
1576
1577 2018-06-20  Renlin Li  <renlin.li@arm.com>
1578
1579         * elfxx-aarch64.c (_bfd_aarch64_elf_resolve_relocation): Use PG_OFFSET
1580         to resolve BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC,
1581         BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC,
1582         BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC,
1583         BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC,
1584         BFD_RELOC_AARCH64_TLSLE_LDST16_TPREL_LO12_NC,
1585         BFD_RELOC_AARCH64_TLSLE_LDST32_TPREL_LO12_NC,
1586         BFD_RELOC_AARCH64_TLSLE_LDST64_TPREL_LO12_NC,
1587         BFD_RELOC_AARCH64_TLSLE_LDST8_TPREL_LO12_NC.
1588
1589 2018-06-20  Nick Clifton  <nickc@redhat.com>
1590
1591         PR 23316
1592         * opncls.c (get_build_id): Check for a negative or excessive data
1593         size in the build-id note.
1594
1595 2018-06-20  Nick Clifton  <nickc@redhat.com>
1596
1597         PR 23299
1598         * mach-o.c (cputype): New function.
1599         (cpusubtype): New function.
1600         (bfd_mach_o_bfd_print_private_data): New function.  Dispalys the
1601         values in the MACH-O file header.
1602         (bfd_mach_o_bfd_copy_private_header_data): Copy the cputype and
1603         cpusubtype fields from the input bfd's mach-o header to the output
1604         bfd.
1605         * mach-o-target.c (bfd_mach_o_bfd_print_private_bfd_data):
1606         Redefine to bfd_mach_o_bfd_print_private_data.
1607         * mach-o.h (bfd_mach_o_bfd_print_private_bfd_data): Prototype.
1608
1609 2018-06-19  Maciej W. Rozycki  <macro@mips.com>
1610
1611         PR ld/22966
1612         * elfxx-mips.c (_bfd_mips_elf_finish_dynamic_symbol): Verify the
1613         `.got.plt' entry referred is in range.
1614         (mips_finish_exec_plt): Correct the range check for `.got.plt'
1615         start.  Replace the assertion used for that with a proper error
1616         message.
1617
1618 2018-06-19  Maciej W. Rozycki  <macro@mips.com>
1619
1620         * elfxx-mips.c (_bfd_mips_elf_finish_dynamic_symbol): Fix
1621         formatting.
1622
1623 2018-06-19  Simon Marchi  <simon.marchi@ericsson.com>
1624
1625         * Makefile.am (AUTOMAKE_OPTIONS): Remove 1.11.
1626         (INCLUDES): Rename to ...
1627         (AM_CPPFLAGS): ... this.
1628         * configure.ac: Remove AC_PREREQ.
1629         * doc/Makefile.am (AUTOMAKE_OPTIONS): Remove 1.9, cygnus, add
1630         info-in-builddir no-texinfo.tex.
1631         (info_TEXINFOS): Rename bfd.texinfo to bfd.texi.
1632         * doc/bfd.texinfo: Rename to ...
1633         * doc/bfd.texi: ... this.
1634         * Makefile.in: Re-generate.
1635         * aclocal.m4: Re-generate.
1636         * config.in: Re-generate.
1637         * configure: Re-generate.
1638         * doc/Makefile.in: Re-generate.
1639
1640 2018-06-18  Mephi  <mephi42@gmail.com>
1641
1642         PR 23297
1643         * mach-o-x86-64.c (x86_64_howto_table): Add entry for
1644         BFD_RELOC_MACH_O_X86_64_RELOC_TLV.
1645         (bfd_mach_o_x86_64_canonicalize_one_reloc): Handle the new reloc.
1646         (bfd_mach_o_x86_64_swap_reloc_out): Likewise.
1647         * reloc.c (BFD_RELOC_MACH_O_X86_64_TV): New entry.
1648         * bfd-in2.h: Regenerate.
1649         * libbfd.h: Regenerate.
1650
1651 2018-06-14  Faraz Shahbazker  <Faraz.Shahbazker@mips.com>
1652
1653         * elfxx-mips.c (print_mips_ases): Add GINV extension.
1654
1655 2018-06-14  H.J. Lu  <hongjiu.lu@intel.com>
1656
1657         PR binutils/23267
1658         * elf.c (_bfd_elf_get_symbol_version_string): Check if the first
1659         symbol version is base version.
1660
1661 2018-06-14  Alan Modra  <amodra@gmail.com>
1662
1663         * elf-bfd.h (struct elf_link_hash_table): Add "dynamic_relocs".
1664         * elflink.c (_bfd_elf_init_2_index_sections): Comment fix.
1665         (_bfd_elf_add_dynamic_entry): Set "dynamic_relocs".
1666         (_bfd_elf_link_renumber_dynsyms): Exclude all section symbols when
1667         "dynamic_relocs" is not set.
1668         * elfxx-mips.c (count_section_dynsyms): Likewise.
1669
1670 2018-06-14  Alan Modra  <amodra@gmail.com>
1671
1672         PR 23282
1673         * bfdio.c (bfd_seek): Optimize away seeks to current position.
1674
1675 2018-06-13  Scott Egerton  <scott.egerton@imgtec.com>
1676             Faraz Shahbazker  <Faraz.Shahbazker@mips.com>
1677
1678         * elfxx-mips.c (print_mips_ases): Add CRC.
1679
1680 2018-06-08  H.J. Lu  <hongjiu.lu@intel.com>
1681
1682         PR ld/23161
1683         * elfxx-x86.c (elf_x86_hide_linker_defined): New function.
1684         (_bfd_x86_elf_link_check_relocs): Use it to hide hidden
1685         __bss_start, _end and _edata in shared libraries.
1686
1687 2018-06-07  Alan Modra  <amodra@gmail.com>
1688
1689         * elf32-tic6x.c (elf32_tic6x_check_relocs): Reference
1690         __c6xabi_DSBT_BASE explicitly for R_C6000_SBR_* relocs.
1691
1692 2018-06-05  Alan Modra  <amodra@gmail.com>
1693
1694         * bfd.c (struct bfd): Update comment on "where" usage.
1695         * bfdio.c (bfd_bwrite, bfd_stat): Use and update "iovec",
1696         "iostream", and "where" from containing archive file.  Return
1697         error on NULL iovec.
1698         (bfd_bread): Similarly, and return error attempted out of
1699         bounds archive element access.
1700         (bfd_tell, bfd_flush): Use and update "iovec", "iostream", and
1701         "where" from containing archive file.
1702         (bfd_seek): Likewise.  Return error on NULL iovec.  Don't
1703         attempt to optimize away seeks.  Don't paper over errors by
1704         calling bfd_tell.
1705         (bfd_get_mtime): Call bfd_stat rather than iovec->bstat.
1706         (bfd_get_size): Likewise.
1707         (bfd_mmap): Operate on and use iovec of containing archive
1708         file.  Return error on NULL iovec.
1709         * cache.c (bfd_cache_lookup_worker): Abort if working on
1710         archive element bfd.
1711         (cache_bread_1): Delete bfd parameter, add FILE* parameter.
1712         Don't ignore zero byte reads.
1713         (cache_bread): Look up FILE* in cache here.  Error on NULL
1714         lookup.
1715         (cache_bwrite): Rename "where" to "from".
1716         (cache_bmmap): Don't handle archive elements.
1717         * coffcode.h (coff_slurp_line_table): Exit early on zero
1718         lineno count.
1719         * bfd-in2.h: Regenerate.
1720
1721 2018-06-05  Alan Modra  <amodra@gmail.com>
1722
1723         PR 23254
1724         * plugin.c (bfd_plugin_open_input): Allow for possibility of
1725         nested archives.  Open file again for plugin.
1726         (try_claim): Don't save and restore file position.  Close file
1727         if not claimed.
1728         * sysdep.h (O_BINARY): Define.
1729
1730 2018-06-04  Max Filippov  <jcmvbkbc@gmail.com>
1731
1732         * elf32-xtensa.c (xtensa_read_table_entries): Make global.
1733         (compute_fill_extra_space): Drop declaration. Rename function to
1734         xtensa_compute_fill_extra_space.
1735         (compute_ebb_actions, remove_dead_literal): Update references to
1736         compute_fill_extra_space.
1737
1738 2018-06-04  Volodymyr Arbatov  <arbatov@cadence.com>
1739
1740         * elf32-xtensa.c (elf32xtensa_separate_props): New global
1741         variable.
1742         (xtensa_add_names): New function.
1743         (xtensa_property_section_name): Add new parameter
1744         separate_sections, use it to choose property section name.
1745         (xtensa_get_separate_property_section): New function.
1746         (xtensa_get_property_section): Invoke
1747         xtensa_get_separate_property_section to get individual property
1748         section if it exists, common property section otherwise.
1749         (xtensa_make_property_section): Pass elf32xtensa_separate_props
1750         to xtensa_property_section_name.
1751
1752 2018-06-04  H.J. Lu  <hongjiu.lu@intel.com>
1753
1754         PR binutils/23146
1755         * bfd-in.h: Include "diagnostics.h".
1756         * bfd-in2.h: Regenerated.
1757         * elf32-arm.c (elf32_arm_nabi_write_core_note): Use
1758         DIAGNOSTIC_PUSH, DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION and
1759         DIAGNOSTIC_POP to silence GCC 8.1 warnings with
1760         -Wstringop-truncation.
1761         * elf32-ppc.c (ppc_elf_write_core_note): Likewse.
1762         * elf32-s390.c (elf_s390_write_core_note): Likewse.
1763         * elf64-ppc.c (ppc64_elf_write_core_note): Likewse.
1764         * elf64-s390.c (elf_s390_write_core_note): Likewse.
1765         * elfxx-aarch64.c (_bfd_aarch64_elf_write_core_note): Likewse.
1766
1767 2018-06-03  Jim Wilson  <jimw@sifive.com>
1768
1769         PR ld/23244
1770         * elfnn-riscv.c (riscv_elf_relocate_section) <R_RISCV_CALL>: Check
1771         for and handle an undefined weak with no PLT.
1772
1773         PR ld/22756
1774         * elfnn-riscv.c (riscv_relax_delete_bytes): Add versioned_hidden check
1775         to code that ignores duplicate symbols.
1776
1777 2018-06-01  H.J. Lu  <hongjiu.lu@intel.com>
1778
1779         * version.m4: Bump version to 2.30.52
1780         * configure: Regenerated.
1781
1782 2018-06-01  Alan Modra  <amodra@gmail.com>
1783
1784         * bfd.c (_bfd_error_handler): Arrange for this function to be
1785         declared in bfd-in2.h.
1786         * libbfd-in.h (_bfd_error_handler): Don't declare.
1787         * libbfd.h: Regenerate.
1788         * bfd-in2.h: Regenerate.
1789
1790 2018-05-30  Amaan Cheval <amaan.cheval@gmail.com>
1791
1792         * config.bfd (x86_64-*-*): Add pei-x86-64 target to x86_64-*-rtems*
1793         This is needed to generate UEFI application image files from ELFs.
1794
1795 2018-05-28  H.J. Lu  <hongjiu.lu@intel.com>
1796
1797         * elf32-i386.c (elf_i386_lazy_plt): Add plt_tlsdesc_entry,
1798         plt_tlsdesc_entry_size, plt_tlsdesc_got1_offset,
1799         plt_tlsdesc_got2_offset, plt_tlsdesc_got1_insn_end and
1800         plt_tlsdesc_got2_insn_end for TLSDESC entry.
1801         (elf_i386_lazy_ibt_plt): Likewise.
1802         (elf_i386_nacl_plt): Likewise.
1803         * elf64-x86-64.c (tlsdesc_plt_entry): Moved and renamed to ...
1804         (elf_x86_64_tlsdesc_plt_entry): This.
1805         (elf_x86_64_lazy_plt): Add plt_tlsdesc_entry,
1806         plt_tlsdesc_entry_size, plt_tlsdesc_got1_offset,
1807         plt_tlsdesc_got2_offset, plt_tlsdesc_got1_insn_end and
1808         plt_tlsdesc_got2_insn_end for TLSDESC entry.
1809         (elf_x86_64_lazy_bnd_plt): Likewise.
1810         (elf_x86_64_lazy_ibt_plt): Likewise.
1811         (elf_x32_lazy_ibt_plt): Likewise.
1812         (elf_x86_64_nacl_plt): Likewise.
1813         (elf_x86_64_finish_dynamic_sections): Use plt_tlsdesc_entry,
1814         plt_tlsdesc_entry_size, plt_tlsdesc_got1_offset,
1815         plt_tlsdesc_got2_offset, plt_tlsdesc_got1_insn_end and
1816         plt_tlsdesc_got2_insn_end to update TLSDESC entry.
1817         * elfxx-x86.h (elf_x86_lazy_plt_layout): Update comments.
1818         Add plt_tlsdesc_entry, plt_tlsdesc_entry_size,
1819         plt_tlsdesc_got1_offset, plt_tlsdesc_got2_offset,
1820         plt_tlsdesc_got1_insn_end and plt_tlsdesc_got2_insn_end.
1821         (elf_x86_non_lazy_plt_layout): Update comments.
1822         (elf_x86_plt_layout): Likewise.
1823
1824 2018-05-28  H.J. Lu  <hongjiu.lu@intel.com>
1825
1826         PR ld/23238
1827         * elf-s390-common.c (elf_s390_add_symbol_hook): Removed.
1828         * elf32-arc.c (elf_arc_add_symbol_hook): Likewise.
1829         (elf_backend_add_symbol_hook): Likewise.
1830         * elf32-m68k.c (elf_m68k_add_symbol_hook): Likewise.
1831         (elf_backend_add_symbol_hook): Likewise.
1832         * elf32-s390.c (elf_backend_add_symbol_hook): Likewise.
1833         * elf32-sparc.c (elf32_sparc_add_symbol_hook): Likewise.
1834         (elf_backend_add_symbol_hook): Likewise.
1835         * elf64-s390.c (elf_backend_add_symbol_hook): Likewise.
1836         * elfxx-aarch64.c (_bfd_aarch64_elf_add_symbol_hook): Likewise.
1837         * elfxx-aarch64.h (_bfd_aarch64_elf_add_symbol_hook): Likewise.
1838         (elf_backend_add_symbol_hook): Likewise.
1839         * elf32-arm.c (elf32_arm_add_symbol_hook): Remove STT_GNU_IFUNC
1840         handling.
1841         * elf32-ppc.c (ppc_elf_add_symbol_hook): Likewise.
1842         * elf64-ppc.c (ppc64_elf_add_symbol_hook): Likewise.
1843         * elf64-sparc.c (elf64_sparc_add_symbol_hook): Likewise.
1844         * elflink.c (elf_link_add_object_symbols): Set
1845         elf_gnu_symbol_ifunc for STT_GNU_IFUNC symbols.
1846
1847 2018-05-26  H.J. Lu  <hongjiu.lu@intel.com>
1848
1849         PR ld/23194
1850         * elf-bfd.h (_bfd_elf_link_hide_sym_by_version): New.
1851         * elflink.c (_bfd_elf_link_hide_versioned_symbol): New function.
1852         Extracted from _bfd_elf_link_assign_sym_version.
1853         (_bfd_elf_link_hide_sym_by_version): New function.
1854         (_bfd_elf_link_assign_sym_version): Use
1855         _bfd_elf_link_hide_versioned_symbol.
1856         * elfxx-x86.c (_bfd_x86_elf_link_symbol_references_local): Call
1857         _bfd_elf_link_hide_sym_by_version instead of
1858         bfd_hide_sym_by_version.  Don't check unversioned symbol.
1859
1860 2018-05-25  Alan Modra  <amodra@gmail.com>
1861
1862         * Makefile.in: Regenerate.
1863         * po/SRC-POTFILES.in: Regenerate.
1864
1865 2018-05-25  Alan Modra  <amodra@gmail.com>
1866
1867         * configure.ac (bfd_cv_hidden): Run test with -Werror in CFLAGS.
1868         * configure: Regenerate.
1869
1870 2018-05-23  H.J. Lu  <hongjiu.lu@intel.com>
1871
1872         * elf64-ppc.c (ppc64_elf_write_core_note): Add ATTRIBUTE_NONSTRING
1873         to data.
1874
1875 2018-05-22  Alan Modra  <amodra@gmail.com>
1876
1877         PR 23207
1878         * elf32-hppa.c (hppa_get_stub_entry): Return NULL when link_sec
1879         is NULL.
1880         (elf32_hppa_size_stubs): Only create stubs for load, alloc, code
1881         sections.
1882         (final_link_relocate): Revert last change.
1883
1884 2018-05-22  Alan Modra  <amodra@gmail.com>
1885
1886         PR 23207
1887         * elf32-hppa.c (final_link_relocate): Don't look for plt call
1888         stubs in non-alloc sections.
1889
1890 2018-05-21  H.J. Lu  <hongjiu.lu@intel.com>
1891
1892         PR ld/23201
1893         * aout-target.h (MY_bfd_link_hide_symbol): New.
1894         * aout-tic30.c (MY_bfd_link_hide_symbol): Likewise.
1895         * binary.c (binary_bfd_link_hide_symbol): Likewise.
1896         * coff-alpha.c (_bfd_ecoff_bfd_link_hide_symbol): Likewise.
1897         * coff-mips.c (_bfd_ecoff_bfd_link_hide_symbol): Likewise.
1898         * coff-rs6000.c (_bfd_xcoff_bfd_link_hide_symbol): Likewise.
1899         * coffcode.h (coff_bfd_link_hide_symbol): Likewise.
1900         * elf-bfd.h (_bfd_elf_link_hide_symbol): Likewise.
1901         * elfxx-target.h (bfd_elfNN_bfd_link_hide_symbol): Likewise.
1902         * i386msdos.c (msdos_bfd_link_hide_symbol): Likewise.
1903         * ihex.c (ihex_bfd_link_hide_symbol): Likewise.
1904         * libbfd-in.h (_bfd_nolink_bfd_link_hide_symbol): Likewise.
1905         * linker.c (_bfd_generic_link_hide_symbol): Likewise.
1906         (bfd_link_hide_symbol): Likewise.
1907         * mach-o-target.c (bfd_mach_o_bfd_link_hide_symbol): Likewise.
1908         * mmo.c (mmo_bfd_link_hide_symbol): Likewise.
1909         * pef.c (bfd_pef_bfd_link_hide_symbol): Likewise.
1910         * plugin.c (bfd_plugin_bfd_link_hide_symbol): Likewise.
1911         * ppcboot.c (ppcboot_bfd_link_hide_symbol): Likewise.
1912         * som.c (som_bfd_link_hide_symbol): Likewise.
1913         * srec.c (srec_bfd_link_hide_symbol): Likewise.
1914         * tekhex.c (tekhex_bfd_link_hide_symbol): Likewise.
1915         * vms-alpha.c (vms_bfd_link_hide_symbol): Likewise.
1916         (alpha_vms_bfd_link_hide_symbol): Likewise.
1917         * xsym.c (bfd_sym_bfd_link_hide_symbol): Likewise.
1918         * coff64-rs6000.c (rs6000_xcoff64_vec): Add
1919         _bfd_generic_link_hide_symbol.
1920         (rs6000_xcoff64_aix_vec): Likewise.
1921         * elflink.c (bfd_elf_record_link_assignment): Don't make forced
1922         local symbol dynamic.
1923         (_bfd_elf_link_hide_symbol): New function.
1924         * elfxx-x86.c (_bfd_x86_elf_link_symbol_references_local): Don't
1925         check root.ldscript_def.
1926         * targets.c (bfd_target): Add _bfd_link_hide_symbol.
1927         (BFD_JUMP_TABLE_LINK): Add NAME##_bfd_link_hide_symbol.
1928         * bfd-in2.h: Regenerated.
1929         * libbfd.h: Likewise.
1930
1931 2018-05-21  H.J. Lu  <hongjiu.lu@intel.com>
1932
1933         PR binutils/23199
1934         * elf.c (setup_group): Mark section in a section group with
1935         SHF_GROUP.
1936
1937 2018-05-18  H.J. Lu  <hongjiu.lu@intel.com>
1938
1939         PR ld/23194
1940         * elfxx-x86.c (_bfd_x86_elf_link_symbol_references_local): Don't
1941         set eh->local_ref to 1 if a symbol is versioned and there is a
1942         version script.
1943
1944 2018-05-18  Kito Cheng  <kito.cheng@gmail.com>
1945
1946         * elfnn-riscv.c (_bfd_riscv_elf_merge_private_bfd_data): Handle
1947         EF_RISCV_RVE.
1948
1949 2018-05-18  Jim Wilson  <jimw@sifive.com>
1950
1951         * elfnn-riscv.c (allocate_dynrelocs): Discard dynamic relocations if
1952         UNDEFWEAK_NO_DYNAMIC_RELOC is true.
1953         (riscv_elf_relocate_section): Don't generate dynamic relocation if
1954         UNDEFWEAK_NO_DYNAMIC_RELOC is true.
1955         (riscv_elf_finish_dynamic_symbol): Likewise.
1956
1957 2018-05-18  John Darrington  <john@darrington.wattle.id.au>
1958
1959         * Makefile.am: Add s12z files.
1960         * Makefile.in: Regenerate.
1961         * archures.c: Add bfd_s12z_arch.
1962         * bfd-in.h: Add exports of bfd_putb24 and bfd_putl24.
1963         * bfd-in2.h: Regenerate.
1964         * config.bfd: Add s12z target.
1965         * configure.ac: Add s12z target.
1966         * configure: Regenerate.
1967         * cpu-s12z.c: New file.
1968         * elf32-s12z.c: New file.
1969         * libbfd.c (bfd_putb24): New function.
1970         (bfd_putl24): New function.
1971         * libbfd.h: Regenerate.
1972         * reloc.c: Add s12z relocations.
1973         (bfd_get_reloc_size): Handle size 5 relocs.
1974         * targets.c: Add s12z_elf32_vec.
1975
1976 2018-05-18  H.J. Lu  <hongjiu.lu@intel.com>
1977
1978         PR ld/23189
1979         * elf32-i386.c (elf_i386_relocate_section): Handle R_386_GOT32X
1980         like R_386_GOT32.
1981         * elfxx-x86.c (_bfd_x86_elf_link_symbol_references_local): Don't
1982         set eh->local_ref to 1 for linker defined symbols.
1983
1984 2018-05-18  Alan Modra  <amodra@gmail.com>
1985
1986         PR 23199
1987         * elf.c (setup_group): Formatting.  Check that SHT_GROUP entries
1988         don't point at other SHT_GROUP sections.  Set shdr corresponding
1989         to invalid entry, to NULL rather than section 0.  Identify
1990         SHT_GROUP section index when reporting an error.  Cope with NULL
1991         shdr pointer.
1992
1993 2018-05-18  Alan Modra  <amodra@gmail.com>
1994
1995         * libbfd-in.h (ATTRIBUTE_HIDDEN): Define and use throughout.
1996         * configure.ac (HAVE_HIDDEN): Check compiler support for hidden
1997         visibility.
1998         * libbfd.h: Regenerate.
1999         * configure: Regenerate.
2000         * config.in: Regenerate.
2001
2002 2018-05-18  Alan Modra  <amodra@gmail.com>
2003
2004         * libbfd-in.h: Add include guard.
2005         * libcoff-in.h: Likewise.
2006         * doc/Makefile.am (libbfd.h, libcoff.h): Append another #endif.
2007         * doc/Makefile.in: Regenerate.
2008         * libbfd.h: Regenerate.
2009         * libcoff.h: Regenerate.
2010
2011 2018-05-16  Maciej W. Rozycki  <macro@mips.com>
2012
2013         * elf32-nds32.c (nds32_convert_32_to_16): Preset `insn_type'.
2014
2015 2018-05-16  Alan Modra  <amodra@gmail.com>
2016
2017         PR 22458
2018         * format.c (struct bfd_preserve): Add section_id.
2019         (bfd_preserve_save, bfd_preserve_restore): Save and restore
2020         _bfd_section_id.
2021         (bfd_reinit): Set _bfd_section_id.
2022         (bfd_check_format_matches): Put all matches of any priority into
2023         matching_vector.  Save initial section id and start each attempted
2024         match at that section id.
2025         * libbfd-in.h (_bfd_section_id): Declare.
2026         * section.c (_bfd_section_id): Rename from section_id and make
2027         global.  Adjust uses.
2028         (bfd_get_next_section_id): Delete.
2029         * elf64-ppc.c (ppc64_elf_setup_section_lists): Replace use of
2030         bfd_get_section_id with _bfd_section_id.
2031         * libbfd.h: Regenerate.
2032         * bfd-in2.h: Regenerate.
2033
2034 2018-05-15  Christophe Guillon  <christophe.guillon@st.com>
2035
2036         * coffcode.h (coff_bigobj_swap_aux_in): Make sure that all fields
2037         of the aux structure are initialised.
2038
2039 2018-05-15  Francois H. Theron  <francois.theron@netronome.com>
2040
2041         * targets.c: Wrap nfp_elf64_vec in BFD64 ifdef.
2042
2043 2018-05-15  Nick Clifton  <nickc@redhat.com>
2044
2045         * po/pt.po: New Portuguese translation.
2046         * configure.ac (ALL_LINGUAS): Add pt.
2047         * configure: Regenerate.
2048
2049 2018-05-14  H.J. Lu  <hongjiu.lu@intel.com>
2050
2051         PR ld/23169
2052         * elf-ifunc.c (_bfd_elf_allocate_ifunc_dyn_relocs): Don't issue
2053         an error on IFUNC pointer defined in PDE.
2054         * elf32-i386.c (elf_i386_finish_dynamic_symbol): Call
2055         _bfd_x86_elf_link_fixup_ifunc_symbol.
2056         * elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Likewise.
2057         * elfxx-x86.c (_bfd_x86_elf_link_fixup_ifunc_symbol): New
2058         function.
2059         * elfxx-x86.h (_bfd_x86_elf_link_fixup_ifunc_symbol): New.
2060
2061 2018-05-14  H.J. Lu  <hongjiu.lu@intel.com>
2062
2063         PR ld/23162
2064         * elfxx-x86.c (elf_x86_linker_defined): New function.
2065         (_bfd_x86_elf_link_check_relocs): Use it to mark __bss_start,
2066         _end and _edata locally defined within executables.
2067
2068 2018-05-12  Alan Modra  <amodra@gmail.com>
2069
2070         PR 20659
2071         * elf.c (rewrite_elf_program_header): Use segment_mark only for
2072         PT_LOAD headers.  Delete first_matching_lma and first_suggested_lma.
2073         Instead make matching_lma and suggested_lma pointers to the
2074         sections.  Align section vma and lma calculated from segment.
2075         Don't clear includes_phdrs or includes_filehdr based on p_paddr
2076         test.  Try to handle alignment padding before first section by
2077         adjusting new segment lma down.  Adjust PT_PHDR map p_paddr.
2078
2079 2018-05-09  Dimitar Dimitrov  <dimitar@dinux.eu>
2080
2081         * elf32-pru.c (pru_elf32_do_ldi32_relocate): Make LDI32 relocation
2082         conformant to TI ABI.
2083         (pru_elf32_relax_section): Likewise.
2084         (pru_elf_relax_delete_bytes): Fix offsets for new LDI32 code.
2085         * elf32-pru.c (pru_elf32_do_ldi32_relocate): Ignore addend.
2086         (pru_elf32_pmem_relocate): Trap - should not get here.
2087         (pru_elf32_relocate_section): Add support for REL relocations.
2088         (elf_info_to_howto_rel): Enable REL.
2089         (elf_backend_may_use_rel_p): Likewise.
2090         (elf_backend_may_use_rela_p): Likewise.
2091         (elf_backend_default_use_rela_p): Likewise.
2092
2093 2018-05-09  Alan Modra  <amodra@gmail.com>
2094
2095         PR 23148
2096         * peXXigen.c (pe_print_edata): Correct minimum size.
2097
2098 2018-05-09  Alan Modra  <amodra@gmail.com>
2099
2100         PR 23147
2101         * peXXigen.c (pe_print_idata): Bound check hint_addr.
2102
2103 2018-05-08  Nick Clifton  <nickc@redhat.com>
2104
2105         PR 22809
2106         * elf.c (bfd_elf_get_str_section): Check for an excessively large
2107         string section.
2108         * elf-attrs.c (_bfd_elf_parse_attributes): Issue an error if the
2109         attribute section is larger than the size of the file.
2110
2111 2018-05-07  Alan Modra  <amodra@gmail.com>
2112
2113         * cofflink.c (_bfd_coff_link_input_bfd): Use memcmp rather than
2114         strncmp when checking for ".bf" special symbol.
2115         * peXXigen.c (_bfd_XXi_swap_scnhdr_out): Make pe_required_section_flags
2116         section name a char array, remove sentinal known_sections entry,
2117         and adjust loop over known_sections to suit.  Use memcmp rather
2118         than strncmp.
2119
2120 2018-05-04  Alan Modra  <amodra@gmail.com>
2121
2122         * elf-linux-core.h (struct elf_external_linux_prpsinfo32_ugid32),
2123         (struct elf_external_linux_prpsinfo32_ugid16),
2124         (struct elf_external_linux_prpsinfo64_ugid32),
2125         (struct elf_external_linux_prpsinfo64_ugid16): Add ATTRIBUTE_NONSTRING
2126         to pr_fname and pr_psargs fields.  Remove GCC diagnostic pragmas.
2127         Move comment to..
2128         * elf.c (elfcore_write_prpsinfo): ..here.  Indent nested preprocessor
2129         directives.
2130         * elf32-arm.c (elf32_arm_nabi_write_core_note): Add ATTRIBUTE_NONSTRING
2131         to data.
2132         * elf32-ppc.c (ppc_elf_write_core_note): Likewise.
2133         * elf32-s390.c (elf_s390_write_core_note): Likewise.
2134         * elf64-s390.c (elf_s390_write_core_note): Likewise.
2135         * elfxx-aarch64.c (_bfd_aarch64_elf_write_core_note): Likewise.
2136         * elf64-x86-64.c (elf_x86_64_write_core_note): Add GCC diagnostic
2137         pragmas.
2138         * peXXigen.c (_bfd_XXi_swap_scnhdr_out): Use strnlen to avoid
2139         false positive gcc-8 warning.
2140         * cofflink.c (_bfd_coff_link_input_bfd): Likewise.
2141
2142 2018-05-04  Tulio Magno Quites Machado Filho  <tuliom@linux.ibm.com>
2143
2144         * elf32-ppc.c (_bfd_elf_ppc_merge_fp_attributes): Fix the order
2145         of arguments when warning about different long double types.
2146
2147 2018-05-03  Simon Atanasyan  <simon@atanasyan.com>
2148
2149         * elf32-mips.c: (elf32_mips_fixup_symbol): New function.
2150         (elf_backend_fixup_symbol): New macro.
2151         * elfxx-mips.c: (mips_elf_output_extsym): Discard _gp_disp
2152         handling.
2153         (_bfd_mips_elf_finish_dynamic_symbol): Likewise.
2154
2155 2018-04-30  Francois H. Theron <francois.theron@netronome.com>
2156
2157         * Makefile.am: Added NFP files to build.
2158         * archures.c: Added bfd_arch_nfp
2159         * config.bfd: Added NFP support.
2160         * configure.ac: Added NFP support.
2161         * cpu-nfp.c: New, for NFP support.
2162         * elf-bfd.h: Added elf_section_info()
2163         * elf64-nfp.c: New, for NFP support.
2164         * po/SRC-POTFILES.in: Added NFP source files.
2165         * targets.c: Added nfp_elf64_vec
2166         * bfd-in2.h: Regenerate.
2167         * Makefile.in: Regenerate.
2168         * configure: Regenerate.
2169
2170 2018-04-27  Alan Modra  <amodra@gmail.com>
2171
2172         * bfd-in2.h: Regenerate.
2173         * libbfd.h: Regenerate.
2174
2175 2018-04-27  Alan Modra  <amodra@gmail.com>
2176
2177         PR 23123
2178         PR 22374
2179         * elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Don't drop plt
2180         relocs for ifuncs.
2181         * elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Comment fixes.
2182
2183 2018-04-26  Pedro Alves  <palves@redhat.com>
2184
2185         * elf64-ppc.c (ppc64_elf_get_synthetic_symtab): Don't consider
2186         ifunc and non-ifunc symbols duplicates.
2187
2188 2018-04-25  Christophe Lyon  <christophe.lyon@st.com>
2189         Mickaël Guêné  <mickael.guene@st.com>
2190
2191         * elf32-arm.c (elf32_arm_fdpic_thumb_plt_entry): New.
2192         (elf32_arm_plt_needs_thumb_stub_p): Handle thumb-only case.
2193         (elf32_arm_populate_plt_entry): Likewise.
2194         (elf32_arm_output_plt_map_1): Likewise.
2195         (elf32_arm_output_arch_local_syms): Likewise.
2196
2197 2018-04-25  Christophe Lyon  <christophe.lyon@st.com>
2198         Mickaël Guêné  <mickael.guene@st.com>
2199
2200         * elf32-arm.c (elf32_arm_finish_dynamic_symbol): Handle
2201         _GLOBAL_OFFSET_TABLE_ in FDPIC mode.
2202
2203 2018-04-25  Christophe Lyon  <christophe.lyon@st.com>
2204         Mickaël Guêné  <mickael.guene@st.com>
2205
2206         * elf32-arm.c (bfd_elf32_arm_set_target_params): Handle FDPIC case
2207         for R_ARM_TARGET2.
2208
2209 2018-04-25  Christophe Lyon  <christophe.lyon@st.com>
2210         Mickaël Guêné  <mickael.guene@st.com>
2211
2212         * elf32-arm.c (DEFAULT_STACK_SIZE): New.
2213         (elf32_arm_always_size_sections): Create stack segment.
2214
2215 2018-04-25  Christophe Lyon  <christophe.lyon@st.com>
2216         Mickaël Guêné  <mickael.guene@st.com>
2217
2218         * bfd-in2.h (BFD_RELOC_ARM_TLS_GD32_FDPIC)
2219         (BFD_RELOC_ARM_TLS_LDM32_FDPIC, BFD_RELOC_ARM_TLS_IE32_FDPIC): New
2220         relocations.
2221         * elf32-arm.c (elf32_arm_howto_table_2): Add R_ARM_TLS_GD32_FDPIC,
2222         R_ARM_TLS_LDM32_FDPIC, R_ARM_TLS_IE32_FDPIC relocations.
2223         (elf32_arm_reloc_map): Add R_ARM_TLS_GD32_FDPIC,
2224         R_ARM_TLS_LDM32_FDPIC, R_ARM_TLS_IE32_FDPIC.
2225         (struct elf32_arm_link_hash_table): Update comment.
2226         (elf32_arm_final_link_relocate): Handle TLS FDPIC relocations.
2227         (IS_ARM_TLS_RELOC): Likewise.
2228         (elf32_arm_check_relocs): Likewise.
2229         (allocate_dynrelocs_for_symbol): Likewise.
2230         (elf32_arm_size_dynamic_sections): Update comment.
2231         * reloc.c: Add BFD_RELOC_ARM_TLS_GD32_FDPIC,
2232         BFD_RELOC_ARM_TLS_LDM32_FDPIC, BFD_RELOC_ARM_TLS_IE32_FDPIC.
2233
2234 2018-04-25  Christophe Lyon  <christophe.lyon@st.com>
2235         Mickaël Guêné  <mickael.guene@st.com>
2236
2237         * elf32-arm.c (elf32_arm_fdpic_plt_entry): New.
2238         (elf32_arm_create_dynamic_sections): Handle FDPIC.
2239         (elf32_arm_allocate_plt_entry): Likewise.
2240         (elf32_arm_populate_plt_entry): Likewise.
2241         (elf32_arm_output_plt_map_1): Likewise.
2242
2243 2018-04-25  Christophe Lyon  <christophe.lyon@st.com>
2244         Mickaël Guêné  <mickael.guene@st.com>
2245
2246         * elf32-arm.c (struct fdpic_local): New.
2247         (elf_arm_obj_tdata): Add local_fdpic_cnts field.
2248         (elf32_arm_local_fdpic_cnts): New.
2249         (struct fdpic_global): New.
2250         (elf32_arm_link_hash_entry): Add fdpic_cnts field.
2251         (elf32_arm_link_hash_table): Add srofixup field.
2252         (arm_elf_add_rofixup): New.
2253         (arm_elf_fill_funcdesc): New.
2254         (elf32_arm_link_hash_newfunc): Handle fdpic_cnts.
2255         (elf32_arm_allocate_local_sym_info): Likewise.
2256         (create_got_section): Create .rofixup section.
2257         (elf32_arm_copy_indirect_symbol): Handle fdpic_cnts.
2258         (bfd_elf32_arm_set_target_params): Handle FDPIC.
2259         (elf32_arm_final_link_relocate): Likewise.
2260         (elf32_arm_check_relocs): Likewise.
2261         (allocate_dynrelocs_for_symbol): Likewise.
2262         (elf32_arm_size_dynamic_sections): Likewise.
2263         (elf32_arm_finish_dynamic_sections): Likewise.
2264         (elf32_arm_output_arch_local_syms): Likewise.
2265         (elf32_arm_fdpic_omit_section_dynsym): New.
2266
2267 2018-04-25  Christophe Lyon  <christophe.lyon@st.com>
2268         Mickaël Guêné  <mickael.guene@st.com>
2269
2270         * bfd-in2.c (BFD_RELOC_ARM_GOTFUNCDESC)
2271         (BFD_RELOC_ARM_GOTOFFFUNCDESC, BFD_RELOC_ARM_FUNCDESC)
2272         (BFD_RELOC_ARM_FUNCDESC_VALUE): New.
2273         * elf32-arm.c (elf32_arm_howto_table_2): Add R_ARM_GOTFUNCDESC,
2274         R_ARM_GOTOFFFUNCDESC, R_ARM_FUNCDESC, R_ARM_FUNCDESC_VALUE.
2275         (elf32_arm_howto_from_type): Take new members of
2276         elf32_arm_howto_table_2 into account.
2277         (elf32_arm_reloc_map): Add BFD_RELOC_ARM_GOTFUNCDESC,
2278         BFD_RELOC_ARM_GOTOFFFUNCDESC, BFD_RELOC_ARM_FUNCDESC,
2279         BFD_RELOC_ARM_FUNCDESC_VALUE.
2280         * reloc.c: Add BFD_RELOC_ARM_GOTFUNCDESC,
2281         BFD_RELOC_ARM_GOTOFFFUNCDESC, BFD_RELOC_ARM_FUNCDESC,
2282         BFD_RELOC_ARM_FUNCDESC_VALUE.
2283
2284 2018-04-25  Christophe Lyon  <christophe.lyon@st.com>
2285         Mickaël Guêné  <mickael.guene@st.com>
2286
2287         * elf32-arm.c (elf32_arm_print_private_bfd_data): Support
2288         EF_ARM_PIC and ELFOSABI_ARM_FDPIC.
2289         (elf32_arm_post_process_headers): Support ELFOSABI_ARM_FDPIC.
2290         (ELF_OSABI): Define to ELFOSABI_ARM_FDPIC.
2291
2292 2018-04-25  Christophe Lyon  <christophe.lyon@st.com>
2293         Mickaël Guêné  <mickael.guene@st.com>
2294
2295         * config.bfd (arm*-*-linux-*): Add arm_elf32_fdpic_be_vec and
2296         arm_elf32_fdpic_le_vec to targ_selvecs. Accept
2297         arm*-*-uclinuxfdpiceabi.
2298         * configure.ac: Add support for arm_elf32_fdpic_be_vec and
2299         arm_elf32_fdpic_le_vec.
2300         * configure: Regenerate.
2301         * elf32-arm.c (struct elf32_arm_link_hash_table): Add fdpic_p.
2302         (elf32_arm_link_hash_table_create): Initialize fdpic_p.
2303         (TARGET_LITTLE_SYM, TARGET_LITTLE_NAME, TARGET_BIG_SYM)
2304         (TARGET_BIG_NAME, elf_match_priority): Define for FDPIC targets.
2305         (elf32_arm_fdpic_link_hash_table_create): New.
2306         * targets.c (_bfd_target_vector): Add arm_elf32_fdpic_be_vec and
2307         arm_elf32_fdpic_le_vec.
2308
2309 2018-04-25  Alan Modra  <amodra@gmail.com>
2310
2311         * elf-linux-core.h: Disable gcc-8 string truncation warning.
2312         * elf.c (elfcore_write_prpsinfo): Likewise.
2313
2314 2018-04-25  Alan Modra  <amodra@gmail.com>
2315
2316         * Makefile.am: Remove arm-aout and arm-coff support.
2317         * config.bfd: Likewise.
2318         * configure.ac: Likewise.
2319         * targets.c: Likewise.
2320         * aout-arm.c: Delete.
2321         * armnetbsd.c: Delete.
2322         * riscix.c: Delete.
2323         * Makefile.in: Regenerate.
2324         * configure: Regenerate.
2325         * po/SRC-POTFILES.in: Regenerate.
2326
2327 2018-04-24  Nick Clifton  <nickc@redhat.com>
2328
2329         PR 23113
2330         * elf.c (ignore_section_sym): Check for the output_section pointer
2331         being NULL before dereferencing it.
2332
2333         PR 23110
2334         * peXXigen.c (_bfd_XX_bfd_copy_private_bfd_data_common): Check for
2335         a negative PE_DEBUG_DATA size before iterating over the debug data.
2336
2337 2018-04-23  Alan Modra  <amodra@gmail.com>
2338
2339         * elf-linux-core.h: Revert last change.
2340         * elf.c: Likewise.
2341
2342 2018-04-23  Nick Clifton  <nickc@redhat.com>
2343
2344         PR 23056
2345         * aoutx.h (aout_get_external_symbols): Allocate an extra byte at
2346         the end of the string table, and zero it.
2347
2348 2018-04-23  Alan Modra  <amodra@gmail.com>
2349
2350         * elf-linux-core.h (swap_linux_prpsinfo32_ugid32_out): Disable
2351         gcc-8 string truncation warning.
2352         (swap_linux_prpsinfo32_ugid16_out): Likewise.
2353         (swap_linux_prpsinfo64_ugid32_out): Likewise.
2354         (swap_linux_prpsinfo64_ugid16_out): Likewise.
2355         * elf.c (elfcore_write_prpsinfo): Likewise.
2356
2357 2018-04-23  Nick Clifton  <nickc@redhat.com>
2358
2359         PR 23056
2360         * aoutx.h (aout_get_external_symbols): Allocate an extra byte at
2361         the end of the string table, and zero it.
2362
2363 2018-04-20  Alan Modra  <amodra@gmail.com>
2364
2365         PR 22978
2366         * elf32-hppa.c (got_relocs_needed): Add extra param to special
2367         case both dtprel and tprel relocs.
2368         (allocate_dynrelocs): Adjust conditions for got relocs.
2369         (elf32_hppa_relocate_section): Likewise for local sym got relocs.
2370         Emit dynamic relocs on TLS GOT entries for shared libraries,
2371         not when pic.  Omit dynamic reloc on dtprel entry when local,
2372         and on tprel entry when local and executable.
2373
2374 2018-04-19  Alan Modra  <amodra@gmail.com>
2375
2376         PR 22537
2377         * elf32-hppa.c (elf32_hppa_size_stubs): Init "destination" to -1.
2378         (hppa_type_of_stub): Don't return a long branch stub for
2379         symbols other than those defined statically.
2380
2381 2018-04-19  Alan Modra  <amodra@gmail.com>
2382
2383         * Makefile.am: Revert 2018-04-18 coff-mips changes.
2384         * config.bfd: Add back mips_ecoff_le_vec and mips_ecoff_be_vec
2385         to selvecs for mips targets change 2018-04-18.
2386         * configure.ac: Reinstate mips_ecoff_le_vec, mips_ecoff_be_vec
2387         and  mips_ecoff_bele_vec.
2388         * targets.c: Likewise.
2389         * coff-mips.c: Resurrect.
2390         * Makefile.in: Regenerate.
2391         * configure: Regenerate.
2392         * po/SRC-POTFILES.in: Regenerate.
2393
2394 2018-04-18  Alan Modra  <amodra@gmail.com>
2395
2396         * Makefile.am: Remove mips aout and coff support.
2397         * config.bfd: Likewise.
2398         * configure.ac: Likewise.
2399         * targets.c: Likewise.
2400         * coff-mips.c: Delete
2401         * mipsbsd.c: Delete
2402         * pe-mips.c: Delete
2403         * pei-mips.c: Delete
2404         * Makefile.in: Regenerate.
2405         * configure: Regenerate.
2406         * po/SRC-POTFILES.in: Regenerate.
2407
2408 2018-04-17  H.J. Lu  <hongjiu.lu@intel.com>
2409
2410         * elf32-i386.c (elf32_bed): Define before including
2411         "elf32-target.h".
2412         * elf64-x86-64.c (elf64_bed): Define before including
2413         "elf64-target.h".
2414         (elf32_bed): Define before including "elf32-target.h".
2415
2416 2018-04-17  H.J. Lu  <hongjiu.lu@intel.com>
2417
2418         PR ld/23055
2419         * elfxx-x86.c (_bfd_x86_elf_link_setup_gnu_properties): Use a
2420         normal input file with compatible relocation.
2421
2422 2018-04-18  Alan Modra  <amodra@gmail.com>
2423
2424         * Makefile.am: Remove support for assorted i386 aout and coff targets.
2425         * config.bfd: Likewise.
2426         * configure.ac: Likewise.
2427         * doc/bfdint.texi: Likewise.
2428         * targets.c: Likewise.
2429         * freebsd.h: Delete.
2430         * i386dynix.c: Delete.
2431         * i386freebsd.c: Delete.
2432         * i386linux.c: Delete.
2433         * i386mach3.c: Delete.
2434         * i386netbsd.c: Delete.
2435         * i386os9k.c: Delete.
2436         * Makefile.in: Regenerate.
2437         * configure: Regenerate.
2438         * po/SRC-POTFILES.in: Regenerate.
2439
2440 2018-04-17 Andrew Sadek  <andrew.sadek.se@gmail.com>
2441
2442         Microblaze Target: PIC data text relative
2443
2444         * bfd/reloc.c (2 new BFD relocations):
2445         BFD_RELOC_MICROBLAZE_64_TEXTPCREL &
2446         BFD_RELOC_MICROBLAZE_64_TEXTPCREL
2447         * bfd/bfd-in2.h: Regenerate
2448         * bfd/libbfd.h: Regenerate
2449         * bfd/elf32-microblaze.c (Handle new relocs): define 'HOWTO' of 3
2450         new relocs and handle them in both relocate and relax functions.
2451         (microblaze_elf_reloc_type_lookup): add mapping between for new
2452         bfd relocs.
2453         (microblaze_elf_relocate_section): Handle new relocs in case of
2454         elf relocation.
2455         (microblaze_elf_relax_section): Handle new relocs for elf relaxation.
2456
2457 2018-04-17  Nick Clifton  <nickc@redhat.com>
2458
2459         PR 23055
2460         * aoutx.h (find_nearest_line): Check that the symbol name exists
2461         and is long enough, before attempting to see if it is for a .o
2462         file.
2463         * hash.c (bfd_hash_hash): Add an assertion that the string is not
2464         NULL.
2465         * linker.c (bfd_link_hash_lookup): Fail if the table or string are
2466         NULL.
2467         (_bfd_generic_link_add_archive_symbols): Fail if an archive entry
2468         has no name.
2469
2470         PR 23065
2471         * dwarf2.c (concat_filename): Check for a NULL table pointer.
2472
2473 2018-04-16  Nick Clifton  <nickc@redhat.com>
2474
2475         PR 23061
2476         * coffgen.c (coff_pointerize_aux): Check for an out of range
2477         fixup.
2478
2479 2018-04-16  Alan Modra  <amodra@gmail.com>
2480
2481         * Makefile.am: Remove arm-epoc-pe support.
2482         * coff-arm.c: Likewise.
2483         * config.bfd: Likewise.
2484         * configure.ac: Likewise.
2485         * targets.c: Likewise.
2486         * epoc-pe-arm.c: Delete.
2487         * epoc-pei-arm.c: Delete.
2488         * Makefile.in: Regenerate.
2489         * configure: Regenerate.
2490         * po/SRC-POTFILES.in: Regenerate.
2491
2492 2018-04-16  Alan Modra  <amodra@gmail.com>
2493
2494         * Makefile.am: Remove sparc-aout and sparc-coff support.
2495         * config.bfd: Likewise.
2496         * configure.ac: Likewise.
2497         * targets.c: Likewise.
2498         * aout-sparcle.c: Delete.
2499         * aoutf1.h: Delete.
2500         * cf-sparclynx.c: Delete.
2501         * coff-sparc.c: Delete.
2502         * demo64.c: Delete.
2503         * sparclinux.c: Delete.
2504         * sparclynx.c: Delete.
2505         * sparcnetbsd.c: Delete.
2506         * sunos.c: Delete.
2507         * Makefile.in: Regenerate.
2508         * configure: Regenerate.
2509         * po/SRC-POTFILES.in: Regenerate.
2510
2511 2018-04-16  Alan Modra  <amodra@gmail.com>
2512
2513         * Makefile.am: Remove m68k-aout and m68k-coff support.
2514         * aoutf1.h: Likewise.
2515         * aoutx.h: Likewise.
2516         * archive.c: Likewise.
2517         * bfd-in.h: Likewise.
2518         * bfd.c: Likewise.
2519         * coffcode.h: Likewise.
2520         * coffswap.h: Likewise.
2521         * config.bfd: Likewise.
2522         * configure.ac: Likewise.
2523         * configure.host: Likewise.
2524         * doc/bfd.texinfo: Likewise.
2525         * doc/bfdint.texi: Likewise.
2526         * freebsd.h: Likewise.
2527         * gen-aout.c: Likewise.
2528         * hpux-core.c: Likewise.
2529         * libaout.h: Likewise.
2530         * libbfd-in.h: Likewise.
2531         * pdp11.c: Likewise.
2532         * peicode.h: Likewise.
2533         * riscix.c: Likewise.
2534         * targets.c: Likewise.
2535         * aout0.c: Delete.
2536         * coff-apollo.c: Delete.
2537         * coff-aux.c: Delete.
2538         * coff-m68k.c: Delete.
2539         * coff-svm68k.c: Delete.
2540         * coff-u68k.c: Delete.
2541         * hosts/delta68.h: Delete.
2542         * hosts/hp300bsd.h: Delete.
2543         * hosts/m68kaux.h: Delete.
2544         * hosts/news.h: Delete.
2545         * hp300bsd.c: Delete.
2546         * hp300hpux.c: Delete.
2547         * liboasys.h: Delete.
2548         * m68k4knetbsd.c: Delete.
2549         * m68klinux.c: Delete.
2550         * m68knetbsd.c: Delete.
2551         * oasys.c: Delete.
2552         * versados.c: Delete.
2553         * Makefile.in: Regenerate.
2554         * bfd-in2.h: Regenerate.
2555         * configure: Regenerate.
2556         * libbfd.h: Regenerate.
2557         * po/SRC-POTFILES.in: Regenerate.
2558
2559 2018-04-16  Alan Modra  <amodra@gmail.com>
2560
2561         * Makefile.am: Remove sh5 and sh64 support.
2562         * archures.c: Likewise.
2563         * config.bfd: Likewise.
2564         * configure.ac: Likewise.
2565         * cpu-sh.c: Likewise.
2566         * elf32-sh-relocs.h: Likewise.
2567         * elf32-sh.c: Likewise.
2568         * targets.c: Likewise.
2569         * elf32-sh64-com.c: Delete.
2570         * elf32-sh64.c: Delete.
2571         * elf32-sh64.h: Delete.
2572         * elf64-sh64.c: Delete.
2573         * Makefile.in: Regenerate.
2574         * bfd-in2.h: Regenerate.
2575         * configure: Regenerate.
2576         * po/SRC-POTFILES.in: Regenerate.
2577
2578 2018-04-16  Alan Modra  <amodra@gmail.com>
2579
2580         * Makefile.am: Remove sh-symbianelf support.
2581         * config.bfd: Likewise.
2582         * configure.ac: Likewise.
2583         * targets.c: Likewise.
2584         * elf32-sh-symbian.c: Delete.
2585         * Makefile.in: Regenerate.
2586         * configure: Regenerate.
2587         * po/SRC-POTFILES.in: Regenerate.
2588
2589 2018-04-16  Alan Modra  <amodra@gmail.com>
2590
2591         * Makefile.am: Remove vax-bsd and vax-ultrix support.
2592         * config.bfd: Likewise.
2593         * configure.ac: Likewise.
2594         * targets.c: Likewise.
2595         * vaxbsd.c: Delete.
2596         * Makefile.in: Regenerate.
2597         * configure: Regenerate.
2598         * po/SRC-POTFILES.in: Regenerate.
2599
2600 2018-04-16  Alan Modra  <amodra@gmail.com>
2601
2602         * Makefile.am: Remove w65 support.
2603         * archures.c: Likewise.
2604         * coffcode.h: Likewise.
2605         * config.bfd: Likewise.
2606         * configure.ac: Likewise.
2607         * targets.c: Likewise.
2608         * coff-w65.c: Delete.
2609         * cpu-w65.c: Delete.
2610         * Makefile.in: Regenerate.
2611         * bfd-in2.h: Regenerate.
2612         * configure: Regenerate.
2613         * po/SRC-POTFILES.in: Regenerate.
2614
2615 2018-04-16  Alan Modra  <amodra@gmail.com>
2616
2617         * Makefile.am: Remove we32k support.
2618         * archures.c: Likewise.
2619         * coffcode.h: Likewise.
2620         * config.bfd: Likewise.
2621         * configure.ac: Likewise.
2622         * targets.c: Likewise.
2623         * coff-we32k.c: Delete.
2624         * cpu-we32k.c: Delete.
2625         * Makefile.in: Regenerate.
2626         * bfd-in2.h: Regenerate.
2627         * configure: Regenerate.
2628         * po/SRC-POTFILES.in: Regenerate.
2629
2630 2018-04-16  Alan Modra  <amodra@gmail.com>
2631
2632         * Makefile.am: Remove m88k support.
2633         * aoutx.h: Likewise.
2634         * archures.c: Likewise.
2635         * coffcode.h: Likewise.
2636         * coffswap.h: Likewise.
2637         * config.bfd: Likewise.
2638         * configure.ac: Likewise.
2639         * cpu-ns32k.c: Likewise.
2640         * elf32-nds32.c: Likewise.
2641         * mach-o.c: Likewise.
2642         * netbsd-core.c: Likewise.
2643         * reloc.c: Likewise.
2644         * targets.c: Likewise.
2645         * coff-m88k.c: Delete.
2646         * cpu-m88k.c: Delete.
2647         * elf32-m88k.c: Delete.
2648         * hosts/m88kmach3.h: Delete.
2649         * m88kmach3.c: Delete.
2650         * m88kopenbsd.c: Delete.
2651         * Makefile.in: Regenerate.
2652         * bfd-in2.h: Regenerate.
2653         * configure: Regenerate.
2654         * po/SRC-POTFILES.in: Regenerate.
2655
2656 2018-04-16  Alan Modra  <amodra@gmail.com>
2657
2658         * Makefile.am: Remove i370 support.
2659         * archures.c: Likewise.
2660         * config.bfd: Likewise.
2661         * configure.ac: Likewise.
2662         * targets.c: Likewise.
2663         * cpu-i370.c: Delete.
2664         * elf32-i370.c: Delete.
2665         * Makefile.in: Regenerate.
2666         * bfd-in2.h: Regenerate.
2667         * configure: Regenerate.
2668         * po/SRC-POTFILES.in: Regenerate.
2669
2670 2018-04-16  Alan Modra  <amodra@gmail.com>
2671
2672         * Makefile.am: Remove h8500 support.
2673         * archures.c: Likewise.
2674         * coffcode.h: Likewise.
2675         * config.bfd: Likewise.
2676         * configure.ac: Likewise.
2677         * targets.c: Likewise.
2678         * coff-h8500.c: Delete.
2679         * cpu-h8500.c: Delete.
2680         * Makefile.in: Regenerate.
2681         * bfd-in2.h: Regenerate.
2682         * configure: Regenerate.
2683         * po/SRC-POTFILES.in: Regenerate.
2684
2685 2018-04-16  Alan Modra  <amodra@gmail.com>
2686
2687         * Makefile.am: Remove h8300-coff support.
2688         * coffcode.h: Likewise.
2689         * config.bfd: Likewise.
2690         * configure.ac: Likewise.
2691         * reloc16.c: Likewise.
2692         * targets.c: Likewise.
2693         * coff-h8300.c: Delete.
2694         * Makefile.in: Regenerate.
2695         * configure: Regenerate.
2696         * po/SRC-POTFILES.in: Regenerate.
2697
2698 2018-04-16  Alan Modra  <amodra@gmail.com>
2699
2700         * Makefile.am: Remove IEEE 695 support.
2701         * archures.c: Likewise.
2702         * bfd.c: Likewise.
2703         * config.bfd: Likewise.
2704         * configure.ac: Likewise.
2705         * doc/bfd.texinfo: Likewise.
2706         * doc/bfdint.texi: Likewise.
2707         * doc/bfdsumm.texi: Likewise.
2708         * section.c: Likewise.
2709         * targets.c: Likewise.
2710         * ieee.c: Delete.
2711         * libieee.h: Delete.
2712         * Makefile.in: Regenerate.
2713         * bfd-in2.h: Regenerate.
2714         * configure: Regenerate.
2715         * po/SRC-POTFILES.in: Regenerate.
2716
2717 2018-04-16  Alan Modra  <amodra@gmail.com>
2718
2719         * config.bfd: Remove tandem support.
2720
2721 2018-04-16  Alan Modra  <amodra@gmail.com>
2722
2723         * Makefile.am: Remove newsos3 support.
2724         * aoutx.h: Likewise.
2725         * config.bfd: Likewise.
2726         * configure.ac: Likewise.
2727         * targets.c: Likewise.
2728         * newsos3.c: Delete.
2729         * Makefile.in: Regenerate.
2730         * configure: Regenerate.
2731         * po/SRC-POTFILES.in: Regenerate.
2732
2733 2018-04-16  Alan Modra  <amodra@gmail.com>
2734
2735         * Makefile.am: Remove netware support.
2736         * bfd-in.h: Likewise.
2737         * bfd.c: Likewise.
2738         * config.bfd: Likewise.
2739         * configure.ac: Likewise.
2740         * doc/bfdint.texi: Likewise.
2741         * ecoff.c: Likewise.
2742         * targets.c: Likewise.
2743         * libnlm.h: Delete.
2744         * nlm-target.h: Delete.
2745         * nlm.c: Delete.
2746         * nlm32-alpha.c: Delete.
2747         * nlm32-i386.c: Delete.
2748         * nlm32-ppc.c: Delete.
2749         * nlm32-sparc.c: Delete.
2750         * nlm32.c: Delete.
2751         * nlm64.c: Delete.
2752         * nlmcode.h: Delete.
2753         * nlmswap.h: Delete.
2754         * Makefile.in: Regenerate.
2755         * bfd-in2.h: Regenerate.
2756         * configure: Regenerate.
2757         * po/SRC-POTFILES.in: Regenerate.
2758
2759 2018-04-16  Alan Modra  <amodra@gmail.com>
2760
2761         * archures.c: Remove tahoe support.
2762         * config.bfd: Likewise.
2763         * configure.ac: Likewise.
2764         * hosts/tahoe.h: Delete.
2765         * bfd-in2.h: Regenerate.
2766         * configure: Regenerate.
2767
2768 2018-04-14  Alan Modra  <amodra@gmail.com>
2769
2770         * elf-bfd.h (struct elf_backend_data): Add relropagesize.
2771         * elfxx-target.h (ELF_RELROPAGESIZE): Provide default and
2772         sanity test.
2773         (elfNN_bed): Init relropagesize.
2774         * bfd.c (bfd_emul_get_commonpagesize): Add boolean param to
2775         select relropagesize.
2776         * elf32-ppc.c (ELF_COMMONPAGESIZE): Define as 0x1000.
2777         (ELF_RELROPAGESIZE): Define as ELF_MAXPAGESIZE.
2778         (ELF_MINPAGESIZE): Don't define.
2779         * elf64-ppc.c (ELF_COMMONPAGESIZE): Define as 0x1000.
2780         (ELF_RELROPAGESIZE): Define as ELF_MAXPAGESIZE.
2781         * bfd-in2.h: Regenerate.
2782
2783 2018-04-14  Alan Modra  <amodra@gmail.com>
2784
2785         * elf32-ppc.c (ELF_MAXPAGESIZE, ELF_COMMONPAGESIZE): Don't depend
2786         on __QNXTARGET__ define.
2787
2788 2018-04-14  Alan Modra  <amodra@gmail.com>
2789
2790         * config.bfd: Add powerpc-*-lynxos* and powerpc-*-windiss*
2791         to obsolete list.
2792
2793 2018-04-11  Alan Modra  <amodra@gmail.com>
2794
2795         * aout-adobe.c: Delete.
2796         * bout.c: Delete.
2797         * coff-i860.c: Delete.
2798         * coff-i960.c: Delete.
2799         * cpu-i860.c: Delete.
2800         * cpu-i960.c: Delete.
2801         * elf32-i860.c: Delete.
2802         * elf32-i960.c: Delete.
2803         * hosts/i860mach3.h: Delete.
2804         * Makefile.am: Remove i860, i960, bout, and adobe support.
2805         * archures.c: Remove i860 and i960 support.
2806         * coffcode.h: Likewise.
2807         * reloc.c: Likewise.
2808         * aoutx.h: Comment updates.
2809         * archive.c: Remove BOUT and i960 support.
2810         * bfd.c: Remove BOUT support.
2811         * coffswap.h: Remove i960 support.
2812         * config.bfd: Remove i860, i960 and adobe targets.
2813         * configure.ac: Remove adode, bout, i860, i960, icoff targets.
2814         * targets.c: Likewise.
2815         * ieee.c: Remove i960 support.
2816         * mach-o.c: Remove i860 support.
2817         * Makefile.in: Regenerate.
2818         * bfd-in2.h: Regenerate.
2819         * configure: Regenerate.
2820         * libbfd.h: Regenerate.
2821         * po/SRC-POTFILES.in: Regenerate.
2822
2823 2018-04-09  Maciej W. Rozycki  <macro@mips.com>
2824
2825         * elf64-mips.c (mips_elf64_write_rel): Handle a NULL BFD pointer
2826         in the BFD symbol referred by the relocation.
2827         (mips_elf64_write_rela): Likewise.
2828
2829 2018-04-09  Maciej W. Rozycki  <macro@mips.com>
2830
2831         * elf64-mips.c (mips_elf64_slurp_one_reloc_table): Issue an
2832         error for out-of-range `r_sym' values.
2833
2834 2018-04-09  Alan Modra  <amodra@gmail.com>
2835
2836         * elf64-ppc.c (struct _ppc64_elf_section_data): Add has_pltcall field.
2837         (struct ppc_link_hash_table): Add can_convert_all_inline_plt.
2838         (ppc64_elf_check_relocs): Set has_pltcall.
2839         (ppc64_elf_adjust_dynamic_symbol): Discard some PLT entries.
2840         (ppc64_elf_inline_plt): New function.
2841         (ppc64_elf_size_dynamic_sections): Discard some PLT entries for locals.
2842         * elf64-ppc.h (ppc64_elf_inline_plt): Declare.
2843         * elf32-ppc.c (has_pltcall): Define.
2844         (struct ppc_elf_link_hash_table): Add can_convert_all_inline_plt.
2845         (ppc_elf_check_relocs): Set has_pltcall.
2846         (ppc_elf_inline_plt): New function.
2847         (ppc_elf_adjust_dynamic_symbol): Discard some PLT entries.
2848         (ppc_elf_size_dynamic_sections): Likewise.
2849         * elf32-ppc.h (ppc_elf_inline_plt): Declare.
2850
2851 2018-04-09  Alan Modra  <amodra@gmail.com>
2852
2853         * elf32-ppc.c (ppc_elf_howto_raw): Add PLTSEQ and PLTCALL howtos.
2854         (is_plt_seq_reloc): New function.
2855         (ppc_elf_check_relocs): Handle PLTSEQ and PLTCALL relocs.
2856         (ppc_elf_tls_optimize): Handle inline plt call sequence.
2857         (ppc_elf_relax_section): Handle PLTCALL reloc.
2858         (ppc_elf_relocate_section): Nop out inline plt call sequence when
2859         resolving locally.
2860         * elf64-ppc.c (ppc64_elf_howto_raw): Add R_PPC64_PLTSEQ and
2861         R_PPC64_PLTCALL entries.  Comment R_PPC64_TOCSAVE.
2862         (has_tls_get_addr_call): Correct comment.
2863         (is_branch_reloc): Add PLTCALL.
2864         (is_plt_seq_reloc): New function.
2865         (ppc64_elf_check_relocs): Handle PLT16_LO_DS reloc.  Set
2866         has_tls_reloc for R_PPC64_TLSGD and R_PPC64_TLSLD.  Create plt
2867         entry for R_PPC64_PLTCALL.
2868         (ppc64_elf_tls_optimize): Handle inline plt call sequence.
2869         (ppc_type_of_stub): Handle PLTCALL reloc.
2870         (toc_adjusting_stub_needed): Likewise.
2871         (ppc64_elf_relocate_section): Set "can_plt_call" for PLTCALL
2872         reloc insn.  Nop out inline plt call sequence when resolving
2873         locally.  Handle __tls_get_addr inline plt call optimization.
2874
2875 2018-04-09  Alan Modra  <amodra@gmail.com>
2876
2877         * elf64-ppc.c (LOCAL_PLT_ENTRY_SIZE): Define.
2878         (struct ppc_stub_hash_entry): Add symtype field.
2879         (PLT_KEEP): Define.
2880         (struct ppc_link_hash_table): Add pltlocal and relpltlocal.
2881         (create_linkage_sections): Create pltlocal and relpltlocal.
2882         (ppc64_elf_check_relocs): Allow PLT relocs on local symbols.
2883         Set PLT_KEEP.
2884         (ppc64_elf_adjust_dynamic_symbol): Keep PLT entries for inline calls.
2885         (allocate_dynrelocs): Allocate pltlocal and relpltlocal.
2886         (ppc64_elf_size_dynamic_sections): Size pltlocal and relpltlocal.
2887         Keep PLT entries for inline calls against locals.
2888         (ppc_build_one_stub): Use pltlocal as appropriate.
2889         (ppc_size_one_stub): Likewise.
2890         (ppc64_elf_size_stubs): Set symtype.
2891         (build_global_entry_stubs_and_plt): Init pltlocal and write
2892         relpltlocal for globals.
2893         (write_plt_relocs_for_local_syms): Likewise for local syms.
2894         (ppc64_elf_relocate_section): Support PLT for local syms.
2895         * elf32-ppc.c (PLT_KEEP): Define.
2896         (struct ppc_elf_link_hash_table): Add pltlocal and relpltlocal.
2897         (ppc_elf_create_glink): Create pltlocal and relpltlocal.
2898         (ppc_elf_check_relocs): Allow PLT relocs on local symbols.
2899         Set PLT_KEEP.  Adjust update_local_sym_info call.
2900         (ppc_elf_adjust_dynamic_symbol): Keep PLT entries for inline calls.
2901         (allocate_dynrelocs): Allocate pltlocal and relpltlocal.
2902         (ppc_elf_size_dynamic_sections): Size pltlocal and relpltlocal.
2903         (ppc_elf_relocate_section): Support PLT16 relocs for local syms.
2904         (write_global_sym_plt): Init pltlocal and write relpltlocal.
2905         (ppc_finish_symbols): Likewise for locals.
2906
2907 2018-04-09  Alan Modra  <amodra@gmail.com>
2908
2909         * elf64-ppc.c (ppc_build_one_stub): Move output of PLT relocs
2910         for local symbols to..
2911         (write_plt_relocs_for_local_syms): ..here.  New function.
2912         (ppc64_elf_finish_dynamic_symbol): Move output of PLT relocs for
2913         global symbols to..
2914         (build_global_entry_stubs_and_plt): ..here.  Rename from
2915         build_global_entry_stubs.
2916         (ppc64_elf_build_stubs): Always call build_global_entry_stubs_and_plt.
2917         Call write_plt_relocs_for_local_syms.
2918         * elf32-ppc.c (get_sym_h): New function.
2919         (ppc_elf_relax_section): Use get_sym_h.
2920         (ppc_elf_relocate_section): Move output of PLT relocs and glink
2921         stubs for local symbols to..
2922         (ppc_finish_symbols): ..here.  New function.
2923         (ppc_elf_finish_dynamic_symbol): Move output of PLT relocs for
2924         global syms to..
2925         (write_global_sym_plt): ..here.  New function.
2926         * elf32-ppc.h (ppc_elf_modify_segment_map): Delete attribute.
2927         (ppc_finish_symbols): Declare.
2928
2929 2018-04-09  Alan Modra  <amodra@gmail.com>
2930
2931         * elf32-ppc.c (ppc_elf_check_relocs): Handle PLT16 relocs.
2932         (ppc_elf_relocate_section): Likewise.
2933         * elf64-ppc.c (ppc64_elf_check_relocs): Handle PLT16_LO_DS.
2934         (ppc64_elf_relocate_section): Likewise.  Correct PLT16
2935         resolution to plt entry relative to toc pointer.
2936
2937 2018-04-09  Alan Modra  <amodra@gmail.com>
2938
2939         * elf64-ppc.c (TLS_TLS, TLS_GD, TLS_LD, TLS_TPREL, TLS_DTPREL,
2940         TLS_TPRELGD, TLS_EXPLICIT):  Renumber.  Test TLS_TLS throughout
2941         file when other TLS flags are tested in a mask.
2942         (TLS_MARK, NON_GOT): Define.
2943         (PLT_IFUNC): Redefine, and test TLS_TLS throughout file as well.
2944         (update_local_sym_info): Don't create got entry when NON_GOT.
2945         (ppc64_elf_check_relocs): Pass NON_GOT with PLT_IFUNC.
2946         Set TLS_MARK.
2947         (get_tls_mask): Do toc lookup if tls_mask is just TLS_MARK.
2948         (ppc64_elf_relocate_section): Likewise.
2949         (ppc64_elf_tls_optimize): Don't attempt to optimize indirect
2950         __tls_get_addr calls lacking a marker reloc.
2951         * elf32-ppc.c (TLS_TLS, TLS_GD, TLS_LD, TLS_TPREL, TLS_DTPREL,
2952         TLS_TPRELGD): Renumber.  Update comment.
2953         (TLS_MARK, NON_GOT): Define.
2954         (PLT_IFUNC): Redefine, and test TLS_TLS throughout file as well.
2955         (update_local_sym_info): Don't create got entry when NON_GOT.
2956         (ppc_elf_check_relocs): Pass NON_GOT with PLT_IFUNC.
2957         Set TLS_MARK.
2958         (ppc_elf_tls_optimize): Don't attempt to optimize indirect
2959         __tls_get_addr calls lacking a marker reloc.
2960
2961 2018-04-06  H.J. Lu  <hongjiu.lu@intel.com>
2962
2963         * elf64-x86-64.c (elf_x86_64_info_to_howto): Don't mask out
2964         R_X86_64_converted_reloc_bit.
2965
2966 2018-04-05  H.J. Lu  <hongjiu.lu@intel.com>
2967
2968         PR gas/22318
2969         * configure: Regenerated.
2970
2971 2018-04-05  Alan Modra  <amodra@gmail.com>
2972
2973         * elf-hppa.h (elf_hppa_info_to_howto): Init howto to NULL.
2974         (elf_hppa_info_to_howto_rel): Likewise.
2975
2976 2018-04-04  Maciej W. Rozycki  <macro@mips.com>
2977
2978         * elf-hppa.h (elf_hppa_info_to_howto): Also return
2979         unsuccessfully for unimplemented relocations.
2980         (elf_hppa_info_to_howto_rel): Likewise.
2981
2982 2018-04-04  Maciej W. Rozycki  <macro@mips.com>
2983
2984         * elf32-i860.c (lookup_howto): Add `abfd' parameter.  Set the
2985         `bfd_error_bad_value' error and call `_bfd_error_handler' on a
2986         howto lookup failure.
2987         (elf32_i860_reloc_type_lookup): Adjust `lookup_howto' call
2988         accordingly.
2989         (elf32_i860_info_to_howto_rela): Likewise.
2990         (elf32_i860_relocate_splitn): Likewise.
2991         (elf32_i860_relocate_pc16): Likewise.
2992         (elf32_i860_relocate_pc26): Likewise.
2993         (elf32_i860_relocate_section): Likewise.
2994
2995 2018-04-04  Maciej W. Rozycki  <macro@mips.com>
2996
2997         * elf32-visium.c (visium_info_to_howto_rela): Correct the range
2998         check for `visium_elf_howto_table' table access.
2999
3000 2018-04-04  Maciej W. Rozycki  <macro@mips.com>
3001
3002         * elf32-iq2000.c (iq2000_info_to_howto_rela): Correct the range
3003         check for `iq2000_elf_howto_table' table access.
3004
3005 2018-04-04  Maciej W. Rozycki  <macro@mips.com>
3006
3007         * elf32-frv.c (frv_info_to_howto_rela): Correct the range check
3008         for `elf32_frv_howto_table' table access.
3009
3010 2018-04-04  Maciej W. Rozycki  <macro@mips.com>
3011
3012         * elf32-mips.c (mips_elf32_rtype_to_howto): Also return
3013         unsuccessfully for placeholder howtos.
3014         * elf64-mips.c (mips_elf64_rtype_to_howto): Likewise.
3015         * elfn32-mips.c (mips_elf_n32_rtype_to_howto): Likewise.
3016
3017 2018-03-29  Maciej W. Rozycki  <macro@mips.com>
3018
3019         * elf32-mips.c (mips_info_to_howto_rel): Remove the calls to
3020         `_bfd_error_handler' and to set the `bfd_error_bad_value' error.
3021
3022 2018-03-28  Maciej W. Rozycki  <macro@mips.com>
3023
3024         * elf-hppa.h (elf_hppa_info_to_howto_rel): Remove
3025         ATTRIBUTE_UNUSED from `abfd'.
3026
3027 2018-03-28  Maciej W. Rozycki  <macro@mips.com>
3028
3029         * elf-hppa.h (elf_hppa_info_to_howto_rel): Correct
3030         `_bfd_error_handler' call formatting.
3031
3032 2018-03-28  Maciej W. Rozycki  <macro@mips.com>
3033
3034         * elf32-mips.c (mips_info_to_howto_rel): Call
3035         `mips_elf32_rtype_to_howto' directly rather than via
3036         `->elf_backend_mips_rtype_to_howto'.
3037
3038 2018-03-28  Renlin Li  <renlin.li@arm.com>
3039
3040         PR ld/22970
3041         * elfnn-aarch64.c (IS_AARCH64_TLS_RELOC): Add cases for
3042         BFD_RELOC_AARCH64_TLSLE_LDST16_TPREL_LO12,
3043         BFD_RELOC_AARCH64_TLSLE_LDST16_TPREL_LO12_NC,
3044         BFD_RELOC_AARCH64_TLSLE_LDST32_TPREL_LO12,
3045         BFD_RELOC_AARCH64_TLSLE_LDST32_TPREL_LO12_NC,
3046         BFD_RELOC_AARCH64_TLSLE_LDST64_TPREL_LO12,
3047         BFD_RELOC_AARCH64_TLSLE_LDST64_TPREL_LO12_NC,
3048         BFD_RELOC_AARCH64_TLSLE_LDST8_TPREL_LO12,
3049         BFD_RELOC_AARCH64_TLSLE_LDST8_TPREL_LO12_NC.
3050         (elfNN_aarch64_final_link_relocate): Support new relocations.
3051         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Support new
3052         relocations.
3053         (_bfd_aarch64_elf_resolve_relocation): Support new relocations.
3054
3055 2018-03-28  Renlin Li  <renlin.li@arm.com>
3056
3057         PR ld/22970
3058         * reloc.c: Add BFD_RELOC_AARCH64_TLSLE_LDST_TPREL_LO12
3059         BFD_RELOC_AARCH64_TLSLE_LDST_TPREL_LO12_NC,
3060         BFD_RELOC_AARCH64_TLSLE_LDST16_TPREL_LO12,
3061         BFD_RELOC_AARCH64_TLSLE_LDST16_TPREL_LO12_NC,
3062         BFD_RELOC_AARCH64_TLSLE_LDST32_TPREL_LO12,
3063         BFD_RELOC_AARCH64_TLSLE_LDST32_TPREL_LO12_NC,
3064         BFD_RELOC_AARCH64_TLSLE_LDST64_TPREL_LO12,
3065         BFD_RELOC_AARCH64_TLSLE_LDST64_TPREL_LO12_NC,
3066         BFD_RELOC_AARCH64_TLSLE_LDST8_TPREL_LO12,
3067         BFD_RELOC_AARCH64_TLSLE_LDST8_TPREL_LO12_NC.
3068         * elfnn-aarch64.c (elfNN_aarch64_howto_table): Add table entry for
3069         TLSLE_LDST16_TPREL_LO12,
3070         TLSLE_LDST16_TPREL_LO12_NC,
3071         TLSLE_LDST32_TPREL_LO12,
3072         TLSLE_LDST32_TPREL_LO12_NC,
3073         TLSLE_LDST64_TPREL_LO12,
3074         TLSLE_LDST64_TPREL_LO12_NC,
3075         TLSLE_LDST8_TPREL_LO12,
3076         TLSLE_LDST8_TPREL_LO12_NC.
3077         * bfd-in2.h: Regenerated.
3078         * libbfd.h: Regenerated.
3079
3080 2018-03-28  Eric Botcazou  <ebotcazou@adacore.com>
3081
3082         PR ld/22972
3083         * elfxx-sparc.c (struct _bfd_sparc_elf_link_hash_entry): Add new flag
3084         has_old_style_got_reloc.
3085         (_bfd_sparc_elf_check_relocs) <GOT relocations>: Set it for old-style
3086         relocations.  Fix a couple of long lines.
3087         (_bfd_sparc_elf_relocate_section) <R_SPARC_GOTDATA_OP>: Do not generate
3088         a R_SPARC_NONE for the GOT slot if the symbol is also subject to old-style
3089         GOT relocations.
3090
3091 2018-03-25  H.J. Lu  <hongjiu.lu@intel.com>
3092
3093         PR ld/23000
3094         * elf64-x86-64.c (elf_x86_64_finish_dynamic_sections): Add
3095         ENDBR64 to the TLSDESC PLT entry.
3096
3097 2018-03-21  Alan Modra  <amodra@gmail.com>
3098
3099         * elf64-ppc.c (ppc64_elf_get_synthetic_symtab): Trim uninteresting
3100         symbols.  Use size_t counts.  Delete redundant opd test.
3101
3102 2018-03-21  Alan Modra  <amodra@gmail.com>
3103
3104         * elf32-ppc.c (ppc_elf_tls_optimize): Delete locsyms.
3105
3106 2018-03-21  Alan Modra  <amodra@gmail.com>
3107
3108         * elf32-ppc.c (struct ppc_elf_link_hash_entry): Make tls_mask
3109         field unsigned.
3110         (update_local_sym_info): Likewise for local_got_tls_masks.
3111         (ppc_elf_tls_optimize): Likewise for lgot_masks.
3112
3113 2018-03-21  Alan Modra  <amodra@gmail.com>
3114
3115         * elf64-ppc.c (ppc_size_one_stub): Fix comment typo.
3116         (ppc64_elf_layout_multitoc): Allocate relocs for tprel as we
3117         do in size_dynamic_sections.
3118
3119 2018-03-21  Alan Modra  <amodra@gmail.com>
3120
3121         * elf64-ppc.c (ppc64_elf_relocate_section): Don't access rel[1]
3122         without first checking array bounds.
3123         * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
3124
3125 2018-03-20  H.J. Lu  <hongjiu.lu@intel.com>
3126
3127         PR ld/22983
3128         * elflink.c (bfd_elf_link_mark_dynamic_symbol): Set
3129         non_ir_ref_dynamic if a symbol is made dynamic by --dynamic-list.
3130
3131 2018-03-19  Nick Clifton  <nickc@redhat.com>
3132
3133         * po/es.po: Updated Spanish translation.
3134
3135 2018-03-15  Max Filippov  <jcmvbkbc@gmail.com>
3136
3137         * elf32-xtensa.c (xlate_map_entry): Change types of address
3138         fields from 'unsigned' to 'bfd_vma'.
3139         (xlate_offset_with_removed_text): Use struct xlate_map_entry as
3140         the key argument to bsearch. Allow offsets past the end of a
3141         section, use the last map entry for translation of such offsets.
3142
3143 2018-03-15  Kuan-Lin Chen  <kuanlinchentw@gmail.com>
3144
3145         * elf32-nds32.c (nds32_elf_ex9_build_hash_table): Removed.
3146         Not support the target feature.
3147         (nds32_elf_ex9_itb_base): Likewise.
3148         (nds32_elf_ex9_import_table): Likewise.
3149         (nds32_elf_ex9_finish): Likewise.
3150         (nds32_elf_ex9_reloc_jmp): Likewise.
3151         (nds32_elf_get_insn_with_reg): Likewise.
3152         (nds32_get_local_syms): Likewise.
3153         (nds32_elf_ex9_replace_instruction): Likewise.
3154         (nds32_elf_ifc_calc): Likewise.
3155         (nds32_elf_ifc_finish): Likewise.
3156         (nds32_elf_ifc_replace): Likewise.
3157         (nds32_elf_ifc_reloc): Likewise.
3158
3159 2018-03-14  Alan Modra  <amodra@gmail.com>
3160
3161         * elf64-ppc.c (sfpr_define): Adjust for stub_sec size having
3162         sfpr size added before defining alias symbols.
3163         (ppc64_elf_build_stubs): Add stub section padding before
3164         copying sfpr contents and defining save/restore alias symbols.
3165
3166 2018-03-14  H.J. Lu  <hongjiu.lu@intel.com>
3167
3168         PR ld/20882
3169         * elflink.c (elf_gc_mark_debug_section): Also check the local
3170         debug definition section.
3171
3172 2018-03-13  Nick Clifton  <nickc@redhat.com>
3173
3174         PR 22113
3175         * pei-x86_64.c (pex64_get_unwind_info): Change to a boolean
3176         function.  Add an end address parameter.  Check access of the data
3177         pointer to make sure that they do not extend beyond the end
3178         address.  Return FALSE if any check fails.  Add the end address
3179         pointer to the ui structure.
3180         (pex64_xdata_print_uwd_codes): Check accesses of the raw unwind
3181         codes to make sure that they do not extend beyond the end address
3182         pointer.  Print an error message and return immediately if any
3183         check fails.
3184
3185 2018-03-09  Nick Clifton  <nickc@redhat.com>
3186
3187         * elf64-s390.c (elf_s390_relocate_section): Move check for
3188         relocations against non-allocated sections to before the code that
3189         handles ifunc relocations.
3190         * elf32-s390.c (elf_s390_relocate_section): Likewise.
3191         * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Treat
3192         relocs against IFUNC symbols in non-allocated sections as relocs
3193         against FUNC symbols.
3194         * elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Likewise.
3195
3196 2018-03-08  H.J. Lu  <hongjiu.lu@intel.com>
3197
3198         PR ld/22929
3199         * elf32-i386.c (elf_i386_relocate_section): Treat relocation
3200         against IFUNC symbol in SHT_NOTE section without SHF_ALLOC as
3201         relocation against FUNC symbol.
3202         * elf64-x86-64.c (elf_x86_64_relocate_section): Likewise.
3203
3204 2018-03-07  Renlin Li  <renlin.li@arm.com>
3205
3206         PR ld/20402
3207         * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Check absolute
3208         symbol, and don't emit relocation in specific case.
3209
3210 2018-03-07  Alan Modra  <amodra@gmail.com>
3211
3212         * elf64-mips.c (mips_elf64_rtype_to_howto): Return NULL on error.
3213         (mips_elf64_slurp_one_reloc_table): Pass on error.
3214
3215 2018-03-03  James Cowgill  <james.cowgill@mips.com>
3216             Maciej W. Rozycki  <macro@mips.com>
3217
3218         PR ld/21900
3219         * elfxx-mips.c (mips_elf_calculate_relocation): Only return
3220         after calling `undefined_symbol' hook if this is an error
3221         condition.  Assume the value of 0 for the symbol requested
3222         otherwise.
3223
3224 2018-03-02  Jim Wilson  <jimw@sifive.com>
3225
3226         PR 22903
3227         * elfnn-aarch64.c (_bfd_aarch64_resize_stubs): Add 8 bytes for branch
3228         and nop instead of 4.
3229         (elfNN_arch64_build_stubs): Add nop after branch.  Increase size by
3230         8 instead of 4.
3231
3232 2018-03-01  Jim Wilson  <jimw@sifive.com>
3233
3234         PR 22756
3235         * elfnn-riscv.c (riscv_relax_delete_bytes): When adjust st_size, use
3236         else if instead of if.
3237
3238 2018-03-01  Alan Modra  <amodra@gmail.com>
3239
3240         * elf32-ft32.c (ft32_info_to_howto_rela): Correct range test.
3241
3242 2018-02-28  Alan Modra  <amodra@gmail.com>
3243
3244         PR 22887
3245         * aoutx.h (swap_std_reloc_in): Correct r_index bound check.
3246
3247 2018-02-28  Nick Clifton  <nickc@redhat.com>
3248
3249         PR 22895
3250         PR 22893
3251         * dwarf2.c (read_n_bytes): Replace size parameter with dwarf_block
3252         pointer.  Drop unused abfd parameter.  Check the size of the block
3253         before initialising the data field.  Return the end pointer if the
3254         size is invalid.
3255         (read_attribute_value): Adjust invocations of read_n_bytes.
3256
3257         PR 22894
3258         * dwarf1.c (parse_die): Check the length of form blocks before
3259         advancing the data pointer.
3260
3261 2018-02-28  Alan Modra  <amodra@gmail.com>
3262
3263         PR 22887
3264         * aoutx.h (translate_symbol_table): Print an error message and set
3265         bfd_error on finding an invalid name string offset.
3266
3267 2018-02-27  H.J. Lu  <hongjiu.lu@intel.com>
3268
3269         * config.in: Regenerated.
3270         * configure: Likewise.
3271         * configure.ac: Add --enable-separate-code.
3272         (DEFAULT_LD_Z_SEPARATE_CODE): New AC_DEFINE_UNQUOTED.  Default
3273         to 1 for Linux/x86 targets,
3274         * elf64-x86-64.c (ELF_MAXPAGESIZE): Set to 0x1000 if
3275         DEFAULT_LD_Z_SEPARATE_CODE is 1.
3276
3277 2018-02-27  Nick Clifton  <nickc@redhat.com>
3278
3279         * aout-cris.c (swap_ext_reloc_out): Standadize error/warning
3280         message.
3281         * elf-hppa.h (elf_hppa_info_to_howto_rel): Likewise.
3282         * elf32-i386.c (elf_i386_reloc_type_lookup): Likewise.
3283         * elf32-xtensa.c (elf_xtensa_reloc_type_lookup): Likewise.
3284         * elf64-ppc.c (ppc64_elf_reloc_type_lookup): Likewise.
3285         * elf64-s390.c (elf_s390_reloc_type_lookup): Likewise.
3286         * elf64-sh64.c (sh_elf64_info_to_howto): Likewise.
3287         * elfxx-ia64.c (ia64_elf_reloc_type_lookup): Likewise.
3288         * elfxx-sparc.c (_bfd_sparc_elf_reloc_type_lookup): Likewise.
3289         * elfxx-tilegx.c (tilegx_reloc_type_lookup): Likewise.
3290
3291         PR 22875
3292         * elf-bfd.h (struct elf_backend_data): Change the return type of
3293         the elf_info_to_howto and elf_info_to_howto_rel function pointers
3294         to bfd_boolean.
3295         * elfcode.h (elf_slurp_reloc_table_from_section): Check the return
3296         value from the info_to_howto function and fail if that function
3297         failed.
3298         * elf32-h8300.c (elf32_h8_relocate_section): Check return value
3299         from the info_to_howto function.
3300         (elf32_h8_relax_section): Likewise.
3301         * elf32-lm32.c (lm32_elf_relocate_section): Likewise.
3302         * elf32-m68hc1x.c (elf32_m68hc11_relocate_section): Likewise.
3303         * elf32-score.c (s3_bfd_score_elf_relocate_section): Likewise.
3304         * elf32-score7.c (s7_bfd_score_elf_relocate_section): Likewise.
3305         * elf32-tic6x.c (elf32_tic6x_relocate_section): Likewise.
3306         * elf64-ia64-vms.c (elf64_ia64_relocate_section): Likewise.
3307         * elf64-sparc.c (elf64_sparc_slurp_one_reloc_table): Likewise.
3308         * elf64-x86-64.c (elf_x86_64_tls_transition): Likewise.
3309         * elfnn-ia64.c (elfNN_ia64_relocate_section): Likewise.
3310         * elfnn-riscv.c (riscv_elf_check_relocs): Likewise.
3311         (riscv_elf_relocate_section): Likewise.
3312         * elf-hppa.h (elf_hppa_info_to_howto): Change return type to
3313         bfd_boolean.  Issue an error message, set an error value and
3314         return FALSE if the reloc is not recognized.
3315         (elf_hppa_info_to_howto_rel): Likewise.
3316         * elf-m10200.c (mn10200_info_to_howto): Likewise.
3317         * elf-m10300.c (mn10300_info_to_howto): Likewise.
3318         * elf.c (_bfd_elf_no_info_to_howto): Likewise.
3319         * elf32-arc.c (arc_info_to_howto_rel): Likewise.
3320         * elf32-arm.c (elf32_arm_info_to_howto): Likewise.
3321         * elf32-avr.c (avr_info_to_howto_rela): Likewise.
3322         * elf32-bfin.c (bfin_info_to_howto): Likewise.
3323         * elf32-cr16.c (elf_cr16_info_to_howto): Likewise.
3324         * elf32-cr16c.c (elf_cr16c_info_to_howto): Likewise.
3325         * elf32-cris.c (elf_cr16c_info_to_howto_rel)
3326         (cris_info_to_howto_rela): Likewise.
3327         * elf32-crx.c (elf_crx_info_to_howto): Likewise.
3328         * elf32-d10v.c (d10v_info_to_howto_rel): Likewise.
3329         * elf32-d30v.c (d30v_info_to_howto_rel, d30v_info_to_howto_rela):
3330         Likewise.
3331         * elf32-dlx.c (dlx_rtype_to_howto, elf32_dlx_info_to_howto)
3332         (elf32_dlx_info_to_howto_rel): Likewise.
3333         * elf32-epiphany.c (epiphany_info_to_howto_rela): Likewise.
3334         * elf32-fr30.c (fr30_info_to_howto_rela): Likewise.
3335         * elf32-frv.c (frv_info_to_howto_rela)
3336         (frvfdpic_info_to_howto_rel): Likewise.
3337         * elf32-ft32.c (ft32_info_to_howto_rela): Likewise.
3338         * elf32-gen.c (elf_generic_info_to_howto)
3339         (elf_generic_info_to_howto_rel): Likewise.
3340         * elf32-h8300.c (elf32_h8_info_to_howto)
3341         (elf32_h8_info_to_howto_rel): Likewise.
3342         * elf32-i370.c (i370_elf_info_to_howto): Likewise.
3343         * elf32-i386.c (elf_i386_reloc_type_lookup)
3344         (elf_i386_rtype_to_howto, elf_i386_info_to_howto_rel): Likewise.
3345         * elf32-i860.c (lookup_howto, elf32_i860_info_to_howto_rela):
3346         Likewise.
3347         * elf32-i960.c (elf32_i960_info_to_howto_rel): Likewise.
3348         * elf32-ip2k.c (ip2k_info_to_howto_rela): Likewise.
3349         * elf32-iq2000.c (iq2000_info_to_howto_rela): Likewise.
3350         * elf32-lm32.c (lm32_info_to_howto_rela): Likewise.
3351         * elf32-m32c.c (m32c_info_to_howto_rela): Likewise.
3352         * elf32-m32r.c (m32r_info_to_howto_rel, m32r_info_to_howto):
3353         Likewise.
3354         * elf32-m68hc11.c (m68hc11_info_to_howto_rel): Likewise.
3355         * elf32-m68hc12.c (m68hc11_info_to_howto_rel): Likewise.
3356         * elf32-m68k.c (rtype_to_howto): Likewise.
3357         * elf32-mcore.c (mcore_elf_info_to_howto): Likewise.
3358         * elf32-mep.c (mep_info_to_howto_rela): Likewise.
3359         * elf32-metag.c (metag_info_to_howto_rela): Likewise.
3360         * elf32-microblaze.c (microblaze_elf_info_to_howto): Likewise.
3361         * elf32-mips.c (mips_info_to_howto_rel, mips_info_to_howto_rela):
3362         Likewise.
3363         * elf32-moxie.c (moxie_info_to_howto_rela): Likewise.
3364         * elf32-msp430.c (msp430_info_to_howto_rela): Likewise.
3365         * elf32-mt.c (mt_info_to_howto_rela): Likewise.
3366         * elf32-nds32.c (nds32_info_to_howto_rel, nds32_info_to_howto):
3367         Likewise.
3368         * elf32-nios2.c (nios2_elf32_info_to_howto): Likewise.
3369         * elf32-or1k.c (or1k_info_to_howto_rela): Likewise.
3370         * elf32-pj.c (pj_elf_info_to_howto): Likewise.
3371         * elf32-ppc.c (ppc_elf_info_to_howto): Likewise.
3372         * elf32-pru.c (pru_elf32_info_to_howto): Likewise.
3373         * elf32-rl78.c (rl78_info_to_howto_rela): Likewise.
3374         * elf32-rx.c (rx_info_to_howto_rela): Likewise.
3375         * elf32-s390.c (elf_s390_info_to_howto): Likewise.
3376         * elf32-score.c (s3_bfd_score_info_to_howto)
3377         (_bfd_score_info_to_howto): Likewise.
3378         * elf32-score7.c (s7_bfd_score_info_to_howto): Likewise.
3379         * elf32-sh.c (sh_elf_info_to_howto): Likewise.
3380         * elf32-spu.c (spu_elf_info_to_howto): Likewise.
3381         * elf32-tic6x.c (elf32_tic6x_info_to_howto)
3382         (elf32_tic6x_info_to_howto_rel): Likewise.
3383         * elf32-tilepro.c (tilepro_info_to_howto_rela): Likewise.
3384         * elf32-v850.c (v850_elf_info_to_howto_rel)
3385         (v850_elf_info_to_howto_rela, v800_elf_info_to_howto): Likewise.
3386         * elf32-vax.c (rtype_to_howto): Likewise.
3387         * elf32-visium.c (visium_info_to_howto_rela): Likewise.
3388         * elf32-wasm32.c (elf32_wasm32_rtype_to_howto)
3389         (elf32_wasm32_info_to_howto_rela): Likewise.
3390         * elf32-xc16x.c (elf32_xc16x_info_to_howto): Likewise.
3391         * elf32-xgate.c (xgate_info_to_howto_rel): Likewise.
3392         * elf32-xstormy16.c (xstormy16_info_to_howto_rela): Likewise.
3393         * elf32-xtensa.c (elf_xtensa_info_to_howto_rela): Likewise.
3394         * elf64-alpha.c (elf64_alpha_info_to_howto): Likewise.
3395         * elf64-gen.c (elf_generic_info_to_howto)
3396         (elf_generic_info_to_howto_rel): Likewise.
3397         * elf64-ia64-vms.c (elf64_ia64_info_to_howto): Likewise.
3398         * elf64-mips.c (mips_elf64_info_to_howto_rela): Likewise.
3399         * elf64-mmix.c (mmix_info_to_howto_rela): Likewise.
3400         * elf64-ppc.c (ppc64_elf_info_to_howto): Likewise.
3401         * elf64-s390.c (elf_s390_reloc_type_lookup): Likewise.
3402         * elf64-sh64.c (elf_s390_info_to_howto, sh_elf64_info_to_howto):
3403         Likewise.
3404         * elf64-x86-64.c (elf_x86_64_info_to_howto): Likewise.
3405         * elfn32-mips.c (mips_info_to_howto_rel, mips_info_to_howto_rela):
3406         Likewise.
3407         * elfnn-aarch64.c (elfNN_aarch64_info_to_howto): Likewise.
3408         * elfnn-ia64.c (elfNN_ia64_info_to_howto): Likewise.
3409         * elfnn-riscv.c (riscv_info_to_howto_rela): Likewise.
3410         * elfxx-ia64.c (ia64_elf_reloc_type_lookup): Likewise.
3411         * elfxx-sparc.c (_bfd_sparc_elf_info_to_howto): Likewise.
3412         * elfxx-tilegx.c (tilegx_info_to_howto_rela): Likewise.
3413         * elf32-score.h (s7_bfd_score_info_to_howto): Update prototype.
3414         * elfxx-sparc.h (_bfd_sparc_elf_info_to_howto): Update prototype.
3415         * elfxx-tilegx.h (tilegx_info_to_howto_rela): Update prototype.
3416         * elfxx-target.h (elf_info_to_howto, elf_info_to_howto_rel):
3417         Default to NULL.
3418
3419 2018-02-26  Jim Wilson  <jimw@sifive.com>
3420             Stephan Schreiber <info@fs-driver.org>
3421
3422         PR 15904
3423         * elfnn-ia64.c (elfNN_ia64_relax_section): After ia64_elf_relax_brl
3424         call, set changed_contents and changed_relocs.  Likewise after
3425         successful ia64_elf_relax_br call.
3426
3427 2018-02-26  Alan Modra  <amodra@gmail.com>
3428
3429         * elf.c (assign_file_positions_except_relocs): Don't segfault
3430         when actual number of phdrs is less than allocated.  Delete
3431         outdated comment.  Formatting.
3432
3433 2018-02-26  Alan Modra  <amodra@gmail.com>
3434
3435         * elf-m10300.c, * elf-s390-common.c, * elf32-arc.c, * elf32-cris.c,
3436         * elf32-dlx.c, * elf32-frv.c, * elf32-i370.c, * elf32-lm32.c,
3437         * elf32-m32r.c, * elf32-m68hc1x.c, * elf32-m68k.c,
3438         * elf32-microblaze.c, * elf32-msp430.c, * elf32-nds32.c,
3439         * elf32-nios2.c, * elf32-or1k.c, * elf32-rl78.c, * elf32-rx.c,
3440         * elf32-score.c, * elf32-score7.c, * elf32-sh-symbian.c,
3441         * elf32-sh.c, * elf32-spu.c, * elf32-v850.c, * elf32-xtensa.c,
3442         * elf64-alpha.c, * elf64-ia64-vms.c, * elf64-mmix.c,
3443         * elf64-sh64.c, * elf64-sparc.c, * elfnn-ia64.c, * elfxx-tilegx.c,
3444         * mmo.c, * osf-core.c, * srec.c, * vms-alpha.c: Standardize
3445         error/warning messages.
3446
3447 2018-02-26  Alan Modra  <amodra@gmail.com>
3448
3449         * archive.c, * bfd.c, * linker.c, * reloc.c, * stabs.c,
3450         * syms.c: Standardize error/warning messages.
3451
3452 2018-02-26  Alan Modra  <amodra@gmail.com>
3453
3454         * aout-adobe.c, * aout-cris.c, * i386linux.c, * m68klinux.c,
3455         * sparclinux.c, * coff-alpha.c, * coff-arm.c, * coff-mcore.c,
3456         * coffcode.h, * coffgen.c, * cofflink.c, * ecoff.c, * pe-mips.c,
3457         * peXXigen.c, * peicode.h: Standardize error/warning messages.
3458
3459 2018-02-26  Alan Modra  <amodra@gmail.com>
3460
3461         * elf32-arm.c, * elfnn-aarch64.c: Standardize error/warning messages.
3462
3463 2018-02-26  Alan Modra  <amodra@gmail.com>
3464
3465         * elfxx-mips.c: Standardize error/warning messages.
3466
3467 2018-02-26  Alan Modra  <amodra@gmail.com>
3468
3469         * dwarf2.c, * elf-attrs.c, * elf-eh-frame.c, * elf.c, * elf32-gen.c,
3470         * elflink.c: Standardize error/warning messages.  Replace use of
3471         linker callback einfo with _bfd_error_handler when possible.
3472
3473 2018-02-26  Alan Modra  <amodra@gmail.com>
3474
3475         * aoutx.h, * coff-alpha.c, * coff-i860.c, * coff-m68k.c,
3476         * coff-mcore.c, * coff-ppc.c, * coff-rs6000.c, * coff-sh.c,
3477         * coff-tic4x.c, * coff-tic54x.c, * coff-tic80.c, * coff-w65.c,
3478         * elf-bfd.h, * elf-m10300.c, * elf.c, * elf32-avr.c, * elf32-bfin.c,
3479         * elf32-cr16.c, * elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c,
3480         * elf32-d10v.c, * elf32-d30v.c, * elf32-dlx.c, * elf32-epiphany.c,
3481         * elf32-fr30.c, * elf32-frv.c, * elf32-i370.c, * elf32-i386.c,
3482         * elf32-i960.c, * elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c,
3483         * elf32-m32c.c, * elf32-m32r.c, * elf32-m68hc11.c, * elf32-m68hc12.c,
3484         * elf32-m68k.c, * elf32-mcore.c, * elf32-mep.c, * elf32-metag.c,
3485         * elf32-microblaze.c, * elf32-mips.c, * elf32-moxie.c,
3486         * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c, * elf32-or1k.c,
3487         * elf32-pj.c, * elf32-ppc.c, * elf32-rl78.c, * elf32-rx.c,
3488         * elf32-s390.c, * elf32-sh.c, * elf32-spu.c, * elf32-tic6x.c,
3489         * elf32-v850.c, * elf32-vax.c, * elf32-visium.c, * elf32-wasm32.c,
3490         * elf32-xgate.c, * elf32-xtensa.c, * elf64-alpha.c,
3491         * elf64-ia64-vms.c, * elf64-mips.c, * elf64-mmix.c,
3492         * elf64-ppc.c, * elf64-s390.c, * elf64-sparc.c, * elf64-x86-64.c,
3493         * elfn32-mips.c, * elfnn-aarch64.c, * elfnn-ia64.c,
3494         * elfnn-riscv.c, * elfxx-mips.c, * elfxx-riscv.c, * elfxx-riscv.h,
3495         * elfxx-sparc.c, * elfxx-sparc.h, * reloc.c: Standardize
3496         unrecognized/unsupported reloc message.
3497
3498 2018-02-26  Alan Modra  <amodra@gmail.com>
3499
3500         * elf32-ppc.c: Standardize error/warning messages.  Use
3501         _bfd_error_handler rather than einfo when einfo features not used.
3502         * elf64-ppc.c: Likewise.
3503
3504 2018-02-23  Alan Modra  <amodra@gmail.com>
3505
3506         PR 22881
3507         * elf.c (assign_file_positions_for_non_load_sections): Remove RELRO
3508         segment if no matching LOAD segment.
3509
3510 2018-02-23  Kuan-Lin Chen  <kuanlinchentw@gmail.com>
3511
3512         * elf32-nds32.h: Define mask for ict_model.
3513
3514 2018-02-20  Jason Duerstock  <jason.duerstock@gmail.com>
3515
3516         * elfnn-ia64.c (elf_backend_can_gc_sections): Enable.
3517
3518 2018-02-19  Maciej W. Rozycki  <macro@mips.com>
3519
3520         Revert
3521         2018-01-12  Vlad Ivanov  <vlad@ivanov.email>
3522
3523         * elfxx-mips.c (_bfd_mips_elf_final_link): Notify user when
3524         .reginfo section has wrong size.
3525
3526 2018-02-19  Maciej W. Rozycki  <macro@mips.com>
3527
3528         * elfxx-mips.c (_bfd_mips_elf_always_size_sections): Set
3529         SEC_FIXED_SIZE and SEC_HAS_CONTENTS flags for `.reginfo' and
3530         `.MIPS.abiflags' sections.
3531         (_bfd_mips_elf_final_link): Avoid reading beyond `.reginfo'
3532         section's end.
3533
3534 2018-02-19  Maciej W. Rozycki  <macro@mips.com>
3535
3536         * section.c (SEC_FIXED_SIZE): New macro.
3537         * bfd-in2.h: Regenerate.
3538
3539 2018-02-19  Maciej W. Rozycki  <macro@mips.com>
3540
3541         * section.c (SEC_HAS_GOT_REF): Remove macro.
3542         * bfd-in2.h: Regenerate.
3543
3544 2018-02-19  Alan Modra  <amodra@gmail.com>
3545
3546         * elf-attrs.c (_bfd_elf_parse_attributes): Correct _bfd_error_handler
3547         arguments.
3548         * elfxx-mips.c (_bfd_mips_elf_final_link): Likewise.
3549         * elfnn-riscv.c (_bfd_riscv_relax_align): Likewise.
3550         (_bfd_riscv_relax_pc): Likewise and fix typos.
3551         * libbfd-in.h (_bfd_error_handler): Add attribute printf.
3552         * libbfd.h: Regenerate.
3553
3554 2018-02-19  Alan Modra  <amodra@gmail.com>
3555
3556         * dwarf2.c (read_section): Don't use 'll' format modifier.
3557         (find_abstract_instance): Likewise.
3558         * elfcore.h (elf_core_file_p): Likewise.
3559
3560 2018-02-19  Alan Modra  <amodra@gmail.com>
3561
3562         * bfd-in.h: Include inttypes.h or if not available define
3563         PRId64, PRIu64 and PRIx64.
3564         * bfd.c (_bfd_doprnt, _bfd_doprnt_scan): Remove support for L
3565         modifier to print bfd_vma.
3566         * coff-arm.c, * coff-mcore.c, * coff-ppc.c, * coff-rs6000.c,
3567         * coff-sh.c, * coff-tic80.c, * coffcode.h, * coffgen.c, * cofflink.c,
3568         * compress.c, * dwarf2.c, * elf-m10300.c, * elf.c, * elf32-arc.c,
3569         * elf32-arm.c, * elf32-bfin.c, * elf32-cris.c, * elf32-hppa.c,
3570         * elf32-i386.c, * elf32-ip2k.c, * elf32-lm32.c, * elf32-m32r.c,
3571         * elf32-m68k.c, * elf32-metag.c, * elf32-nds32.c, * elf32-nios2.c,
3572         * elf32-ppc.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c,
3573         * elf32-score7.c, * elf32-sh.c, * elf32-sh64.c, * elf32-spu.c,
3574         * elf32-tic6x.c, * elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c,
3575         * elf32-xtensa.c, * elf64-alpha.c, * elf64-hppa.c, * elf64-ia64-vms.c,
3576         * elf64-mmix.c, * elf64-s390.c, * elf64-sh64.c, * elf64-x86-64.c,
3577         * elfcode.h, * elfcore.h, * elflink.c, * elfnn-aarch64.c,
3578         * elfnn-ia64.c, * elfnn-riscv.c, * elfxx-mips.c, * elfxx-sparc.c,
3579         * elfxx-tilegx.c, * ieee.c, * ihex.c, * mach-o.c, * merge.c, * mmo.c,
3580         * peXXigen.c, * xcofflink.c: Replace use of Lx modifier with PRIx64,
3581         and cast input to uint64_t, and similarly for Ld and Lu.
3582         * bfd-in2.h: Regenerate.
3583
3584 2018-02-19  Alan Modra  <amodra@gmail.com>
3585
3586         * elf32-arm.c, * elf32-hppa.c, * elf32-lm32.c, * elf32-m32r.c,
3587         * elf32-metag.c, * elf32-nds32.c, * elf32-or1k.c, * elf32-ppc.c,
3588         * elf32-s390.c, * elf32-sh.c, * elf32-tic6x.c, * elf32-tilepro.c,
3589         * elf64-ppc.c, * elf64-s390.c, * elflink.c, * elfnn-aarch64.c,
3590         * elfnn-riscv.c, * elfxx-sparc.c, * elfxx-tilegx.c, * elfxx-x86.c,
3591         * reloc.c: Replace use of %R and %T in format strings passed to
3592         einfo and friends by %pR and %pT.
3593
3594 2018-02-19  Alan Modra  <amodra@gmail.com>
3595
3596         * bfd.c (_bfd_doprnt, _bfd_doprnt_scan): Handle %pA and %pB in place
3597         of %A and %B.
3598         * aout-adobe.c: Update all messages using %A and %B.
3599         * aout-cris.c: Likewise.
3600         * aoutx.h: Likewise.
3601         * archive.c: Likewise.
3602         * binary.c: Likewise.
3603         * cache.c: Likewise.
3604         * coff-alpha.c: Likewise.
3605         * coff-arm.c: Likewise.
3606         * coff-i860.c: Likewise.
3607         * coff-mcore.c: Likewise.
3608         * coff-ppc.c: Likewise.
3609         * coff-rs6000.c: Likewise.
3610         * coff-sh.c: Likewise.
3611         * coff-tic4x.c: Likewise.
3612         * coff-tic54x.c: Likewise.
3613         * coff-tic80.c: Likewise.
3614         * coff64-rs6000.c: Likewise.
3615         * coffcode.h: Likewise.
3616         * coffgen.c: Likewise.
3617         * cofflink.c: Likewise.
3618         * coffswap.h: Likewise.
3619         * compress.c: Likewise.
3620         * cpu-arm.c: Likewise.
3621         * ecoff.c: Likewise.
3622         * elf-attrs.c: Likewise.
3623         * elf-eh-frame.c: Likewise.
3624         * elf-ifunc.c: Likewise.
3625         * elf-m10300.c: Likewise.
3626         * elf-properties.c: Likewise.
3627         * elf-s390-common.c: Likewise.
3628         * elf.c: Likewise.
3629         * elf32-arc.c: Likewise.
3630         * elf32-arm.c: Likewise.
3631         * elf32-avr.c: Likewise.
3632         * elf32-bfin.c: Likewise.
3633         * elf32-cr16.c: Likewise.
3634         * elf32-cr16c.c: Likewise.
3635         * elf32-cris.c: Likewise.
3636         * elf32-crx.c: Likewise.
3637         * elf32-d10v.c: Likewise.
3638         * elf32-d30v.c: Likewise.
3639         * elf32-epiphany.c: Likewise.
3640         * elf32-fr30.c: Likewise.
3641         * elf32-frv.c: Likewise.
3642         * elf32-gen.c: Likewise.
3643         * elf32-hppa.c: Likewise.
3644         * elf32-i370.c: Likewise.
3645         * elf32-i386.c: Likewise.
3646         * elf32-i960.c: Likewise.
3647         * elf32-ip2k.c: Likewise.
3648         * elf32-iq2000.c: Likewise.
3649         * elf32-lm32.c: Likewise.
3650         * elf32-m32c.c: Likewise.
3651         * elf32-m32r.c: Likewise.
3652         * elf32-m68hc11.c: Likewise.
3653         * elf32-m68hc12.c: Likewise.
3654         * elf32-m68hc1x.c: Likewise.
3655         * elf32-m68k.c: Likewise.
3656         * elf32-mcore.c: Likewise.
3657         * elf32-mep.c: Likewise.
3658         * elf32-metag.c: Likewise.
3659         * elf32-microblaze.c: Likewise.
3660         * elf32-moxie.c: Likewise.
3661         * elf32-msp430.c: Likewise.
3662         * elf32-mt.c: Likewise.
3663         * elf32-nds32.c: Likewise.
3664         * elf32-nios2.c: Likewise.
3665         * elf32-or1k.c: Likewise.
3666         * elf32-pj.c: Likewise.
3667         * elf32-ppc.c: Likewise.
3668         * elf32-rl78.c: Likewise.
3669         * elf32-rx.c: Likewise.
3670         * elf32-s390.c: Likewise.
3671         * elf32-score.c: Likewise.
3672         * elf32-score7.c: Likewise.
3673         * elf32-sh-symbian.c: Likewise.
3674         * elf32-sh.c: Likewise.
3675         * elf32-sh64.c: Likewise.
3676         * elf32-sparc.c: Likewise.
3677         * elf32-spu.c: Likewise.
3678         * elf32-tic6x.c: Likewise.
3679         * elf32-tilepro.c: Likewise.
3680         * elf32-v850.c: Likewise.
3681         * elf32-vax.c: Likewise.
3682         * elf32-visium.c: Likewise.
3683         * elf32-wasm32.c: Likewise.
3684         * elf32-xgate.c: Likewise.
3685         * elf32-xtensa.c: Likewise.
3686         * elf64-alpha.c: Likewise.
3687         * elf64-gen.c: Likewise.
3688         * elf64-hppa.c: Likewise.
3689         * elf64-ia64-vms.c: Likewise.
3690         * elf64-mmix.c: Likewise.
3691         * elf64-ppc.c: Likewise.
3692         * elf64-s390.c: Likewise.
3693         * elf64-sh64.c: Likewise.
3694         * elf64-sparc.c: Likewise.
3695         * elf64-x86-64.c: Likewise.
3696         * elfcode.h: Likewise.
3697         * elfcore.h: Likewise.
3698         * elflink.c: Likewise.
3699         * elfnn-aarch64.c: Likewise.
3700         * elfnn-ia64.c: Likewise.
3701         * elfnn-riscv.c: Likewise.
3702         * elfxx-mips.c: Likewise.
3703         * elfxx-sparc.c: Likewise.
3704         * elfxx-tilegx.c: Likewise.
3705         * elfxx-x86.c: Likewise.
3706         * hpux-core.c: Likewise.
3707         * ieee.c: Likewise.
3708         * ihex.c: Likewise.
3709         * libbfd.c: Likewise.
3710         * linker.c: Likewise.
3711         * mach-o.c: Likewise.
3712         * merge.c: Likewise.
3713         * mmo.c: Likewise.
3714         * oasys.c: Likewise.
3715         * pdp11.c: Likewise.
3716         * pe-mips.c: Likewise.
3717         * peXXigen.c: Likewise.
3718         * peicode.h: Likewise.
3719         * reloc.c: Likewise.
3720         * rs6000-core.c: Likewise.
3721         * srec.c: Likewise.
3722         * stabs.c: Likewise.
3723         * vms-alpha.c: Likewise.
3724         * xcofflink.c: Likewise.
3725
3726 2018-02-19  Alan Modra  <amodra@gmail.com>
3727
3728         PR 22845
3729         * elf.c (IS_TBSS): Define.
3730         (_bfd_elf_map_sections_to_segments): Use IS_TBSS.
3731         (assign_file_positions_for_non_load_sections): Revert last change.
3732         Properly calculate load segment limits to compare against relro limits.
3733
3734 2018-02-17  Alan Modra  <amodra@gmail.com>
3735
3736         PR 22845
3737         * elf.c (assign_file_positions_for_non_load_sections): Ignore
3738         degenerate zero size PT_LOAD segments when finding one overlapping
3739         the PT_GNU_RELRO segment.
3740
3741 2018-02-16  Alan Modra  <amodra@gmail.com>
3742
3743         * libbfd.c (_bfd_bool_bfd_false_error): Rename from bfd_false.
3744         (_bfd_bool_bfd_true): Rename from bfd_true.
3745         (_bfd_ptr_bfd_null_error): Rename from bfd_nullvoidptr.
3746         (_bfd_int_bfd_0): Rename from bfd_0.
3747         (_bfd_uint_bfd_0): Rename from bfd_0u.
3748         (_bfd_long_bfd_0): Rename from bfd_0l.
3749         (_bfd_long_bfd_n1_error): Rename from _bfd_n1.
3750         (_bfd_void_bfd): Rename from bfd_void.
3751         (_bfd_bool_bfd_false, _bfd_bool_bfd_asymbol_false),
3752         (_bfd_bool_bfd_link_false_error),
3753         (_bfd_bool_bfd_link_true, _bfd_bool_bfd_bfd_true),
3754         (_bfd_bool_bfd_uint_true, _bfd_bool_bfd_ptr_true),
3755         (_bfd_bool_bfd_asection_bfd_asection_true),
3756         (_bfd_bool_bfd_asymbol_bfd_asymbol_true),
3757         (_bfd_void_bfd_link, _bfd_void_bfd_asection): New functions.
3758         * archive.c (_bfd_noarchive_get_elt_at_index),
3759         (_bfd_noarchive_openr_next_archived_file),
3760         (_bfd_noarchive_construct_extended_name_table),
3761         (_bfd_noarchive_write_ar_hdr, _bfd_noarchive_truncate_arname),
3762         (_bfd_noarchive_write_armap): New functions.
3763         * archures.c (_bfd_nowrite_set_arch_mach): New function.
3764         * coff-alpha.c (alpha_ecoff_swap_coff_aux_in),
3765         (alpha_ecoff_swap_coff_sym_in, alpha_ecoff_swap_coff_lineno_in),
3766         (alpha_ecoff_swap_coff_aux_out, alpha_ecoff_swap_coff_sym_out),
3767         (alpha_ecoff_swap_coff_lineno_out),
3768         (alpha_ecoff_swap_coff_reloc_out): New functions.
3769         * coff-mips.c (mips_ecoff_swap_coff_aux_in),
3770         (mips_ecoff_swap_coff_sym_in, mips_ecoff_swap_coff_lineno_in),
3771         (mips_ecoff_swap_coff_aux_out, mips_ecoff_swap_coff_sym_out),
3772         (mips_ecoff_swap_coff_lineno_out),
3773         (mips_ecoff_swap_coff_reloc_out): New functions.
3774         * coffcode.h (coff_set_alignment_hook): Replace define with
3775         new function.
3776         (symname_in_debug_hook): Likewise.
3777         * ecoff.c (_bfd_ecoff_set_alignment_hook): New function.
3778         * elfxx-target.h (elf_backend_allow_non_load_phdr): Default to 0.
3779         * elf.c (assign_file_positions_except_relocs): Test
3780         elf_backend_allow_non_load_phdr for NULL.
3781         * elflink.c (_bfd_elf_omit_section_dynsym_default): Rename from
3782         _bfd_elf_link_omit_section_dynsym.  Update uses.
3783         (_bfd_elf_omit_section_dynsym_all): New function.
3784         * elf-bfd.h (_bfd_elf_link_omit_section_dynsym): Delete.
3785         (_bfd_elf_omit_section_dynsym_default): Declare.
3786         (_bfd_elf_omit_section_dynsym_all): Declare.
3787         * linker.c (_bfd_nolink_sizeof_headers, _bfd_nolink_bfd_relax_section),
3788         (_bfd_nolink_bfd_get_relocated_section_contents),
3789         (_bfd_nolink_bfd_lookup_section_flags),
3790         (_bfd_nolink_bfd_is_group_section, _bfd_nolink_bfd_discard_group),
3791         (_bfd_nolink_bfd_link_hash_table_create),
3792         (_bfd_nolink_bfd_link_just_syms),
3793         (_bfd_nolink_bfd_copy_link_hash_symbol_type),
3794         (_bfd_nolink_bfd_link_split_section),
3795         (_bfd_nolink_section_already_linked),
3796         (_bfd_nolink_bfd_define_common_symbol),
3797         (_bfd_nolink_bfd_define_start_stop): New functions.
3798         * reloc.c (_bfd_norelocs_bfd_reloc_type_lookup),
3799         (_bfd_norelocs_bfd_reloc_name_lookup),
3800         (_bfd_nodynamic_canonicalize_dynamic_reloc): New functions.
3801         * section.c (_bfd_nowrite_set_section_contents): New function.
3802         * syms.c (_bfd_nosymbols_canonicalize_symtab),
3803         (_bfd_nosymbols_print_symbol, _bfd_nosymbols_get_symbol_info),
3804         (_bfd_nosymbols_get_symbol_version_string),
3805         (_bfd_nosymbols_bfd_is_local_label_name),
3806         (_bfd_nosymbols_get_lineno, _bfd_nosymbols_find_nearest_line),
3807         (_bfd_nosymbols_find_line, _bfd_nosymbols_find_inliner_info),
3808         (_bfd_nosymbols_bfd_make_debug_symbol),
3809         ( _bfd_nosymbols_read_minisymbols),
3810         ( _bfd_nosymbols_minisymbol_to_symbol),
3811         (_bfd_nodynamic_get_synthetic_symtab): New functions.
3812         * libbfd-in.h: Declare new functions.  Update existing defines,
3813         removing casts.
3814         * aix386-core.c: Update to use new hooks.  Formatting.
3815         * aout-adobe.c: Likewise.
3816         * aout-arm.c: Likewise.
3817         * aout-target.h: Likewise.
3818         * aout-tic30.c: Likewise.
3819         * aoutf1.h: Likewise.
3820         * binary.c: Likewise.
3821         * bout.c: Likewise.
3822         * cisco-core.c: Likewise.
3823         * coff-alpha.c: Likewise.
3824         * coff-i386.c: Likewise.
3825         * coff-i860.c: Likewise.
3826         * coff-i960.c: Likewise.
3827         * coff-ia64.c: Likewise.
3828         * coff-mips.c: Likewise.
3829         * coff-ppc.c: Likewise.
3830         * coff-rs6000.c: Likewise.
3831         * coff-sh.c: Likewise.
3832         * coff-tic30.c: Likewise.
3833         * coff-tic54x.c: Likewise.
3834         * coff-x86_64.c: Likewise.
3835         * coff64-rs6000.c: Likewise.
3836         * coffcode.h: Likewise.
3837         * elf-m10300.c: Likewise.
3838         * elf32-cr16.c: Likewise.
3839         * elf32-lm32.c: Likewise.
3840         * elf32-m32r.c: Likewise.
3841         * elf32-metag.c: Likewise.
3842         * elf32-score.c: Likewise.
3843         * elf32-score7.c: Likewise.
3844         * elf32-tilepro.c: Likewise.
3845         * elf32-xstormy16.c: Likewise.
3846         * elf32-xtensa.c: Likewise.
3847         * elf64-alpha.c: Likewise.
3848         * elf64-hppa.c: Likewise.
3849         * elf64-ia64-vms.c: Likewise.
3850         * elf64-mmix.c: Likewise.
3851         * elf64-sh64.c: Likewise.
3852         * elfnn-ia64.c: Likewise.
3853         * elfxx-sparc.c: Likewise.
3854         * elfxx-target.h: Likewise.
3855         * elfxx-tilegx.c: Likewise.
3856         * elfxx-x86.h: Likewise.
3857         * hp300hpux.c: Likewise.
3858         * hppabsd-core.c: Likewise.
3859         * hpux-core.c: Likewise.
3860         * i386msdos.c: Likewise.
3861         * i386os9k.c: Likewise.
3862         * ieee.c: Likewise.
3863         * ihex.c: Likewise.
3864         * irix-core.c: Likewise.
3865         * libaout.h: Likewise.
3866         * libecoff.h: Likewise.
3867         * mach-o-target.c: Likewise.
3868         * mach-o.c: Likewise.
3869         * mipsbsd.c: Likewise.
3870         * mmo.c: Likewise.
3871         * netbsd-core.c: Likewise.
3872         * nlm-target.h: Likewise.
3873         * oasys.c: Likewise.
3874         * osf-core.c: Likewise.
3875         * pdp11.c: Likewise.
3876         * pe-mips.c: Likewise.
3877         * pe-x86_64.c: Likewise.
3878         * pef.c: Likewise.
3879         * plugin.c: Likewise.
3880         * ppcboot.c: Likewise.
3881         * ptrace-core.c: Likewise.
3882         * sco5-core.c: Likewise.
3883         * som.c: Likewise.
3884         * sparclynx.c: Likewise.
3885         * srec.c: Likewise.
3886         * tekhex.c: Likewise.
3887         * trad-core.c: Likewise.
3888         * verilog.c: Likewise.
3889         * versados.c: Likewise.
3890         * vms-alpha.c: Likewise.
3891         * vms-lib.c: Likewise.
3892         * wasm-module.c: Likewise.
3893         * xsym.c: Likewise.
3894         * libbfd.h: Regenerate.
3895
3896 2018-02-15  Jim Wilson  <jimw@sifive.com>
3897
3898         * elfnn-riscv.c (_bfd_riscv_relax_section): Ifdef out check to ignore
3899         symbols whose section address is zero.
3900
3901         * elfnn-riscv.c (riscv_elf_relocate_section): Use bfd_reloc_dangerous
3902         when pcrel_lo reloc has an addend.  Use reloc_dangerous callback for
3903         bfd_reloc_dangerous.  Use einfo instead of warning callback for errors.
3904         Add %X%P to error messages.
3905
3906 2018-02-15  Eric Botcazou  <ebotcazou@adacore.com>
3907
3908         PR ld/22832
3909         * elfxx-sparc.c (_bfd_sparc_elf_check_relocs) <R_SPARC_TLS_GD_CALL>:
3910         Pass FALSE instead of TRUE as 'create' argument to bfd_link_hash_lookup
3911         and assert that the result of the call is not NULL.
3912
3913 2018-02-14  Nick Clifton  <nickc@redhat.com>
3914
3915         PR 22823
3916         Revert previous delta.  Add extra casts to avoid compile time
3917         warnings instead.
3918         * libbfd-in.h (_bfd_generic_bfd_copy_private_bfd_data): Add extra
3919         cast to avoid warning from gcc v8 compiler.
3920         (_bfd_generic_bfd_merge_private_bfd_data): Likewise.
3921         (_bfd_generic_bfd_set_private_flags): Likewise.
3922         (_bfd_generic_bfd_copy_private_section_data): Likewise.
3923         (_bfd_generic_bfd_copy_private_symbol_data): Likewise.
3924         (_bfd_generic_bfd_copy_private_header_data): Likewise.
3925         (_bfd_generic_bfd_print_private_bfd_data): Likewise.
3926         (_bfd_noarchive_construct_extended_name_table): Likewise.
3927         (_bfd_noarchive_truncate_arname): Likewise.
3928         (_bfd_noarchive_write_ar_hdr): Likewise.
3929         (_bfd_noarchive_get_elt_at_index): Likewise.
3930         (_bfd_nosymbols_canonicalize_symtab): Likewise.
3931         (_bfd_nosymbols_print_symbol): Likewise.
3932         (_bfd_nosymbols_get_symbol_info): Likewise.
3933         (_bfd_nosymbols_get_symbol_version_string): Likewise.
3934         (_bfd_nosymbols_bfd_is_local_label_name): Likewise.
3935         (_bfd_nosymbols_bfd_is_target_special_symbol): Likewise.
3936         (_bfd_nosymbols_get_lineno): Likewise.
3937         (_bfd_nosymbols_find_nearest_line): Likewise.
3938         (_bfd_nosymbols_find_line): Likewise.
3939         (_bfd_nosymbols_find_inliner_info): Likewise.
3940         (_bfd_nosymbols_bfd_make_debug_symbol): Likewise.
3941         (_bfd_nosymbols_read_minisymbols): Likewise.
3942         (_bfd_nosymbols_minisymbol_to_symbol): Likewise.
3943         (_bfd_norelocs_bfd_reloc_type_lookup): Likewise.
3944         (_bfd_norelocs_bfd_reloc_name_lookup): Likewise.
3945         (_bfd_nowrite_set_arch_mach): Likewise.
3946         (_bfd_nowrite_set_section_contents): Likewise.
3947         (_bfd_nolink_sizeof_headers): Likewise.
3948         (_bfd_nolink_bfd_get_relocated_section_contents): Likewise.
3949         (_bfd_nolink_bfd_relax_section): Likewise.
3950         (_bfd_nolink_bfd_gc_sections): Likewise.
3951         (_bfd_nolink_bfd_lookup_section_flags): Likewise.
3952         (_bfd_nolink_bfd_merge_sections): Likewise.
3953         (_bfd_nolink_bfd_is_group_section): Likewise.
3954         (_bfd_nolink_bfd_discard_group): Likewise.
3955         (_bfd_nolink_bfd_link_hash_table_create): Likewise.
3956         (_bfd_nolink_bfd_link_add_symbols): Likewise.
3957         (_bfd_nolink_bfd_link_just_syms): Likewise.
3958         (_bfd_nolink_bfd_copy_link_hash_symbol_type): Likewise.
3959         (_bfd_nolink_bfd_final_link): Likewise.
3960         (_bfd_nolink_bfd_link_split_section): Likewise.
3961         (_bfd_nolink_section_already_linked): Likewise.
3962         (_bfd_nolink_bfd_define_common_symbol): Likewise.
3963         (_bfd_nolink_bfd_define_start_stop): Likewise.
3964         (_bfd_nodynamic_canonicalize_dynamic_symtab): Likewise.
3965         (_bfd_nodynamic_get_synthetic_symtab): Likewise.
3966         (_bfd_nodynamic_get_dynamic_reloc_upper_bound _bfd_): Likewise.
3967         (_bfd_nodynamic_canonicalize_dynamic_reloc): Likewise.
3968         * libbfd.c (bfd_false_any): Delete.
3969         (bfd_true_any, bfd_nullvoidptr_any, bfd_0_any): Delete.
3970         (bfd_0u_any, bfd_0l_any, _bfd_n1_any, bfd_void_any): Delete.
3971         * libbfd.h (extern): Regenerate
3972         * aout-target.h (MY_bfd_is_target_special_symbol): Add extra
3973         cast to avoid warning from gcc v8 compiler.
3974         * aout-tic30.c (tic30_aout_set_arch_mach): Likewise.
3975         * binary.c (binary_get_symbol_info): Likewise.
3976         * coff-alpha.c (alpha_ecoff_backend_data): Likewise.
3977         * coff-mips.c (mips_ecoff_backend_data): Likewise.
3978         * coffcode.h (coff_set_alignment_hook): Likewise.
3979         (symname_in_debug_hook): Likewise.
3980         (bfd_coff_backend_data bigobj_swap_table): Likewise.
3981         * elf-m10300.c (elf_backend_omit_section_dynsym): Likewise.
3982         * elf32-cr16.c (elf_backend_omit_section_dynsym): Likewise.
3983         * elf32-lm32.c (elf_backend_omit_section_dynsym): Likewise.
3984         * elf32-m32r.c (elf_backend_omit_section_dynsym): Likewise.
3985         * elf32-metag.c (elf_backend_omit_section_dynsym): Likewise.
3986         * elf32-score.c (elf_backend_omit_section_dynsym): Likewise.
3987         * elf32-score7.c (elf_backend_omit_section_dynsym): Likewise.
3988         * elf32-xstormy16.c (elf_backend_omit_section_dynsym): Likewise.
3989         * elf32-xtensa.c (elf_backend_omit_section_dynsym): Likewise.
3990         * elf64-alpha.c (elf_backend_omit_section_dynsym): Likewise.
3991         * elf64-hppa.c (elf_backend_omit_section_dynsym): Likewise.
3992         * elf64-ia64-vms.c (elf_backend_omit_section_dynsym): Likewise.
3993         * elf64-mmix.c (elf_backend_omit_section_dynsym): Likewise.
3994         * elf64-sh64.c (elf_backend_omit_section_dynsym): Likewise.
3995         * elfnn-ia64.c (elf_backend_omit_section_dynsym): Likewise.
3996         * elfxx-target.h (bfd_elfNN_bfd_debug_info_accumulate): Likewise.
3997         (bfd_elfNN_bfd_make_debug_symbol): Likewise.
3998         (bfd_elfNN_bfd_merge_private_bfd_data): Likewise.
3999         (bfd_elfNN_bfd_set_private_flags): Likewise.
4000         (bfd_elfNN_bfd_is_target_special_symbol): Likewise.
4001         (elf_backend_init_index_section): Likewise.
4002         (elf_backend_allow_non_load_phdr): Likewise.
4003         * elfxx-x86.h (elf_backend_omit_section_dynsym): Likewise.
4004         * i386msdos.c (msdos_bfd_is_target_special_symbol): Likewise.
4005         * ieee.c (ieee_construct_extended_name_table): Likewise.
4006         (ieee_write_armap): Likewise.
4007         (ieee_write_ar_hdr): Likewise.
4008         (ieee_bfd_is_target_special_symbol): Likewise.
4009         * ihex.c (ihex_canonicalize_symtab): Likewise.
4010         (ihex_bfd_is_target_special_symbol): Likewise.
4011         * libaout.h (aout_32_bfd_is_target_special_symbol): Likewise.
4012         * libecoff.h (_bfd_ecoff_bfd_is_target_special_symbol): Likewise.
4013         (_bfd_ecoff_set_alignment_hook): Likewise.
4014         * mach-o-target.c (bfd_mach_o_bfd_is_target_special_symbol): Likewise.
4015         * mmo.c (mmo_bfd_is_target_special_symbol): Likewise.
4016         * nlm-target.h (nlm_bfd_is_target_special_symbol): Likewise.
4017         * oasys.c (oasys_construct_extended_name_table): Likewise.
4018         (oasys_write_armap): Likewise.
4019         (oasys_write_ar_hdr): Likewise.
4020         (oasys_bfd_is_target_special_symbol): Likewise.
4021         * pef.c (bfd_pef_bfd_is_target_special_symbol): Likewise.
4022         * plugin.c (bfd_plugin_bfd_is_target_special_symbol): Likewise.
4023         * ppcboot.c (ppcboot_bfd_is_target_special_symbol): Likewise.
4024         * som.c (som_bfd_is_target_special_symbol): Likewise.
4025         * srec.c (srec_bfd_is_target_special_symbol): Likewise.
4026         * tekhex.c (tekhex_bfd_is_target_special_symbol): Likewise.
4027         * verilog.c (verilog_bfd_is_target_special_symbol): Likewise.
4028         * versados.c (versados_bfd_is_target_special_symbol): Likewise.
4029         (versados_bfd_reloc_name_lookup): Likewise.
4030         * vms-alpha.c (vms_bfd_is_target_special_symbol): Likewise.
4031         (vms_bfd_define_start_stop): Likewise.
4032         (alpha_vms_bfd_is_target_special_symbol): Likewise.
4033         * wasm-module.c (wasm_bfd_is_target_special_symbol): Likewise.
4034         * xsym.c (bfd_sym_bfd_is_target_special_symbol): Likewise.
4035
4036 2018-02-14  H.J. Lu  <hongjiu.lu@intel.com>
4037
4038         PR ld/22842
4039         * elf32-i386.c (elf_i386_check_relocs): Pass FALSE for non
4040         PC-relative PLT to NEED_DYNAMIC_RELOCATION_P.
4041         * elf64-x86-64.c (elf_x86_64_check_relocs): Create PLT for
4042         R_X86_64_PC32 reloc against dynamic function in data section.
4043         Pass TRUE for PC-relative PLT to NEED_DYNAMIC_RELOCATION_P.
4044         (elf_x86_64_relocate_section): Use PLT for R_X86_64_PC32 reloc
4045         against dynamic function in data section.
4046         * elfxx-x86.c (elf_x86_allocate_dynrelocs): Use PLT in PIE as
4047         function address only if pcrel_plt is true.
4048         (_bfd_x86_elf_link_hash_table_create): Set pcrel_plt.
4049         * elfxx-x86.h (NEED_DYNAMIC_RELOCATION_P): Add PCREL_PLT for
4050         PC-relative PLT.  If PLT is PC-relative, don't generate dynamic
4051         PC-relative relocation against a function definition in data
4052         secton in PIE.  Remove the obsolete comments.
4053         (elf_x86_link_hash_table): Add pcrel_plt.
4054
4055 2018-02-13  H.J. Lu  <hongjiu.lu@intel.com>
4056
4057         * elfxx-x86.c (elf_x86_allocate_dynrelocs): Check bfd_link_dll,
4058         instead of bfd_link_pic, for building shared library.
4059
4060 2018-02-13  H.J. Lu  <hongjiu.lu@intel.com>
4061
4062         PR gas/22791
4063         * elf64-x86-64.c (is_32bit_relative_branch): Removed.
4064         (elf_x86_64_relocate_section): Check PIC relocations in PIE.
4065         Remove is_32bit_relative_branch usage.  Disallow PC32 reloc
4066         against protected function in shared object.
4067
4068 2018-02-13  Sergei Trofimovich  <slyfox@inbox.ru>
4069
4070         PR 22828
4071         * po/ru.po: Fix typo in Russian translation.
4072
4073 2018-02-13  Maciej W. Rozycki  <macro@mips.com>
4074
4075         * wasm-module.c (wasm_scan_name_function_section): Rename
4076         `index' local variable to `idx'.
4077
4078 2018-02-13  Nick Clifton  <nickc@redhat.com>
4079
4080         PR 22823
4081         Fix compile time warnings generated by gcc version 8.
4082         * libbfd-in.h: Remove extraneous text from prototypes.
4083         Add prototypes for bfd_false_any, bfd_true_any,
4084         bfd_nullvoidptr_any, bfd_0_any, bfd_0u_any, bfd_0l_any,
4085         bfd_n1_any, bfd_void_any.
4086         (_bfd_generic_bfd_copy_private_bfd_data): Use vararg based dummy
4087         function.
4088         (_bfd_generic_bfd_merge_private_bfd_data): Likewise.
4089         (_bfd_generic_bfd_set_private_flags): Likewise.
4090         (_bfd_generic_bfd_copy_private_section_data): Likewise.
4091         (_bfd_generic_bfd_copy_private_symbol_data): Likewise.
4092         (_bfd_generic_bfd_copy_private_header_data): Likewise.
4093         (_bfd_generic_bfd_print_private_bfd_data): Likewise.
4094         (_bfd_noarchive_construct_extended_name_table): Likewise.
4095         (_bfd_noarchive_truncate_arname): Likewise.
4096         (_bfd_noarchive_write_ar_hdr): Likewise.
4097         (_bfd_noarchive_get_elt_at_index): Likewise.
4098         (_bfd_nosymbols_canonicalize_symtab): Likewise.
4099         (_bfd_nosymbols_print_symbol): Likewise.
4100         (_bfd_nosymbols_get_symbol_info): Likewise.
4101         (_bfd_nosymbols_get_symbol_version_string): Likewise.
4102         (_bfd_nosymbols_bfd_is_local_label_name): Likewise.
4103         (_bfd_nosymbols_bfd_is_target_special_symbol): Likewise.
4104         (_bfd_nosymbols_get_lineno): Likewise.
4105         (_bfd_nosymbols_find_nearest_line): Likewise.
4106         (_bfd_nosymbols_find_line): Likewise.
4107         (_bfd_nosymbols_find_inliner_info): Likewise.
4108         (_bfd_nosymbols_bfd_make_debug_symbol): Likewise.
4109         (_bfd_nosymbols_read_minisymbols): Likewise.
4110         (_bfd_nosymbols_minisymbol_to_symbol): Likewise.
4111         (_bfd_norelocs_bfd_reloc_type_lookup): Likewise.
4112         (_bfd_norelocs_bfd_reloc_name_lookup): Likewise.
4113         (_bfd_nowrite_set_arch_mach): Likewise.
4114         (_bfd_nowrite_set_section_contents): Likewise.
4115         (_bfd_nolink_sizeof_headers): Likewise.
4116         (_bfd_nolink_bfd_get_relocated_section_contents): Likewise.
4117         (_bfd_nolink_bfd_relax_section): Likewise.
4118         (_bfd_nolink_bfd_gc_sections): Likewise.
4119         (_bfd_nolink_bfd_lookup_section_flags): Likewise.
4120         (_bfd_nolink_bfd_merge_sections): Likewise.
4121         (_bfd_nolink_bfd_is_group_section): Likewise.
4122         (_bfd_nolink_bfd_discard_group): Likewise.
4123         (_bfd_nolink_bfd_link_hash_table_create): Likewise.
4124         (_bfd_nolink_bfd_link_add_symbols): Likewise.
4125         (_bfd_nolink_bfd_link_just_syms): Likewise.
4126         (_bfd_nolink_bfd_copy_link_hash_symbol_type): Likewise.
4127         (_bfd_nolink_bfd_final_link): Likewise.
4128         (_bfd_nolink_bfd_link_split_section): Likewise.
4129         (_bfd_nolink_section_already_linked): Likewise.
4130         (_bfd_nolink_bfd_define_common_symbol): Likewise.
4131         (_bfd_nolink_bfd_define_start_stop): Likewise.
4132         (_bfd_nodynamic_canonicalize_dynamic_symtab): Likewise.
4133         (_bfd_nodynamic_get_synthetic_symtab): Likewise.
4134         (_bfd_nodynamic_get_dynamic_reloc_upper_bound _bfd_): Likewise.
4135         (_bfd_nodynamic_canonicalize_dynamic_reloc): Likewise.
4136         * libbfd.c (bfd_false_any): New function.  Like bfd_false but
4137         accepts one or more arguments.
4138         (bfd_true_any): Likewise.
4139         (bfd_nullvoidptr_any): Likewise.
4140         (bfd_0_any): Likewise.
4141         (bfd_0u_any): Likewise.
4142         (bfd_0l_any): Likewise.
4143         (_bfd_n1_any): Likewise.
4144         (bfd_void_any): Likewise.
4145         * libbfd.h (extern): Regenerate
4146         * aout-target.h (MY_bfd_is_target_special_symbol): Use vararg
4147         based dummy function.
4148         * aout-tic30.c (tic30_aout_set_arch_mach): Likewise.
4149         * binary.c (binary_get_symbol_info): Likewise.
4150         * coff-alpha.c (alpha_ecoff_backend_data): Likewise.
4151         * coff-mips.c (mips_ecoff_backend_data): Likewise.
4152         * coffcode.h (coff_set_alignment_hook): Likewise.
4153         (symname_in_debug_hook): Likewise.
4154         (bfd_coff_backend_data bigobj_swap_table): Likewise.
4155         * elf-m10300.c (elf_backend_omit_section_dynsym): Likewise.
4156         * elf32-cr16.c (elf_backend_omit_section_dynsym): Likewise.
4157         * elf32-lm32.c (elf_backend_omit_section_dynsym): Likewise.
4158         * elf32-m32r.c (elf_backend_omit_section_dynsym): Likewise.
4159         * elf32-metag.c (elf_backend_omit_section_dynsym): Likewise.
4160         * elf32-score.c (elf_backend_omit_section_dynsym): Likewise.
4161         * elf32-score7.c (elf_backend_omit_section_dynsym): Likewise.
4162         * elf32-xstormy16.c (elf_backend_omit_section_dynsym): Likewise.
4163         * elf32-xtensa.c (elf_backend_omit_section_dynsym): Likewise.
4164         * elf64-alpha.c (elf_backend_omit_section_dynsym): Likewise.
4165         * elf64-hppa.c (elf_backend_omit_section_dynsym): Likewise.
4166         * elf64-ia64-vms.c (elf_backend_omit_section_dynsym): Likewise.
4167         * elf64-mmix.c (elf_backend_omit_section_dynsym): Likewise.
4168         * elf64-sh64.c (elf_backend_omit_section_dynsym): Likewise.
4169         * elfnn-ia64.c (elf_backend_omit_section_dynsym): Likewise.
4170         * elfxx-target.h (bfd_elfNN_bfd_debug_info_accumulate): Likewise.
4171         (bfd_elfNN_bfd_make_debug_symbol): Likewise.
4172         (bfd_elfNN_bfd_merge_private_bfd_data): Likewise.
4173         (bfd_elfNN_bfd_set_private_flags): Likewise.
4174         (bfd_elfNN_bfd_is_target_special_symbol): Likewise.
4175         (elf_backend_init_index_section): Likewise.
4176         (elf_backend_allow_non_load_phdr): Likewise.
4177         * elfxx-x86.h (elf_backend_omit_section_dynsym): Likewise.
4178         * i386msdos.c (msdos_bfd_is_target_special_symbol): Likewise.
4179         * ieee.c (ieee_construct_extended_name_table): Likewise.
4180         (ieee_write_armap): Likewise.
4181         (ieee_write_ar_hdr): Likewise.
4182         (ieee_bfd_is_target_special_symbol): Likewise.
4183         * ihex.c (ihex_canonicalize_symtab): Likewise.
4184         (ihex_bfd_is_target_special_symbol): Likewise.
4185         * libaout.h (aout_32_bfd_is_target_special_symbol): Likewise.
4186         * libecoff.h (_bfd_ecoff_bfd_is_target_special_symbol): Likewise.
4187         (_bfd_ecoff_set_alignment_hook): Likewise.
4188         * mach-o-target.c (bfd_mach_o_bfd_is_target_special_symbol): Likewise.
4189         * mmo.c (mmo_bfd_is_target_special_symbol): Likewise.
4190         * nlm-target.h (nlm_bfd_is_target_special_symbol): Likewise.
4191         * oasys.c (oasys_construct_extended_name_table): Likewise.
4192         (oasys_write_armap): Likewise.
4193         (oasys_write_ar_hdr): Likewise.
4194         (oasys_bfd_is_target_special_symbol): Likewise.
4195         * pef.c (bfd_pef_bfd_is_target_special_symbol): Likewise.
4196         * plugin.c (bfd_plugin_bfd_is_target_special_symbol): Likewise.
4197         * ppcboot.c (ppcboot_bfd_is_target_special_symbol): Likewise.
4198         * som.c (som_bfd_is_target_special_symbol): Likewise.
4199         * srec.c (srec_bfd_is_target_special_symbol): Likewise.
4200         * tekhex.c (tekhex_bfd_is_target_special_symbol): Likewise.
4201         * verilog.c (verilog_bfd_is_target_special_symbol): Likewise.
4202         * versados.c (versados_bfd_is_target_special_symbol): Likewise.
4203         (versados_bfd_reloc_name_lookup): Likewise.
4204         * vms-alpha.c (vms_bfd_is_target_special_symbol): Likewise.
4205         (vms_bfd_define_start_stop): Likewise.
4206         (alpha_vms_bfd_is_target_special_symbol): Likewise.
4207         * wasm-module.c (wasm_bfd_is_target_special_symbol): Likewise.
4208         * xsym.c (bfd_sym_bfd_is_target_special_symbol): Likewise.
4209         * elf32-arc.c (get_replace_function): Assign replacement function
4210         to func pointer.
4211         * elf32-i370.c (i370_noop): Update prototype.
4212
4213 2018-02-13  Alan Modra  <amodra@gmail.com>
4214
4215         PR 22836
4216         * elf.c (_bfd_elf_fixup_group_sections): Account for removed
4217         relocation sections.  If size reduces to just the flag word,
4218         remove that too and mark with SEC_EXCLUDE.
4219         * elflink.c (bfd_elf_final_link): Strip empty group sections.
4220
4221 2018-02-13  Alan Modra  <amodra@gmail.com>
4222
4223         PR 22829
4224         * elf.c (assign_file_positions_for_non_load_sections): Rewrite
4225         PT_GNU_RELRO setup.
4226
4227 2018-02-12  Zebediah Figura  <z.figura12@gmail.com>
4228
4229         * i386msdos.c (msdos_mkobject); New function.
4230         (msdos_object_p): New function.
4231         (i386_msdos_vec): Use msdos_object_p as the check_format
4232         function.
4233         * peicode.h: Rename external_PEI_DOS_hdr, DOSMAGIC, and
4234         NT_SIGNATURE to external_DOS_hdr, IMAGE_DOS_SIGNATURE, and
4235         IMAGE_NT_SIGNATURE.
4236         * peXXigen.c: Likewise.
4237         * coff-ia64.c: Likewise.
4238
4239 2018-02-12  Nick Clifton  <nickc@redhat.com>
4240
4241         * elf32-nds32.c (nds32_elf_relax_longjump3): Remove redundant
4242         assignment.
4243         * elf32-arc.c (elf_arc_relocate_section): Likewise.
4244
4245 2018-02-09  Eric Botcazou  <ebotcazou@adacore.com>
4246
4247         * elfxx-sparc.c (UNDEFINED_WEAK_RESOLVED_TO_ZERO): Reorder conditions.
4248         (sparc_elf_append_rela): Assert that there is enough room in section.
4249         (_bfd_sparc_elf_copy_indirect_symbol): Fix formatting.
4250         (_bfd_sparc_elf_adjust_dynamic_symbol): Minor tweak.
4251         (allocate_dynrelocs): Remove outdated comments and reorder conditions.
4252         For a symbol subject to a GOT relocation, reserve a slot in the
4253         relocation section if the symbol isn't dynamic and we are in PIC mode.
4254         (_bfd_sparc_elf_relocate_section) <R_SPARC_GOTDATA_OP>: If relocation
4255         is relaxed and a slot was reserved, generate a R_SPARC_NONE relocation.
4256         <R_SPARC_GOTDATA_OP_HIX22>: Adjust comments.
4257         <R_SPARC_PC10>: Reorder conditions.  Remove always-false assertion.
4258         (_bfd_sparc_elf_finish_dynamic_symbol): Rename local_undefweak into
4259         resolved_to_zero.  Do not generate a dynamic GOT relocation for an
4260         undefined weak symbol with non-default visibility.  Remove superfluous
4261         'else' and fix formatting.
4262
4263 2018-02-09  H.J. Lu  <hongjiu.lu@intel.com>
4264
4265         * elf32-i386.c (elf_i386_get_synthetic_symtab): Also handle
4266         is_solaris.
4267         (i386_elf32_sol2_vec): Don't declare.
4268         (elf_i386_link_setup_gnu_properties): Also handle is_solaris.
4269         Don't set need_global_offset_table.
4270         (elf_i386_solaris_arch_bed): New.
4271         (elf_backend_arch_data): Set to elf_i386_solaris_arch_bed for
4272         Solaris.
4273         * elf64-x86-64.c (elf_x86_64_get_synthetic_symtab): Check
4274         target_os != is_nacl instead of target_os == is_normal.
4275         (x86_64_elf64_sol2_vec): Don't declare.
4276         (elf_x86_64_link_setup_gnu_properties): Check target_os !=
4277         is_nacl instead of target_os == is_normal.  Don't set
4278         need_global_offset_table.
4279         (elf_x86_64_solaris_arch_bed): New.
4280         (elf_backend_arch_data): Set to elf_x86_64_solaris_arch_bed for
4281         Solaris.
4282         * elfxx-x86.c (_bfd_x86_elf_size_dynamic_sections): Keep
4283         _GLOBAL_OFFSET_TABLE_ for Solaris.
4284         (_bfd_x86_elf_link_setup_gnu_properties): Don't copy
4285         need_global_offset_table.
4286         * elfxx-x86.h (elf_x86_target_os): Add is_solaris.
4287         (elf_x86_link_hash_table): Remove need_global_offset_table.
4288         (elf_x86_init_table): Likewise.
4289
4290 2018-02-08  H.J. Lu  <hongjiu.lu@intel.com>
4291
4292         * elf32-i386.c (elf32_i386_copy_solaris_special_section_fields):
4293         Remove prototype.
4294         (i386_elf32_sol2_vec): Declared.
4295         (elf_i386_link_setup_gnu_properties): Set
4296         need_global_offset_table with info->output_bfd->xvec.
4297         * elf64-x86-64.c (elf64_x86_64_copy_solaris_special_section_fields):
4298         Remove prototype.
4299         (x86_64_elf64_sol2_vec): Declared.
4300         (elf_x86_64_link_setup_gnu_properties): Set
4301         need_global_offset_table with info->output_bfd->xvec.
4302
4303 2018-02-08  H.J. Lu  <hongjiu.lu@intel.com>
4304
4305         * elf32-i386.c (elf32_i386_copy_solaris_special_section_fields):
4306         New prototype.
4307         (elf_i386_link_setup_gnu_properties): Set need_global_offset_table
4308         for Solaris.
4309         * elf64-x86-64.c (elf64_x86_64_copy_solaris_special_section_fields):
4310         New prototype.
4311         (elf_x86_64_link_setup_gnu_properties): Set
4312         need_global_offset_table for Solaris.
4313         * elfxx-x86.c (_bfd_x86_elf_size_dynamic_sections): Keep the
4314         unused _GLOBAL_OFFSET_TABLE_ for Solaris.
4315         (_bfd_x86_elf_link_setup_gnu_properties): Copy
4316         need_global_offset_table.
4317         * elfxx-x86.h (elf_x86_link_hash_table): Add
4318         need_global_offset_table.
4319         (elf_x86_init_table): Likewise.
4320
4321 2018-02-08  Jim Wilson  <jimw@sifive.com>
4322
4323         * elfnn-riscv.c (riscv_elf_relocate_section): Add comment for previous
4324         change.
4325
4326 2018-02-08  Nick Clifton  <nickc@redhat.com>
4327
4328         PR 22788
4329         * elf.c (elf_parse_notes): Reject notes with excessuively large
4330         alignments.
4331
4332 2018-02-07  Alan Modra  <amodra@gmail.com>
4333
4334         Revert 2018-01-17  Alan Modra  <amodra@gmail.com>
4335         * elf32-ppc.c: Remove speculation barrier support.
4336         * elf32-ppc.h: Likewise.
4337         * elf64-ppc.c: Likewise.
4338         * elf64-ppc.h: Likewise.
4339
4340 2018-02-06  Jim Wilson  <jimw@sifive.com>
4341
4342         * elfnn-riscv.c (riscv_elf_relocate_section): Return TRUE if used
4343         callback to report an error.
4344
4345 2018-02-06  Eric Botcazou  <ebotcazou@adacore.com>
4346
4347         PR ld/22263
4348         * elfxx-sparc.c (sparc_elf_tls_transition): Turn call to bfd_link_pic
4349         into call to !bfd_link_executable and tidy up.
4350         (_bfd_sparc_elf_check_relocs): Fix formatting and tidy up.
4351         <R_SPARC_TLS_LE_HIX22>: Turn call to bfd_link_pic into call to
4352         !bfd_link_executable.
4353         <R_SPARC_TLS_IE_HI22>: Likewise.
4354         <GOT relocations>: Remove useless code, tidy and merge related blocks.
4355         <R_SPARC_TLS_GD_CALL>: Turn call to bfd_link_pic into call to
4356         !bfd_link_executable.
4357         <R_SPARC_WPLT30>: Tidy up.
4358         (_bfd_sparc_elf_gc_mark_hook): Turn call to bfd_link_pic into call to
4359         !bfd_link_executable.
4360         (allocate_dynrelocs): Likewise.
4361         (_bfd_sparc_elf_relocate_section): Fix formatting and tidy up.
4362         <R_SPARC_TLS_GD_HI22>: Merge into...
4363         <R_SPARC_TLS_GD_LO10>: ...this.  Adjust 4th argument in call to
4364         sparc_elf_tls_transition and remove redundant code.
4365         <R_SPARC_TLS_LDM_HI22>: Turn call to bfd_link_pic into call to
4366         !bfd_link_executable.
4367         <R_SPARC_TLS_LDO_HIX22>: Likewise.
4368         <R_SPARC_TLS_LE_HIX22>: Likewise.  Tidy up.
4369         <R_SPARC_TLS_LDM_CALL>: Likewise.
4370         <R_SPARC_TLS_GD_CALL>: Likewise.  Tidy up.
4371         <R_SPARC_TLS_GD_ADD>: Likewise.
4372         <R_SPARC_TLS_LDM_ADD>: Likewise.
4373         <R_SPARC_TLS_LDO_ADD>: Likewise.
4374         <R_SPARC_TLS_IE_LD>: Likewise.
4375
4376 2018-02-06  MiloÅ¡ Stojanović  <milos.stojanovic@rt-rk.com>
4377
4378         PR 22789
4379         * elfxx-mips.c (_bfd_mips_elf_find_nearest_line): If the dwarf
4380         functions failed to find the function name, try the generic elf
4381         find function instead.
4382
4383 2018-02-06  Sergio Durigan Junior  <sergiodj@redhat.com>
4384
4385         * coff-rs6000.c (xcoff_write_archive_contents_old): Use
4386         'memcpy' instead of 'strncpy' when writing the magic number.
4387
4388 2018-02-06  Nick Clifton  <nickc@redhat.com>
4389
4390         PR 22794
4391         * opncls.c (bfd_get_debug_link_info_1): Check the size of the
4392         section before attempting to read it in.
4393         (bfd_get_alt_debug_link_info): Likewise.
4394
4395 2018-02-06  Paul Carroll  <pcarroll@codesourcery.com>
4396
4397         * bfd/dwarf2.c (find_abstract_name): Modified to return file and
4398         line information in addition to name, if they can be found.
4399
4400 2018-02-05  Renlin Li  <renlin.li@arm.com>
4401
4402         PR ld/22764
4403         * elfnn-aarch64.c (elfNN_aarch64_check_relocs): Relax the
4404         R_AARCH64_ABS32 and R_AARCH64_ABS16 for absolute symbol. Apply the
4405         check for writeable section as well.
4406
4407 2018-02-05  H.J. Lu  <hongjiu.lu@intel.com>
4408
4409         PR ld/22782
4410         * elf32-i386.c (elf_i386_check_relocs): Set got_referenced if
4411         _GLOBAL_OFFSET_TABLE_ is referenced or GOT is needed to resolve
4412         undefined weak symbol to 0.
4413         * elf64-x86-64.c (elf_x86_64_check_relocs): Set got_referenced
4414         if _GLOBAL_OFFSET_TABLE_ is referenced.
4415         * elfxx-x86.c (_bfd_x86_elf_size_dynamic_sections): Check
4416         got_referenced instead of ref_regular_nonweak.  Remove the
4417         unused _GLOBAL_OFFSET_TABLE_ from symbol table.
4418         * elfxx-x86.h (elf_x86_link_hash_table): Add got_referenced.
4419
4420 2018-02-05  Maciej W. Rozycki  <macro@mips.com>
4421
4422         * elfnn-riscv.c (_bfd_riscv_relax_pc): Use `memset' to
4423         initialize `hi_reloc'.
4424
4425 2018-02-05  Maciej W. Rozycki  <macro@mips.com>
4426
4427         * elfxx-mips.c (_bfd_mips_elf_section_processing): For
4428         SHT_MIPS_REGINFO sections don't assert the correct size and
4429         report an error instead.
4430
4431 2018-02-05  Maciej W. Rozycki  <macro@mips.com>
4432
4433         * elf.c (_bfd_elf_write_object_contents): Propagate a failure
4434         status from `->elf_backend_section_processing'.
4435
4436 2018-02-02  Jim Wilson  <jimw@sifive.com>
4437
4438         PR ld/22756
4439         * elfnn-riscv.c (riscv_relax_delete_bytes): New parameter link_info.
4440         If link_info->wrap_hash, check for a duplicate symbol and ignore.
4441         (_bfd_riscv_relax_call, bfd_riscv_relax_lui, _bfd_riscv_relax_tls_le):
4442         Pass new argument to riscv_relax_delete_bytes.
4443         (_bfd_riscv_relax_align, _bfd_riscv_relax_delete): Likewise.  Remove
4444         ATTRIBUTE_UNUSED from link_info parameter.
4445
4446 2018-02-02  Alan Modra  <amodra@gmail.com>
4447
4448         * elf64-ppc.c (ppc64_elf_relocate_section): Don't relocate nops
4449         emitted for toc sequence optimization.  Set and use "howto" later.
4450
4451 2018-02-01  Simon Marchi  <simon.marchi@ericsson.com>
4452
4453         * elf64-ppc.c (ppc64_elf_archive_symbol_lookup): Avoid pointer
4454         arithmetic on NULL pointer.
4455         * elflink.c (_bfd_elf_archive_symbol_lookup,
4456         elf_link_add_archive_symbols): Likewise.
4457
4458 2018-01-31  Michael Matz  <matz@suse.de>
4459
4460         * elflink.c (bfd_elf_define_start_stop): Fix check of
4461         def_dynamic.
4462
4463 2018-01-31  H.J. Lu  <hongjiu.lu@intel.com>
4464
4465         PR ld/21964
4466         * elflink.c (bfd_elf_define_start_stop): Check if __start and
4467         __stop symbols are referenced by shared objects.
4468
4469 2018-01-30  Alan Modra  <amodra@gmail.com>
4470
4471         PR 22758
4472         * elf.c (_bfd_elf_map_sections_to_segments): Don't start a new
4473         segment when demand paged with lma on the same page.  Test this
4474         before load/non-load, executable/non-executable,
4475         writable/non-writable tests and simplify.  Delete bogus relro
4476         condition in writable/non-writable test.  Delete outdated
4477         comment.  Formatting.
4478
4479 2018-01-30  Alan Modra  <amodra@gmail.com>
4480
4481         * elflink.c (bfd_elf_define_start_stop): Make __start and __stop
4482         symbols dynamic.
4483
4484 2018-01-29  Alan Modra  <amodra@gmail.com>
4485
4486         PR 22741
4487         * coffgen.c (coff_pointerize_aux): Ensure auxent tagndx is in
4488         range before converting to a symbol table pointer.
4489
4490 2018-01-27  Nick Clifton  <nickc@redhat.com>
4491
4492         * po/ru.po: Updated Russian translation.
4493
4494 2018-01-26  Alan Modra  <amodra@gmail.com>
4495
4496         * elflink.c (bfd_elf_define_start_stop): Override symbols when
4497         they are defined dynamically.
4498
4499 2018-01-26  Alan Modra  <amodra@gmail.com>
4500
4501         * elf64-ppc.c (ppc64_elf_size_stubs): Iterate sizing when
4502         .branch_lt changes size.
4503
4504 2018-01-25  Alan Modra  <amodra@gmail.com>
4505
4506         PR 22746
4507         * elfcode.h (elf_object_p): Avoid integer overflow.
4508
4509 2018-01-25  Eric Botcazou  <ebotcazou@adacore.com>
4510
4511         PR ld/22727
4512         * elfxx-sparc.c (_bfd_sparc_elf_check_relocs) <R_SPARC_TLS_GD_CALL>:
4513         Do a mere lookup of the __tls_get_addr symbol instead of adding it.
4514
4515         Revert
4516         2017-10-19  H.J. Lu  <hongjiu.lu@intel.com>
4517
4518         PR ld/22263
4519         * elfxx-sparc.c (sparc_elf_tls_transition): Replace
4520         bfd_link_pic with !bfd_link_executable, !bfd_link_pic with
4521         bfd_link_executable for TLS check.
4522         (_bfd_sparc_elf_check_relocs): Likewise.
4523         (allocate_dynrelocs): Likewise.
4524         (_bfd_sparc_elf_relocate_section): Likewise.
4525
4526 2018-01-24  Renlin Li  <renlin.li@arm.com>
4527
4528         * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Add support for
4529         BFD_RELOC_AARCH64_MOVW_PREL_G0, BFD_RELOC_AARCH64_MOVW_PREL_G0_NC,
4530         BFD_RELOC_AARCH64_MOVW_PREL_G1, BFD_RELOC_AARCH64_MOVW_PREL_G1_NC,
4531         BFD_RELOC_AARCH64_MOVW_PREL_G2, BFD_RELOC_AARCH64_MOVW_PREL_G2_NC,
4532         BFD_RELOC_AARCH64_MOVW_PREL_G3.
4533         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.
4534         (_bfd_aarch64_elf_resolve_relocation): Likewise.
4535
4536 2018-01-24  Renlin Li  <renlin.li@arm.com>
4537
4538         * reloc.c: Add BFD_RELOC_AARCH64_MOVW_PREL_G0,
4539         BFD_RELOC_AARCH64_MOVW_PREL_G0_NC, BFD_RELOC_AARCH64_MOVW_PREL_G1,
4540         BFD_RELOC_AARCH64_MOVW_PREL_G1_NC, BFD_RELOC_AARCH64_MOVW_PREL_G2,
4541         BFD_RELOC_AARCH64_MOVW_PREL_G2_NC, BFD_RELOC_AARCH64_MOVW_PREL_G3.
4542         * elfnn-aarch64.c (elfNN_aarch64_howto_table): Add entries for
4543         BFD_RELOC_AARCH64_MOVW_PREL_G0, BFD_RELOC_AARCH64_MOVW_PREL_G0_NC,
4544         BFD_RELOC_AARCH64_MOVW_PREL_G1, BFD_RELOC_AARCH64_MOVW_PREL_G1_NC,
4545         BFD_RELOC_AARCH64_MOVW_PREL_G2, BFD_RELOC_AARCH64_MOVW_PREL_G2_NC,
4546         BFD_RELOC_AARCH64_MOVW_PREL_G3.
4547         * bfd-in2.h: Regenerate.
4548         * libbfd.h: Regenerate.
4549
4550 2018-01-23  Maciej W. Rozycki  <macro@mips.com>
4551
4552         * elfxx-mips.c (_bfd_mips_elf_final_link): Update a stale
4553         `mips_elf32_section_processing' comment reference.
4554
4555 2018-01-20  H.J. Lu  <hongjiu.lu@intel.com>
4556
4557         PR ld/22721
4558         * elfxx-x86.c (_bfd_x86_elf_link_check_relocs): Check the
4559         versioned __tls_get_addr symbol.
4560
4561 2018-01-19  Nick Clifton  <nickc@redhat.com>
4562
4563         * po/fr.po: Updated French translation.
4564
4565 2018-01-18  Alan Modra  <amodra@gmail.com>
4566
4567         * elf32-ppc.c (ppc_elf_create_glink): Correct alignment of .glink.
4568         * elf64-ppc.c (ppc64_elf_size_stubs): Handle negative plt_stub_align.
4569         (ppc64_elf_build_stubs): Likewise.
4570
4571 2018-01-17  Nick Clifton  <nickc@redhat.com>
4572
4573         * po/ru.po: Updated Russian translation.
4574         * po/uk/po: Updated Ukranian translation.
4575
4576 2018-01-17  Alan Modra  <amodra@gmail.com>
4577
4578         * elf64-ppc.c (ppc64_elf_build_stubs): Silence gcc warning.
4579
4580 2018-01-17  Alan Modra  <amodra@gmail.com>
4581
4582         * elf32-ppc.c (GLINK_ENTRY_SIZE): Handle speculation barrier.
4583         (CRSETEQ, BEQCTRM): Define.
4584         (is_nonpic_glink_stub): Don't check bctr.
4585         (ppc_elf_link_hash_table_create): Init new ppc_elf_params field.
4586         (ppc_elf_relax_section): Size speculation barrier.
4587         (output_bctr): New function.
4588         (write_glink_stub): Use output_bctr.
4589         (ppc_elf_relocate_section): Use output_bctr for long branch stub.
4590         (ppc_elf_finish_dynamic_symbol): Likewise.
4591         (ppc_elf_finish_dynamic_sections): Use output_bctr.
4592         * elf32-ppc.h (struct ppc_elf_params): Add speculate_indirect_jumps.
4593         * elf64-ppc.c (CRSETEQ, BEQCTRM, BEQCTRLM): Define.
4594         (GLINK_PLTRESOLVE_SIZE): Size speculation barrier.
4595         (size_global_entry_stubs): Handle speculation barrier sizing.
4596         (plt_stub_size): Likewise.
4597         (output_bctr): New function.
4598         (build_plt_stub, build_tls_get_addr_stub): Output speculation
4599         barrier.
4600         (ppc_build_one_stub): Likewise for ppc_stub_plt_branch.
4601         (ppc_size_one_stub): Size speculation barrier in ppc_stub_plt_branch.
4602         (build_global_entry_stubs): Output speculation barrier.
4603         (ppc64_elf_build_stubs): Likewise in __glink_PLTresolve stub.
4604         * elf64-ppc.h (struct ppc64_elf_params): Add speculate_indirect_jumps.
4605
4606 2018-01-17  Alan Modra  <amodra@gmail.com>
4607
4608         * elf32-ppc.c (GLINK_ENTRY_SIZE): Add parameters, handle
4609         __tls_get_addr_opt, and alignment sizing.
4610         (TLS_GET_ADDR_GLINK_SIZE): Delete.
4611         (is_nonpic_glink_stub): Don't use GLINK_ENTRY_SIZE.
4612         (ppc_elf_get_synthetic_symtab): Recognize stubs spaced at 4, 6,
4613         or 8 insns.
4614         (ppc_elf_link_hash_table_create): Init new ppc_elf_params field.
4615         (allocate_dynrelocs): Use new GLINK_ENTRY_SIZE.
4616         (ppc_elf_size_dynamic_sections): Likewise.  Size branch table
4617         by PLT reloc count.
4618         (write_glink_stub): Handle __tls_get_addr_opt stub.
4619         Pad out to size given by GLINK_ENTRY_SIZE.
4620         (ppc_elf_relocate_section): Adjust write_glink_stub call.
4621         (ppc_elf_finish_dynamic_symbol): Likewise.
4622         (ppc_elf_finish_dynamic_sections): Write PLTresolve without using
4623         insn array since so many need rewriting.
4624         * elf32-ppc.h (struct ppc_elf_params): Add plt_stub_align.
4625         * elf64-ppc.c (GLINK_PLTRESOLVE_SIZE): Rename from
4626         GLINK_CALL_STUB_SIZE.  Add htab param and evaluate to size without
4627         nops.  Adjust all uses.
4628         (ppc64_elf_get_synthetic_symtab): Don't use GLINK_CALL_STUB_SIZE
4629         in glink_vma calculation.
4630         (struct ppc_link_hash_table): Add global_entry section pointer.
4631         (create_linkage_sections): Create separate section for global
4632         entry stubs.
4633         (PPC_LO, PPC_HI, PPC_HA): Move earlier.
4634         (size_global_entry_stubs): Handle sizing for aligned stubs.
4635         (ppc64_elf_size_dynamic_sections): Handle global_entry alloc,
4636         and don't stash end of glink branch table in rawsize.
4637         (ppc_build_one_stub): Rewrite stub size calculations.
4638         (build_global_entry_stubs): Use new section.
4639         (ppc64_elf_build_stubs): Don't pad __glink_PLTresolve with nops.
4640         Build lazy link stubs out to end of section.  Build global entry
4641         stubs in new section.
4642
4643 2018-01-15  Nick Clifton  <nickc@redhat.com>
4644
4645         * po/uk.po: Updated Ukranian translation.
4646
4647 2018-01-13  Nick Clifton  <nickc@redhat.com>
4648
4649         * po/bfd.pot: Regenerated.
4650
4651 2018-01-13  Nick Clifton  <nickc@redhat.com>
4652
4653         * version.m4: Bump version to 2.30.51
4654         * configure: Regenerate.
4655
4656 2018-01-13  Nick Clifton  <nickc@redhat.com>
4657
4658         2.30 branch created.
4659
4660 2018-01-12  Jens Widell  <jl@opera.com>
4661
4662         * elf.c (setup_group): Optimize search for group by remembering
4663         last found group and restarting search at that index.
4664         * elf-bfd.h (struct elf_obj_tdata): Add group_search_offset field.
4665
4666 2018-01-12  Gunther Nikl  <gnikl@users.sourceforge.net>
4667
4668         * aoutx.h (aout_link_check_ar_symbols): Remove default and handle
4669         bfd_link_common_skip_none in switch.
4670
4671 2018-01-12  Alan Modra  <amodra@gmail.com>
4672
4673         PR ld/22649
4674         * elf64-ppc.c (ppc64_elf_gc_mark_dynamic_ref): Ignore dynamic
4675         references on forced local symbols.
4676
4677 2018-01-12  Vlad Ivanov  <vlad@ivanov.email>
4678
4679         * elfxx-mips.c (_bfd_mips_elf_final_link): Notify user when
4680         .reginfo section has wrong size.
4681
4682 2018-01-11  H.J. Lu  <hongjiu.lu@intel.com>
4683
4684         PR ld/22393
4685         * elf.c (_bfd_elf_map_sections_to_segments): When generating
4686         separate code and read-only data LOAD segments, create a new
4687         LOAD segment if the previous section contains text and the
4688         current section doesn't or vice versa.  Don't put a writable
4689         section in a read-only segment if there is a RELRO segment.
4690
4691 2018-01-11  H.J. Lu  <hongjiu.lu@intel.com>
4692
4693         PR ld/22649
4694         * elflink.c (bfd_elf_gc_mark_dynamic_ref_symbol): Ignore dynamic
4695         references on forced local symbols.
4696
4697 2018-01-11  H.J. Lu  <hongjiu.lu@intel.com>
4698
4699         PR ld/22677
4700         * elflink.c (bfd_elf_gc_sections): Keep all PREINIT_ARRAY,
4701         INIT_ARRAY as well as FINI_ARRAY sections for ld -r --gc-section.
4702
4703 2018-01-09  Kuan-Lin Chen  <kuanlinchentw@gmail.com>
4704
4705         PR 22662
4706         * elf32-nds32.c (nds32_elf_relax_loadstore): Fix a typographical error.
4707
4708 2018-01-03  John Baldwin  <jhb@FreeBSD.org>
4709
4710         * elf.c (elfcore_grok_freebsd_note): Handle
4711         NT_FREEBSD_PROCSTAT_PROC, NT_FREEBSD_PROCSTAT_FILES, and
4712         NT_FREEBSD_PROCSTAT_VMMAP.
4713
4714 2018-01-03  Alan Modra  <amodra@gmail.com>
4715
4716         Update year range in copyright notice of all files.
4717
4718 For older changes see ChangeLog-2017
4719 \f
4720 Copyright (C) 2018 Free Software Foundation, Inc.
4721
4722 Copying and distribution of this file, with or without modification,
4723 are permitted in any medium without royalty provided the copyright
4724 notice and this notice are preserved.
4725
4726 Local Variables:
4727 mode: change-log
4728 left-margin: 8
4729 fill-column: 74
4730 version-control: never
4731 End: