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