1*a9fa9459Szrj /* script-c.h -- C interface for linker scripts in gold. */ 2*a9fa9459Szrj 3*a9fa9459Szrj /* Copyright (C) 2006-2016 Free Software Foundation, Inc. 4*a9fa9459Szrj Written by Ian Lance Taylor <iant@google.com>. 5*a9fa9459Szrj 6*a9fa9459Szrj This file is part of gold. 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 exists so that both the bison parser and script.cc can 24*a9fa9459Szrj include it, so that they can communicate back and forth. */ 25*a9fa9459Szrj 26*a9fa9459Szrj #ifndef GOLD_SCRIPT_C_H 27*a9fa9459Szrj #define GOLD_SCRIPT_C_H 28*a9fa9459Szrj 29*a9fa9459Szrj #ifdef __cplusplus 30*a9fa9459Szrj #include <vector> 31*a9fa9459Szrj #include <string> 32*a9fa9459Szrj #endif 33*a9fa9459Szrj 34*a9fa9459Szrj #ifdef __cplusplus 35*a9fa9459Szrj 36*a9fa9459Szrj // For the C++ code we declare the various supporting structures in 37*a9fa9459Szrj // the gold namespace. For the C code we declare it at the top level. 38*a9fa9459Szrj // The namespace level should not affect the layout of the structure. 39*a9fa9459Szrj 40*a9fa9459Szrj namespace gold 41*a9fa9459Szrj { 42*a9fa9459Szrj #endif 43*a9fa9459Szrj 44*a9fa9459Szrj /* A string value for the bison parser. */ 45*a9fa9459Szrj 46*a9fa9459Szrj struct Parser_string 47*a9fa9459Szrj { 48*a9fa9459Szrj const char* value; 49*a9fa9459Szrj size_t length; 50*a9fa9459Szrj }; 51*a9fa9459Szrj 52*a9fa9459Szrj /* The expression functions deal with pointers to Expression objects. 53*a9fa9459Szrj Since the bison parser generates C code, this is a hack to keep the 54*a9fa9459Szrj C++ code type safe. This hacks assumes that all pointers look 55*a9fa9459Szrj alike. */ 56*a9fa9459Szrj 57*a9fa9459Szrj #ifdef __cplusplus 58*a9fa9459Szrj class Expression; 59*a9fa9459Szrj typedef Expression* Expression_ptr; 60*a9fa9459Szrj #else 61*a9fa9459Szrj typedef void* Expression_ptr; 62*a9fa9459Szrj #endif 63*a9fa9459Szrj 64*a9fa9459Szrj /* Script_section type. */ 65*a9fa9459Szrj enum Script_section_type 66*a9fa9459Szrj { 67*a9fa9459Szrj /* No section type. */ 68*a9fa9459Szrj SCRIPT_SECTION_TYPE_NONE, 69*a9fa9459Szrj SCRIPT_SECTION_TYPE_NOLOAD, 70*a9fa9459Szrj SCRIPT_SECTION_TYPE_DSECT, 71*a9fa9459Szrj SCRIPT_SECTION_TYPE_COPY, 72*a9fa9459Szrj SCRIPT_SECTION_TYPE_INFO, 73*a9fa9459Szrj SCRIPT_SECTION_TYPE_OVERLAY 74*a9fa9459Szrj }; 75*a9fa9459Szrj 76*a9fa9459Szrj /* A constraint for whether to use a particular output section 77*a9fa9459Szrj definition. */ 78*a9fa9459Szrj 79*a9fa9459Szrj enum Section_constraint 80*a9fa9459Szrj { 81*a9fa9459Szrj /* No constraint. */ 82*a9fa9459Szrj CONSTRAINT_NONE, 83*a9fa9459Szrj /* Only if all input sections are read-only. */ 84*a9fa9459Szrj CONSTRAINT_ONLY_IF_RO, 85*a9fa9459Szrj /* Only if at least input section is writable. */ 86*a9fa9459Szrj CONSTRAINT_ONLY_IF_RW, 87*a9fa9459Szrj /* Special constraint. */ 88*a9fa9459Szrj CONSTRAINT_SPECIAL 89*a9fa9459Szrj }; 90*a9fa9459Szrj 91*a9fa9459Szrj /* The information we store for an output section header in the bison 92*a9fa9459Szrj parser. */ 93*a9fa9459Szrj 94*a9fa9459Szrj struct Parser_output_section_header 95*a9fa9459Szrj { 96*a9fa9459Szrj /* The address. This may be NULL. */ 97*a9fa9459Szrj Expression_ptr address; 98*a9fa9459Szrj /* Section type. May be NULL string. */ 99*a9fa9459Szrj enum Script_section_type section_type; 100*a9fa9459Szrj /* The load address, from the AT specifier. This may be NULL. */ 101*a9fa9459Szrj Expression_ptr load_address; 102*a9fa9459Szrj /* The alignment, from the ALIGN specifier. This may be NULL. */ 103*a9fa9459Szrj Expression_ptr align; 104*a9fa9459Szrj /* The input section alignment, from the SUBALIGN specifier. This 105*a9fa9459Szrj may be NULL. */ 106*a9fa9459Szrj Expression_ptr subalign; 107*a9fa9459Szrj /* A constraint on this output section. */ 108*a9fa9459Szrj enum Section_constraint constraint; 109*a9fa9459Szrj }; 110*a9fa9459Szrj 111*a9fa9459Szrj /* We keep vectors of strings. In order to manage this in both C and 112*a9fa9459Szrj C++, we use a pointer to a vector. This assumes that all pointers 113*a9fa9459Szrj look the same. */ 114*a9fa9459Szrj 115*a9fa9459Szrj #ifdef __cplusplus 116*a9fa9459Szrj typedef std::vector<std::string> String_list; 117*a9fa9459Szrj typedef String_list* String_list_ptr; 118*a9fa9459Szrj #else 119*a9fa9459Szrj typedef void* String_list_ptr; 120*a9fa9459Szrj #endif 121*a9fa9459Szrj 122*a9fa9459Szrj /* The information we store for an output section trailer in the bison 123*a9fa9459Szrj parser. */ 124*a9fa9459Szrj 125*a9fa9459Szrj struct Parser_output_section_trailer 126*a9fa9459Szrj { 127*a9fa9459Szrj /* The fill value. This may be NULL. */ 128*a9fa9459Szrj Expression_ptr fill; 129*a9fa9459Szrj /* The program segments this section should go into. This may be 130*a9fa9459Szrj NULL. */ 131*a9fa9459Szrj String_list_ptr phdrs; 132*a9fa9459Szrj }; 133*a9fa9459Szrj 134*a9fa9459Szrj /* The different sorts we can find in a linker script. */ 135*a9fa9459Szrj 136*a9fa9459Szrj enum Sort_wildcard 137*a9fa9459Szrj { 138*a9fa9459Szrj SORT_WILDCARD_NONE, 139*a9fa9459Szrj SORT_WILDCARD_BY_NAME, 140*a9fa9459Szrj SORT_WILDCARD_BY_ALIGNMENT, 141*a9fa9459Szrj SORT_WILDCARD_BY_NAME_BY_ALIGNMENT, 142*a9fa9459Szrj SORT_WILDCARD_BY_ALIGNMENT_BY_NAME, 143*a9fa9459Szrj SORT_WILDCARD_BY_INIT_PRIORITY 144*a9fa9459Szrj }; 145*a9fa9459Szrj 146*a9fa9459Szrj /* The information we build for a single wildcard specification. */ 147*a9fa9459Szrj 148*a9fa9459Szrj struct Wildcard_section 149*a9fa9459Szrj { 150*a9fa9459Szrj /* The wildcard spec itself. */ 151*a9fa9459Szrj struct Parser_string name; 152*a9fa9459Szrj /* How the entries should be sorted. */ 153*a9fa9459Szrj enum Sort_wildcard sort; 154*a9fa9459Szrj }; 155*a9fa9459Szrj 156*a9fa9459Szrj /* A vector of Wildcard_section entries. */ 157*a9fa9459Szrj 158*a9fa9459Szrj #ifdef __cplusplus 159*a9fa9459Szrj typedef std::vector<Wildcard_section> String_sort_list; 160*a9fa9459Szrj typedef String_sort_list* String_sort_list_ptr; 161*a9fa9459Szrj #else 162*a9fa9459Szrj typedef void* String_sort_list_ptr; 163*a9fa9459Szrj #endif 164*a9fa9459Szrj 165*a9fa9459Szrj /* A list of wildcard specifications, which may include EXCLUDE_FILE 166*a9fa9459Szrj clauses. */ 167*a9fa9459Szrj 168*a9fa9459Szrj struct Wildcard_sections 169*a9fa9459Szrj { 170*a9fa9459Szrj /* Wildcard specs. */ 171*a9fa9459Szrj String_sort_list_ptr sections; 172*a9fa9459Szrj /* Exclusions. */ 173*a9fa9459Szrj String_list_ptr exclude; 174*a9fa9459Szrj }; 175*a9fa9459Szrj 176*a9fa9459Szrj /* A complete input section specification. */ 177*a9fa9459Szrj 178*a9fa9459Szrj struct Input_section_spec 179*a9fa9459Szrj { 180*a9fa9459Szrj /* The file name. */ 181*a9fa9459Szrj struct Wildcard_section file; 182*a9fa9459Szrj /* The list of sections. */ 183*a9fa9459Szrj struct Wildcard_sections input_sections; 184*a9fa9459Szrj }; 185*a9fa9459Szrj 186*a9fa9459Szrj /* Information for a program header. */ 187*a9fa9459Szrj 188*a9fa9459Szrj struct Phdr_info 189*a9fa9459Szrj { 190*a9fa9459Szrj /* A boolean value: whether to include the file header. */ 191*a9fa9459Szrj int includes_filehdr; 192*a9fa9459Szrj /* A boolean value: whether to include the program headers. */ 193*a9fa9459Szrj int includes_phdrs; 194*a9fa9459Szrj /* A boolean value: whether the flags field is valid. */ 195*a9fa9459Szrj int is_flags_valid; 196*a9fa9459Szrj /* The value to use for the flags. */ 197*a9fa9459Szrj unsigned int flags; 198*a9fa9459Szrj /* The load address. */ 199*a9fa9459Szrj Expression_ptr load_address; 200*a9fa9459Szrj }; 201*a9fa9459Szrj 202*a9fa9459Szrj struct Version_dependency_list; 203*a9fa9459Szrj struct Version_expression_list; 204*a9fa9459Szrj struct Version_tree; 205*a9fa9459Szrj 206*a9fa9459Szrj #ifdef __cplusplus 207*a9fa9459Szrj extern "C" { 208*a9fa9459Szrj #endif 209*a9fa9459Szrj 210*a9fa9459Szrj /* The bison parser definitions. */ 211*a9fa9459Szrj 212*a9fa9459Szrj #include "yyscript.h" 213*a9fa9459Szrj 214*a9fa9459Szrj /* The bison parser function. */ 215*a9fa9459Szrj 216*a9fa9459Szrj extern int 217*a9fa9459Szrj yyparse(void* closure); 218*a9fa9459Szrj 219*a9fa9459Szrj /* Called by the bison parser skeleton to return the next token. */ 220*a9fa9459Szrj 221*a9fa9459Szrj extern int 222*a9fa9459Szrj yylex(YYSTYPE*, void* closure); 223*a9fa9459Szrj 224*a9fa9459Szrj /* Called by the bison parser skeleton to report an error. */ 225*a9fa9459Szrj 226*a9fa9459Szrj extern void 227*a9fa9459Szrj yyerror(void* closure, const char*); 228*a9fa9459Szrj 229*a9fa9459Szrj /* Called by the bison parser to add an external symbol (a symbol in 230*a9fa9459Szrj an EXTERN declaration) to the link. */ 231*a9fa9459Szrj 232*a9fa9459Szrj extern void 233*a9fa9459Szrj script_add_extern(void* closure, const char*, size_t); 234*a9fa9459Szrj 235*a9fa9459Szrj /* Called by the bison parser to add a file to the link. */ 236*a9fa9459Szrj 237*a9fa9459Szrj extern void 238*a9fa9459Szrj script_add_file(void* closure, const char*, size_t); 239*a9fa9459Szrj 240*a9fa9459Szrj /* Called by the bison parser to add a library to the link. */ 241*a9fa9459Szrj 242*a9fa9459Szrj extern void 243*a9fa9459Szrj script_add_library(void* closure, const char*, size_t); 244*a9fa9459Szrj 245*a9fa9459Szrj /* Called by the bison parser to start and stop a group. */ 246*a9fa9459Szrj 247*a9fa9459Szrj extern void 248*a9fa9459Szrj script_start_group(void* closure); 249*a9fa9459Szrj extern void 250*a9fa9459Szrj script_end_group(void* closure); 251*a9fa9459Szrj 252*a9fa9459Szrj /* Called by the bison parser to start and end an AS_NEEDED list. */ 253*a9fa9459Szrj 254*a9fa9459Szrj extern void 255*a9fa9459Szrj script_start_as_needed(void* closure); 256*a9fa9459Szrj extern void 257*a9fa9459Szrj script_end_as_needed(void* closure); 258*a9fa9459Szrj 259*a9fa9459Szrj /* Called by the bison parser to set the entry symbol. */ 260*a9fa9459Szrj 261*a9fa9459Szrj extern void 262*a9fa9459Szrj script_set_entry(void* closure, const char*, size_t); 263*a9fa9459Szrj 264*a9fa9459Szrj /* Called by the bison parser to set whether to define common symbols. */ 265*a9fa9459Szrj 266*a9fa9459Szrj extern void 267*a9fa9459Szrj script_set_common_allocation(void* closure, int); 268*a9fa9459Szrj 269*a9fa9459Szrj /* Called by the bison parser to parse an OPTION. */ 270*a9fa9459Szrj 271*a9fa9459Szrj extern void 272*a9fa9459Szrj script_parse_option(void* closure, const char*, size_t); 273*a9fa9459Szrj 274*a9fa9459Szrj /* Called by the bison parser to handle OUTPUT_FORMAT. This return 0 275*a9fa9459Szrj if the parse should be aborted. */ 276*a9fa9459Szrj 277*a9fa9459Szrj extern int 278*a9fa9459Szrj script_check_output_format(void* closure, const char*, size_t, 279*a9fa9459Szrj const char*, size_t, const char*, size_t); 280*a9fa9459Szrj 281*a9fa9459Szrj /* Called by the bison parser to handle TARGET. */ 282*a9fa9459Szrj extern void 283*a9fa9459Szrj script_set_target(void* closure, const char*, size_t); 284*a9fa9459Szrj 285*a9fa9459Szrj /* Called by the bison parser to handle SEARCH_DIR. */ 286*a9fa9459Szrj 287*a9fa9459Szrj extern void 288*a9fa9459Szrj script_add_search_dir(void* closure, const char*, size_t); 289*a9fa9459Szrj 290*a9fa9459Szrj /* Called by the bison parser to push the lexer into expression 291*a9fa9459Szrj mode. */ 292*a9fa9459Szrj 293*a9fa9459Szrj extern void 294*a9fa9459Szrj script_push_lex_into_expression_mode(void* closure); 295*a9fa9459Szrj 296*a9fa9459Szrj /* Called by the bison parser to push the lexer into version 297*a9fa9459Szrj mode. */ 298*a9fa9459Szrj 299*a9fa9459Szrj extern void 300*a9fa9459Szrj script_push_lex_into_version_mode(void* closure); 301*a9fa9459Szrj 302*a9fa9459Szrj /* Called by the bison parser to pop the lexer mode. */ 303*a9fa9459Szrj 304*a9fa9459Szrj extern void 305*a9fa9459Szrj script_pop_lex_mode(void* closure); 306*a9fa9459Szrj 307*a9fa9459Szrj /* Called by the bison parser to get the value of a symbol. This is 308*a9fa9459Szrj called for a reference to a symbol, but is not called for something 309*a9fa9459Szrj like "sym += 10". Uses of the special symbol "." can just call 310*a9fa9459Szrj script_exp_string. */ 311*a9fa9459Szrj 312*a9fa9459Szrj extern Expression_ptr 313*a9fa9459Szrj script_symbol(void* closure, const char*, size_t); 314*a9fa9459Szrj 315*a9fa9459Szrj /* Called by the bison parser to set a symbol to a value. PROVIDE is 316*a9fa9459Szrj non-zero if the symbol should be provided--only defined if there is 317*a9fa9459Szrj an undefined reference. HIDDEN is non-zero if the symbol should be 318*a9fa9459Szrj hidden. */ 319*a9fa9459Szrj 320*a9fa9459Szrj extern void 321*a9fa9459Szrj script_set_symbol(void* closure, const char*, size_t, Expression_ptr, 322*a9fa9459Szrj int provide, int hidden); 323*a9fa9459Szrj 324*a9fa9459Szrj /* Called by the bison parser to add an assertion. */ 325*a9fa9459Szrj 326*a9fa9459Szrj extern void 327*a9fa9459Szrj script_add_assertion(void* closure, Expression_ptr, const char* message, 328*a9fa9459Szrj size_t messagelen); 329*a9fa9459Szrj 330*a9fa9459Szrj /* Called by the bison parser to start a SECTIONS clause. */ 331*a9fa9459Szrj 332*a9fa9459Szrj extern void 333*a9fa9459Szrj script_start_sections(void* closure); 334*a9fa9459Szrj 335*a9fa9459Szrj /* Called by the bison parser to finish a SECTIONS clause. */ 336*a9fa9459Szrj 337*a9fa9459Szrj extern void 338*a9fa9459Szrj script_finish_sections(void* closure); 339*a9fa9459Szrj 340*a9fa9459Szrj /* Called by the bison parser to start handling input section 341*a9fa9459Szrj specifications for an output section. */ 342*a9fa9459Szrj 343*a9fa9459Szrj extern void 344*a9fa9459Szrj script_start_output_section(void* closure, const char* name, size_t namelen, 345*a9fa9459Szrj const struct Parser_output_section_header*); 346*a9fa9459Szrj 347*a9fa9459Szrj /* Called by the bison parser when done handling input section 348*a9fa9459Szrj specifications for an output section. */ 349*a9fa9459Szrj 350*a9fa9459Szrj extern void 351*a9fa9459Szrj script_finish_output_section(void* closure, 352*a9fa9459Szrj const struct Parser_output_section_trailer*); 353*a9fa9459Szrj 354*a9fa9459Szrj /* Called by the bison parser to handle a data statement (LONG, BYTE, 355*a9fa9459Szrj etc.) in an output section. */ 356*a9fa9459Szrj 357*a9fa9459Szrj extern void 358*a9fa9459Szrj script_add_data(void* closure, int data_token, Expression_ptr val); 359*a9fa9459Szrj 360*a9fa9459Szrj /* Called by the bison parser to set the fill value in an output 361*a9fa9459Szrj section. */ 362*a9fa9459Szrj 363*a9fa9459Szrj extern void 364*a9fa9459Szrj script_add_fill(void* closure, Expression_ptr val); 365*a9fa9459Szrj 366*a9fa9459Szrj /* Called by the bison parser to add an input section specification to 367*a9fa9459Szrj an output section. The KEEP parameter is non-zero if this is 368*a9fa9459Szrj within a KEEP clause, meaning that the garbage collector should not 369*a9fa9459Szrj discard it. */ 370*a9fa9459Szrj 371*a9fa9459Szrj extern void 372*a9fa9459Szrj script_add_input_section(void* closure, const struct Input_section_spec*, 373*a9fa9459Szrj int keep); 374*a9fa9459Szrj 375*a9fa9459Szrj /* Create a new list of string and sort entries. */ 376*a9fa9459Szrj 377*a9fa9459Szrj extern String_sort_list_ptr 378*a9fa9459Szrj script_new_string_sort_list(const struct Wildcard_section*); 379*a9fa9459Szrj 380*a9fa9459Szrj /* Add an entry to a list of string and sort entries. */ 381*a9fa9459Szrj 382*a9fa9459Szrj extern String_sort_list_ptr 383*a9fa9459Szrj script_string_sort_list_add(String_sort_list_ptr, 384*a9fa9459Szrj const struct Wildcard_section*); 385*a9fa9459Szrj 386*a9fa9459Szrj /* Create a new list of strings. */ 387*a9fa9459Szrj 388*a9fa9459Szrj extern String_list_ptr 389*a9fa9459Szrj script_new_string_list(const char*, size_t); 390*a9fa9459Szrj 391*a9fa9459Szrj /* Add an element to a list of strings. */ 392*a9fa9459Szrj 393*a9fa9459Szrj extern String_list_ptr 394*a9fa9459Szrj script_string_list_push_back(String_list_ptr, const char*, size_t); 395*a9fa9459Szrj 396*a9fa9459Szrj /* Concatenate two string lists. */ 397*a9fa9459Szrj 398*a9fa9459Szrj extern String_list_ptr 399*a9fa9459Szrj script_string_list_append(String_list_ptr, String_list_ptr); 400*a9fa9459Szrj 401*a9fa9459Szrj /* Define a new program header. */ 402*a9fa9459Szrj 403*a9fa9459Szrj extern void 404*a9fa9459Szrj script_add_phdr(void* closure, const char* name, size_t namelen, 405*a9fa9459Szrj unsigned int type, const struct Phdr_info*); 406*a9fa9459Szrj 407*a9fa9459Szrj /* Convert a program header string to a type. */ 408*a9fa9459Szrj 409*a9fa9459Szrj extern unsigned int 410*a9fa9459Szrj script_phdr_string_to_type(void* closure, const char*, size_t); 411*a9fa9459Szrj 412*a9fa9459Szrj /* Handle DATA_SEGMENT_ALIGN and DATA_SEGMENT_RELRO_END. */ 413*a9fa9459Szrj 414*a9fa9459Szrj extern void 415*a9fa9459Szrj script_data_segment_align(void* closure); 416*a9fa9459Szrj 417*a9fa9459Szrj extern void 418*a9fa9459Szrj script_data_segment_relro_end(void* closure); 419*a9fa9459Szrj 420*a9fa9459Szrj /* Record the fact that a SEGMENT_START expression is seen. */ 421*a9fa9459Szrj 422*a9fa9459Szrj extern void 423*a9fa9459Szrj script_saw_segment_start_expression(void* closure); 424*a9fa9459Szrj 425*a9fa9459Szrj /* Called by the bison parser for MEMORY regions. */ 426*a9fa9459Szrj 427*a9fa9459Szrj extern void 428*a9fa9459Szrj script_add_memory(void*, const char*, size_t, unsigned int, 429*a9fa9459Szrj Expression_ptr, Expression_ptr); 430*a9fa9459Szrj 431*a9fa9459Szrj extern unsigned int 432*a9fa9459Szrj script_parse_memory_attr(void*, const char*, size_t, int); 433*a9fa9459Szrj 434*a9fa9459Szrj extern void 435*a9fa9459Szrj script_set_section_region(void*, const char*, size_t, int); 436*a9fa9459Szrj 437*a9fa9459Szrj extern void 438*a9fa9459Szrj script_include_directive(int, void *, const char*, size_t); 439*a9fa9459Szrj 440*a9fa9459Szrj /* Called by the bison parser for expressions. */ 441*a9fa9459Szrj 442*a9fa9459Szrj extern Expression_ptr 443*a9fa9459Szrj script_exp_unary_minus(Expression_ptr); 444*a9fa9459Szrj extern Expression_ptr 445*a9fa9459Szrj script_exp_unary_logical_not(Expression_ptr); 446*a9fa9459Szrj extern Expression_ptr 447*a9fa9459Szrj script_exp_unary_bitwise_not(Expression_ptr); 448*a9fa9459Szrj extern Expression_ptr 449*a9fa9459Szrj script_exp_binary_mult(Expression_ptr, Expression_ptr); 450*a9fa9459Szrj extern Expression_ptr 451*a9fa9459Szrj script_exp_binary_div(Expression_ptr, Expression_ptr); 452*a9fa9459Szrj extern Expression_ptr 453*a9fa9459Szrj script_exp_binary_mod(Expression_ptr, Expression_ptr); 454*a9fa9459Szrj extern Expression_ptr 455*a9fa9459Szrj script_exp_binary_add(Expression_ptr, Expression_ptr); 456*a9fa9459Szrj extern Expression_ptr 457*a9fa9459Szrj script_exp_binary_sub(Expression_ptr, Expression_ptr); 458*a9fa9459Szrj extern Expression_ptr 459*a9fa9459Szrj script_exp_binary_lshift(Expression_ptr, Expression_ptr); 460*a9fa9459Szrj extern Expression_ptr 461*a9fa9459Szrj script_exp_binary_rshift(Expression_ptr, Expression_ptr); 462*a9fa9459Szrj extern Expression_ptr 463*a9fa9459Szrj script_exp_binary_eq(Expression_ptr, Expression_ptr); 464*a9fa9459Szrj extern Expression_ptr 465*a9fa9459Szrj script_exp_binary_ne(Expression_ptr, Expression_ptr); 466*a9fa9459Szrj extern Expression_ptr 467*a9fa9459Szrj script_exp_binary_le(Expression_ptr, Expression_ptr); 468*a9fa9459Szrj extern Expression_ptr 469*a9fa9459Szrj script_exp_binary_ge(Expression_ptr, Expression_ptr); 470*a9fa9459Szrj extern Expression_ptr 471*a9fa9459Szrj script_exp_binary_lt(Expression_ptr, Expression_ptr); 472*a9fa9459Szrj extern Expression_ptr 473*a9fa9459Szrj script_exp_binary_gt(Expression_ptr, Expression_ptr); 474*a9fa9459Szrj extern Expression_ptr 475*a9fa9459Szrj script_exp_binary_bitwise_and(Expression_ptr, Expression_ptr); 476*a9fa9459Szrj extern Expression_ptr 477*a9fa9459Szrj script_exp_binary_bitwise_xor(Expression_ptr, Expression_ptr); 478*a9fa9459Szrj extern Expression_ptr 479*a9fa9459Szrj script_exp_binary_bitwise_or(Expression_ptr, Expression_ptr); 480*a9fa9459Szrj extern Expression_ptr 481*a9fa9459Szrj script_exp_binary_logical_and(Expression_ptr, Expression_ptr); 482*a9fa9459Szrj extern Expression_ptr 483*a9fa9459Szrj script_exp_binary_logical_or(Expression_ptr, Expression_ptr); 484*a9fa9459Szrj extern Expression_ptr 485*a9fa9459Szrj script_exp_trinary_cond(Expression_ptr, Expression_ptr, Expression_ptr); 486*a9fa9459Szrj extern Expression_ptr 487*a9fa9459Szrj script_exp_integer(uint64_t); 488*a9fa9459Szrj extern Expression_ptr 489*a9fa9459Szrj script_exp_string(const char*, size_t); 490*a9fa9459Szrj extern Expression_ptr 491*a9fa9459Szrj script_exp_function_max(Expression_ptr, Expression_ptr); 492*a9fa9459Szrj extern Expression_ptr 493*a9fa9459Szrj script_exp_function_min(Expression_ptr, Expression_ptr); 494*a9fa9459Szrj extern Expression_ptr 495*a9fa9459Szrj script_exp_function_defined(const char*, size_t); 496*a9fa9459Szrj extern Expression_ptr 497*a9fa9459Szrj script_exp_function_sizeof_headers(void); 498*a9fa9459Szrj extern Expression_ptr 499*a9fa9459Szrj script_exp_function_alignof(const char*, size_t); 500*a9fa9459Szrj extern Expression_ptr 501*a9fa9459Szrj script_exp_function_sizeof(const char*, size_t); 502*a9fa9459Szrj extern Expression_ptr 503*a9fa9459Szrj script_exp_function_addr(const char*, size_t); 504*a9fa9459Szrj extern Expression_ptr 505*a9fa9459Szrj script_exp_function_loadaddr(const char*, size_t); 506*a9fa9459Szrj extern Expression_ptr 507*a9fa9459Szrj script_exp_function_origin(void*, const char*, size_t); 508*a9fa9459Szrj extern Expression_ptr 509*a9fa9459Szrj script_exp_function_length(void*, const char*, size_t); 510*a9fa9459Szrj extern Expression_ptr 511*a9fa9459Szrj script_exp_function_constant(const char*, size_t); 512*a9fa9459Szrj extern Expression_ptr 513*a9fa9459Szrj script_exp_function_absolute(Expression_ptr); 514*a9fa9459Szrj extern Expression_ptr 515*a9fa9459Szrj script_exp_function_align(Expression_ptr, Expression_ptr); 516*a9fa9459Szrj extern Expression_ptr 517*a9fa9459Szrj script_exp_function_data_segment_align(Expression_ptr, Expression_ptr); 518*a9fa9459Szrj extern Expression_ptr 519*a9fa9459Szrj script_exp_function_data_segment_relro_end(Expression_ptr, Expression_ptr); 520*a9fa9459Szrj extern Expression_ptr 521*a9fa9459Szrj script_exp_function_data_segment_end(Expression_ptr); 522*a9fa9459Szrj extern Expression_ptr 523*a9fa9459Szrj script_exp_function_segment_start(const char*, size_t, Expression_ptr); 524*a9fa9459Szrj extern Expression_ptr 525*a9fa9459Szrj script_exp_function_assert(Expression_ptr, const char*, size_t); 526*a9fa9459Szrj 527*a9fa9459Szrj extern void 528*a9fa9459Szrj script_register_vers_node(void* closure, 529*a9fa9459Szrj const char* tag, 530*a9fa9459Szrj int taglen, 531*a9fa9459Szrj struct Version_tree*, 532*a9fa9459Szrj struct Version_dependency_list*); 533*a9fa9459Szrj 534*a9fa9459Szrj extern struct Version_dependency_list* 535*a9fa9459Szrj script_add_vers_depend(void* closure, 536*a9fa9459Szrj struct Version_dependency_list* existing_dependencies, 537*a9fa9459Szrj const char* depend_to_add, int deplen); 538*a9fa9459Szrj 539*a9fa9459Szrj extern struct Version_expression_list* 540*a9fa9459Szrj script_new_vers_pattern(void* closure, 541*a9fa9459Szrj struct Version_expression_list*, 542*a9fa9459Szrj const char*, int, int); 543*a9fa9459Szrj 544*a9fa9459Szrj extern struct Version_expression_list* 545*a9fa9459Szrj script_merge_expressions(struct Version_expression_list* a, 546*a9fa9459Szrj struct Version_expression_list* b); 547*a9fa9459Szrj 548*a9fa9459Szrj extern struct Version_tree* 549*a9fa9459Szrj script_new_vers_node(void* closure, 550*a9fa9459Szrj struct Version_expression_list* global, 551*a9fa9459Szrj struct Version_expression_list* local); 552*a9fa9459Szrj 553*a9fa9459Szrj extern void 554*a9fa9459Szrj version_script_push_lang(void* closure, const char* lang, int langlen); 555*a9fa9459Szrj 556*a9fa9459Szrj extern void 557*a9fa9459Szrj version_script_pop_lang(void* closure); 558*a9fa9459Szrj 559*a9fa9459Szrj #ifdef __cplusplus 560*a9fa9459Szrj } // End extern "C" 561*a9fa9459Szrj #endif 562*a9fa9459Szrj 563*a9fa9459Szrj #ifdef __cplusplus 564*a9fa9459Szrj } // End namespace gold. 565*a9fa9459Szrj #endif 566*a9fa9459Szrj 567*a9fa9459Szrj #endif /* !defined(GOLD_SCRIPT_C_H) */ 568