/* ldlang.h - linker command language support
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
- 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+ 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
Free Software Foundation, Inc.
This file is part of the GNU Binutils.
bfd_boolean had_full_message;
} lang_memory_region_type;
+enum statement_enum
+{
+ lang_output_section_statement_enum,
+ lang_assignment_statement_enum,
+ lang_input_statement_enum,
+ lang_address_statement_enum,
+ lang_wild_statement_enum,
+ lang_input_section_enum,
+ lang_object_symbols_statement_enum,
+ lang_fill_statement_enum,
+ lang_data_statement_enum,
+ lang_reloc_statement_enum,
+ lang_target_statement_enum,
+ lang_output_statement_enum,
+ lang_padding_statement_enum,
+ lang_group_statement_enum,
+ lang_insert_statement_enum,
+ lang_constructors_statement_enum
+};
+
typedef struct lang_statement_header_struct
{
union lang_statement_union *next;
- enum statement_enum
- {
- lang_output_section_statement_enum,
- lang_assignment_statement_enum,
- lang_input_statement_enum,
- lang_address_statement_enum,
- lang_wild_statement_enum,
- lang_input_section_enum,
- lang_object_symbols_statement_enum,
- lang_fill_statement_enum,
- lang_data_statement_enum,
- lang_reloc_statement_enum,
- lang_target_statement_enum,
- lang_output_statement_enum,
- lang_padding_statement_enum,
- lang_group_statement_enum,
- lang_insert_statement_enum,
- lang_constructors_statement_enum
- } type;
+ enum statement_enum type;
} lang_statement_header_type;
typedef struct
bfd_vma output_offset;
} lang_reloc_statement_type;
-typedef struct lang_input_statement_struct
+struct lang_input_statement_flags
{
- lang_statement_header_type header;
- /* Name of this file. */
- const char *filename;
- /* Name to use for the symbol giving address of text start.
- Usually the same as filename, but for a file spec'd with
- -l this is the -l switch itself rather than the filename. */
- const char *local_sym_name;
-
- bfd *the_bfd;
-
- /* Point to the next file - whatever it is, wanders up and down
- archives */
- union lang_statement_union *next;
-
- /* Point to the next file, but skips archive contents. */
- union lang_statement_union *next_real_file;
-
- const char *target;
-
- unsigned int is_archive : 1;
+ /* 1 means this file was specified in a -l option. */
+ unsigned int maybe_archive : 1;
/* 1 means search a set of directories for this file. */
- unsigned int search_dirs_flag : 1;
+ unsigned int search_dirs : 1;
- /* 1 means this was found in a search directory marked as sysrooted,
- if search_dirs_flag is false, otherwise, that it should be
- searched in ld_sysroot before any other location, as long as it
- starts with a slash. */
+ /* 1 means this was found when processing a script in the sysroot. */
unsigned int sysrooted : 1;
/* 1 means this is base file of incremental load.
Do not load this file's text or data.
Also default text_start to after this file's bss. */
- unsigned int just_syms_flag : 1;
+ unsigned int just_syms : 1;
/* Whether to search for this entry as a dynamic archive. */
unsigned int dynamic : 1;
- /* Whether DT_NEEDED tags should be added for dynamic libraries in
- DT_NEEDED tags from this entry. */
- unsigned int add_needed : 1;
+ /* Set if a DT_NEEDED tag should be added not just for the dynamic library
+ explicitly given by this entry but also for any dynamic libraries in
+ this entry's needed list. */
+ unsigned int add_DT_NEEDED_for_dynamic : 1;
- /* Whether this entry should cause a DT_NEEDED tag only when
- satisfying references from regular files, or always. */
- unsigned int as_needed : 1;
+ /* Set if this entry should cause a DT_NEEDED tag only when some
+ regular file references its symbols (ie. --as-needed is in effect). */
+ unsigned int add_DT_NEEDED_for_regular : 1;
/* Whether to include the entire contents of an archive. */
unsigned int whole_archive : 1;
+ /* Set when bfd opening is successful. */
unsigned int loaded : 1;
unsigned int real : 1;
+
+ /* Set if the file does not exist. */
+ unsigned int missing_file : 1;
+
+#ifdef ENABLE_PLUGINS
+ /* Set if the file was claimed by a plugin. */
+ unsigned int claimed : 1;
+
+ /* Set if the file was claimed from an archive. */
+ unsigned int claim_archive : 1;
+
+ /* Set if reloading an --as-needed lib. */
+ unsigned int reload : 1;
+#endif /* ENABLE_PLUGINS */
+};
+
+typedef struct lang_input_statement_struct
+{
+ lang_statement_header_type header;
+ /* Name of this file. */
+ const char *filename;
+ /* Name to use for the symbol giving address of text start.
+ Usually the same as filename, but for a file spec'd with
+ -l this is the -l switch itself rather than the filename. */
+ const char *local_sym_name;
+
+ bfd *the_bfd;
+
+ struct flag_info *section_flag_list;
+
+ /* Point to the next file - whatever it is, wanders up and down
+ archives */
+ union lang_statement_union *next;
+
+ /* Point to the next file, but skips archive contents. */
+ union lang_statement_union *next_real_file;
+
+ const char *target;
+
+ struct lang_input_statement_flags flags;
} lang_input_statement_type;
typedef struct
walk_wild_section_handler_t walk_wild_section_handler;
struct wildcard_list *handler_data[4];
lang_section_bst_type *tree;
+ struct flag_info *section_flag_list;
};
typedef struct lang_address_statement_struct
{
lang_statement_header_type header;
bfd_vma output_offset;
- size_t size;
+ bfd_size_type size;
asection *output_section;
fill_type *fill;
} lang_padding_statement_type;
etree_type *flags;
};
-extern struct lang_phdr *lang_phdr_list;
-
/* This structure is used to hold a list of sections which may not
cross reference each other. */
lang_nocrossref_type *list;
};
-extern struct lang_nocrossrefs *nocrossref_list;
-
/* This structure is used to hold a list of input section names which
will not match an output section in the linker script. */
lang_output_section_statement_type **os_tail;
};
+extern struct lang_phdr *lang_phdr_list;
+extern struct lang_nocrossrefs *nocrossref_list;
+extern const char *output_target;
extern lang_output_section_statement_type *abs_output_section;
extern lang_statement_list_type lang_output_section_statement;
+extern struct lang_input_statement_flags input_flags;
extern bfd_boolean lang_has_input_file;
extern etree_type *base;
extern lang_statement_list_type *stat_ptr;
etree_type *, int);
extern void lang_final
(void);
+extern void lang_relax_sections
+ (bfd_boolean);
extern void lang_process
(void);
extern void lang_section_start
extern void lang_reset_memory_regions
(void);
extern void lang_do_assignments
- (void);
+ (lang_phase_type);
#define LANG_FOR_EACH_INPUT_STATEMENT(statement) \
lang_input_statement_type *statement; \
extern void lang_add_keepsyms_file
(const char *);
extern lang_output_section_statement_type *lang_output_section_statement_lookup
- (const char *const, int, bfd_boolean);
+ (const char *, int, bfd_boolean);
+extern lang_output_section_statement_type *next_matching_output_section_statement
+ (lang_output_section_statement_type *, int);
extern void ldlang_add_undef
- (const char *const);
+ (const char *const, bfd_boolean);
extern void lang_add_output_format
(const char *, const char *, const char *, int);
extern void lang_list_init
union etree_union *);
extern void lang_for_each_statement
(void (*) (lang_statement_union_type *));
+extern void lang_for_each_statement_worker
+ (void (*) (lang_statement_union_type *), lang_statement_union_type *);
extern void *stat_alloc
(size_t);
extern void strip_excluded_output_sections
(etree_type *, int, fill_type *, const char *,
lang_output_section_phdr_list *, const char *);
-extern struct bfd_elf_version_tree *lang_elf_version_info;
-
extern struct bfd_elf_version_expr *lang_new_vers_pattern
(struct bfd_elf_version_expr *, const char *, const char *, bfd_boolean);
extern struct bfd_elf_version_tree *lang_new_vers_node
ldlang_override_segment_assignment
(struct bfd_link_info *, bfd *, asection *, asection *, bfd_boolean);
+extern void
+lang_ld_feature (char *);
+
#endif