X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=gold%2Fscript-c.h;h=084e78a5232f0ef4ec278951f24eb62c71a9f594;hb=de194d8575765da6c7905d09b8675c59fad035e9;hp=26dc5566042202857a4297e1a60ad189bfca83ae;hpb=3802b2dd6b937e2904b6e2de087e224437eab493;p=binutils-gdb.git diff --git a/gold/script-c.h b/gold/script-c.h index 26dc5566042..084e78a5232 100644 --- a/gold/script-c.h +++ b/gold/script-c.h @@ -1,6 +1,6 @@ /* script-c.h -- C interface for linker scripts in gold. */ -/* Copyright 2006, 2007, 2008 Free Software Foundation, Inc. +/* Copyright (C) 2006-2017 Free Software Foundation, Inc. Written by Ian Lance Taylor . This file is part of gold. @@ -61,6 +61,18 @@ typedef Expression* Expression_ptr; typedef void* Expression_ptr; #endif +/* Script_section type. */ +enum Script_section_type +{ + /* No section type. */ + SCRIPT_SECTION_TYPE_NONE, + SCRIPT_SECTION_TYPE_NOLOAD, + SCRIPT_SECTION_TYPE_DSECT, + SCRIPT_SECTION_TYPE_COPY, + SCRIPT_SECTION_TYPE_INFO, + SCRIPT_SECTION_TYPE_OVERLAY +}; + /* A constraint for whether to use a particular output section definition. */ @@ -83,6 +95,8 @@ struct Parser_output_section_header { /* The address. This may be NULL. */ Expression_ptr address; + /* Section type. May be NULL string. */ + enum Script_section_type section_type; /* The load address, from the AT specifier. This may be NULL. */ Expression_ptr load_address; /* The alignment, from the ALIGN specifier. This may be NULL. */ @@ -94,15 +108,6 @@ struct Parser_output_section_header enum Section_constraint constraint; }; -/* The information we store for an output section trailer in the bison - parser. */ - -struct Parser_output_section_trailer -{ - /* The fill value. This may be NULL. */ - Expression_ptr fill; -}; - /* We keep vectors of strings. In order to manage this in both C and C++, we use a pointer to a vector. This assumes that all pointers look the same. */ @@ -114,6 +119,18 @@ typedef String_list* String_list_ptr; typedef void* String_list_ptr; #endif +/* The information we store for an output section trailer in the bison + parser. */ + +struct Parser_output_section_trailer +{ + /* The fill value. This may be NULL. */ + Expression_ptr fill; + /* The program segments this section should go into. This may be + NULL. */ + String_list_ptr phdrs; +}; + /* The different sorts we can find in a linker script. */ enum Sort_wildcard @@ -122,7 +139,8 @@ enum Sort_wildcard SORT_WILDCARD_BY_NAME, SORT_WILDCARD_BY_ALIGNMENT, SORT_WILDCARD_BY_NAME_BY_ALIGNMENT, - SORT_WILDCARD_BY_ALIGNMENT_BY_NAME + SORT_WILDCARD_BY_ALIGNMENT_BY_NAME, + SORT_WILDCARD_BY_INIT_PRIORITY }; /* The information we build for a single wildcard specification. */ @@ -165,6 +183,22 @@ struct Input_section_spec struct Wildcard_sections input_sections; }; +/* Information for a program header. */ + +struct Phdr_info +{ + /* A boolean value: whether to include the file header. */ + int includes_filehdr; + /* A boolean value: whether to include the program headers. */ + int includes_phdrs; + /* A boolean value: whether the flags field is valid. */ + int is_flags_valid; + /* The value to use for the flags. */ + unsigned int flags; + /* The load address. */ + Expression_ptr load_address; +}; + struct Version_dependency_list; struct Version_expression_list; struct Version_tree; @@ -192,11 +226,22 @@ yylex(YYSTYPE*, void* closure); extern void yyerror(void* closure, const char*); +/* Called by the bison parser to add an external symbol (a symbol in + an EXTERN declaration) to the link. */ + +extern void +script_add_extern(void* closure, const char*, size_t); + /* Called by the bison parser to add a file to the link. */ extern void script_add_file(void* closure, const char*, size_t); +/* Called by the bison parser to add a library to the link. */ + +extern void +script_add_library(void* closure, const char*, size_t); + /* Called by the bison parser to start and stop a group. */ extern void @@ -216,11 +261,27 @@ script_end_as_needed(void* closure); extern void script_set_entry(void* closure, const char*, size_t); +/* Called by the bison parser to set whether to define common symbols. */ + +extern void +script_set_common_allocation(void* closure, int); + /* Called by the bison parser to parse an OPTION. */ extern void script_parse_option(void* closure, const char*, size_t); +/* Called by the bison parser to handle OUTPUT_FORMAT. This return 0 + if the parse should be aborted. */ + +extern int +script_check_output_format(void* closure, const char*, size_t, + const char*, size_t, const char*, size_t); + +/* Called by the bison parser to handle TARGET. */ +extern void +script_set_target(void* closure, const char*, size_t); + /* Called by the bison parser to handle SEARCH_DIR. */ extern void @@ -243,6 +304,14 @@ script_push_lex_into_version_mode(void* closure); extern void script_pop_lex_mode(void* closure); +/* Called by the bison parser to get the value of a symbol. This is + called for a reference to a symbol, but is not called for something + like "sym += 10". Uses of the special symbol "." can just call + script_exp_string. */ + +extern Expression_ptr +script_symbol(void* closure, const char*, size_t); + /* Called by the bison parser to set a symbol to a value. PROVIDE is non-zero if the symbol should be provided--only defined if there is an undefined reference. HIDDEN is non-zero if the symbol should be @@ -329,6 +398,45 @@ script_string_list_push_back(String_list_ptr, const char*, size_t); extern String_list_ptr script_string_list_append(String_list_ptr, String_list_ptr); +/* Define a new program header. */ + +extern void +script_add_phdr(void* closure, const char* name, size_t namelen, + unsigned int type, const struct Phdr_info*); + +/* Convert a program header string to a type. */ + +extern unsigned int +script_phdr_string_to_type(void* closure, const char*, size_t); + +/* Handle DATA_SEGMENT_ALIGN and DATA_SEGMENT_RELRO_END. */ + +extern void +script_data_segment_align(void* closure); + +extern void +script_data_segment_relro_end(void* closure); + +/* Record the fact that a SEGMENT_START expression is seen. */ + +extern void +script_saw_segment_start_expression(void* closure); + +/* Called by the bison parser for MEMORY regions. */ + +extern void +script_add_memory(void*, const char*, size_t, unsigned int, + Expression_ptr, Expression_ptr); + +extern unsigned int +script_parse_memory_attr(void*, const char*, size_t, int); + +extern void +script_set_section_region(void*, const char*, size_t, int); + +extern void +script_include_directive(int, void *, const char*, size_t); + /* Called by the bison parser for expressions. */ extern Expression_ptr @@ -396,9 +504,9 @@ script_exp_function_addr(const char*, size_t); extern Expression_ptr script_exp_function_loadaddr(const char*, size_t); extern Expression_ptr -script_exp_function_origin(const char*, size_t); +script_exp_function_origin(void*, const char*, size_t); extern Expression_ptr -script_exp_function_length(const char*, size_t); +script_exp_function_length(void*, const char*, size_t); extern Expression_ptr script_exp_function_constant(const char*, size_t); extern Expression_ptr @@ -420,27 +528,27 @@ extern void script_register_vers_node(void* closure, const char* tag, int taglen, - struct Version_tree *, - struct Version_dependency_list *); + struct Version_tree*, + struct Version_dependency_list*); -extern struct Version_dependency_list * +extern struct Version_dependency_list* script_add_vers_depend(void* closure, - struct Version_dependency_list *existing_dependencies, - const char *depend_to_add, int deplen); + struct Version_dependency_list* existing_dependencies, + const char* depend_to_add, int deplen); -extern struct Version_expression_list * +extern struct Version_expression_list* script_new_vers_pattern(void* closure, - struct Version_expression_list *, - const char *, int, int); + struct Version_expression_list*, + const char*, int, int); -extern struct Version_expression_list * -script_merge_expressions(struct Version_expression_list *a, - struct Version_expression_list *b); +extern struct Version_expression_list* +script_merge_expressions(struct Version_expression_list* a, + struct Version_expression_list* b); -extern struct Version_tree * +extern struct Version_tree* script_new_vers_node(void* closure, - struct Version_expression_list *global, - struct Version_expression_list *local); + struct Version_expression_list* global, + struct Version_expression_list* local); extern void version_script_push_lang(void* closure, const char* lang, int langlen);