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