PR22881, null pointer dereference in assign_file_positions_for_non_load_sections
[external/binutils.git] / bfd / ChangeLog
1 2018-02-23  Alan Modra  <amodra@gmail.com>
2
3         PR 22881
4         * elf.c (assign_file_positions_for_non_load_sections): Remove RELRO
5         segment if no matching LOAD segment.
6
7 2018-02-23  Kuan-Lin Chen  <kuanlinchentw@gmail.com>
8
9         * elf32-nds32.h: Define mask for ict_model.
10
11 2018-02-20  Jason Duerstock  <jason.duerstock@gmail.com>
12
13         * elfnn-ia64.c (elf_backend_can_gc_sections): Enable.
14
15 2018-02-19  Maciej W. Rozycki  <macro@mips.com>
16
17         Revert
18         2018-01-12  Vlad Ivanov  <vlad@ivanov.email>
19
20         * elfxx-mips.c (_bfd_mips_elf_final_link): Notify user when
21         .reginfo section has wrong size.
22
23 2018-02-19  Maciej W. Rozycki  <macro@mips.com>
24
25         * elfxx-mips.c (_bfd_mips_elf_always_size_sections): Set
26         SEC_FIXED_SIZE and SEC_HAS_CONTENTS flags for `.reginfo' and
27         `.MIPS.abiflags' sections.
28         (_bfd_mips_elf_final_link): Avoid reading beyond `.reginfo'
29         section's end.
30
31 2018-02-19  Maciej W. Rozycki  <macro@mips.com>
32
33         * section.c (SEC_FIXED_SIZE): New macro.
34         * bfd-in2.h: Regenerate.
35
36 2018-02-19  Maciej W. Rozycki  <macro@mips.com>
37
38         * section.c (SEC_HAS_GOT_REF): Remove macro.
39         * bfd-in2.h: Regenerate.
40
41 2018-02-19  Alan Modra  <amodra@gmail.com>
42
43         * elf-attrs.c (_bfd_elf_parse_attributes): Correct _bfd_error_handler
44         arguments.
45         * elfxx-mips.c (_bfd_mips_elf_final_link): Likewise.
46         * elfnn-riscv.c (_bfd_riscv_relax_align): Likewise.
47         (_bfd_riscv_relax_pc): Likewise and fix typos.
48         * libbfd-in.h (_bfd_error_handler): Add attribute printf.
49         * libbfd.h: Regenerate.
50
51 2018-02-19  Alan Modra  <amodra@gmail.com>
52
53         * dwarf2.c (read_section): Don't use 'll' format modifier.
54         (find_abstract_instance): Likewise.
55         * elfcore.h (elf_core_file_p): Likewise.
56
57 2018-02-19  Alan Modra  <amodra@gmail.com>
58
59         * bfd-in.h: Include inttypes.h or if not available define
60         PRId64, PRIu64 and PRIx64.
61         * bfd.c (_bfd_doprnt, _bfd_doprnt_scan): Remove support for L
62         modifier to print bfd_vma.
63         * coff-arm.c, * coff-mcore.c, * coff-ppc.c, * coff-rs6000.c,
64         * coff-sh.c, * coff-tic80.c, * coffcode.h, * coffgen.c, * cofflink.c,
65         * compress.c, * dwarf2.c, * elf-m10300.c, * elf.c, * elf32-arc.c,
66         * elf32-arm.c, * elf32-bfin.c, * elf32-cris.c, * elf32-hppa.c,
67         * elf32-i386.c, * elf32-ip2k.c, * elf32-lm32.c, * elf32-m32r.c,
68         * elf32-m68k.c, * elf32-metag.c, * elf32-nds32.c, * elf32-nios2.c,
69         * elf32-ppc.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c,
70         * elf32-score7.c, * elf32-sh.c, * elf32-sh64.c, * elf32-spu.c,
71         * elf32-tic6x.c, * elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c,
72         * elf32-xtensa.c, * elf64-alpha.c, * elf64-hppa.c, * elf64-ia64-vms.c,
73         * elf64-mmix.c, * elf64-s390.c, * elf64-sh64.c, * elf64-x86-64.c,
74         * elfcode.h, * elfcore.h, * elflink.c, * elfnn-aarch64.c,
75         * elfnn-ia64.c, * elfnn-riscv.c, * elfxx-mips.c, * elfxx-sparc.c,
76         * elfxx-tilegx.c, * ieee.c, * ihex.c, * mach-o.c, * merge.c, * mmo.c,
77         * peXXigen.c, * xcofflink.c: Replace use of Lx modifier with PRIx64,
78         and cast input to uint64_t, and similarly for Ld and Lu.
79         * bfd-in2.h: Regenerate.
80
81 2018-02-19  Alan Modra  <amodra@gmail.com>
82
83         * elf32-arm.c, * elf32-hppa.c, * elf32-lm32.c, * elf32-m32r.c,
84         * elf32-metag.c, * elf32-nds32.c, * elf32-or1k.c, * elf32-ppc.c,
85         * elf32-s390.c, * elf32-sh.c, * elf32-tic6x.c, * elf32-tilepro.c,
86         * elf64-ppc.c, * elf64-s390.c, * elflink.c, * elfnn-aarch64.c,
87         * elfnn-riscv.c, * elfxx-sparc.c, * elfxx-tilegx.c, * elfxx-x86.c,
88         * reloc.c: Replace use of %R and %T in format strings passed to
89         einfo and friends by %pR and %pT.
90
91 2018-02-19  Alan Modra  <amodra@gmail.com>
92
93         * bfd.c (_bfd_doprnt, _bfd_doprnt_scan): Handle %pA and %pB in place
94         of %A and %B.
95         * aout-adobe.c: Update all messages using %A and %B.
96         * aout-cris.c: Likewise.
97         * aoutx.h: Likewise.
98         * archive.c: Likewise.
99         * binary.c: Likewise.
100         * cache.c: Likewise.
101         * coff-alpha.c: Likewise.
102         * coff-arm.c: Likewise.
103         * coff-i860.c: Likewise.
104         * coff-mcore.c: Likewise.
105         * coff-ppc.c: Likewise.
106         * coff-rs6000.c: Likewise.
107         * coff-sh.c: Likewise.
108         * coff-tic4x.c: Likewise.
109         * coff-tic54x.c: Likewise.
110         * coff-tic80.c: Likewise.
111         * coff64-rs6000.c: Likewise.
112         * coffcode.h: Likewise.
113         * coffgen.c: Likewise.
114         * cofflink.c: Likewise.
115         * coffswap.h: Likewise.
116         * compress.c: Likewise.
117         * cpu-arm.c: Likewise.
118         * ecoff.c: Likewise.
119         * elf-attrs.c: Likewise.
120         * elf-eh-frame.c: Likewise.
121         * elf-ifunc.c: Likewise.
122         * elf-m10300.c: Likewise.
123         * elf-properties.c: Likewise.
124         * elf-s390-common.c: Likewise.
125         * elf.c: Likewise.
126         * elf32-arc.c: Likewise.
127         * elf32-arm.c: Likewise.
128         * elf32-avr.c: Likewise.
129         * elf32-bfin.c: Likewise.
130         * elf32-cr16.c: Likewise.
131         * elf32-cr16c.c: Likewise.
132         * elf32-cris.c: Likewise.
133         * elf32-crx.c: Likewise.
134         * elf32-d10v.c: Likewise.
135         * elf32-d30v.c: Likewise.
136         * elf32-epiphany.c: Likewise.
137         * elf32-fr30.c: Likewise.
138         * elf32-frv.c: Likewise.
139         * elf32-gen.c: Likewise.
140         * elf32-hppa.c: Likewise.
141         * elf32-i370.c: Likewise.
142         * elf32-i386.c: Likewise.
143         * elf32-i960.c: Likewise.
144         * elf32-ip2k.c: Likewise.
145         * elf32-iq2000.c: Likewise.
146         * elf32-lm32.c: Likewise.
147         * elf32-m32c.c: Likewise.
148         * elf32-m32r.c: Likewise.
149         * elf32-m68hc11.c: Likewise.
150         * elf32-m68hc12.c: Likewise.
151         * elf32-m68hc1x.c: Likewise.
152         * elf32-m68k.c: Likewise.
153         * elf32-mcore.c: Likewise.
154         * elf32-mep.c: Likewise.
155         * elf32-metag.c: Likewise.
156         * elf32-microblaze.c: Likewise.
157         * elf32-moxie.c: Likewise.
158         * elf32-msp430.c: Likewise.
159         * elf32-mt.c: Likewise.
160         * elf32-nds32.c: Likewise.
161         * elf32-nios2.c: Likewise.
162         * elf32-or1k.c: Likewise.
163         * elf32-pj.c: Likewise.
164         * elf32-ppc.c: Likewise.
165         * elf32-rl78.c: Likewise.
166         * elf32-rx.c: Likewise.
167         * elf32-s390.c: Likewise.
168         * elf32-score.c: Likewise.
169         * elf32-score7.c: Likewise.
170         * elf32-sh-symbian.c: Likewise.
171         * elf32-sh.c: Likewise.
172         * elf32-sh64.c: Likewise.
173         * elf32-sparc.c: Likewise.
174         * elf32-spu.c: Likewise.
175         * elf32-tic6x.c: Likewise.
176         * elf32-tilepro.c: Likewise.
177         * elf32-v850.c: Likewise.
178         * elf32-vax.c: Likewise.
179         * elf32-visium.c: Likewise.
180         * elf32-wasm32.c: Likewise.
181         * elf32-xgate.c: Likewise.
182         * elf32-xtensa.c: Likewise.
183         * elf64-alpha.c: Likewise.
184         * elf64-gen.c: Likewise.
185         * elf64-hppa.c: Likewise.
186         * elf64-ia64-vms.c: Likewise.
187         * elf64-mmix.c: Likewise.
188         * elf64-ppc.c: Likewise.
189         * elf64-s390.c: Likewise.
190         * elf64-sh64.c: Likewise.
191         * elf64-sparc.c: Likewise.
192         * elf64-x86-64.c: Likewise.
193         * elfcode.h: Likewise.
194         * elfcore.h: Likewise.
195         * elflink.c: Likewise.
196         * elfnn-aarch64.c: Likewise.
197         * elfnn-ia64.c: Likewise.
198         * elfnn-riscv.c: Likewise.
199         * elfxx-mips.c: Likewise.
200         * elfxx-sparc.c: Likewise.
201         * elfxx-tilegx.c: Likewise.
202         * elfxx-x86.c: Likewise.
203         * hpux-core.c: Likewise.
204         * ieee.c: Likewise.
205         * ihex.c: Likewise.
206         * libbfd.c: Likewise.
207         * linker.c: Likewise.
208         * mach-o.c: Likewise.
209         * merge.c: Likewise.
210         * mmo.c: Likewise.
211         * oasys.c: Likewise.
212         * pdp11.c: Likewise.
213         * pe-mips.c: Likewise.
214         * peXXigen.c: Likewise.
215         * peicode.h: Likewise.
216         * reloc.c: Likewise.
217         * rs6000-core.c: Likewise.
218         * srec.c: Likewise.
219         * stabs.c: Likewise.
220         * vms-alpha.c: Likewise.
221         * xcofflink.c: Likewise.
222
223 2018-02-19  Alan Modra  <amodra@gmail.com>
224
225         PR 22845
226         * elf.c (IS_TBSS): Define.
227         (_bfd_elf_map_sections_to_segments): Use IS_TBSS.
228         (assign_file_positions_for_non_load_sections): Revert last change.
229         Properly calculate load segment limits to compare against relro limits.
230
231 2018-02-17  Alan Modra  <amodra@gmail.com>
232
233         PR 22845
234         * elf.c (assign_file_positions_for_non_load_sections): Ignore
235         degenerate zero size PT_LOAD segments when finding one overlapping
236         the PT_GNU_RELRO segment.
237
238 2018-02-16  Alan Modra  <amodra@gmail.com>
239
240         * libbfd.c (_bfd_bool_bfd_false_error): Rename from bfd_false.
241         (_bfd_bool_bfd_true): Rename from bfd_true.
242         (_bfd_ptr_bfd_null_error): Rename from bfd_nullvoidptr.
243         (_bfd_int_bfd_0): Rename from bfd_0.
244         (_bfd_uint_bfd_0): Rename from bfd_0u.
245         (_bfd_long_bfd_0): Rename from bfd_0l.
246         (_bfd_long_bfd_n1_error): Rename from _bfd_n1.
247         (_bfd_void_bfd): Rename from bfd_void.
248         (_bfd_bool_bfd_false, _bfd_bool_bfd_asymbol_false),
249         (_bfd_bool_bfd_link_false_error),
250         (_bfd_bool_bfd_link_true, _bfd_bool_bfd_bfd_true),
251         (_bfd_bool_bfd_uint_true, _bfd_bool_bfd_ptr_true),
252         (_bfd_bool_bfd_asection_bfd_asection_true),
253         (_bfd_bool_bfd_asymbol_bfd_asymbol_true),
254         (_bfd_void_bfd_link, _bfd_void_bfd_asection): New functions.
255         * archive.c (_bfd_noarchive_get_elt_at_index),
256         (_bfd_noarchive_openr_next_archived_file),
257         (_bfd_noarchive_construct_extended_name_table),
258         (_bfd_noarchive_write_ar_hdr, _bfd_noarchive_truncate_arname),
259         (_bfd_noarchive_write_armap): New functions.
260         * archures.c (_bfd_nowrite_set_arch_mach): New function.
261         * coff-alpha.c (alpha_ecoff_swap_coff_aux_in),
262         (alpha_ecoff_swap_coff_sym_in, alpha_ecoff_swap_coff_lineno_in),
263         (alpha_ecoff_swap_coff_aux_out, alpha_ecoff_swap_coff_sym_out),
264         (alpha_ecoff_swap_coff_lineno_out),
265         (alpha_ecoff_swap_coff_reloc_out): New functions.
266         * coff-mips.c (mips_ecoff_swap_coff_aux_in),
267         (mips_ecoff_swap_coff_sym_in, mips_ecoff_swap_coff_lineno_in),
268         (mips_ecoff_swap_coff_aux_out, mips_ecoff_swap_coff_sym_out),
269         (mips_ecoff_swap_coff_lineno_out),
270         (mips_ecoff_swap_coff_reloc_out): New functions.
271         * coffcode.h (coff_set_alignment_hook): Replace define with
272         new function.
273         (symname_in_debug_hook): Likewise.
274         * ecoff.c (_bfd_ecoff_set_alignment_hook): New function.
275         * elfxx-target.h (elf_backend_allow_non_load_phdr): Default to 0.
276         * elf.c (assign_file_positions_except_relocs): Test
277         elf_backend_allow_non_load_phdr for NULL.
278         * elflink.c (_bfd_elf_omit_section_dynsym_default): Rename from
279         _bfd_elf_link_omit_section_dynsym.  Update uses.
280         (_bfd_elf_omit_section_dynsym_all): New function.
281         * elf-bfd.h (_bfd_elf_link_omit_section_dynsym): Delete.
282         (_bfd_elf_omit_section_dynsym_default): Declare.
283         (_bfd_elf_omit_section_dynsym_all): Declare.
284         * linker.c (_bfd_nolink_sizeof_headers, _bfd_nolink_bfd_relax_section),
285         (_bfd_nolink_bfd_get_relocated_section_contents),
286         (_bfd_nolink_bfd_lookup_section_flags),
287         (_bfd_nolink_bfd_is_group_section, _bfd_nolink_bfd_discard_group),
288         (_bfd_nolink_bfd_link_hash_table_create),
289         (_bfd_nolink_bfd_link_just_syms),
290         (_bfd_nolink_bfd_copy_link_hash_symbol_type),
291         (_bfd_nolink_bfd_link_split_section),
292         (_bfd_nolink_section_already_linked),
293         (_bfd_nolink_bfd_define_common_symbol),
294         (_bfd_nolink_bfd_define_start_stop): New functions.
295         * reloc.c (_bfd_norelocs_bfd_reloc_type_lookup),
296         (_bfd_norelocs_bfd_reloc_name_lookup),
297         (_bfd_nodynamic_canonicalize_dynamic_reloc): New functions.
298         * section.c (_bfd_nowrite_set_section_contents): New function.
299         * syms.c (_bfd_nosymbols_canonicalize_symtab),
300         (_bfd_nosymbols_print_symbol, _bfd_nosymbols_get_symbol_info),
301         (_bfd_nosymbols_get_symbol_version_string),
302         (_bfd_nosymbols_bfd_is_local_label_name),
303         (_bfd_nosymbols_get_lineno, _bfd_nosymbols_find_nearest_line),
304         (_bfd_nosymbols_find_line, _bfd_nosymbols_find_inliner_info),
305         (_bfd_nosymbols_bfd_make_debug_symbol),
306         ( _bfd_nosymbols_read_minisymbols),
307         ( _bfd_nosymbols_minisymbol_to_symbol),
308         (_bfd_nodynamic_get_synthetic_symtab): New functions.
309         * libbfd-in.h: Declare new functions.  Update existing defines,
310         removing casts.
311         * aix386-core.c: Update to use new hooks.  Formatting.
312         * aout-adobe.c: Likewise.
313         * aout-arm.c: Likewise.
314         * aout-target.h: Likewise.
315         * aout-tic30.c: Likewise.
316         * aoutf1.h: Likewise.
317         * binary.c: Likewise.
318         * bout.c: Likewise.
319         * cisco-core.c: Likewise.
320         * coff-alpha.c: Likewise.
321         * coff-i386.c: Likewise.
322         * coff-i860.c: Likewise.
323         * coff-i960.c: Likewise.
324         * coff-ia64.c: Likewise.
325         * coff-mips.c: Likewise.
326         * coff-ppc.c: Likewise.
327         * coff-rs6000.c: Likewise.
328         * coff-sh.c: Likewise.
329         * coff-tic30.c: Likewise.
330         * coff-tic54x.c: Likewise.
331         * coff-x86_64.c: Likewise.
332         * coff64-rs6000.c: Likewise.
333         * coffcode.h: Likewise.
334         * elf-m10300.c: Likewise.
335         * elf32-cr16.c: Likewise.
336         * elf32-lm32.c: Likewise.
337         * elf32-m32r.c: Likewise.
338         * elf32-metag.c: Likewise.
339         * elf32-score.c: Likewise.
340         * elf32-score7.c: Likewise.
341         * elf32-tilepro.c: Likewise.
342         * elf32-xstormy16.c: Likewise.
343         * elf32-xtensa.c: Likewise.
344         * elf64-alpha.c: Likewise.
345         * elf64-hppa.c: Likewise.
346         * elf64-ia64-vms.c: Likewise.
347         * elf64-mmix.c: Likewise.
348         * elf64-sh64.c: Likewise.
349         * elfnn-ia64.c: Likewise.
350         * elfxx-sparc.c: Likewise.
351         * elfxx-target.h: Likewise.
352         * elfxx-tilegx.c: Likewise.
353         * elfxx-x86.h: Likewise.
354         * hp300hpux.c: Likewise.
355         * hppabsd-core.c: Likewise.
356         * hpux-core.c: Likewise.
357         * i386msdos.c: Likewise.
358         * i386os9k.c: Likewise.
359         * ieee.c: Likewise.
360         * ihex.c: Likewise.
361         * irix-core.c: Likewise.
362         * libaout.h: Likewise.
363         * libecoff.h: Likewise.
364         * mach-o-target.c: Likewise.
365         * mach-o.c: Likewise.
366         * mipsbsd.c: Likewise.
367         * mmo.c: Likewise.
368         * netbsd-core.c: Likewise.
369         * nlm-target.h: Likewise.
370         * oasys.c: Likewise.
371         * osf-core.c: Likewise.
372         * pdp11.c: Likewise.
373         * pe-mips.c: Likewise.
374         * pe-x86_64.c: Likewise.
375         * pef.c: Likewise.
376         * plugin.c: Likewise.
377         * ppcboot.c: Likewise.
378         * ptrace-core.c: Likewise.
379         * sco5-core.c: Likewise.
380         * som.c: Likewise.
381         * sparclynx.c: Likewise.
382         * srec.c: Likewise.
383         * tekhex.c: Likewise.
384         * trad-core.c: Likewise.
385         * verilog.c: Likewise.
386         * versados.c: Likewise.
387         * vms-alpha.c: Likewise.
388         * vms-lib.c: Likewise.
389         * wasm-module.c: Likewise.
390         * xsym.c: Likewise.
391         * libbfd.h: Regenerate.
392
393 2018-02-15  Jim Wilson  <jimw@sifive.com>
394
395         * elfnn-riscv.c (_bfd_riscv_relax_section): Ifdef out check to ignore
396         symbols whose section address is zero.
397
398         * elfnn-riscv.c (riscv_elf_relocate_section): Use bfd_reloc_dangerous
399         when pcrel_lo reloc has an addend.  Use reloc_dangerous callback for
400         bfd_reloc_dangerous.  Use einfo instead of warning callback for errors.
401         Add %X%P to error messages.
402
403 2018-02-15  Eric Botcazou  <ebotcazou@adacore.com>
404
405         PR ld/22832
406         * elfxx-sparc.c (_bfd_sparc_elf_check_relocs) <R_SPARC_TLS_GD_CALL>:
407         Pass FALSE instead of TRUE as 'create' argument to bfd_link_hash_lookup
408         and assert that the result of the call is not NULL.
409
410 2018-02-14  Nick Clifton  <nickc@redhat.com>
411
412         PR 22823
413         Revert previous delta.  Add extra casts to avoid compile time
414         warnings instead.
415         * libbfd-in.h (_bfd_generic_bfd_copy_private_bfd_data): Add extra
416         cast to avoid warning from gcc v8 compiler.
417         (_bfd_generic_bfd_merge_private_bfd_data): Likewise.
418         (_bfd_generic_bfd_set_private_flags): Likewise.
419         (_bfd_generic_bfd_copy_private_section_data): Likewise.
420         (_bfd_generic_bfd_copy_private_symbol_data): Likewise.
421         (_bfd_generic_bfd_copy_private_header_data): Likewise.
422         (_bfd_generic_bfd_print_private_bfd_data): Likewise.
423         (_bfd_noarchive_construct_extended_name_table): Likewise.
424         (_bfd_noarchive_truncate_arname): Likewise.
425         (_bfd_noarchive_write_ar_hdr): Likewise.
426         (_bfd_noarchive_get_elt_at_index): Likewise.
427         (_bfd_nosymbols_canonicalize_symtab): Likewise.
428         (_bfd_nosymbols_print_symbol): Likewise.
429         (_bfd_nosymbols_get_symbol_info): Likewise.
430         (_bfd_nosymbols_get_symbol_version_string): Likewise.
431         (_bfd_nosymbols_bfd_is_local_label_name): Likewise.
432         (_bfd_nosymbols_bfd_is_target_special_symbol): Likewise.
433         (_bfd_nosymbols_get_lineno): Likewise.
434         (_bfd_nosymbols_find_nearest_line): Likewise.
435         (_bfd_nosymbols_find_line): Likewise.
436         (_bfd_nosymbols_find_inliner_info): Likewise.
437         (_bfd_nosymbols_bfd_make_debug_symbol): Likewise.
438         (_bfd_nosymbols_read_minisymbols): Likewise.
439         (_bfd_nosymbols_minisymbol_to_symbol): Likewise.
440         (_bfd_norelocs_bfd_reloc_type_lookup): Likewise.
441         (_bfd_norelocs_bfd_reloc_name_lookup): Likewise.
442         (_bfd_nowrite_set_arch_mach): Likewise.
443         (_bfd_nowrite_set_section_contents): Likewise.
444         (_bfd_nolink_sizeof_headers): Likewise.
445         (_bfd_nolink_bfd_get_relocated_section_contents): Likewise.
446         (_bfd_nolink_bfd_relax_section): Likewise.
447         (_bfd_nolink_bfd_gc_sections): Likewise.
448         (_bfd_nolink_bfd_lookup_section_flags): Likewise.
449         (_bfd_nolink_bfd_merge_sections): Likewise.
450         (_bfd_nolink_bfd_is_group_section): Likewise.
451         (_bfd_nolink_bfd_discard_group): Likewise.
452         (_bfd_nolink_bfd_link_hash_table_create): Likewise.
453         (_bfd_nolink_bfd_link_add_symbols): Likewise.
454         (_bfd_nolink_bfd_link_just_syms): Likewise.
455         (_bfd_nolink_bfd_copy_link_hash_symbol_type): Likewise.
456         (_bfd_nolink_bfd_final_link): Likewise.
457         (_bfd_nolink_bfd_link_split_section): Likewise.
458         (_bfd_nolink_section_already_linked): Likewise.
459         (_bfd_nolink_bfd_define_common_symbol): Likewise.
460         (_bfd_nolink_bfd_define_start_stop): Likewise.
461         (_bfd_nodynamic_canonicalize_dynamic_symtab): Likewise.
462         (_bfd_nodynamic_get_synthetic_symtab): Likewise.
463         (_bfd_nodynamic_get_dynamic_reloc_upper_bound _bfd_): Likewise.
464         (_bfd_nodynamic_canonicalize_dynamic_reloc): Likewise.
465         * libbfd.c (bfd_false_any): Delete.
466         (bfd_true_any, bfd_nullvoidptr_any, bfd_0_any): Delete.
467         (bfd_0u_any, bfd_0l_any, _bfd_n1_any, bfd_void_any): Delete.
468         * libbfd.h (extern): Regenerate
469         * aout-target.h (MY_bfd_is_target_special_symbol): Add extra
470         cast to avoid warning from gcc v8 compiler.
471         * aout-tic30.c (tic30_aout_set_arch_mach): Likewise.
472         * binary.c (binary_get_symbol_info): Likewise.
473         * coff-alpha.c (alpha_ecoff_backend_data): Likewise.
474         * coff-mips.c (mips_ecoff_backend_data): Likewise.
475         * coffcode.h (coff_set_alignment_hook): Likewise.
476         (symname_in_debug_hook): Likewise.
477         (bfd_coff_backend_data bigobj_swap_table): Likewise.
478         * elf-m10300.c (elf_backend_omit_section_dynsym): Likewise.
479         * elf32-cr16.c (elf_backend_omit_section_dynsym): Likewise.
480         * elf32-lm32.c (elf_backend_omit_section_dynsym): Likewise.
481         * elf32-m32r.c (elf_backend_omit_section_dynsym): Likewise.
482         * elf32-metag.c (elf_backend_omit_section_dynsym): Likewise.
483         * elf32-score.c (elf_backend_omit_section_dynsym): Likewise.
484         * elf32-score7.c (elf_backend_omit_section_dynsym): Likewise.
485         * elf32-xstormy16.c (elf_backend_omit_section_dynsym): Likewise.
486         * elf32-xtensa.c (elf_backend_omit_section_dynsym): Likewise.
487         * elf64-alpha.c (elf_backend_omit_section_dynsym): Likewise.
488         * elf64-hppa.c (elf_backend_omit_section_dynsym): Likewise.
489         * elf64-ia64-vms.c (elf_backend_omit_section_dynsym): Likewise.
490         * elf64-mmix.c (elf_backend_omit_section_dynsym): Likewise.
491         * elf64-sh64.c (elf_backend_omit_section_dynsym): Likewise.
492         * elfnn-ia64.c (elf_backend_omit_section_dynsym): Likewise.
493         * elfxx-target.h (bfd_elfNN_bfd_debug_info_accumulate): Likewise.
494         (bfd_elfNN_bfd_make_debug_symbol): Likewise.
495         (bfd_elfNN_bfd_merge_private_bfd_data): Likewise.
496         (bfd_elfNN_bfd_set_private_flags): Likewise.
497         (bfd_elfNN_bfd_is_target_special_symbol): Likewise.
498         (elf_backend_init_index_section): Likewise.
499         (elf_backend_allow_non_load_phdr): Likewise.
500         * elfxx-x86.h (elf_backend_omit_section_dynsym): Likewise.
501         * i386msdos.c (msdos_bfd_is_target_special_symbol): Likewise.
502         * ieee.c (ieee_construct_extended_name_table): Likewise.
503         (ieee_write_armap): Likewise.
504         (ieee_write_ar_hdr): Likewise.
505         (ieee_bfd_is_target_special_symbol): Likewise.
506         * ihex.c (ihex_canonicalize_symtab): Likewise.
507         (ihex_bfd_is_target_special_symbol): Likewise.
508         * libaout.h (aout_32_bfd_is_target_special_symbol): Likewise.
509         * libecoff.h (_bfd_ecoff_bfd_is_target_special_symbol): Likewise.
510         (_bfd_ecoff_set_alignment_hook): Likewise.
511         * mach-o-target.c (bfd_mach_o_bfd_is_target_special_symbol): Likewise.
512         * mmo.c (mmo_bfd_is_target_special_symbol): Likewise.
513         * nlm-target.h (nlm_bfd_is_target_special_symbol): Likewise.
514         * oasys.c (oasys_construct_extended_name_table): Likewise.
515         (oasys_write_armap): Likewise.
516         (oasys_write_ar_hdr): Likewise.
517         (oasys_bfd_is_target_special_symbol): Likewise.
518         * pef.c (bfd_pef_bfd_is_target_special_symbol): Likewise.
519         * plugin.c (bfd_plugin_bfd_is_target_special_symbol): Likewise.
520         * ppcboot.c (ppcboot_bfd_is_target_special_symbol): Likewise.
521         * som.c (som_bfd_is_target_special_symbol): Likewise.
522         * srec.c (srec_bfd_is_target_special_symbol): Likewise.
523         * tekhex.c (tekhex_bfd_is_target_special_symbol): Likewise.
524         * verilog.c (verilog_bfd_is_target_special_symbol): Likewise.
525         * versados.c (versados_bfd_is_target_special_symbol): Likewise.
526         (versados_bfd_reloc_name_lookup): Likewise.
527         * vms-alpha.c (vms_bfd_is_target_special_symbol): Likewise.
528         (vms_bfd_define_start_stop): Likewise.
529         (alpha_vms_bfd_is_target_special_symbol): Likewise.
530         * wasm-module.c (wasm_bfd_is_target_special_symbol): Likewise.
531         * xsym.c (bfd_sym_bfd_is_target_special_symbol): Likewise.
532
533 2018-02-14  H.J. Lu  <hongjiu.lu@intel.com>
534
535         PR ld/22842
536         * elf32-i386.c (elf_i386_check_relocs): Pass FALSE for non
537         PC-relative PLT to NEED_DYNAMIC_RELOCATION_P.
538         * elf64-x86-64.c (elf_x86_64_check_relocs): Create PLT for
539         R_X86_64_PC32 reloc against dynamic function in data section.
540         Pass TRUE for PC-relative PLT to NEED_DYNAMIC_RELOCATION_P.
541         (elf_x86_64_relocate_section): Use PLT for R_X86_64_PC32 reloc
542         against dynamic function in data section.
543         * elfxx-x86.c (elf_x86_allocate_dynrelocs): Use PLT in PIE as
544         function address only if pcrel_plt is true.
545         (_bfd_x86_elf_link_hash_table_create): Set pcrel_plt.
546         * elfxx-x86.h (NEED_DYNAMIC_RELOCATION_P): Add PCREL_PLT for
547         PC-relative PLT.  If PLT is PC-relative, don't generate dynamic
548         PC-relative relocation against a function definition in data
549         secton in PIE.  Remove the obsolete comments.
550         (elf_x86_link_hash_table): Add pcrel_plt.
551
552 2018-02-13  H.J. Lu  <hongjiu.lu@intel.com>
553
554         * elfxx-x86.c (elf_x86_allocate_dynrelocs): Check bfd_link_dll,
555         instead of bfd_link_pic, for building shared library.
556
557 2018-02-13  H.J. Lu  <hongjiu.lu@intel.com>
558
559         PR gas/22791
560         * elf64-x86-64.c (is_32bit_relative_branch): Removed.
561         (elf_x86_64_relocate_section): Check PIC relocations in PIE.
562         Remove is_32bit_relative_branch usage.  Disallow PC32 reloc
563         against protected function in shared object.
564
565 2018-02-13  Sergei Trofimovich  <slyfox@inbox.ru>
566
567         PR 22828
568         * po/ru.po: Fix typo in Russian translation.
569
570 2018-02-13  Maciej W. Rozycki  <macro@mips.com>
571
572         * wasm-module.c (wasm_scan_name_function_section): Rename
573         `index' local variable to `idx'.
574
575 2018-02-13  Nick Clifton  <nickc@redhat.com>
576
577         PR 22823
578         Fix compile time warnings generated by gcc version 8.
579         * libbfd-in.h: Remove extraneous text from prototypes.
580         Add prototypes for bfd_false_any, bfd_true_any,
581         bfd_nullvoidptr_any, bfd_0_any, bfd_0u_any, bfd_0l_any,
582         bfd_n1_any, bfd_void_any.
583         (_bfd_generic_bfd_copy_private_bfd_data): Use vararg based dummy
584         function.
585         (_bfd_generic_bfd_merge_private_bfd_data): Likewise.
586         (_bfd_generic_bfd_set_private_flags): Likewise.
587         (_bfd_generic_bfd_copy_private_section_data): Likewise.
588         (_bfd_generic_bfd_copy_private_symbol_data): Likewise.
589         (_bfd_generic_bfd_copy_private_header_data): Likewise.
590         (_bfd_generic_bfd_print_private_bfd_data): Likewise.
591         (_bfd_noarchive_construct_extended_name_table): Likewise.
592         (_bfd_noarchive_truncate_arname): Likewise.
593         (_bfd_noarchive_write_ar_hdr): Likewise.
594         (_bfd_noarchive_get_elt_at_index): Likewise.
595         (_bfd_nosymbols_canonicalize_symtab): Likewise.
596         (_bfd_nosymbols_print_symbol): Likewise.
597         (_bfd_nosymbols_get_symbol_info): Likewise.
598         (_bfd_nosymbols_get_symbol_version_string): Likewise.
599         (_bfd_nosymbols_bfd_is_local_label_name): Likewise.
600         (_bfd_nosymbols_bfd_is_target_special_symbol): Likewise.
601         (_bfd_nosymbols_get_lineno): Likewise.
602         (_bfd_nosymbols_find_nearest_line): Likewise.
603         (_bfd_nosymbols_find_line): Likewise.
604         (_bfd_nosymbols_find_inliner_info): Likewise.
605         (_bfd_nosymbols_bfd_make_debug_symbol): Likewise.
606         (_bfd_nosymbols_read_minisymbols): Likewise.
607         (_bfd_nosymbols_minisymbol_to_symbol): Likewise.
608         (_bfd_norelocs_bfd_reloc_type_lookup): Likewise.
609         (_bfd_norelocs_bfd_reloc_name_lookup): Likewise.
610         (_bfd_nowrite_set_arch_mach): Likewise.
611         (_bfd_nowrite_set_section_contents): Likewise.
612         (_bfd_nolink_sizeof_headers): Likewise.
613         (_bfd_nolink_bfd_get_relocated_section_contents): Likewise.
614         (_bfd_nolink_bfd_relax_section): Likewise.
615         (_bfd_nolink_bfd_gc_sections): Likewise.
616         (_bfd_nolink_bfd_lookup_section_flags): Likewise.
617         (_bfd_nolink_bfd_merge_sections): Likewise.
618         (_bfd_nolink_bfd_is_group_section): Likewise.
619         (_bfd_nolink_bfd_discard_group): Likewise.
620         (_bfd_nolink_bfd_link_hash_table_create): Likewise.
621         (_bfd_nolink_bfd_link_add_symbols): Likewise.
622         (_bfd_nolink_bfd_link_just_syms): Likewise.
623         (_bfd_nolink_bfd_copy_link_hash_symbol_type): Likewise.
624         (_bfd_nolink_bfd_final_link): Likewise.
625         (_bfd_nolink_bfd_link_split_section): Likewise.
626         (_bfd_nolink_section_already_linked): Likewise.
627         (_bfd_nolink_bfd_define_common_symbol): Likewise.
628         (_bfd_nolink_bfd_define_start_stop): Likewise.
629         (_bfd_nodynamic_canonicalize_dynamic_symtab): Likewise.
630         (_bfd_nodynamic_get_synthetic_symtab): Likewise.
631         (_bfd_nodynamic_get_dynamic_reloc_upper_bound _bfd_): Likewise.
632         (_bfd_nodynamic_canonicalize_dynamic_reloc): Likewise.
633         * libbfd.c (bfd_false_any): New function.  Like bfd_false but
634         accepts one or more arguments.
635         (bfd_true_any): Likewise.
636         (bfd_nullvoidptr_any): Likewise.
637         (bfd_0_any): Likewise.
638         (bfd_0u_any): Likewise.
639         (bfd_0l_any): Likewise.
640         (_bfd_n1_any): Likewise.
641         (bfd_void_any): Likewise.
642         * libbfd.h (extern): Regenerate
643         * aout-target.h (MY_bfd_is_target_special_symbol): Use vararg
644         based dummy function.
645         * aout-tic30.c (tic30_aout_set_arch_mach): Likewise.
646         * binary.c (binary_get_symbol_info): Likewise.
647         * coff-alpha.c (alpha_ecoff_backend_data): Likewise.
648         * coff-mips.c (mips_ecoff_backend_data): Likewise.
649         * coffcode.h (coff_set_alignment_hook): Likewise.
650         (symname_in_debug_hook): Likewise.
651         (bfd_coff_backend_data bigobj_swap_table): Likewise.
652         * elf-m10300.c (elf_backend_omit_section_dynsym): Likewise.
653         * elf32-cr16.c (elf_backend_omit_section_dynsym): Likewise.
654         * elf32-lm32.c (elf_backend_omit_section_dynsym): Likewise.
655         * elf32-m32r.c (elf_backend_omit_section_dynsym): Likewise.
656         * elf32-metag.c (elf_backend_omit_section_dynsym): Likewise.
657         * elf32-score.c (elf_backend_omit_section_dynsym): Likewise.
658         * elf32-score7.c (elf_backend_omit_section_dynsym): Likewise.
659         * elf32-xstormy16.c (elf_backend_omit_section_dynsym): Likewise.
660         * elf32-xtensa.c (elf_backend_omit_section_dynsym): Likewise.
661         * elf64-alpha.c (elf_backend_omit_section_dynsym): Likewise.
662         * elf64-hppa.c (elf_backend_omit_section_dynsym): Likewise.
663         * elf64-ia64-vms.c (elf_backend_omit_section_dynsym): Likewise.
664         * elf64-mmix.c (elf_backend_omit_section_dynsym): Likewise.
665         * elf64-sh64.c (elf_backend_omit_section_dynsym): Likewise.
666         * elfnn-ia64.c (elf_backend_omit_section_dynsym): Likewise.
667         * elfxx-target.h (bfd_elfNN_bfd_debug_info_accumulate): Likewise.
668         (bfd_elfNN_bfd_make_debug_symbol): Likewise.
669         (bfd_elfNN_bfd_merge_private_bfd_data): Likewise.
670         (bfd_elfNN_bfd_set_private_flags): Likewise.
671         (bfd_elfNN_bfd_is_target_special_symbol): Likewise.
672         (elf_backend_init_index_section): Likewise.
673         (elf_backend_allow_non_load_phdr): Likewise.
674         * elfxx-x86.h (elf_backend_omit_section_dynsym): Likewise.
675         * i386msdos.c (msdos_bfd_is_target_special_symbol): Likewise.
676         * ieee.c (ieee_construct_extended_name_table): Likewise.
677         (ieee_write_armap): Likewise.
678         (ieee_write_ar_hdr): Likewise.
679         (ieee_bfd_is_target_special_symbol): Likewise.
680         * ihex.c (ihex_canonicalize_symtab): Likewise.
681         (ihex_bfd_is_target_special_symbol): Likewise.
682         * libaout.h (aout_32_bfd_is_target_special_symbol): Likewise.
683         * libecoff.h (_bfd_ecoff_bfd_is_target_special_symbol): Likewise.
684         (_bfd_ecoff_set_alignment_hook): Likewise.
685         * mach-o-target.c (bfd_mach_o_bfd_is_target_special_symbol): Likewise.
686         * mmo.c (mmo_bfd_is_target_special_symbol): Likewise.
687         * nlm-target.h (nlm_bfd_is_target_special_symbol): Likewise.
688         * oasys.c (oasys_construct_extended_name_table): Likewise.
689         (oasys_write_armap): Likewise.
690         (oasys_write_ar_hdr): Likewise.
691         (oasys_bfd_is_target_special_symbol): Likewise.
692         * pef.c (bfd_pef_bfd_is_target_special_symbol): Likewise.
693         * plugin.c (bfd_plugin_bfd_is_target_special_symbol): Likewise.
694         * ppcboot.c (ppcboot_bfd_is_target_special_symbol): Likewise.
695         * som.c (som_bfd_is_target_special_symbol): Likewise.
696         * srec.c (srec_bfd_is_target_special_symbol): Likewise.
697         * tekhex.c (tekhex_bfd_is_target_special_symbol): Likewise.
698         * verilog.c (verilog_bfd_is_target_special_symbol): Likewise.
699         * versados.c (versados_bfd_is_target_special_symbol): Likewise.
700         (versados_bfd_reloc_name_lookup): Likewise.
701         * vms-alpha.c (vms_bfd_is_target_special_symbol): Likewise.
702         (vms_bfd_define_start_stop): Likewise.
703         (alpha_vms_bfd_is_target_special_symbol): Likewise.
704         * wasm-module.c (wasm_bfd_is_target_special_symbol): Likewise.
705         * xsym.c (bfd_sym_bfd_is_target_special_symbol): Likewise.
706         * elf32-arc.c (get_replace_function): Assign replacement function
707         to func pointer.
708         * elf32-i370.c (i370_noop): Update prototype.
709
710 2018-02-13  Alan Modra  <amodra@gmail.com>
711
712         PR 22836
713         * elf.c (_bfd_elf_fixup_group_sections): Account for removed
714         relocation sections.  If size reduces to just the flag word,
715         remove that too and mark with SEC_EXCLUDE.
716         * elflink.c (bfd_elf_final_link): Strip empty group sections.
717
718 2018-02-13  Alan Modra  <amodra@gmail.com>
719
720         PR 22829
721         * elf.c (assign_file_positions_for_non_load_sections): Rewrite
722         PT_GNU_RELRO setup.
723
724 2018-02-12  Zebediah Figura  <z.figura12@gmail.com>
725
726         * i386msdos.c (msdos_mkobject); New function.
727         (msdos_object_p): New function.
728         (i386_msdos_vec): Use msdos_object_p as the check_format
729         function.
730         * peicode.h: Rename external_PEI_DOS_hdr, DOSMAGIC, and
731         NT_SIGNATURE to external_DOS_hdr, IMAGE_DOS_SIGNATURE, and
732         IMAGE_NT_SIGNATURE.
733         * peXXigen.c: Likewise.
734         * coff-ia64.c: Likewise.
735
736 2018-02-12  Nick Clifton  <nickc@redhat.com>
737
738         * elf32-nds32.c (nds32_elf_relax_longjump3): Remove redundant
739         assignment.
740         * elf32-arc.c (elf_arc_relocate_section): Likewise.
741
742 2018-02-09  Eric Botcazou  <ebotcazou@adacore.com>
743
744         * elfxx-sparc.c (UNDEFINED_WEAK_RESOLVED_TO_ZERO): Reorder conditions.
745         (sparc_elf_append_rela): Assert that there is enough room in section.
746         (_bfd_sparc_elf_copy_indirect_symbol): Fix formatting.
747         (_bfd_sparc_elf_adjust_dynamic_symbol): Minor tweak.
748         (allocate_dynrelocs): Remove outdated comments and reorder conditions.
749         For a symbol subject to a GOT relocation, reserve a slot in the
750         relocation section if the symbol isn't dynamic and we are in PIC mode.
751         (_bfd_sparc_elf_relocate_section) <R_SPARC_GOTDATA_OP>: If relocation
752         is relaxed and a slot was reserved, generate a R_SPARC_NONE relocation.
753         <R_SPARC_GOTDATA_OP_HIX22>: Adjust comments.
754         <R_SPARC_PC10>: Reorder conditions.  Remove always-false assertion.
755         (_bfd_sparc_elf_finish_dynamic_symbol): Rename local_undefweak into
756         resolved_to_zero.  Do not generate a dynamic GOT relocation for an
757         undefined weak symbol with non-default visibility.  Remove superfluous
758         'else' and fix formatting.
759
760 2018-02-09  H.J. Lu  <hongjiu.lu@intel.com>
761
762         * elf32-i386.c (elf_i386_get_synthetic_symtab): Also handle
763         is_solaris.
764         (i386_elf32_sol2_vec): Don't declare.
765         (elf_i386_link_setup_gnu_properties): Also handle is_solaris.
766         Don't set need_global_offset_table.
767         (elf_i386_solaris_arch_bed): New.
768         (elf_backend_arch_data): Set to elf_i386_solaris_arch_bed for
769         Solaris.
770         * elf64-x86-64.c (elf_x86_64_get_synthetic_symtab): Check
771         target_os != is_nacl instead of target_os == is_normal.
772         (x86_64_elf64_sol2_vec): Don't declare.
773         (elf_x86_64_link_setup_gnu_properties): Check target_os !=
774         is_nacl instead of target_os == is_normal.  Don't set
775         need_global_offset_table.
776         (elf_x86_64_solaris_arch_bed): New.
777         (elf_backend_arch_data): Set to elf_x86_64_solaris_arch_bed for
778         Solaris.
779         * elfxx-x86.c (_bfd_x86_elf_size_dynamic_sections): Keep
780         _GLOBAL_OFFSET_TABLE_ for Solaris.
781         (_bfd_x86_elf_link_setup_gnu_properties): Don't copy
782         need_global_offset_table.
783         * elfxx-x86.h (elf_x86_target_os): Add is_solaris.
784         (elf_x86_link_hash_table): Remove need_global_offset_table.
785         (elf_x86_init_table): Likewise.
786
787 2018-02-08  H.J. Lu  <hongjiu.lu@intel.com>
788
789         * elf32-i386.c (elf32_i386_copy_solaris_special_section_fields):
790         Remove prototype.
791         (i386_elf32_sol2_vec): Declared.
792         (elf_i386_link_setup_gnu_properties): Set
793         need_global_offset_table with info->output_bfd->xvec.
794         * elf64-x86-64.c (elf64_x86_64_copy_solaris_special_section_fields):
795         Remove prototype.
796         (x86_64_elf64_sol2_vec): Declared.
797         (elf_x86_64_link_setup_gnu_properties): Set
798         need_global_offset_table with info->output_bfd->xvec.
799
800 2018-02-08  H.J. Lu  <hongjiu.lu@intel.com>
801
802         * elf32-i386.c (elf32_i386_copy_solaris_special_section_fields):
803         New prototype.
804         (elf_i386_link_setup_gnu_properties): Set need_global_offset_table
805         for Solaris.
806         * elf64-x86-64.c (elf64_x86_64_copy_solaris_special_section_fields):
807         New prototype.
808         (elf_x86_64_link_setup_gnu_properties): Set
809         need_global_offset_table for Solaris.
810         * elfxx-x86.c (_bfd_x86_elf_size_dynamic_sections): Keep the
811         unused _GLOBAL_OFFSET_TABLE_ for Solaris.
812         (_bfd_x86_elf_link_setup_gnu_properties): Copy
813         need_global_offset_table.
814         * elfxx-x86.h (elf_x86_link_hash_table): Add
815         need_global_offset_table.
816         (elf_x86_init_table): Likewise.
817
818 2018-02-08  Jim Wilson  <jimw@sifive.com>
819
820         * elfnn-riscv.c (riscv_elf_relocate_section): Add comment for previous
821         change.
822
823 2018-02-08  Nick Clifton  <nickc@redhat.com>
824
825         PR 22788
826         * elf.c (elf_parse_notes): Reject notes with excessuively large
827         alignments.
828
829 2018-02-07  Alan Modra  <amodra@gmail.com>
830
831         Revert 2018-01-17  Alan Modra  <amodra@gmail.com>
832         * elf32-ppc.c: Remove speculation barrier support.
833         * elf32-ppc.h: Likewise.
834         * elf64-ppc.c: Likewise.
835         * elf64-ppc.h: Likewise.
836
837 2018-02-06  Jim Wilson  <jimw@sifive.com>
838
839         * elfnn-riscv.c (riscv_elf_relocate_section): Return TRUE if used
840         callback to report an error.
841
842 2018-02-06  Eric Botcazou  <ebotcazou@adacore.com>
843
844         PR ld/22263
845         * elfxx-sparc.c (sparc_elf_tls_transition): Turn call to bfd_link_pic
846         into call to !bfd_link_executable and tidy up.
847         (_bfd_sparc_elf_check_relocs): Fix formatting and tidy up.
848         <R_SPARC_TLS_LE_HIX22>: Turn call to bfd_link_pic into call to
849         !bfd_link_executable.
850         <R_SPARC_TLS_IE_HI22>: Likewise.
851         <GOT relocations>: Remove useless code, tidy and merge related blocks.
852         <R_SPARC_TLS_GD_CALL>: Turn call to bfd_link_pic into call to
853         !bfd_link_executable.
854         <R_SPARC_WPLT30>: Tidy up.
855         (_bfd_sparc_elf_gc_mark_hook): Turn call to bfd_link_pic into call to
856         !bfd_link_executable.
857         (allocate_dynrelocs): Likewise.
858         (_bfd_sparc_elf_relocate_section): Fix formatting and tidy up.
859         <R_SPARC_TLS_GD_HI22>: Merge into...
860         <R_SPARC_TLS_GD_LO10>: ...this.  Adjust 4th argument in call to
861         sparc_elf_tls_transition and remove redundant code.
862         <R_SPARC_TLS_LDM_HI22>: Turn call to bfd_link_pic into call to
863         !bfd_link_executable.
864         <R_SPARC_TLS_LDO_HIX22>: Likewise.
865         <R_SPARC_TLS_LE_HIX22>: Likewise.  Tidy up.
866         <R_SPARC_TLS_LDM_CALL>: Likewise.
867         <R_SPARC_TLS_GD_CALL>: Likewise.  Tidy up.
868         <R_SPARC_TLS_GD_ADD>: Likewise.
869         <R_SPARC_TLS_LDM_ADD>: Likewise.
870         <R_SPARC_TLS_LDO_ADD>: Likewise.
871         <R_SPARC_TLS_IE_LD>: Likewise.
872
873 2018-02-06  MiloÅ¡ Stojanović  <milos.stojanovic@rt-rk.com>
874
875         PR 22789
876         * elfxx-mips.c (_bfd_mips_elf_find_nearest_line): If the dwarf
877         functions failed to find the function name, try the generic elf
878         find function instead.
879
880 2018-02-06  Sergio Durigan Junior  <sergiodj@redhat.com>
881
882         * coff-rs6000.c (xcoff_write_archive_contents_old): Use
883         'memcpy' instead of 'strncpy' when writing the magic number.
884
885 2018-02-06  Nick Clifton  <nickc@redhat.com>
886
887         PR 22794
888         * opncls.c (bfd_get_debug_link_info_1): Check the size of the
889         section before attempting to read it in.
890         (bfd_get_alt_debug_link_info): Likewise.
891
892 2018-02-06  Paul Carroll  <pcarroll@codesourcery.com>
893
894         * bfd/dwarf2.c (find_abstract_name): Modified to return file and
895         line information in addition to name, if they can be found.
896
897 2018-02-05  Renlin Li  <renlin.li@arm.com>
898
899         PR ld/22764
900         * elfnn-aarch64.c (elfNN_aarch64_check_relocs): Relax the
901         R_AARCH64_ABS32 and R_AARCH64_ABS16 for absolute symbol. Apply the
902         check for writeable section as well.
903
904 2018-02-05  H.J. Lu  <hongjiu.lu@intel.com>
905
906         PR ld/22782
907         * elf32-i386.c (elf_i386_check_relocs): Set got_referenced if
908         _GLOBAL_OFFSET_TABLE_ is referenced or GOT is needed to resolve
909         undefined weak symbol to 0.
910         * elf64-x86-64.c (elf_x86_64_check_relocs): Set got_referenced
911         if _GLOBAL_OFFSET_TABLE_ is referenced.
912         * elfxx-x86.c (_bfd_x86_elf_size_dynamic_sections): Check
913         got_referenced instead of ref_regular_nonweak.  Remove the
914         unused _GLOBAL_OFFSET_TABLE_ from symbol table.
915         * elfxx-x86.h (elf_x86_link_hash_table): Add got_referenced.
916
917 2018-02-05  Maciej W. Rozycki  <macro@mips.com>
918
919         * elfnn-riscv.c (_bfd_riscv_relax_pc): Use `memset' to
920         initialize `hi_reloc'.
921
922 2018-02-05  Maciej W. Rozycki  <macro@mips.com>
923
924         * elfxx-mips.c (_bfd_mips_elf_section_processing): For
925         SHT_MIPS_REGINFO sections don't assert the correct size and
926         report an error instead.
927
928 2018-02-05  Maciej W. Rozycki  <macro@mips.com>
929
930         * elf.c (_bfd_elf_write_object_contents): Propagate a failure
931         status from `->elf_backend_section_processing'.
932
933 2018-02-02  Jim Wilson  <jimw@sifive.com>
934
935         PR ld/22756
936         * elfnn-riscv.c (riscv_relax_delete_bytes): New parameter link_info.
937         If link_info->wrap_hash, check for a duplicate symbol and ignore.
938         (_bfd_riscv_relax_call, bfd_riscv_relax_lui, _bfd_riscv_relax_tls_le):
939         Pass new argument to riscv_relax_delete_bytes.
940         (_bfd_riscv_relax_align, _bfd_riscv_relax_delete): Likewise.  Remove
941         ATTRIBUTE_UNUSED from link_info parameter.
942
943 2018-02-02  Alan Modra  <amodra@gmail.com>
944
945         * elf64-ppc.c (ppc64_elf_relocate_section): Don't relocate nops
946         emitted for toc sequence optimization.  Set and use "howto" later.
947
948 2018-02-01  Simon Marchi  <simon.marchi@ericsson.com>
949
950         * elf64-ppc.c (ppc64_elf_archive_symbol_lookup): Avoid pointer
951         arithmetic on NULL pointer.
952         * elflink.c (_bfd_elf_archive_symbol_lookup,
953         elf_link_add_archive_symbols): Likewise.
954
955 2018-01-31  Michael Matz  <matz@suse.de>
956
957         * elflink.c (bfd_elf_define_start_stop): Fix check of
958         def_dynamic.
959
960 2018-01-31  H.J. Lu  <hongjiu.lu@intel.com>
961
962         PR ld/21964
963         * elflink.c (bfd_elf_define_start_stop): Check if __start and
964         __stop symbols are referenced by shared objects.
965
966 2018-01-30  Alan Modra  <amodra@gmail.com>
967
968         PR 22758
969         * elf.c (_bfd_elf_map_sections_to_segments): Don't start a new
970         segment when demand paged with lma on the same page.  Test this
971         before load/non-load, executable/non-executable,
972         writable/non-writable tests and simplify.  Delete bogus relro
973         condition in writable/non-writable test.  Delete outdated
974         comment.  Formatting.
975
976 2018-01-30  Alan Modra  <amodra@gmail.com>
977
978         * elflink.c (bfd_elf_define_start_stop): Make __start and __stop
979         symbols dynamic.
980
981 2018-01-29  Alan Modra  <amodra@gmail.com>
982
983         PR 22741
984         * coffgen.c (coff_pointerize_aux): Ensure auxent tagndx is in
985         range before converting to a symbol table pointer.
986
987 2018-01-27  Nick Clifton  <nickc@redhat.com>
988
989         * po/ru.po: Updated Russian translation.
990
991 2018-01-26  Alan Modra  <amodra@gmail.com>
992
993         * elflink.c (bfd_elf_define_start_stop): Override symbols when
994         they are defined dynamically.
995
996 2018-01-26  Alan Modra  <amodra@gmail.com>
997
998         * elf64-ppc.c (ppc64_elf_size_stubs): Iterate sizing when
999         .branch_lt changes size.
1000
1001 2018-01-25  Alan Modra  <amodra@gmail.com>
1002
1003         PR 22746
1004         * elfcode.h (elf_object_p): Avoid integer overflow.
1005
1006 2018-01-25  Eric Botcazou  <ebotcazou@adacore.com>
1007
1008         PR ld/22727
1009         * elfxx-sparc.c (_bfd_sparc_elf_check_relocs) <R_SPARC_TLS_GD_CALL>:
1010         Do a mere lookup of the __tls_get_addr symbol instead of adding it.
1011
1012         Revert
1013         2017-10-19  H.J. Lu  <hongjiu.lu@intel.com>
1014
1015         PR ld/22263
1016         * elfxx-sparc.c (sparc_elf_tls_transition): Replace
1017         bfd_link_pic with !bfd_link_executable, !bfd_link_pic with
1018         bfd_link_executable for TLS check.
1019         (_bfd_sparc_elf_check_relocs): Likewise.
1020         (allocate_dynrelocs): Likewise.
1021         (_bfd_sparc_elf_relocate_section): Likewise.
1022
1023 2018-01-24  Renlin Li  <renlin.li@arm.com>
1024
1025         * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Add support for
1026         BFD_RELOC_AARCH64_MOVW_PREL_G0, BFD_RELOC_AARCH64_MOVW_PREL_G0_NC,
1027         BFD_RELOC_AARCH64_MOVW_PREL_G1, BFD_RELOC_AARCH64_MOVW_PREL_G1_NC,
1028         BFD_RELOC_AARCH64_MOVW_PREL_G2, BFD_RELOC_AARCH64_MOVW_PREL_G2_NC,
1029         BFD_RELOC_AARCH64_MOVW_PREL_G3.
1030         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.
1031         (_bfd_aarch64_elf_resolve_relocation): Likewise.
1032
1033 2018-01-24  Renlin Li  <renlin.li@arm.com>
1034
1035         * reloc.c: Add BFD_RELOC_AARCH64_MOVW_PREL_G0,
1036         BFD_RELOC_AARCH64_MOVW_PREL_G0_NC, BFD_RELOC_AARCH64_MOVW_PREL_G1,
1037         BFD_RELOC_AARCH64_MOVW_PREL_G1_NC, BFD_RELOC_AARCH64_MOVW_PREL_G2,
1038         BFD_RELOC_AARCH64_MOVW_PREL_G2_NC, BFD_RELOC_AARCH64_MOVW_PREL_G3.
1039         * elfnn-aarch64.c (elfNN_aarch64_howto_table): Add entries for
1040         BFD_RELOC_AARCH64_MOVW_PREL_G0, BFD_RELOC_AARCH64_MOVW_PREL_G0_NC,
1041         BFD_RELOC_AARCH64_MOVW_PREL_G1, BFD_RELOC_AARCH64_MOVW_PREL_G1_NC,
1042         BFD_RELOC_AARCH64_MOVW_PREL_G2, BFD_RELOC_AARCH64_MOVW_PREL_G2_NC,
1043         BFD_RELOC_AARCH64_MOVW_PREL_G3.
1044         * bfd-in2.h: Regenerate.
1045         * libbfd.h: Regenerate.
1046
1047 2018-01-23  Maciej W. Rozycki  <macro@mips.com>
1048
1049         * elfxx-mips.c (_bfd_mips_elf_final_link): Update a stale
1050         `mips_elf32_section_processing' comment reference.
1051
1052 2018-01-20  H.J. Lu  <hongjiu.lu@intel.com>
1053
1054         PR ld/22721
1055         * elfxx-x86.c (_bfd_x86_elf_link_check_relocs): Check the
1056         versioned __tls_get_addr symbol.
1057
1058 2018-01-19  Nick Clifton  <nickc@redhat.com>
1059
1060         * po/fr.po: Updated French translation.
1061
1062 2018-01-18  Alan Modra  <amodra@gmail.com>
1063
1064         * elf32-ppc.c (ppc_elf_create_glink): Correct alignment of .glink.
1065         * elf64-ppc.c (ppc64_elf_size_stubs): Handle negative plt_stub_align.
1066         (ppc64_elf_build_stubs): Likewise.
1067
1068 2018-01-17  Nick Clifton  <nickc@redhat.com>
1069
1070         * po/ru.po: Updated Russian translation.
1071         * po/uk/po: Updated Ukranian translation.
1072
1073 2018-01-17  Alan Modra  <amodra@gmail.com>
1074
1075         * elf64-ppc.c (ppc64_elf_build_stubs): Silence gcc warning.
1076
1077 2018-01-17  Alan Modra  <amodra@gmail.com>
1078
1079         * elf32-ppc.c (GLINK_ENTRY_SIZE): Handle speculation barrier.
1080         (CRSETEQ, BEQCTRM): Define.
1081         (is_nonpic_glink_stub): Don't check bctr.
1082         (ppc_elf_link_hash_table_create): Init new ppc_elf_params field.
1083         (ppc_elf_relax_section): Size speculation barrier.
1084         (output_bctr): New function.
1085         (write_glink_stub): Use output_bctr.
1086         (ppc_elf_relocate_section): Use output_bctr for long branch stub.
1087         (ppc_elf_finish_dynamic_symbol): Likewise.
1088         (ppc_elf_finish_dynamic_sections): Use output_bctr.
1089         * elf32-ppc.h (struct ppc_elf_params): Add speculate_indirect_jumps.
1090         * elf64-ppc.c (CRSETEQ, BEQCTRM, BEQCTRLM): Define.
1091         (GLINK_PLTRESOLVE_SIZE): Size speculation barrier.
1092         (size_global_entry_stubs): Handle speculation barrier sizing.
1093         (plt_stub_size): Likewise.
1094         (output_bctr): New function.
1095         (build_plt_stub, build_tls_get_addr_stub): Output speculation
1096         barrier.
1097         (ppc_build_one_stub): Likewise for ppc_stub_plt_branch.
1098         (ppc_size_one_stub): Size speculation barrier in ppc_stub_plt_branch.
1099         (build_global_entry_stubs): Output speculation barrier.
1100         (ppc64_elf_build_stubs): Likewise in __glink_PLTresolve stub.
1101         * elf64-ppc.h (struct ppc64_elf_params): Add speculate_indirect_jumps.
1102
1103 2018-01-17  Alan Modra  <amodra@gmail.com>
1104
1105         * elf32-ppc.c (GLINK_ENTRY_SIZE): Add parameters, handle
1106         __tls_get_addr_opt, and alignment sizing.
1107         (TLS_GET_ADDR_GLINK_SIZE): Delete.
1108         (is_nonpic_glink_stub): Don't use GLINK_ENTRY_SIZE.
1109         (ppc_elf_get_synthetic_symtab): Recognize stubs spaced at 4, 6,
1110         or 8 insns.
1111         (ppc_elf_link_hash_table_create): Init new ppc_elf_params field.
1112         (allocate_dynrelocs): Use new GLINK_ENTRY_SIZE.
1113         (ppc_elf_size_dynamic_sections): Likewise.  Size branch table
1114         by PLT reloc count.
1115         (write_glink_stub): Handle __tls_get_addr_opt stub.
1116         Pad out to size given by GLINK_ENTRY_SIZE.
1117         (ppc_elf_relocate_section): Adjust write_glink_stub call.
1118         (ppc_elf_finish_dynamic_symbol): Likewise.
1119         (ppc_elf_finish_dynamic_sections): Write PLTresolve without using
1120         insn array since so many need rewriting.
1121         * elf32-ppc.h (struct ppc_elf_params): Add plt_stub_align.
1122         * elf64-ppc.c (GLINK_PLTRESOLVE_SIZE): Rename from
1123         GLINK_CALL_STUB_SIZE.  Add htab param and evaluate to size without
1124         nops.  Adjust all uses.
1125         (ppc64_elf_get_synthetic_symtab): Don't use GLINK_CALL_STUB_SIZE
1126         in glink_vma calculation.
1127         (struct ppc_link_hash_table): Add global_entry section pointer.
1128         (create_linkage_sections): Create separate section for global
1129         entry stubs.
1130         (PPC_LO, PPC_HI, PPC_HA): Move earlier.
1131         (size_global_entry_stubs): Handle sizing for aligned stubs.
1132         (ppc64_elf_size_dynamic_sections): Handle global_entry alloc,
1133         and don't stash end of glink branch table in rawsize.
1134         (ppc_build_one_stub): Rewrite stub size calculations.
1135         (build_global_entry_stubs): Use new section.
1136         (ppc64_elf_build_stubs): Don't pad __glink_PLTresolve with nops.
1137         Build lazy link stubs out to end of section.  Build global entry
1138         stubs in new section.
1139
1140 2018-01-15  Nick Clifton  <nickc@redhat.com>
1141
1142         * po/uk.po: Updated Ukranian translation.
1143
1144 2018-01-13  Nick Clifton  <nickc@redhat.com>
1145
1146         * po/bfd.pot: Regenerated.
1147
1148 2018-01-13  Nick Clifton  <nickc@redhat.com>
1149
1150         * version.m4: Bump version to 2.30.51
1151         * configure: Regenerate.
1152
1153 2018-01-13  Nick Clifton  <nickc@redhat.com>
1154
1155         2.30 branch created.
1156
1157 2018-01-12  Jens Widell  <jl@opera.com>
1158
1159         * elf.c (setup_group): Optimize search for group by remembering
1160         last found group and restarting search at that index.
1161         * elf-bfd.h (struct elf_obj_tdata): Add group_search_offset field.
1162
1163 2018-01-12  Gunther Nikl  <gnikl@users.sourceforge.net>
1164
1165         * aoutx.h (aout_link_check_ar_symbols): Remove default and handle
1166         bfd_link_common_skip_none in switch.
1167
1168 2018-01-12  Alan Modra  <amodra@gmail.com>
1169
1170         PR ld/22649
1171         * elf64-ppc.c (ppc64_elf_gc_mark_dynamic_ref): Ignore dynamic
1172         references on forced local symbols.
1173
1174 2018-01-12  Vlad Ivanov  <vlad@ivanov.email>
1175
1176         * elfxx-mips.c (_bfd_mips_elf_final_link): Notify user when
1177         .reginfo section has wrong size.
1178
1179 2018-01-11  H.J. Lu  <hongjiu.lu@intel.com>
1180
1181         PR ld/22393
1182         * elf.c (_bfd_elf_map_sections_to_segments): When generating
1183         separate code and read-only data LOAD segments, create a new
1184         LOAD segment if the previous section contains text and the
1185         current section doesn't or vice versa.  Don't put a writable
1186         section in a read-only segment if there is a RELRO segment.
1187
1188 2018-01-11  H.J. Lu  <hongjiu.lu@intel.com>
1189
1190         PR ld/22649
1191         * elflink.c (bfd_elf_gc_mark_dynamic_ref_symbol): Ignore dynamic
1192         references on forced local symbols.
1193
1194 2018-01-11  H.J. Lu  <hongjiu.lu@intel.com>
1195
1196         PR ld/22677
1197         * elflink.c (bfd_elf_gc_sections): Keep all PREINIT_ARRAY,
1198         INIT_ARRAY as well as FINI_ARRAY sections for ld -r --gc-section.
1199
1200 2018-01-09  Kuan-Lin Chen  <kuanlinchentw@gmail.com>
1201
1202         PR 22662
1203         * elf32-nds32.c (nds32_elf_relax_loadstore): Fix a typographical error.
1204
1205 2018-01-03  John Baldwin  <jhb@FreeBSD.org>
1206
1207         * elf.c (elfcore_grok_freebsd_note): Handle
1208         NT_FREEBSD_PROCSTAT_PROC, NT_FREEBSD_PROCSTAT_FILES, and
1209         NT_FREEBSD_PROCSTAT_VMMAP.
1210
1211 2018-01-03  Alan Modra  <amodra@gmail.com>
1212
1213         Update year range in copyright notice of all files.
1214
1215 For older changes see ChangeLog-2017
1216 \f
1217 Copyright (C) 2018 Free Software Foundation, Inc.
1218
1219 Copying and distribution of this file, with or without modification,
1220 are permitted in any medium without royalty provided the copyright
1221 notice and this notice are preserved.
1222
1223 Local Variables:
1224 mode: change-log
1225 left-margin: 8
1226 fill-column: 74
1227 version-control: never
1228 End: