bfd: RISC-V: relax to gp in more cases.
[external/binutils.git] / bfd / ChangeLog
1 2017-02-24  Andrew Waterman  <andrew@sifive.com>
2
3         * elfnn-riscv.c (GP_NAME): New macro.
4         (riscv_global_pointer_value): Use it.
5         (_bfd_riscv_relax_lui): If symbol and global pointer are in same
6         output section, consider only that section's alignment.
7
8 2017-02-23  Maciej W. Rozycki  <macro@imgtec.com>
9
10         * elfxx-mips.h (_bfd_mips_relax_section): Remove prototype.
11         * elfxx-mips.c (_bfd_mips_relax_section): Remove function.
12         * elf64-mips.c (bfd_elf64_bfd_relax_section): Remove macro.
13         * elfn32-mips.c (bfd_elf32_bfd_relax_section): Likewise.
14
15 2017-02-23  Maciej W. Rozycki  <macro@imgtec.com>
16
17         * elfxx-mips.c (mips_elf_calculate_relocation) <R_MIPS_JALR>
18         <R_MICROMIPS_JALR>: Discard relocation if `cross_mode_jump_p'
19         or misaligned.
20
21 2017-02-23  Alan Modra  <amodra@gmail.com>
22
23         PR 20744
24         * elf32-ppc.c (ppc_elf_howto_raw): Correct dst_mask on all VLE
25         16D relocations.
26         (ppc_elf_vle_split16): Correct field mask and shift for 16D relocs.
27         (ppc_elf_relocate_section): Correct calculation for VLE SDAREL
28         relocs.
29
30 2017-02-22  Maciej W. Rozycki  <macro@imgtec.com>
31
32         PR ld/20828
33         * elflink.c (bfd_elf_size_dynamic_sections): Move symbol version
34         processing ahead of the call to `elf_gc_sweep_symbol'.
35
36 2017-02-22  Nick Clifton  <nickc@redhat.com>
37
38         PR binutils/21193
39         * opncls.c (bfd_create_gnu_debuglink_section): Give the newly
40         created section 4-byte alignment.
41
42 2017-02-22  Alan Modra  <amodra@gmail.com>
43
44         * elf64-ppc.c (ppc64_elf_finish_dynamic_sections): Don't segfault
45         on .got or .plt output section being discarded by script.
46         * elf32-ppc.c (ppc_elf_finish_dynamic_sections): Likewise.  Move
47         vxworks splt temp.
48
49 2017-02-21  Alan Modra  <amodra@gmail.com>
50
51         * elf64-alpha.c (elf64_alpha_size_dynamic_sections): Only emit
52         DT_RELA, DT_RELASZ, and DT_RELAENT when DT_RELASZ is non-zero.
53
54 2017-02-20  Alan Modra  <amodra@gmail.com>
55
56         PR 21181
57         * elflink.c (bfd_elf_final_link): Make DT_REL/DT_RELA zero
58         if DT_RELSZ/DT_RELASZ is zero.
59
60 2017-02-17  Nick Clifton  <nickc@redhat.com>
61
62         * compress.c (bfd_get_full_section_contents): Remember to reduce
63         compressed size by the sizeof the compression header when
64         decompressing the contents.
65
66 2017-02-17  Pedro Alves  <palves@redhat.com>
67
68         * srec.c (Chunk): Rename to ...
69         (_bfd_srec_len): ... this.
70         (S3Forced): Rename to ...
71         (_bfd_srec_forceS3): ... this.
72         * objcopy.c: Adjust all references.
73
74 2017-02-17  Pedro Alves  <palves@redhat.com>
75
76         * archive.c (bsd_write_armap): Rename to ...
77         (_bfd_bsd_write_armap): ... this.
78         (coff_write_armap): Rename to ...
79         (_bfd_coff_write_armap): ... this.
80         * libbfd-in.h (bsd_write_armap): Rename to ...
81         (_bfd_bsd_write_armap): ... this.
82         (coff_write_armap): Rename to ...
83         (_bfd_coff_write_armap): ... this.
84         * aout-target.h, aout-tic30.c: Adjust all users.
85         * libbfd.h: Regenerate.
86
87 2017-02-17  Pedro Alves  <palves@redhat.com>
88
89         * bfd-in.h (bfd_read, bfd_write): Adjust to rename.
90         (warn_deprecated): Rename to ...
91         (_bfd_warn_deprecated): ... this.
92         * libbfd.c (warn_deprecated): Rename to ...
93         (_bfd_warn_deprecated): ... this.
94         * bfd-in2.h: Regenerate.
95
96 2017-02-17  Pedro Alves  <palves@redhat.com>
97
98         * bfdio.c (real_ftell): Rename to ...
99         (_bfd_real_ftell): ... this.
100         (real_fseek): Rename to ...
101         (_bfd_real_fseek): ... this.
102         (real_fopen): Rename to ...
103         (_bfd_real_fopen): ... this.
104         * libbfd-in.h (real_ftell): Rename to ...
105         (_bfd_real_ftell): ... this.
106         (real_fseek): Rename to ...
107         (_bfd_real_fseek): ... this.
108         (real_fopen): Rename to ...
109         (_bfd_real_fopen): ... this.
110         * cache.c, dwarf2.c, opncls.c: Adjust all callers.
111         * libbfd.h: Regenerate.
112
113 2017-02-17  Pedro Alves  <palves@redhat.com>
114
115         * dwarf2.c, elf-attrs.c, elf32-nds32.c: Adjust all callers.
116         * libbfd.c (read_unsigned_leb128): Rename to ...
117         (_bfd_read_unsigned_leb128): ... this.
118         (read_signed_leb128): Rename to ...
119         (_bfd_read_signed_leb128): ... this.
120         (safe_read_leb128): Rename to ...
121         (_bfd_safe_read_leb128): ... this.
122         * libbfd-in.h (read_unsigned_leb128): Rename to ...
123         (_bfd_read_unsigned_leb128): ... this.
124         (read_signed_leb128): Rename to ...
125         (_bfd_read_signed_leb128): ... this.
126         (safe_read_leb128): Rename to ...
127         (_bfd_safe_read_leb128): ... this.
128         * libbfd.h: Renegerate.
129
130 2017-02-16  Andrew Burgess  <andrew.burgess@embecosm.com>
131
132         * dwarf2.c (_bfd_dwarf2_find_nearest_line): Perform symbol lookup
133         before trying to fine matching file and line information.
134
135 2017-02-16  Andrew Burgess  <andrew.burgess@embecosm.com>
136
137         * dwarf2.c (struct dwarf2_debug): Add orig_bfd member.
138         (_bfd_dwarf2_slurp_debug_info): If stashed debug information does
139         not match current bfd, then reload debug information.  Record bfd
140         we're loading debug info for in the stash.  If we have debug
141         informatin in the cache then perform section placement before
142         returning.
143
144 2017-02-16  Alan Modra  <amodra@gmail.com>
145
146         PR 21000
147         * elf-bfd.h (struct elf_backend_data): Add no_page_alias.
148         * elfxx-target.h (elf_backend_no_page_alias): Define.
149         (elfNN_bed): Init new field.
150         * elf.c (assign_file_positions_for_load_sections): If no_page_alias
151         ensure PT_LOAD segment starts on a new page.
152         * elf32-hppa.c (elf_backend_no_page_alias): Define.
153
154 2017-02-16  Alan Modra  <amodra@gmail.com>
155
156         PR 21132
157         * elf32-hppa.c (allocate_plt_static): Allocate space for relocs
158         if pic.
159
160 2017-02-16  Jiong Wang <jiong.wang@arm.com>
161
162         * bfd.c (BFD_FLAGS_SAVED): Add BFD_LINKER_CREATED.
163         * bfd-in2.h: Regenerated.
164
165 2017-02-15  H.J. Lu  <hongjiu.lu@intel.com>
166
167         PR ld/21168
168         * elf32-i386.c (elf_i386_relocate_section): Allow
169         "lea foo@GOT, %reg" in PIC.
170
171 2017-02-15  H.J. Lu  <hongjiu.lu@intel.com>
172
173         PR ld/20244
174         * elf32-i386.c (elf_i386_relocate_section): Properly get IFUNC
175         symbol name when reporting R_386_GOT32/R_386_GOT32X relocation
176         error against local IFUNC symbol without a base register for
177         PIC.
178
179 2017-02-15  Maciej W. Rozycki  <macro@imgtec.com>
180
181         * elf32-ppc.c (ppc_elf_check_relocs): Use `%H:' rather than
182         `%P: %H:' with `info->callbacks->einfo'.
183         (ppc_elf_relocate_section): Likewise.
184         * elf64-ppc.c (ppc64_elf_check_relocs): Likewise.
185         (ppc64_elf_edit_toc): Likewise.
186         (ppc64_elf_relocate_section): Likewise.
187
188 2017-02-14  Alan Modra  <amodra@gmail.com>
189
190         * elf64-ppc.c (ppc64_elf_gc_mark_dynamic_ref): Support
191         --gc-keep-exported, and test versioned field of sym rather than
192         looking for @ in name.
193
194 2017-02-13  Palmer Dabbelt  <palmer@dabbelt.com>
195
196         * elfnn-riscv.c (riscv_global_pointer_value): Change _gp to
197         __global_pointer$.
198
199 2017-02-13  Nick Clifton  <nickc@redhat.com>
200
201         PR binutils/21151
202         * dwarf2.c (_bfd_dwarf2_find_nearest_line): Check for an invalid
203         unit length field.
204
205 2017-02-07  Andrew Waterman  <andrew@sifive.com>
206
207         * elfnn-riscv.c (riscv_elf_finish_dynamic_sections): Only write PLT
208         entry size if PLT header is written.
209
210 2017-02-06  Sheldon Lobo  <sheldon.lobo@oracle.com>
211
212         Fix sparc64 dynamic relocation processing to use the dynamic
213         symbol count.
214         * elf64-sparc.c (elf64_sparc_slurp_one_reloc_table): Use 'dynamic'
215         to determine if bfd_get_symcount() or bfd_get_dynamic_symcount()
216         should be used.
217
218 2017-02-03  Nick Clifton  <nickc@redhat.com>
219
220         PR 21096
221         * coffcode.h (coff_write_object_contents): Enlarge size of
222         s_name_buf in order to avoid compile time warning about possible
223         integer truncation.
224         * elf32-nds32.c (nds32_elf_ex9_import_table): Mask off lower
225         32-bits of insn value before printing into buffer.
226
227 2017-02-02  Maciej W. Rozycki  <macro@imgtec.com>
228
229         * elfxx-mips.c (mips_elf_hash_sort_data): Add
230         `max_local_dynindx'.
231         (mips_elf_sort_hash_table): Handle it.
232         (mips_elf_sort_hash_table_f) <GGA_NONE>: For forced local
233         symbols bump up `max_local_dynindx' rather than
234         `max_non_got_dynindx'.
235
236 2017-02-02  Maciej W. Rozycki  <macro@imgtec.com>
237
238         * elfxx-mips.c (mips_elf_hash_sort_data): Convert the
239         `min_got_dynindx', `max_unref_got_dynindx' and
240         `max_non_got_dynindx' members to the `bfd_size_type' data type.
241         (mips_elf_sort_hash_table): Adjust accordingly.
242
243 2017-02-02  Maciej W. Rozycki  <macro@imgtec.com>
244
245         * elfxx-mips.c (mips_elf_sort_hash_table): Use `htab' throughout
246         to access the hash table.
247
248 2017-02-02  Maciej W. Rozycki  <macro@imgtec.com>
249
250         * elfxx-mips.c (mips_elf_sort_hash_table): Move assertion on
251         non-NULL `htab' to the beginning.
252
253 2017-02-02  Maciej W. Rozycki  <macro@imgtec.com>
254
255         * elflink.c (elf_gc_sweep): Wrap overlong line.
256
257 2017-01-30  Maciej W. Rozycki  <macro@imgtec.com>
258
259         * elfxx-mips.h (_bfd_mips_elf_insn32): Rename prototype to...
260         (_bfd_mips_elf_linker_flags): ... this.  Add another parameter.
261         * elfxx-mips.c (mips_elf_link_hash_table): Add
262         `ignore_branch_isa' member.
263         (mips_elf_perform_relocation): Do not treat an ISA mode mismatch
264         in branch relocation calculation as an error if
265         `ignore_branch_isa' has been set.
266         (_bfd_mips_elf_insn32): Rename to...
267         (_bfd_mips_elf_linker_flags): ... this.  Rename the `on'
268         parameter to `insn32' and add an `ignore_branch_isa' parameter.
269         Handle the new parameter.
270
271 2017-01-27  Hans-Peter Nilsson  <hp@axis.com>
272
273         * elf32-cris.c (elf_cris_finish_dynamic_symbol): Remove now unused
274         local variable dynobj.
275
276         PR ld/20995
277         * elf32-cris.c (elf_cris_size_dynamic_sections): Handle sdynrelro.
278         (elf_cris_adjust_dynamic_symbol): Place variables copied into the
279         executable from read-only sections into sdynrelro.
280         (elf_cris_finish_dynamic_symbol): Select sreldynrelro for
281         dynamic relocs in sdynrelro.
282         (elf_backend_want_dynrelro): Define.
283
284 2017-01-25  Sebastian Huber  <sebastian.huber@embedded-brains.de>
285
286         * config.bfd (*-*-rtemsaout*): Mark as removed.
287
288 2017-01-25  Sebastian Huber  <sebastian.huber@embedded-brains.de>
289
290         * config.bfd (powerpcle-*-rtems*): Do not mark as removed.
291         (arm-*-rtems*): Move to (arm*-*-eabi*).
292         (i[3-7]86-*-rtems*): Move to (i[3-7]86-*-elf*).
293         (m68-*-rtems*): Move to (m68*-*-elf*).
294
295 2017-01-25  Sebastian Huber  <sebastian.huber@embedded-brains.de>
296
297         * config.bfd (*-*-rtemscoff*): Mark as removed.
298
299 2017-01-24  Maciej W. Rozycki  <macro@imgtec.com>
300
301         PR ld/20828
302         * elflink.c (bfd_elf_record_link_assignment): Revert last
303         change and don't ever clear `forced_local'.  Set `mark'
304         unconditionally.
305         (elf_gc_sweep_symbol_info, elf_gc_sweep_symbol): Reorder within
306         file.
307         (elf_gc_sweep): Move the call to `elf_gc_sweep_symbol'...
308         (bfd_elf_size_dynamic_sections): ... here.
309         * elf32-ppc.c (ppc_elf_tls_setup): Don't clear `forced_local'
310         and set `mark' instead in `__tls_get_addr_opt' processing.
311         * elf64-ppc.c (ppc64_elf_tls_setup): Likewise.
312
313 2017-01-24  Alan Modra  <amodra@gmail.com>
314
315         * elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Merge two cases
316         where dynamic relocs are preferable.  Allow ifunc too.
317         (ensure_undefweak_dynamic): New function.
318         (allocate_dynrelocs): Use it here.  Move plt handling last and
319         don't make symbols dynamic, simplifying loop.  Only make undef
320         weak symbols with GOT entries dynamic.  Correct condition
321         for GOT relocs.  Handle dynamic relocs on ifuncs.  Correct
322         comments.  Remove goto.
323         (ppc_elf_relocate_section): Correct test for using dynamic
324         symbol on GOT relocs.  Rearrange test for emitting GOT relocs
325         to suit.  Set up explicit tls_index entries and implicit GOT
326         tls_index entries resolvable at link time for
327         __tls_get_addr_opt.  Simplify test to clear mem for prelink.
328         * elf64-ppc.c (allocate_got): Correct condition for GOT relocs.
329         (ensure_undefweak_dynamic): New function.
330         (allocate_dynrelocs): Use it here.  Only make undef weak symbols
331         with GOT entries dynamic.  Remove unnecessary test of
332         WILL_CALL_FINISH_DYNAMIC_SYMBOL in PLT handling.
333         (ppc64_elf_relocate_section): Correct test for using dynamic
334         symbol on GOT relocs.  Rearrange test for emitting GOT relocs
335         to suit.  Set up explicit tls_index entries and implicit GOT
336         tls_index entries resolvable at link time for __tls_get_addr_opt.
337         Simplify expression to clear mem for prelink.
338
339 2017-01-23  Yury Norov  <ynorov@caviumnetworks.com>
340
341         * elfnn-aarch64.c: Fix relaxations for ILP32 mode.
342
343 2017-01-20  Jiong Wang <jiong.wang@arm.com>
344
345         * elfnn-aarch64.c (elf_aarch64_hash_symbol): New function.
346         (elf_backend_hash_symbol): Define.
347
348 2017-01-18  Maciej W. Rozycki  <macro@imgtec.com>
349
350         PR ld/20828
351         * elflink.c (bfd_elf_record_link_assignment): Clear any
352         `forced_local' marking for DSO symbols that are not being
353         provided.
354
355 2017-01-17  Kuan-Lin Chen  <kuanlinchentw@gmail.com>
356
357         * elfnn-riscv.c (riscv_elf_object_p): New function.
358
359 2017-01-12  H.J. Lu  <hongjiu.lu@intel.com>
360
361         PR ld/21038
362         * elf64-x86-64.c (elf_x86_64_link_hash_table): Add
363         plt_bnd_eh_frame.
364         (elf_x86_64_check_relocs): Create .eh_frame section for the
365         .plt.bnd section.
366         (elf_x86_64_size_dynamic_sections): Allocate and initialize
367         .eh_frame section for the .plt.bnd section.
368         (elf_x86_64_finish_dynamic_sections): Adjust .eh_frame section
369         for the .plt.bnd section.
370
371 2017-01-12  Nick Clifton  <nickc@redhat.com>
372
373         PR binutils/20876
374         * opncls.c (find_separate_debug_file): Add include_dirs
375         parameter.  Only include the directory part of the bfd's filename
376         in search paths if include_dirs is true.  Add a couple of extra
377         locations for looking for debug files.
378         ( bfd_follow_gnu_debuglink): Update invocation of
379         find_separate_debug_file.
380         (bfd_follow_gnu_debugaltlink): Likewise.
381         (get_build_id): New function: Finds the build-id of the given bfd.
382         (get_build_id_name): New function: Computes the name of the
383         separate debug info file for a bfd, based upon its build-id.
384         (check_build_id_file): New function: Checks to see if a separate
385         debug info file exists at the given location, and that its
386         build-id matches that of the original bfd.
387         (bfd_follow_build_id_debuglink): New function: Finds a separate
388         debug info file for a given bfd by using the build-id method.
389         * dwarf2.c (_bfd_dwarf2_slurp_debug_info): Try using the build-id
390         method of locating a separate debug info file before using the
391         debuglink method.
392         * bfd-in2.h: Regenerate.
393
394 2017-01-11  H.J. Lu  <hongjiu.lu@intel.com>
395
396         PR ld/21038
397         * elf64-x86-64.c (elf_x86_64_eh_frame_bnd_plt): New.
398         (elf_x86_64_bnd_arch_bed): Use elf_x86_64_eh_frame_bnd_plt and
399         elf_x86_64_eh_frame_plt_got.
400         (elf_x86_64_size_dynamic_sections): Get unwind info from
401         elf_x86_64_bnd_arch_bed for the BND PLT.
402
403 2017-01-11  Jeremy Soller  <jackpot51@gmail.com>
404
405         * config.bfd: Add entries for i686-redox and x86_64-redox.
406
407 2017-01-10  H.J. Lu  <hongjiu.lu@intel.com>
408
409         * elf32-i386.c (elf_i386_check_relocs): Align .eh_frame section
410         to 4 bytes.
411         * elf64-x86-64.c (elf_x86_64_create_dynamic_sections): Align
412         .eh_frame section to 4 bytes for x32.
413         (elf_x86_64_check_relocs): Likewise.
414
415 2017-01-10  H.J. Lu  <hongjiu.lu@intel.com>
416
417         PR ld/20830
418         * elf32-i386.c (elf_i386_eh_frame_plt_got): New.
419         (PLT_GOT_FDE_LENGTH): Likewise.
420         (elf_i386_plt_layout): Add eh_frame_plt_got and
421         eh_frame_plt_got_size.
422         (elf_i386_plt): Updated.
423         (elf_i386_link_hash_table): Add plt_got_eh_frame.
424         (elf_i386_check_relocs): Create .eh_frame section for .plt.got.
425         (elf_i386_size_dynamic_sections): Allocate and initialize
426         .eh_frame section for .plt.got.
427         (elf_i386_finish_dynamic_sections): Adjust .eh_frame section for
428         .plt.got.
429         (elf_i386_nacl_plt): Add FIXME for eh_frame_plt_got and
430         eh_frame_plt_got_size.
431         * elf64-x86-64.c (elf_x86_64_eh_frame_plt_got): New.
432         (PLT_GOT_FDE_LENGTH): Likewise.
433         (elf_x86_64_backend_data): Add eh_frame_plt_got and
434         eh_frame_plt_got_size.
435         (elf_x86_64_arch_bed): Updated.
436         (elf_x86_64_bnd_arch_bed): Add FIXME for eh_frame_plt_got and
437         eh_frame_plt_got_size.
438         (elf_x86_64_nacl_arch_bed): Likewise.
439         (elf_x86_64_link_hash_table): Add plt_got_eh_frame.
440         (elf_x86_64_check_relocs): Create .eh_frame section for .plt.got.
441         (elf_x86_64_size_dynamic_sections): Allocate and initialize
442         .eh_frame section for .plt.got.
443         (elf_x86_64_finish_dynamic_sections): Adjust .eh_frame section
444         for .plt.got.
445
446 2017-01-10  H.J. Lu  <hongjiu.lu@intel.com>
447
448         * elf32-i386.c (elf_i386_size_dynamic_sections): Set
449         plt_eh_frame->size to eh_frame_plt_size and use eh_frame_plt.
450
451 2017-01-09  Nick Clifton  <nickc@redhat.com>
452
453         * dwarf2.c (lookup_address_in_function_table): Return early if
454         there are no functions in the given comp unit, or if the high
455         address of the last function in the comp unit is less than the
456         desired address.
457
458 2017-01-09  Nick Clifton  <nickc@redhat.com>
459
460         PR binutils/21013
461         * coffgen.c (_bfd_coff_get_external_symbols): Generate an error
462         message if there are too many symbols to load.
463
464 2017-01-04  James Clarke  <jrtc27@jrtc27.com>
465
466         * elf64-alpha.c (elf64_alpha_relax_opt_call): Don't set tsec_free
467         if relocs are cached.
468
469 2017-01-03  Rich Felker  <bugdal@aerifal.cx>
470
471         PR ld/21017
472         * elf32-microblaze.c (microblaze_elf_check_relocs): Add an entry
473         for R_MICROBLAZE_GOTOFF_64.
474
475 2017-01-03  Nick Clifton  <nickc@redhat.com>
476
477         * mach-o.c (bfd_mach_o_lookup_uuid_command): Fix compile time
478         warning about using a possibly uninitialised variable.
479
480 2017-01-02  Alan Modra  <amodra@gmail.com>
481
482         * elf32-hppa.c (ensure_undef_weak_dynamic): New function.
483         (allocate_plt_static, allocate_dynrelocs): Use it.
484
485 2017-01-02  Alan Modra  <amodra@gmail.com>
486
487         * elf-hppa.h (elf_hppa_fake_sections): Set SHF_INFO_LINK for
488         .PARISC.unwind section.
489
490 2017-01-02  Alan Modra  <amodra@gmail.com>
491
492         PR ld/20989
493         * elfxx-sparc.c (gdop_relative_offset_ok): New function.
494         (_bfd_sparc_elf_relocate_section): Use it to validate GOT
495         indirect to GOT pointer relative code edit.
496
497 2017-01-02  Alan Modra  <amodra@gmail.com>
498
499         Update year range in copyright notice of all files.
500
501 For older changes see ChangeLog-2016
502 \f
503 Copyright (C) 2017 Free Software Foundation, Inc.
504
505 Copying and distribution of this file, with or without modification,
506 are permitted in any medium without royalty provided the copyright
507 notice and this notice are preserved.
508
509 Local Variables:
510 mode: change-log
511 left-margin: 8
512 fill-column: 74
513 version-control: never
514 End: