+/* 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. */
+
+enum Section_constraint
+{
+ /* No constraint. */
+ CONSTRAINT_NONE,
+ /* Only if all input sections are read-only. */
+ CONSTRAINT_ONLY_IF_RO,
+ /* Only if at least input section is writable. */
+ CONSTRAINT_ONLY_IF_RW,
+ /* Special constraint. */
+ CONSTRAINT_SPECIAL
+};
+
+/* The information we store for an output section header in the bison
+ parser. */
+
+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. */
+ Expression_ptr align;
+ /* The input section alignment, from the SUBALIGN specifier. This
+ may be NULL. */
+ Expression_ptr subalign;
+ /* A constraint on this output section. */
+ enum Section_constraint constraint;
+};
+
+/* 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. */
+
+#ifdef __cplusplus
+typedef std::vector<std::string> String_list;
+typedef String_list* String_list_ptr;
+#else
+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
+{
+ SORT_WILDCARD_NONE,
+ SORT_WILDCARD_BY_NAME,
+ SORT_WILDCARD_BY_ALIGNMENT,
+ SORT_WILDCARD_BY_NAME_BY_ALIGNMENT,
+ SORT_WILDCARD_BY_ALIGNMENT_BY_NAME,
+ SORT_WILDCARD_BY_INIT_PRIORITY
+};
+
+/* The information we build for a single wildcard specification. */
+
+struct Wildcard_section
+{
+ /* The wildcard spec itself. */
+ struct Parser_string name;
+ /* How the entries should be sorted. */
+ enum Sort_wildcard sort;
+};
+
+/* A vector of Wildcard_section entries. */
+
+#ifdef __cplusplus
+typedef std::vector<Wildcard_section> String_sort_list;
+typedef String_sort_list* String_sort_list_ptr;
+#else
+typedef void* String_sort_list_ptr;
+#endif
+
+/* A list of wildcard specifications, which may include EXCLUDE_FILE
+ clauses. */
+
+struct Wildcard_sections
+{
+ /* Wildcard specs. */
+ String_sort_list_ptr sections;
+ /* Exclusions. */
+ String_list_ptr exclude;
+};
+
+/* A complete input section specification. */
+
+struct Input_section_spec
+{
+ /* The file name. */
+ struct Wildcard_section file;
+ /* The list of sections. */
+ 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;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+