PR22167, NULL pointer dereference in scan_unit_for_symbols
[binutils-gdb.git] / bfd / ChangeLog
1 2017-09-24 Alan Modra <amodra@gmail.com>
2
3 PR 22167
4 * dwarf2.c (scan_unit_for_symbols): Check u.blk->data is non-NULL.
5
6 2017-09-24 Alan Modra <amodra@gmail.com>
7
8 PR 22166
9 * elf.c (_bfd_elf_slurp_version_tables): Test sh_info on
10 SHT_GNU_verneed section for sanity. Don't zalloc memory for
11 verref.
12
13 2017-09-22 H.J. Lu <hongjiu.lu@intel.com>
14
15 PR binutils/22170
16 * elfxx-x86.c (_bfd_x86_elf_get_synthetic_symtab): Guard against
17 corrupted PLT.
18
19 2017-09-22 H.J. Lu <hongjiu.lu@intel.com>
20
21 PR binutils/22163
22 * elfxx-x86.c (_bfd_x86_elf_get_synthetic_symtab): Also return
23 -1 if bfd_canonicalize_dynamic_reloc returns 0.
24
25 2017-09-22 Pedro Alves <palves@redhat.com>
26 Alan Modra <amodra@gmail.com>
27
28 * version.h: Add comment.
29
30 2017-09-21 Andreas Arnez <arnez@linux.vnet.ibm.com>
31
32 * elf.c (elfcore_grok_note): For the cases NT_S390_GS_CB and
33 NT_S390_GS_BC, correct the previously swapped invocations of
34 elfcore_grok_s390_gs_bc and elfcore_grok_s390_gs_cb.
35
36 2017-09-19 Alan Modra <amodra@gmail.com>
37
38 PR 21441
39 * elf64-ppc.c (ppc64_elf_build_stubs): Don't check glink_eh_frame
40 size.
41
42 2017-09-19 Alan Modra <amodra@gmail.com>
43
44 PR 22150
45 * elflink.c (bfd_elf_size_dynamic_sections): Garbage collect
46 symbols before calculating verrefs. Don't renumber dynsyms
47 after gc. Exclude .gnu.version when zero or one dynsym.
48 Localize some vars and reindent.
49
50 2017-09-18 H.J. Lu <hongjiu.lu@intel.com>
51
52 PR ld/22148
53 * elfxx-x86.c (_bfd_x86_elf_get_synthetic_symtab): Check error
54 return from bfd_canonicalize_dynamic_reloc.
55
56 2017-09-15 Alan Modra <amodra@gmail.com>
57
58 PR 22116
59 * archive.c (bfd_ar_hdr_from_filesystem): Detect when status.st_size
60 overflows bfd_size_type.
61
62 2017-09-14 H.J. Lu <hongjiu.lu@intel.com>
63
64 PR ld/22135
65 * elf32-i386.c (elf_i386_convert_load_reloc): Add an argument
66 to indicate if conversion is performed.
67 (elf_i386_check_relocs): Cache section contents and relocations
68 if conversion is performed.
69 * elf64-x86-64.c (elf_x86_64_check_relocs): Cache section
70 contents and relocations if conversion is performed.
71
72 2017-09-14 Nick Clifton <nickc@redhat.com>
73
74 PR binutils/22113
75 * peXXigen.c (pe_print_idata): Extend check for HintName vector
76 entries.
77
78 2017-09-13 H.J. Lu <hongjiu.lu@intel.com>
79
80 * elfxx-x86.h: Fix a typo in comments.
81
82 2017-09-09 Kamil Rytarowski <n54@gmx.com>
83
84 * elf32-nds32.c: Rename __BIT() to N32_BIT().
85
86 2017-09-09 Alan Modra <amodra@gmail.com>
87
88 * elf64-ppp.c (plt_stub_pad): Handle positive and negative
89 plt_stub_align.
90
91 2017-09-09 H.J. Lu <hongjiu.lu@intel.com>
92
93 * elf32-i386.c (elf_i386_relocate_section): Update usage of
94 UNDEFINED_WEAK_RESOLVED_TO_ZERO.
95 (elf_i386_finish_dynamic_symbol): Likewise.
96 * elf64-x86-64.c (elf_x86_64_relocate_section): Likewise.
97 (elf_x86_64_finish_dynamic_symbol): Likewise.
98 * elfxx-x86.c (elf_x86_allocate_dynrelocs): Likewise.
99 (_bfd_x86_elf_fixup_symbol): Likewise.
100
101 2017-09-09 H.J. Lu <hongjiu.lu@intel.com>
102
103 * elfxx-x86.c (_bfd_x86_elf_link_symbol_references_local): Don't
104 check has_non_got_reloc.
105
106 2017-09-09 H.J. Lu <hongjiu.lu@intel.com>
107
108 PR ld/22115
109 * elf32-i386.c (elf_i386_convert_load_reloc): Check linker_def.
110 Don't use UNDEFINED_WEAK_RESOLVED_TO_ZERO.
111 * elf64-x86-64.c (elf_x86_64_convert_load_reloc): Check
112 linker_def. Don't use UNDEFINED_WEAK_RESOLVED_TO_ZERO.
113 * elfxx-x86.c (_bfd_x86_elf_link_check_relocs): Set local_ref
114 and linker_def on __ehdr_start if it is referenced and not
115 defined.
116 (_bfd_x86_elf_link_symbol_references_local): Also set local_ref
117 and return TRUE when building executable, if a symbol has
118 non-GOT/non-PLT relocations in text section or there is no
119 dynamic linker.
120 * elfxx-x86.h (elf_x86_link_hash_entry): Add linker_def.
121
122 2017-09-08 H.J. Lu <hongjiu.lu@intel.com>
123
124 * elfxx-x86.h: Update comments.
125
126 2017-09-08 H.J. Lu <hongjiu.lu@intel.com>
127
128 * elf32-i386.c (elf_i386_link_setup_gnu_properties): Replace
129 elf_x86_plt_layout_table with elf_x86_init_table.
130 * elf64-x86-64.c (elf_x86_64_link_setup_gnu_properties):
131 Likewise.
132 * elfxx-x86.c (_bfd_x86_elf_link_setup_gnu_properties):
133 Likewise.
134 * elfxx-x86.h (elf_x86_plt_layout_table): Renamed to ...
135 (elf_x86_init_table): This.
136 (_bfd_x86_elf_link_setup_gnu_properties): Replace
137 elf_x86_plt_layout_table with elf_x86_init_table.
138
139 2017-09-07 H.J. Lu <hongjiu.lu@intel.com>
140
141 * configure.ac (bfd_backends): Don't add elf64-x86-64.lo nor
142 elf64.lo together with elfxx-x86.lo for 64-bit BFD.
143 * configure: Regenerated.
144 * elf32-i386.c (elf_i386_link_setup_gnu_properties): Set r_info
145 and r_sym fields of plt_layout.
146 * elf64-x86-64.c (elf_x86_64_link_setup_gnu_properties):
147 Likewise.
148 * elfxx-x86.c (elf_x86_64_is_reloc_section): Remove BFD64 check.
149 (_bfd_x86_elf_link_hash_table_create): Likewise. Don't set
150 r_info nor r_sym fields.
151 (_bfd_x86_elf_link_setup_gnu_properties): Set r_info and r_sym
152 fields of htab.
153 * elfxx-x86.h (elf_x86_plt_layout_table): Add r_info and r_sym.
154
155 2017-09-07 Palmer Dabbelt <palmer@dabbelt.com>
156
157 * (_bfd_riscv_relax_align): Call bfd_set_error and
158 print an error message when unable to relax a .align directive.
159
160 2017-09-07 Palmer Dabbelt <palmer@dabbelt.com>
161
162 * elfnn-riscv.c (riscv_zero_pcrel_hi_reloc): New function.
163 (riscv_record_pcrel_hi_reloc): Add absolute argument.
164 (riscv_elf_relocate_section): Call riscv_zero_pcrel_hi_reloc for
165 R_RISCV_PCREL_HI20 relocs, and pass the result to
166 riscv_record_pcrel_hi_reloc.
167
168 2017-09-07 H.J. Lu <hongjiu.lu@intel.com>
169
170 * elf32-i386.c (elf_i386_convert_load_reloc): Add an argument,
171 r_type_p. Remove the converted argument. Replace
172 SYMBOL_REFERENCES_LOCAL with SYMBOL_REFERENCES_LOCAL_P. Return
173 the new relocation type via r_type_p.
174 (elf_i386_relocate_section): Likewise.
175 (elf_i386_finish_dynamic_symbol): Likewise.
176 (need_convert_load): Removed.
177 (check_relocs_failed): Updated.
178 (elf_i386_check_relocs): Call elf_i386_convert_load_reloc,
179 instead of setting need_convert_load.
180 (_bfd_i386_elf_convert_load): Removed.
181 * elf64-x86-64.c (need_convert_load): Removed.
182 (check_relocs_failed): Updated.
183 (elf_x86_64_convert_load_reloc): Add an argument, r_type_p.
184 Replace SYMBOL_REFERENCES_LOCAL with SYMBOL_REFERENCES_LOCAL_P.
185 Return the new relocation type via r_type_p.
186 (elf_x86_64_check_relocs): Call elf_x86_64_convert_load_reloc,
187 instead of setting need_convert_load.
188 (elf_x86_64_check_relocs): Don't check PIC if relocation has
189 been converted.
190 (_bfd_x86_64_elf_convert_load): Removed.
191 (elf_x86_64_relocate_section): Replace SYMBOL_REFERENCES_LOCAL
192 with SYMBOL_REFERENCES_LOCAL_P.
193 (elf_x86_64_finish_dynamic_symbol): Likewise.
194 * elfxx-x86.c (_bfd_x86_elf_link_hash_table_create): Don't
195 set convert_load.
196 (_bfd_x86_elf_size_dynamic_sections): Don't call convert_load.
197 (_bfd_x86_elf_link_symbol_references_local): New function.
198 * elfxx-x86.h (SYMBOL_REFERENCES_LOCAL_P): New.
199 (UNDEFINED_WEAK_RESOLVED_TO_ZERO): Replace elf.forced_local with
200 SYMBOL_REFERENCES_LOCAL_P.
201 (elf_x86_link_hash_entry): Add local_ref.
202 (elf_x86_link_hash_table): Remove convert_load.
203 (_bfd_i386_elf_convert_load): Removed.
204 (_bfd_x86_64_elf_convert_load): Likewise.
205 (_bfd_x86_elf_link_symbol_references_local): New.
206
207 2017-09-06 H.J. Lu <hongjiu.lu@intel.com>
208
209 * elf64-x86-64.c (R_X86_64_converted_reloc_bit): New.
210 (elf_x86_64_info_to_howto): Get the real relocation type by
211 masking out R_X86_64_converted_reloc_bit.
212 (elf_x86_64_check_tls_transition): Get the real relocation type
213 by masking out R_X86_64_converted_reloc_bit.
214 (elf_x86_64_convert_load_reloc): Set R_X86_64_converted_reloc_bit
215 instead of setting converted_reloc.
216 (elf_x86_64_relocate_section): Check R_X86_64_converted_reloc_bit
217 instead of converted_reloc. Get the real relocation type by
218 masking out R_X86_64_converted_reloc_bit.
219 (elf_x86_64_link_setup_gnu_properties): Verify that the value of
220 R_X86_64_converted_reloc_bit is valid.
221 * elfxx-x86.h (converted_reloc): Removed.
222
223 2017-09-06 H.J. Lu <hongjiu.lu@intel.com>
224
225 * elf32-i386.c (elf_i386_relocate_section): Don't change r_type
226 when calling elf_i386_tls_transition. Don't use ELF32_R_TYPE
227 to get the relocation type again.
228 * elf64-x86-64.c (elf_x86_64_relocate_section): Don't change
229 r_type when calling elf_x86_64_tls_transition. Don't use
230 ELF32_R_TYPE to get the relocation type again.
231
232 2017-09-05 H.J. Lu <hongjiu.lu@intel.com>
233
234 * elf64-x86-64.c (elf_x86_64_convert_load_reloc): Properly set
235 converted_reloc.
236
237 2017-09-05 H.J. Lu <hongjiu.lu@intel.com>
238
239 * elf64-x86-64.c (elf_x86_64_convert_load_reloc): Remove the sec
240 argument. Don't check relocation overflow. Avoid relocation
241 overflow if --no-relax is used. Set converted_reloc on symbol
242 if a GOTPCREL relocation is converted.
243 (elf_x86_64_relocate_section): Issue a fatal error and suggest
244 --no-relax if GOTPCREL relocation conversion leads to relocation
245 overflow.
246 * elfxx-x86.h (elf_x86_link_hash_entry): Add converted_reloc.
247
248 2017-09-05 Alexander Fedotov <alexander.fedotov@nxp.com>
249 Edmar Wienskoski <edmar.wienskoski@nxp.com
250
251 * elf32-ppc.c (ppc_elf_howto_raw): Add R_PPC_VLE_ADDR20.
252 (ppc_elf_check_relocs): Handle it.
253 (ppc_elf_vle_split20): New function.
254 (ppc_elf_relocate_section): Handle R_PPC_VLE_ADDR20.
255
256 2017-09-03 H.J. Lu <hongjiu.lu@intel.com>
257
258 PR ld/22071
259 * elfxx-x86.c (elf_x86_allocate_dynrelocs): Set tlsdesc_plt
260 for x86-64 if GOT_TLS_GDESC_P is true.
261
262 2017-09-03 Alan Modra <amodra@gmail.com>
263
264 PR 22067
265 * elfxx-x86.h (elf_x86_hash_table): Check is_elf_hash_table first.
266
267 2017-09-02 H.J. Lu <hongjiu.lu@intel.com>
268
269 * elfxx-x86.c (_bfd_x86_elf_link_hash_table_create): Initialize
270 tls_get_addr for x86-64 in one place.
271
272 2017-09-02 H.J. Lu <hongjiu.lu@intel.com>
273
274 * configure.ac (bfd_backends): Add elf64-x86-64.lo together
275 with elfxx-x86.lo for 64-bit BFD.
276 * configure: Regenerated.
277
278 2017-09-02 H.J. Lu <hongjiu.lu@intel.com>
279
280 * elf32-i386.c (elf_i386_convert_load): Renamed to ...
281 (_bfd_i386_elf_convert_load): This. Remove static.
282 (elf_i386_size_dynamic_sections): Removed.
283 (elf_backend_size_dynamic_sections): Likewise.
284 * elf64-x86-64.c (elf_x86_64_convert_load): Renamed to ...
285 (_bfd_x86_64_elf_convert_load): This. Remove static.
286 (elf_x86_64_size_dynamic_sections): Removed.
287 (elf_backend_size_dynamic_sections): Likewise.
288 * elfxx-x86.c (_bfd_x86_elf_allocate_dynrelocs): Renamed to ...
289 (elf_x86_allocate_dynrelocs): This. Make it static.
290 (_bfd_x86_elf_allocate_local_dynrelocs): Renamed to ...
291 (elf_x86_allocate_local_dynreloc): This. Make it static.
292 (elf_i386_is_reloc_section): New function.
293 (elf_x86_64_is_reloc_section): Likewise.
294 (_bfd_x86_elf_link_hash_table_create): Initialize convert_load,
295 is_reloc_section, dt_reloc, dt_reloc_sz and dt_reloc_ent.
296 Rearrange got_entry_size initialization.
297 (_bfd_x86_elf_size_dynamic_sections): New function.
298 * elfxx-x86.h (elf_x86_link_hash_table): Add convert_load,
299 is_reloc_section, dt_reloc, dt_reloc_sz and dt_reloc_ent.
300 (_bfd_i386_elf_convert_load): New.
301 (_bfd_x86_64_elf_convert_load): Likewise.
302 (_bfd_x86_elf_size_dynamic_sections): Likewise.
303 (elf_backend_size_dynamic_sections): Likewise.
304 (_bfd_x86_elf_allocate_dynrelocs): Removed.
305 (_bfd_x86_elf_allocate_local_dynrelocs): Likewise.
306
307 2017-09-02 H.J. Lu <hongjiu.lu@intel.com>
308
309 * elfxx-x86.h (elf_x86_link_hash_table): Rearrange fields and
310 update comments.
311
312 2017-09-02 H.J. Lu <hongjiu.lu@intel.com>
313
314 * elf32-i386.c (elf_i386_size_dynamic_sections): Set
315 sgotplt_jump_table_size with elf_x86_compute_jump_table_size.
316
317 2017-09-02 H.J. Lu <hongjiu.lu@intel.com>
318
319 * elf32-i386.c (PLT_CIE_LENGTH, PLT_FDE_LENGTH,
320 PLT_FDE_START_OFFSET, PLT_FDE_LEN_OFFSET): Moved to ...
321 * elfxx-x86.h (PLT_CIE_LENGTH, PLT_FDE_LENGTH,
322 PLT_FDE_START_OFFSET, PLT_FDE_LEN_OFFSET): Here.
323 * elf64-x86-64.c (PLT_CIE_LENGTH, PLT_FDE_LENGTH,
324 PLT_FDE_START_OFFSET, PLT_FDE_LEN_OFFSET): Removed.
325
326 2017-09-02 H.J. Lu <hongjiu.lu@intel.com>
327
328 * elf32-i386.c (elf_i386_allocate_dynrelocs): Removed.
329 (elf_i386_allocate_local_dynrelocs): Likewise.
330 (elf_i386_size_dynamic_sections): Replace
331 elf_i386_allocate_dynrelocs/elf_i386_allocate_local_dynrelocs
332 with _bfd_x86_elf_allocate_dynrelocs and
333 _bfd_x86_elf_allocate_local_dynrelocs.
334 * elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): Removed.
335 (elf_x86_64_allocate_local_dynrelocs): Likewise.
336 (elf_x86_64_size_dynamic_sections): Replace
337 elf_x86_64_allocate_dynrelocs/elf_x86_64_allocate_local_dynrelocs
338 with _bfd_x86_elf_allocate_dynrelocs and
339 _bfd_x86_elf_allocate_local_dynrelocs.
340 * elfxx-x86.c (_bfd_x86_elf_allocate_dynrelocs): New function.
341 (_bfd_x86_elf_allocate_local_dynrelocs): Likewise.
342 * elfxx-x86.h (_bfd_x86_elf_allocate_dynrelocs): New prototype.
343 (_bfd_x86_elf_allocate_local_dynrelocs): Likewise.
344
345 2017-09-02 H.J. Lu <hongjiu.lu@intel.com>
346
347 * elf32-i386.c (is_i386_elf): Removed.
348 (elf_i386_check_relocs): Replace is_i386_elf with is_x86_elf.
349 (elf_i386_size_dynamic_sections): Likewise.
350 (elf_i386_relocate_section): Likewise.
351 * elf64-x86-64.c (is_x86_64_elf): Removed.
352 (elf_x86_64_check_relocs): Replace is_x86_64_elf with
353 is_x86_elf.
354 (elf_x86_64_size_dynamic_sections): Likewise.
355 (elf_x86_64_relocate_section): Likewise.
356 * elfxx-x86.c (_bfd_x86_elf_link_hash_table_create): Initialize
357 target_id.
358 * elfxx-x86.h (elf_x86_link_hash_table): Add target_id.
359 (is_x86_elf): New.
360
361 2017-09-02 H.J. Lu <hongjiu.lu@intel.com>
362
363 * elf32-i386.c (elf_i386_compute_jump_table_size): Removed.
364 (elf_i386_allocate_dynrelocs): Replace
365 elf_i386_compute_jump_table_size with
366 elf_x86_compute_jump_table_size.
367 (elf_i386_size_dynamic_sections): Likewise.
368 * elf64-x86-64.c (elf_x86_64_compute_jump_table_size): Removed.
369 (elf_x86_64_allocate_dynrelocs): Replace
370 elf_x86_64_compute_jump_table_size with
371 elf_x86_compute_jump_table_size.
372 (elf_x86_64_size_dynamic_sections): Likewise.
373 * elfxx-x86.c (_bfd_x86_elf_link_hash_table_create): Initialize
374 got_entry_size.
375 * elfxx-x86.h (elf_x86_link_hash_table): Add got_entry_size.
376 (elf_x86_compute_jump_table_size): New.
377
378 2017-09-02 H.J. Lu <hongjiu.lu@intel.com>
379
380 * elfxx-x86.c (_bfd_x86_elf_link_hash_table_create): Initialize
381 sizeof_reloc.
382 (_bfd_x86_elf_adjust_dynamic_symbol): Use sizeof_reloc.
383 * elfxx-x86.h (elf_x86_link_hash_table): Add sizeof_reloc.
384
385 2017-09-02 H.J. Lu <hongjiu.lu@intel.com>
386
387 * elf32-i386.c (elf_i386_allocate_dynrelocs): Check VxWorks
388 with htab->is_vxworks.
389 (elf_i386_size_dynamic_sections): Likewise.
390 (elf_i386_relocate_section): Likewise.
391 (elf_i386_finish_dynamic_symbol): Likewise.
392 (elf_i386_finish_dynamic_sections): Likewise.
393
394 2017-09-02 H.J. Lu <hongjiu.lu@intel.com>
395
396 * elf32-i386.c (GOT_TLS_IE, GOT_TLS_IE_POS, GOT_TLS_IE_NEG,
397 GOT_TLS_IE_BOTH, GOT_TLS_GDESC, GOT_TLS_GD_BOTH_P,
398 GOT_TLS_GD_P, GOT_TLS_GDESC_P, GOT_TLS_GD_ANY_P): Moved to ...
399 * elfxx-x86.h (GOT_TLS_IE, GOT_TLS_IE_POS, GOT_TLS_IE_NEG,
400 GOT_TLS_IE_BOTH, GOT_TLS_GDESC, GOT_TLS_GD_BOTH_P,
401 GOT_TLS_GD_P, GOT_TLS_GDESC_P, GOT_TLS_GD_ANY_P): Here.
402 * elf64-x86-64.c (GOT_TLS_IE, GOT_TLS_GDESC, GOT_TLS_GD_BOTH_P,
403 GOT_TLS_GD_P, GOT_TLS_GDESC_P, GOT_TLS_GD_ANY_P): Removed.
404
405 2017-09-01 H.J. Lu <hongjiu.lu@intel.com>
406
407 PR ld/22064
408 * elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Check
409 ELF_COMMON_DEF_P for common symbols.
410
411 2017-09-02 Alan Modra <amodra@gmail.com>
412
413 * elf-eh-frame.c (offset_adjust): Avoid false positive gcc warning.
414 * elflink.c (bfd_elf_size_dynsym_hash_dynstr): Likewise.
415 * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Likewise.
416
417 2017-09-01 H.J. Lu <hongjiu.lu@intel.com>
418
419 * elf32-i386.c (elf_i386_gc_mark_hook): Removed.
420 (elf_backend_gc_mark_hook): Likewise.
421 * elf64-x86-64.c (elf_x86_64_gc_mark_hook): Likewise.
422 (elf_backend_gc_mark_hook): Likewise.
423 * elfxx-x86.c (_bfd_x86_elf_gc_mark_hook): New function.
424 * elfxx-x86.h (_bfd_x86_elf_gc_mark_hook): New.
425 (elf_backend_gc_mark_hook): Likewise.
426
427 2017-09-01 H.J. Lu <hongjiu.lu@intel.com>
428
429 * elf32-i386.c (elf_i386_adjust_dynamic_symbol): Removed.
430 (elf_backend_adjust_dynamic_symbol): Likewise.
431 * elf64-x86-64.c (elf_x86_64_adjust_dynamic_symbol): Likewise.
432 (elf_backend_adjust_dynamic_symbol): Likewise.
433 * elfxx-x86.c (_bfd_x86_elf_adjust_dynamic_symbol): New function.
434 (_bfd_x86_elf_link_setup_gnu_properties): Copy is_vxworks.
435 * elfxx-x86.h (elf_x86_link_hash_table): Add is_vxworks.
436 (_bfd_x86_elf_adjust_dynamic_symbol): New.
437 (elf_backend_adjust_dynamic_symbol): Likewise.
438
439 2017-09-01 H.J. Lu <hongjiu.lu@intel.com>
440
441 * elfxx-x86.h (elf_x86_plt_layout_table): Fix a typo in
442 comments.
443
444 2017-09-01 H.J. Lu <hongjiu.lu@intel.com>
445
446 * elf32-i386.c (elf_i386_mkobject): Removed.
447 (bfd_elf32_mkobject): Likewise.
448 * elf64-x86-64.c (elf_x86_64_mkobject): Likewise.
449 (bfd_elf64_mkobject): Likewise.
450 (bfd_elf32_mkobject): Likewise.
451 * elfxx-x86.c (_bfd_x86_elf_mkobject): New function.
452 * elfxx-x86.h (_bfd_x86_elf_mkobject): New.
453 (bfd_elf64_mkobject): Likewise.
454 (bfd_elf32_mkobject): Likewise.
455
456 2017-09-01 H.J. Lu <hongjiu.lu@intel.com>
457
458 * elf32-i386.c (elf_i386_link_setup_gnu_properties): Updated.
459 Call _bfd_x86_elf_link_setup_gnu_properties.
460 * elf64-x86-64.c (elf_x86_lazy_plt_layout): Initialize
461 pic_plt0_entry and pic_plt_entry fields with the non-PIC PLT
462 entries.
463 (elf_x86_64_non_lazy_plt): Likewise.
464 (elf_x86_64_lazy_bnd_plt): Likewise.
465 (elf_x86_64_non_lazy_bnd_plt): Likewise.
466 (elf_x86_64_lazy_ibt_plt): Likewise.
467 (elf_x32_lazy_ibt_plt): Likewise.
468 (elf_x86_64_non_lazy_ibt_plt): Likewise.
469 (elf_x32_non_lazy_ibt_plt): Likewise.
470 (elf_x86_64_nacl_plt): Likewise.
471 (elf_x86_64_link_setup_gnu_properties): Updated. Call
472 _bfd_x86_elf_link_setup_gnu_properties.
473 * elfxx-x86.c: Include elf-vxworks.h".
474 (_bfd_x86_elf_link_setup_gnu_properties): New function.
475 * elfxx-x86.h (elf_x86_lazy_plt_layout): Remove "for i386 only"
476 comments for pic_plt0_entry and pic_plt_entry.
477 (elf_x86_non_lazy_plt_layout): Likewise.
478 (elf_x86_plt_layout_table): New.
479 (_bfd_x86_elf_link_setup_gnu_properties): Likewise.
480
481 2017-09-01 H.J. Lu <hongjiu.lu@intel.com>
482
483 PR ld/22061
484 * elf32-i386.c (elf_i386_link_setup_gnu_properties): Create
485 .eh_frame section for the second PLT.
486 * elf64-x86-64.c (elf_x86_64_link_setup_gnu_properties): Correct
487 alignment of .eh_frame section for the second PLT.
488
489 2017-09-01 Nick Clifton <nickc@redhat.com>
490
491 PR 22059
492 * dwarf2.c (decode_line_info): Fix test for an overlong line info
493 structure.
494
495 2017-09-01 Nick Clifton <nickc@redhat.com>
496
497 PR 22058
498 * elf-attrs.c (_bfd_elf_parse_attributes): Ensure that the
499 attribute buffer is NUL terminated.
500
501 2017-08-31 Nick Clifton <nickc@redhat.com>
502
503 PR 22047
504 * dwarf2.c (read_section): If necessary add a terminating NUL byte
505 to dwarf string sections.
506
507 2017-08-31 Alan Modra <amodra@gmail.com>
508
509 * po/SRC-POTFILES.in: Regenerate.
510
511 2017-08-31 Alan Modra <amodra@gmail.com>
512
513 * elf-eh-frame.c (_bfd_elf_parse_eh_frame): Don't exit early
514 for a section containing just a terminator. Allow multiple
515 terminators at end of section.
516 * elflink.c (bfd_elf_discard_info): Iterate over .eh_frame
517 sections when not adding alignment. Assert on terminator in
518 the middle of FDEs.
519
520 2017-08-31 Alan Modra <amodra@gmail.com>
521
522 PR 21441
523 PR 22048
524 * elflink.c (bfd_elf_discard_info): Don't pad embedded zero
525 terminators.
526
527 2017-08-30 H.J. Lu <hongjiu.lu@intel.com>
528
529 * configure.ac (bfd_backends): Add elf64.lo together with
530 elfxx-x86.lo for 64-bit BFD.
531 * configure: Regenerated.
532
533 2017-08-31 James Bowman <james.bowman@ftdichip.com>
534
535 * elf32-ft32.c (ft32_elf_howto_table): Use complain_overflow_dont
536 for R_FT32_18.
537
538 2017-08-31 Alan Modra <amodra@gmail.com>
539
540 PR binutils/22032
541 * opncls.c (bfd_close_all_done): Don't call bfd_cache_close
542 before _close_and_cleanup. Call iovec->bclose after.
543 (bfd_close): Remove code common to, and call, bfd_close_all_done.
544
545 2017-08-30 H.J. Lu <hongjiu.lu@intel.com>
546
547 * elf32-i386.c (elf_i386_plt_type): Removed.
548 (elf_i386_plt): Likewise.
549 (elf_i386_get_synthetic_symtab): Updated. Call
550 _bfd_x86_elf_get_synthetic_symtab.
551 * elf64-x86-64.c (elf_x86_64_plt_type): Removed.
552 (elf_x86_64_plt): Likewise.
553 (elf_x86_64_get_synthetic_symtab): Updated. Call
554 _bfd_x86_elf_get_synthetic_symtab.
555 * elfxx-x86.c (elf_i386_get_plt_got_vma): New function.
556 (elf_x86_64_get_plt_got_vma): Likewise.
557 (elf_i386_valid_plt_reloc_p): Likewise.
558 (elf_x86_64_valid_plt_reloc_p): Likewise.
559 (_bfd_x86_elf_get_synthetic_symtab): Likewise.
560 * elfxx-x86.h (elf_x86_plt_type): New.
561 (elf_x86_plt): Likewise.
562 (_bfd_x86_elf_get_synthetic_symtab): Likewise.
563
564 2017-08-30 H.J. Lu <hongjiu.lu@intel.com>
565
566 * elfxx-x86.c (_bfd_x86_elf_link_hash_table_create): Check
567 target_id instead of elf_machine_code.
568
569 2017-08-30 H.J. Lu <hongjiu.lu@intel.com>
570
571 * elf32-i386.c (ELF_DYNAMIC_INTERPRETER): Removed.
572 (elf_i386_lazy_plt_layout): Likewise.
573 (elf_i386_non_lazy_plt_layout): Likewise.
574 (elf_i386_plt_layout): Likewise.
575 (elf_i386_link_hash_table): Likewise.
576 (elf_i386_next_tls_desc_index): Likewise.
577 (elf_i386_srelplt2): Likewise.
578 (elf_i386_plt): Likewise.
579 (elf_i386_lazy_plt): Likewise.
580 (elf_i386_non_lazy_plt): Likewise.
581 (elf_i386_link_hash_table_create): Likewise.
582 (bfd_elf32_bfd_link_hash_table_create): Likewise.
583 (elf_i386_lazy_plt): Updated.
584 (elf_i386_non_lazy_plt): Likewise.
585 (elf_i386_lazy_ibt_plt): Likewise.
586 (elf_i386_non_lazy_ibt_plt): Likewise.
587 (elf_i386_allocate_dynrelocs): Likewise.
588 (elf_i386_size_dynamic_sections): Likewise.
589 (elf_i386_relocate_section): Likewise.
590 (elf_i386_finish_dynamic_symbol): Likewise.
591 (elf_i386_finish_dynamic_sections): Likewise.
592 (elf_i386_get_synthetic_symtab): Likewise.
593 (elf_i386_link_setup_gnu_properties): Likewise.
594 (elf_i386_nacl_plt): Likewise.
595 * elf64-x86-64.c (ABI_64_P): Removed.
596 (ELF64_DYNAMIC_INTERPRETER): Likewise.
597 (ELF32_DYNAMIC_INTERPRETER): Likewise.
598 (elf_x86_64_lazy_plt_layout): Likewise.
599 (elf_x86_64_non_lazy_plt_layout): Likewise.
600 (elf_x86_64_plt_layout): Likewise.
601 (elf_x86_64_link_hash_table): Likewise.
602 (elf_x86_64_plt): Likewise.
603 (elf_x86_64_lazy_plt): Likewise.
604 (elf_x86_64_non_lazy_plt): Likewise.
605 (elf_x86_64_link_hash_table_create): Likewise.
606 (bfd_elf64_bfd_link_hash_table_create): Likewise.
607 (bfd_elf32_bfd_link_hash_table_create): Likewise.
608 (elf_x86_64_lazy_plt): Updated.
609 (elf_x86_64_non_lazy_plt): Likewise.
610 (elf_x86_64_lazy_bnd_plt): Likewise.
611 (elf_x86_64_non_lazy_bnd_plt): Likewise.
612 (elf_x86_64_lazy_ibt_plt): Likewise.
613 (elf_x32_lazy_ibt_plt): Likewise.
614 (elf_x86_64_non_lazy_ibt_plt): Likewise.
615 (elf_x32_non_lazy_ibt_plt): Likewise.
616 (elf_x86_64_allocate_dynrelocs): Likewise.
617 (elf_x86_64_size_dynamic_sections): Likewise.
618 (elf_x86_64_relocate_section): Likewise.
619 (elf_x86_64_finish_dynamic_symbol): Likewise.
620 (elf_x86_64_finish_dynamic_sections): Likewise.
621 (elf_x86_64_get_synthetic_symtab): Likewise.
622 (elf_x86_64_link_setup_gnu_properties): Likewise.
623 (elf_x86_64_nacl_plt): Likewise.
624 * elfxx-x86.c: Include "objalloc.h", "elf/i386.h" and
625 "elf/x86-64.h".
626 (ELF32_DYNAMIC_INTERPRETER): New.
627 (ELF64_DYNAMIC_INTERPRETER): Likewise.
628 (ELFX32_DYNAMIC_INTERPRETER): Likewise.
629 (_bfd_x86_elf_link_hash_table_create): Likewise.
630 (_bfd_x86_elf_link_hash_table_free): Renamed to ...
631 (elf_x86_link_hash_table_free): This. Make it static.
632 * elfxx-x86.h: Don't include "objalloc.h".
633 (ABI_64_P): New.
634 (elf_x86_lazy_plt_layout): Likewise.
635 (elf_x86_non_lazy_plt_layout): Likewise.
636 (elf_x86_plt_layout): Likewise.
637 (_bfd_x86_elf_link_hash_table_create): Likewise.
638 (bfd_elf64_bfd_link_hash_table_create): Likewise.
639 (bfd_elf32_bfd_link_hash_table_create): Likewise.
640 (elf_x86_link_hash_table): Add plt, lazy_plt, non_lazy_plt,
641 srelplt2 and next_tls_desc_index.
642 (_bfd_x86_elf_link_hash_table_free): Removed.
643
644 2017-08-30 Maciej W. Rozycki <macro@imgtec.com>
645
646 * elfxx-mips.c (mips_elf_perform_relocation): Correct microMIPS
647 branch offset interpretation.
648
649 2017-08-30 H.J. Lu <hongjiu.lu@intel.com>
650
651 PR binutils/22032
652 * opncls.c (bfd_close_all_done): Call _close_and_cleanup.
653
654 2017-08-30 H.J. Lu <hongjiu.lu@intel.com>
655
656 * elf64-x86-64.c (elf_x86_64_next_tls_desc_index): Removed.
657 (elf_x86_64_srelplt2): Likewise.
658
659 2017-08-30 Alan Modra <amodra@gmail.com>
660
661 * elf64-ppc.c (struct ppc_link_hash_table): Add do_tls_opt.
662 (ppc64_elf_tls_optimize): Set it.
663 (ppc64_elf_relocate_section): Nop addis on TPREL16_HA, and convert
664 insn on TPREL16_LO and TPREL16_LO_DS relocs to use r13 when
665 addis would add zero.
666 * elf32-ppc.c (struct ppc_elf_link_hash_table): Add do_tls_opt.
667 (ppc_elf_tls_optimize): Set it.
668 (ppc_elf_relocate_section): Nop addis on TPREL16_HA, and convert
669 insn on TPREL16_LO relocs to use r2 when addis would add zero.
670
671 2017-08-30 Alan Modra <amodra@gmail.com>
672
673 * elf64-ppc.c (ppc64_elf_relocate_section): When optimizing
674 __tls_get_addr call sequences to LE, don't move the addi down
675 to the nop. Replace the bl with addi and leave the nop alone.
676
677 2017-08-29 H.J. Lu <hongjiu.lu@intel.com>
678
679 * elf32-i386.c (elf_i386_pie_finish_undefweak_symbol):
680 Re-indent.
681 * elf64-x86-64.c (elf_x86_64_finish_local_dynamic_symbol):
682 Likewise.
683 (elf_x86_64_pie_finish_undefweak_symbol): Likewise.
684
685 2017-08-29 H.J. Lu <hongjiu.lu@intel.com>
686
687 * Makefile.am (BFD32_BACKENDS): Add elfxx-x86.lo.
688 (BFD64_BACKENDS): Likewise.
689 (BFD32_BACKENDS_CFILES): Add elfxx-x86.c.
690 (BFD64_BACKENDS_CFILES): Likewise.
691 * Makefile.in: Regenerated.
692 * configure.ac (bfd_backends): Add elfxx-x86.lo together with
693 elf32-i386.lo and elf64-x86-64.lo.
694 * configure: Regenerated.
695 * elf32-i386.c: Include "elfxx-x86.h" instead of "sysdep.h",
696 "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h",
697 "objalloc.h" and "hashtab.h".
698 (ELIMINATE_COPY_RELOCS): Removed.
699 (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise.
700 (SYMBOL_NO_COPYRELOC): Likewise.
701 (elf_i386_link_hash_entry): Likewise.
702 (GOT_UNKNOWN): Likewise.
703 (GOT_NORMAL): Likewise.
704 (GOT_TLS_GD): Likewise.
705 (elf_i386_hash_entry): Likewise.
706 (elf_i386_obj_tdata): Likewise.
707 (elf_i386_tdata): Likewise.
708 (elf_i386_local_got_tls_type): Likewise.
709 (elf_i386_local_tlsdesc_gotent): Likewise.
710 (elf_i386_hash_table): Likewise.
711 (elf_i386_link_hash_newfunc): Likewise.
712 (elf_i386_local_htab_hash): Likewise.
713 (elf_i386_local_htab_eq): Likewise.
714 (elf_i386_get_local_sym_hash): Likewise.
715 (elf_i386_link_hash_table_free): Likewise.
716 (elf_i386_copy_indirect_symbol): Likewise.
717 (elf_i386_fixup_symbol): Likewise.
718 (elf_i386_readonly_dynrelocs): Likewise.
719 (elf_i386_always_size_sections): Likewise.
720 (elf_i386_set_tls_module_base): Likewise.
721 (elf_i386_dtpoff_base): Likewise.
722 (compare_relocs): Likewise.
723 (elf_i386_hash_symbol): Likewise.
724 (elf_i386_parse_gnu_properties): Likewise.
725 (elf_i386_merge_gnu_properties): Likewise.
726 (elf_i386_link_check_relocs): Likewise.
727 (elf_i386_merge_symbol_attribute): Likewise.
728 (bfd_elf32_bfd_link_check_relocs): Likewise.
729 (elf_backend_copy_indirect_symbol): Likewise.
730 (elf_backend_always_size_sections): Likewise.
731 (elf_backend_omit_section_dynsym): Likewise.
732 (elf_backend_hash_symbol): Likewise.
733 (elf_backend_fixup_symbol): Likewise.
734 (elf_backend_parse_gnu_properties): Likewise.
735 (elf_backend_merge_gnu_properties): Likewise.
736 (elf_backend_merge_symbol_attribute): Likewise.
737 (elf_i386_mkobject): Updated.
738 (elf_i386_link_hash_table_create): Likewise.
739 (elf_i386_check_tls_transition): Likewise.
740 (elf_i386_tls_transition): Likewise.
741 (elf_i386_convert_load_reloc): Likewise.
742 (elf_i386_check_relocs): Likewise.
743 (elf_i386_adjust_dynamic_symbol): Likewise.
744 (elf_i386_allocate_dynrelocs): Likewise.
745 (elf_i386_convert_load): Likewise.
746 (elf_i386_size_dynamic_sections): Likewise.
747 (elf_i386_relocate_section): Likewise.
748 (elf_i386_finish_dynamic_symbol ): Likewise.
749 (elf_i386_finish_dynamic_sections): Likewise.
750 (elf_i386_output_arch_local_syms): Likewise.
751 (elf_i386_get_synthetic_symtab): Likewise.
752 (elf_i386_link_setup_gnu_properties): Likewise.
753 (elf_i386_link_hash_table): Use elf_x86_link_hash_table, instead
754 of elf_link_hash_table, as base.
755 (elf_i386_next_tls_desc_index): New.
756 (elf_i386_srelplt2): Likewise.
757 (elf_i386_plt): Likewise.
758 (elf_i386_lazy_plt): Likewise.
759 (elf_i386_non_lazy_plt): Likewise.
760 * elf32-x86-64.c: Include "elfxx-x86.h" instead of "sysdep.h",
761 "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h",
762 "objalloc.h" and "hashtab.h".
763 (ELIMINATE_COPY_RELOCS): Removed.
764 (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise.
765 (SYMBOL_NO_COPYRELOC): Likewise.
766 (elf_x86_64_link_hash_entry): Likewise.
767 (GOT_UNKNOWN): Likewise.
768 (GOT_NORMAL): Likewise.
769 (GOT_TLS_GD): Likewise.
770 (elf_x86_64_hash_entry): Likewise.
771 (elf_x86_64_obj_tdata): Likewise.
772 (elf_x86_64_tdata): Likewise.
773 (elf_x86_64_local_got_tls_type): Likewise.
774 (elf_x86_64_local_tlsdesc_gotent): Likewise.
775 (elf_x86_64_hash_table): Likewise.
776 (elf_x86_64_link_hash_newfunc): Likewise.
777 (elf_x86_64_local_htab_hash): Likewise.
778 (elf_x86_64_local_htab_eq): Likewise.
779 (elf_x86_64_get_local_sym_hash): Likewise.
780 (elf_x86_64_link_hash_table_free): Likewise.
781 (elf_x86_64_copy_indirect_symbol): Likewise.
782 (elf_x86_64_fixup_symbol): Likewise.
783 (elf_x86_64_readonly_dynrelocs): Likewise.
784 (elf_x86_64_always_size_sections): Likewise.
785 (elf_x86_64_set_tls_module_base): Likewise.
786 (elf_x86_64_dtpoff_base): Likewise.
787 (compare_relocs): Likewise.
788 (elf_x86_64_merge_symbol_attribute): Likewise.
789 (elf_x86_64_hash_symbol): Likewise.
790 (elf_x86_64_parse_gnu_properties): Likewise.
791 (elf_x86_64_merge_gnu_properties): Likewise.
792 (elf_x86_64_link_check_relocs): Likewise.
793 (elf_backend_copy_indirect_symbol): Likewise.
794 (elf_backend_always_size_sections): Likewise.
795 (bfd_elf64_bfd_link_check_relocs): Likewise.
796 (elf_backend_merge_symbol_attribute): Likewise.
797 (elf_backend_hash_symbol): Likewise.
798 (elf_backend_omit_section_dynsym): Likewise.
799 (elf_backend_fixup_symbol): Likewise.
800 (elf_backend_parse_gnu_properties): Likewise.
801 (elf_backend_merge_gnu_properties): Likewise.
802 (bfd_elf32_bfd_link_check_relocs): Likewise.
803 (elf_x86_64_mkobject): Updated.
804 (elf_x86_64_link_hash_table_create): Likewise.
805 (elf_x86_64_check_tls_transition): Likewise.
806 (elf_x86_64_tls_transition): Likewise.
807 (elf_x86_64_convert_load_reloc): Likewise.
808 (elf_x86_64_check_relocs): Likewise.
809 (elf_x86_64_adjust_dynamic_symbol): Likewise.
810 (elf_x86_64_allocate_dynrelocs): Likewise.
811 (elf_x86_64_convert_load): Likewise.
812 (elf_x86_64_size_dynamic_sections): Likewise.
813 (elf_x86_64_relocate_section): Likewise.
814 (elf_x86_64_finish_dynamic_symbol ): Likewise.
815 (elf_x86_64_finish_dynamic_sections): Likewise.
816 (elf_x86_64_output_arch_local_syms): Likewise.
817 (elf_x86_64_get_synthetic_symtab): Likewise.
818 (elf_x86_64_link_setup_gnu_properties): Likewise.
819 (elf_x86_64_link_hash_table): Use elf_x86_link_hash_table,
820 instead of elf_link_hash_table, as base.
821 (elf_x86_64_next_tls_desc_index): New.
822 (elf_x86_64_srelplt2): Likewise.
823 (elf_x86_64_plt): Likewise.
824 (elf_x86_64_lazy_plt): Likewise.
825 (elf_x86_64_non_lazy_plt): Likewise.
826 * elfxx-x86.c: New file.
827 * elfxx-x86.h: Likewise.
828
829 2017-08-29 H.J. Lu <hongjiu.lu@intel.com>
830
831 * elf32-i386.c (elf_i386_get_synthetic_symtab): Simplify bad
832 return.
833 * elf64-x86-64.c (elf_x86_64_get_synthetic_symtab): Likewise.
834
835 2017-08-29 H.J. Lu <hongjiu.lu@intel.com>
836
837 * elf32-i386.c (elf_i386_get_synthetic_symtab): Check valid PLT
838 sections before checking dynamic relocations and free invalid
839 PLT section contents.
840 * elf64-x86-64.c (elf_x86_64_get_synthetic_symtab): Likewise.
841
842 2017-08-28 H.J. Lu <hongjiu.lu@intel.com>
843
844 * elf-bfd.h (_bfd_elf_ifunc_get_synthetic_symtab): Removed.
845 * elf-ifunc.c (_bfd_elf_ifunc_get_synthetic_symtab): Likewise.
846
847 2017-08-28 H.J. Lu <hongjiu.lu@intel.com>
848
849 PR binutils/22018
850 * elf32-i386.c (elf_i386_get_synthetic_symtab): Check for valid
851 PLT section size.
852 * elf64-x86-64.c (elf_x86_64_get_synthetic_symtab): Likewise.
853
854 2017-08-27 H.J. Lu <hongjiu.lu@intel.com>
855
856 * elf32-i386.c (elf_i386_link_hash_newfunc): Initialize
857 def_protected.
858 * elf64-x86-64.c (elf_x86_64_link_hash_newfunc): Likewise.
859
860 2017-08-26 H.J. Lu <hongjiu.lu@intel.com>
861
862 PR ld/21997
863 * elf-bfd.h (elf_obj_tdata): Use ENUM_BITFIELD on object_id,
864 dyn_lib_class and has_gnu_symbols. Change bad_symtab to bitfield.
865 Add a has_no_copy_on_protected bitfield.
866 (elf_has_no_copy_on_protected): New.
867 * elf-properties.c (_bfd_elf_parse_gnu_properties): Set
868 elf_has_no_copy_on_protected for GNU_PROPERTY_NO_COPY_ON_PROTECTED.
869 (elf_merge_gnu_property_list): Likewise.
870 (_bfd_elf_link_setup_gnu_properties): Set extern_protected_data
871 to FALSE for elf_has_no_copy_on_protected.
872 * elf32-i386.c (SYMBOL_NO_COPYRELOC): New.
873 (elf_i386_link_hash_entry): Add def_protected.
874 (elf_i386_adjust_dynamic_symbol): Also check SYMBOL_NO_COPYRELOC
875 when checking info->nocopyreloc.
876 (elf_i386_link_setup_gnu_properties): Don't set
877 extern_protected_data here.
878 (elf_i386_merge_symbol_attribute): New function.
879 (elf_backend_merge_symbol_attribute): New.
880 * elf64-x86-64.c (SYMBOL_NO_COPYRELOC): New.
881 (elf_x86_64_link_hash_entry): Add def_protected.
882 (elf_x86_64_need_pic): Report protected symbol for def_protected.
883 (elf_x86_64_adjust_dynamic_symbol): Also check SYMBOL_NO_COPYRELOC
884 when checking info->nocopyreloc.
885 (elf_x86_64_relocate_section): Also check for R_X86_64_PC32
886 relocation run-time overflow and unresolvable R_X86_64_32S
887 relocation against protected data symbol defined in shared object
888 with GNU_PROPERTY_NO_COPY_ON_PROTECTED.
889 (elf_x86_64_link_setup_gnu_properties): Don't set
890 extern_protected_data here.
891 (elf_x86_64_merge_symbol_attribute): New function.
892 (elf_backend_merge_symbol_attribute): New.
893
894 2017-08-26 Alan Modra <amodra@gmail.com>
895
896 * elf32-ppc.c (must_be_dyn_reloc): Use bfd_link_dll. Comment.
897 (ppc_elf_check_relocs): Only set DF_STATIC_TLS in shared libs.
898 (ppc_elf_relocate_section): Comment fix.
899 * elf64-ppc.c (must_be_dyn_reloc): Use bfd_link_dll. Comment.
900 (ppc64_elf_check_relocs): Only set DF_STATIC_TLS in shared libs.
901 Support dynamic relocs for TPREL16 when non-pic too.
902 (dec_dynrel_count): Adjust TPREL16 handling as per check_relocs.
903 (ppc64_elf_relocate_section): Support dynamic relocs for TPREL16
904 when non-pic too.
905
906 2017-08-25 H.J. Lu <hongjiu.lu@intel.com>
907
908 * elf32-i386.c (elf_i386_link_hash_entry): Remove redundant
909 "symbol" in comments.
910 * elf64-x86-64.c (elf_x86_64_link_hash_entry): Likewise.
911
912 2017-08-24 H.J. Lu <hongjiu.lu@intel.com>
913
914 PR ld/22001
915 * elf64-x86-64.c (elf_x86_64_relocate_section): Check for
916 R_X86_64_PC32 relocation run-time overflow and unresolvable
917 R_X86_64_32S relocation with -z nocopyreloc.
918
919 2017-08-24 H.J. Lu <hongjiu.lu@intel.com>
920
921 * elf32-i386.c (elf_i386_check_relocs): Revert the last change.
922 Undefined symbols may not have a type.
923 * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
924
925 2017-08-23 H.J. Lu <hongjiu.lu@intel.com>
926
927 * elf64-x86-64.c (elf_x86_64_need_pic): Add an argument for
928 bfd_link_info. Report shared, PIE or PDE object based on
929 bfd_link_info.
930 (elf_x86_64_check_relocs): Update elf_x86_64_need_pic call.
931 (elf_x86_64_relocate_section): Likewise.
932
933 2017-08-23 H.J. Lu <hongjiu.lu@intel.com>
934
935 * elf32-i386.c (elf_i386_check_relocs): Increment PLT count only
936 for function symbols.
937 * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
938
939 2017-08-23 H.J. Lu <hongjiu.lu@intel.com>
940
941 * elf32-i386.c (elf_i386_link_setup_gnu_properties): Set
942 extern_protected_data to FALSE if GNU_PROPERTY_NO_COPY_ON_PROTECTED
943 is set on any input relocatable file.
944 * elf64-x86-64.c (elf_x86_64_link_setup_gnu_properties): Likewise.
945
946 2017-08-23 Alan Modra <amodra@gmail.com>
947
948 PR 21988
949 * elf64-ppc.c (ensure_undef_dynamic): Rename from
950 ensure_undefweak_dynamic. Handle undefined too.
951 * elf32-ppc.c (ensure_undef_dynamic): Likewise.
952 * elf32-hppa.c (ensure_undef_dynamic): Likewise.
953 (allocate_dynrelocs): Discard undefined non-default visibility
954 relocs first. Make undefined syms dynamic. Tidy goto.
955
956 2017-08-21 Alan Modra <amodra@gmail.com>
957 H.J. Lu <hongjiu.lu@intel.com>
958
959 PR ld/21964
960 * elf-bfd.h (SYMBOLIC_BIND): Return TRUE for __start/__stop symbols.
961 * elflink.c (bfd_elf_define_start_stop): Rewrite.
962
963 2017-08-21 Hans-Peter Nilsson <hp@bitrange.com>
964
965 PR ld/20125
966 * elf64-mmix.c (mmix_elf_relax_section): Correct handling of
967 undefined weak symbols.
968
969 2017-08-18 Nick Clifton <nickc@redhat.com>
970
971 PR binutils/21962
972 * tekhex.c (getsym): Fix check for source pointer walking off the
973 end of the input buffer.
974
975 2017-08-17 Szabolcs Nagy <szabolcs.nagy@arm.com>
976
977 PR ld/18808
978 * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Skip IFUNC
979 relocations in debug sections, change abort to _bfd_error_handler.
980
981 2017-08-14 Nick Clifton <nickc@redhat.com>
982
983 PR 21957
984 * elf.c (setup_group): Check for an empty or very small group
985 section.
986 * po/bfd.pot: Regenerate.
987
988 2017-08-14 Alan Modra <amodra@gmail.com>
989
990 PR 21441
991 * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Don't add
992 alignment padding here.
993 * elflink.c (bfd_elf_discard_info): Add .eh_frame padding here
994 in a reverse pass over sections.
995
996 2017-08-11 H.J. Lu <hongjiu.lu@intel.com>
997
998 PR binutils/21943
999 * elf32-i386.c (elf_i386_get_synthetic_symtab): Allocate space
1000 for @plt suffixes first.
1001 * elf64-x86-64.c (elf_x86_64_get_synthetic_symtab): Likewise.
1002
1003 2017-08-08 Nick Clifton <nickc@redhat.com>
1004
1005 PR 21916
1006 * elf-attrs.c (_bfd_elf_parse_attributes): Complain about very
1007 small section lengths.
1008 * elf.c (_bfd_elf_setup_sections): Skip empty entries in the group
1009 table.
1010 (elfcore_grok_freebsd_prstatus): Add checks to make sure that
1011 there is enough data present in the note.
1012
1013 2017-08-08 Alan Modra <amodra@gmail.com>
1014
1015 PR 21017
1016 * elf32-microblaze.c (microblaze_elf_check_relocs): Don't bump
1017 got.refcount for GOTOFF relocs, just create .got section.
1018
1019 2017-08-07 H.J. Lu <hongjiu.lu@intel.com>
1020
1021 * elflink.c (elf_link_add_object_symbols): Move common symbol
1022 check after bed->common_definition.
1023
1024 2017-08-07 Alan Modra <amodra@gmail.com>
1025
1026 PR 21910
1027 * elflink.c (bfd_elf_final_link): Don't segfault when sections
1028 needed to define various dynamic tags have been discarded.
1029
1030 2017-08-07 Nick Clifton <nickc@redhat.com>
1031
1032 PR 21884
1033 * elf32-i386.c (elf_i386_link_setup_gnu_properties): If the dynobj
1034 has not been set then use the bfd returned by
1035 _bfd_elf_link_setup_gnu_properties. If that is null then search
1036 through all the input bfds selecting the first normal, ELF format
1037 one.
1038 * elf64-x86-64.c (elf_x86_64_link_setup_gnu_properties): Likewise.
1039
1040 2017-08-06 H.J. Lu <hongjiu.lu@intel.com>
1041
1042 * elf32-i386.c (elf_i386_link_hash_entry): Change tls_get_addr
1043 to 1 bit.
1044 (elf_i386_link_hash_newfunc): Initialize tls_get_addr to 0.
1045 (elf_i386_check_tls_transition): Check tls_get_addr directly.
1046 (elf_i386_convert_load_reloc): Update tls_get_addr check.
1047 (elf_i386_link_check_relocs): New function.
1048 (bfd_elf32_bfd_link_check_relocs): New.
1049 * elf64-x86-64.c (elf_x86_64_link_hash_entry): Change tls_get_addr
1050 to 1 bit.
1051 (elf_x86_64_link_hash_newfunc): Initialize tls_get_addr to 0.
1052 (elf_x86_64_check_tls_transition): Check tls_get_addr directly.
1053 (elf_x86_64_convert_load_reloc): Update tls_get_addr check.
1054 (elf_x86_64_link_check_relocs): New function.
1055 (bfd_elf64_bfd_link_check_relocs): New.
1056 (bfd_elf32_bfd_link_check_relocs): Likewise.
1057
1058 2017-08-06 H.J. Lu <hongjiu.lu@intel.com>
1059
1060 PR ld/21903:
1061 * elflink.c (elf_link_add_object_symbols): Treat common symbol
1062 as undefined for --no-define-common.
1063
1064 2017-08-05 Alan Modra <amodra@gmail.com>
1065
1066 * elf32-hppa.c (elf32_hppa_set_gp): Don't require an
1067 hppa_link_hash_table.
1068
1069 2017-08-02 Max Filippov <jcmvbkbc@gmail.com>
1070
1071 * xtensa-isa.c (xtensa_isa_init): Don't update lookup table
1072 entries for sysregs with negative indices.
1073
1074 2017-08-01 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
1075
1076 * elf32-s390.c (elf_s390_finish_dynamic_sections): Skip if it
1077 isn't the S/390 specific elf data.
1078 * elf64-s390.c (elf_s390_finish_dynamic_sections): Likewise.
1079
1080 2017-07-31 Kuan-Lin Chen <rufus@andestech.com>
1081
1082 * elfxx-riscv.c (riscv_elf_add_sub_reloc): New function.
1083 * (howto_table) [R_RISCV_ADD8]: Use riscv_elf_add_sub_reloc.
1084 [R_RISCV_ADD16]: Likewise.
1085 [R_RISCV_ADD32]: Likewise.
1086 [R_RISCV_ADD64]: Likewise.
1087 [R_RISCV_SUB6]: Likewise.
1088 [R_RISCV_SUB8]: Likewise.
1089 [R_RISCV_SUB16]: Likewise.
1090 [R_RISCV_SUB32]: Likewise.
1091 [R_RISCV_SUB64]: Likewise.
1092
1093 2017-07-31 Alan Modra <amodra@gmail.com>
1094
1095 * elf64-ppc.c (ppc64_elf_tls_setup): Warn on --plt-localentry
1096 without ld.so checks.
1097
1098 2017-07-29 Alan Modra <amodra@gmail.com>
1099
1100 PR 21847
1101 * elf64-ppc.c (struct ppc_link_hash_entry): Add non_zero_localentry.
1102 (ppc64_elf_merge_symbol): Set non_zero_localentry.
1103 (is_elfv2_localentry0): Test non_zero_localentry.
1104 (ppc64_elf_tls_setup): Default to --no-plt-localentry.
1105
1106 2017-07-28 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
1107
1108 * elf32-s390.c (elf_s390_finish_dynamic_sections): Add NULL
1109 pointer check for htab->elf.irelplt.
1110 * elf64-s390.c (elf_s390_finish_dynamic_sections): Likewise.
1111
1112 2017-07-27 Nick Clifton <nickc@redhat.com>
1113
1114 PR 21840
1115 * mach-o.c (bfd_mach_o_read_symtab_strtab): Fail if the symtab
1116 size is -1.
1117 * nlmcode.h (nlm_swap_auxiliary_headers_in): Replace assertion
1118 with error return.
1119 * section.c (bfd_make_section_with_flags): Fail if the name or bfd
1120 are NULL.
1121 * vms-alpha.c (bfd_make_section_with_flags): Correct computation
1122 of end pointer.
1123 (evax_bfd_print_emh): Check for invalid string lengths.
1124
1125 2017-07-25 Nick Clifton <nickc@redhat.com>
1126
1127 * po/fr.po: Updated French translation.
1128
1129 2017-07-25 Benjamin Green <bengreen5mx@gmail.com>
1130
1131 PR 21824
1132 * elf32-msp430.c (msp430_elf_relax_section): Allow conversion of
1133 16-bit absolute branches into 10-bit pc-relative branches on the
1134 MSP430 as well as the MSP430X.
1135
1136 2017-07-25 Alan Modra <amodra@gmail.com>
1137
1138 * elf64-ppc.c (struct map_stub): Add tls_get_addr_opt_bctrl.
1139 (stub_eh_frame_size): New function.
1140 (ppc_size_one_stub): Set group tls_get_addr_opt_bctrl.
1141 (group_sections): Init group tls_get_addr_opt_bctrl.
1142 (ppc64_elf_size_stubs): Update sizing and initialization of
1143 .eh_frame. Iteration over stubs via group list.
1144 (ppc64_elf_build_stubs): Iterate over stubs via group list.
1145 (ppc64_elf_finish_dynamic_sections): Update finalization of
1146 .eh_frame.
1147
1148 2017-07-24 Nick Clifton <nickc@redhat.com>
1149
1150 PR 21813
1151 * mach-o.c (bfd_mach_o_canonicalize_relocs): Pass the base address
1152 of the relocs to the canonicalize_one_reloc routine.
1153 * mach-o.h (struct bfd_mach_o_backend_data): Update the prototype
1154 for the _bfd_mach_o_canonicalize_one_reloc field.
1155 * mach-o-arm.c (bfd_mach_o_arm_canonicalize_one_reloc): Add
1156 res_base parameter. Use to check for corrupt pair relocs.
1157 * mach-o-aarch64.c (bfd_mach_o_arm64_canonicalize_one_reloc):
1158 Likewise.
1159 * mach-o-i386.c (bfd_mach_o_i386_canonicalize_one_reloc):
1160 Likewise.
1161 * mach-o-x86-64.c (bfd_mach_o_x86_64_canonicalize_one_reloc):
1162 Likewise.
1163
1164 * vms-alpha.c (_bfd_vms_slurp_eihd): Make sure that there is
1165 enough data in the record before attempting to parse it.
1166 (_bfd_vms_slurp_eeom): Likewise.
1167
1168 (_bfd_vms_slurp_egsd): Check for an invalid section index.
1169 (image_set_ptr): Likewise.
1170 (alpha_vms_slurp_relocs): Likewise.
1171
1172 (alpha_vms_object_p): Check for a truncated record.
1173
1174 2017-07-24 Nick Clifton <nickc@redhat.com>
1175
1176 PR 21803
1177 * reloc.c (_bfd_unrecognized_reloc): New function. Reports
1178 an unrecognized reloc and sets the bfd_error value.
1179 * libbfd.h: Regenerate.
1180 * elf32-arm.c (elf32_arm_final_link_relocate): Use the new
1181 function.
1182 * elf32-i386.c (elf_i386_relocate_section): Likewise.
1183 * elf32-tilepro.c (tilepro_elf_relocate_section): Likewise.
1184 * elf64-x86-64.c (elf_x86_64_relocate_section): Likewise.
1185 * elfnn-aarch64.c (elfNN_aarch64_relocate_section): Likewise.
1186 * elfxx-tilegx.c (tilegx_elf_relocate_section): Likewise.
1187
1188 2017-07-23 Alan Modra <amodra@gmail.com>
1189
1190 * elf64-ppc.c (ppc64_elf_size_stubs): Correct advance to
1191 restore of LR.
1192
1193 2017-07-19 Szabolcs Nagy <szabolcs.nagy@arm.com>
1194
1195 PR ld/18841
1196 * elfnn-aarch64.c (elfNN_aarch64_reloc_type_class): Return
1197 reloc_class_ifunc for ifunc symbols.
1198
1199 2017-07-19 Nick Clifton <nickc@redhat.com>
1200
1201 PR 21787
1202 * archive.c (bfd_generic_archive_p): If the bfd does not have the
1203 correct magic bytes at the start, set the error to wrong format
1204 and clear the format selector before returning NULL.
1205
1206 2017-07-19 Nick Clifton <nickc@redhat.com>
1207
1208 PR 21786
1209 * coff-rs6000.c (_bfd_strntol): New function.
1210 (_bfd_strntoll): New function.
1211 (GET_VALUE_IN_FIELD): New macro.
1212 (EQ_VALUE_IN_FIELD): new macro.
1213 (_bfd_xcoff_slurp_armap): Use new macros.
1214 (_bfd_xcoff_archive_p): Likewise.
1215 (_bfd_xcoff_read_ar_hdr): Likewise.
1216 (_bfd_xcoff_openr_next_archived_file): Likewise.
1217 (_bfd_xcoff_stat_arch_elt): Likewise.
1218 * coff64-rs6000.c (_bfd_strntol): New function.
1219 (_bfd_strntoll): New function.
1220 (GET_VALUE_IN_FIELD): New macro.
1221 (xcoff64_slurp_armap): Use new macros.
1222
1223 2017-07-19 Claudiu Zissulescu <claziss@synopsys.com>
1224 John Eric Martin <John.Martin@emmicro-us.com>
1225
1226 * bfd-in2.h: Regenerate.
1227 * libbfd.h: Regenerate.
1228 * elf32-arc.c (JLI): Define.
1229 * reloc.c: Add JLI relocations.
1230
1231 2017-07-18 Nick Clifton <nickc@redhat.com>
1232
1233 PR 21775
1234 * coff-sh.c: Fix spelling typos.
1235 * compress.c: Likewise.
1236 * cpu-pdp11.c: Likewise.
1237 * ecofflink.c: Likewise.
1238 * elf-m10300.c: Likewise.
1239 * elf.c: Likewise.
1240 * elf32-arm.c: Likewise.
1241 * elf32-m68k.c: Likewise.
1242 * elf32-nds32.c: Likewise.
1243 * elf32-ppc.c: Likewise.
1244 * elf32-sh.c: Likewise.
1245 * elf32-v850.c: Likewise.
1246 * elf64-ppc.c: Likewise.
1247 * elf64-x86-64.c: Likewise.
1248 * elflink.c: Likewise.
1249 * elfnn-aarch64.c: Likewise.
1250 * elfxx-mips.c: Likewise.
1251 * som.c: Likewise.
1252 * sunos.c: Likewise.
1253 * vms-alpha.c: Likewise.
1254 * xcofflink.c: Likewise.
1255
1256 2017-07-18 Nick Clifton <nickc@redhat.com>
1257
1258 PR binutils/21781
1259 * coffcode.h (handle_COMDAT): Replace abort with an error message
1260 and return.
1261
1262 2017-07-17 H.J. Lu <hongjiu.lu@intel.com>
1263
1264 PR ld/21782
1265 * elf64-x86-64.c (elf_x86_64_relocate_section): Limit PIC check
1266 to shared library.
1267
1268 2017-07-17 H.J. Lu <hongjiu.lu@intel.com>
1269
1270 * elf64-x86-64.c (elf_x86_64_relocate_section): Re-indent.
1271
1272 2017-07-16 Alan Modra <amodra@gmail.com>
1273
1274 * elf64-ppc.c (ppc64_elf_relocate_section): Don't optimize
1275 __tls_index GOT entries when using __tls_get_addr_opt stub.
1276 * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
1277
1278 2017-07-12 Alan Modra <amodra@gmail.com>
1279
1280 * po/es.po: Update from translationproject.org/latest/bfd/.
1281 * po/fi.po: Likewise.
1282 * po/fr.po: Likewise.
1283 * po/id.po: Likewise.
1284 * po/ja.po: Likewise.
1285 * po/ro.po: Likewise.
1286 * po/ru.po: Likewise.
1287 * po/sr.po: Likewise.
1288 * po/sv.po: Likewise.
1289 * po/tr.po: Likewise.
1290 * po/uk.po: Likewise.
1291 * po/vi.po: Likewise.
1292 * po/zh_CN.po: Likewise.
1293 * po/hr.po: New file from translationproject.org.
1294 * configure.ac (ALL_LINGUAS): Add hr. Sort.
1295 * configure: Regenerate.
1296
1297 2017-07-12 Nick Clifton <nickc@redhat.com>
1298
1299 Fix compile time warnings using gcc 7.1.1.
1300 * elf32-xtensa.c (elf_xtensa_get_plt_section): Increase length of
1301 plt_name buffer.
1302 (elf_xtensa_get_gotplt_section): Increase length of got_name
1303 buffer.
1304 * mach-o-arm.c (bfd_mach_o_arm_canonicalize_one_reloc): Add a
1305 default return of FALSE.
1306 * mach-o-i386.c (bfd_mach_o_i386_canonicalize_one_reloc): Add a
1307 default return of FALSE.
1308
1309 2017-07-12 Alan Modra <amodra@gmail.com>
1310
1311 * binary.c (binary_set_section_contents): Don't print filepos in
1312 error message.
1313 (coff_write_object_contents): Cast size_t for error message.
1314 (coff_slurp_line_table): Don't use bfd_vma symndx.
1315 (coff_slurp_reloc_table): Remove unneeded cast.
1316 * dwarf2.c (read_section): Cast bfd_int64_t to long long for
1317 error message.
1318 (find_abstract_instance_name): Likewise.
1319 * elf32-arm.c (arm_type_of_stub): Correct error arg order.
1320 (bfd_elf32_arm_stm32l4xx_erratum_scan): Don't cast error arg.
1321 (elf32_arm_check_relocs): Make r_symndx an int.
1322 * elf32-cris.c (cris_elf_check_relocs): Delete extraneous %s in
1323 format string.
1324 * elf32-metag.c (elf_metag_relocate_section): Delete extra error
1325 message arg.
1326 * elf32-nds32.c (nds32_elf_ex9_build_hash_table): Rewrite bogus
1327 error message.
1328 * elf32-i386.c (elf_i386_check_relocs): Make r_symndx an int.
1329 * elf32-s390.c (elf_s390_check_relocs): Likewise.
1330 * elf32-tic6x.c (elf32_tic6x_check_relocs): Likewise.
1331 * elf32-tilepro.c (tilepro_elf_check_relocs): Likewise.
1332 * elf32-xtensa.c (elf_xtensa_check_relocs): Likewise.
1333 * elf64-s390.c (elf_s390_check_relocs): Likewise.
1334 * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
1335 * elfnn-aarch64.c (elfNN_aarch64_check_relocs): Likewise.
1336 * elfnn-riscv.c (riscv_elf_check_relocs): Likewise.
1337 * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Likewise.
1338 * elfxx-tilegx.c (tilegx_elf_check_relocs): Likewise.
1339 * elf64-mmix.c (_bfd_mmix_after_linker_allocation): Cast size_t args
1340 and use %lu for error message.
1341 * elflink.c (elf_link_adjust_relocs): Delete extra error message arg.
1342 * mmo.c (mmo_scan): Make stab_loc a file_ptr. Cast expression for
1343 error message.
1344
1345 * elf32-arm.c (elf32_arm_tls_relax): Correct format string and args
1346 in error message.
1347 (elf32_arm_final_link_relocate): Likewise.
1348 * coff-arm.c (bfd_arm_process_before_allocation): Likewise.
1349 * coffcode.h (styp_to_sec_flags): Likewise.
1350 * cofflink.c (_bfd_coff_write_global_sym): Likewise.
1351 * ecoff.c (_bfd_ecoff_slurp_symbol_table): Likewise.
1352 * elf32-arc.c (arc_elf_merge_private_bfd_data): Likewise.
1353 * elf32-bfin.c (bfinfdpic_check_relocs): Likewise.
1354 (elf32_bfin_merge_private_bfd_data): Likewise.
1355 * elf32-cris.c (cris_elf_relocate_section): Likewise.
1356 * elf32-frv.c (frv_elf_merge_private_bfd_data): Likewise.
1357 * elf32-i370.c (i370_elf_merge_private_bfd_data): Likewise.
1358 (i370_elf_relocate_section): Likewise.
1359 * elf32-iq2000.c (iq2000_elf_merge_private_bfd_data): Likewise.
1360 * elf32-m32c.c (m32c_elf_merge_private_bfd_data): Likewise.
1361 * elf32-m68hc1x.c (_bfd_m68hc11_elf_merge_private_bfd_data): Likewise.
1362 * elf32-mcore.c (mcore_elf_relocate_section): Likewise.
1363 * elf32-mep.c (mep_elf_merge_private_bfd_data): Likewise.
1364 * elf32-mt.c (mt_elf_merge_private_bfd_data): Likewise.
1365 * elf64-sparc.c (elf64_sparc_merge_private_bfd_data): Likewise.
1366 * elfxx-mips.c (mips_elf_merge_obj_e_flags): Likewise.
1367 (_bfd_mips_elf_merge_private_bfd_data): Likewise.
1368 * ieee.c (ieee_write_id, read_id): Likewise.
1369 * mach-o.c (bfd_mach_o_write_contents): Likewise.
1370 (bfd_mach_o_layout_commands, bfd_mach_o_read_section_32): Likewise.
1371 (bfd_mach_o_read_section_64, bfd_mach_o_read_symtab_symbol): Likewise.
1372 (bfd_mach_o_read_command, bfd_mach_o_header_p): Likewise.
1373 * peXXigen.c (_bfd_XXi_swap_aouthdr_in): Likewise.
1374 * stabs.c (_bfd_link_section_stabs): Likewise.
1375
1376 * coff-arm.c (coff_arm_relocate_section): Use L modifier in error
1377 format.
1378 * coff-mcore.c (coff_mcore_relocate_section): Likewise.
1379 * coff-ppc.c (coff_ppc_relocate_section): Likewise.
1380 * coff-rs6000.c (xcoff_reloc_type_toc): Likewise.
1381 * coff-sh.c (sh_relax_section): Likewise.
1382 (sh_relax_delete_bytes, sh_swap_insns): Likewise.
1383 * coff-tic80.c (coff_tic80_relocate_section): Likewise.
1384 * coffcode.h (coff_slurp_reloc_table): Likewise.
1385 * coffgen.c (_bfd_coff_get_external_symbols): Likewise.
1386 (_bfd_coff_read_string_table): Likewise.
1387 * cofflink.c (_bfd_coff_generic_relocate_section): Likewise.
1388 * compress.c (bfd_get_full_section_contents): Likewise.
1389 * dwarf2.c (read_formatted_entries, decode_line_info): Likewise.
1390 * elf-m10300.c (mn10300_elf_relocate_section): Likewise.
1391 * elf.c (bfd_elf_string_from_elf_section): Likewise.
1392 * elf32-arc.c (arc_special_overflow_checks): Likewise.
1393 * elf32-arm.c (elf32_arm_tls_relax): Likewise.
1394 (elf32_arm_final_link_relocate, elf32_arm_relocate_section): Likewise.
1395 (elf32_arm_write_section): Likewise.
1396 * elf32-bfin.c (bfin_relocate_section): Likewise.
1397 (bfinfdpic_relocate_section): Likewise.
1398 * elf32-hppa.c (hppa_build_one_stub): Likewise.
1399 (final_link_relocate, elf32_hppa_relocate_section): Likewise.
1400 * elf32-i386.c (elf_i386_tls_transition): Likewise.
1401 (elf_i386_relocate_section): Likewise.
1402 * elf32-ip2k.c (ip2k_final_link_relocate): Likewise.
1403 * elf32-lm32.c (lm32_elf_finish_dynamic_sections): Likewise.
1404 * elf32-m32r.c (m32r_elf_relocate_section): Likewise.
1405 * elf32-m68k.c (elf_m68k_relocate_section): Likewise.
1406 * elf32-metag.c (elf_metag_relocate_section): Likewise.
1407 * elf32-nds32.c (unrecognized_reloc_msg): Likewise.
1408 (nds32_elf_relax_longcall1, nds32_elf_relax_longcall2): Likewise.
1409 (nds32_elf_relax_longcall3, nds32_elf_relax_longjump1): Likewise.
1410 (nds32_elf_relax_longjump2, nds32_elf_relax_longjump3): Likewise.
1411 (nds32_elf_relax_longcall4, nds32_elf_relax_longcall5): Likewise.
1412 (nds32_elf_relax_longcall6, nds32_elf_relax_longjump4): Likewise.
1413 (nds32_elf_relax_longjump5, nds32_elf_relax_longjump6): Likewise.
1414 (nds32_elf_relax_longjump7, nds32_elf_relax_loadstore): Likewise.
1415 (nds32_elf_relax_ptr, nds32_elf_ex9_build_hash_table): Likewise.
1416 * elf32-nios2.c (nios2_elf32_relocate_section): Likewise.
1417 * elf32-rx.c (UNSAFE_FOR_PID): Likewise.
1418 * elf32-s390.c (invalid_tls_insn, elf_s390_relocate_section): Likewise.
1419 * elf32-score.c (s3_bfd_score_elf_check_relocs): Likewise.
1420 * elf32-score7.c (s7_bfd_score_elf_check_relocs): Likewise.
1421 * elf32-sh.c (sh_elf_relax_section): Likewise.
1422 (sh_elf_relax_delete_bytes, sh_elf_swap_insns): Likewise.
1423 (sh_elf_relocate_section): Likewise.
1424 * elf32-sh64.c (shmedia_prepare_reloc): Likewise.
1425 * elf32-spu.c (spu_elf_relocate_section): Likewise.
1426 * elf32-tic6x.c (elf32_tic6x_relocate_section): Likewise.
1427 * elf32-tilepro.c (tilepro_elf_relocate_section): Likewise.
1428 * elf32-v850.c (v850_elf_relax_section): Likewise.
1429 * elf32-vax.c (elf_vax_check_relocs): Likewise.
1430 (elf_vax_relocate_section): Likewise.
1431 * elf32-xtensa.c (elf_xtensa_relocate_section): Likewise.
1432 (extend_ebb_bounds_forward, extend_ebb_bounds_backward): Likewise.
1433 (compute_text_actions, compute_ebb_proposed_actions): Likewise.
1434 (do_fix_for_relocatable_link): Likewise.
1435 * elf64-alpha.c (elf64_alpha_relax_got_load): Likewise.
1436 (elf64_alpha_relax_with_lituse): Likewise.
1437 * elf64-hppa.c (elf64_hppa_finish_dynamic_symbol): Likewise.
1438 (elf_hppa_final_link_relocate): Likewise.
1439 * elf64-ia64-vms.c (elf64_ia64_relax_section): Likewise.
1440 (elf64_ia64_choose_gp, elf64_ia64_relocate_section): Likewise.
1441 (elf64_vms_link_add_object_symbols): Likewise.
1442 * elf64-mmix.c (mmix_elf_perform_relocation): Likewise.
1443 (mmix_final_link_relocate): Likewise.
1444 * elf64-s390.c (invalid_tls_insn): Likewise.
1445 (elf_s390_relocate_section): Likewise.
1446 * elf64-sh64.c (sh_elf64_relocate_section): Likewise.
1447 * elf64-x86-64.c (elf_x86_64_tls_transition): Likewise.
1448 (elf_x86_64_relocate_section): Likewise.
1449 * elfcode.h (elf_slurp_symbol_table): Likewise.
1450 * elfcore.h (elf_core_file_p): Likewise.
1451 * elflink.c (elf_link_read_relocs_from_section): Likewise.
1452 * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Likewise.
1453 (elfNN_aarch64_relocate_section): Likewise.
1454 * elfnn-ia64.c (elfNN_ia64_relax_section): Likewise.
1455 (elfNN_ia64_choose_gp, elfNN_ia64_relocate_section): Likewise.
1456 * elfnn-riscv.c (riscv_elf_relocate_section): Likewise.
1457 * elfxx-mips.c (_bfd_mips_elf_check_relocs): Likewise.
1458 (_bfd_mips_elf_relocate_section): Likewise.
1459 (_bfd_mips_elf_finish_dynamic_symbol, mips_finish_exec_plt): Likewise.
1460 * elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Likewise.
1461 * elfxx-tilegx.c (tilegx_elf_relocate_section): Likewise.
1462 * ieee.c (ieee_slurp_external_symbols): Likewise.
1463 * ihex.c (ihex_write_object_content): Likewise.
1464 * mach-o.c (bfd_mach_o_build_exec_seg_command): Likewise.
1465 * merge.c (_bfd_merged_section_offset): Likewise.
1466 * mmo.c (mmo_write_loc_chunk): Likewise.
1467 (mmo_write_object_contents): Likewise.
1468 * peXXigen.c (_bfd_XX_bfd_copy_private_bfd_data_common): Likewise.
1469 * stabs.c (_bfd_link_section_stabs): Likewise.
1470 * xcofflink.c (xcoff_link_add_symbols, xcoff_find_tc0): Likewise.
1471
1472 2017-07-11 Alan Modra <amodra@gmail.com>
1473
1474 * elf32-ppc.c (ppc_elf_relocate_section): Fix typo.
1475
1476 2017-07-11 Alan Modra <amodra@gmail.com>
1477
1478 * elf32-ppc.c (ppc_elf_relocate_section): Emit "unexpected
1479 instruction" error using _bfd_error_handler, not einfo.
1480
1481 2017-07-10 Nick Clifton <nickc@redhat.com>
1482
1483 * coffcode.h (coff_slurp_symbol_table): Do not include an entry
1484 for C_AIX_WEAKEXT if it has the same value as C_WEAKEXT.
1485
1486 2017-07-07 John Baldwin <jhb@FreeBSD.org>
1487
1488 * elf.c (elfcore_grok_freebsd_note): Handle NT_FREEBSD_PTLWPINFO.
1489
1490 2017-07-07 Alan Modra <amodra@gmail.com>
1491
1492 * coffcode.h (coff_slurp_symbol_table): Handle C_AIX_WEAKEXT.
1493
1494 2017-07-07 Alan Modra <amodra@gmail.com>
1495
1496 * bfd.c (_doprnt): Replace "L" with "ll" when printing bfd_vma
1497 as long long. Move code replacing "ll" with "I64", and simplify.
1498
1499 2017-07-06 H.J. Lu <hongjiu.lu@intel.com>
1500
1501 * bfd.c (_doprnt): Convert 'L' to 'l' when setting wide_width
1502 to 1.
1503
1504 2017-07-05 H.J. Lu <hongjiu.lu@intel.com>
1505
1506 * dwarf2.c (line_info_add_include_dir_stub): Replace time with
1507 xtime.
1508 (line_info_add_file_name): Likewise.
1509 (decode_line_info): Likewise.
1510
1511 2017-07-04 Tristan Gingold <gingold@adacore.com>
1512
1513 * version.m4: Bump version to 2.29.51
1514 * configure: Regenerate.
1515
1516 2017-07-04 Jiong Wang <jiong.wang@arm.com>
1517
1518 * elfnn-aarch64.c (elfNN_aarch64_finish_dynamic_symbol): Remove the
1519 sanity check at the head of this function.
1520
1521 2017-07-04 Jan Kratochvil <jan.kratochvil@redhat.com>
1522
1523 * dwarf2.c (struct dwarf2_debug): Add fields dwarf_line_str_buffer and
1524 dwarf_line_str_size.
1525 (struct attr_abbrev): Add field implicit_const.
1526 (dwarf_debug_sections): Add .debug_line_str.
1527 (enum dwarf_debug_section_enum): Add debug_line_str and debug_max.
1528 (dwarf_debug_section_assert): Add static assertion.
1529 (read_indirect_line_string): New.
1530 (read_abbrevs): Support DW_FORM_implicit_const.
1531 (is_str_attr): Support DW_FORM_line_strp.
1532 (read_attribute_value): Support DW_FORM_line_strp and
1533 DW_FORM_implicit_const.
1534 (read_attribute): Support DW_FORM_implicit_const.
1535 (line_info_add_include_dir, line_info_add_include_dir_stub):
1536 (line_info_add_file_name, read_formatted_entries): New.
1537 (decode_line_info, parse_comp_unit): Support DWARF 5.
1538 (_bfd_dwarf2_cleanup_debug_info): Free dwarf_line_str_buffer.
1539
1540 2017-07-03 Egeyar Bagcioglu <egeyar.bagcioglu@oracle.com>
1541
1542 * elfxx-sparc.c (_bfd_sparc_elf_finish_dynamic_symbol): Remove the
1543 abort statement that was put for symbols that are not dynamic.
1544
1545 2017-07-03 Tristan Gingold <gingold@adacore.com>
1546
1547 * po/bfd.pot: Regenerate
1548
1549 2017-07-03 Alan Modra <amodra@gmail.com>
1550
1551 * bfd.c (_doprnt): Rewrite "ll" and "L" modifiers to "I64" for
1552 __MSVCRT__. Support "L" modifier for bfd_vma. Formatting.
1553 * elf.c (setup_group): Use "Lx" to print sh_size.
1554 (_bfd_elf_setup_sections): Remove unnecessary cast and print
1555 unknown section type in hex.
1556 (copy_special_section_fields): Style fix.
1557 (bfd_section_from_shdr): Correct format for sh_link. Use a
1558 common error message for all the variants of unrecognized
1559 section types.
1560 (assign_file_positions_for_load_sections): Use "Lx" for lma
1561 adjust error message.
1562 (assign_file_positions_for_non_load_sections): Formatting.
1563 (rewrite_elf_program_header): Formatting. Use "Lx" for
1564 bfd_vma values in error messages.
1565 * elfcode.h (elf_slurp_reloc_table_from_section): Cast
1566 ELF_R_SYM value to type expected by format.
1567 * elflink.c (elf_link_read_relocs_from_section): Use "Lx"
1568 in error messages.
1569 (elf_link_add_object_symbols): Use "Lu" for symbol sizes.
1570 (elf_link_input_bfd): Use "Lx" for r_info.
1571 (bfd_elf_gc_record_vtinherit): Use "Lx" for offset.
1572
1573 2017-07-03 Alan Modra <amodra@gmail.com>
1574
1575 * bfd.c (bfd_scan_vma): Don't use long long unless HAVE_LONG_LONG.
1576 * coff-rs6000.c (FMT20): Handle hosts with 64-bit long and
1577 Microsoft C library variant of long long format specifier.
1578 (PRINT20): Cast value to bfd_uint64_t not long long.
1579 * coffcode.h (coff_print_aux): Use BFD_VMA_FMT.
1580 * coff-x86_64.c (coff_amd64_reloc): Use bfd_uint64_t rather than
1581 long long. Don't cast to bfd_vma.
1582 * elf32-score.c (score3_bfd_getl48): Likewise.
1583 * vms-alpha.c (_bfd_vms_slurp_eisd): Likewise.
1584
1585 2017-07-03 Alan Modra <amodra@gmail.com>
1586
1587 * elf.c (_bfd_elf_print_private_bfd_data): Use BFD_VMA_FMT to
1588 print d_tag.
1589 (bfd_elf_print_symbol): Don't cast symbol->flags.
1590 (_bfd_elf_symbol_from_bfd_symbol): Likewise.
1591 * elf32-ppc.c (ppc_elf_begin_write_processing): Correct
1592 _bfd_error_handler argument order.
1593 (ppc_elf_merge_private_bfd_data): Don't cast flags.
1594
1595 2017-07-03 Alan Modra <amodra@gmail.com>
1596
1597 * configure.ac: Invoke AC_CHECK_TYPES for long long. Invoke
1598 AC_TYPE_LONG_DOUBLE.
1599 * configure: Regenerate.
1600 * config.in: Regenerate.
1601
1602 2017-06-29 Andrew Waterman <andrew@sifive.com>
1603
1604 * elfnn-riscv.c (riscv_elf_adjust_dynamic_symbol): Fix TLS copy
1605 relocs.
1606
1607 2017-06-29 Egeyar Bagcioglu <egeyar.bagcioglu@oracle.com>
1608
1609 * elfxx-sparc.c (allocate_dynrelocs): Don't make a symbol dynamic
1610 unless it is undefined weak.
1611 * elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Set the flag
1612 relative_reloc to direct non-dynamic symbols to R_SPARC_RELATIVE
1613 relocation.
1614 * elfxx-sparc.c (_bfd_sparc_elf_finish_dynamic_symbol): If symbol
1615 is not dynamic in PIC, abort.
1616
1617 2017-06-29 Jiong Wang <jiong.wang@arm.com>
1618
1619 PR ld/21402
1620 * elfnn-aarch64.c (elfNN_aarch64_allocate_dynrelocs): Only make
1621 undefined weak symbols into dynamic.
1622 (elfNN_aarch64_final_link_relocate): Generate runtime RELATIVE
1623 relocation for non-dynamic symbols.
1624 (elfNN_aarch64_finish_dynamic_symbol): Add sanity check.
1625
1626 2017-06-29 Jiong Wang <jiong.wang@arm.com>
1627
1628 * elfnn-aarch64.c (aarch64_relocation_aginst_gp_p): New function.
1629 (elfNN_aarch64_final_link_relocate): Delete duplicated code for
1630 BFD_RELOC_AARCH64_LD64_GOTOFF_LO15, BFD_RELOC_AARCH64_MOVW_GOTOFF_G0_NC,
1631 BFD_RELOC_AARCH64_MOVW_GOTOFF_G1.
1632 * elfxx-aarch64.c (_bfd_aarch64_elf_resolve_relocation): Optimize the
1633 support for them.
1634
1635 2017-06-29 Andreas Arnez <arnez@linux.vnet.ibm.com>
1636
1637 * elf-bfd.h (elfcore_write_s390_gs_cb): Add prototype.
1638 (elfcore_write_s390_gs_bc): Likewise.
1639 * elf.c (elfcore_grok_s390_gs_cb): New function.
1640 (elfcore_grok_s390_gs_bc): New function.
1641 (elfcore_grok_note): Call them.
1642 (elfcore_write_s390_gs_cb): New function.
1643 (elfcore_write_s390_gs_bc): New function.
1644 (elfcore_write_register_note): Call them.
1645
1646 2017-06-28 H.J. Lu <hongjiu.lu@intel.com>
1647
1648 * libbfd.c (_bfd_generic_get_section_contents): Don't call
1649 bfd_get_file_size. Check archive element size.
1650 (_bfd_generic_get_section_contents_in_window): Likewise.
1651
1652 2017-06-28 H.J. Lu <hongjiu.lu@intel.com>
1653
1654 * bfd-in2.h: Regenerated.
1655 * bfdio.c (bfd_get_size): Change return type to ufile_ptr.
1656 (bfd_get_file_size): Likewise.
1657
1658 2017-06-28 Maciej W. Rozycki <macro@imgtec.com>
1659 Matthew Fortune <matthew.fortune@imgtec.com>
1660
1661 * archures.c (bfd_mach_mips_interaptiv_mr2): New macro.
1662 * cpu-mips.c (I_interaptiv_mr2): New enum value.
1663 (arch_info_struct): Add "mips:interaptiv-mr2" entry.
1664 * elfxx-mips.c (_bfd_elf_mips_mach) <E_MIPS_MACH_IAMR2>: New
1665 case.
1666 (mips_set_isa_flags) <bfd_mach_mips_interaptiv_mr2>: Likewise.
1667 (bfd_mips_isa_ext) <bfd_mach_mips_interaptiv_mr2>: Likewise.
1668 (print_mips_isa_ext) <AFL_EXT_INTERAPTIV_MR2>: Likewise.
1669 (mips_mach_extensions): Add `bfd_mach_mipsisa32r3' and
1670 `bfd_mach_mips_interaptiv_mr2' entries.
1671 * bfd-in2.h: Regenerate.
1672
1673 2017-06-27 Nick Clifton <nickc@redhat.com>
1674
1675 * tekhex.c (pass_over): Revert accidental conversion of a local
1676 array to a static array.
1677
1678 2017-06-27 Senthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com>
1679
1680 PR ld/13402
1681 * elf32-avr.c (elf32_avr_adjust_diff_reloc_value): Adjust
1682 reloc addend if necessary. Adjust diff only if
1683 shrinked_insn_address < end_address.
1684
1685 2017-06-27 Alan Modra <amodra@gmail.com>
1686
1687 PR binutils/21665
1688 * libbfd.c (_bfd_generic_get_section_contents): Warning fix.
1689 (_bfd_generic_get_section_contents_in_window): Likewise.
1690
1691 2017-06-26 Kuan-Lin Chen <rufus@andestech.com>
1692
1693 * elfnn-riscv.c (perform_relocation): Support the new
1694 R_RISCV_32_PCREL relocation.
1695 (riscv_elf_relocate_section): Likewise.
1696 * elfxx-riscv.c (howto_table): Likewise.
1697 (riscv_reloc_map): Likewise.
1698 * bfd-in2.h (BFD_RELOC_RISCV_32_PCREL): New relocation.
1699 * libbfd.h: Regenerate.
1700
1701 2017-06-27 Alan Modra <amodra@gmail.com>
1702
1703 PR binutils/21665
1704 * libbfd.c (_bfd_generic_get_section_contents): Delete abort.
1705 Use unsigned file pointer type, and remove cast.
1706 * libbfd.c (_bfd_generic_get_section_contents_in_window): Likewise.
1707 Add "count", not "sz".
1708
1709 2017-06-26 Pedro Alves <palves@redhat.com>
1710
1711 PR binutils/21665
1712 * libbfd.c (_bfd_generic_get_section_contents): Add "count", not
1713 "sz".
1714
1715 2017-06-26 H.J. Lu <hongjiu.lu@intel.com>
1716
1717 PR binutils/21665
1718 * libbfd.c (_bfd_generic_get_section_contents_in_window): Add
1719 a missing line.
1720
1721 2017-06-26 Maciej W. Rozycki <macro@imgtec.com>
1722
1723 * cpu-mips.c (arch_info_struct): Mark the 4010 32-bit.
1724 * elfxx-mips.c (mips_set_isa_flags) <bfd_mach_mips4010>: Set
1725 E_MIPS_ARCH_2 rather than E_MIPS_ARCH_3 in `e_flags'.
1726 (mips_mach_extensions): Mark `bfd_mach_mips4010' as extending
1727 `bfd_mach_mips6000' rather than `bfd_mach_mips4000'.
1728
1729 2017-06-26 H.J. Lu <hongjiu.lu@intel.com>
1730
1731 PR binutils/21665
1732 * compress.c (bfd_get_full_section_contents): Don't check the
1733 file size here.
1734 * libbfd.c (_bfd_generic_get_section_contents): Check for and
1735 reject a section whose size + offset is greater than the size
1736 of the entire file.
1737 (_bfd_generic_get_section_contents_in_window): Likewise.
1738
1739 2017-06-26 Nick Clifton <nickc@redhat.com>
1740
1741 PR binutils/21670
1742 * tekhex.c (getvalue): Check for the source pointer exceeding the
1743 end pointer before the first byte is read.
1744
1745 2017-06-26 Nick Clifton <nickc@redhat.com>
1746
1747 PR binutils/21665
1748 * opncls.c (get_build_id): Check that the section is big enough
1749 to contain the whole note.
1750 * compress.c (bfd_get_full_section_contents): Check for and reject
1751 a section whose size is greater than the size of the entire file.
1752 * elf32-v850.c (v850_elf_copy_notes): Allow for the ouput to not
1753 contain a notes section.
1754
1755 2017-06-26 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
1756
1757 * elf64-s390.c (elf_s390_additional_program_headers): Add NULL
1758 pointer checks.
1759 (elf_s390_modify_segment_map): Likewise.
1760 (bfd_elf_s390_set_options): Lisewise.
1761
1762 2017-06-26 Alan Modra <amodra@gmail.com>
1763
1764 * elflink.c (_bfd_elf_link_create_dynstrtab): Don't make dynobj
1765 a --just-syms bfd.
1766 (_bfd_elf_size_group_sections): Skip --just-syms bfds.
1767 (bfd_elf_size_dynamic_sections): Ignore .note.GNU-stack and
1768 .preinit_array on --just-syms bfds.
1769 (_bfd_elf_gc_mark_extra_sections): Skip --just-syms bfds.
1770 (elf_gc_sweep, bfd_elf_parse_eh_frame_entries): Likewise.
1771 (bfd_elf_gc_sections, bfd_elf_discard_info): Likewise.
1772
1773 2017-06-25 Sergei Trofimovich <slyfox@gentoo.org>
1774
1775 * elf.c (find_link): Bounds check "hint".
1776
1777 2017-06-24 Thomas Preud'homme <thomas.preudhomme@arm.com>
1778
1779 * elf32-arm.c (using_thumb_only): Update list of architectures in
1780 BFD_ASSERT for which the logic is valid.
1781 (using_thumb2_bl): Likewise.
1782 (using_thumb2): Likewise and return true for ARMv8-R.
1783 (arch_has_arm_nop): Likewise.
1784 (tag_cpu_arch_combine): New v8r table for ARMv8-R Tag_CPU_arch
1785 merging logic. Update commentis for value 15 of v8m_baseline,
1786 v8m_mainline and v4t_plus_v6_m arrays. Use v8r array to decide
1787 merging of value 15 of Tag_CPU_arch.
1788
1789 2017-06-23 Jiong Wang <jiong.wang@arm.com>
1790
1791 * reloc.c (BFD_RELOC_AARCH64_ADR_GOTPAGE): Rename to
1792 BFD_RELOC_AARCH64_ADR_GOT_PAGE
1793 * bfd-in2.h: Regenerate.
1794
1795 2017-06-22 H.J. Lu <hongjiu.lu@intel.com>
1796
1797 * elf64-x86-64.c (elf_x86_64_link_setup_gnu_properties): Move
1798 the error_alignment label forward. Properly align program
1799 property note section.
1800
1801 2017-06-22 Eric Christopher <echristo@gmail.com>
1802
1803 * elf32-arm.c (elf32_arm_final_link_relocate): Use labs rather than
1804 abs to fix a truncation warning.
1805
1806 2017-06-22 H.J. Lu <hongjiu.lu@intel.com>
1807
1808 * elf32-i386.c (UNDEFINED_WEAK_RESOLVED_TO_ZERO): Resolve
1809 local undefined weak symbol to 0.
1810 * elf64-x86-64.c (UNDEFINED_WEAK_RESOLVED_TO_ZERO): Likewise.
1811
1812 2017-06-22 H.J. Lu <hongjiu.lu@intel.com>
1813
1814 * elf32-i386.c (elf_i386_merge_gnu_properties): If info->shstk
1815 is set, turn on GNU_PROPERTY_X86_FEATURE_1_SHSTK.
1816 (elf_i386_link_setup_gnu_properties): If info->shstk is set,
1817 turn on GNU_PROPERTY_X86_FEATURE_1_IBT.
1818 * elf64-x86-64.c (elf_x86_64_merge_gnu_properties): If
1819 info->shstk is set, turn on GNU_PROPERTY_X86_FEATURE_1_SHSTK.
1820 (elf_x86_64_link_setup_gnu_properties): If info->shstk is set,
1821 turn on GNU_PROPERTY_X86_FEATURE_1_IBT.
1822
1823 2017-06-22 H.J. Lu <hongjiu.lu@intel.com>
1824
1825 * elf32-i386.c (elf_i386_lazy_ibt_plt0_entry): New.
1826 (elf_i386_lazy_ibt_plt_entry): Likewise.
1827 (elf_i386_pic_lazy_ibt_plt0_entry): Likewise.
1828 (elf_i386_non_lazy_ibt_plt_entry): Likewise.
1829 (elf_i386_pic_non_lazy_ibt_plt_entry): Likewise.
1830 (elf_i386_eh_frame_lazy_ibt_plt): Likewise.
1831 (elf_i386_lazy_plt_layout): Likewise.
1832 (elf_i386_non_lazy_plt_layout): Likewise.
1833 (elf_i386_link_hash_entry): Add plt_second.
1834 (elf_i386_link_hash_table): Add plt_second and
1835 plt_second_eh_frame.
1836 (elf_i386_allocate_dynrelocs): Use the second PLT if needed.
1837 (elf_i386_size_dynamic_sections): Use .plt.got unwind info for
1838 the second PLT. Check the second PLT.
1839 (elf_i386_relocate_section): Use the second PLT to resolve
1840 PLT reference if needed.
1841 (elf_i386_finish_dynamic_symbol): Fill and use the second PLT if
1842 needed.
1843 (elf_i386_finish_dynamic_sections): Set sh_entsize on the
1844 second PLT. Generate unwind info for the second PLT.
1845 (elf_i386_plt_type): Add plt_second.
1846 (elf_i386_get_synthetic_symtab): Support the second PLT.
1847 (elf_i386_parse_gnu_properties): Support
1848 GNU_PROPERTY_X86_FEATURE_1_AND.
1849 (elf_i386_merge_gnu_properties): Support
1850 GNU_PROPERTY_X86_FEATURE_1_AND. If info->ibt is set, turn
1851 on GNU_PROPERTY_X86_FEATURE_1_IBT
1852 (elf_i386_link_setup_gnu_properties): If info->ibt is set,
1853 turn on GNU_PROPERTY_X86_FEATURE_1_IBT. Use IBT-enabled PLT
1854 for info->ibtplt, info->ibt or GNU_PROPERTY_X86_FEATURE_1_IBT
1855 is set on all relocatable inputs.
1856 * elf64-x86-64.c (elf_x86_64_lazy_ibt_plt_entry): New.
1857 (elf_x32_lazy_ibt_plt_entry): Likewise.
1858 (elf_x86_64_non_lazy_ibt_plt_entry): Likewise.
1859 (elf_x32_non_lazy_ibt_plt_entry): Likewise.
1860 (elf_x86_64_eh_frame_lazy_ibt_plt): Likewise.
1861 (elf_x32_eh_frame_lazy_ibt_plt): Likewise.
1862 (elf_x86_64_lazy_ibt_plt): Likewise.
1863 (elf_x32_lazy_ibt_plt): Likewise.
1864 (elf_x86_64_non_lazy_ibt_plt): Likewise.
1865 (elf_x32_non_lazy_ibt_plt): Likewise.
1866 (elf_x86_64_get_synthetic_symtab): Support the second PLT.
1867 (elf_x86_64_parse_gnu_properties): Support
1868 GNU_PROPERTY_X86_FEATURE_1_AND.
1869 (elf_x86_64_merge_gnu_properties): Support
1870 GNU_PROPERTY_X86_FEATURE_1_AND. If info->ibt is set, turn
1871 on GNU_PROPERTY_X86_FEATURE_1_IBT
1872 (elf_x86_64_link_setup_gnu_properties): If info->ibt is set,
1873 turn on GNU_PROPERTY_X86_FEATURE_1_IBT. Use IBT-enabled PLT
1874 for info->ibtplt, info->ibt or GNU_PROPERTY_X86_FEATURE_1_IBT
1875 is set on all relocatable inputs.
1876
1877 2017-06-22 Nick Clifton <nickc@redhat.com>
1878
1879 PR binutils/21649
1880 * som.c (setup_sections): NUL terminate the space_strings buffer.
1881 Check that the space.name field does not index beyond the end of
1882 the space_strings buffer.
1883
1884 2017-06-21 Nick Clifton <nickc@redhat.com>
1885
1886 PR binutils/21646
1887 * coff-sh.c (sh_reloc): Check for an out of range reloc.
1888
1889 2017-06-21 Nick Clifton <nickc@redhat.com>
1890
1891 PR binutils/21639
1892 * vms-misc.c (_bfd_vms_save_sized_string): Use unsigned int as
1893 type of the size parameter.
1894 (_bfd_vms_save_counted_string): Add second parameter - the maximum
1895 length of the counted string.
1896 * vms.h (_bfd_vms_save_sized_string): Update prototype.
1897 (_bfd_vms_save_counted_string): Likewise.
1898 * vms-alpha.c (_bfd_vms_slurp_eisd): Update calls to
1899 _bfd_vms_save_counted_string.
1900 (_bfd_vms_slurp_ehdr): Likewise.
1901 (_bfd_vms_slurp_egsd): Likewise.
1902 (Parse_module): Likewise.
1903
1904 2017-06-21 Alan Modra <amodra@gmail.com>
1905
1906 * elf64-ppc.c (ppc64_elf_size_stubs): Test for localentry:0 plt
1907 calls before tocsave calls.
1908 (ppc64_elf_relocate_section): Allow localentry:0 plt calls without
1909 following nop.
1910
1911 2017-06-21 Nick Clifton <nickc@redhat.com>
1912
1913 PR binutils/21645
1914 * reloc.c (bfd_generic_get_relocated_section_contents): Fail if
1915 bfd_get_full_section_contents returns no contents.
1916
1917 2017-06-21 Nick Clifton <nickc@redhat.com>
1918
1919 PR binutils/21638
1920 * vms-alpha.c (_bfd_vms_slurp_egsd): Check for an undersized
1921 record.
1922
1923 2017-06-21 Nick Clifton <nickc@redhat.com>
1924
1925 PR binutils/21637
1926 * vms-alpha.c (_bfd_vms_slurp_egsd): Check for an empty section
1927 list.
1928 (image_set_ptr): Likewise.
1929 (alpha_vms_fix_sec_rel): Likewise.
1930 (alpha_vms_slurp_relocs): Likewise.
1931
1932 2017-06-21 Nick Clifton <nickc@redhat.com>
1933
1934 PR binutils/21633
1935 * ieee.c (ieee_slurp_sections): Check for a NULL return from
1936 read_id.
1937 (ieee_archive_p): Likewise.
1938 (ieee_object_p): Likewise.
1939
1940 2017-06-21 Nick Clifton <nickc@redhat.com>
1941
1942 PR binutils/21640
1943 * elf.c (setup_group): Zero the group section pointer list after
1944 allocation so that loops can be caught. Check for NULL pointers
1945 when processing a group list.
1946
1947 2017-06-20 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
1948
1949 * elf-s390.h: New file.
1950 * elf64-s390.c (struct elf_s390_link_hash_table): Add params
1951 field.
1952 (elf_s390_additional_program_headers): New function.
1953 (elf_s390_modify_segment_map): New function.
1954 (bfd_elf_s390_set_options): New function.
1955 (elf_backend_additional_program_headers)
1956 (elf_backend_modify_segment_map): Add macro definitions.
1957
1958 2017-06-19 H.J. Lu <hongjiu.lu@intel.com>
1959
1960 PR ld/21626
1961 * elf-properties.c (_bfd_elf_link_setup_gnu_properties): Check
1962 the DYNAMIC bit instead of bfd_count_sections.
1963
1964 2017-06-19 Nick Clifton <nickc@redhat.com>
1965
1966 PR binutils/21618
1967 * vms-alpha.c (evax_bfd_print_emh): Check for insufficient record
1968 length.
1969 (evax_bfd_print_eeom): Likewise.
1970 (evax_bfd_print_egsd): Check for an overlarge record length.
1971 (evax_bfd_print_etir): Likewise.
1972
1973 2017-06-19 Nick Clifton <nickc@redhat.com>
1974
1975 PR binutils/21612
1976 * libieee.h (struct common_header_type): Add end_p field.
1977 * ieee.c (this_byte_and_next): Do not advance input_p beyond
1978 end_p.
1979 (read_id): Check for a length that exceeds the remaining bytes in
1980 the input buffer.
1981 (ieee_seek): Initialise end_p.
1982 (ieee_archive_p): Likewise.
1983 (ieee_object_p): Likewise.
1984
1985 2017-06-19 Nick Clifton <nickc@redhat.com>
1986
1987 PR binutils/21611
1988 * vms-alpha.c (_bfd_vms_slurp_eihs): Check for invalid offset
1989 before reading the EIHS structure entries.
1990
1991 2017-06-19 Nick Clifton <nickc@redhat.com>
1992
1993 PR binutils/21615
1994 * vms-alpha.c (_bfd_vms_slurp_egsd): Use unsigned int for
1995 gsd_size. Check that there are enough bytes remaining to read the
1996 type and size of the next egsd. Check that the size of the egsd
1997 does not exceed the size of the record.
1998
1999 2017-06-19 Alan Modra <amodra@gmail.com>
2000
2001 * config.bfd: Correct targ_underscore for cris.
2002
2003 2017-06-18 Alan Modra <amodra@gmail.com>
2004
2005 * config.bfd: Correct targ_underscore for epiphany, ip2k,
2006 m32c, mn10200, pru, rl78, rx, crisv32 and v850.
2007
2008 2017-06-16 Nick Clifton <nickc@redhat.com>
2009
2010 * elflink.c (bfd_elf_size_dynsym_hash_dynstr): Do not fail if the
2011 bucketlist is empty because there are no symbols to add to the
2012 list.
2013
2014 2017-06-16 Alan Modra <amodra@gmail.com>
2015
2016 PR ld/20022
2017 PR ld/21557
2018 PR ld/21562
2019 PR ld/21571
2020 * targets.c (struct bfd_target): Add _bfd_define_start_stop.
2021 (BFD_JUMP_TABLE_LINK): Likewise.
2022 * elf-bfd.h (bfd_elf_define_start_stop): Declare.
2023 * elflink.c (_bfd_elf_gc_mark_rsec): Update comment.
2024 (bfd_elf_define_start_stop): New function.
2025 * linker.c (bfd_generic_define_start_stop): New function.
2026 * coff64-rs6000.c (rs6000_xcoff64_vec, rs6000_xcoff64_aix_vec): Init
2027 new field.
2028 * aout-adobe.c (aout_32_bfd_define_start_stop): Define.
2029 * aout-target.h (MY_bfd_define_start_stop): Define.
2030 * aout-tic30.c (MY_bfd_define_start_stop): Define.
2031 * binary.c (binary_bfd_define_start_stop): Define.
2032 * bout.c (b_out_bfd_define_start_stop): Define.
2033 * coff-alpha.c (_bfd_ecoff_bfd_define_start_stop): Define.
2034 * coff-mips.c (_bfd_ecoff_bfd_define_start_stop): Define.
2035 * coff-rs6000.c (_bfd_xcoff_bfd_define_start_stop): Define.
2036 * coffcode.h (coff_bfd_define_start_stop): Define.
2037 * elfxx-target.h (bfd_elfNN_bfd_define_start_stop): Define.
2038 * i386msdos.c (msdos_bfd_define_start_stop): Define.
2039 * i386os9k.c (os9k_bfd_define_start_stop): Define.
2040 * ieee.c (ieee_bfd_define_start_stop): Define.
2041 * ihex.c (ihex_bfd_define_start_stop): Define.
2042 * libbfd-in.h (_bfd_nolink_bfd_define_start_stop): Define.
2043 * mach-o-target.c (bfd_mach_o_bfd_define_start_stop): Define.
2044 * mmo.c (mmo_bfd_define_start_stop): Define.
2045 * nlm-target.h (nlm_bfd_define_start_stop): Define.
2046 * oasys.c (oasys_bfd_define_start_stop): Define.
2047 * pef.c (bfd_pef_bfd_define_start_stop): Define.
2048 * plugin.c (bfd_plugin_bfd_define_start_stop): Define.
2049 * ppcboot.c (ppcboot_bfd_define_start_stop): Define.
2050 * som.c (som_bfd_define_start_stop): Define.
2051 * srec.c (srec_bfd_define_start_stop): Define.
2052 * tekhex.c (tekhex_bfd_define_start_stop): Define.
2053 * versados.c (versados_bfd_define_start_stop): Define.
2054 * vms-alpha.c (vms_bfd_define_start_stop): Define.
2055 (alpha_vms_bfd_define_start_stop): Define.
2056 * xsym.c (bfd_sym_bfd_define_start_stop): Define.
2057 * bfd-in2.h: Regenerate.
2058 * libbfd.h: Regenerate.
2059
2060 2017-06-16 Jiong Wang <jiong.wang@arm.com>
2061
2062 * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Use
2063 SYMBOL_REFERENCES_LOCAL.
2064
2065 2017-06-15 Jiong Wang <jiong.wang@arm.com>
2066
2067 PR ld/21532
2068 * elfnn-aarch64.c (ELIMINATE_COPY_RELOCS): Set to 1.
2069 (elfNN_aarch64_final_link_relocate): Also propagate relocations to
2070 runtime for if there needs copy relocation elimination.
2071 (need_copy_relocation_p): New function. Return true for symbol with
2072 pc-relative references and if it's against read-only sections.
2073 (elfNN_aarch64_adjust_dynamic_symbol): Use need_copy_relocation_p.
2074 (elfNN_aarch64_check_relocs): Allocate dynrelocs for relocation types
2075 that are related with accessing external objects.
2076 (elfNN_aarch64_gc_sweep_hook): Sync the relocation types with the change
2077 in elfNN_aarch64_check_relocs.
2078
2079 2017-06-15 Nick Clifton <nickc@redhat.com>
2080
2081 PR binutils/21582
2082 * ieee.c (ieee_object_p): Use a static buffer to avoid compiler
2083 bugs.
2084 PR binutils/21581
2085 (ieee_archive_p): Likewise.
2086
2087 2017-06-15 Nick Clifton <nickc@redhat.com>
2088
2089 PR binutils/21579
2090 * vms-alpha.c (_bfd_vms_slurp_etir): Extend check of cmd_length.
2091
2092 2017-06-14 Max Filippov <jcmvbkbc@gmail.com>
2093
2094 * elf32-xtensa.c (elf_xtensa_be_plt_entry,
2095 elf_xtensa_le_plt_entry): Add dimension for the ABI to arrays,
2096 keep both windowed and call0 ABI PLT definitions.
2097 (elf_xtensa_create_plt_entry): Use selected ABI to choose upper
2098 elf_xtensa_*_plt_entry endex.
2099 (ELF_MAXPAGESIZE): Fix at minimal supported MMU page size.
2100
2101 2017-06-14 Nick Clifton <nickc@redhat.com>
2102
2103 PR binutils/21578
2104 * elf32-sh.c (sh_elf_set_mach_from_flags): Fix check for invalid
2105 flag value.
2106
2107 2017-06-14 Nick Clifton <nickc@redhat.com>
2108
2109 PR binutils/21589
2110 * vms-alpha.c (_bfd_vms_get_value): Add an extra parameter - the
2111 maximum value for the ascic pointer. Check that name processing
2112 does not read beyond this value.
2113 (_bfd_vms_slurp_etir): Add checks for attempts to read beyond the
2114 end of etir record.
2115
2116 2017-06-14 Nick Clifton <nickc@redhat.com>
2117
2118 PR binutils/21591
2119 * versados.c (versados_mkobject): Zero the allocated tdata structure.
2120 (process_otr): Check for an invalid offset in the otr structure.
2121
2122 2017-06-14 Sebastian Huber <sebastian.huber@embedded-brains.de>
2123
2124 * config.bfd (epiphany-*-elf): Accept epiphany-*-*.
2125
2126 2017-06-13 H.J. Lu <hongjiu.lu@intel.com>
2127
2128 PR ld/20022
2129 PR ld/21557
2130 PR ld/21562
2131 PR ld/21571
2132 * elf-bfd.h (elf_link_hash_entry): Add start_stop. Change the
2133 vtable field to a union.
2134 (_bfd_elf_is_start_stop): Removed.
2135 * elf32-i386.c (elf_i386_convert_load_reloc): Also check for
2136 __start_SECNAME and __stop_SECNAME symbols.
2137 * elf64-x86-64.c (elf_x86_64_convert_load_reloc): Likewise.
2138 * elflink.c (_bfd_elf_is_start_stop): Removed.
2139 (_bfd_elf_gc_mark_rsec): Check start_stop instead of calling
2140 _bfd_elf_is_start_stop.
2141 (elf_gc_propagate_vtable_entries_used): Skip __start_SECNAME and
2142 __stop_SECNAME symbols. Updated.
2143 (elf_gc_smash_unused_vtentry_relocs): Likewise.
2144 (bfd_elf_gc_record_vtinherit): Likewise.
2145 (bfd_elf_gc_record_vtentry): Likewise.
2146
2147 2017-06-13 Nick Clifton <nickc@redhat.com>
2148
2149 PR ld/21524
2150 * elflink.c (elf_link_adjust_relocs): Generate an error when
2151 encountering a reloc against a symbol removed by garbage
2152 collection.
2153
2154 2017-06-12 H.J. Lu <hongjiu.lu@intel.com>
2155
2156 * elf-bfd.h (elf_backend_data): Add struct bfd_link_info *
2157 to merge_gnu_properties.
2158 * elf-properties.c (elf_merge_gnu_properties): Add struct
2159 bfd_link_info * and pass it to merge_gnu_properties.
2160 (elf_merge_gnu_property_list): Add struct bfd_link_info *
2161 and pass it to elf_merge_gnu_properties.
2162 (_bfd_elf_link_setup_gnu_properties): Pass info to
2163 elf_merge_gnu_property_list.
2164 * elf32-i386.c (elf_i386_merge_gnu_properties): Add struct
2165 bfd_link_info *.
2166 * elf64-x86-64.c (elf_x86_64_merge_gnu_properties): Likewise.
2167
2168 2017-06-11 Joe Zbiciak <joe.zbiciak@leftturnonly.info>
2169
2170 PR 21564
2171 * binary.c (binary_set_section_contents): Scale lma by octets
2172 per byte to set filepos.
2173
2174 2017-06-08 Cupertino Miranda <cmiranda@synopsys.com>
2175
2176 * elf32-arc.c (elf_arc_check_relocs): Fixed conditions to generate
2177 dynamic sections.
2178
2179 2017-06-08 Cupertino Miranda <cmiranda@synopsys.com>
2180
2181 * elf32-arc.c (elf_arc_size_dynamic_sections): Changed condition to
2182 require TEXTREL.
2183
2184 2017-06-08 Cupertino Miranda <cmiranda@synopsys.com>
2185
2186 * arc-got.h (relocate_fix_got_relocs_for_got_info): Added TCB_SIZE to
2187 patched section contents for TLS IE reloc.
2188 * elf32-arc.c: Remove TCB_SIZE preprocessor macro.
2189
2190 2017-06-08 Cupertino Miranda <cmiranda@synopsys.com>
2191
2192 * elf32-arc.c (elf_arc_relocate_section): Added "call" to
2193 RELOC_FOR_GLOBAL_SYMBOL macro.
2194
2195 2018-06-08 Cupertino Miranda <cmiranda@synopsys.com>
2196
2197 * elf32-arc.c (elf_arc_relocate_section): Small refactor and condition
2198 changes.
2199
2200 2017-06-08 Cupertino Miranda <cmiranda@synopsys.com>
2201
2202 * config/tc-arc.c (md_undefined_symbol): Changed.
2203 * config/tc-arc.h (DYNAMIC_STRUCT_NAME): Removed.
2204
2205 2017-06-08 Cupertino Miranda <cmiranda@synopsys.com>
2206
2207 * elf32-arc.c (elf_arc_relocate_section): Fixed reassign of indirect
2208 symbols.
2209
2210 2017-06-08 Cupertino Miranda <cmiranda@synopsys.com>
2211
2212 * elf32-arc.c (elf_arc_check_relocs): Added condition to disable
2213 warning and "Bad value" for local symbols ARC_32 or ARC_32_ME relocs.
2214
2215 2017-06-08 Cupertino Miranda <cmiranda@synopsys.com>
2216
2217 * elf32-arc.c (ADD_RELA): Changed to only work when dynamic
2218 object is created.
2219
2220 2017-06-08 Richard Earnshaw <rearnsha@arm.com>
2221
2222 * elf32-arm.c (elf32_arm_merge_eabi_attributes): Remove assertion
2223 that the input bfd has Tag_FP_ARCH non-zero if Tag_ABI_HardFP_use
2224 is non-zero. Add clarifying comments.
2225
2226 2017-06-08 H.J. Lu <hongjiu.lu@intel.com>
2227
2228 * elf32-i386.c (elf_i386_check_relocs): Set local IFUNC symbol
2229 name. Use local IFUNC symbol name string to report unsupported
2230 non-PIC call to IFUNC function.
2231 (elf_i386_relocate_section): Dump local IFUNC name with minfo
2232 when generating R_386_IRELATIVE relocation.
2233 (elf_i386_finish_dynamic_symbol): Likewise.
2234 * elf_x86_64_check_relocs (elf_x86_64_check_relocs): Set local
2235 IFUNC symbol name.
2236 (elf_x86_64_relocate_section): Dump local IFUNC name with minfo
2237 when generating R_X86_64_IRELATIVE relocation.
2238 (elf_x86_64_finish_dynamic_symbol): Likewise.
2239
2240 2017-06-06 Jose E. Marchesi <jose.marchesi@oracle.com>
2241
2242 * elf.c (setup_group): Make sure BFD sections are created for all
2243 group sections in the input file when processing SHF_GROUP
2244 sections.
2245 (bfd_section_from_shdr): Avoid duplicating logic already
2246 implemented in `setup_group'.
2247
2248 2017-06-06 Daniel Bonniot de Ruisselet <bonniot@gmail.com>
2249
2250 PR binutils/21546
2251 * peXXigen.c (pe_print_idata): Use the address of the first thunk
2252 if the hint address is zero.
2253
2254 2017-06-06 James Clarke <jrtc27@jrtc27.com>
2255
2256 PR ld/19579
2257 * elfnn-aarch64.c (elfNN_aarch64_finish_dynamic_symbol): Check
2258 ELF_COMMON_DEF_P for common symbols.
2259
2260 2017-06-06 Andrew Burgess <andrew.burgess@embecosm.com>
2261
2262 * elf.c (_bfd_elf_make_section_from_shdr): Don't initially mark
2263 SEC_GROUP sections as SEC_EXCLUDE.
2264 (bfd_elf_set_group_contents): Replace use of abort with an assert.
2265 (assign_section_numbers): Use resolve_section_groups flag instead
2266 of relocatable link type.
2267 (_bfd_elf_init_private_section_data): Use resolve_section_groups
2268 flag instead of checking the final_link flag for part of the
2269 checks in here. Fix white space as a result.
2270 * elflink.c (elf_link_input_bfd): Use resolve_section_groups flag
2271 instead of relocatable link type.
2272 (bfd_elf_final_link): Likewise.
2273
2274 2017-06-06 Jose E. Marchesi <jose.marchesi@oracle.com>
2275
2276 * elfxx-mips.c (_bfd_mips_elf_relocate_section): Remove unused
2277 variable `bed'.
2278 * elf32-score.c (score_elf_final_link_relocate): Likewise.
2279 (s3_bfd_score_elf_check_relocs): Likewise.
2280 * elf32-score7.c (s7_bfd_score_elf_relocate_section): Likewise.
2281 (score_elf_final_link_relocate): Likewise.
2282 (s7_bfd_score_elf_check_relocs): Likewise.
2283
2284 2017-06-06 Jose E. Marchesi <jose.marchesi@oracle.com>
2285
2286 * elflink.c (init_reloc_cookie_rels): Remove unused variable
2287 `bed'.
2288
2289 2017-06-06 Maciej W. Rozycki <macro@imgtec.com>
2290
2291 * elf-bfd.h (RELOC_AGAINST_DISCARDED_SECTION): Subtract `count'
2292 from `reloc_count' rather than decrementing it.
2293 * elf.c (bfd_section_from_shdr): Multiply the adjustment to
2294 `reloc_count' by `int_rels_per_ext_rel'.
2295 * elf32-score.c (score_elf_final_link_relocate): Do not multiply
2296 `reloc_count' by `int_rels_per_ext_rel' for last relocation
2297 entry determination.
2298 (s3_bfd_score_elf_check_relocs): Likewise.
2299 * elf32-score7.c (score_elf_final_link_relocate): Likewise.
2300 (s7_bfd_score_elf_relocate_section): Likewise.
2301 (s7_bfd_score_elf_check_relocs): Likewise.
2302 * elf64-mips.c (mips_elf64_get_reloc_upper_bound): Remove
2303 prototype and function.
2304 (mips_elf64_slurp_one_reloc_table): Do not update `reloc_count'.
2305 (mips_elf64_slurp_reloc_table): Assert that `reloc_count' is
2306 triple rather than once the sum of REL and RELA relocation entry
2307 counts.
2308 (bfd_elf64_get_reloc_upper_bound): Remove macro.
2309 * elflink.c (_bfd_elf_link_read_relocs): Do not multiply
2310 `reloc_count' by `int_rels_per_ext_rel' for internal relocation
2311 storage allocation size determination.
2312 (elf_link_input_bfd): Multiply `.ctors' and `.dtors' section's
2313 size by `int_rels_per_ext_rel'. Do not multiply `reloc_count'
2314 by `int_rels_per_ext_rel' for last relocation entry
2315 determination.
2316 (bfd_elf_final_link): Do not multiply `reloc_count' by
2317 `int_rels_per_ext_rel' for internal relocation storage
2318 allocation size determination.
2319 (init_reloc_cookie_rels): Do not multiply `reloc_count' by
2320 `int_rels_per_ext_rel' for last relocation entry determination.
2321 (elf_gc_smash_unused_vtentry_relocs): Likewise.
2322 * elfxx-mips.c (_bfd_mips_elf_check_relocs): Likewise.
2323 (_bfd_mips_elf_relocate_section): Likewise.
2324
2325 2017-06-05 Alan Modra <amodra@gmail.com>
2326
2327 PR 21529
2328 * linker.c (_bfd_generic_link_output_symbols): Handle BSF_GNU_UNIQUE.
2329
2330 2017-06-01 John Baldwin <jhb@FreeBSD.org>
2331
2332 * elf.c (elfcore_grok_freebsd_psinfo): Use ELF header class to
2333 determine structure sizes.
2334 (elfcore_grok_freebsd_prstatus): Likewise.
2335
2336 2017-06-01 Alan Modra <amodra@gmail.com>
2337
2338 * elf64-ppc.c (struct ppc_link_hash_table): Add has_plt_localentry0.
2339 (ppc64_elf_merge_symbol_attribute): Merge localentry bits from
2340 dynamic objects.
2341 (is_elfv2_localentry0): New function.
2342 (ppc64_elf_tls_setup): Default params->plt_localentry0.
2343 (plt_stub_size): Adjust size for tls_get_addr_opt stub.
2344 (build_tls_get_addr_stub): Use a simpler stub when r2 is not saved.
2345 (ppc64_elf_size_stubs): Leave stub_type as ppc_stub_plt_call for
2346 optimized localentry:0 stubs.
2347 (ppc64_elf_build_stubs): Save r2 in ELFv2 __glink_PLTresolve.
2348 (ppc64_elf_relocate_section): Leave nop unchanged for optimized
2349 localentry:0 stubs.
2350 (ppc64_elf_finish_dynamic_sections): Set PPC64_OPT_LOCALENTRY in
2351 DT_PPC64_OPT.
2352 * elf64-ppc.h (struct ppc64_elf_params): Add plt_localentry0.
2353
2354 2017-05-30 Casey Smith <clegg89@gmail.com>
2355
2356 PR ld/21523
2357 * elf32-arm.c (elf32_arm_final_link_relocate): Install an absolute
2358 value when processing the R_ARM_THM_ALU_PREL_11_0 reloc.
2359
2360 2017-05-30 Anton Kolesov Anton.Kolesov@synopsys.com
2361
2362 * cpu-arc.c (arc_compatible): New function.
2363
2364 2017-05-30 Anton Kolesov <anton.kolesov@synopsys.com>
2365
2366 * cpu-arc.c (arch_info_struct): Remove duplicate ARC600 entry.
2367
2368 2017-05-30 H.J. Lu <hongjiu.lu@intel.com>
2369
2370 PR binutils/21519
2371 * bfdio.c (bfd_get_file_size): New function.
2372 * bfd-in2.h: Regenerated.
2373
2374 2017-05-23 Dilian Palauzov <git-dpa@aegee.org>
2375
2376 * elf32-arc.c (arc_elf_merge_attributes): Add fall through
2377 comments.
2378
2379 2017-05-22 H.J. Lu <hongjiu.lu@intel.com>
2380
2381 * elf64-x86-64.c (elf_x86_64_link_setup_gnu_properties): Use
2382 dynobj instead of htab->elf.dynobj.
2383
2384 2017-05-19 Maciej W. Rozycki <macro@imgtec.com>
2385
2386 * elf64-mips.c (mips_elf64_canonicalize_reloc): Remove prototype
2387 and function.
2388 (mips_elf64_canonicalize_dynamic_reloc): Likewise.
2389 (mips_elf64_slurp_one_reloc_table): Set `reloc_count' to the
2390 actual number of internal relocations retrieved. Adjust
2391 function description.
2392 (bfd_elf64_canonicalize_reloc): Remove macro.
2393 (bfd_elf64_canonicalize_dynamic_reloc): Likewise.
2394
2395 2017-05-19 Jose E. Marchesi <jose.marchesi@oracle.com>
2396
2397 * archures.c (bfd_mach_sparc_v9m8): Define.
2398 (bfd_mach_sparc_v8plusm8): Likewise.
2399 (bfd_mach_sparc_v9_p): Adjust to M8.
2400 (bfd_mach_sparc_64bit_p): Likewise.
2401 * aoutx.h (machine_type): Handle bfd_mach_sparc_v9m8 and
2402 bfd_mach_sparc_v8plusm8.
2403 * bfd-in2.h: Regenerated.
2404 * cpu-sparc.c (arch_info_struct): Entries for sparc:v9m8 and
2405 sparc:v8plusm8.
2406 * elfxx-sparc.c (_bfd_sparc_elf_object_p): Handle
2407 bfd_mach_sparc_v8plusm8 and bfd_mach_sparc_v9m8 using the new hw
2408 capabilities ONADDSUB, ONMUL, ONDIV, DICTUNP, FPCPSHL, RLE and
2409 SHA3.
2410 * elf32-sparc.c (elf32_sparc_final_write_processing): Handle
2411 bfd_mach_sparc_v8plusm8.
2412
2413 2017-05-19 Alan Modra <amodra@gmail.com>
2414
2415 * elflink.c (_bfd_elf_gc_mark_extra_sections): Don't keep
2416 debug and special sections when no non-note alloc sections in an
2417 object are kept.
2418
2419 2017-05-18 Alan Modra <amodra@gmail.com>
2420
2421 * arc-got.h: Don't compare boolean values against TRUE or FALSE.
2422 * elf-m10300.c: Likewise.
2423 * elf.c: Likewise.
2424 * elf32-arc.c: Likewise.
2425 * elf32-bfin.c: Likewise.
2426 * elf32-m68k.c: Likewise.
2427 * elf32-nds32.c: Likewise.
2428 * elf32-tilepro.c: Likewise.
2429 * elflink.c: Likewise.
2430 * elfnn-aarch64.c: Likewise.
2431 * elfnn-riscv.c: Likewise.
2432 * elfxx-tilegx.c: Likewise.
2433 * mach-o.c: Likewise.
2434 * peXXigen.c: Likewise.
2435 * vms-alpha.c: Likewise.
2436 * vms-lib.c: Likewise.
2437
2438 2017-05-17 H.J. Lu <hongjiu.lu@intel.com>
2439
2440 PR ld/20882
2441 * elflink.c (elf_gc_mark_debug_section): New function.
2442 (_bfd_elf_gc_mark_extra_sections): Mark any debug sections
2443 referenced by kept debug sections.
2444
2445 2017-05-16 Alan Modra <amodra@gmail.com>
2446
2447 * elf-m10300.c: Rename occurrences of non_ir_ref.
2448 * elf32-arm.c: Likewise.
2449 * elf32-bfin.c: Likewise.
2450 * elf32-cr16.c: Likewise.
2451 * elf32-cris.c: Likewise.
2452 * elf32-d10v.c: Likewise.
2453 * elf32-dlx.c: Likewise.
2454 * elf32-fr30.c: Likewise.
2455 * elf32-frv.c: Likewise.
2456 * elf32-hppa.c: Likewise.
2457 * elf32-i370.c: Likewise.
2458 * elf32-i386.c: Likewise.
2459 * elf32-iq2000.c: Likewise.
2460 * elf32-lm32.c: Likewise.
2461 * elf32-m32c.c: Likewise.
2462 * elf32-m32r.c: Likewise.
2463 * elf32-m68hc1x.c: Likewise.
2464 * elf32-m68k.c: Likewise.
2465 * elf32-mcore.c: Likewise.
2466 * elf32-metag.c: Likewise.
2467 * elf32-microblaze.c: Likewise.
2468 * elf32-moxie.c: Likewise.
2469 * elf32-msp430.c: Likewise.
2470 * elf32-mt.c: Likewise.
2471 * elf32-nios2.c: Likewise.
2472 * elf32-or1k.c: Likewise.
2473 * elf32-ppc.c: Likewise.
2474 * elf32-rl78.c: Likewise.
2475 * elf32-s390.c: Likewise.
2476 * elf32-score.c: Likewise.
2477 * elf32-score7.c: Likewise.
2478 * elf32-sh.c: Likewise.
2479 * elf32-tic6x.c: Likewise.
2480 * elf32-tilepro.c: Likewise.
2481 * elf32-v850.c: Likewise.
2482 * elf32-vax.c: Likewise.
2483 * elf32-xstormy16.c: Likewise.
2484 * elf32-xtensa.c: Likewise.
2485 * elf64-alpha.c: Likewise.
2486 * elf64-hppa.c: Likewise.
2487 * elf64-ia64-vms.c: Likewise.
2488 * elf64-mmix.c: Likewise.
2489 * elf64-ppc.c: Likewise.
2490 * elf64-s390.c: Likewise.
2491 * elf64-sh64.c: Likewise.
2492 * elf64-x86-64.c: Likewise.
2493 * elflink.c: Likewise.
2494 * elfnn-aarch64.c: Likewise.
2495 * elfnn-ia64.c: Likewise.
2496 * elfnn-riscv.c: Likewise.
2497 * elfxx-mips.c: Likewise.
2498 * elfxx-sparc.c: Likewise.
2499 * elfxx-tilegx.c: Likewise.
2500 * linker.c: Likewise.
2501
2502 2017-05-16 Alan Modra <amodra@gmail.com>
2503
2504 * elf64-ppc.c (add_symbol_adjust): Transfer non_ir_ref_dynamic.
2505 * elflink.c (elf_link_add_object_symbols): Update to use
2506 non_ir_ref_dynamic.
2507 (elf_link_input_bfd): Test non_ir_ref_dynamic in addition to
2508 non_ir_ref.
2509 * linker.c (_bfd_generic_link_add_one_symbol): Likewise.
2510
2511 2017-05-15 Maciej W. Rozycki <macro@imgtec.com>
2512
2513 * elfxx-mips.c (print_mips_ases): Handle MIPS16e2 ASE.
2514
2515 2017-05-12 H.J. Lu <hongjiu.lu@intel.com>
2516
2517 * elf32-i386.c (elf_i386_parse_gnu_properties): Merge
2518 GNU_PROPERTY_X86_ISA_1_USED and GNU_PROPERTY_X86_ISA_1_NEEDED
2519 properties.
2520 * elf64-x86-64.c (elf_x86_64_parse_gnu_properties): Likewise.
2521
2522 2017-05-11 H.J. Lu <hongjiu.lu@intel.com>
2523
2524 * elf64-x86-64.c (elf_x86_64_link_hash_entry): Rename plt_bnd
2525 to plt_second.
2526 (elf_x86_64_link_hash_table): Rename plt_bnd/plt_bnd_eh_frame
2527 to plt_second/plt_second_eh_frame.
2528 (elf_x86_64_link_hash_newfunc): Updated.
2529 (elf_x86_64_allocate_dynrelocs): Likewise.
2530 (elf_x86_64_size_dynamic_sections): Likewise.
2531 (elf_x86_64_relocate_section): Likewise.
2532 (elf_x86_64_finish_dynamic_symbol): Likewise.
2533 (elf_x86_64_finish_dynamic_sections): Likewise.
2534 (elf_x86_64_plt_type): Rename plt_bnd to plt_second.
2535 (elf_x86_64_get_synthetic_symtab): Updated. Also scan the
2536 .plt.sec section.
2537 (elf_backend_setup_gnu_properties): Updated. Create the
2538 .plt.sec section instead of the .plt.sec section.
2539
2540 2017-05-11 H.J. Lu <hongjiu.lu@intel.com>
2541
2542 * elf32-i386.c (elf_i386_allocate_dynrelocs): Partially revert
2543 commit 25070364b0ce33eed46aa5d78ebebbec6accec7e.
2544 * elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): Likewse.
2545
2546 2017-05-10 Jose E. Marchesi <jose.marchesi@oracle.com>
2547
2548 * elf64-sparc.c (elf64_sparc_set_reloc): New function.
2549 (bfd_elf64_set_reloc): Define.
2550 (elf64_sparc_write_relocs): Use `canon_reloc_count'.
2551
2552 2017-05-10 Jose E. Marchesi <jose.marchesi@oracle.com>
2553
2554 * targets.c (BFD_JUMP_TABLE_RELOCS): Add NAME##_set_reloc.
2555 (struct bfd_target): New field _bfd_set_reloc.
2556 * bfd.c (bfd_set_reloc): Call backend _set_bfd.
2557 * reloc.c (_bfd_generic_set_reloc): New function.
2558 * coffcode.h (coff_set_reloc): Define to _bfd_generic_set_reloc.
2559 * nlm-target.h (nlm_set_reloc): Likewise.
2560 * coff-rs6000.c (_bfd_xcoff_set_reloc): Likewise.
2561 * aout-tic30.c (MY_set_reloc): Likewise.
2562 * aout-target.h (MY_set_reloc): Likewise.
2563 * elfxx-target.h (bfd_elfNN_set_reloc): Likewise.
2564 * coff-alpha.c (_bfd_ecoff_set_reloc): Likewise.
2565 * mach-o-target.c (bfd_mach_o_set_reloc): Likewise.
2566 * vms-alpha.c (alpha_vms_set_reloc): Likewise.
2567 * aout-adobe.c (aout_32_set_reloc): Likewise.
2568 * bout.c (b_out_set_reloc): Likewise.
2569 * coff-mips.c (_bfd_ecoff_set_reloc): Likewise.
2570 * i386os9k.c (aout_32_set_reloc): Likewise.
2571 * ieee.c (ieee_set_reloc): Likewise.
2572 * oasys.c (oasys_set_reloc): Likewise.
2573 * som.c (som_set_reloc): Likewise.
2574 * versados.c (versados_set_reloc): Likewise.
2575 * coff64-rs6000.c (rs6000_xcoff64_vec): Add
2576 _bfd_generic_set_reloc.
2577 (rs6000_xcoff64_aix_vec): LIkewise.
2578 * libbfd.c (_bfd_norelocs_set_reloc): New function.
2579 * libbfd-in.h: Prototype for _bfd_norelocs_set_reloc.
2580 * i386msdos.c (msdos_set_reloc): Define to
2581 _bfd_norelocs_set_reloc.
2582 * elfcode.h (elf_set_reloc): Define.
2583 * bfd-in2.h: Regenerated.
2584
2585 2017-05-10 H.J. Lu <hongjiu.lu@intel.com>
2586
2587 PR ld/21481
2588 * elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Use .plt.bnd
2589 for IFUNC function address.
2590
2591 2017-05-10 Claudiu Zissulescu <claziss@synopsys.com>
2592
2593 * elf32-arc.c (FEATURE_LIST_NAME): Define.
2594 (CONFLICT_LIST): Likewise.
2595 (opcode/arc-attrs.h): Include.
2596 (arc_elf_print_private_bfd_data): Print OSABI v4 flag.
2597 (arc_extract_features): New file.
2598 (arc_stralloc): Likewise.
2599 (arc_elf_merge_attributes): Likewise.
2600 (arc_elf_merge_private_bfd_data): Use object attributes.
2601 (bfd_arc_get_mach_from_attributes): New function.
2602 (arc_elf_object_p): Use object attributes.
2603 (arc_elf_final_write_processing): Likewise.
2604 (elf32_arc_obj_attrs_arg_type): New function.
2605 (elf32_arc_obj_attrs_handle_unknown): Likewise.
2606 (elf32_arc_section_from_shdr): Likewise.
2607 (elf_backend_obj_attrs_vendor): Define.
2608 (elf_backend_obj_attrs_section): Likewise.
2609 (elf_backend_obj_attrs_arg_type): Likewise.
2610 (elf_backend_obj_attrs_section_type): Likewise.
2611 (elf_backend_obj_attrs_handle_unknown): Likewise.
2612 (elf_backend_section_from_shdr): Likewise.
2613
2614 2017-05-09 Andrew Goedhart <Andrewgoedhart@simplepowersolutions.co.za>
2615
2616 PR ld/21458
2617 * elf32-arm.c (elf32_arm_final_link_relocate): Set the bottom bit
2618 of the value when resolving a R_ARM_THM_ALU_PREL_11_0 relocation
2619 and the destination is a Thumb symbol.
2620
2621 2017-05-08 H.J. Lu <hongjiu.lu@intel.com>
2622
2623 * elf32-i386.c (elf_i386_get_synthetic_symtab): Add missing
2624 initializer to silence GCC 4.2.
2625 * lf64-x86-64.c (elf_x86_64_get_synthetic_symtab): Likewise.
2626
2627 2017-05-08 H.J. Lu <hongjiu.lu@intel.com>
2628
2629 * elf64-x86-64.c (PLT_ENTRY_SIZE): Renamed to ...
2630 (LAZY_PLT_ENTRY_SIZE): This.
2631 (NON_LAZY_PLT_ENTRY_SIZE): New.
2632 (elf_x86_64_plt0_entry): Renamed to ...
2633 (elf_x86_64_lazy_plt0_entry): This.
2634 (elf_x86_64_plt_entry): Renamed to ...
2635 (elf_x86_64_lazy_plt_entry): This.
2636 (elf_x86_64_bnd_plt0_entry): Renamed to ...
2637 (elf_x86_64_lazy_bnd_plt0_entry): This.
2638 (elf_x86_64_legacy_plt_entry): Removed.
2639 (elf_x86_64_bnd_plt_entry): Renamed to ...
2640 (elf_x86_64_lazy_bnd_plt_entry): This.
2641 (elf_x86_64_legacy_plt2_entry): Renamed to ...
2642 (elf_x86_64_non_lazy_plt_entry): This.
2643 (elf_x86_64_bnd_plt2_entry): Renamed to ...
2644 (elf_x86_64_non_lazy_bnd_plt_entry): This.
2645 (elf_x86_64_eh_frame_plt): Renamed to ...
2646 (elf_x86_64_eh_frame_lazy_plt): This.
2647 (elf_x86_64_eh_frame_bnd_plt): Renamed to ...
2648 (elf_x86_64_eh_frame_lazy_bnd_plt): This.
2649 (elf_x86_64_eh_frame_plt_got): Renamed to ...
2650 (elf_x86_64_eh_frame_non_lazy_plt): This.
2651 (elf_x86_64_lazy_plt_layout): New.
2652 (elf_x86_64_non_lazy_plt_layout): Likewise.
2653 (elf_x86_64_plt_layout): Likewise.
2654 (elf_x86_64_backend_data): Remove PLT layout information. Add
2655 os for target system.
2656 (GET_PLT_ENTRY_SIZE): Removed.
2657 (elf_x86_64_lazy_plt): New.
2658 (elf_x86_64_non_lazy_plt): Likewise.
2659 (elf_x86_64_lazy_bnd_plt): Likewise.
2660 (elf_x86_64_non_lazy_bnd_plt): Likewise.
2661 (elf_x86-64_arch_bed): Updated.
2662 (elf_x86_64_link_hash_table): Add plt, lazy_plt and non_lazy_plt.
2663 (elf_x86_64_create_dynamic_sections): Removed.
2664 (elf_x86_64_check_relocs): Don't check elf.dynobj. Don't call
2665 _bfd_elf_create_ifunc_sections nor _bfd_elf_create_got_section.
2666 (elf_x86-64_adjust_dynamic_symbol): Updated.
2667 (elf_x86_64_allocate_dynrelocs): Updated. Pass 0 as PLT header
2668 size to _bfd_elf_allocate_ifunc_dyn_relocs and don't allocate
2669 size for PLT0 if there is no PLT0. Get plt_entry_size from
2670 non_lazy_plt for non-lazy PLT entries.
2671 (elf_x86_64_size_dynamic_sections): Updated. Get plt_entry_size
2672 from non_lazy_plt for non-lazy PLT entries.
2673 (elf_x86-64_relocate_section): Updated. Properly get PLT index
2674 if there is no PLT0.
2675 (elf_x86_64_finish_dynamic_symbol): Updated. Fill the first slot
2676 in the PLT entry with generic PLT layout. Fill the non-lazy PLT
2677 entries with non-lazy PLT layout. Don't fill the second and third
2678 slots in the PLT entry if there is no PLT0.
2679 (elf_x86_64_finish_dynamic_sections): Updated. Don't fill PLT0
2680 if there is no PLT0. Set sh_entsize on the .plt.got section.
2681 (compare_relocs): New.
2682 (elf_x86_64_plt_type): Likewise.
2683 (elf_x86_64_plt): Likewise.
2684 (elf_x86_64_nacl_plt): New. Forward declaration.
2685 (elf_x86_64_get_plt_sym_val): Removed.
2686 (elf_x86_64_get_synthetic_symtab): Rewrite to check PLT sections
2687 against all dynamic relocations.
2688 (elf_x86_64_link_setup_gnu_properties): New function.
2689 (elf_backend_create_dynamic_sections): Updated.
2690 (elf_backend_setup_gnu_properties): New.
2691 (elf_x86_64_nacl_plt): New.
2692 (elf_x86_64_nacl_arch_bed): Updated.
2693
2694 2017-05-08 H.J. Lu <hongjiu.lu@intel.com>
2695
2696 * elf32-i386.c (PLT_ENTRY_SIZE): Renamed to ...
2697 (LAZY_PLT_ENTRY_SIZE): This.
2698 (NON_LAZY_PLT_ENTRY_SIZE): New.
2699 (elf_i386_plt0_entry): Renamed to ...
2700 (elf_i386_lazy_plt0_entry): This.
2701 (elf_i386_plt_entry): Renamed to ...
2702 (elf_i386_lazy_plt_entry): This.
2703 (elf_i386_pic_plt0_entry): Renamed to ...
2704 (elf_i386_pic_lazy_plt0_entry): This.
2705 (elf_i386_pic_plt_entry): Renamed to ...
2706 (elf_i386_pic_lazy_plt_entry): This.
2707 (elf_i386_got_plt_entry): Renamed to ...
2708 (elf_i386_non_lazy_plt_entry): This.
2709 (elf_i386_pic_got_plt_entry): Renamed to ...
2710 (elf_i386_pic_non_lazy_plt_entry): This.
2711 (elf_i386_eh_frame_plt): Renamed to ...
2712 (elf_i386_eh_frame_lazy_plt): This.
2713 (elf_i386_eh_frame_plt_got): Renamed to ...
2714 (elf_i386_eh_frame_non_lazy_plt): This.
2715 (elf_i386_plt_layout): Renamed to ...
2716 (elf_i386_lazy_plt_layout): This. Remove eh_frame_plt_got and
2717 eh_frame_plt_got_size.
2718 (elf_i386_non_lazy_plt_layout): New.
2719 (elf_i386_plt_layout): Likewise.
2720 (elf_i386_non_lazy_plt): Likewise.
2721 (GET_PLT_ENTRY_SIZE): Removed.
2722 (elf_i386_plt): Renamed to ...
2723 (elf_i386_lazy_plt): This.
2724 (elf_i386_backend_data): Remove plt. Rename is_vxworks to os.
2725 (elf_i386_arch_bed): Updated.
2726 (elf_i386_link_hash_table): Add plt, lazy_plt and non_lazy_plt.
2727 (elf_i386_create_dynamic_sections): Removed.
2728 (elf_i386_check_relocs): Don't check elf.dynobj. Don't call
2729 _bfd_elf_create_ifunc_sections nor _bfd_elf_create_got_section.
2730 (elf_i386_adjust_dynamic_symbol): Updated.
2731 (elf_i386_allocate_dynrelocs): Updated. Pass 0 as PLT header
2732 size to _bfd_elf_allocate_ifunc_dyn_relocs and don't allocate
2733 size for PLT0 if there is no PLT0.
2734 (elf_i386_size_dynamic_sections): Updated. Check whether GOT
2735 output section is discarded only if GOT isn't empty.
2736 (elf_i386_relocate_section): Updated. Properly get PLT index
2737 if there is no PLT0.
2738 (elf_i386_finish_dynamic_symbol): Updated. Don't fill the
2739 second and third slots in the PLT entry if there is no PLT0.
2740 (elf_i386_finish_dynamic_sections): Updated. Don't fill PLT0
2741 if there is no PLT0. Set sh_entsize on the .plt.got section.
2742 (elf_i386_nacl_plt): Forward declaration.
2743 (elf_i386_get_plt_sym_val): Removed.
2744 (elf_i386_get_synthetic_symtab): Rewrite to check PLT sections
2745 against all dynamic relocations.
2746 (elf_i386_link_setup_gnu_properties): New function.
2747 (elf_backend_create_dynamic_sections): Updated.
2748 (elf_backend_setup_gnu_properties): New.
2749 (elf_i386_nacl_plt): Updated.
2750 (elf_i386_nacl_arch_bed): Likewise.
2751 (elf_i386_vxworks_arch_bed): Likewise.
2752
2753 2017-05-08 Thomas Preud'homme <thomas.preudhomme@arm.com>
2754
2755 * elflink.c (elf_output_implib): Remove executable flag from import
2756 library bfd.
2757 * elf32-arm.c (elf32_arm_filter_implib_symbols): Assert that the import
2758 library is a relocatable object file.
2759
2760 2017-05-01 Senthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com>
2761
2762 PR ld/21404
2763 * elf32-avr.c (avr_should_move_sym): New function.
2764 (avr_should_reduce_sym_size): Likewise.
2765 (avr_should_increase_sym_size): Likewise.
2766 (elf32_avr_relax_delete_bytes): Adjust symbol values
2767 and sizes by calling new functions.
2768
2769 2017-05-01 Palmer Dabbelt <palmer@dabbelt.com>
2770
2771 * config.bfd (riscv32-*): Enable rv64.
2772
2773 2017-05-02 Alan Modra <amodra@gmail.com>
2774
2775 PR 21384
2776 * elflink.c (bfd_elf_link_mark_dynamic_symbol): Test h->non_elf
2777 rather than h->root.type == bfd_link_hash_new.
2778 (bfd_elf_record_link_assignment): Similarly, call
2779 bfd_elf_link_mark_dynamic_symbol when h->non_elf.
2780
2781 2017-04-29 Alan Modra <amodra@gmail.com>
2782
2783 PR 21432
2784 * reloc.c (reloc_offset_in_range): New function.
2785 (bfd_perform_relocation, bfd_install_relocation): Use it.
2786 (_bfd_final_link_relocate): Likewise.
2787
2788 2017-04-28 H.J. Lu <hongjiu.lu@intel.com>
2789
2790 * elf32-i386.c (elf_i386_allocate_dynrelocs): Check plt_got
2791 before using .plt.got.
2792 * elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): Likewise.
2793
2794 2017-04-27 H.J. Lu <hongjiu.lu@intel.com>
2795
2796 * elf64-x86-64.c (elf_x86_64_size_dynamic_sections): Use "="
2797 instead of "+=" to update 0.
2798
2799 2017-04-27 H.J. Lu <hongjiu.lu@intel.com>
2800
2801 * elf32-i386.c (elf_i386_create_dynamic_sections): Create the
2802 .plt.got section here.
2803 (elf_i386_check_relocs): Don't create the .plt.got section.
2804 * elf64-x86-64.c (elf_x86_64_create_dynamic_sections): Create
2805 the .plt.got and .plt.bnd sections here.
2806 (elf_x86_64_check_relocs): Don't create the .plt.got nor
2807 .plt.bnd sections.
2808
2809 2017-04-27 H.J. Lu <hongjiu.lu@intel.com>
2810
2811 * elf64-x86-64.c (elf_x86_64_link_hash_entry): Remove
2812 has_bnd_reloc.
2813 (elf_x86_64_link_hash_newfunc): Don't clear has_bnd_reloc.
2814 (elf_x86_64_copy_indirect_symbol): Don't copy has_bnd_reloc.
2815 (elf_x86_64_check_relocs): Don't set has_bnd_reloc.
2816 (elf_x86_64_finish_dynamic_symbol): Check bndplt instead of
2817 has_bnd_reloc.
2818
2819 2017-04-27 H.J. Lu <hongjiu.lu@intel.com>
2820
2821 * elf-bfd.h (elf_backend_data): Change setup_gnu_properties
2822 to return bfd *.
2823 (_bfd_elf_link_setup_gnu_properties): Return bfd *.
2824 * elf-properties.c (_bfd_elf_link_setup_gnu_properties): Return
2825 the first relocatable ELF input with GNU properties.
2826
2827 2017-04-27 H.J. Lu <hongjiu.lu@intel.com>
2828
2829 * elf32-i386.c (elf_i386_finish_dynamic_sections): Simplify
2830 VxWorks for non-PIC.
2831
2832 2017-04-27 Alan Modra <amodra@gmail.com>
2833
2834 * elf-bfd.h (struct elf_backend_data): Make asection param of
2835 elf_backend_eh_frame_address_size const.
2836 (_bfd_elf_eh_frame_address_size): Likewise.
2837 * elf32-m32c.c (_bfd_m32c_elf_eh_frame_address_size): Likewise.
2838 * elf32-msp430.c (elf32_msp430_eh_frame_address_size): Likewise.
2839 * elfxx-mips.c (_bfd_mips_elf_eh_frame_address_size): Likewise.
2840 * elfxx-mips.h (_bfd_mips_elf_eh_frame_address_size): Likewise.
2841 * elf-eh-frame.c (_bfd_elf_eh_frame_address_size): Likewise.
2842 (next_cie_fde_offset): Constify params.
2843 (offset_adjust, adjust_eh_frame_local_symbols): Likewise.
2844
2845 2017-04-27 Alan Modra <amodra@gmail.com>
2846
2847 * elf-bfd.h (struct eh_cie_fde): Add aug_str_len and aug_data_len.
2848 (_bfd_elf_adjust_eh_frame_global_symbol): Declare.
2849 * elf-eh-frame.c (_bfd_elf_parse_eh_frame): Set aug_str_len and
2850 aug_data_len.
2851 (offset_adjust): New function.
2852 (_bfd_elf_adjust_eh_frame_global_symbol): Likewise.
2853 (adjust_eh_frame_local_symbols): Likewise.
2854 (_bfd_elf_discard_section_eh_frame): Call adjust_eh_frame_local_symbols
2855 after changing anything. Return true if anything changed.
2856 * elflink.c (bfd_elf_discard_info): If .eh_frame changed, call
2857 _bfd_elf_adjust_eh_frame_global_symbol for globals.
2858
2859 2017-04-27 Alan Modra <amodra@gmail.com>
2860
2861 * elflink.c (_bfd_elf_link_hash_hide_symbol): Clear dynstr_index
2862 when force_local.
2863
2864 2017-04-27 Alan Modra <amodra@gmail.com>
2865
2866 * elf32-ppc.c (UNDEFWEAK_NO_DYNAMIC_RELOC): Define.
2867 (ppc_elf_select_plt_layout, ppc_elf_tls_setup): Use it.
2868 (ppc_elf_adjust_dynamic_symbol, allocate_dynrelocs): Likewise.
2869 (ppc_elf_relocate_section): Likewise. Delete silly optimisation
2870 for undef and undefweak dyn_relocs.
2871 * elf64-ppc.c (UNDEFWEAK_NO_DYNAMIC_RELOC): Define.
2872 (ppc64_elf_adjust_dynamic_symbol, ppc64_elf_tls_setup): Use it.
2873 (allocate_got, allocate_dynrelocs): Likewise.
2874 (ppc64_elf_relocate_section): Likewise.
2875
2876 2017-04-26 H.J. Lu <hongjiu.lu@intel.com>
2877
2878 * elf32-i386.c (elf_i386_size_dynamic_sections): Alwasys add
2879 DT_PLTRELSZ, DT_PLTREL and DT_JMPREL for .rel.plt section.
2880 * elf64-x86-64.c (elf_x86_64_size_dynamic_sections): Alwasys
2881 add DT_PLTRELSZ, DT_PLTREL and DT_JMPREL for .rela.plt section.
2882
2883 2017-04-26 Nick Clifton <nickc@redhat.com>
2884
2885 PR binutils/21434
2886 * reloc.c (bfd_perform_relocation): Check for a negative address
2887 in the reloc.
2888
2889 2017-04-26 Maciej W. Rozycki <macro@imgtec.com>
2890
2891 PR ld/21334
2892 * elf-bfd.h (elf_backend_data): Add `always_renumber_dynsyms'
2893 member.
2894 * elfxx-target.h [!elf_backend_always_renumber_dynsyms]
2895 (elf_backend_always_renumber_dynsyms): Define.
2896 (elfNN_bed): Initialize `always_renumber_dynsyms' member.
2897 * elfxx-mips.h (elf_backend_always_renumber_dynsyms): Define.
2898 * elflink.c (bfd_elf_size_dynamic_sections): Also call
2899 `_bfd_elf_link_renumber_dynsyms' if the backend has requested
2900 it.
2901 (bfd_elf_size_dynsym_hash_dynstr): Likewise.
2902
2903 2017-04-26 Maciej W. Rozycki <macro@imgtec.com>
2904
2905 * elflink.c (bfd_elf_size_dynamic_sections): Only call
2906 `_bfd_elf_link_renumber_dynsyms' after section GC if dynamic
2907 sections have been created.
2908
2909 2017-04-26 Nick Clifton <nickc@redhat.com>
2910
2911 PR binutils/21431
2912 * compress.c (bfd_init_section_compress_status): Check the return
2913 value from bfd_malloc.
2914
2915 2017-04-24 H.J. Lu <hongjiu.lu@intel.com>
2916
2917 * elf64-x86-64.c (elf_x86_64_link_hash_entry): Add
2918 no_finish_dynamic_symbol.
2919 (elf_x86_64_link_hash_newfunc): Set no_finish_dynamic_symbol to
2920 0.
2921 (elf_x86_64_allocate_dynrelocs): If a symbol isn't undefined
2922 weak symbol, don't make it dynamic.
2923 (elf_x86_64_relocate_section): If a symbol isn't dynamic in PIC,
2924 set no_finish_dynamic_symbol and generate R_X86_64_RELATIVE
2925 relocation for GOT reference.
2926 (elf_x86_64_finish_dynamic_symbol): Abort if
2927 no_finish_dynamic_symbol isn't 0.
2928
2929 2017-04-24 H.J. Lu <hongjiu.lu@intel.com>
2930
2931 PR ld/21402
2932 * elf32-i386.c (elf_i386_allocate_dynrelocs): If a symbol isn't
2933 undefined weak symbol, don't make it dynamic.
2934 (elf_i386_relocate_section): If a symbol isn't dynamic in PIC,
2935 set no_finish_dynamic_symbol and generate R_386_RELATIVE
2936 relocation for R_386_GOT32.
2937
2938 2017-04-24 H.J. Lu <hongjiu.lu@intel.com>
2939
2940 PR ld/21425
2941 * elf32-i386.c (ELF_MAXPAGESIZE): Set to 0x1000 for VxWorks.
2942
2943 2017-04-23 Alan Modra <amodra@gmail.com>
2944
2945 PR 21414
2946 * section.c (GLOBAL_SYM_INIT): Make available in bfd.h.
2947 * elf.c (lcomm_sym): New.
2948 (_bfd_elf_large_com_section): Use lcomm_sym section symbol.
2949 * bfd-in2.h: Regenerate.
2950
2951 2017-04-23 Alan Modra <amodra@gmail.com>
2952
2953 PR 21412
2954 * elf-bfd.h (struct elf_backend_data <get_reloc_section>): Change
2955 parameters and comment.
2956 (_bfd_elf_get_reloc_section): Delete.
2957 (_bfd_elf_plt_get_reloc_section): Declare.
2958 * elf.c (_bfd_elf_plt_get_reloc_section, elf_get_reloc_section):
2959 New functions. Don't blindly skip over assumed .rel/.rela prefix.
2960 Extracted from..
2961 (_bfd_elf_get_reloc_section): ..here. Delete.
2962 (assign_section_numbers): Call elf_get_reloc_section.
2963 * elf64-ppc.c (elf_backend_get_reloc_section): Define.
2964 * elfxx-target.h (elf_backend_get_reloc_section): Update.
2965
2966 2017-04-23 Alan Modra <amodra@gmail.com>
2967
2968 PR 21409
2969 * dwarf2.c (_bfd_dwarf2_find_nearest_line): Don't segfault when
2970 no symbols.
2971
2972 2017-04-21 H.J. Lu <hongjiu.lu@intel.com>
2973
2974 PR ld/21402
2975 * elf32-i386.c (elf_i386_link_hash_entry): Add
2976 no_finish_dynamic_symbol.
2977 (elf_i386_link_hash_newfunc): Set no_finish_dynamic_symbol to 0.
2978 (elf_i386_allocate_dynrelocs): If a symbol isn't undefined weak
2979 symbol, don't make it dynamic in PIE.
2980 (elf_i386_relocate_section): If a symbol isn't dynamic in PIE,
2981 set no_finish_dynamic_symbol and generate R_386_RELATIVE
2982 relocation for R_386_GOT32
2983 (elf_i386_finish_dynamic_symbol): Abort if no_finish_dynamic_symbol
2984 isn't 0.
2985
2986 2017-04-21 H.J. Lu <hongjiu.lu@intel.com>
2987
2988 PR ld/19617
2989 PR ld/21086
2990 * elflink.c (elf_link_add_object_symbols): Require
2991 --no-dynamic-linker with -E/--dynamic-list when creating
2992 dynamic sections.
2993
2994 2017-04-20 Maciej W. Rozycki <macro@imgtec.com>
2995
2996 * elflink.c (_bfd_elf_symbol_refs_local_p): Always return TRUE
2997 if forced local.
2998
2999 2017-04-20 Maciej W. Rozycki <macro@imgtec.com>
3000
3001 * elfxx-mips.c (_bfd_mips_elf_final_link): Reorder comment about
3002 dynamic symbol sorting.
3003
3004 2017-04-20 H.J. Lu <hongjiu.lu@intel.com>
3005
3006 PR ld/21382
3007 * elflink.c (elf_link_add_object_symbols): Preserve
3008 dynamic_ref_after_ir_def when restoring the symbol table for
3009 unneeded dynamic object.
3010
3011 2017-04-19 H.J. Lu <hongjiu.lu@intel.com>
3012
3013 PR ld/21401
3014 * elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Don't abort
3015 on on undefined IFUNC symbol in the second PLT.
3016
3017 2017-04-19 Wedson Almeida Filho <wedsonaf@gmail.com>
3018
3019 * peXXigen.c (pe_print_reloc): Correct chunk_end.
3020
3021 2017-04-19 Alan Modra <amodra@gmail.com>
3022
3023 * elflink.c (_bfd_elf_adjust_dynamic_symbol): Hide undefweak
3024 or make dynamic for info->dynamic_undefined_weak 0 and 1.
3025 * elf32-ppc.c:Formatting.
3026 (ensure_undefweak_dynamic): Don't make dynamic when
3027 info->dynamic_undefined_weak is zero.
3028 (allocate_dynrelocs): Discard undefweak dyn_relocs for
3029 info->dynamic_undefined_weak. Discard undef dyn_relocs when
3030 not default visibility. Discard undef and undefweak
3031 dyn_relocs earlier.
3032 (ppc_elf_relocate_section): Adjust to suit.
3033 * elf64-ppc.c: Formatting.
3034 (ensure_undefweak_dynamic): Don't make dynamic when
3035 info->dynamic_undefined_weak is zero.
3036 (allocate_dynrelocs): Discard undefweak dyn_relocs for
3037 info->dynamic_undefined_weak. Discard them earlier.
3038
3039 2017-04-17 H.J. Lu <hongjiu.lu@intel.com>
3040
3041 PR ld/21389
3042 * elflink.c (bfd_elf_size_dynamic_sections): Get soname index
3043 before generating the version definition section.
3044
3045 2017-04-17 Alan Modra <amodra@gmail.com>
3046
3047 * elflink.c (_bfd_elf_merge_symbol): Undo dynamic linking
3048 state when a regular object file defines a symbol with
3049 incompatible type to that defined by an earlier shared lib.
3050
3051 2017-04-13 Alan Modra <amodra@gmail.com>
3052
3053 * coffcode.h: Wrap some overly long _bfd_error_handler args.
3054 * elf.c: Likewise.
3055 * elf32-arm.c: Likewise.
3056 * elf32-i386.c: Likewise.
3057 * elf32-mep.c: Likewise.
3058 * elf64-ia64-vms.c: Likewise.
3059 * elf64-x86-64.c: Likewise.
3060 * elflink.c: Likewise.
3061 * elfnn-ia64.c: Likewise.
3062 * elfxx-mips.c: Likewise.
3063
3064 2017-04-13 Alan Modra <amodra@gmail.com>
3065
3066 * aoutx.h: Use %B and %A in error messages throughout file.
3067 * aout-cris.c: Likewise.
3068 * archive.c: Likewise.
3069 * binary.c: Likewise.
3070 * coff-rs6000.c: Likewise.
3071 * coff-tic4x.c: Likewise.
3072 * coffcode.h: Likewise.
3073 * coffgen.c: Likewise.
3074 * cofflink.c: Likewise.
3075 * coffswap.h: Likewise.
3076 * cpu-arm.c: Likewise.
3077 * elf-eh-frame.c: Likewise.
3078 * elf-m10300.c: Likewise.
3079 * elf.c: Likewise.
3080 * elf32-arc.c: Likewise.
3081 * elf32-arm.c: Likewise.
3082 * elf32-bfin.c: Likewise.
3083 * elf32-frv.c: Likewise.
3084 * elf32-iq2000.c: Likewise.
3085 * elf32-m32c.c: Likewise.
3086 * elf32-microblaze.c: Likewise.
3087 * elf32-nds32.c: Likewise.
3088 * elf32-rl78.c: Likewise.
3089 * elf32-rx.c: Likewise.
3090 * elf32-score.c: Likewise.
3091 * elf32-score7.c: Likewise.
3092 * elf32-sh64.c: Likewise.
3093 * elf32-v850.c: Likewise.
3094 * elf32-vax.c: Likewise.
3095 * elf32-visium.c: Likewise.
3096 * elf64-ia64-vms.c: Likewise.
3097 * elf64-mmix.c: Likewise.
3098 * elf64-sh64.c: Likewise.
3099 * elfcode.h: Likewise.
3100 * elfnn-aarch64.c: Likewise.
3101 * elfnn-ia64.c: Likewise.
3102 * elfxx-mips.c: Likewise.
3103 * hpux-core.c: Likewise.
3104 * ieee.c: Likewise.
3105 * ihex.c: Likewise.
3106 * linker.c: Likewise.
3107 * merge.c: Likewise.
3108 * mmo.c: Likewise.
3109 * oasys.c: Likewise.
3110 * pdp11.c: Likewise.
3111 * peXXigen.c: Likewise.
3112 * rs6000-core.c: Likewise.
3113 * vms-alpha.c: Likewise.
3114 * xcofflink.c: Likewise.
3115
3116 2017-04-13 Alan Modra <amodra@gmail.com>
3117
3118 * bfd.c (PRINT_TYPE): Define.
3119 (_doprnt): New function.
3120 (error_handler_internal): Use _doprnt.
3121 * coff-arm.c: Put %A and %B arguments to _bfd_error_handler
3122 calls in their natural order, throughout file.
3123 * coff-mcore.c: Likewise.
3124 * coff-ppc.c: Likewise.
3125 * coff-tic80.c: Likewise.
3126 * cofflink.c: Likewise.
3127 * elf-s390-common.c: Likewise.
3128 * elf.c: Likewise.
3129 * elf32-arm.c: Likewise.
3130 * elf32-i386.c: Likewise.
3131 * elf32-m32r.c: Likewise.
3132 * elf32-msp430.c: Likewise.
3133 * elf32-spu.c: Likewise.
3134 * elf64-ia64-vms.c: Likewise.
3135 * elf64-sparc.c: Likewise.
3136 * elf64-x86-64.c: Likewise.
3137 * elflink.c: Likewise.
3138 * elfnn-aarch64.c: Likewise.
3139 * elfnn-ia64.c: Likewise.
3140 * elfxx-mips.c: Likewise.
3141
3142 2017-04-13 Alan Modra <amodra@gmail.com>
3143
3144 * elf32-arm.c (arm_type_of_stub): Supply missing args to "long
3145 branch veneers" error. Fix double space and format message.
3146 * elf32-avr.c (avr_add_stub): Do not pass NULL as %B arg.
3147 * elf64-ppc.c (tocsave_find): Supply missing %B arg.
3148
3149 2017-04-13 Alan Modra <amodra@gmail.com>
3150
3151 * bfd-in2.h: Regenerate.
3152
3153 2017-04-11 H.J. Lu <hongjiu.lu@intel.com>
3154
3155 * elf-properties.c (_bfd_elf_parse_gnu_properties): Remove the
3156 extra `\n' in warning/error messages.
3157 * elf32-i386.c (elf_i386_parse_gnu_properties): Likewise.
3158 * elf64-x86-64.c (elf_x86_64_parse_gnu_properties): Likewise.
3159
3160 2017-04-11 H.J. Lu <hongjiu.lu@intel.com>
3161
3162 * elf-properties.c (_bfd_elf_parse_gnu_properties): Ignore
3163 processor-specific properties with generic ELF target vector.
3164
3165 2017-04-10 Qing Zhao <qing.zhao@oracle.com>
3166
3167 * elf32-sparc.c (elf_backend_fixup_symbol): New.
3168 * elf64-sparc.c (elf_backend_fixup_symbol): New.
3169 * elfxx-sparc.c (UNDEFINED_WEAK_RESOLVED_TO_ZERO): New.
3170 (_bfd_sparc_elf_link_hash_entry): Add has_got_reloc and
3171 has_non_got_reloc.
3172 (link_hash_newfunc): Initialize has_got_reloc and
3173 has_non_got_reloc.
3174 (_bfd_sparc_elf_size_dynamic_sections): Set interp to .interp
3175 section.
3176 (_bfd_sparc_elf_copy_indirect_symbol): Copy has_got_reloc and
3177 has_non_got_reloc.
3178 (_bfd_sparc_elf_check_relocs): Set has_got_reloc and
3179 has_non_got_reloc.
3180 (_bfd_sparc_elf_fixup_symbol): New function.
3181 (allocate_dynrelocs): Don't allocate space for dynamic
3182 relocations and discard relocations against resolved undefined
3183 weak symbols in executable. Don't make resolved undefined weak
3184 symbols in executable dynamic. Keep dynamic non-GOT/non-PLT
3185 relocation against undefined weak symbols in PIE.
3186 (_bfd_sparc_elf_relocate_section): Don't generate dynamic
3187 relocations against resolved undefined weak symbols in PIE
3188 (_bfd_sparc_elf_finish_dynamic_symbol): Keep PLT/GOT entries
3189 without ynamic PLT/GOT relocations for resolved undefined weak
3190 symbols.
3191 Don't generate dynamic relocation against resolved undefined
3192 weak symbol in executable.
3193 (pie_finish_undefweak_symbol): New function.
3194 (_bfd_sparc_elf_finish_dynamic_sections): Call
3195 pie_finish_undefweak_symbol on all symbols in PIE.
3196 * elfxx-sparc.h (_bfd_sparc_elf_link_hash_table): Add interp.
3197 (_bfd_sparc_elf_fixup_symbol): New function.
3198
3199 2017-04-10 Nick Clifton <nickc@redhat.com>
3200
3201 * config.bfd: Remove ns32k from obsolete list.
3202
3203 2017-04-10 Alan Modra <amodra@gmail.com>
3204
3205 PR 21287
3206 * elf.c (special_sections_f): Match .fini_array and .fini_array.*.
3207 (special_sections_i): Likewise for .init_array.
3208 (special_sections_p): Likewise for .preinit_array.
3209
3210 2017-04-07 H.J. Lu <hongjiu.lu@intel.com>
3211
3212 PR ld/19579
3213 PR ld/21306
3214 * elf32-s390.c (elf_s390_finish_dynamic_symbol): Check
3215 ELF_COMMON_DEF_P for common symbols.
3216 * elf64-s390.c (elf_s390_finish_dynamic_symbol): Likewise.
3217 * elf64-x86-64.c (elf_x86_64_relocate_section): Likewise.
3218 * elflink.c (_bfd_elf_merge_symbol): Revert commits
3219 202ac193bbbecc96a4978d1ac3d17148253f9b01 and
3220 07492f668d2173da7a2bda3707ff0985e0f460b6.
3221
3222 2017-04-07 Pedro Alves <palves@redhat.com>
3223
3224 * opncls.c (bfd_get_debug_link_info): Rename to...
3225 (bfd_get_debug_link_info_1): ... this. Change type of second
3226 parameter to void pointer. Adjust.
3227 (bfd_get_debug_link_info): Reimplement on top of
3228 bfd_get_debug_link_info_1.
3229 (separate_debug_file_exists, separate_alt_debug_file_exists):
3230 Change type of second parameter to void pointer. Adjust.
3231 (get_func_type, check_func_type): Change type of second parameter
3232 to void pointer.
3233 (find_separate_debug_file): Add 'func_data' parameter. Pass it to
3234 the callback functions instead of passing the address of a local.
3235 (bfd_follow_gnu_debuglink): Pass address of unsigned long local to
3236 find_separate_debug_file.
3237 (get_alt_debug_link_info_shim): Change type of second parameter to
3238 void pointer. Adjust.
3239 (bfd_follow_gnu_debugaltlink): Adjust to pass NULL to
3240 find_separate_debug_file.
3241 (get_build_id_name, bfd_boolean check_build_id_file): Change type
3242 of second parameter to void pointer. Adjust.
3243 (bfd_follow_build_id_debuglink): Pass address of bfd_build_id
3244 pointer local to find_separate_debug_file.
3245
3246 2017-04-07 Tristan Gingold <gingold@gingold-Precision-7510>
3247
3248 * coffgen.c (_bfd_coff_gc_mark_hook): Handle PE weak
3249 external symbols with a definition.
3250 (_bfd_coff_gc_mark_extra_sections): Fix typo.
3251
3252 2017-04-07 Alan Modra <amodra@gmail.com>
3253
3254 * po/SRC-POTFILES.in: Regenerate.
3255
3256 2017-04-05 Alan Modra <amodra@gmail.com>
3257
3258 * elf64-ppc.c (ppc64_elf_gc_sweep_hook): Support ELFv2 PLT
3259 reference counting.
3260
3261 2017-04-02 Jon Turney <jon.turney@dronecode.org.uk>
3262
3263 (_bfd_XXi_swap_aouthdr_out): For clarity, use defines rather than
3264 numbers for DataDirectory entry indicies passed to
3265 add_data_entry().
3266
3267 2017-04-04 H.J. Lu <hongjiu.lu@intel.com>
3268
3269 * elf.c (get_program_header_size): Add a GNU_MBIND segment for
3270 each GNU_MBIND section and align GNU_MBIND section to page size.
3271 (_bfd_elf_map_sections_to_segments): Create a GNU_MBIND
3272 segment for each GNU_MBIND section.
3273 (_bfd_elf_init_private_section_data): Copy sh_info from input
3274 for GNU_MBIND section.
3275
3276 2017-04-03 Palmer Dabbelt <palmer@dabbelt.com>
3277
3278 * elfnn-riscv.c (GP_NAME): Delete.
3279 (riscv_global_pointer_value): Change GP_NAME to RISCV_GP_SYMBOL.
3280 (_bfd_riscv_relax_lui): Likewise.
3281
3282 2017-04-04 Nick Clifton <nickc@redhat.com>
3283
3284 PR binutils/21342
3285 * elflink.c (_bfd_elf_define_linkage_sym): Prevent null pointer
3286 dereference.
3287 (bfd_elf_final_link): Only initialize the extended symbol index
3288 section if there are extended symbol tables to list.
3289
3290 2017-04-03 H.J. Lu <hongjiu.lu@intel.com>
3291
3292 * Makefile.am (BFD32_BACKENDS): Add elf-properties.lo.
3293 (BFD32_BACKENDS_CFILES): Add elf-properties.c.
3294 * configure.ac (elf): Add elf-properties.lo.
3295 * Makefile.in: Regenerated.
3296 * configure: Likewise.
3297 * elf-bfd.h (elf_property_kind): New.
3298 (elf_property): Likewise.
3299 (elf_property_list): Likewise.
3300 (elf_properties): Likewise.
3301 (_bfd_elf_parse_gnu_properties): Likewise.
3302 (_bfd_elf_get_property): Likewise.
3303 (_bfd_elf_link_setup_gnu_properties): Likewise.
3304 (elf_backend_data): Add parse_gnu_properties, merge_gnu_properties
3305 and setup_gnu_properties.
3306 (elf_obj_tdata): Add properties.
3307 * elf-properties.c: New file.
3308 * elf32-i386.c (elf_i386_parse_gnu_properties): New.
3309 (elf_i386_merge_gnu_properties): Likewise.
3310 (elf_backend_parse_gnu_properties): Likewise.
3311 (elf_backend_merge_gnu_properties): Likewise.
3312 * elf64-x86-64.c (elf_x86_64_parse_gnu_properties): Likewise.
3313 (elf_x86_64_merge_gnu_properties): Likewise.
3314 (elf_backend_parse_gnu_properties): Likewise.
3315 (elf_backend_merge_gnu_properties): Likewise.
3316 * elfxx-target.h (elf_backend_merge_gnu_properties): Likewise.
3317 (elf_backend_parse_gnu_properties): Likewise.
3318 (elf_backend_setup_gnu_properties): Likewise.
3319 (elfNN_bed): Add elf_backend_parse_gnu_properties,
3320 elf_backend_merge_gnu_properties and
3321 elf_backend_setup_gnu_properties.
3322
3323 2017-03-30 Pip Cet <pipcet@gmail.com>
3324
3325 * elf32-wasm32.c: Add relocation code, two relocs.
3326 * reloc.c: Add wasm32 relocations.
3327 * libbfd.h: Regenerate.
3328 * bfd-in2.h: Regenerate.
3329 * bfd/po/bfd.pot: Regenerate.
3330
3331 2017-03-29 Nick Clifton <nickc@redhat.com>
3332
3333 PR binutils/18025
3334 * coff-bfd.h (struct coff_section_data): Add new fields:
3335 saved_bias and bias.
3336 * coffgen.c (coff_find_nearest_line_with_names): Cache the bias
3337 computed for PE binaries.
3338 * dwarf2.c (scan_unit_for_symbols): Only warn once about each
3339 missing abbrev.
3340
3341 2017-03-28 Hans-Peter Nilsson <hp@axis.com>
3342
3343 PR ld/16044
3344 * elf32-cris.c (elf_cris_adjust_gotplt_to_got): Adjust BFD_ASSERT
3345 to handle a local symbol with a hash-symbol-entry; without PLT.
3346 Add BFD_ASSERT for an incidental case with GOT entry present.
3347 (cris_elf_check_relocs): Increment PLT refcount only if the symbol
3348 isn't forced-or-set local.
3349
3350 2017-03-27 Pip Cet <pipcet@gmail.com>
3351
3352 * wasm-module.c: New file to support WebAssembly modules.
3353 * wasm-module.h: New file to support WebAssembly modules.
3354 * doc/webassembly.texi: Start documenting wasm-module.c.
3355 * config.bfd: Add wasm_vec.
3356 * targets.c: Likewise.
3357 * configure.ac: Likewise.
3358 * Makefile.am: Add entries for wasm-module.c.
3359 * Makefile.in: Regenerate.
3360 * configure: Regenerate.
3361 * po/SRC-POTFILES.in: Regenerate.
3362
3363 2017-03-27 Pip Cet <pipcet@gmail.com>
3364
3365 * cpu-wasm32.c: New file to support wasm32 architecture.
3366 * elf32-wasm32.c: New file to support wasm32 architecture.
3367 * Makefile.am: Add wasm32 architecture.
3368 * archures.c: Likewise.
3369 * config.bfd: Likewise.
3370 * configure.ac: Likewise.
3371 * targets.c: Likewise.
3372 * Makefile.in: Regenerate.
3373 * bfd-in2.h: Regenerate.
3374 * configure: Regenerate.
3375 * po/SRC-POTFILES.in: Regenerate.
3376
3377 2017-03-20 Alan Modra <amodra@gmail.com>
3378
3379 PR 21266
3380 * elf64-ppc.c (compare_symbols): Stabilize sort.
3381
3382 2017-03-18 Alan Modra <amodra@gmail.com>
3383
3384 * elf64-ppc.c (struct ppc_link_hash_table): Add
3385 local_ifunc_resolver and maybe_local_ifunc_resolver.
3386 (ppc_build_one_stub): Set flags on emitting dynamic
3387 relocation to ifunc.
3388 (ppc64_elf_relocate_section): Likewise.
3389 (ppc64_elf_finish_dynamic_symbol): Likewise.
3390 (ppc64_elf_finish_dynamic_sections): Error on DT_TEXTREL with
3391 local dynamic relocs to ifuncs.
3392 * elf32-ppc.c (struct ppc_elf_link_hash_table): Add
3393 local_ifunc_resolver and maybe_local_ifunc_resolver.
3394 (ppc_elf_relocate_section): Set flag on emitting dynamic
3395 relocation to ifuncs.
3396 (ppc_elf_finish_dynamic_symbol): Likewise.
3397 (ppc_elf_finish_dynamic_sections): Error on DT_TEXTREL with local
3398 dynamic relocs to ifuncs.
3399
3400 2017-03-13 Nick Clifton <nickc@redhat.com>
3401
3402 PR binutils/21202
3403 * reloc.c (BFD_RELOC_AARCH64_TLSDESC_LD64_LO12_NC): Rename to
3404 BFD_RELOC_AARCH64_TLSDESC_LD64_LO12.
3405 (BFD_RELOC_AARCH64_TLSDESC_ADD_LO12_NC): Rename to
3406 BFD_RELOC_AARCH64_TLSDESC_ADD_LO12.
3407 * bfd-in2.h: Regenerate.
3408 * libbfd.h: Regenerate.
3409 * elfnn-aarch64.c (IS_AARCH64_TLS_RELAX_RELOC): Update reloc
3410 names.
3411 (IS_AARCH64_TLSDESC_RELOC): Likewise.
3412 (elfNN_aarch64_howto_table): Likewise.
3413 (aarch64_tls_transition_without_check): Likewise.
3414 (aarch64_reloc_got_type): Likewise.
3415 (elfNN_aarch64_final_link_relocate): Likewise.
3416 (elfNN_aarch64_tls_relax): Likewise.
3417 (elfNN_aarch64_relocate_section): Likewise.
3418 (elfNN_aarch64_gc_sweep_hook): Likewise.
3419 (elfNN_aarch64_check_relocs): Likewise.
3420 * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.
3421 (_bfd_aarch64_elf_resolve_relocation): Likewise.
3422
3423 2017-03-11 Alan Modra <amodra@gmail.com>
3424
3425 * elf32-ppc.c: Remove ATTRIBUTE_UNUSED throughout when function
3426 parameter is in fact used. Whitespace fixes.
3427 * elf64-ppc.c: Likewise.
3428
3429 2017-03-09 Sam Thursfield <sam.thursfield@codethink.co.uk>
3430
3431 * rs6000-core.c (CORE_NEW): Simplify macro when
3432 AIX_CORE_DUMPX_CORE and BFD64 are true to avoid compile warning.
3433
3434 2017-03-07 Alan Modra <amodra@gmail.com>
3435
3436 PR 21224
3437 PR 20519
3438 * elf64-ppc.c (ppc64_elf_relocate_section): Add missing
3439 dyn_relocs check.
3440
3441 2017-03-05 Alan Modra <amodra@gmail.com>
3442
3443 * elf-bfd.h (struct eh_cie_fde): Add u.cie.per_encoding_aligned8.
3444 * elf-eh-frame.c (size_of_output_cie_fde): Don't align here.
3445 (next_cie_fde_offset): New function.
3446 (_bfd_elf_parse_eh_frame): Set u.cie.per_encoding_aligned8.
3447 (_bfd_elf_discard_section_eh_frame): Align zero terminator to
3448 four bytes. Align CIEs to four or eight bytes depending on
3449 per_encoding_aligned8. Align FDEs according to their encoding.
3450 Pad last FDE to output section alignment.
3451 (_bfd_elf_write_section_eh_frame): Adjust to suit. Remove
3452 assertion.
3453 * elf64-ppc.c (glink_eh_frame_cie): Delete padding.
3454 (ppc64_elf_size_stubs): Pad glink eh_frame as per elf-eh-frame.c.
3455 (ppc64_elf_finish_dynamic_sections): Adjust to suit.
3456
3457 2017-03-02 Martin Bickel <binutils@ineranves.de>
3458
3459 PR ld/21212
3460 * elf.c (rewrite_elf_program_header): Do not issue a warning for
3461 empty segments which have a zero filesz, but a non-zero memsz.
3462
3463 2017-03-02 Alan Modra <amodra@gmail.com>
3464
3465 * elf32-ppc.c (ppc_elf_vle_split16): Correct insn mask typo.
3466
3467 2017-02-28 Alan Modra <amodra@gmail.com>
3468
3469 * elf64-ppc.c (ppc64_elf_ha_reloc): Revert last change.
3470 (ppc64_elf_relocate_section): Likewise.
3471
3472 2017-02-28 Alan Modra <amodra@gmail.com>
3473
3474 PR 20995
3475 * elf32-nios2.c (nios2_elf32_relocate_section): Use htab
3476 rather than elf32_nios2_hash_table or elf_hash_table.
3477 (create_got_section): Likewise.
3478 (nios2_elf32_finish_dynamic_symbol): Likewise.
3479 (nios2_elf32_adjust_dynamic_symbol): Likewise.
3480 (nios2_elf32_size_dynamic_sections): Likewise.
3481 (nios2_elf32_check_relocs): Delete dynobj, sgot, and srelgot
3482 vars. Use htab equivalents directly instead. Don't create
3483 all dynamic sections on needing just the GOT. Use a goto
3484 rather than a fall-through with reloc test. Ensure
3485 htab->dynobj is set when making dynamic sreloc section.
3486 (nios2_elf32_finish_dynamic_sections): Delete dynobj, use htab
3487 equivalent directly instead. Don't segfault on looking for
3488 .dynamic when dynamic sections have not been created. Don't
3489 segfault on .got.plt being discarded.
3490 (nios2_elf32_size_dynamic_sections): Delete plt and got vars.
3491 Don't set "relocs" on .rela.plt. Do handle .sbss. Delete
3492 fixme and another not so relevant comment.
3493 (nios2_elf_add_symbol_hook): Delete dynobj var. If not
3494 already set, set hash table dynobj on creating .sbss.
3495
3496 2017-02-28 Alan Modra <amodra@gmail.com>
3497
3498 * reloc.c (BFD_RELOC_PPC_16DX_HA): New.
3499 * elf64-ppc.c (ppc64_elf_howto_raw <R_PPC64_16DX_HA>): New howto.
3500 (ppc64_elf_reloc_type_lookup): Translate new bfd reloc.
3501 (ppc64_elf_ha_reloc): Correct overflow test on REL16DX_HA.
3502 (ppc64_elf_relocate_section): Likewise.
3503 * elf32-ppc.c (ppc_elf_howto_raw <R_PPC_16DX_HA>): New howto.
3504 (ppc_elf_reloc_type_lookup): Translate new bfd reloc.
3505 (ppc_elf_check_relocs): Handle R_PPC_16DX_HA to pacify gcc.
3506 * libbfd.h: Regenerate.
3507 * bfd-in2.h: Regenerate.
3508
3509 2017-02-28 Alan Modra <amodra@gmail.com>
3510
3511 * elflink.c (_bfd_elf_create_dynamic_sections): Don't make
3512 dynamic .data.rel.ro read-only.
3513 * elf32-arm.c (elf32_arm_finish_dynamic_symbol): Compare section
3514 rather than section flags when deciding where copy reloc goes.
3515 * elf32-cris.c (elf_cris_finish_dynamic_symbol): Likewise.
3516 * elf32-hppa.c (elf32_hppa_finish_dynamic_symbol): Likewise.
3517 * elf32-i386.c (elf_i386_finish_dynamic_symbol): Likewise.
3518 * elf32-metag.c (elf_metag_finish_dynamic_symbol): Likewise.
3519 * elf32-microblaze.c (microblaze_elf_finish_dynamic_symbol): Likewise.
3520 * elf32-nios2.c (nios2_elf32_finish_dynamic_symbol): Likewise.
3521 * elf32-or1k.c (or1k_elf_finish_dynamic_symbol): Likewise.
3522 * elf32-ppc.c (ppc_elf_finish_dynamic_symbol): Likewise.
3523 * elf32-s390.c (elf_s390_finish_dynamic_symbol): Likewise.
3524 * elf32-tic6x.c (elf32_tic6x_finish_dynamic_symbol): Likewise.
3525 * elf32-tilepro.c (tilepro_elf_finish_dynamic_symbol): Likewise.
3526 * elf64-ppc.c (ppc64_elf_finish_dynamic_symbol): Likewise.
3527 * elf64-s390.c (elf_s390_finish_dynamic_symbol): Likewise.
3528 * elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Likewise.
3529 * elfnn-aarch64.c (elfNN_aarch64_finish_dynamic_symbol): Likewise.
3530 * elfnn-riscv.c (riscv_elf_finish_dynamic_symbol): Likewise.
3531 * elfxx-mips.c (_bfd_mips_vxworks_finish_dynamic_symbol): Likewise.
3532 * elfxx-sparc.c (_bfd_sparc_elf_finish_dynamic_symbol): Likewise.
3533 * elfxx-tilegx.c (tilegx_elf_finish_dynamic_symbol): Likewise.
3534
3535 2017-02-28 Maciej W. Rozycki <macro@imgtec.com>
3536
3537 * elfxx-mips.c (mips_elf_perform_relocation): Also handle the
3538 `jalr $0, $25' instruction encoding.
3539
3540 2017-02-27 Nick Clifton <nickc@redhat.com>
3541
3542 PR ld/21180
3543 * elf32-microblaze.c (microblaze_elf_finish_dynamic_symbol): Avoid
3544 generating a seg-fault when encountering a symbol that has been
3545 deleted by garbage collection.
3546
3547 2017-02-25 Alan Modra <amodra@gmail.com>
3548
3549 * elf32-arc.c (struct dynamic_sections): Delete.
3550 (enum dyn_section_types): Delete.
3551 (dyn_section_names): Delete.
3552 (arc_create_dynamic_sections): Delete.
3553 (elf_arc_finish_dynamic_sections): Don't call the above. Don't
3554 segfault on discarded .rela.plt section.
3555 (elf_arc_size_dynamic_sections): Formatting. Don't call
3556 arc_create_dynamic_sections. Don't allocate memory for sections
3557 handled by the generic linker. Correct code finding relocs in
3558 read-only sections. Set SEC_EXCLUDE on zero size .got,
3559 .got.plt, and .dynbss sections. Do set .interp for pies.
3560
3561 2017-02-24 Andrew Waterman <andrew@sifive.com>
3562
3563 * elfnn-riscv.c (GP_NAME): New macro.
3564 (riscv_global_pointer_value): Use it.
3565 (_bfd_riscv_relax_lui): If symbol and global pointer are in same
3566 output section, consider only that section's alignment.
3567
3568 2017-02-23 Maciej W. Rozycki <macro@imgtec.com>
3569
3570 * elfxx-mips.h (_bfd_mips_relax_section): Remove prototype.
3571 * elfxx-mips.c (_bfd_mips_relax_section): Remove function.
3572 * elf64-mips.c (bfd_elf64_bfd_relax_section): Remove macro.
3573 * elfn32-mips.c (bfd_elf32_bfd_relax_section): Likewise.
3574
3575 2017-02-23 Maciej W. Rozycki <macro@imgtec.com>
3576
3577 * elfxx-mips.c (mips_elf_calculate_relocation) <R_MIPS_JALR>
3578 <R_MICROMIPS_JALR>: Discard relocation if `cross_mode_jump_p'
3579 or misaligned.
3580
3581 2017-02-23 Alan Modra <amodra@gmail.com>
3582
3583 PR 20744
3584 * elf32-ppc.c (ppc_elf_howto_raw): Correct dst_mask on all VLE
3585 16D relocations.
3586 (ppc_elf_vle_split16): Correct field mask and shift for 16D relocs.
3587 (ppc_elf_relocate_section): Correct calculation for VLE SDAREL
3588 relocs.
3589
3590 2017-02-22 Maciej W. Rozycki <macro@imgtec.com>
3591
3592 PR ld/20828
3593 * elflink.c (bfd_elf_size_dynamic_sections): Move symbol version
3594 processing ahead of the call to `elf_gc_sweep_symbol'.
3595
3596 2017-02-22 Nick Clifton <nickc@redhat.com>
3597
3598 PR binutils/21193
3599 * opncls.c (bfd_create_gnu_debuglink_section): Give the newly
3600 created section 4-byte alignment.
3601
3602 2017-02-22 Alan Modra <amodra@gmail.com>
3603
3604 * elf64-ppc.c (ppc64_elf_finish_dynamic_sections): Don't segfault
3605 on .got or .plt output section being discarded by script.
3606 * elf32-ppc.c (ppc_elf_finish_dynamic_sections): Likewise. Move
3607 vxworks splt temp.
3608
3609 2017-02-21 Alan Modra <amodra@gmail.com>
3610
3611 * elf64-alpha.c (elf64_alpha_size_dynamic_sections): Only emit
3612 DT_RELA, DT_RELASZ, and DT_RELAENT when DT_RELASZ is non-zero.
3613
3614 2017-02-20 Alan Modra <amodra@gmail.com>
3615
3616 PR 21181
3617 * elflink.c (bfd_elf_final_link): Make DT_REL/DT_RELA zero
3618 if DT_RELSZ/DT_RELASZ is zero.
3619
3620 2017-02-17 Nick Clifton <nickc@redhat.com>
3621
3622 * compress.c (bfd_get_full_section_contents): Remember to reduce
3623 compressed size by the sizeof the compression header when
3624 decompressing the contents.
3625
3626 2017-02-17 Pedro Alves <palves@redhat.com>
3627
3628 * srec.c (Chunk): Rename to ...
3629 (_bfd_srec_len): ... this.
3630 (S3Forced): Rename to ...
3631 (_bfd_srec_forceS3): ... this.
3632 * objcopy.c: Adjust all references.
3633
3634 2017-02-17 Pedro Alves <palves@redhat.com>
3635
3636 * archive.c (bsd_write_armap): Rename to ...
3637 (_bfd_bsd_write_armap): ... this.
3638 (coff_write_armap): Rename to ...
3639 (_bfd_coff_write_armap): ... this.
3640 * libbfd-in.h (bsd_write_armap): Rename to ...
3641 (_bfd_bsd_write_armap): ... this.
3642 (coff_write_armap): Rename to ...
3643 (_bfd_coff_write_armap): ... this.
3644 * aout-target.h, aout-tic30.c: Adjust all users.
3645 * libbfd.h: Regenerate.
3646
3647 2017-02-17 Pedro Alves <palves@redhat.com>
3648
3649 * bfd-in.h (bfd_read, bfd_write): Adjust to rename.
3650 (warn_deprecated): Rename to ...
3651 (_bfd_warn_deprecated): ... this.
3652 * libbfd.c (warn_deprecated): Rename to ...
3653 (_bfd_warn_deprecated): ... this.
3654 * bfd-in2.h: Regenerate.
3655
3656 2017-02-17 Pedro Alves <palves@redhat.com>
3657
3658 * bfdio.c (real_ftell): Rename to ...
3659 (_bfd_real_ftell): ... this.
3660 (real_fseek): Rename to ...
3661 (_bfd_real_fseek): ... this.
3662 (real_fopen): Rename to ...
3663 (_bfd_real_fopen): ... this.
3664 * libbfd-in.h (real_ftell): Rename to ...
3665 (_bfd_real_ftell): ... this.
3666 (real_fseek): Rename to ...
3667 (_bfd_real_fseek): ... this.
3668 (real_fopen): Rename to ...
3669 (_bfd_real_fopen): ... this.
3670 * cache.c, dwarf2.c, opncls.c: Adjust all callers.
3671 * libbfd.h: Regenerate.
3672
3673 2017-02-17 Pedro Alves <palves@redhat.com>
3674
3675 * dwarf2.c, elf-attrs.c, elf32-nds32.c: Adjust all callers.
3676 * libbfd.c (read_unsigned_leb128): Rename to ...
3677 (_bfd_read_unsigned_leb128): ... this.
3678 (read_signed_leb128): Rename to ...
3679 (_bfd_read_signed_leb128): ... this.
3680 (safe_read_leb128): Rename to ...
3681 (_bfd_safe_read_leb128): ... this.
3682 * libbfd-in.h (read_unsigned_leb128): Rename to ...
3683 (_bfd_read_unsigned_leb128): ... this.
3684 (read_signed_leb128): Rename to ...
3685 (_bfd_read_signed_leb128): ... this.
3686 (safe_read_leb128): Rename to ...
3687 (_bfd_safe_read_leb128): ... this.
3688 * libbfd.h: Renegerate.
3689
3690 2017-02-16 Andrew Burgess <andrew.burgess@embecosm.com>
3691
3692 * dwarf2.c (_bfd_dwarf2_find_nearest_line): Perform symbol lookup
3693 before trying to fine matching file and line information.
3694
3695 2017-02-16 Andrew Burgess <andrew.burgess@embecosm.com>
3696
3697 * dwarf2.c (struct dwarf2_debug): Add orig_bfd member.
3698 (_bfd_dwarf2_slurp_debug_info): If stashed debug information does
3699 not match current bfd, then reload debug information. Record bfd
3700 we're loading debug info for in the stash. If we have debug
3701 informatin in the cache then perform section placement before
3702 returning.
3703
3704 2017-02-16 Alan Modra <amodra@gmail.com>
3705
3706 PR 21000
3707 * elf-bfd.h (struct elf_backend_data): Add no_page_alias.
3708 * elfxx-target.h (elf_backend_no_page_alias): Define.
3709 (elfNN_bed): Init new field.
3710 * elf.c (assign_file_positions_for_load_sections): If no_page_alias
3711 ensure PT_LOAD segment starts on a new page.
3712 * elf32-hppa.c (elf_backend_no_page_alias): Define.
3713
3714 2017-02-16 Alan Modra <amodra@gmail.com>
3715
3716 PR 21132
3717 * elf32-hppa.c (allocate_plt_static): Allocate space for relocs
3718 if pic.
3719
3720 2017-02-16 Jiong Wang <jiong.wang@arm.com>
3721
3722 * bfd.c (BFD_FLAGS_SAVED): Add BFD_LINKER_CREATED.
3723 * bfd-in2.h: Regenerated.
3724
3725 2017-02-15 H.J. Lu <hongjiu.lu@intel.com>
3726
3727 PR ld/21168
3728 * elf32-i386.c (elf_i386_relocate_section): Allow
3729 "lea foo@GOT, %reg" in PIC.
3730
3731 2017-02-15 H.J. Lu <hongjiu.lu@intel.com>
3732
3733 PR ld/20244
3734 * elf32-i386.c (elf_i386_relocate_section): Properly get IFUNC
3735 symbol name when reporting R_386_GOT32/R_386_GOT32X relocation
3736 error against local IFUNC symbol without a base register for
3737 PIC.
3738
3739 2017-02-15 Maciej W. Rozycki <macro@imgtec.com>
3740
3741 * elf32-ppc.c (ppc_elf_check_relocs): Use `%H:' rather than
3742 `%P: %H:' with `info->callbacks->einfo'.
3743 (ppc_elf_relocate_section): Likewise.
3744 * elf64-ppc.c (ppc64_elf_check_relocs): Likewise.
3745 (ppc64_elf_edit_toc): Likewise.
3746 (ppc64_elf_relocate_section): Likewise.
3747
3748 2017-02-14 Alan Modra <amodra@gmail.com>
3749
3750 * elf64-ppc.c (ppc64_elf_gc_mark_dynamic_ref): Support
3751 --gc-keep-exported, and test versioned field of sym rather than
3752 looking for @ in name.
3753
3754 2017-02-13 Palmer Dabbelt <palmer@dabbelt.com>
3755
3756 * elfnn-riscv.c (riscv_global_pointer_value): Change _gp to
3757 __global_pointer$.
3758
3759 2017-02-13 Nick Clifton <nickc@redhat.com>
3760
3761 PR binutils/21151
3762 * dwarf2.c (_bfd_dwarf2_find_nearest_line): Check for an invalid
3763 unit length field.
3764
3765 2017-02-07 Andrew Waterman <andrew@sifive.com>
3766
3767 * elfnn-riscv.c (riscv_elf_finish_dynamic_sections): Only write PLT
3768 entry size if PLT header is written.
3769
3770 2017-02-06 Sheldon Lobo <sheldon.lobo@oracle.com>
3771
3772 Fix sparc64 dynamic relocation processing to use the dynamic
3773 symbol count.
3774 * elf64-sparc.c (elf64_sparc_slurp_one_reloc_table): Use 'dynamic'
3775 to determine if bfd_get_symcount() or bfd_get_dynamic_symcount()
3776 should be used.
3777
3778 2017-02-03 Nick Clifton <nickc@redhat.com>
3779
3780 PR 21096
3781 * coffcode.h (coff_write_object_contents): Enlarge size of
3782 s_name_buf in order to avoid compile time warning about possible
3783 integer truncation.
3784 * elf32-nds32.c (nds32_elf_ex9_import_table): Mask off lower
3785 32-bits of insn value before printing into buffer.
3786
3787 2017-02-02 Maciej W. Rozycki <macro@imgtec.com>
3788
3789 * elfxx-mips.c (mips_elf_hash_sort_data): Add
3790 `max_local_dynindx'.
3791 (mips_elf_sort_hash_table): Handle it.
3792 (mips_elf_sort_hash_table_f) <GGA_NONE>: For forced local
3793 symbols bump up `max_local_dynindx' rather than
3794 `max_non_got_dynindx'.
3795
3796 2017-02-02 Maciej W. Rozycki <macro@imgtec.com>
3797
3798 * elfxx-mips.c (mips_elf_hash_sort_data): Convert the
3799 `min_got_dynindx', `max_unref_got_dynindx' and
3800 `max_non_got_dynindx' members to the `bfd_size_type' data type.
3801 (mips_elf_sort_hash_table): Adjust accordingly.
3802
3803 2017-02-02 Maciej W. Rozycki <macro@imgtec.com>
3804
3805 * elfxx-mips.c (mips_elf_sort_hash_table): Use `htab' throughout
3806 to access the hash table.
3807
3808 2017-02-02 Maciej W. Rozycki <macro@imgtec.com>
3809
3810 * elfxx-mips.c (mips_elf_sort_hash_table): Move assertion on
3811 non-NULL `htab' to the beginning.
3812
3813 2017-02-02 Maciej W. Rozycki <macro@imgtec.com>
3814
3815 * elflink.c (elf_gc_sweep): Wrap overlong line.
3816
3817 2017-01-30 Maciej W. Rozycki <macro@imgtec.com>
3818
3819 * elfxx-mips.h (_bfd_mips_elf_insn32): Rename prototype to...
3820 (_bfd_mips_elf_linker_flags): ... this. Add another parameter.
3821 * elfxx-mips.c (mips_elf_link_hash_table): Add
3822 `ignore_branch_isa' member.
3823 (mips_elf_perform_relocation): Do not treat an ISA mode mismatch
3824 in branch relocation calculation as an error if
3825 `ignore_branch_isa' has been set.
3826 (_bfd_mips_elf_insn32): Rename to...
3827 (_bfd_mips_elf_linker_flags): ... this. Rename the `on'
3828 parameter to `insn32' and add an `ignore_branch_isa' parameter.
3829 Handle the new parameter.
3830
3831 2017-01-27 Hans-Peter Nilsson <hp@axis.com>
3832
3833 * elf32-cris.c (elf_cris_finish_dynamic_symbol): Remove now unused
3834 local variable dynobj.
3835
3836 PR ld/20995
3837 * elf32-cris.c (elf_cris_size_dynamic_sections): Handle sdynrelro.
3838 (elf_cris_adjust_dynamic_symbol): Place variables copied into the
3839 executable from read-only sections into sdynrelro.
3840 (elf_cris_finish_dynamic_symbol): Select sreldynrelro for
3841 dynamic relocs in sdynrelro.
3842 (elf_backend_want_dynrelro): Define.
3843
3844 2017-01-25 Sebastian Huber <sebastian.huber@embedded-brains.de>
3845
3846 * config.bfd (*-*-rtemsaout*): Mark as removed.
3847
3848 2017-01-25 Sebastian Huber <sebastian.huber@embedded-brains.de>
3849
3850 * config.bfd (powerpcle-*-rtems*): Do not mark as removed.
3851 (arm-*-rtems*): Move to (arm*-*-eabi*).
3852 (i[3-7]86-*-rtems*): Move to (i[3-7]86-*-elf*).
3853 (m68-*-rtems*): Move to (m68*-*-elf*).
3854
3855 2017-01-25 Sebastian Huber <sebastian.huber@embedded-brains.de>
3856
3857 * config.bfd (*-*-rtemscoff*): Mark as removed.
3858
3859 2017-01-24 Maciej W. Rozycki <macro@imgtec.com>
3860
3861 PR ld/20828
3862 * elflink.c (bfd_elf_record_link_assignment): Revert last
3863 change and don't ever clear `forced_local'. Set `mark'
3864 unconditionally.
3865 (elf_gc_sweep_symbol_info, elf_gc_sweep_symbol): Reorder within
3866 file.
3867 (elf_gc_sweep): Move the call to `elf_gc_sweep_symbol'...
3868 (bfd_elf_size_dynamic_sections): ... here.
3869 * elf32-ppc.c (ppc_elf_tls_setup): Don't clear `forced_local'
3870 and set `mark' instead in `__tls_get_addr_opt' processing.
3871 * elf64-ppc.c (ppc64_elf_tls_setup): Likewise.
3872
3873 2017-01-24 Alan Modra <amodra@gmail.com>
3874
3875 * elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Merge two cases
3876 where dynamic relocs are preferable. Allow ifunc too.
3877 (ensure_undefweak_dynamic): New function.
3878 (allocate_dynrelocs): Use it here. Move plt handling last and
3879 don't make symbols dynamic, simplifying loop. Only make undef
3880 weak symbols with GOT entries dynamic. Correct condition
3881 for GOT relocs. Handle dynamic relocs on ifuncs. Correct
3882 comments. Remove goto.
3883 (ppc_elf_relocate_section): Correct test for using dynamic
3884 symbol on GOT relocs. Rearrange test for emitting GOT relocs
3885 to suit. Set up explicit tls_index entries and implicit GOT
3886 tls_index entries resolvable at link time for
3887 __tls_get_addr_opt. Simplify test to clear mem for prelink.
3888 * elf64-ppc.c (allocate_got): Correct condition for GOT relocs.
3889 (ensure_undefweak_dynamic): New function.
3890 (allocate_dynrelocs): Use it here. Only make undef weak symbols
3891 with GOT entries dynamic. Remove unnecessary test of
3892 WILL_CALL_FINISH_DYNAMIC_SYMBOL in PLT handling.
3893 (ppc64_elf_relocate_section): Correct test for using dynamic
3894 symbol on GOT relocs. Rearrange test for emitting GOT relocs
3895 to suit. Set up explicit tls_index entries and implicit GOT
3896 tls_index entries resolvable at link time for __tls_get_addr_opt.
3897 Simplify expression to clear mem for prelink.
3898
3899 2017-01-23 Yury Norov <ynorov@caviumnetworks.com>
3900
3901 * elfnn-aarch64.c: Fix relaxations for ILP32 mode.
3902
3903 2017-01-20 Jiong Wang <jiong.wang@arm.com>
3904
3905 * elfnn-aarch64.c (elf_aarch64_hash_symbol): New function.
3906 (elf_backend_hash_symbol): Define.
3907
3908 2017-01-18 Maciej W. Rozycki <macro@imgtec.com>
3909
3910 PR ld/20828
3911 * elflink.c (bfd_elf_record_link_assignment): Clear any
3912 `forced_local' marking for DSO symbols that are not being
3913 provided.
3914
3915 2017-01-17 Kuan-Lin Chen <kuanlinchentw@gmail.com>
3916
3917 * elfnn-riscv.c (riscv_elf_object_p): New function.
3918
3919 2017-01-12 H.J. Lu <hongjiu.lu@intel.com>
3920
3921 PR ld/21038
3922 * elf64-x86-64.c (elf_x86_64_link_hash_table): Add
3923 plt_bnd_eh_frame.
3924 (elf_x86_64_check_relocs): Create .eh_frame section for the
3925 .plt.bnd section.
3926 (elf_x86_64_size_dynamic_sections): Allocate and initialize
3927 .eh_frame section for the .plt.bnd section.
3928 (elf_x86_64_finish_dynamic_sections): Adjust .eh_frame section
3929 for the .plt.bnd section.
3930
3931 2017-01-12 Nick Clifton <nickc@redhat.com>
3932
3933 PR binutils/20876
3934 * opncls.c (find_separate_debug_file): Add include_dirs
3935 parameter. Only include the directory part of the bfd's filename
3936 in search paths if include_dirs is true. Add a couple of extra
3937 locations for looking for debug files.
3938 ( bfd_follow_gnu_debuglink): Update invocation of
3939 find_separate_debug_file.
3940 (bfd_follow_gnu_debugaltlink): Likewise.
3941 (get_build_id): New function: Finds the build-id of the given bfd.
3942 (get_build_id_name): New function: Computes the name of the
3943 separate debug info file for a bfd, based upon its build-id.
3944 (check_build_id_file): New function: Checks to see if a separate
3945 debug info file exists at the given location, and that its
3946 build-id matches that of the original bfd.
3947 (bfd_follow_build_id_debuglink): New function: Finds a separate
3948 debug info file for a given bfd by using the build-id method.
3949 * dwarf2.c (_bfd_dwarf2_slurp_debug_info): Try using the build-id
3950 method of locating a separate debug info file before using the
3951 debuglink method.
3952 * bfd-in2.h: Regenerate.
3953
3954 2017-01-11 H.J. Lu <hongjiu.lu@intel.com>
3955
3956 PR ld/21038
3957 * elf64-x86-64.c (elf_x86_64_eh_frame_bnd_plt): New.
3958 (elf_x86_64_bnd_arch_bed): Use elf_x86_64_eh_frame_bnd_plt and
3959 elf_x86_64_eh_frame_plt_got.
3960 (elf_x86_64_size_dynamic_sections): Get unwind info from
3961 elf_x86_64_bnd_arch_bed for the BND PLT.
3962
3963 2017-01-11 Jeremy Soller <jackpot51@gmail.com>
3964
3965 * config.bfd: Add entries for i686-redox and x86_64-redox.
3966
3967 2017-01-10 H.J. Lu <hongjiu.lu@intel.com>
3968
3969 * elf32-i386.c (elf_i386_check_relocs): Align .eh_frame section
3970 to 4 bytes.
3971 * elf64-x86-64.c (elf_x86_64_create_dynamic_sections): Align
3972 .eh_frame section to 4 bytes for x32.
3973 (elf_x86_64_check_relocs): Likewise.
3974
3975 2017-01-10 H.J. Lu <hongjiu.lu@intel.com>
3976
3977 PR ld/20830
3978 * elf32-i386.c (elf_i386_eh_frame_plt_got): New.
3979 (PLT_GOT_FDE_LENGTH): Likewise.
3980 (elf_i386_plt_layout): Add eh_frame_plt_got and
3981 eh_frame_plt_got_size.
3982 (elf_i386_plt): Updated.
3983 (elf_i386_link_hash_table): Add plt_got_eh_frame.
3984 (elf_i386_check_relocs): Create .eh_frame section for .plt.got.
3985 (elf_i386_size_dynamic_sections): Allocate and initialize
3986 .eh_frame section for .plt.got.
3987 (elf_i386_finish_dynamic_sections): Adjust .eh_frame section for
3988 .plt.got.
3989 (elf_i386_nacl_plt): Add FIXME for eh_frame_plt_got and
3990 eh_frame_plt_got_size.
3991 * elf64-x86-64.c (elf_x86_64_eh_frame_plt_got): New.
3992 (PLT_GOT_FDE_LENGTH): Likewise.
3993 (elf_x86_64_backend_data): Add eh_frame_plt_got and
3994 eh_frame_plt_got_size.
3995 (elf_x86_64_arch_bed): Updated.
3996 (elf_x86_64_bnd_arch_bed): Add FIXME for eh_frame_plt_got and
3997 eh_frame_plt_got_size.
3998 (elf_x86_64_nacl_arch_bed): Likewise.
3999 (elf_x86_64_link_hash_table): Add plt_got_eh_frame.
4000 (elf_x86_64_check_relocs): Create .eh_frame section for .plt.got.
4001 (elf_x86_64_size_dynamic_sections): Allocate and initialize
4002 .eh_frame section for .plt.got.
4003 (elf_x86_64_finish_dynamic_sections): Adjust .eh_frame section
4004 for .plt.got.
4005
4006 2017-01-10 H.J. Lu <hongjiu.lu@intel.com>
4007
4008 * elf32-i386.c (elf_i386_size_dynamic_sections): Set
4009 plt_eh_frame->size to eh_frame_plt_size and use eh_frame_plt.
4010
4011 2017-01-09 Nick Clifton <nickc@redhat.com>
4012
4013 * dwarf2.c (lookup_address_in_function_table): Return early if
4014 there are no functions in the given comp unit, or if the high
4015 address of the last function in the comp unit is less than the
4016 desired address.
4017
4018 2017-01-09 Nick Clifton <nickc@redhat.com>
4019
4020 PR binutils/21013
4021 * coffgen.c (_bfd_coff_get_external_symbols): Generate an error
4022 message if there are too many symbols to load.
4023
4024 2017-01-04 James Clarke <jrtc27@jrtc27.com>
4025
4026 * elf64-alpha.c (elf64_alpha_relax_opt_call): Don't set tsec_free
4027 if relocs are cached.
4028
4029 2017-01-03 Rich Felker <bugdal@aerifal.cx>
4030
4031 PR ld/21017
4032 * elf32-microblaze.c (microblaze_elf_check_relocs): Add an entry
4033 for R_MICROBLAZE_GOTOFF_64.
4034
4035 2017-01-03 Nick Clifton <nickc@redhat.com>
4036
4037 * mach-o.c (bfd_mach_o_lookup_uuid_command): Fix compile time
4038 warning about using a possibly uninitialised variable.
4039
4040 2017-01-02 Alan Modra <amodra@gmail.com>
4041
4042 * elf32-hppa.c (ensure_undef_weak_dynamic): New function.
4043 (allocate_plt_static, allocate_dynrelocs): Use it.
4044
4045 2017-01-02 Alan Modra <amodra@gmail.com>
4046
4047 * elf-hppa.h (elf_hppa_fake_sections): Set SHF_INFO_LINK for
4048 .PARISC.unwind section.
4049
4050 2017-01-02 Alan Modra <amodra@gmail.com>
4051
4052 PR ld/20989
4053 * elfxx-sparc.c (gdop_relative_offset_ok): New function.
4054 (_bfd_sparc_elf_relocate_section): Use it to validate GOT
4055 indirect to GOT pointer relative code edit.
4056
4057 2017-01-02 Alan Modra <amodra@gmail.com>
4058
4059 Update year range in copyright notice of all files.
4060
4061 For older changes see ChangeLog-2016
4062 \f
4063 Copyright (C) 2017 Free Software Foundation, Inc.
4064
4065 Copying and distribution of this file, with or without modification,
4066 are permitted in any medium without royalty provided the copyright
4067 notice and this notice are preserved.
4068
4069 Local Variables:
4070 mode: change-log
4071 left-margin: 8
4072 fill-column: 74
4073 version-control: never
4074 End: