xref: /dflybsd-src/contrib/binutils-2.27/include/plugin-api.h (revision e656dc90e3d65d744d534af2f5ea88cf8101ebcf)
1*a9fa9459Szrj /* plugin-api.h -- External linker plugin API.  */
2*a9fa9459Szrj 
3*a9fa9459Szrj /* Copyright (C) 2009-2016 Free Software Foundation, Inc.
4*a9fa9459Szrj    Written by Cary Coutant <ccoutant@google.com>.
5*a9fa9459Szrj 
6*a9fa9459Szrj    This file is part of binutils.
7*a9fa9459Szrj 
8*a9fa9459Szrj    This program is free software; you can redistribute it and/or modify
9*a9fa9459Szrj    it under the terms of the GNU General Public License as published by
10*a9fa9459Szrj    the Free Software Foundation; either version 3 of the License, or
11*a9fa9459Szrj    (at your option) any later version.
12*a9fa9459Szrj 
13*a9fa9459Szrj    This program is distributed in the hope that it will be useful,
14*a9fa9459Szrj    but WITHOUT ANY WARRANTY; without even the implied warranty of
15*a9fa9459Szrj    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16*a9fa9459Szrj    GNU General Public License for more details.
17*a9fa9459Szrj 
18*a9fa9459Szrj    You should have received a copy of the GNU General Public License
19*a9fa9459Szrj    along with this program; if not, write to the Free Software
20*a9fa9459Szrj    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
21*a9fa9459Szrj    MA 02110-1301, USA.  */
22*a9fa9459Szrj 
23*a9fa9459Szrj /* This file defines the interface for writing a linker plugin, which is
24*a9fa9459Szrj    described at < http://gcc.gnu.org/wiki/whopr/driver >.  */
25*a9fa9459Szrj 
26*a9fa9459Szrj #ifndef PLUGIN_API_H
27*a9fa9459Szrj #define PLUGIN_API_H
28*a9fa9459Szrj 
29*a9fa9459Szrj #ifdef HAVE_STDINT_H
30*a9fa9459Szrj #include <stdint.h>
31*a9fa9459Szrj #elif defined(HAVE_INTTYPES_H)
32*a9fa9459Szrj #include <inttypes.h>
33*a9fa9459Szrj #endif
34*a9fa9459Szrj #include <sys/types.h>
35*a9fa9459Szrj #if !defined(HAVE_STDINT_H) && !defined(HAVE_INTTYPES_H) && \
36*a9fa9459Szrj     !defined(UINT64_MAX) && !defined(uint64_t)
37*a9fa9459Szrj #error can not find uint64_t type
38*a9fa9459Szrj #endif
39*a9fa9459Szrj 
40*a9fa9459Szrj #ifdef __cplusplus
41*a9fa9459Szrj extern "C"
42*a9fa9459Szrj {
43*a9fa9459Szrj #endif
44*a9fa9459Szrj 
45*a9fa9459Szrj /* Status code returned by most API routines.  */
46*a9fa9459Szrj 
47*a9fa9459Szrj enum ld_plugin_status
48*a9fa9459Szrj {
49*a9fa9459Szrj   LDPS_OK = 0,
50*a9fa9459Szrj   LDPS_NO_SYMS,         /* Attempt to get symbols that haven't been added. */
51*a9fa9459Szrj   LDPS_BAD_HANDLE,      /* No claimed object associated with given handle. */
52*a9fa9459Szrj   LDPS_ERR
53*a9fa9459Szrj   /* Additional Error codes TBD.  */
54*a9fa9459Szrj };
55*a9fa9459Szrj 
56*a9fa9459Szrj /* The version of the API specification.  */
57*a9fa9459Szrj 
58*a9fa9459Szrj enum ld_plugin_api_version
59*a9fa9459Szrj {
60*a9fa9459Szrj   LD_PLUGIN_API_VERSION = 1
61*a9fa9459Szrj };
62*a9fa9459Szrj 
63*a9fa9459Szrj /* The type of output file being generated by the linker.  */
64*a9fa9459Szrj 
65*a9fa9459Szrj enum ld_plugin_output_file_type
66*a9fa9459Szrj {
67*a9fa9459Szrj   LDPO_REL,
68*a9fa9459Szrj   LDPO_EXEC,
69*a9fa9459Szrj   LDPO_DYN,
70*a9fa9459Szrj   LDPO_PIE
71*a9fa9459Szrj };
72*a9fa9459Szrj 
73*a9fa9459Szrj /* An input file managed by the plugin library.  */
74*a9fa9459Szrj 
75*a9fa9459Szrj struct ld_plugin_input_file
76*a9fa9459Szrj {
77*a9fa9459Szrj   const char *name;
78*a9fa9459Szrj   int fd;
79*a9fa9459Szrj   off_t offset;
80*a9fa9459Szrj   off_t filesize;
81*a9fa9459Szrj   void *handle;
82*a9fa9459Szrj };
83*a9fa9459Szrj 
84*a9fa9459Szrj /* A symbol belonging to an input file managed by the plugin library.  */
85*a9fa9459Szrj 
86*a9fa9459Szrj struct ld_plugin_symbol
87*a9fa9459Szrj {
88*a9fa9459Szrj   char *name;
89*a9fa9459Szrj   char *version;
90*a9fa9459Szrj   int def;
91*a9fa9459Szrj   int visibility;
92*a9fa9459Szrj   uint64_t size;
93*a9fa9459Szrj   char *comdat_key;
94*a9fa9459Szrj   int resolution;
95*a9fa9459Szrj };
96*a9fa9459Szrj 
97*a9fa9459Szrj /* An object's section.  */
98*a9fa9459Szrj 
99*a9fa9459Szrj struct ld_plugin_section
100*a9fa9459Szrj {
101*a9fa9459Szrj   const void* handle;
102*a9fa9459Szrj   unsigned int shndx;
103*a9fa9459Szrj };
104*a9fa9459Szrj 
105*a9fa9459Szrj /* Whether the symbol is a definition, reference, or common, weak or not.  */
106*a9fa9459Szrj 
107*a9fa9459Szrj enum ld_plugin_symbol_kind
108*a9fa9459Szrj {
109*a9fa9459Szrj   LDPK_DEF,
110*a9fa9459Szrj   LDPK_WEAKDEF,
111*a9fa9459Szrj   LDPK_UNDEF,
112*a9fa9459Szrj   LDPK_WEAKUNDEF,
113*a9fa9459Szrj   LDPK_COMMON
114*a9fa9459Szrj };
115*a9fa9459Szrj 
116*a9fa9459Szrj /* The visibility of the symbol.  */
117*a9fa9459Szrj 
118*a9fa9459Szrj enum ld_plugin_symbol_visibility
119*a9fa9459Szrj {
120*a9fa9459Szrj   LDPV_DEFAULT,
121*a9fa9459Szrj   LDPV_PROTECTED,
122*a9fa9459Szrj   LDPV_INTERNAL,
123*a9fa9459Szrj   LDPV_HIDDEN
124*a9fa9459Szrj };
125*a9fa9459Szrj 
126*a9fa9459Szrj /* How a symbol is resolved.  */
127*a9fa9459Szrj 
128*a9fa9459Szrj enum ld_plugin_symbol_resolution
129*a9fa9459Szrj {
130*a9fa9459Szrj   LDPR_UNKNOWN = 0,
131*a9fa9459Szrj 
132*a9fa9459Szrj   /* Symbol is still undefined at this point.  */
133*a9fa9459Szrj   LDPR_UNDEF,
134*a9fa9459Szrj 
135*a9fa9459Szrj   /* This is the prevailing definition of the symbol, with references from
136*a9fa9459Szrj      regular object code.  */
137*a9fa9459Szrj   LDPR_PREVAILING_DEF,
138*a9fa9459Szrj 
139*a9fa9459Szrj   /* This is the prevailing definition of the symbol, with no
140*a9fa9459Szrj      references from regular objects.  It is only referenced from IR
141*a9fa9459Szrj      code.  */
142*a9fa9459Szrj   LDPR_PREVAILING_DEF_IRONLY,
143*a9fa9459Szrj 
144*a9fa9459Szrj   /* This definition was pre-empted by a definition in a regular
145*a9fa9459Szrj      object file.  */
146*a9fa9459Szrj   LDPR_PREEMPTED_REG,
147*a9fa9459Szrj 
148*a9fa9459Szrj   /* This definition was pre-empted by a definition in another IR file.  */
149*a9fa9459Szrj   LDPR_PREEMPTED_IR,
150*a9fa9459Szrj 
151*a9fa9459Szrj   /* This symbol was resolved by a definition in another IR file.  */
152*a9fa9459Szrj   LDPR_RESOLVED_IR,
153*a9fa9459Szrj 
154*a9fa9459Szrj   /* This symbol was resolved by a definition in a regular object
155*a9fa9459Szrj      linked into the main executable.  */
156*a9fa9459Szrj   LDPR_RESOLVED_EXEC,
157*a9fa9459Szrj 
158*a9fa9459Szrj   /* This symbol was resolved by a definition in a shared object.  */
159*a9fa9459Szrj   LDPR_RESOLVED_DYN,
160*a9fa9459Szrj 
161*a9fa9459Szrj   /* This is the prevailing definition of the symbol, with no
162*a9fa9459Szrj      references from regular objects.  It is only referenced from IR
163*a9fa9459Szrj      code, but the symbol is exported and may be referenced from
164*a9fa9459Szrj      a dynamic object (not seen at link time).  */
165*a9fa9459Szrj   LDPR_PREVAILING_DEF_IRONLY_EXP
166*a9fa9459Szrj };
167*a9fa9459Szrj 
168*a9fa9459Szrj /* The plugin library's "claim file" handler.  */
169*a9fa9459Szrj 
170*a9fa9459Szrj typedef
171*a9fa9459Szrj enum ld_plugin_status
172*a9fa9459Szrj (*ld_plugin_claim_file_handler) (
173*a9fa9459Szrj   const struct ld_plugin_input_file *file, int *claimed);
174*a9fa9459Szrj 
175*a9fa9459Szrj /* The plugin library's "all symbols read" handler.  */
176*a9fa9459Szrj 
177*a9fa9459Szrj typedef
178*a9fa9459Szrj enum ld_plugin_status
179*a9fa9459Szrj (*ld_plugin_all_symbols_read_handler) (void);
180*a9fa9459Szrj 
181*a9fa9459Szrj /* The plugin library's cleanup handler.  */
182*a9fa9459Szrj 
183*a9fa9459Szrj typedef
184*a9fa9459Szrj enum ld_plugin_status
185*a9fa9459Szrj (*ld_plugin_cleanup_handler) (void);
186*a9fa9459Szrj 
187*a9fa9459Szrj /* The linker's interface for registering the "claim file" handler.  */
188*a9fa9459Szrj 
189*a9fa9459Szrj typedef
190*a9fa9459Szrj enum ld_plugin_status
191*a9fa9459Szrj (*ld_plugin_register_claim_file) (ld_plugin_claim_file_handler handler);
192*a9fa9459Szrj 
193*a9fa9459Szrj /* The linker's interface for registering the "all symbols read" handler.  */
194*a9fa9459Szrj 
195*a9fa9459Szrj typedef
196*a9fa9459Szrj enum ld_plugin_status
197*a9fa9459Szrj (*ld_plugin_register_all_symbols_read) (
198*a9fa9459Szrj   ld_plugin_all_symbols_read_handler handler);
199*a9fa9459Szrj 
200*a9fa9459Szrj /* The linker's interface for registering the cleanup handler.  */
201*a9fa9459Szrj 
202*a9fa9459Szrj typedef
203*a9fa9459Szrj enum ld_plugin_status
204*a9fa9459Szrj (*ld_plugin_register_cleanup) (ld_plugin_cleanup_handler handler);
205*a9fa9459Szrj 
206*a9fa9459Szrj /* The linker's interface for adding symbols from a claimed input file.  */
207*a9fa9459Szrj 
208*a9fa9459Szrj typedef
209*a9fa9459Szrj enum ld_plugin_status
210*a9fa9459Szrj (*ld_plugin_add_symbols) (void *handle, int nsyms,
211*a9fa9459Szrj                           const struct ld_plugin_symbol *syms);
212*a9fa9459Szrj 
213*a9fa9459Szrj /* The linker's interface for getting the input file information with
214*a9fa9459Szrj    an open (possibly re-opened) file descriptor.  */
215*a9fa9459Szrj 
216*a9fa9459Szrj typedef
217*a9fa9459Szrj enum ld_plugin_status
218*a9fa9459Szrj (*ld_plugin_get_input_file) (const void *handle,
219*a9fa9459Szrj                              struct ld_plugin_input_file *file);
220*a9fa9459Szrj 
221*a9fa9459Szrj typedef
222*a9fa9459Szrj enum ld_plugin_status
223*a9fa9459Szrj (*ld_plugin_get_view) (const void *handle, const void **viewp);
224*a9fa9459Szrj 
225*a9fa9459Szrj /* The linker's interface for releasing the input file.  */
226*a9fa9459Szrj 
227*a9fa9459Szrj typedef
228*a9fa9459Szrj enum ld_plugin_status
229*a9fa9459Szrj (*ld_plugin_release_input_file) (const void *handle);
230*a9fa9459Szrj 
231*a9fa9459Szrj /* The linker's interface for retrieving symbol resolution information.  */
232*a9fa9459Szrj 
233*a9fa9459Szrj typedef
234*a9fa9459Szrj enum ld_plugin_status
235*a9fa9459Szrj (*ld_plugin_get_symbols) (const void *handle, int nsyms,
236*a9fa9459Szrj                           struct ld_plugin_symbol *syms);
237*a9fa9459Szrj 
238*a9fa9459Szrj /* The linker's interface for adding a compiled input file.  */
239*a9fa9459Szrj 
240*a9fa9459Szrj typedef
241*a9fa9459Szrj enum ld_plugin_status
242*a9fa9459Szrj (*ld_plugin_add_input_file) (const char *pathname);
243*a9fa9459Szrj 
244*a9fa9459Szrj /* The linker's interface for adding a library that should be searched.  */
245*a9fa9459Szrj 
246*a9fa9459Szrj typedef
247*a9fa9459Szrj enum ld_plugin_status
248*a9fa9459Szrj (*ld_plugin_add_input_library) (const char *libname);
249*a9fa9459Szrj 
250*a9fa9459Szrj /* The linker's interface for adding a library path that should be searched.  */
251*a9fa9459Szrj 
252*a9fa9459Szrj typedef
253*a9fa9459Szrj enum ld_plugin_status
254*a9fa9459Szrj (*ld_plugin_set_extra_library_path) (const char *path);
255*a9fa9459Szrj 
256*a9fa9459Szrj /* The linker's interface for issuing a warning or error message.  */
257*a9fa9459Szrj 
258*a9fa9459Szrj typedef
259*a9fa9459Szrj enum ld_plugin_status
260*a9fa9459Szrj (*ld_plugin_message) (int level, const char *format, ...);
261*a9fa9459Szrj 
262*a9fa9459Szrj /* The linker's interface for retrieving the number of sections in an object.
263*a9fa9459Szrj    The handle is obtained in the claim_file handler.  This interface should
264*a9fa9459Szrj    only be invoked in the claim_file handler.   This function sets *COUNT to
265*a9fa9459Szrj    the number of sections in the object.  */
266*a9fa9459Szrj 
267*a9fa9459Szrj typedef
268*a9fa9459Szrj enum ld_plugin_status
269*a9fa9459Szrj (*ld_plugin_get_input_section_count) (const void* handle, unsigned int *count);
270*a9fa9459Szrj 
271*a9fa9459Szrj /* The linker's interface for retrieving the section type of a specific
272*a9fa9459Szrj    section in an object.  This interface should only be invoked in the
273*a9fa9459Szrj    claim_file handler.  This function sets *TYPE to an ELF SHT_xxx value.  */
274*a9fa9459Szrj 
275*a9fa9459Szrj typedef
276*a9fa9459Szrj enum ld_plugin_status
277*a9fa9459Szrj (*ld_plugin_get_input_section_type) (const struct ld_plugin_section section,
278*a9fa9459Szrj                                      unsigned int *type);
279*a9fa9459Szrj 
280*a9fa9459Szrj /* The linker's interface for retrieving the name of a specific section in
281*a9fa9459Szrj    an object. This interface should only be invoked in the claim_file handler.
282*a9fa9459Szrj    This function sets *SECTION_NAME_PTR to a null-terminated buffer allocated
283*a9fa9459Szrj    by malloc.  The plugin must free *SECTION_NAME_PTR.  */
284*a9fa9459Szrj 
285*a9fa9459Szrj typedef
286*a9fa9459Szrj enum ld_plugin_status
287*a9fa9459Szrj (*ld_plugin_get_input_section_name) (const struct ld_plugin_section section,
288*a9fa9459Szrj                                      char **section_name_ptr);
289*a9fa9459Szrj 
290*a9fa9459Szrj /* The linker's interface for retrieving the contents of a specific section
291*a9fa9459Szrj    in an object.  This interface should only be invoked in the claim_file
292*a9fa9459Szrj    handler.  This function sets *SECTION_CONTENTS to point to a buffer that is
293*a9fa9459Szrj    valid until clam_file handler returns.  It sets *LEN to the size of the
294*a9fa9459Szrj    buffer.  */
295*a9fa9459Szrj 
296*a9fa9459Szrj typedef
297*a9fa9459Szrj enum ld_plugin_status
298*a9fa9459Szrj (*ld_plugin_get_input_section_contents) (const struct ld_plugin_section section,
299*a9fa9459Szrj                                          const unsigned char **section_contents,
300*a9fa9459Szrj                                          size_t* len);
301*a9fa9459Szrj 
302*a9fa9459Szrj /* The linker's interface for specifying the desired order of sections.
303*a9fa9459Szrj    The sections should be specifed using the array SECTION_LIST in the
304*a9fa9459Szrj    order in which they should appear in the final layout.  NUM_SECTIONS
305*a9fa9459Szrj    specifies the number of entries in each array.  This should be invoked
306*a9fa9459Szrj    in the all_symbols_read handler.  */
307*a9fa9459Szrj 
308*a9fa9459Szrj typedef
309*a9fa9459Szrj enum ld_plugin_status
310*a9fa9459Szrj (*ld_plugin_update_section_order) (const struct ld_plugin_section *section_list,
311*a9fa9459Szrj 				   unsigned int num_sections);
312*a9fa9459Szrj 
313*a9fa9459Szrj /* The linker's interface for specifying that reordering of sections is
314*a9fa9459Szrj    desired so that the linker can prepare for it.  This should be invoked
315*a9fa9459Szrj    before update_section_order, preferably in the claim_file handler.  */
316*a9fa9459Szrj 
317*a9fa9459Szrj typedef
318*a9fa9459Szrj enum ld_plugin_status
319*a9fa9459Szrj (*ld_plugin_allow_section_ordering) (void);
320*a9fa9459Szrj 
321*a9fa9459Szrj /* The linker's interface for specifying that a subset of sections is
322*a9fa9459Szrj    to be mapped to a unique segment.  If the plugin wants to call
323*a9fa9459Szrj    unique_segment_for_sections, it must call this function from a
324*a9fa9459Szrj    claim_file_handler or when it is first loaded.  */
325*a9fa9459Szrj 
326*a9fa9459Szrj typedef
327*a9fa9459Szrj enum ld_plugin_status
328*a9fa9459Szrj (*ld_plugin_allow_unique_segment_for_sections) (void);
329*a9fa9459Szrj 
330*a9fa9459Szrj /* The linker's interface for specifying that a specific set of sections
331*a9fa9459Szrj    must be mapped to a unique segment.  ELF segments do not have names
332*a9fa9459Szrj    and the NAME is used as the name of the newly created output section
333*a9fa9459Szrj    that is then placed in the unique PT_LOAD segment.  FLAGS is used to
334*a9fa9459Szrj    specify if any additional segment flags need to be set.  For instance,
335*a9fa9459Szrj    a specific segment flag can be set to identify this segment.  Unsetting
336*a9fa9459Szrj    segment flags that would be set by default is not possible.  The
337*a9fa9459Szrj    parameter SEGMENT_ALIGNMENT when non-zero will override the default.  */
338*a9fa9459Szrj 
339*a9fa9459Szrj typedef
340*a9fa9459Szrj enum ld_plugin_status
341*a9fa9459Szrj (*ld_plugin_unique_segment_for_sections) (
342*a9fa9459Szrj     const char* segment_name,
343*a9fa9459Szrj     uint64_t segment_flags,
344*a9fa9459Szrj     uint64_t segment_alignment,
345*a9fa9459Szrj     const struct ld_plugin_section * section_list,
346*a9fa9459Szrj     unsigned int num_sections);
347*a9fa9459Szrj 
348*a9fa9459Szrj /* The linker's interface for retrieving the section alignment requirement
349*a9fa9459Szrj    of a specific section in an object.  This interface should only be invoked in the
350*a9fa9459Szrj    claim_file handler.  This function sets *ADDRALIGN to the ELF sh_addralign
351*a9fa9459Szrj    value of the input section.  */
352*a9fa9459Szrj 
353*a9fa9459Szrj typedef
354*a9fa9459Szrj enum ld_plugin_status
355*a9fa9459Szrj (*ld_plugin_get_input_section_alignment) (const struct ld_plugin_section section,
356*a9fa9459Szrj                                           unsigned int *addralign);
357*a9fa9459Szrj 
358*a9fa9459Szrj /* The linker's interface for retrieving the section size of a specific section
359*a9fa9459Szrj    in an object.  This interface should only be invoked in the claim_file handler.
360*a9fa9459Szrj    This function sets *SECSIZE to the ELF sh_size
361*a9fa9459Szrj    value of the input section.  */
362*a9fa9459Szrj 
363*a9fa9459Szrj typedef
364*a9fa9459Szrj enum ld_plugin_status
365*a9fa9459Szrj (*ld_plugin_get_input_section_size) (const struct ld_plugin_section section,
366*a9fa9459Szrj                                      uint64_t *secsize);
367*a9fa9459Szrj 
368*a9fa9459Szrj enum ld_plugin_level
369*a9fa9459Szrj {
370*a9fa9459Szrj   LDPL_INFO,
371*a9fa9459Szrj   LDPL_WARNING,
372*a9fa9459Szrj   LDPL_ERROR,
373*a9fa9459Szrj   LDPL_FATAL
374*a9fa9459Szrj };
375*a9fa9459Szrj 
376*a9fa9459Szrj /* Values for the tv_tag field of the transfer vector.  */
377*a9fa9459Szrj 
378*a9fa9459Szrj enum ld_plugin_tag
379*a9fa9459Szrj {
380*a9fa9459Szrj   LDPT_NULL = 0,
381*a9fa9459Szrj   LDPT_API_VERSION = 1,
382*a9fa9459Szrj   LDPT_GOLD_VERSION = 2,
383*a9fa9459Szrj   LDPT_LINKER_OUTPUT = 3,
384*a9fa9459Szrj   LDPT_OPTION = 4,
385*a9fa9459Szrj   LDPT_REGISTER_CLAIM_FILE_HOOK = 5,
386*a9fa9459Szrj   LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK = 6,
387*a9fa9459Szrj   LDPT_REGISTER_CLEANUP_HOOK = 7,
388*a9fa9459Szrj   LDPT_ADD_SYMBOLS = 8,
389*a9fa9459Szrj   LDPT_GET_SYMBOLS = 9,
390*a9fa9459Szrj   LDPT_ADD_INPUT_FILE = 10,
391*a9fa9459Szrj   LDPT_MESSAGE = 11,
392*a9fa9459Szrj   LDPT_GET_INPUT_FILE = 12,
393*a9fa9459Szrj   LDPT_RELEASE_INPUT_FILE = 13,
394*a9fa9459Szrj   LDPT_ADD_INPUT_LIBRARY = 14,
395*a9fa9459Szrj   LDPT_OUTPUT_NAME = 15,
396*a9fa9459Szrj   LDPT_SET_EXTRA_LIBRARY_PATH = 16,
397*a9fa9459Szrj   LDPT_GNU_LD_VERSION = 17,
398*a9fa9459Szrj   LDPT_GET_VIEW = 18,
399*a9fa9459Szrj   LDPT_GET_INPUT_SECTION_COUNT = 19,
400*a9fa9459Szrj   LDPT_GET_INPUT_SECTION_TYPE = 20,
401*a9fa9459Szrj   LDPT_GET_INPUT_SECTION_NAME = 21,
402*a9fa9459Szrj   LDPT_GET_INPUT_SECTION_CONTENTS = 22,
403*a9fa9459Szrj   LDPT_UPDATE_SECTION_ORDER = 23,
404*a9fa9459Szrj   LDPT_ALLOW_SECTION_ORDERING = 24,
405*a9fa9459Szrj   LDPT_GET_SYMBOLS_V2 = 25,
406*a9fa9459Szrj   LDPT_ALLOW_UNIQUE_SEGMENT_FOR_SECTIONS = 26,
407*a9fa9459Szrj   LDPT_UNIQUE_SEGMENT_FOR_SECTIONS = 27,
408*a9fa9459Szrj   LDPT_GET_SYMBOLS_V3 = 28,
409*a9fa9459Szrj   LDPT_GET_INPUT_SECTION_ALIGNMENT = 29,
410*a9fa9459Szrj   LDPT_GET_INPUT_SECTION_SIZE = 30
411*a9fa9459Szrj };
412*a9fa9459Szrj 
413*a9fa9459Szrj /* The plugin transfer vector.  */
414*a9fa9459Szrj 
415*a9fa9459Szrj struct ld_plugin_tv
416*a9fa9459Szrj {
417*a9fa9459Szrj   enum ld_plugin_tag tv_tag;
418*a9fa9459Szrj   union
419*a9fa9459Szrj   {
420*a9fa9459Szrj     int tv_val;
421*a9fa9459Szrj     const char *tv_string;
422*a9fa9459Szrj     ld_plugin_register_claim_file tv_register_claim_file;
423*a9fa9459Szrj     ld_plugin_register_all_symbols_read tv_register_all_symbols_read;
424*a9fa9459Szrj     ld_plugin_register_cleanup tv_register_cleanup;
425*a9fa9459Szrj     ld_plugin_add_symbols tv_add_symbols;
426*a9fa9459Szrj     ld_plugin_get_symbols tv_get_symbols;
427*a9fa9459Szrj     ld_plugin_add_input_file tv_add_input_file;
428*a9fa9459Szrj     ld_plugin_message tv_message;
429*a9fa9459Szrj     ld_plugin_get_input_file tv_get_input_file;
430*a9fa9459Szrj     ld_plugin_get_view tv_get_view;
431*a9fa9459Szrj     ld_plugin_release_input_file tv_release_input_file;
432*a9fa9459Szrj     ld_plugin_add_input_library tv_add_input_library;
433*a9fa9459Szrj     ld_plugin_set_extra_library_path tv_set_extra_library_path;
434*a9fa9459Szrj     ld_plugin_get_input_section_count tv_get_input_section_count;
435*a9fa9459Szrj     ld_plugin_get_input_section_type tv_get_input_section_type;
436*a9fa9459Szrj     ld_plugin_get_input_section_name tv_get_input_section_name;
437*a9fa9459Szrj     ld_plugin_get_input_section_contents tv_get_input_section_contents;
438*a9fa9459Szrj     ld_plugin_update_section_order tv_update_section_order;
439*a9fa9459Szrj     ld_plugin_allow_section_ordering tv_allow_section_ordering;
440*a9fa9459Szrj     ld_plugin_allow_unique_segment_for_sections tv_allow_unique_segment_for_sections;
441*a9fa9459Szrj     ld_plugin_unique_segment_for_sections tv_unique_segment_for_sections;
442*a9fa9459Szrj     ld_plugin_get_input_section_alignment tv_get_input_section_alignment;
443*a9fa9459Szrj     ld_plugin_get_input_section_size tv_get_input_section_size;
444*a9fa9459Szrj   } tv_u;
445*a9fa9459Szrj };
446*a9fa9459Szrj 
447*a9fa9459Szrj /* The plugin library's "onload" entry point.  */
448*a9fa9459Szrj 
449*a9fa9459Szrj typedef
450*a9fa9459Szrj enum ld_plugin_status
451*a9fa9459Szrj (*ld_plugin_onload) (struct ld_plugin_tv *tv);
452*a9fa9459Szrj 
453*a9fa9459Szrj #ifdef __cplusplus
454*a9fa9459Szrj }
455*a9fa9459Szrj #endif
456*a9fa9459Szrj 
457*a9fa9459Szrj #endif /* !defined(PLUGIN_API_H) */
458