}  static void print_size (value) size_t value; { fprintf (config.map_file, "%5x", (unsigned) value); }  static void print_alignment (value) unsigned int value; { fprintf (config.map_file, "2**%1u", value); }  static void print_fill (value) fill_type value; { fprintf (config.map_file, "%04x", (unsigned) value); }  static void print_section (name) CONST char *name; { fprintf (config.map_file, "%*s", -longest_section_name, name);
static lang_statement_union_type *new_statement PARAMS ((enum statement_enum,							 size_t,							 lang_statement_list_type*));/* LOCALS */static struct obstack stat_obstack;#define obstack_chunk_alloc xmalloc#define obstack_chunk_free freestatic CONST char *startup_file;static lang_statement_list_type input_file_chain;static boolean placed_commons = false;static lang_output_section_statement_type *default_common_section;static boolean map_option_f;static bfd_vma print_dot;static lang_input_statement_type *first_file;static lang_statement_list_type lang_output_section_statement;static CONST char *current_target;static CONST char *output_target;static int longest_section_name = 8;static lang_statement_list_type statement_list;static void print_size PARAMS ((size_t value));static void print_alignment PARAMS ((unsigned int value));static void print_fill PARAMS ((fill_type value));static void print_section PARAMS ((const char *name));static void lang_for_each_statement_worker  PARAMS ((void (*func) (lang_statement_union_type *),	   lang_statement_union_type *s));static lang_input_statement_type *new_afile  PARAMS ((const char *name, lang_input_file_enum_type file_type,	   const char *target, boolean add_to_list));static void print_flags PARAMS ((int *ignore_flags));static void init_os PARAMS ((lang_output_section_statement_type *s));static void wild_section PARAMS ((lang_wild_statement_type *ptr,				  const char *section,				  lang_input_statement_type *file,				  lang_output_section_statement_type *output));static lang_input_statement_type *lookup_name PARAMS ((const char *name));static void load_symbols PARAMS ((lang_input_statement_type *entry,				  lang_statement_list_type *));static void wild PARAMS ((lang_wild_statement_type *s,			  const char *section, const char *file,			  const char *target,			  lang_output_section_statement_type *output));static bfd *open_output PARAMS ((const char *name));static void ldlang_open_output PARAMS ((lang_statement_union_type *statement));static void open_input_bfds  PARAMS ((lang_statement_union_type *statement, boolean));static void lang_reasonable_defaults PARAMS ((void));static void lang_place_undefineds PARAMS ((void));static void map_input_to_output_sections  PARAMS ((lang_statement_union_type *s,	   const char *target,	   lang_output_section_statement_type *output_section_statement));static void print_output_section_statement  PARAMS ((lang_output_section_statement_type *output_section_statement));static void print_assignment  PARAMS ((lang_assignment_statement_type *assignment,	   lang_output_section_statement_type *output_section));static void print_input_statement PARAMS ((lang_input_statement_type *statm));static void print_input_section PARAMS ((lang_input_section_type *in));static void print_fill_statement PARAMS ((lang_fill_statement_type *fill));static void print_data_statement PARAMS ((lang_data_statement_type *data));static void print_reloc_statement PARAMS ((lang_reloc_statement_type *reloc));static void print_padding_statement PARAMS ((lang_padding_statement_type *s));static void print_wild_statement  PARAMS ((lang_wild_statement_type *w,	   lang_output_section_statement_type *os));static void print_group  PARAMS ((lang_group_statement_type *, lang_output_section_statement_type *));static void print_statement PARAMS ((lang_statement_union_type *s,				     lang_output_section_statement_type *os));static void print_statements PARAMS ((void));static bfd_vma insert_pad PARAMS ((lang_statement_union_type **this_ptr,				   fill_type fill, unsigned int power,				   asection *output_section_statement,				   bfd_vma dot));static bfd_vma size_input_section  PARAMS ((lang_statement_union_type **this_ptr,	   lang_output_section_statement_type *output_section_statement,	   fill_type fill, bfd_vma dot, boolean relax));static void lang_finish PARAMS ((void));static void lang_check PARAMS ((void));static void lang_common PARAMS ((void));static boolean lang_one_common PARAMS ((struct bfd_link_hash_entry *, PTR));static void lang_place_orphans PARAMS ((void));static int topower PARAMS ((int));static void lang_set_startof PARAMS ((void));static void reset_memory_regions PARAMS ((void));/* EXPORTS */lang_output_section_statement_type *abs_output_section;lang_statement_list_type *stat_ptr = &statement_list;lang_statement_list_type file_chain = { 0 };const char *entry_symbol = NULL;boolean entry_from_cmdline;boolean lang_has_input_file = false;boolean had_output_filename = false;boolean lang_float_flag = false;boolean delete_output_file_on_failure = false;etree_type *base; /* Relocation base - or null */#if defined(__STDC__) || defined(ALMOST_STDC)#define cat(a,b) a##b#else#define cat(a,b) a/**/b#endif#define new_stat(x,y) (cat(x,_type)*) new_statement(cat(x,_enum), sizeof(cat(x,_type)),y)#define outside_section_address(q) ( (q)->output_offset + (q)->output_section->vma)#define outside_symbol_address(q) ((q)->value +   outside_section_address(q->section))PTRstat_alloc (size)     size_t size;{  return obstack_alloc (&stat_obstack, size);}static voidprint_size (value)     size_t value;{  fprintf (config.map_file, "%5x", (unsigned) value);}static voidprint_alignment (value)     unsigned int value;{  fprintf (config.map_file, "2**%1u", value);}static voidprint_fill (value)     fill_type value;{  fprintf (config.map_file, "%04x", (unsigned) value);}static voidprint_section (name)     CONST char *name;{  fprintf (config.map_file, "%*s", -longest_section_name, name);}/*----------------------------------------------------------------------  lang_for_each_statement walks the parse tree and calls the provided  function for each node*/static voidlang_for_each_statement_worker (func, s)     void (*func) PARAMS ((lang_statement_union_type *));     lang_statement_union_type *s;{  for (; s != (lang_statement_union_type *) NULL; s = s->next)    {      func (s);      switch (s->header.type)	{	case lang_constructors_statement_enum:	  lang_for_each_statement_worker (func, constructor_list.head);	  break;	case lang_output_section_statement_enum:	  lang_for_each_statement_worker	    (func,	     s->output_section_statement.children.head);	  break;	case lang_wild_statement_enum:	  lang_for_each_statement_worker	    (func,	     s->wild_statement.children.head);	  break;	case lang_group_statement_enum:	  lang_for_each_statement_worker (func,					  s->group_statement.children.head);	  break;	case lang_data_statement_enum:	case lang_reloc_statement_enum:	case lang_object_symbols_statement_enum:	case lang_output_statement_enum:	case lang_target_statement_enum:	case lang_input_section_enum:	case lang_input_statement_enum:	case lang_assignment_statement_enum:	case lang_padding_statement_enum:	case lang_address_statement_enum:	  break;	default:	  FAIL ();	  break;	}    }}voidlang_for_each_statement (func)     void (*func) PARAMS ((lang_statement_union_type *));{  lang_for_each_statement_worker (func,				  statement_list.head);}/*----------------------------------------------------------------------*/voidlang_list_init (list)     lang_statement_list_type *list;{  list->head = (lang_statement_union_type *) NULL;  list->tail = &list->head;}/*----------------------------------------------------------------------  build a new statement node for the parse tree */staticlang_statement_union_type *new_statement (type, size, list)     enum statement_enum type;     size_t size;     lang_statement_list_type * list;{  lang_statement_union_type *new = (lang_statement_union_type *)  stat_alloc (size);  new->header.type = type;  new->header.next = (lang_statement_union_type *) NULL;  lang_statement_append (list, new, &new->header.next);  return new;}