PR binutils/22875: FRV/ELF: Prevent an out-of-bounds howto table access
[external/binutils.git] / bfd / ChangeLog
1 2018-04-04  Maciej W. Rozycki  <macro@mips.com>
2
3         * elf32-frv.c (frv_info_to_howto_rela): Correct the range check
4         for `elf32_frv_howto_table' table access.
5
6 2018-04-04  Maciej W. Rozycki  <macro@mips.com>
7
8         * elf32-mips.c (mips_elf32_rtype_to_howto): Also return
9         unsuccessfully for placeholder howtos.
10         * elf64-mips.c (mips_elf64_rtype_to_howto): Likewise.
11         * elfn32-mips.c (mips_elf_n32_rtype_to_howto): Likewise.
12
13 2018-03-29  Maciej W. Rozycki  <macro@mips.com>
14
15         * elf32-mips.c (mips_info_to_howto_rel): Remove the calls to
16         `_bfd_error_handler' and to set the `bfd_error_bad_value' error.
17
18 2018-03-28  Maciej W. Rozycki  <macro@mips.com>
19
20         * elf-hppa.h (elf_hppa_info_to_howto_rel): Remove
21         ATTRIBUTE_UNUSED from `abfd'.
22
23 2018-03-28  Maciej W. Rozycki  <macro@mips.com>
24
25         * elf-hppa.h (elf_hppa_info_to_howto_rel): Correct
26         `_bfd_error_handler' call formatting.
27
28 2018-03-28  Maciej W. Rozycki  <macro@mips.com>
29
30         * elf32-mips.c (mips_info_to_howto_rel): Call
31         `mips_elf32_rtype_to_howto' directly rather than via
32         `->elf_backend_mips_rtype_to_howto'.
33
34 2018-03-28  Renlin Li  <renlin.li@arm.com>
35
36         PR ld/22970
37         * elfnn-aarch64.c (IS_AARCH64_TLS_RELOC): Add cases for
38         BFD_RELOC_AARCH64_TLSLE_LDST16_TPREL_LO12,
39         BFD_RELOC_AARCH64_TLSLE_LDST16_TPREL_LO12_NC,
40         BFD_RELOC_AARCH64_TLSLE_LDST32_TPREL_LO12,
41         BFD_RELOC_AARCH64_TLSLE_LDST32_TPREL_LO12_NC,
42         BFD_RELOC_AARCH64_TLSLE_LDST64_TPREL_LO12,
43         BFD_RELOC_AARCH64_TLSLE_LDST64_TPREL_LO12_NC,
44         BFD_RELOC_AARCH64_TLSLE_LDST8_TPREL_LO12,
45         BFD_RELOC_AARCH64_TLSLE_LDST8_TPREL_LO12_NC.
46         (elfNN_aarch64_final_link_relocate): Support new relocations.
47         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Support new
48         relocations.
49         (_bfd_aarch64_elf_resolve_relocation): Support new relocations.
50
51 2018-03-28  Renlin Li  <renlin.li@arm.com>
52
53         PR ld/22970
54         * reloc.c: Add BFD_RELOC_AARCH64_TLSLE_LDST_TPREL_LO12
55         BFD_RELOC_AARCH64_TLSLE_LDST_TPREL_LO12_NC,
56         BFD_RELOC_AARCH64_TLSLE_LDST16_TPREL_LO12,
57         BFD_RELOC_AARCH64_TLSLE_LDST16_TPREL_LO12_NC,
58         BFD_RELOC_AARCH64_TLSLE_LDST32_TPREL_LO12,
59         BFD_RELOC_AARCH64_TLSLE_LDST32_TPREL_LO12_NC,
60         BFD_RELOC_AARCH64_TLSLE_LDST64_TPREL_LO12,
61         BFD_RELOC_AARCH64_TLSLE_LDST64_TPREL_LO12_NC,
62         BFD_RELOC_AARCH64_TLSLE_LDST8_TPREL_LO12,
63         BFD_RELOC_AARCH64_TLSLE_LDST8_TPREL_LO12_NC.
64         * elfnn-aarch64.c (elfNN_aarch64_howto_table): Add table entry for
65         TLSLE_LDST16_TPREL_LO12,
66         TLSLE_LDST16_TPREL_LO12_NC,
67         TLSLE_LDST32_TPREL_LO12,
68         TLSLE_LDST32_TPREL_LO12_NC,
69         TLSLE_LDST64_TPREL_LO12,
70         TLSLE_LDST64_TPREL_LO12_NC,
71         TLSLE_LDST8_TPREL_LO12,
72         TLSLE_LDST8_TPREL_LO12_NC.
73         * bfd-in2.h: Regenerated.
74         * libbfd.h: Regenerated.
75
76 2018-03-28  Eric Botcazou  <ebotcazou@adacore.com>
77
78         PR ld/22972
79         * elfxx-sparc.c (struct _bfd_sparc_elf_link_hash_entry): Add new flag
80         has_old_style_got_reloc.
81         (_bfd_sparc_elf_check_relocs) <GOT relocations>: Set it for old-style
82         relocations.  Fix a couple of long lines.
83         (_bfd_sparc_elf_relocate_section) <R_SPARC_GOTDATA_OP>: Do not generate
84         a R_SPARC_NONE for the GOT slot if the symbol is also subject to old-style
85         GOT relocations.
86
87 2018-03-25  H.J. Lu  <hongjiu.lu@intel.com>
88
89         PR ld/23000
90         * elf64-x86-64.c (elf_x86_64_finish_dynamic_sections): Add
91         ENDBR64 to the TLSDESC PLT entry.
92
93 2018-03-21  Alan Modra  <amodra@gmail.com>
94
95         * elf64-ppc.c (ppc64_elf_get_synthetic_symtab): Trim uninteresting
96         symbols.  Use size_t counts.  Delete redundant opd test.
97
98 2018-03-21  Alan Modra  <amodra@gmail.com>
99
100         * elf32-ppc.c (ppc_elf_tls_optimize): Delete locsyms.
101
102 2018-03-21  Alan Modra  <amodra@gmail.com>
103
104         * elf32-ppc.c (struct ppc_elf_link_hash_entry): Make tls_mask
105         field unsigned.
106         (update_local_sym_info): Likewise for local_got_tls_masks.
107         (ppc_elf_tls_optimize): Likewise for lgot_masks.
108
109 2018-03-21  Alan Modra  <amodra@gmail.com>
110
111         * elf64-ppc.c (ppc_size_one_stub): Fix comment typo.
112         (ppc64_elf_layout_multitoc): Allocate relocs for tprel as we
113         do in size_dynamic_sections.
114
115 2018-03-21  Alan Modra  <amodra@gmail.com>
116
117         * elf64-ppc.c (ppc64_elf_relocate_section): Don't access rel[1]
118         without first checking array bounds.
119         * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
120
121 2018-03-20  H.J. Lu  <hongjiu.lu@intel.com>
122
123         PR ld/22983
124         * elflink.c (bfd_elf_link_mark_dynamic_symbol): Set
125         non_ir_ref_dynamic if a symbol is made dynamic by --dynamic-list.
126
127 2018-03-19  Nick Clifton  <nickc@redhat.com>
128
129         * po/es.po: Updated Spanish translation.
130
131 2018-03-15  Max Filippov  <jcmvbkbc@gmail.com>
132
133         * elf32-xtensa.c (xlate_map_entry): Change types of address
134         fields from 'unsigned' to 'bfd_vma'.
135         (xlate_offset_with_removed_text): Use struct xlate_map_entry as
136         the key argument to bsearch. Allow offsets past the end of a
137         section, use the last map entry for translation of such offsets.
138
139 2018-03-15  Kuan-Lin Chen  <kuanlinchentw@gmail.com>
140
141         * elf32-nds32.c (nds32_elf_ex9_build_hash_table): Removed.
142         Not support the target feature.
143         (nds32_elf_ex9_itb_base): Likewise.
144         (nds32_elf_ex9_import_table): Likewise.
145         (nds32_elf_ex9_finish): Likewise.
146         (nds32_elf_ex9_reloc_jmp): Likewise.
147         (nds32_elf_get_insn_with_reg): Likewise.
148         (nds32_get_local_syms): Likewise.
149         (nds32_elf_ex9_replace_instruction): Likewise.
150         (nds32_elf_ifc_calc): Likewise.
151         (nds32_elf_ifc_finish): Likewise.
152         (nds32_elf_ifc_replace): Likewise.
153         (nds32_elf_ifc_reloc): Likewise.
154
155 2018-03-14  Alan Modra  <amodra@gmail.com>
156
157         * elf64-ppc.c (sfpr_define): Adjust for stub_sec size having
158         sfpr size added before defining alias symbols.
159         (ppc64_elf_build_stubs): Add stub section padding before
160         copying sfpr contents and defining save/restore alias symbols.
161
162 2018-03-14  H.J. Lu  <hongjiu.lu@intel.com>
163
164         PR ld/20882
165         * elflink.c (elf_gc_mark_debug_section): Also check the local
166         debug definition section.
167
168 2018-03-13  Nick Clifton  <nickc@redhat.com>
169
170         PR 22113
171         * pei-x86_64.c (pex64_get_unwind_info): Change to a boolean
172         function.  Add an end address parameter.  Check access of the data
173         pointer to make sure that they do not extend beyond the end
174         address.  Return FALSE if any check fails.  Add the end address
175         pointer to the ui structure.
176         (pex64_xdata_print_uwd_codes): Check accesses of the raw unwind
177         codes to make sure that they do not extend beyond the end address
178         pointer.  Print an error message and return immediately if any
179         check fails.
180
181 2018-03-09  Nick Clifton  <nickc@redhat.com>
182
183         * elf64-s390.c (elf_s390_relocate_section): Move check for
184         relocations against non-allocated sections to before the code that
185         handles ifunc relocations.
186         * elf32-s390.c (elf_s390_relocate_section): Likewise.
187         * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Treat
188         relocs against IFUNC symbols in non-allocated sections as relocs
189         against FUNC symbols.
190         * elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Likewise.
191
192 2018-03-08  H.J. Lu  <hongjiu.lu@intel.com>
193
194         PR ld/22929
195         * elf32-i386.c (elf_i386_relocate_section): Treat relocation
196         against IFUNC symbol in SHT_NOTE section without SHF_ALLOC as
197         relocation against FUNC symbol.
198         * elf64-x86-64.c (elf_x86_64_relocate_section): Likewise.
199
200 2018-03-07  Renlin Li  <renlin.li@arm.com>
201
202         PR ld/20402
203         * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Check absolute
204         symbol, and don't emit relocation in specific case.
205
206 2018-03-07  Alan Modra  <amodra@gmail.com>
207
208         * elf64-mips.c (mips_elf64_rtype_to_howto): Return NULL on error.
209         (mips_elf64_slurp_one_reloc_table): Pass on error.
210
211 2018-03-03  James Cowgill  <james.cowgill@mips.com>
212             Maciej W. Rozycki  <macro@mips.com>
213
214         PR ld/21900
215         * elfxx-mips.c (mips_elf_calculate_relocation): Only return
216         after calling `undefined_symbol' hook if this is an error
217         condition.  Assume the value of 0 for the symbol requested
218         otherwise.
219
220 2018-03-02  Jim Wilson  <jimw@sifive.com>
221
222         PR 22903
223         * elfnn-aarch64.c (_bfd_aarch64_resize_stubs): Add 8 bytes for branch
224         and nop instead of 4.
225         (elfNN_arch64_build_stubs): Add nop after branch.  Increase size by
226         8 instead of 4.
227
228 2018-03-01  Jim Wilson  <jimw@sifive.com>
229
230         PR 22756
231         * elfnn-riscv.c (riscv_relax_delete_bytes): When adjust st_size, use
232         else if instead of if.
233
234 2018-03-01  Alan Modra  <amodra@gmail.com>
235
236         * elf32-ft32.c (ft32_info_to_howto_rela): Correct range test.
237
238 2018-02-28  Alan Modra  <amodra@gmail.com>
239
240         PR 22887
241         * aoutx.h (swap_std_reloc_in): Correct r_index bound check.
242
243 2018-02-28  Nick Clifton  <nickc@redhat.com>
244
245         PR 22895
246         PR 22893
247         * dwarf2.c (read_n_bytes): Replace size parameter with dwarf_block
248         pointer.  Drop unused abfd parameter.  Check the size of the block
249         before initialising the data field.  Return the end pointer if the
250         size is invalid.
251         (read_attribute_value): Adjust invocations of read_n_bytes.
252
253         PR 22894
254         * dwarf1.c (parse_die): Check the length of form blocks before
255         advancing the data pointer.
256
257 2018-02-28  Alan Modra  <amodra@gmail.com>
258
259         PR 22887
260         * aoutx.h (translate_symbol_table): Print an error message and set
261         bfd_error on finding an invalid name string offset.
262
263 2018-02-27  H.J. Lu  <hongjiu.lu@intel.com>
264
265         * config.in: Regenerated.
266         * configure: Likewise.
267         * configure.ac: Add --enable-separate-code.
268         (DEFAULT_LD_Z_SEPARATE_CODE): New AC_DEFINE_UNQUOTED.  Default
269         to 1 for Linux/x86 targets,
270         * elf64-x86-64.c (ELF_MAXPAGESIZE): Set to 0x1000 if
271         DEFAULT_LD_Z_SEPARATE_CODE is 1.
272
273 2018-02-27  Nick Clifton  <nickc@redhat.com>
274
275         * aout-cris.c (swap_ext_reloc_out): Standadize error/warning
276         message.
277         * elf-hppa.h (elf_hppa_info_to_howto_rel): Likewise.
278         * elf32-i386.c (elf_i386_reloc_type_lookup): Likewise.
279         * elf32-xtensa.c (elf_xtensa_reloc_type_lookup): Likewise.
280         * elf64-ppc.c (ppc64_elf_reloc_type_lookup): Likewise.
281         * elf64-s390.c (elf_s390_reloc_type_lookup): Likewise.
282         * elf64-sh64.c (sh_elf64_info_to_howto): Likewise.
283         * elfxx-ia64.c (ia64_elf_reloc_type_lookup): Likewise.
284         * elfxx-sparc.c (_bfd_sparc_elf_reloc_type_lookup): Likewise.
285         * elfxx-tilegx.c (tilegx_reloc_type_lookup): Likewise.
286
287         PR 22875
288         * elf-bfd.h (struct elf_backend_data): Change the return type of
289         the elf_info_to_howto and elf_info_to_howto_rel function pointers
290         to bfd_boolean.
291         * elfcode.h (elf_slurp_reloc_table_from_section): Check the return
292         value from the info_to_howto function and fail if that function
293         failed.
294         * elf32-h8300.c (elf32_h8_relocate_section): Check return value
295         from the info_to_howto function.
296         (elf32_h8_relax_section): Likewise.
297         * elf32-lm32.c (lm32_elf_relocate_section): Likewise.
298         * elf32-m68hc1x.c (elf32_m68hc11_relocate_section): Likewise.
299         * elf32-score.c (s3_bfd_score_elf_relocate_section): Likewise.
300         * elf32-score7.c (s7_bfd_score_elf_relocate_section): Likewise.
301         * elf32-tic6x.c (elf32_tic6x_relocate_section): Likewise.
302         * elf64-ia64-vms.c (elf64_ia64_relocate_section): Likewise.
303         * elf64-sparc.c (elf64_sparc_slurp_one_reloc_table): Likewise.
304         * elf64-x86-64.c (elf_x86_64_tls_transition): Likewise.
305         * elfnn-ia64.c (elfNN_ia64_relocate_section): Likewise.
306         * elfnn-riscv.c (riscv_elf_check_relocs): Likewise.
307         (riscv_elf_relocate_section): Likewise.
308         * elf-hppa.h (elf_hppa_info_to_howto): Change return type to
309         bfd_boolean.  Issue an error message, set an error value and
310         return FALSE if the reloc is not recognized.
311         (elf_hppa_info_to_howto_rel): Likewise.
312         * elf-m10200.c (mn10200_info_to_howto): Likewise.
313         * elf-m10300.c (mn10300_info_to_howto): Likewise.
314         * elf.c (_bfd_elf_no_info_to_howto): Likewise.
315         * elf32-arc.c (arc_info_to_howto_rel): Likewise.
316         * elf32-arm.c (elf32_arm_info_to_howto): Likewise.
317         * elf32-avr.c (avr_info_to_howto_rela): Likewise.
318         * elf32-bfin.c (bfin_info_to_howto): Likewise.
319         * elf32-cr16.c (elf_cr16_info_to_howto): Likewise.
320         * elf32-cr16c.c (elf_cr16c_info_to_howto): Likewise.
321         * elf32-cris.c (elf_cr16c_info_to_howto_rel)
322         (cris_info_to_howto_rela): Likewise.
323         * elf32-crx.c (elf_crx_info_to_howto): Likewise.
324         * elf32-d10v.c (d10v_info_to_howto_rel): Likewise.
325         * elf32-d30v.c (d30v_info_to_howto_rel, d30v_info_to_howto_rela):
326         Likewise.
327         * elf32-dlx.c (dlx_rtype_to_howto, elf32_dlx_info_to_howto)
328         (elf32_dlx_info_to_howto_rel): Likewise.
329         * elf32-epiphany.c (epiphany_info_to_howto_rela): Likewise.
330         * elf32-fr30.c (fr30_info_to_howto_rela): Likewise.
331         * elf32-frv.c (frv_info_to_howto_rela)
332         (frvfdpic_info_to_howto_rel): Likewise.
333         * elf32-ft32.c (ft32_info_to_howto_rela): Likewise.
334         * elf32-gen.c (elf_generic_info_to_howto)
335         (elf_generic_info_to_howto_rel): Likewise.
336         * elf32-h8300.c (elf32_h8_info_to_howto)
337         (elf32_h8_info_to_howto_rel): Likewise.
338         * elf32-i370.c (i370_elf_info_to_howto): Likewise.
339         * elf32-i386.c (elf_i386_reloc_type_lookup)
340         (elf_i386_rtype_to_howto, elf_i386_info_to_howto_rel): Likewise.
341         * elf32-i860.c (lookup_howto, elf32_i860_info_to_howto_rela):
342         Likewise.
343         * elf32-i960.c (elf32_i960_info_to_howto_rel): Likewise.
344         * elf32-ip2k.c (ip2k_info_to_howto_rela): Likewise.
345         * elf32-iq2000.c (iq2000_info_to_howto_rela): Likewise.
346         * elf32-lm32.c (lm32_info_to_howto_rela): Likewise.
347         * elf32-m32c.c (m32c_info_to_howto_rela): Likewise.
348         * elf32-m32r.c (m32r_info_to_howto_rel, m32r_info_to_howto):
349         Likewise.
350         * elf32-m68hc11.c (m68hc11_info_to_howto_rel): Likewise.
351         * elf32-m68hc12.c (m68hc11_info_to_howto_rel): Likewise.
352         * elf32-m68k.c (rtype_to_howto): Likewise.
353         * elf32-mcore.c (mcore_elf_info_to_howto): Likewise.
354         * elf32-mep.c (mep_info_to_howto_rela): Likewise.
355         * elf32-metag.c (metag_info_to_howto_rela): Likewise.
356         * elf32-microblaze.c (microblaze_elf_info_to_howto): Likewise.
357         * elf32-mips.c (mips_info_to_howto_rel, mips_info_to_howto_rela):
358         Likewise.
359         * elf32-moxie.c (moxie_info_to_howto_rela): Likewise.
360         * elf32-msp430.c (msp430_info_to_howto_rela): Likewise.
361         * elf32-mt.c (mt_info_to_howto_rela): Likewise.
362         * elf32-nds32.c (nds32_info_to_howto_rel, nds32_info_to_howto):
363         Likewise.
364         * elf32-nios2.c (nios2_elf32_info_to_howto): Likewise.
365         * elf32-or1k.c (or1k_info_to_howto_rela): Likewise.
366         * elf32-pj.c (pj_elf_info_to_howto): Likewise.
367         * elf32-ppc.c (ppc_elf_info_to_howto): Likewise.
368         * elf32-pru.c (pru_elf32_info_to_howto): Likewise.
369         * elf32-rl78.c (rl78_info_to_howto_rela): Likewise.
370         * elf32-rx.c (rx_info_to_howto_rela): Likewise.
371         * elf32-s390.c (elf_s390_info_to_howto): Likewise.
372         * elf32-score.c (s3_bfd_score_info_to_howto)
373         (_bfd_score_info_to_howto): Likewise.
374         * elf32-score7.c (s7_bfd_score_info_to_howto): Likewise.
375         * elf32-sh.c (sh_elf_info_to_howto): Likewise.
376         * elf32-spu.c (spu_elf_info_to_howto): Likewise.
377         * elf32-tic6x.c (elf32_tic6x_info_to_howto)
378         (elf32_tic6x_info_to_howto_rel): Likewise.
379         * elf32-tilepro.c (tilepro_info_to_howto_rela): Likewise.
380         * elf32-v850.c (v850_elf_info_to_howto_rel)
381         (v850_elf_info_to_howto_rela, v800_elf_info_to_howto): Likewise.
382         * elf32-vax.c (rtype_to_howto): Likewise.
383         * elf32-visium.c (visium_info_to_howto_rela): Likewise.
384         * elf32-wasm32.c (elf32_wasm32_rtype_to_howto)
385         (elf32_wasm32_info_to_howto_rela): Likewise.
386         * elf32-xc16x.c (elf32_xc16x_info_to_howto): Likewise.
387         * elf32-xgate.c (xgate_info_to_howto_rel): Likewise.
388         * elf32-xstormy16.c (xstormy16_info_to_howto_rela): Likewise.
389         * elf32-xtensa.c (elf_xtensa_info_to_howto_rela): Likewise.
390         * elf64-alpha.c (elf64_alpha_info_to_howto): Likewise.
391         * elf64-gen.c (elf_generic_info_to_howto)
392         (elf_generic_info_to_howto_rel): Likewise.
393         * elf64-ia64-vms.c (elf64_ia64_info_to_howto): Likewise.
394         * elf64-mips.c (mips_elf64_info_to_howto_rela): Likewise.
395         * elf64-mmix.c (mmix_info_to_howto_rela): Likewise.
396         * elf64-ppc.c (ppc64_elf_info_to_howto): Likewise.
397         * elf64-s390.c (elf_s390_reloc_type_lookup): Likewise.
398         * elf64-sh64.c (elf_s390_info_to_howto, sh_elf64_info_to_howto):
399         Likewise.
400         * elf64-x86-64.c (elf_x86_64_info_to_howto): Likewise.
401         * elfn32-mips.c (mips_info_to_howto_rel, mips_info_to_howto_rela):
402         Likewise.
403         * elfnn-aarch64.c (elfNN_aarch64_info_to_howto): Likewise.
404         * elfnn-ia64.c (elfNN_ia64_info_to_howto): Likewise.
405         * elfnn-riscv.c (riscv_info_to_howto_rela): Likewise.
406         * elfxx-ia64.c (ia64_elf_reloc_type_lookup): Likewise.
407         * elfxx-sparc.c (_bfd_sparc_elf_info_to_howto): Likewise.
408         * elfxx-tilegx.c (tilegx_info_to_howto_rela): Likewise.
409         * elf32-score.h (s7_bfd_score_info_to_howto): Update prototype.
410         * elfxx-sparc.h (_bfd_sparc_elf_info_to_howto): Update prototype.
411         * elfxx-tilegx.h (tilegx_info_to_howto_rela): Update prototype.
412         * elfxx-target.h (elf_info_to_howto, elf_info_to_howto_rel):
413         Default to NULL.
414
415 2018-02-26  Jim Wilson  <jimw@sifive.com>
416             Stephan Schreiber <info@fs-driver.org>
417
418         PR 15904
419         * elfnn-ia64.c (elfNN_ia64_relax_section): After ia64_elf_relax_brl
420         call, set changed_contents and changed_relocs.  Likewise after
421         successful ia64_elf_relax_br call.
422
423 2018-02-26  Alan Modra  <amodra@gmail.com>
424
425         * elf.c (assign_file_positions_except_relocs): Don't segfault
426         when actual number of phdrs is less than allocated.  Delete
427         outdated comment.  Formatting.
428
429 2018-02-26  Alan Modra  <amodra@gmail.com>
430
431         * elf-m10300.c, * elf-s390-common.c, * elf32-arc.c, * elf32-cris.c,
432         * elf32-dlx.c, * elf32-frv.c, * elf32-i370.c, * elf32-lm32.c,
433         * elf32-m32r.c, * elf32-m68hc1x.c, * elf32-m68k.c,
434         * elf32-microblaze.c, * elf32-msp430.c, * elf32-nds32.c,
435         * elf32-nios2.c, * elf32-or1k.c, * elf32-rl78.c, * elf32-rx.c,
436         * elf32-score.c, * elf32-score7.c, * elf32-sh-symbian.c,
437         * elf32-sh.c, * elf32-spu.c, * elf32-v850.c, * elf32-xtensa.c,
438         * elf64-alpha.c, * elf64-ia64-vms.c, * elf64-mmix.c,
439         * elf64-sh64.c, * elf64-sparc.c, * elfnn-ia64.c, * elfxx-tilegx.c,
440         * mmo.c, * osf-core.c, * srec.c, * vms-alpha.c: Standardize
441         error/warning messages.
442
443 2018-02-26  Alan Modra  <amodra@gmail.com>
444
445         * archive.c, * bfd.c, * linker.c, * reloc.c, * stabs.c,
446         * syms.c: Standardize error/warning messages.
447
448 2018-02-26  Alan Modra  <amodra@gmail.com>
449
450         * aout-adobe.c, * aout-cris.c, * i386linux.c, * m68klinux.c,
451         * sparclinux.c, * coff-alpha.c, * coff-arm.c, * coff-mcore.c,
452         * coffcode.h, * coffgen.c, * cofflink.c, * ecoff.c, * pe-mips.c,
453         * peXXigen.c, * peicode.h: Standardize error/warning messages.
454
455 2018-02-26  Alan Modra  <amodra@gmail.com>
456
457         * elf32-arm.c, * elfnn-aarch64.c: Standardize error/warning messages.
458
459 2018-02-26  Alan Modra  <amodra@gmail.com>
460
461         * elfxx-mips.c: Standardize error/warning messages.
462
463 2018-02-26  Alan Modra  <amodra@gmail.com>
464
465         * dwarf2.c, * elf-attrs.c, * elf-eh-frame.c, * elf.c, * elf32-gen.c,
466         * elflink.c: Standardize error/warning messages.  Replace use of
467         linker callback einfo with _bfd_error_handler when possible.
468
469 2018-02-26  Alan Modra  <amodra@gmail.com>
470
471         * aoutx.h, * coff-alpha.c, * coff-i860.c, * coff-m68k.c,
472         * coff-mcore.c, * coff-ppc.c, * coff-rs6000.c, * coff-sh.c,
473         * coff-tic4x.c, * coff-tic54x.c, * coff-tic80.c, * coff-w65.c,
474         * elf-bfd.h, * elf-m10300.c, * elf.c, * elf32-avr.c, * elf32-bfin.c,
475         * elf32-cr16.c, * elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c,
476         * elf32-d10v.c, * elf32-d30v.c, * elf32-dlx.c, * elf32-epiphany.c,
477         * elf32-fr30.c, * elf32-frv.c, * elf32-i370.c, * elf32-i386.c,
478         * elf32-i960.c, * elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c,
479         * elf32-m32c.c, * elf32-m32r.c, * elf32-m68hc11.c, * elf32-m68hc12.c,
480         * elf32-m68k.c, * elf32-mcore.c, * elf32-mep.c, * elf32-metag.c,
481         * elf32-microblaze.c, * elf32-mips.c, * elf32-moxie.c,
482         * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c, * elf32-or1k.c,
483         * elf32-pj.c, * elf32-ppc.c, * elf32-rl78.c, * elf32-rx.c,
484         * elf32-s390.c, * elf32-sh.c, * elf32-spu.c, * elf32-tic6x.c,
485         * elf32-v850.c, * elf32-vax.c, * elf32-visium.c, * elf32-wasm32.c,
486         * elf32-xgate.c, * elf32-xtensa.c, * elf64-alpha.c,
487         * elf64-ia64-vms.c, * elf64-mips.c, * elf64-mmix.c,
488         * elf64-ppc.c, * elf64-s390.c, * elf64-sparc.c, * elf64-x86-64.c,
489         * elfn32-mips.c, * elfnn-aarch64.c, * elfnn-ia64.c,
490         * elfnn-riscv.c, * elfxx-mips.c, * elfxx-riscv.c, * elfxx-riscv.h,
491         * elfxx-sparc.c, * elfxx-sparc.h, * reloc.c: Standardize
492         unrecognized/unsupported reloc message.
493
494 2018-02-26  Alan Modra  <amodra@gmail.com>
495
496         * elf32-ppc.c: Standardize error/warning messages.  Use
497         _bfd_error_handler rather than einfo when einfo features not used.
498         * elf64-ppc.c: Likewise.
499
500 2018-02-23  Alan Modra  <amodra@gmail.com>
501
502         PR 22881
503         * elf.c (assign_file_positions_for_non_load_sections): Remove RELRO
504         segment if no matching LOAD segment.
505
506 2018-02-23  Kuan-Lin Chen  <kuanlinchentw@gmail.com>
507
508         * elf32-nds32.h: Define mask for ict_model.
509
510 2018-02-20  Jason Duerstock  <jason.duerstock@gmail.com>
511
512         * elfnn-ia64.c (elf_backend_can_gc_sections): Enable.
513
514 2018-02-19  Maciej W. Rozycki  <macro@mips.com>
515
516         Revert
517         2018-01-12  Vlad Ivanov  <vlad@ivanov.email>
518
519         * elfxx-mips.c (_bfd_mips_elf_final_link): Notify user when
520         .reginfo section has wrong size.
521
522 2018-02-19  Maciej W. Rozycki  <macro@mips.com>
523
524         * elfxx-mips.c (_bfd_mips_elf_always_size_sections): Set
525         SEC_FIXED_SIZE and SEC_HAS_CONTENTS flags for `.reginfo' and
526         `.MIPS.abiflags' sections.
527         (_bfd_mips_elf_final_link): Avoid reading beyond `.reginfo'
528         section's end.
529
530 2018-02-19  Maciej W. Rozycki  <macro@mips.com>
531
532         * section.c (SEC_FIXED_SIZE): New macro.
533         * bfd-in2.h: Regenerate.
534
535 2018-02-19  Maciej W. Rozycki  <macro@mips.com>
536
537         * section.c (SEC_HAS_GOT_REF): Remove macro.
538         * bfd-in2.h: Regenerate.
539
540 2018-02-19  Alan Modra  <amodra@gmail.com>
541
542         * elf-attrs.c (_bfd_elf_parse_attributes): Correct _bfd_error_handler
543         arguments.
544         * elfxx-mips.c (_bfd_mips_elf_final_link): Likewise.
545         * elfnn-riscv.c (_bfd_riscv_relax_align): Likewise.
546         (_bfd_riscv_relax_pc): Likewise and fix typos.
547         * libbfd-in.h (_bfd_error_handler): Add attribute printf.
548         * libbfd.h: Regenerate.
549
550 2018-02-19  Alan Modra  <amodra@gmail.com>
551
552         * dwarf2.c (read_section): Don't use 'll' format modifier.
553         (find_abstract_instance): Likewise.
554         * elfcore.h (elf_core_file_p): Likewise.
555
556 2018-02-19  Alan Modra  <amodra@gmail.com>
557
558         * bfd-in.h: Include inttypes.h or if not available define
559         PRId64, PRIu64 and PRIx64.
560         * bfd.c (_bfd_doprnt, _bfd_doprnt_scan): Remove support for L
561         modifier to print bfd_vma.
562         * coff-arm.c, * coff-mcore.c, * coff-ppc.c, * coff-rs6000.c,
563         * coff-sh.c, * coff-tic80.c, * coffcode.h, * coffgen.c, * cofflink.c,
564         * compress.c, * dwarf2.c, * elf-m10300.c, * elf.c, * elf32-arc.c,
565         * elf32-arm.c, * elf32-bfin.c, * elf32-cris.c, * elf32-hppa.c,
566         * elf32-i386.c, * elf32-ip2k.c, * elf32-lm32.c, * elf32-m32r.c,
567         * elf32-m68k.c, * elf32-metag.c, * elf32-nds32.c, * elf32-nios2.c,
568         * elf32-ppc.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c,
569         * elf32-score7.c, * elf32-sh.c, * elf32-sh64.c, * elf32-spu.c,
570         * elf32-tic6x.c, * elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c,
571         * elf32-xtensa.c, * elf64-alpha.c, * elf64-hppa.c, * elf64-ia64-vms.c,
572         * elf64-mmix.c, * elf64-s390.c, * elf64-sh64.c, * elf64-x86-64.c,
573         * elfcode.h, * elfcore.h, * elflink.c, * elfnn-aarch64.c,
574         * elfnn-ia64.c, * elfnn-riscv.c, * elfxx-mips.c, * elfxx-sparc.c,
575         * elfxx-tilegx.c, * ieee.c, * ihex.c, * mach-o.c, * merge.c, * mmo.c,
576         * peXXigen.c, * xcofflink.c: Replace use of Lx modifier with PRIx64,
577         and cast input to uint64_t, and similarly for Ld and Lu.
578         * bfd-in2.h: Regenerate.
579
580 2018-02-19  Alan Modra  <amodra@gmail.com>
581
582         * elf32-arm.c, * elf32-hppa.c, * elf32-lm32.c, * elf32-m32r.c,
583         * elf32-metag.c, * elf32-nds32.c, * elf32-or1k.c, * elf32-ppc.c,
584         * elf32-s390.c, * elf32-sh.c, * elf32-tic6x.c, * elf32-tilepro.c,
585         * elf64-ppc.c, * elf64-s390.c, * elflink.c, * elfnn-aarch64.c,
586         * elfnn-riscv.c, * elfxx-sparc.c, * elfxx-tilegx.c, * elfxx-x86.c,
587         * reloc.c: Replace use of %R and %T in format strings passed to
588         einfo and friends by %pR and %pT.
589
590 2018-02-19  Alan Modra  <amodra@gmail.com>
591
592         * bfd.c (_bfd_doprnt, _bfd_doprnt_scan): Handle %pA and %pB in place
593         of %A and %B.
594         * aout-adobe.c: Update all messages using %A and %B.
595         * aout-cris.c: Likewise.
596         * aoutx.h: Likewise.
597         * archive.c: Likewise.
598         * binary.c: Likewise.
599         * cache.c: Likewise.
600         * coff-alpha.c: Likewise.
601         * coff-arm.c: Likewise.
602         * coff-i860.c: Likewise.
603         * coff-mcore.c: Likewise.
604         * coff-ppc.c: Likewise.
605         * coff-rs6000.c: Likewise.
606         * coff-sh.c: Likewise.
607         * coff-tic4x.c: Likewise.
608         * coff-tic54x.c: Likewise.
609         * coff-tic80.c: Likewise.
610         * coff64-rs6000.c: Likewise.
611         * coffcode.h: Likewise.
612         * coffgen.c: Likewise.
613         * cofflink.c: Likewise.
614         * coffswap.h: Likewise.
615         * compress.c: Likewise.
616         * cpu-arm.c: Likewise.
617         * ecoff.c: Likewise.
618         * elf-attrs.c: Likewise.
619         * elf-eh-frame.c: Likewise.
620         * elf-ifunc.c: Likewise.
621         * elf-m10300.c: Likewise.
622         * elf-properties.c: Likewise.
623         * elf-s390-common.c: Likewise.
624         * elf.c: Likewise.
625         * elf32-arc.c: Likewise.
626         * elf32-arm.c: Likewise.
627         * elf32-avr.c: Likewise.
628         * elf32-bfin.c: Likewise.
629         * elf32-cr16.c: Likewise.
630         * elf32-cr16c.c: Likewise.
631         * elf32-cris.c: Likewise.
632         * elf32-crx.c: Likewise.
633         * elf32-d10v.c: Likewise.
634         * elf32-d30v.c: Likewise.
635         * elf32-epiphany.c: Likewise.
636         * elf32-fr30.c: Likewise.
637         * elf32-frv.c: Likewise.
638         * elf32-gen.c: Likewise.
639         * elf32-hppa.c: Likewise.
640         * elf32-i370.c: Likewise.
641         * elf32-i386.c: Likewise.
642         * elf32-i960.c: Likewise.
643         * elf32-ip2k.c: Likewise.
644         * elf32-iq2000.c: Likewise.
645         * elf32-lm32.c: Likewise.
646         * elf32-m32c.c: Likewise.
647         * elf32-m32r.c: Likewise.
648         * elf32-m68hc11.c: Likewise.
649         * elf32-m68hc12.c: Likewise.
650         * elf32-m68hc1x.c: Likewise.
651         * elf32-m68k.c: Likewise.
652         * elf32-mcore.c: Likewise.
653         * elf32-mep.c: Likewise.
654         * elf32-metag.c: Likewise.
655         * elf32-microblaze.c: Likewise.
656         * elf32-moxie.c: Likewise.
657         * elf32-msp430.c: Likewise.
658         * elf32-mt.c: Likewise.
659         * elf32-nds32.c: Likewise.
660         * elf32-nios2.c: Likewise.
661         * elf32-or1k.c: Likewise.
662         * elf32-pj.c: Likewise.
663         * elf32-ppc.c: Likewise.
664         * elf32-rl78.c: Likewise.
665         * elf32-rx.c: Likewise.
666         * elf32-s390.c: Likewise.
667         * elf32-score.c: Likewise.
668         * elf32-score7.c: Likewise.
669         * elf32-sh-symbian.c: Likewise.
670         * elf32-sh.c: Likewise.
671         * elf32-sh64.c: Likewise.
672         * elf32-sparc.c: Likewise.
673         * elf32-spu.c: Likewise.
674         * elf32-tic6x.c: Likewise.
675         * elf32-tilepro.c: Likewise.
676         * elf32-v850.c: Likewise.
677         * elf32-vax.c: Likewise.
678         * elf32-visium.c: Likewise.
679         * elf32-wasm32.c: Likewise.
680         * elf32-xgate.c: Likewise.
681         * elf32-xtensa.c: Likewise.
682         * elf64-alpha.c: Likewise.
683         * elf64-gen.c: Likewise.
684         * elf64-hppa.c: Likewise.
685         * elf64-ia64-vms.c: Likewise.
686         * elf64-mmix.c: Likewise.
687         * elf64-ppc.c: Likewise.
688         * elf64-s390.c: Likewise.
689         * elf64-sh64.c: Likewise.
690         * elf64-sparc.c: Likewise.
691         * elf64-x86-64.c: Likewise.
692         * elfcode.h: Likewise.
693         * elfcore.h: Likewise.
694         * elflink.c: Likewise.
695         * elfnn-aarch64.c: Likewise.
696         * elfnn-ia64.c: Likewise.
697         * elfnn-riscv.c: Likewise.
698         * elfxx-mips.c: Likewise.
699         * elfxx-sparc.c: Likewise.
700         * elfxx-tilegx.c: Likewise.
701         * elfxx-x86.c: Likewise.
702         * hpux-core.c: Likewise.
703         * ieee.c: Likewise.
704         * ihex.c: Likewise.
705         * libbfd.c: Likewise.
706         * linker.c: Likewise.
707         * mach-o.c: Likewise.
708         * merge.c: Likewise.
709         * mmo.c: Likewise.
710         * oasys.c: Likewise.
711         * pdp11.c: Likewise.
712         * pe-mips.c: Likewise.
713         * peXXigen.c: Likewise.
714         * peicode.h: Likewise.
715         * reloc.c: Likewise.
716         * rs6000-core.c: Likewise.
717         * srec.c: Likewise.
718         * stabs.c: Likewise.
719         * vms-alpha.c: Likewise.
720         * xcofflink.c: Likewise.
721
722 2018-02-19  Alan Modra  <amodra@gmail.com>
723
724         PR 22845
725         * elf.c (IS_TBSS): Define.
726         (_bfd_elf_map_sections_to_segments): Use IS_TBSS.
727         (assign_file_positions_for_non_load_sections): Revert last change.
728         Properly calculate load segment limits to compare against relro limits.
729
730 2018-02-17  Alan Modra  <amodra@gmail.com>
731
732         PR 22845
733         * elf.c (assign_file_positions_for_non_load_sections): Ignore
734         degenerate zero size PT_LOAD segments when finding one overlapping
735         the PT_GNU_RELRO segment.
736
737 2018-02-16  Alan Modra  <amodra@gmail.com>
738
739         * libbfd.c (_bfd_bool_bfd_false_error): Rename from bfd_false.
740         (_bfd_bool_bfd_true): Rename from bfd_true.
741         (_bfd_ptr_bfd_null_error): Rename from bfd_nullvoidptr.
742         (_bfd_int_bfd_0): Rename from bfd_0.
743         (_bfd_uint_bfd_0): Rename from bfd_0u.
744         (_bfd_long_bfd_0): Rename from bfd_0l.
745         (_bfd_long_bfd_n1_error): Rename from _bfd_n1.
746         (_bfd_void_bfd): Rename from bfd_void.
747         (_bfd_bool_bfd_false, _bfd_bool_bfd_asymbol_false),
748         (_bfd_bool_bfd_link_false_error),
749         (_bfd_bool_bfd_link_true, _bfd_bool_bfd_bfd_true),
750         (_bfd_bool_bfd_uint_true, _bfd_bool_bfd_ptr_true),
751         (_bfd_bool_bfd_asection_bfd_asection_true),
752         (_bfd_bool_bfd_asymbol_bfd_asymbol_true),
753         (_bfd_void_bfd_link, _bfd_void_bfd_asection): New functions.
754         * archive.c (_bfd_noarchive_get_elt_at_index),
755         (_bfd_noarchive_openr_next_archived_file),
756         (_bfd_noarchive_construct_extended_name_table),
757         (_bfd_noarchive_write_ar_hdr, _bfd_noarchive_truncate_arname),
758         (_bfd_noarchive_write_armap): New functions.
759         * archures.c (_bfd_nowrite_set_arch_mach): New function.
760         * coff-alpha.c (alpha_ecoff_swap_coff_aux_in),
761         (alpha_ecoff_swap_coff_sym_in, alpha_ecoff_swap_coff_lineno_in),
762         (alpha_ecoff_swap_coff_aux_out, alpha_ecoff_swap_coff_sym_out),
763         (alpha_ecoff_swap_coff_lineno_out),
764         (alpha_ecoff_swap_coff_reloc_out): New functions.
765         * coff-mips.c (mips_ecoff_swap_coff_aux_in),
766         (mips_ecoff_swap_coff_sym_in, mips_ecoff_swap_coff_lineno_in),
767         (mips_ecoff_swap_coff_aux_out, mips_ecoff_swap_coff_sym_out),
768         (mips_ecoff_swap_coff_lineno_out),
769         (mips_ecoff_swap_coff_reloc_out): New functions.
770         * coffcode.h (coff_set_alignment_hook): Replace define with
771         new function.
772         (symname_in_debug_hook): Likewise.
773         * ecoff.c (_bfd_ecoff_set_alignment_hook): New function.
774         * elfxx-target.h (elf_backend_allow_non_load_phdr): Default to 0.
775         * elf.c (assign_file_positions_except_relocs): Test
776         elf_backend_allow_non_load_phdr for NULL.
777         * elflink.c (_bfd_elf_omit_section_dynsym_default): Rename from
778         _bfd_elf_link_omit_section_dynsym.  Update uses.
779         (_bfd_elf_omit_section_dynsym_all): New function.
780         * elf-bfd.h (_bfd_elf_link_omit_section_dynsym): Delete.
781         (_bfd_elf_omit_section_dynsym_default): Declare.
782         (_bfd_elf_omit_section_dynsym_all): Declare.
783         * linker.c (_bfd_nolink_sizeof_headers, _bfd_nolink_bfd_relax_section),
784         (_bfd_nolink_bfd_get_relocated_section_contents),
785         (_bfd_nolink_bfd_lookup_section_flags),
786         (_bfd_nolink_bfd_is_group_section, _bfd_nolink_bfd_discard_group),
787         (_bfd_nolink_bfd_link_hash_table_create),
788         (_bfd_nolink_bfd_link_just_syms),
789         (_bfd_nolink_bfd_copy_link_hash_symbol_type),
790         (_bfd_nolink_bfd_link_split_section),
791         (_bfd_nolink_section_already_linked),
792         (_bfd_nolink_bfd_define_common_symbol),
793         (_bfd_nolink_bfd_define_start_stop): New functions.
794         * reloc.c (_bfd_norelocs_bfd_reloc_type_lookup),
795         (_bfd_norelocs_bfd_reloc_name_lookup),
796         (_bfd_nodynamic_canonicalize_dynamic_reloc): New functions.
797         * section.c (_bfd_nowrite_set_section_contents): New function.
798         * syms.c (_bfd_nosymbols_canonicalize_symtab),
799         (_bfd_nosymbols_print_symbol, _bfd_nosymbols_get_symbol_info),
800         (_bfd_nosymbols_get_symbol_version_string),
801         (_bfd_nosymbols_bfd_is_local_label_name),
802         (_bfd_nosymbols_get_lineno, _bfd_nosymbols_find_nearest_line),
803         (_bfd_nosymbols_find_line, _bfd_nosymbols_find_inliner_info),
804         (_bfd_nosymbols_bfd_make_debug_symbol),
805         ( _bfd_nosymbols_read_minisymbols),
806         ( _bfd_nosymbols_minisymbol_to_symbol),
807         (_bfd_nodynamic_get_synthetic_symtab): New functions.
808         * libbfd-in.h: Declare new functions.  Update existing defines,
809         removing casts.
810         * aix386-core.c: Update to use new hooks.  Formatting.
811         * aout-adobe.c: Likewise.
812         * aout-arm.c: Likewise.
813         * aout-target.h: Likewise.
814         * aout-tic30.c: Likewise.
815         * aoutf1.h: Likewise.
816         * binary.c: Likewise.
817         * bout.c: Likewise.
818         * cisco-core.c: Likewise.
819         * coff-alpha.c: Likewise.
820         * coff-i386.c: Likewise.
821         * coff-i860.c: Likewise.
822         * coff-i960.c: Likewise.
823         * coff-ia64.c: Likewise.
824         * coff-mips.c: Likewise.
825         * coff-ppc.c: Likewise.
826         * coff-rs6000.c: Likewise.
827         * coff-sh.c: Likewise.
828         * coff-tic30.c: Likewise.
829         * coff-tic54x.c: Likewise.
830         * coff-x86_64.c: Likewise.
831         * coff64-rs6000.c: Likewise.
832         * coffcode.h: Likewise.
833         * elf-m10300.c: Likewise.
834         * elf32-cr16.c: Likewise.
835         * elf32-lm32.c: Likewise.
836         * elf32-m32r.c: Likewise.
837         * elf32-metag.c: Likewise.
838         * elf32-score.c: Likewise.
839         * elf32-score7.c: Likewise.
840         * elf32-tilepro.c: Likewise.
841         * elf32-xstormy16.c: Likewise.
842         * elf32-xtensa.c: Likewise.
843         * elf64-alpha.c: Likewise.
844         * elf64-hppa.c: Likewise.
845         * elf64-ia64-vms.c: Likewise.
846         * elf64-mmix.c: Likewise.
847         * elf64-sh64.c: Likewise.
848         * elfnn-ia64.c: Likewise.
849         * elfxx-sparc.c: Likewise.
850         * elfxx-target.h: Likewise.
851         * elfxx-tilegx.c: Likewise.
852         * elfxx-x86.h: Likewise.
853         * hp300hpux.c: Likewise.
854         * hppabsd-core.c: Likewise.
855         * hpux-core.c: Likewise.
856         * i386msdos.c: Likewise.
857         * i386os9k.c: Likewise.
858         * ieee.c: Likewise.
859         * ihex.c: Likewise.
860         * irix-core.c: Likewise.
861         * libaout.h: Likewise.
862         * libecoff.h: Likewise.
863         * mach-o-target.c: Likewise.
864         * mach-o.c: Likewise.
865         * mipsbsd.c: Likewise.
866         * mmo.c: Likewise.
867         * netbsd-core.c: Likewise.
868         * nlm-target.h: Likewise.
869         * oasys.c: Likewise.
870         * osf-core.c: Likewise.
871         * pdp11.c: Likewise.
872         * pe-mips.c: Likewise.
873         * pe-x86_64.c: Likewise.
874         * pef.c: Likewise.
875         * plugin.c: Likewise.
876         * ppcboot.c: Likewise.
877         * ptrace-core.c: Likewise.
878         * sco5-core.c: Likewise.
879         * som.c: Likewise.
880         * sparclynx.c: Likewise.
881         * srec.c: Likewise.
882         * tekhex.c: Likewise.
883         * trad-core.c: Likewise.
884         * verilog.c: Likewise.
885         * versados.c: Likewise.
886         * vms-alpha.c: Likewise.
887         * vms-lib.c: Likewise.
888         * wasm-module.c: Likewise.
889         * xsym.c: Likewise.
890         * libbfd.h: Regenerate.
891
892 2018-02-15  Jim Wilson  <jimw@sifive.com>
893
894         * elfnn-riscv.c (_bfd_riscv_relax_section): Ifdef out check to ignore
895         symbols whose section address is zero.
896
897         * elfnn-riscv.c (riscv_elf_relocate_section): Use bfd_reloc_dangerous
898         when pcrel_lo reloc has an addend.  Use reloc_dangerous callback for
899         bfd_reloc_dangerous.  Use einfo instead of warning callback for errors.
900         Add %X%P to error messages.
901
902 2018-02-15  Eric Botcazou  <ebotcazou@adacore.com>
903
904         PR ld/22832
905         * elfxx-sparc.c (_bfd_sparc_elf_check_relocs) <R_SPARC_TLS_GD_CALL>:
906         Pass FALSE instead of TRUE as 'create' argument to bfd_link_hash_lookup
907         and assert that the result of the call is not NULL.
908
909 2018-02-14  Nick Clifton  <nickc@redhat.com>
910
911         PR 22823
912         Revert previous delta.  Add extra casts to avoid compile time
913         warnings instead.
914         * libbfd-in.h (_bfd_generic_bfd_copy_private_bfd_data): Add extra
915         cast to avoid warning from gcc v8 compiler.
916         (_bfd_generic_bfd_merge_private_bfd_data): Likewise.
917         (_bfd_generic_bfd_set_private_flags): Likewise.
918         (_bfd_generic_bfd_copy_private_section_data): Likewise.
919         (_bfd_generic_bfd_copy_private_symbol_data): Likewise.
920         (_bfd_generic_bfd_copy_private_header_data): Likewise.
921         (_bfd_generic_bfd_print_private_bfd_data): Likewise.
922         (_bfd_noarchive_construct_extended_name_table): Likewise.
923         (_bfd_noarchive_truncate_arname): Likewise.
924         (_bfd_noarchive_write_ar_hdr): Likewise.
925         (_bfd_noarchive_get_elt_at_index): Likewise.
926         (_bfd_nosymbols_canonicalize_symtab): Likewise.
927         (_bfd_nosymbols_print_symbol): Likewise.
928         (_bfd_nosymbols_get_symbol_info): Likewise.
929         (_bfd_nosymbols_get_symbol_version_string): Likewise.
930         (_bfd_nosymbols_bfd_is_local_label_name): Likewise.
931         (_bfd_nosymbols_bfd_is_target_special_symbol): Likewise.
932         (_bfd_nosymbols_get_lineno): Likewise.
933         (_bfd_nosymbols_find_nearest_line): Likewise.
934         (_bfd_nosymbols_find_line): Likewise.
935         (_bfd_nosymbols_find_inliner_info): Likewise.
936         (_bfd_nosymbols_bfd_make_debug_symbol): Likewise.
937         (_bfd_nosymbols_read_minisymbols): Likewise.
938         (_bfd_nosymbols_minisymbol_to_symbol): Likewise.
939         (_bfd_norelocs_bfd_reloc_type_lookup): Likewise.
940         (_bfd_norelocs_bfd_reloc_name_lookup): Likewise.
941         (_bfd_nowrite_set_arch_mach): Likewise.
942         (_bfd_nowrite_set_section_contents): Likewise.
943         (_bfd_nolink_sizeof_headers): Likewise.
944         (_bfd_nolink_bfd_get_relocated_section_contents): Likewise.
945         (_bfd_nolink_bfd_relax_section): Likewise.
946         (_bfd_nolink_bfd_gc_sections): Likewise.
947         (_bfd_nolink_bfd_lookup_section_flags): Likewise.
948         (_bfd_nolink_bfd_merge_sections): Likewise.
949         (_bfd_nolink_bfd_is_group_section): Likewise.
950         (_bfd_nolink_bfd_discard_group): Likewise.
951         (_bfd_nolink_bfd_link_hash_table_create): Likewise.
952         (_bfd_nolink_bfd_link_add_symbols): Likewise.
953         (_bfd_nolink_bfd_link_just_syms): Likewise.
954         (_bfd_nolink_bfd_copy_link_hash_symbol_type): Likewise.
955         (_bfd_nolink_bfd_final_link): Likewise.
956         (_bfd_nolink_bfd_link_split_section): Likewise.
957         (_bfd_nolink_section_already_linked): Likewise.
958         (_bfd_nolink_bfd_define_common_symbol): Likewise.
959         (_bfd_nolink_bfd_define_start_stop): Likewise.
960         (_bfd_nodynamic_canonicalize_dynamic_symtab): Likewise.
961         (_bfd_nodynamic_get_synthetic_symtab): Likewise.
962         (_bfd_nodynamic_get_dynamic_reloc_upper_bound _bfd_): Likewise.
963         (_bfd_nodynamic_canonicalize_dynamic_reloc): Likewise.
964         * libbfd.c (bfd_false_any): Delete.
965         (bfd_true_any, bfd_nullvoidptr_any, bfd_0_any): Delete.
966         (bfd_0u_any, bfd_0l_any, _bfd_n1_any, bfd_void_any): Delete.
967         * libbfd.h (extern): Regenerate
968         * aout-target.h (MY_bfd_is_target_special_symbol): Add extra
969         cast to avoid warning from gcc v8 compiler.
970         * aout-tic30.c (tic30_aout_set_arch_mach): Likewise.
971         * binary.c (binary_get_symbol_info): Likewise.
972         * coff-alpha.c (alpha_ecoff_backend_data): Likewise.
973         * coff-mips.c (mips_ecoff_backend_data): Likewise.
974         * coffcode.h (coff_set_alignment_hook): Likewise.
975         (symname_in_debug_hook): Likewise.
976         (bfd_coff_backend_data bigobj_swap_table): Likewise.
977         * elf-m10300.c (elf_backend_omit_section_dynsym): Likewise.
978         * elf32-cr16.c (elf_backend_omit_section_dynsym): Likewise.
979         * elf32-lm32.c (elf_backend_omit_section_dynsym): Likewise.
980         * elf32-m32r.c (elf_backend_omit_section_dynsym): Likewise.
981         * elf32-metag.c (elf_backend_omit_section_dynsym): Likewise.
982         * elf32-score.c (elf_backend_omit_section_dynsym): Likewise.
983         * elf32-score7.c (elf_backend_omit_section_dynsym): Likewise.
984         * elf32-xstormy16.c (elf_backend_omit_section_dynsym): Likewise.
985         * elf32-xtensa.c (elf_backend_omit_section_dynsym): Likewise.
986         * elf64-alpha.c (elf_backend_omit_section_dynsym): Likewise.
987         * elf64-hppa.c (elf_backend_omit_section_dynsym): Likewise.
988         * elf64-ia64-vms.c (elf_backend_omit_section_dynsym): Likewise.
989         * elf64-mmix.c (elf_backend_omit_section_dynsym): Likewise.
990         * elf64-sh64.c (elf_backend_omit_section_dynsym): Likewise.
991         * elfnn-ia64.c (elf_backend_omit_section_dynsym): Likewise.
992         * elfxx-target.h (bfd_elfNN_bfd_debug_info_accumulate): Likewise.
993         (bfd_elfNN_bfd_make_debug_symbol): Likewise.
994         (bfd_elfNN_bfd_merge_private_bfd_data): Likewise.
995         (bfd_elfNN_bfd_set_private_flags): Likewise.
996         (bfd_elfNN_bfd_is_target_special_symbol): Likewise.
997         (elf_backend_init_index_section): Likewise.
998         (elf_backend_allow_non_load_phdr): Likewise.
999         * elfxx-x86.h (elf_backend_omit_section_dynsym): Likewise.
1000         * i386msdos.c (msdos_bfd_is_target_special_symbol): Likewise.
1001         * ieee.c (ieee_construct_extended_name_table): Likewise.
1002         (ieee_write_armap): Likewise.
1003         (ieee_write_ar_hdr): Likewise.
1004         (ieee_bfd_is_target_special_symbol): Likewise.
1005         * ihex.c (ihex_canonicalize_symtab): Likewise.
1006         (ihex_bfd_is_target_special_symbol): Likewise.
1007         * libaout.h (aout_32_bfd_is_target_special_symbol): Likewise.
1008         * libecoff.h (_bfd_ecoff_bfd_is_target_special_symbol): Likewise.
1009         (_bfd_ecoff_set_alignment_hook): Likewise.
1010         * mach-o-target.c (bfd_mach_o_bfd_is_target_special_symbol): Likewise.
1011         * mmo.c (mmo_bfd_is_target_special_symbol): Likewise.
1012         * nlm-target.h (nlm_bfd_is_target_special_symbol): Likewise.
1013         * oasys.c (oasys_construct_extended_name_table): Likewise.
1014         (oasys_write_armap): Likewise.
1015         (oasys_write_ar_hdr): Likewise.
1016         (oasys_bfd_is_target_special_symbol): Likewise.
1017         * pef.c (bfd_pef_bfd_is_target_special_symbol): Likewise.
1018         * plugin.c (bfd_plugin_bfd_is_target_special_symbol): Likewise.
1019         * ppcboot.c (ppcboot_bfd_is_target_special_symbol): Likewise.
1020         * som.c (som_bfd_is_target_special_symbol): Likewise.
1021         * srec.c (srec_bfd_is_target_special_symbol): Likewise.
1022         * tekhex.c (tekhex_bfd_is_target_special_symbol): Likewise.
1023         * verilog.c (verilog_bfd_is_target_special_symbol): Likewise.
1024         * versados.c (versados_bfd_is_target_special_symbol): Likewise.
1025         (versados_bfd_reloc_name_lookup): Likewise.
1026         * vms-alpha.c (vms_bfd_is_target_special_symbol): Likewise.
1027         (vms_bfd_define_start_stop): Likewise.
1028         (alpha_vms_bfd_is_target_special_symbol): Likewise.
1029         * wasm-module.c (wasm_bfd_is_target_special_symbol): Likewise.
1030         * xsym.c (bfd_sym_bfd_is_target_special_symbol): Likewise.
1031
1032 2018-02-14  H.J. Lu  <hongjiu.lu@intel.com>
1033
1034         PR ld/22842
1035         * elf32-i386.c (elf_i386_check_relocs): Pass FALSE for non
1036         PC-relative PLT to NEED_DYNAMIC_RELOCATION_P.
1037         * elf64-x86-64.c (elf_x86_64_check_relocs): Create PLT for
1038         R_X86_64_PC32 reloc against dynamic function in data section.
1039         Pass TRUE for PC-relative PLT to NEED_DYNAMIC_RELOCATION_P.
1040         (elf_x86_64_relocate_section): Use PLT for R_X86_64_PC32 reloc
1041         against dynamic function in data section.
1042         * elfxx-x86.c (elf_x86_allocate_dynrelocs): Use PLT in PIE as
1043         function address only if pcrel_plt is true.
1044         (_bfd_x86_elf_link_hash_table_create): Set pcrel_plt.
1045         * elfxx-x86.h (NEED_DYNAMIC_RELOCATION_P): Add PCREL_PLT for
1046         PC-relative PLT.  If PLT is PC-relative, don't generate dynamic
1047         PC-relative relocation against a function definition in data
1048         secton in PIE.  Remove the obsolete comments.
1049         (elf_x86_link_hash_table): Add pcrel_plt.
1050
1051 2018-02-13  H.J. Lu  <hongjiu.lu@intel.com>
1052
1053         * elfxx-x86.c (elf_x86_allocate_dynrelocs): Check bfd_link_dll,
1054         instead of bfd_link_pic, for building shared library.
1055
1056 2018-02-13  H.J. Lu  <hongjiu.lu@intel.com>
1057
1058         PR gas/22791
1059         * elf64-x86-64.c (is_32bit_relative_branch): Removed.
1060         (elf_x86_64_relocate_section): Check PIC relocations in PIE.
1061         Remove is_32bit_relative_branch usage.  Disallow PC32 reloc
1062         against protected function in shared object.
1063
1064 2018-02-13  Sergei Trofimovich  <slyfox@inbox.ru>
1065
1066         PR 22828
1067         * po/ru.po: Fix typo in Russian translation.
1068
1069 2018-02-13  Maciej W. Rozycki  <macro@mips.com>
1070
1071         * wasm-module.c (wasm_scan_name_function_section): Rename
1072         `index' local variable to `idx'.
1073
1074 2018-02-13  Nick Clifton  <nickc@redhat.com>
1075
1076         PR 22823
1077         Fix compile time warnings generated by gcc version 8.
1078         * libbfd-in.h: Remove extraneous text from prototypes.
1079         Add prototypes for bfd_false_any, bfd_true_any,
1080         bfd_nullvoidptr_any, bfd_0_any, bfd_0u_any, bfd_0l_any,
1081         bfd_n1_any, bfd_void_any.
1082         (_bfd_generic_bfd_copy_private_bfd_data): Use vararg based dummy
1083         function.
1084         (_bfd_generic_bfd_merge_private_bfd_data): Likewise.
1085         (_bfd_generic_bfd_set_private_flags): Likewise.
1086         (_bfd_generic_bfd_copy_private_section_data): Likewise.
1087         (_bfd_generic_bfd_copy_private_symbol_data): Likewise.
1088         (_bfd_generic_bfd_copy_private_header_data): Likewise.
1089         (_bfd_generic_bfd_print_private_bfd_data): Likewise.
1090         (_bfd_noarchive_construct_extended_name_table): Likewise.
1091         (_bfd_noarchive_truncate_arname): Likewise.
1092         (_bfd_noarchive_write_ar_hdr): Likewise.
1093         (_bfd_noarchive_get_elt_at_index): Likewise.
1094         (_bfd_nosymbols_canonicalize_symtab): Likewise.
1095         (_bfd_nosymbols_print_symbol): Likewise.
1096         (_bfd_nosymbols_get_symbol_info): Likewise.
1097         (_bfd_nosymbols_get_symbol_version_string): Likewise.
1098         (_bfd_nosymbols_bfd_is_local_label_name): Likewise.
1099         (_bfd_nosymbols_bfd_is_target_special_symbol): Likewise.
1100         (_bfd_nosymbols_get_lineno): Likewise.
1101         (_bfd_nosymbols_find_nearest_line): Likewise.
1102         (_bfd_nosymbols_find_line): Likewise.
1103         (_bfd_nosymbols_find_inliner_info): Likewise.
1104         (_bfd_nosymbols_bfd_make_debug_symbol): Likewise.
1105         (_bfd_nosymbols_read_minisymbols): Likewise.
1106         (_bfd_nosymbols_minisymbol_to_symbol): Likewise.
1107         (_bfd_norelocs_bfd_reloc_type_lookup): Likewise.
1108         (_bfd_norelocs_bfd_reloc_name_lookup): Likewise.
1109         (_bfd_nowrite_set_arch_mach): Likewise.
1110         (_bfd_nowrite_set_section_contents): Likewise.
1111         (_bfd_nolink_sizeof_headers): Likewise.
1112         (_bfd_nolink_bfd_get_relocated_section_contents): Likewise.
1113         (_bfd_nolink_bfd_relax_section): Likewise.
1114         (_bfd_nolink_bfd_gc_sections): Likewise.
1115         (_bfd_nolink_bfd_lookup_section_flags): Likewise.
1116         (_bfd_nolink_bfd_merge_sections): Likewise.
1117         (_bfd_nolink_bfd_is_group_section): Likewise.
1118         (_bfd_nolink_bfd_discard_group): Likewise.
1119         (_bfd_nolink_bfd_link_hash_table_create): Likewise.
1120         (_bfd_nolink_bfd_link_add_symbols): Likewise.
1121         (_bfd_nolink_bfd_link_just_syms): Likewise.
1122         (_bfd_nolink_bfd_copy_link_hash_symbol_type): Likewise.
1123         (_bfd_nolink_bfd_final_link): Likewise.
1124         (_bfd_nolink_bfd_link_split_section): Likewise.
1125         (_bfd_nolink_section_already_linked): Likewise.
1126         (_bfd_nolink_bfd_define_common_symbol): Likewise.
1127         (_bfd_nolink_bfd_define_start_stop): Likewise.
1128         (_bfd_nodynamic_canonicalize_dynamic_symtab): Likewise.
1129         (_bfd_nodynamic_get_synthetic_symtab): Likewise.
1130         (_bfd_nodynamic_get_dynamic_reloc_upper_bound _bfd_): Likewise.
1131         (_bfd_nodynamic_canonicalize_dynamic_reloc): Likewise.
1132         * libbfd.c (bfd_false_any): New function.  Like bfd_false but
1133         accepts one or more arguments.
1134         (bfd_true_any): Likewise.
1135         (bfd_nullvoidptr_any): Likewise.
1136         (bfd_0_any): Likewise.
1137         (bfd_0u_any): Likewise.
1138         (bfd_0l_any): Likewise.
1139         (_bfd_n1_any): Likewise.
1140         (bfd_void_any): Likewise.
1141         * libbfd.h (extern): Regenerate
1142         * aout-target.h (MY_bfd_is_target_special_symbol): Use vararg
1143         based dummy function.
1144         * aout-tic30.c (tic30_aout_set_arch_mach): Likewise.
1145         * binary.c (binary_get_symbol_info): Likewise.
1146         * coff-alpha.c (alpha_ecoff_backend_data): Likewise.
1147         * coff-mips.c (mips_ecoff_backend_data): Likewise.
1148         * coffcode.h (coff_set_alignment_hook): Likewise.
1149         (symname_in_debug_hook): Likewise.
1150         (bfd_coff_backend_data bigobj_swap_table): Likewise.
1151         * elf-m10300.c (elf_backend_omit_section_dynsym): Likewise.
1152         * elf32-cr16.c (elf_backend_omit_section_dynsym): Likewise.
1153         * elf32-lm32.c (elf_backend_omit_section_dynsym): Likewise.
1154         * elf32-m32r.c (elf_backend_omit_section_dynsym): Likewise.
1155         * elf32-metag.c (elf_backend_omit_section_dynsym): Likewise.
1156         * elf32-score.c (elf_backend_omit_section_dynsym): Likewise.
1157         * elf32-score7.c (elf_backend_omit_section_dynsym): Likewise.
1158         * elf32-xstormy16.c (elf_backend_omit_section_dynsym): Likewise.
1159         * elf32-xtensa.c (elf_backend_omit_section_dynsym): Likewise.
1160         * elf64-alpha.c (elf_backend_omit_section_dynsym): Likewise.
1161         * elf64-hppa.c (elf_backend_omit_section_dynsym): Likewise.
1162         * elf64-ia64-vms.c (elf_backend_omit_section_dynsym): Likewise.
1163         * elf64-mmix.c (elf_backend_omit_section_dynsym): Likewise.
1164         * elf64-sh64.c (elf_backend_omit_section_dynsym): Likewise.
1165         * elfnn-ia64.c (elf_backend_omit_section_dynsym): Likewise.
1166         * elfxx-target.h (bfd_elfNN_bfd_debug_info_accumulate): Likewise.
1167         (bfd_elfNN_bfd_make_debug_symbol): Likewise.
1168         (bfd_elfNN_bfd_merge_private_bfd_data): Likewise.
1169         (bfd_elfNN_bfd_set_private_flags): Likewise.
1170         (bfd_elfNN_bfd_is_target_special_symbol): Likewise.
1171         (elf_backend_init_index_section): Likewise.
1172         (elf_backend_allow_non_load_phdr): Likewise.
1173         * elfxx-x86.h (elf_backend_omit_section_dynsym): Likewise.
1174         * i386msdos.c (msdos_bfd_is_target_special_symbol): Likewise.
1175         * ieee.c (ieee_construct_extended_name_table): Likewise.
1176         (ieee_write_armap): Likewise.
1177         (ieee_write_ar_hdr): Likewise.
1178         (ieee_bfd_is_target_special_symbol): Likewise.
1179         * ihex.c (ihex_canonicalize_symtab): Likewise.
1180         (ihex_bfd_is_target_special_symbol): Likewise.
1181         * libaout.h (aout_32_bfd_is_target_special_symbol): Likewise.
1182         * libecoff.h (_bfd_ecoff_bfd_is_target_special_symbol): Likewise.
1183         (_bfd_ecoff_set_alignment_hook): Likewise.
1184         * mach-o-target.c (bfd_mach_o_bfd_is_target_special_symbol): Likewise.
1185         * mmo.c (mmo_bfd_is_target_special_symbol): Likewise.
1186         * nlm-target.h (nlm_bfd_is_target_special_symbol): Likewise.
1187         * oasys.c (oasys_construct_extended_name_table): Likewise.
1188         (oasys_write_armap): Likewise.
1189         (oasys_write_ar_hdr): Likewise.
1190         (oasys_bfd_is_target_special_symbol): Likewise.
1191         * pef.c (bfd_pef_bfd_is_target_special_symbol): Likewise.
1192         * plugin.c (bfd_plugin_bfd_is_target_special_symbol): Likewise.
1193         * ppcboot.c (ppcboot_bfd_is_target_special_symbol): Likewise.
1194         * som.c (som_bfd_is_target_special_symbol): Likewise.
1195         * srec.c (srec_bfd_is_target_special_symbol): Likewise.
1196         * tekhex.c (tekhex_bfd_is_target_special_symbol): Likewise.
1197         * verilog.c (verilog_bfd_is_target_special_symbol): Likewise.
1198         * versados.c (versados_bfd_is_target_special_symbol): Likewise.
1199         (versados_bfd_reloc_name_lookup): Likewise.
1200         * vms-alpha.c (vms_bfd_is_target_special_symbol): Likewise.
1201         (vms_bfd_define_start_stop): Likewise.
1202         (alpha_vms_bfd_is_target_special_symbol): Likewise.
1203         * wasm-module.c (wasm_bfd_is_target_special_symbol): Likewise.
1204         * xsym.c (bfd_sym_bfd_is_target_special_symbol): Likewise.
1205         * elf32-arc.c (get_replace_function): Assign replacement function
1206         to func pointer.
1207         * elf32-i370.c (i370_noop): Update prototype.
1208
1209 2018-02-13  Alan Modra  <amodra@gmail.com>
1210
1211         PR 22836
1212         * elf.c (_bfd_elf_fixup_group_sections): Account for removed
1213         relocation sections.  If size reduces to just the flag word,
1214         remove that too and mark with SEC_EXCLUDE.
1215         * elflink.c (bfd_elf_final_link): Strip empty group sections.
1216
1217 2018-02-13  Alan Modra  <amodra@gmail.com>
1218
1219         PR 22829
1220         * elf.c (assign_file_positions_for_non_load_sections): Rewrite
1221         PT_GNU_RELRO setup.
1222
1223 2018-02-12  Zebediah Figura  <z.figura12@gmail.com>
1224
1225         * i386msdos.c (msdos_mkobject); New function.
1226         (msdos_object_p): New function.
1227         (i386_msdos_vec): Use msdos_object_p as the check_format
1228         function.
1229         * peicode.h: Rename external_PEI_DOS_hdr, DOSMAGIC, and
1230         NT_SIGNATURE to external_DOS_hdr, IMAGE_DOS_SIGNATURE, and
1231         IMAGE_NT_SIGNATURE.
1232         * peXXigen.c: Likewise.
1233         * coff-ia64.c: Likewise.
1234
1235 2018-02-12  Nick Clifton  <nickc@redhat.com>
1236
1237         * elf32-nds32.c (nds32_elf_relax_longjump3): Remove redundant
1238         assignment.
1239         * elf32-arc.c (elf_arc_relocate_section): Likewise.
1240
1241 2018-02-09  Eric Botcazou  <ebotcazou@adacore.com>
1242
1243         * elfxx-sparc.c (UNDEFINED_WEAK_RESOLVED_TO_ZERO): Reorder conditions.
1244         (sparc_elf_append_rela): Assert that there is enough room in section.
1245         (_bfd_sparc_elf_copy_indirect_symbol): Fix formatting.
1246         (_bfd_sparc_elf_adjust_dynamic_symbol): Minor tweak.
1247         (allocate_dynrelocs): Remove outdated comments and reorder conditions.
1248         For a symbol subject to a GOT relocation, reserve a slot in the
1249         relocation section if the symbol isn't dynamic and we are in PIC mode.
1250         (_bfd_sparc_elf_relocate_section) <R_SPARC_GOTDATA_OP>: If relocation
1251         is relaxed and a slot was reserved, generate a R_SPARC_NONE relocation.
1252         <R_SPARC_GOTDATA_OP_HIX22>: Adjust comments.
1253         <R_SPARC_PC10>: Reorder conditions.  Remove always-false assertion.
1254         (_bfd_sparc_elf_finish_dynamic_symbol): Rename local_undefweak into
1255         resolved_to_zero.  Do not generate a dynamic GOT relocation for an
1256         undefined weak symbol with non-default visibility.  Remove superfluous
1257         'else' and fix formatting.
1258
1259 2018-02-09  H.J. Lu  <hongjiu.lu@intel.com>
1260
1261         * elf32-i386.c (elf_i386_get_synthetic_symtab): Also handle
1262         is_solaris.
1263         (i386_elf32_sol2_vec): Don't declare.
1264         (elf_i386_link_setup_gnu_properties): Also handle is_solaris.
1265         Don't set need_global_offset_table.
1266         (elf_i386_solaris_arch_bed): New.
1267         (elf_backend_arch_data): Set to elf_i386_solaris_arch_bed for
1268         Solaris.
1269         * elf64-x86-64.c (elf_x86_64_get_synthetic_symtab): Check
1270         target_os != is_nacl instead of target_os == is_normal.
1271         (x86_64_elf64_sol2_vec): Don't declare.
1272         (elf_x86_64_link_setup_gnu_properties): Check target_os !=
1273         is_nacl instead of target_os == is_normal.  Don't set
1274         need_global_offset_table.
1275         (elf_x86_64_solaris_arch_bed): New.
1276         (elf_backend_arch_data): Set to elf_x86_64_solaris_arch_bed for
1277         Solaris.
1278         * elfxx-x86.c (_bfd_x86_elf_size_dynamic_sections): Keep
1279         _GLOBAL_OFFSET_TABLE_ for Solaris.
1280         (_bfd_x86_elf_link_setup_gnu_properties): Don't copy
1281         need_global_offset_table.
1282         * elfxx-x86.h (elf_x86_target_os): Add is_solaris.
1283         (elf_x86_link_hash_table): Remove need_global_offset_table.
1284         (elf_x86_init_table): Likewise.
1285
1286 2018-02-08  H.J. Lu  <hongjiu.lu@intel.com>
1287
1288         * elf32-i386.c (elf32_i386_copy_solaris_special_section_fields):
1289         Remove prototype.
1290         (i386_elf32_sol2_vec): Declared.
1291         (elf_i386_link_setup_gnu_properties): Set
1292         need_global_offset_table with info->output_bfd->xvec.
1293         * elf64-x86-64.c (elf64_x86_64_copy_solaris_special_section_fields):
1294         Remove prototype.
1295         (x86_64_elf64_sol2_vec): Declared.
1296         (elf_x86_64_link_setup_gnu_properties): Set
1297         need_global_offset_table with info->output_bfd->xvec.
1298
1299 2018-02-08  H.J. Lu  <hongjiu.lu@intel.com>
1300
1301         * elf32-i386.c (elf32_i386_copy_solaris_special_section_fields):
1302         New prototype.
1303         (elf_i386_link_setup_gnu_properties): Set need_global_offset_table
1304         for Solaris.
1305         * elf64-x86-64.c (elf64_x86_64_copy_solaris_special_section_fields):
1306         New prototype.
1307         (elf_x86_64_link_setup_gnu_properties): Set
1308         need_global_offset_table for Solaris.
1309         * elfxx-x86.c (_bfd_x86_elf_size_dynamic_sections): Keep the
1310         unused _GLOBAL_OFFSET_TABLE_ for Solaris.
1311         (_bfd_x86_elf_link_setup_gnu_properties): Copy
1312         need_global_offset_table.
1313         * elfxx-x86.h (elf_x86_link_hash_table): Add
1314         need_global_offset_table.
1315         (elf_x86_init_table): Likewise.
1316
1317 2018-02-08  Jim Wilson  <jimw@sifive.com>
1318
1319         * elfnn-riscv.c (riscv_elf_relocate_section): Add comment for previous
1320         change.
1321
1322 2018-02-08  Nick Clifton  <nickc@redhat.com>
1323
1324         PR 22788
1325         * elf.c (elf_parse_notes): Reject notes with excessuively large
1326         alignments.
1327
1328 2018-02-07  Alan Modra  <amodra@gmail.com>
1329
1330         Revert 2018-01-17  Alan Modra  <amodra@gmail.com>
1331         * elf32-ppc.c: Remove speculation barrier support.
1332         * elf32-ppc.h: Likewise.
1333         * elf64-ppc.c: Likewise.
1334         * elf64-ppc.h: Likewise.
1335
1336 2018-02-06  Jim Wilson  <jimw@sifive.com>
1337
1338         * elfnn-riscv.c (riscv_elf_relocate_section): Return TRUE if used
1339         callback to report an error.
1340
1341 2018-02-06  Eric Botcazou  <ebotcazou@adacore.com>
1342
1343         PR ld/22263
1344         * elfxx-sparc.c (sparc_elf_tls_transition): Turn call to bfd_link_pic
1345         into call to !bfd_link_executable and tidy up.
1346         (_bfd_sparc_elf_check_relocs): Fix formatting and tidy up.
1347         <R_SPARC_TLS_LE_HIX22>: Turn call to bfd_link_pic into call to
1348         !bfd_link_executable.
1349         <R_SPARC_TLS_IE_HI22>: Likewise.
1350         <GOT relocations>: Remove useless code, tidy and merge related blocks.
1351         <R_SPARC_TLS_GD_CALL>: Turn call to bfd_link_pic into call to
1352         !bfd_link_executable.
1353         <R_SPARC_WPLT30>: Tidy up.
1354         (_bfd_sparc_elf_gc_mark_hook): Turn call to bfd_link_pic into call to
1355         !bfd_link_executable.
1356         (allocate_dynrelocs): Likewise.
1357         (_bfd_sparc_elf_relocate_section): Fix formatting and tidy up.
1358         <R_SPARC_TLS_GD_HI22>: Merge into...
1359         <R_SPARC_TLS_GD_LO10>: ...this.  Adjust 4th argument in call to
1360         sparc_elf_tls_transition and remove redundant code.
1361         <R_SPARC_TLS_LDM_HI22>: Turn call to bfd_link_pic into call to
1362         !bfd_link_executable.
1363         <R_SPARC_TLS_LDO_HIX22>: Likewise.
1364         <R_SPARC_TLS_LE_HIX22>: Likewise.  Tidy up.
1365         <R_SPARC_TLS_LDM_CALL>: Likewise.
1366         <R_SPARC_TLS_GD_CALL>: Likewise.  Tidy up.
1367         <R_SPARC_TLS_GD_ADD>: Likewise.
1368         <R_SPARC_TLS_LDM_ADD>: Likewise.
1369         <R_SPARC_TLS_LDO_ADD>: Likewise.
1370         <R_SPARC_TLS_IE_LD>: Likewise.
1371
1372 2018-02-06  MiloÅ¡ Stojanović  <milos.stojanovic@rt-rk.com>
1373
1374         PR 22789
1375         * elfxx-mips.c (_bfd_mips_elf_find_nearest_line): If the dwarf
1376         functions failed to find the function name, try the generic elf
1377         find function instead.
1378
1379 2018-02-06  Sergio Durigan Junior  <sergiodj@redhat.com>
1380
1381         * coff-rs6000.c (xcoff_write_archive_contents_old): Use
1382         'memcpy' instead of 'strncpy' when writing the magic number.
1383
1384 2018-02-06  Nick Clifton  <nickc@redhat.com>
1385
1386         PR 22794
1387         * opncls.c (bfd_get_debug_link_info_1): Check the size of the
1388         section before attempting to read it in.
1389         (bfd_get_alt_debug_link_info): Likewise.
1390
1391 2018-02-06  Paul Carroll  <pcarroll@codesourcery.com>
1392
1393         * bfd/dwarf2.c (find_abstract_name): Modified to return file and
1394         line information in addition to name, if they can be found.
1395
1396 2018-02-05  Renlin Li  <renlin.li@arm.com>
1397
1398         PR ld/22764
1399         * elfnn-aarch64.c (elfNN_aarch64_check_relocs): Relax the
1400         R_AARCH64_ABS32 and R_AARCH64_ABS16 for absolute symbol. Apply the
1401         check for writeable section as well.
1402
1403 2018-02-05  H.J. Lu  <hongjiu.lu@intel.com>
1404
1405         PR ld/22782
1406         * elf32-i386.c (elf_i386_check_relocs): Set got_referenced if
1407         _GLOBAL_OFFSET_TABLE_ is referenced or GOT is needed to resolve
1408         undefined weak symbol to 0.
1409         * elf64-x86-64.c (elf_x86_64_check_relocs): Set got_referenced
1410         if _GLOBAL_OFFSET_TABLE_ is referenced.
1411         * elfxx-x86.c (_bfd_x86_elf_size_dynamic_sections): Check
1412         got_referenced instead of ref_regular_nonweak.  Remove the
1413         unused _GLOBAL_OFFSET_TABLE_ from symbol table.
1414         * elfxx-x86.h (elf_x86_link_hash_table): Add got_referenced.
1415
1416 2018-02-05  Maciej W. Rozycki  <macro@mips.com>
1417
1418         * elfnn-riscv.c (_bfd_riscv_relax_pc): Use `memset' to
1419         initialize `hi_reloc'.
1420
1421 2018-02-05  Maciej W. Rozycki  <macro@mips.com>
1422
1423         * elfxx-mips.c (_bfd_mips_elf_section_processing): For
1424         SHT_MIPS_REGINFO sections don't assert the correct size and
1425         report an error instead.
1426
1427 2018-02-05  Maciej W. Rozycki  <macro@mips.com>
1428
1429         * elf.c (_bfd_elf_write_object_contents): Propagate a failure
1430         status from `->elf_backend_section_processing'.
1431
1432 2018-02-02  Jim Wilson  <jimw@sifive.com>
1433
1434         PR ld/22756
1435         * elfnn-riscv.c (riscv_relax_delete_bytes): New parameter link_info.
1436         If link_info->wrap_hash, check for a duplicate symbol and ignore.
1437         (_bfd_riscv_relax_call, bfd_riscv_relax_lui, _bfd_riscv_relax_tls_le):
1438         Pass new argument to riscv_relax_delete_bytes.
1439         (_bfd_riscv_relax_align, _bfd_riscv_relax_delete): Likewise.  Remove
1440         ATTRIBUTE_UNUSED from link_info parameter.
1441
1442 2018-02-02  Alan Modra  <amodra@gmail.com>
1443
1444         * elf64-ppc.c (ppc64_elf_relocate_section): Don't relocate nops
1445         emitted for toc sequence optimization.  Set and use "howto" later.
1446
1447 2018-02-01  Simon Marchi  <simon.marchi@ericsson.com>
1448
1449         * elf64-ppc.c (ppc64_elf_archive_symbol_lookup): Avoid pointer
1450         arithmetic on NULL pointer.
1451         * elflink.c (_bfd_elf_archive_symbol_lookup,
1452         elf_link_add_archive_symbols): Likewise.
1453
1454 2018-01-31  Michael Matz  <matz@suse.de>
1455
1456         * elflink.c (bfd_elf_define_start_stop): Fix check of
1457         def_dynamic.
1458
1459 2018-01-31  H.J. Lu  <hongjiu.lu@intel.com>
1460
1461         PR ld/21964
1462         * elflink.c (bfd_elf_define_start_stop): Check if __start and
1463         __stop symbols are referenced by shared objects.
1464
1465 2018-01-30  Alan Modra  <amodra@gmail.com>
1466
1467         PR 22758
1468         * elf.c (_bfd_elf_map_sections_to_segments): Don't start a new
1469         segment when demand paged with lma on the same page.  Test this
1470         before load/non-load, executable/non-executable,
1471         writable/non-writable tests and simplify.  Delete bogus relro
1472         condition in writable/non-writable test.  Delete outdated
1473         comment.  Formatting.
1474
1475 2018-01-30  Alan Modra  <amodra@gmail.com>
1476
1477         * elflink.c (bfd_elf_define_start_stop): Make __start and __stop
1478         symbols dynamic.
1479
1480 2018-01-29  Alan Modra  <amodra@gmail.com>
1481
1482         PR 22741
1483         * coffgen.c (coff_pointerize_aux): Ensure auxent tagndx is in
1484         range before converting to a symbol table pointer.
1485
1486 2018-01-27  Nick Clifton  <nickc@redhat.com>
1487
1488         * po/ru.po: Updated Russian translation.
1489
1490 2018-01-26  Alan Modra  <amodra@gmail.com>
1491
1492         * elflink.c (bfd_elf_define_start_stop): Override symbols when
1493         they are defined dynamically.
1494
1495 2018-01-26  Alan Modra  <amodra@gmail.com>
1496
1497         * elf64-ppc.c (ppc64_elf_size_stubs): Iterate sizing when
1498         .branch_lt changes size.
1499
1500 2018-01-25  Alan Modra  <amodra@gmail.com>
1501
1502         PR 22746
1503         * elfcode.h (elf_object_p): Avoid integer overflow.
1504
1505 2018-01-25  Eric Botcazou  <ebotcazou@adacore.com>
1506
1507         PR ld/22727
1508         * elfxx-sparc.c (_bfd_sparc_elf_check_relocs) <R_SPARC_TLS_GD_CALL>:
1509         Do a mere lookup of the __tls_get_addr symbol instead of adding it.
1510
1511         Revert
1512         2017-10-19  H.J. Lu  <hongjiu.lu@intel.com>
1513
1514         PR ld/22263
1515         * elfxx-sparc.c (sparc_elf_tls_transition): Replace
1516         bfd_link_pic with !bfd_link_executable, !bfd_link_pic with
1517         bfd_link_executable for TLS check.
1518         (_bfd_sparc_elf_check_relocs): Likewise.
1519         (allocate_dynrelocs): Likewise.
1520         (_bfd_sparc_elf_relocate_section): Likewise.
1521
1522 2018-01-24  Renlin Li  <renlin.li@arm.com>
1523
1524         * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Add support for
1525         BFD_RELOC_AARCH64_MOVW_PREL_G0, BFD_RELOC_AARCH64_MOVW_PREL_G0_NC,
1526         BFD_RELOC_AARCH64_MOVW_PREL_G1, BFD_RELOC_AARCH64_MOVW_PREL_G1_NC,
1527         BFD_RELOC_AARCH64_MOVW_PREL_G2, BFD_RELOC_AARCH64_MOVW_PREL_G2_NC,
1528         BFD_RELOC_AARCH64_MOVW_PREL_G3.
1529         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.
1530         (_bfd_aarch64_elf_resolve_relocation): Likewise.
1531
1532 2018-01-24  Renlin Li  <renlin.li@arm.com>
1533
1534         * reloc.c: Add BFD_RELOC_AARCH64_MOVW_PREL_G0,
1535         BFD_RELOC_AARCH64_MOVW_PREL_G0_NC, BFD_RELOC_AARCH64_MOVW_PREL_G1,
1536         BFD_RELOC_AARCH64_MOVW_PREL_G1_NC, BFD_RELOC_AARCH64_MOVW_PREL_G2,
1537         BFD_RELOC_AARCH64_MOVW_PREL_G2_NC, BFD_RELOC_AARCH64_MOVW_PREL_G3.
1538         * elfnn-aarch64.c (elfNN_aarch64_howto_table): Add entries for
1539         BFD_RELOC_AARCH64_MOVW_PREL_G0, BFD_RELOC_AARCH64_MOVW_PREL_G0_NC,
1540         BFD_RELOC_AARCH64_MOVW_PREL_G1, BFD_RELOC_AARCH64_MOVW_PREL_G1_NC,
1541         BFD_RELOC_AARCH64_MOVW_PREL_G2, BFD_RELOC_AARCH64_MOVW_PREL_G2_NC,
1542         BFD_RELOC_AARCH64_MOVW_PREL_G3.
1543         * bfd-in2.h: Regenerate.
1544         * libbfd.h: Regenerate.
1545
1546 2018-01-23  Maciej W. Rozycki  <macro@mips.com>
1547
1548         * elfxx-mips.c (_bfd_mips_elf_final_link): Update a stale
1549         `mips_elf32_section_processing' comment reference.
1550
1551 2018-01-20  H.J. Lu  <hongjiu.lu@intel.com>
1552
1553         PR ld/22721
1554         * elfxx-x86.c (_bfd_x86_elf_link_check_relocs): Check the
1555         versioned __tls_get_addr symbol.
1556
1557 2018-01-19  Nick Clifton  <nickc@redhat.com>
1558
1559         * po/fr.po: Updated French translation.
1560
1561 2018-01-18  Alan Modra  <amodra@gmail.com>
1562
1563         * elf32-ppc.c (ppc_elf_create_glink): Correct alignment of .glink.
1564         * elf64-ppc.c (ppc64_elf_size_stubs): Handle negative plt_stub_align.
1565         (ppc64_elf_build_stubs): Likewise.
1566
1567 2018-01-17  Nick Clifton  <nickc@redhat.com>
1568
1569         * po/ru.po: Updated Russian translation.
1570         * po/uk/po: Updated Ukranian translation.
1571
1572 2018-01-17  Alan Modra  <amodra@gmail.com>
1573
1574         * elf64-ppc.c (ppc64_elf_build_stubs): Silence gcc warning.
1575
1576 2018-01-17  Alan Modra  <amodra@gmail.com>
1577
1578         * elf32-ppc.c (GLINK_ENTRY_SIZE): Handle speculation barrier.
1579         (CRSETEQ, BEQCTRM): Define.
1580         (is_nonpic_glink_stub): Don't check bctr.
1581         (ppc_elf_link_hash_table_create): Init new ppc_elf_params field.
1582         (ppc_elf_relax_section): Size speculation barrier.
1583         (output_bctr): New function.
1584         (write_glink_stub): Use output_bctr.
1585         (ppc_elf_relocate_section): Use output_bctr for long branch stub.
1586         (ppc_elf_finish_dynamic_symbol): Likewise.
1587         (ppc_elf_finish_dynamic_sections): Use output_bctr.
1588         * elf32-ppc.h (struct ppc_elf_params): Add speculate_indirect_jumps.
1589         * elf64-ppc.c (CRSETEQ, BEQCTRM, BEQCTRLM): Define.
1590         (GLINK_PLTRESOLVE_SIZE): Size speculation barrier.
1591         (size_global_entry_stubs): Handle speculation barrier sizing.
1592         (plt_stub_size): Likewise.
1593         (output_bctr): New function.
1594         (build_plt_stub, build_tls_get_addr_stub): Output speculation
1595         barrier.
1596         (ppc_build_one_stub): Likewise for ppc_stub_plt_branch.
1597         (ppc_size_one_stub): Size speculation barrier in ppc_stub_plt_branch.
1598         (build_global_entry_stubs): Output speculation barrier.
1599         (ppc64_elf_build_stubs): Likewise in __glink_PLTresolve stub.
1600         * elf64-ppc.h (struct ppc64_elf_params): Add speculate_indirect_jumps.
1601
1602 2018-01-17  Alan Modra  <amodra@gmail.com>
1603
1604         * elf32-ppc.c (GLINK_ENTRY_SIZE): Add parameters, handle
1605         __tls_get_addr_opt, and alignment sizing.
1606         (TLS_GET_ADDR_GLINK_SIZE): Delete.
1607         (is_nonpic_glink_stub): Don't use GLINK_ENTRY_SIZE.
1608         (ppc_elf_get_synthetic_symtab): Recognize stubs spaced at 4, 6,
1609         or 8 insns.
1610         (ppc_elf_link_hash_table_create): Init new ppc_elf_params field.
1611         (allocate_dynrelocs): Use new GLINK_ENTRY_SIZE.
1612         (ppc_elf_size_dynamic_sections): Likewise.  Size branch table
1613         by PLT reloc count.
1614         (write_glink_stub): Handle __tls_get_addr_opt stub.
1615         Pad out to size given by GLINK_ENTRY_SIZE.
1616         (ppc_elf_relocate_section): Adjust write_glink_stub call.
1617         (ppc_elf_finish_dynamic_symbol): Likewise.
1618         (ppc_elf_finish_dynamic_sections): Write PLTresolve without using
1619         insn array since so many need rewriting.
1620         * elf32-ppc.h (struct ppc_elf_params): Add plt_stub_align.
1621         * elf64-ppc.c (GLINK_PLTRESOLVE_SIZE): Rename from
1622         GLINK_CALL_STUB_SIZE.  Add htab param and evaluate to size without
1623         nops.  Adjust all uses.
1624         (ppc64_elf_get_synthetic_symtab): Don't use GLINK_CALL_STUB_SIZE
1625         in glink_vma calculation.
1626         (struct ppc_link_hash_table): Add global_entry section pointer.
1627         (create_linkage_sections): Create separate section for global
1628         entry stubs.
1629         (PPC_LO, PPC_HI, PPC_HA): Move earlier.
1630         (size_global_entry_stubs): Handle sizing for aligned stubs.
1631         (ppc64_elf_size_dynamic_sections): Handle global_entry alloc,
1632         and don't stash end of glink branch table in rawsize.
1633         (ppc_build_one_stub): Rewrite stub size calculations.
1634         (build_global_entry_stubs): Use new section.
1635         (ppc64_elf_build_stubs): Don't pad __glink_PLTresolve with nops.
1636         Build lazy link stubs out to end of section.  Build global entry
1637         stubs in new section.
1638
1639 2018-01-15  Nick Clifton  <nickc@redhat.com>
1640
1641         * po/uk.po: Updated Ukranian translation.
1642
1643 2018-01-13  Nick Clifton  <nickc@redhat.com>
1644
1645         * po/bfd.pot: Regenerated.
1646
1647 2018-01-13  Nick Clifton  <nickc@redhat.com>
1648
1649         * version.m4: Bump version to 2.30.51
1650         * configure: Regenerate.
1651
1652 2018-01-13  Nick Clifton  <nickc@redhat.com>
1653
1654         2.30 branch created.
1655
1656 2018-01-12  Jens Widell  <jl@opera.com>
1657
1658         * elf.c (setup_group): Optimize search for group by remembering
1659         last found group and restarting search at that index.
1660         * elf-bfd.h (struct elf_obj_tdata): Add group_search_offset field.
1661
1662 2018-01-12  Gunther Nikl  <gnikl@users.sourceforge.net>
1663
1664         * aoutx.h (aout_link_check_ar_symbols): Remove default and handle
1665         bfd_link_common_skip_none in switch.
1666
1667 2018-01-12  Alan Modra  <amodra@gmail.com>
1668
1669         PR ld/22649
1670         * elf64-ppc.c (ppc64_elf_gc_mark_dynamic_ref): Ignore dynamic
1671         references on forced local symbols.
1672
1673 2018-01-12  Vlad Ivanov  <vlad@ivanov.email>
1674
1675         * elfxx-mips.c (_bfd_mips_elf_final_link): Notify user when
1676         .reginfo section has wrong size.
1677
1678 2018-01-11  H.J. Lu  <hongjiu.lu@intel.com>
1679
1680         PR ld/22393
1681         * elf.c (_bfd_elf_map_sections_to_segments): When generating
1682         separate code and read-only data LOAD segments, create a new
1683         LOAD segment if the previous section contains text and the
1684         current section doesn't or vice versa.  Don't put a writable
1685         section in a read-only segment if there is a RELRO segment.
1686
1687 2018-01-11  H.J. Lu  <hongjiu.lu@intel.com>
1688
1689         PR ld/22649
1690         * elflink.c (bfd_elf_gc_mark_dynamic_ref_symbol): Ignore dynamic
1691         references on forced local symbols.
1692
1693 2018-01-11  H.J. Lu  <hongjiu.lu@intel.com>
1694
1695         PR ld/22677
1696         * elflink.c (bfd_elf_gc_sections): Keep all PREINIT_ARRAY,
1697         INIT_ARRAY as well as FINI_ARRAY sections for ld -r --gc-section.
1698
1699 2018-01-09  Kuan-Lin Chen  <kuanlinchentw@gmail.com>
1700
1701         PR 22662
1702         * elf32-nds32.c (nds32_elf_relax_loadstore): Fix a typographical error.
1703
1704 2018-01-03  John Baldwin  <jhb@FreeBSD.org>
1705
1706         * elf.c (elfcore_grok_freebsd_note): Handle
1707         NT_FREEBSD_PROCSTAT_PROC, NT_FREEBSD_PROCSTAT_FILES, and
1708         NT_FREEBSD_PROCSTAT_VMMAP.
1709
1710 2018-01-03  Alan Modra  <amodra@gmail.com>
1711
1712         Update year range in copyright notice of all files.
1713
1714 For older changes see ChangeLog-2017
1715 \f
1716 Copyright (C) 2018 Free Software Foundation, Inc.
1717
1718 Copying and distribution of this file, with or without modification,
1719 are permitted in any medium without royalty provided the copyright
1720 notice and this notice are preserved.
1721
1722 Local Variables:
1723 mode: change-log
1724 left-margin: 8
1725 fill-column: 74
1726 version-control: never
1727 End: