PowerPC PLT speculative execution barriers
[external/binutils.git] / bfd / elf64-ppc.h
1 /* PowerPC64-specific support for 64-bit ELF.
2    Copyright (C) 2002-2018 Free Software Foundation, Inc.
3
4    This file is part of BFD, the Binary File Descriptor library.
5
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 3 of the License, or
9    (at your option) any later version.
10
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with this program; if not, write to the Free Software
18    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
19    MA 02110-1301, USA.  */
20
21 /* Used to pass info between ld and bfd.  */
22 struct ppc64_elf_params
23 {
24   /* Linker stub bfd.  */
25   bfd *stub_bfd;
26
27   /* Linker call-backs.  */
28   asection * (*add_stub_section) (const char *, asection *);
29   void (*layout_sections_again) (void);
30
31   /* Maximum size of a group of input sections that can be handled by
32      one stub section.  A value of +/-1 indicates the bfd back-end
33      should use a suitable default size.  */
34   bfd_signed_vma group_size;
35
36   /* Whether to use a special call stub for __tls_get_addr.  */
37   int tls_get_addr_opt;
38
39   /* Whether to allow multiple toc sections.  */
40   int no_multi_toc;
41
42   /* Set if PLT call stubs should load r11.  */
43   int plt_static_chain;
44
45   /* Set if PLT call stubs need to be thread safe on power7+.  */
46   int plt_thread_safe;
47
48   /* Set if individual PLT call stubs should be aligned.  */
49   int plt_stub_align;
50
51   /* Set if PLT call stubs for localentry:0 functions should omit r2 save.  */
52   int plt_localentry0;
53
54   /* Clear if PLT call stubs should use a speculative execution barrier.  */
55   int speculate_indirect_jumps;
56
57   /* Whether to canonicalize .opd so that there are no overlapping
58      .opd entries.  */
59   int non_overlapping_opd;
60
61   /* Whether to emit symbols for stubs.  */
62   int emit_stub_syms;
63
64   /* Whether to generate out-of-line register save/restore for gcc -Os code.  */
65   int save_restore_funcs;
66
67   /* Set when a potential variable is detected in .toc.  */
68   int object_in_toc;
69 };
70
71 bfd_boolean ppc64_elf_init_stub_bfd
72   (struct bfd_link_info *, struct ppc64_elf_params *);
73 bfd_boolean ppc64_elf_edit_opd
74   (struct bfd_link_info *);
75 asection *ppc64_elf_tls_setup
76   (struct bfd_link_info *);
77 bfd_boolean ppc64_elf_tls_optimize
78   (struct bfd_link_info *);
79 bfd_boolean ppc64_elf_edit_toc
80   (struct bfd_link_info *);
81 bfd_boolean ppc64_elf_has_small_toc_reloc
82   (asection *);
83 bfd_vma ppc64_elf_set_toc
84   (struct bfd_link_info *, bfd *);
85 int ppc64_elf_setup_section_lists
86   (struct bfd_link_info *);
87 void ppc64_elf_start_multitoc_partition
88   (struct bfd_link_info *);
89 bfd_boolean ppc64_elf_next_toc_section
90   (struct bfd_link_info *, asection *);
91 bfd_boolean ppc64_elf_layout_multitoc
92   (struct bfd_link_info *);
93 void ppc64_elf_finish_multitoc_partition
94   (struct bfd_link_info *);
95 bfd_boolean ppc64_elf_check_init_fini
96   (struct bfd_link_info *);
97 bfd_boolean ppc64_elf_next_input_section
98   (struct bfd_link_info *, asection *);
99 bfd_boolean ppc64_elf_size_stubs
100 (struct bfd_link_info *);
101 bfd_boolean ppc64_elf_build_stubs
102   (struct bfd_link_info *, char **);