Back to index

cell-binutils  2.17cvs20070401
Classes | Defines | Typedefs | Enumerations | Functions | Variables
ldlang.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _fill_type
struct  statement_list
struct  memory_region_struct
struct  lang_statement_header_struct
struct  lang_assignment_statement_type
struct  lang_target_statement_struct
struct  lang_output_statement_struct
struct  lang_output_section_phdr_list
struct  lang_output_section_statement_struct
struct  lang_common_statement_type
struct  lang_object_symbols_statement_type
struct  lang_fill_statement_type
struct  lang_data_statement_type
struct  lang_reloc_statement_type
struct  lang_input_statement_struct
struct  lang_input_section_type
struct  lang_afile_asection_pair_statement_type
struct  lang_section_bst
struct  lang_wild_statement_struct
struct  lang_address_statement_struct
struct  lang_padding_statement_type
struct  lang_group_statement_type
union  lang_statement_union
struct  lang_phdr
struct  lang_nocrossref
struct  lang_nocrossrefs
struct  unique_sections
struct  lang_definedness_hash_entry
struct  orphan_save

Defines

#define DEFAULT_MEMORY_REGION   "*default*"
#define LANG_FOR_EACH_INPUT_STATEMENT(statement)

Typedefs

typedef struct statement_list lang_statement_list_type
typedef struct memory_region_struct lang_memory_region_type
typedef struct
lang_statement_header_struct 
lang_statement_header_type
typedef struct
lang_target_statement_struct 
lang_target_statement_type
typedef struct
lang_output_statement_struct 
lang_output_statement_type
typedef struct
lang_output_section_phdr_list 
lang_output_section_phdr_list
typedef struct
lang_output_section_statement_struct 
lang_output_section_statement_type
typedef struct
lang_input_statement_struct 
lang_input_statement_type
typedef struct lang_wild_statement_struct
typedef void(* callback_t )(lang_wild_statement_type *, struct wildcard_list *, asection *, lang_input_statement_type *, void *)
typedef void(* walk_wild_section_handler_t )(lang_wild_statement_type *, lang_input_statement_type *, callback_t callback, void *data)
typedef bfd_boolean(* lang_match_sec_type_func )(bfd *, const asection *, bfd *, const asection *)
typedef struct lang_section_bst lang_section_bst_type
typedef struct
lang_address_statement_struct 
lang_address_statement_type
typedef union lang_statement_union lang_statement_union_type
typedef struct lang_nocrossref lang_nocrossref_type

Enumerations

enum  lang_input_file_enum_type {
  lang_input_file_is_l_enum, lang_input_file_is_symbols_only_enum, lang_input_file_is_marker_enum, lang_input_file_is_fake_enum,
  lang_input_file_is_search_file_enum, lang_input_file_is_file_enum
}
enum  section_type { normal_section, noload_section, noalloc_section }

Functions

void lang_init (void)
void lang_finish (void)
lang_memory_region_typelang_memory_region_lookup (const char *const, bfd_boolean)
lang_memory_region_typelang_memory_region_default (asection *)
void lang_map (void)
void lang_set_flags (lang_memory_region_type *, const char *, int)
void lang_add_output (const char *, int from_script)
lang_output_section_statement_typelang_enter_output_section_statement (const char *output_section_statement_name, etree_type *address_exp, enum section_type sectype, etree_type *align, etree_type *subalign, etree_type *, int)
void lang_final (void)
void lang_process (void)
void lang_section_start (const char *, union etree_union *, const segment_type *)
void lang_add_entry (const char *, bfd_boolean)
void lang_default_entry (const char *)
void lang_add_target (const char *)
void lang_add_wild (struct wildcard_spec *, struct wildcard_list *, bfd_boolean)
void lang_add_map (const char *)
void lang_add_fill (fill_type *)
lang_assignment_statement_typelang_add_assignment (union etree_union *)
void lang_add_attribute (enum statement_enum)
void lang_startup (const char *)
void lang_float (bfd_boolean)
void lang_leave_output_section_statement (fill_type *, const char *, lang_output_section_phdr_list *, const char *)
void lang_abs_symbol_at_end_of (const char *, const char *)
void lang_abs_symbol_at_beginning_of (const char *, const char *)
void lang_statement_append (lang_statement_list_type *, lang_statement_union_type *, lang_statement_union_type **)
void lang_for_each_input_file (void(*dothis)(lang_input_statement_type *))
void lang_for_each_file (void(*dothis)(lang_input_statement_type *))
void lang_reset_memory_regions (void)
void lang_do_assignments (void)
void ldlang_add_file (lang_input_statement_type *)
lang_output_section_statement_typelang_output_section_find (const char *const)
lang_output_section_statement_typelang_output_section_find_by_flags (const asection *, lang_output_section_statement_type **, lang_match_sec_type_func)
lang_output_section_statement_typelang_insert_orphan (asection *, const char *, lang_output_section_statement_type *, struct orphan_save *, etree_type *, lang_statement_list_type *)
lang_input_statement_typelang_add_input_file (const char *, lang_input_file_enum_type, const char *)
void lang_add_keepsyms_file (const char *)
lang_output_section_statement_typelang_output_section_statement_lookup (const char *const)
void ldlang_add_undef (const char *const)
void lang_add_output_format (const char *, const char *, const char *, int)
void lang_list_init (lang_statement_list_type *)
void lang_add_data (int type, union etree_union *)
void lang_add_reloc (bfd_reloc_code_real_type, reloc_howto_type *, asection *, const char *, union etree_union *)
void lang_for_each_statement (void(*)(lang_statement_union_type *))
void * stat_alloc (size_t)
void strip_excluded_output_sections (void)
void dprint_statement (lang_statement_union_type *, int)
void lang_size_sections (bfd_boolean *, bfd_boolean)
void one_lang_size_sections_pass (bfd_boolean *, bfd_boolean)
void lang_enter_group (void)
void lang_leave_group (void)
void lang_add_section (lang_statement_list_type *, asection *, lang_output_section_statement_type *)
void lang_new_phdr (const char *, etree_type *, bfd_boolean, bfd_boolean, etree_type *, etree_type *)
void lang_add_nocrossref (lang_nocrossref_type *)
void lang_enter_overlay (etree_type *, etree_type *)
void lang_enter_overlay_section (const char *)
void lang_leave_overlay_section (fill_type *, lang_output_section_phdr_list *)
void lang_leave_overlay (etree_type *, int, fill_type *, const char *, lang_output_section_phdr_list *, const char *)
struct bfd_elf_version_exprlang_new_vers_pattern (struct bfd_elf_version_expr *, const char *, const char *, bfd_boolean)
struct bfd_elf_version_treelang_new_vers_node (struct bfd_elf_version_expr *, struct bfd_elf_version_expr *)
struct bfd_elf_version_depslang_add_vers_depend (struct bfd_elf_version_deps *, const char *)
void lang_register_vers_node (const char *, struct bfd_elf_version_tree *, struct bfd_elf_version_deps *)
void lang_append_dynamic_list (struct bfd_elf_version_expr *)
void lang_append_dynamic_list_cpp_typeinfo (void)
void lang_append_dynamic_list_cpp_new (void)
bfd_boolean unique_section_p (const asection *)
void lang_add_unique (const char *)
const char * lang_get_output_target (void)
void lang_track_definedness (const char *)
int lang_symbol_definition_iteration (const char *)
void lang_update_definedness (const char *, struct bfd_link_hash_entry *)
void add_excluded_libs (const char *)
bfd_boolean load_symbols (lang_input_statement_type *, lang_statement_list_type *)
bfd_boolean ldlang_override_segment_assignment (struct bfd_link_info *, bfd *, asection *, asection *, bfd_boolean)

Variables

struct lang_phdrlang_phdr_list
struct lang_nocrossrefsnocrossref_list
lang_output_section_statement_typeabs_output_section
lang_statement_list_type lang_output_section_statement
bfd_boolean lang_has_input_file
etree_typebase
lang_statement_list_typestat_ptr
bfd_boolean delete_output_file_on_failure
const char * entry_section
bfd_boolean entry_from_cmdline
lang_statement_list_type file_chain
lang_statement_list_type input_file_chain
int lang_statement_iteration
struct bfd_elf_version_treelang_elf_version_info

Class Documentation

struct _fill_type

Definition at line 38 of file ldlang.h.

Class Members
unsigned char data
size_t size
struct statement_list

Definition at line 44 of file ldlang.h.

Collaboration diagram for statement_list:
Class Members
union lang_statement_union * head
union lang_statement_union ** tail
struct memory_region_struct

Definition at line 50 of file ldlang.h.

Collaboration diagram for memory_region_struct:
Class Members
bfd_vma current
flagword flags
bfd_boolean had_full_message
union lang_statement_union * last_os
bfd_size_type length
char * name
struct memory_region_struct * next
flagword not_flags
bfd_vma origin
struct lang_assignment_statement_type

Definition at line 88 of file ldlang.h.

Collaboration diagram for lang_assignment_statement_type:
Class Members
union etree_union * exp
lang_statement_header_type header
struct lang_target_statement_struct

Definition at line 94 of file ldlang.h.

Collaboration diagram for lang_target_statement_struct:
Class Members
lang_statement_header_type header
const char * target
struct lang_output_statement_struct

Definition at line 100 of file ldlang.h.

Collaboration diagram for lang_output_statement_struct:
Class Members
lang_statement_header_type header
const char * name
struct lang_output_section_phdr_list

Definition at line 118 of file ldlang.h.

Collaboration diagram for lang_output_section_phdr_list:
Class Members
const char * name
struct
lang_output_section_phdr_list *
next
bfd_boolean used
struct lang_output_section_statement_struct

Definition at line 125 of file ldlang.h.

Collaboration diagram for lang_output_section_statement_struct:
Class Members
union etree_union * addr_tree
asection * bfd_section
unsigned int block_value
lang_statement_list_type children
int constraint
fill_type * fill
flagword flags
lang_statement_header_type header
lang_memory_region_type * lma_region
union etree_union * load_base
const char * name
struct
lang_output_section_statement_struct *
next
lang_output_section_phdr_list * phdrs
struct
lang_output_section_statement_struct *
prev
lang_memory_region_type * region
int section_alignment
int subsection_alignment
union etree_union * update_dot_tree
struct lang_common_statement_type

Definition at line 162 of file ldlang.h.

Collaboration diagram for lang_common_statement_type:
Class Members
lang_statement_header_type header
struct lang_object_symbols_statement_type

Definition at line 167 of file ldlang.h.

Collaboration diagram for lang_object_symbols_statement_type:
Class Members
lang_statement_header_type header
struct lang_fill_statement_type

Definition at line 172 of file ldlang.h.

Collaboration diagram for lang_fill_statement_type:
Class Members
fill_type * fill
lang_statement_header_type header
asection * output_section
int size
struct lang_data_statement_type

Definition at line 180 of file ldlang.h.

Collaboration diagram for lang_data_statement_type:
Class Members
union etree_union * exp
lang_statement_header_type header
bfd_vma output_offset
asection * output_section
unsigned int type
bfd_vma value
struct lang_reloc_statement_type

Definition at line 192 of file ldlang.h.

Collaboration diagram for lang_reloc_statement_type:
Class Members
union etree_union * addend_exp
bfd_vma addend_value
lang_statement_header_type header
reloc_howto_type * howto
const char * name
bfd_vma output_offset
asection * output_section
bfd_reloc_code_real_type reloc
asection * section
struct lang_input_statement_struct

Definition at line 223 of file ldlang.h.

Collaboration diagram for lang_input_statement_struct:
Class Members
unsigned int add_needed: 1
unsigned int as_needed: 1
asymbol ** asymbols
unsigned int closed: 1
unsigned int dynamic: 1
const char * filename
lang_statement_header_type header
unsigned int is_archive: 1
unsigned int just_syms_flag: 1
unsigned int loaded: 1
const char * local_sym_name
union lang_statement_union * next
union lang_statement_union * next_real_file
file_ptr passive_position
unsigned int real: 1
unsigned int search_dirs_flag: 1
unsigned int symbol_count
unsigned int sysrooted: 1
const char * target
bfd * the_bfd
unsigned int whole_archive: 1
struct lang_input_section_type

Definition at line 286 of file ldlang.h.

Collaboration diagram for lang_input_section_type:
Class Members
lang_statement_header_type header
asection * section
struct lang_afile_asection_pair_statement_type

Definition at line 292 of file ldlang.h.

Collaboration diagram for lang_afile_asection_pair_statement_type:
Class Members
union lang_statement_union * file
lang_statement_header_type header
asection * section
struct lang_section_bst

Definition at line 314 of file ldlang.h.

Collaboration diagram for lang_section_bst:
Class Members
struct lang_section_bst * left
struct lang_section_bst * right
asection * section
struct lang_wild_statement_struct

Definition at line 321 of file ldlang.h.

Collaboration diagram for lang_wild_statement_struct:
Class Members
lang_statement_list_type children
const char * filename
bfd_boolean filenames_sorted
struct wildcard_list * handler_data
lang_statement_header_type header
bfd_boolean keep_sections
struct wildcard_list * section_list
lang_section_bst_type * tree
walk_wild_section_handler_t walk_wild_section_handler
struct lang_address_statement_struct

Definition at line 335 of file ldlang.h.

Collaboration diagram for lang_address_statement_struct:
Class Members
union etree_union * address
lang_statement_header_type header
const char * section_name
const segment_type * segment
struct lang_padding_statement_type

Definition at line 343 of file ldlang.h.

Collaboration diagram for lang_padding_statement_type:
Class Members
fill_type * fill
lang_statement_header_type header
bfd_vma output_offset
asection * output_section
size_t size
struct lang_group_statement_type

Definition at line 357 of file ldlang.h.

Collaboration diagram for lang_group_statement_type:
Class Members
lang_statement_list_type children
lang_statement_header_type header
union lang_statement_union

Definition at line 363 of file ldlang.h.

Collaboration diagram for lang_statement_union:
Class Members
lang_address_statement_type address_statement
lang_afile_asection_pair_statement_type afile_asection_pair_statement
lang_assignment_statement_type assignment_statement
lang_common_statement_type common_statement
lang_data_statement_type data_statement
lang_fill_statement_type fill_statement
lang_group_statement_type group_statement
lang_statement_header_type header
lang_input_section_type input_section
lang_input_statement_type input_statement
lang_object_symbols_statement_type object_symbols_statement
lang_output_section_statement_type output_section_statement
lang_output_statement_type output_statement
lang_padding_statement_type padding_statement
lang_reloc_statement_type reloc_statement
lang_target_statement_type target_statement
lang_wild_statement_type wild_statement
struct lang_phdr

Definition at line 387 of file ldlang.h.

Collaboration diagram for lang_phdr:
Class Members
etree_type * at
bfd_boolean filehdr
etree_type * flags
const char * name
struct lang_phdr * next
bfd_boolean phdrs
unsigned long type
struct lang_nocrossref

Definition at line 403 of file ldlang.h.

Collaboration diagram for lang_nocrossref:
Class Members
const char * name
struct lang_nocrossref * next
struct lang_nocrossrefs

Definition at line 411 of file ldlang.h.

Collaboration diagram for lang_nocrossrefs:
Class Members
lang_nocrossref_type * list
struct lang_nocrossrefs * next
struct unique_sections

Definition at line 422 of file ldlang.h.

Collaboration diagram for unique_sections:
Class Members
const char * name
struct unique_sections * next
struct lang_definedness_hash_entry

Definition at line 431 of file ldlang.h.

Class Members
int iteration
struct orphan_save

Definition at line 439 of file ldlang.h.

Collaboration diagram for orphan_save:
Class Members
flagword flags
const char * name
lang_output_section_statement_type * os
lang_output_section_statement_type ** os_tail
asection ** section
lang_statement_union_type ** stmt

Define Documentation

#define DEFAULT_MEMORY_REGION   "*default*"

Definition at line 26 of file ldlang.h.

#define LANG_FOR_EACH_INPUT_STATEMENT (   statement)
Value:
lang_input_statement_type *statement;                                 \
  for (statement = (lang_input_statement_type *) file_chain.head;     \
       statement != (lang_input_statement_type *) NULL;               \
       statement = (lang_input_statement_type *) statement->next)     \

Definition at line 529 of file ldlang.h.


Typedef Documentation

typedef void(* callback_t)(lang_wild_statement_type *, struct wildcard_list *, asection *, lang_input_statement_type *, void *)

Definition at line 301 of file ldlang.h.

Definition at line 309 of file ldlang.h.

Definition at line 299 of file ldlang.h.

typedef void(* walk_wild_section_handler_t)(lang_wild_statement_type *, lang_input_statement_type *, callback_t callback, void *data)

Definition at line 304 of file ldlang.h.


Enumeration Type Documentation

Enumerator:
lang_input_file_is_l_enum 
lang_input_file_is_symbols_only_enum 
lang_input_file_is_marker_enum 
lang_input_file_is_fake_enum 
lang_input_file_is_search_file_enum 
lang_input_file_is_file_enum 

Definition at line 28 of file ldlang.h.

Enumerator:
normal_section 
noload_section 
noalloc_section 

Definition at line 108 of file ldlang.h.


Function Documentation

void add_excluded_libs ( const char *  )

Definition at line 2345 of file ldlang.c.

{
  const char *p = list, *end;

  while (*p != '\0')
    {
      struct excluded_lib *entry;
      end = strpbrk (p, ",:");
      if (end == NULL)
       end = p + strlen (p);
      entry = xmalloc (sizeof (*entry));
      entry->next = excluded_libs;
      entry->name = xmalloc (end - p + 1);
      memcpy (entry->name, p, end - p);
      entry->name[end - p] = '\0';
      excluded_libs = entry;
      if (*end == '\0')
       break;
      p = end + 1;
    }
}

Here is the call graph for this function:

Definition at line 3975 of file ldlang.c.

{
  FILE *map_save = config.map_file;

  config.map_file = stderr;

  if (n < 0)
    print_statement_list (s, abs_output_section);
  else
    {
      while (s && --n >= 0)
       {
         print_statement (s, abs_output_section);
         s = s->header.next;
       }
    }

  config.map_file = map_save;
}

Here is the call graph for this function:

void lang_abs_symbol_at_beginning_of ( const char *  ,
const char *   
)

Definition at line 6076 of file ldlang.c.

{
  struct bfd_link_hash_entry *h;

  h = bfd_link_hash_lookup (link_info.hash, name, TRUE, TRUE, TRUE);
  if (h == NULL)
    einfo (_("%P%F: bfd_link_hash_lookup failed: %E\n"));

  if (h->type == bfd_link_hash_new
      || h->type == bfd_link_hash_undefined)
    {
      asection *sec;

      h->type = bfd_link_hash_defined;

      sec = bfd_get_section_by_name (output_bfd, secname);
      if (sec == NULL)
       h->u.def.value = 0;
      else
       h->u.def.value = bfd_get_section_vma (output_bfd, sec);

      h->u.def.section = bfd_abs_section_ptr;
    }
}

Here is the call graph for this function:

void lang_abs_symbol_at_end_of ( const char *  ,
const char *   
)

Definition at line 6107 of file ldlang.c.

{
  struct bfd_link_hash_entry *h;

  h = bfd_link_hash_lookup (link_info.hash, name, TRUE, TRUE, TRUE);
  if (h == NULL)
    einfo (_("%P%F: bfd_link_hash_lookup failed: %E\n"));

  if (h->type == bfd_link_hash_new
      || h->type == bfd_link_hash_undefined)
    {
      asection *sec;

      h->type = bfd_link_hash_defined;

      sec = bfd_get_section_by_name (output_bfd, secname);
      if (sec == NULL)
       h->u.def.value = 0;
      else
       h->u.def.value = (bfd_get_section_vma (output_bfd, sec)
                       + TO_ADDR (sec->size));

      h->u.def.section = bfd_abs_section_ptr;
    }
}

Here is the call graph for this function:

Definition at line 5984 of file ldlang.c.

{
  lang_assignment_statement_type *new;

  new = new_stat (lang_assignment_statement, stat_ptr);
  new->exp = exp;
  return new;
}

Here is the caller graph for this function:

void lang_add_attribute ( enum  statement_enum)

Definition at line 5994 of file ldlang.c.

Here is the call graph for this function:

void lang_add_data ( int  type,
union etree_union  
)

Definition at line 5947 of file ldlang.c.

{
  lang_data_statement_type *new;

  new = new_stat (lang_data_statement, stat_ptr);
  new->exp = exp;
  new->type = type;
}

Here is the caller graph for this function:

void lang_add_entry ( const char *  ,
bfd_boolean   
)

Definition at line 5892 of file ldlang.c.

{
  if (entry_symbol.name == NULL
      || cmdline
      || ! entry_from_cmdline)
    {
      entry_symbol.name = name;
      entry_from_cmdline = cmdline;
    }
}

Here is the caller graph for this function:

void lang_add_fill ( fill_type *  )

Definition at line 5938 of file ldlang.c.

{
  lang_fill_statement_type *new;

  new = new_stat (lang_fill_statement, stat_ptr);
  new->fill = fill;
}

Here is the call graph for this function:

Definition at line 995 of file ldlang.c.

{
  return new_afile (name, file_type, target, TRUE);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void lang_add_keepsyms_file ( const char *  )
void lang_add_map ( const char *  )

Definition at line 5923 of file ldlang.c.

{
  while (*name)
    {
      switch (*name)
       {
       case 'F':
         map_option_f = TRUE;
         break;
       }
      name++;
    }
}

Definition at line 6337 of file ldlang.c.

{
  struct lang_nocrossrefs *n;

  n = xmalloc (sizeof *n);
  n->next = nocrossref_list;
  n->list = l;
  nocrossref_list = n;

  /* Set notice_all so that we get informed about all symbols.  */
  link_info.notice_all = TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void lang_add_output ( const char *  ,
int  from_script 
)

Definition at line 5463 of file ldlang.c.

{
  /* Make -o on command line override OUTPUT in script.  */
  if (!had_output_filename || !from_script)
    {
      output_filename = name;
      had_output_filename = TRUE;
    }
}

Here is the caller graph for this function:

void lang_add_output_format ( const char *  ,
const char *  ,
const char *  ,
int   
)

Definition at line 6145 of file ldlang.c.

{
  if (output_target == NULL || !from_script)
    {
      if (command_line.endian == ENDIAN_BIG
         && big != NULL)
       format = big;
      else if (command_line.endian == ENDIAN_LITTLE
              && little != NULL)
       format = little;

      output_target = format;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void lang_add_reloc ( bfd_reloc_code_real_type  ,
reloc_howto_type *  ,
asection ,
const char *  ,
union etree_union  
)

Definition at line 5964 of file ldlang.c.

{
  lang_reloc_statement_type *p = new_stat (lang_reloc_statement, stat_ptr);

  p->reloc = reloc;
  p->howto = howto;
  p->section = section;
  p->name = name;
  p->addend_exp = addend;

  p->addend_value = 0;
  p->output_section = NULL;
  p->output_offset = 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1992 of file ldlang.c.

{
  flagword flags = section->flags;
  bfd_boolean discard;

  /* Discard sections marked with SEC_EXCLUDE.  */
  discard = (flags & SEC_EXCLUDE) != 0;

  /* Discard input sections which are assigned to a section named
     DISCARD_SECTION_NAME.  */
  if (strcmp (output->name, DISCARD_SECTION_NAME) == 0)
    discard = TRUE;

  /* Discard debugging sections if we are stripping debugging
     information.  */
  if ((link_info.strip == strip_debugger || link_info.strip == strip_all)
      && (flags & SEC_DEBUGGING) != 0)
    discard = TRUE;

  if (discard)
    {
      if (section->output_section == NULL)
       {
         /* This prevents future calls from assigning this section.  */
         section->output_section = bfd_abs_section_ptr;
       }
      return;
    }

  if (section->output_section == NULL)
    {
      bfd_boolean first;
      lang_input_section_type *new;
      flagword flags;

      flags = section->flags;

      /* We don't copy the SEC_NEVER_LOAD flag from an input section
        to an output section, because we want to be able to include a
        SEC_NEVER_LOAD section in the middle of an otherwise loaded
        section (I don't know why we want to do this, but we do).
        build_link_order in ldwrite.c handles this case by turning
        the embedded SEC_NEVER_LOAD section into a fill.  */

      flags &= ~ SEC_NEVER_LOAD;

      switch (output->sectype)
       {
       case normal_section:
         break;
       case noalloc_section:
         flags &= ~SEC_ALLOC;
         break;
       case noload_section:
         flags &= ~SEC_LOAD;
         flags |= SEC_NEVER_LOAD;
         break;
       }

      if (output->bfd_section == NULL)
       init_os (output, section, flags);

      first = ! output->bfd_section->linker_has_input;
      output->bfd_section->linker_has_input = 1;

      if (!link_info.relocatable
         && !stripped_excluded_sections)
       {
         asection *s = output->bfd_section->map_tail.s;
         output->bfd_section->map_tail.s = section;
         section->map_head.s = NULL;
         section->map_tail.s = s;
         if (s != NULL)
           s->map_head.s = section;
         else
           output->bfd_section->map_head.s = section;
       }

      /* Add a section reference to the list.  */
      new = new_stat (lang_input_section, ptr);

      new->section = section;
      section->output_section = output->bfd_section;

      /* If final link, don't copy the SEC_LINK_ONCE flags, they've
        already been processed.  One reason to do this is that on pe
        format targets, .text$foo sections go into .text and it's odd
        to see .text with SEC_LINK_ONCE set.  */

      if (! link_info.relocatable)
       flags &= ~ (SEC_LINK_ONCE | SEC_LINK_DUPLICATES);

      /* If this is not the first input section, and the SEC_READONLY
        flag is not currently set, then don't set it just because the
        input section has it set.  */

      if (! first && (output->bfd_section->flags & SEC_READONLY) == 0)
       flags &= ~ SEC_READONLY;

      /* Keep SEC_MERGE and SEC_STRINGS only if they are the same.  */
      if (! first
         && ((output->bfd_section->flags & (SEC_MERGE | SEC_STRINGS))
             != (flags & (SEC_MERGE | SEC_STRINGS))
             || ((flags & SEC_MERGE)
                && output->bfd_section->entsize != section->entsize)))
       {
         output->bfd_section->flags &= ~ (SEC_MERGE | SEC_STRINGS);
         flags &= ~ (SEC_MERGE | SEC_STRINGS);
       }

      output->bfd_section->flags |= flags;

      if (flags & SEC_MERGE)
       output->bfd_section->entsize = section->entsize;

      /* If SEC_READONLY is not set in the input section, then clear
        it from the output section.  */
      if ((section->flags & SEC_READONLY) == 0)
       output->bfd_section->flags &= ~SEC_READONLY;

      /* Copy over SEC_SMALL_DATA.  */
      if (section->flags & SEC_SMALL_DATA)
       output->bfd_section->flags |= SEC_SMALL_DATA;

      if (section->alignment_power > output->bfd_section->alignment_power)
       output->bfd_section->alignment_power = section->alignment_power;

      if (bfd_get_arch (section->owner) == bfd_arch_tic54x
         && (section->flags & SEC_TIC54X_BLOCK) != 0)
       {
         output->bfd_section->flags |= SEC_TIC54X_BLOCK;
         /* FIXME: This value should really be obtained from the bfd...  */
         output->block_value = 128;
       }
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void lang_add_target ( const char *  )

Definition at line 5914 of file ldlang.c.

{
  lang_target_statement_type *new;

  new = new_stat (lang_target_statement, stat_ptr);
  new->target = name;
}

Here is the caller graph for this function:

void lang_add_unique ( const char *  )

Definition at line 7007 of file ldlang.c.

{
  struct unique_sections *ent;

  for (ent = unique_section_list; ent; ent = ent->next)
    if (strcmp (ent->name, name) == 0)
      return;

  ent = xmalloc (sizeof *ent);
  ent->name = xstrdup (name);
  ent->next = unique_section_list;
  unique_section_list = ent;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 6947 of file ldlang.c.

{
  struct bfd_elf_version_deps *ret;
  struct bfd_elf_version_tree *t;

  ret = xmalloc (sizeof *ret);
  ret->next = list;

  for (t = lang_elf_version_info; t != NULL; t = t->next)
    {
      if (strcmp (t->name, name) == 0)
       {
         ret->version_needed = t;
         return ret;
       }
    }

  einfo (_("%X%P: unable to find version dependency `%s'\n"), name);

  return ret;
}

Here is the call graph for this function:

Definition at line 5833 of file ldlang.c.

{
  struct wildcard_list *curr, *next;
  lang_wild_statement_type *new;

  /* Reverse the list as the parser puts it back to front.  */
  for (curr = section_list, section_list = NULL;
       curr != NULL;
       section_list = curr, curr = next)
    {
      if (curr->spec.name != NULL && strcmp (curr->spec.name, "COMMON") == 0)
       placed_commons = TRUE;

      next = curr->next;
      curr->next = section_list;
    }

  if (filespec != NULL && filespec->name != NULL)
    {
      if (strcmp (filespec->name, "*") == 0)
       filespec->name = NULL;
      else if (! wildcardp (filespec->name))
       lang_has_input_file = TRUE;
    }

  new = new_stat (lang_wild_statement, stat_ptr);
  new->filename = NULL;
  new->filenames_sorted = FALSE;
  if (filespec != NULL)
    {
      new->filename = filespec->name;
      new->filenames_sorted = filespec->sorted == by_name;
    }
  new->section_list = section_list;
  new->keep_sections = keep_sections;
  lang_list_init (&new->children);
  analyze_walk_wild_section_handler (new);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 7024 of file ldlang.c.

{
  if (link_info.dynamic_list)
    {
      struct bfd_elf_version_expr *tail;
      for (tail = dynamic; tail->next != NULL; tail = tail->next)
       ;
      tail->next = link_info.dynamic_list->head.list;
      link_info.dynamic_list->head.list = dynamic;
    }
  else
    {
      struct bfd_elf_dynamic_list *d;

      d = xcalloc (1, sizeof *d);
      d->head.list = dynamic;
      d->match = lang_vers_match;
      link_info.dynamic_list = d;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 7070 of file ldlang.c.

{
  const char * symbols [] =
    {
      "operator new*",
      "operator delete*"
    };
  struct bfd_elf_version_expr *dynamic = NULL;
  unsigned int i;

  for (i = 0; i < ARRAY_SIZE (symbols); i++)
    dynamic = lang_new_vers_pattern (dynamic, symbols [i], "C++",
                                 FALSE);

  lang_append_dynamic_list (dynamic);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 7049 of file ldlang.c.

{
  const char * symbols [] =
    {
      "typeinfo name for*",
      "typeinfo for*"
    };
  struct bfd_elf_version_expr *dynamic = NULL;
  unsigned int i;

  for (i = 0; i < ARRAY_SIZE (symbols); i++)
    dynamic = lang_new_vers_pattern (dynamic, symbols [i], "C++",
                                 FALSE);

  lang_append_dynamic_list (dynamic);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void lang_default_entry ( const char *  )

Definition at line 5908 of file ldlang.c.

void lang_do_assignments ( void  )

Definition at line 4982 of file ldlang.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void lang_enter_group ( void  )

Definition at line 6167 of file ldlang.c.

{
  lang_group_statement_type *g;

  g = new_stat (lang_group_statement, stat_ptr);
  lang_list_init (&g->children);
  stat_ptr = &g->children;
}

Here is the call graph for this function:

Here is the caller graph for this function:

lang_output_section_statement_type* lang_enter_output_section_statement ( const char *  output_section_statement_name,
etree_type address_exp,
enum section_type  sectype,
etree_type align,
etree_type subalign,
etree_type ,
int   
)

Definition at line 5495 of file ldlang.c.

{
  lang_output_section_statement_type *os;

   os = lang_output_section_statement_lookup_1 (output_section_statement_name,
                                          constraint);
   current_section = os;

  /* Make next things chain into subchain of this.  */

  if (os->addr_tree == NULL)
    {
      os->addr_tree = address_exp;
    }
  os->sectype = sectype;
  if (sectype != noload_section)
    os->flags = SEC_NO_FLAGS;
  else
    os->flags = SEC_NEVER_LOAD;
  os->block_value = 1;
  stat_ptr = &os->children;

  os->subsection_alignment =
    topower (exp_get_value_int (subalign, -1, "subsection alignment"));
  os->section_alignment =
    topower (exp_get_value_int (align, -1, "section alignment"));

  os->load_base = ebase;
  return os;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void lang_enter_overlay ( etree_type ,
etree_type  
)

Definition at line 6372 of file ldlang.c.

{
  /* The grammar should prevent nested overlays from occurring.  */
  ASSERT (overlay_vma == NULL
         && overlay_subalign == NULL
         && overlay_max == NULL);

  overlay_vma = vma_expr;
  overlay_subalign = subalign;
}
void lang_enter_overlay_section ( const char *  )

Definition at line 6388 of file ldlang.c.

{
  struct overlay_list *n;
  etree_type *size;

  lang_enter_output_section_statement (name, overlay_vma, normal_section,
                                   0, overlay_subalign, 0, 0);

  /* If this is the first section, then base the VMA of future
     sections on this one.  This will work correctly even if `.' is
     used in the addresses.  */
  if (overlay_list == NULL)
    overlay_vma = exp_nameop (ADDR, name);

  /* Remember the section.  */
  n = xmalloc (sizeof *n);
  n->os = current_section;
  n->next = overlay_list;
  overlay_list = n;

  size = exp_nameop (SIZEOF, name);

  /* Arrange to work out the maximum section end address.  */
  if (overlay_max == NULL)
    overlay_max = size;
  else
    overlay_max = exp_binop (MAX_K, overlay_max, size);
}

Here is the call graph for this function:

void lang_final ( void  )

Definition at line 5533 of file ldlang.c.

{
  lang_output_statement_type *new;

  new = new_stat (lang_output_statement, stat_ptr);
  new->name = output_filename;
}

Here is the caller graph for this function:

void lang_finish ( void  )

Definition at line 1115 of file ldlang.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void lang_float ( bfd_boolean  )

Definition at line 6014 of file ldlang.c.

{
  lang_float_flag = maybe;
}
void lang_for_each_file ( void(*)(lang_input_statement_type *)  dothis)

Definition at line 5422 of file ldlang.c.

Here is the caller graph for this function:

Definition at line 857 of file ldlang.c.

Here is the call graph for this function:

Here is the caller graph for this function:

const char* lang_get_output_target ( void  )

Definition at line 2729 of file ldlang.c.

{
  const char *target;

  /* Has the user told us which output format to use?  */
  if (output_target != NULL)
    return output_target;

  /* No - has the current target been set to something other than
     the default?  */
  if (current_target != default_target)
    return current_target;

  /* No - can we determine the format of the first input file?  */
  target = get_first_input_target ();
  if (target != NULL)
    return target;

  /* Failed - use the default output target.  */
  return default_target;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void lang_init ( void  )

Definition at line 1081 of file ldlang.c.

{
  obstack_begin (&stat_obstack, 1000);

  stat_ptr = &statement_list;

  output_section_statement_table_init ();

  lang_list_init (stat_ptr);

  lang_list_init (&input_file_chain);
  lang_list_init (&lang_output_section_statement);
  lang_list_init (&file_chain);
  first_file = lang_add_input_file (NULL, lang_input_file_is_marker_enum,
                                NULL);
  abs_output_section =
    lang_output_section_statement_lookup (BFD_ABS_SECTION_NAME);

  abs_output_section->bfd_section = bfd_abs_section_ptr;

  /* The value "3" is ad-hoc, somewhat related to the expected number of
     DEFINED expressions in a linker script.  For most default linker
     scripts, there are none.  Why a hash table then?  Well, it's somewhat
     simpler to re-use working machinery than using a linked list in terms
     of code-complexity here in ld, besides the initialization which just
     looks like other code here.  */
  if (!bfd_hash_table_init_n (&lang_definedness_table,
                           lang_definedness_newfunc,
                           sizeof (struct lang_definedness_hash_entry),
                           3))
    einfo (_("%P%F: can not create hash table: %E\n"));
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1455 of file ldlang.c.

{
  lang_statement_list_type *old;
  lang_statement_list_type add;
  const char *ps;
  lang_output_section_statement_type *os;
  lang_output_section_statement_type **os_tail;

  /* Start building a list of statements for this section.
     First save the current statement pointer.  */
  old = stat_ptr;

  /* If we have found an appropriate place for the output section
     statements for this orphan, add them to our own private list,
     inserting them later into the global statement list.  */
  if (after != NULL)
    {
      stat_ptr = &add;
      lang_list_init (stat_ptr);
    }

  ps = NULL;
  if (config.build_constructors)
    {
      /* If the name of the section is representable in C, then create
        symbols to mark the start and the end of the section.  */
      for (ps = secname; *ps != '\0'; ps++)
       if (! ISALNUM ((unsigned char) *ps) && *ps != '_')
         break;
      if (*ps == '\0')
       {
         char *symname;
         etree_type *e_align;

         symname = (char *) xmalloc (ps - secname + sizeof "__start_" + 1);
         symname[0] = bfd_get_symbol_leading_char (output_bfd);
         sprintf (symname + (symname[0] != 0), "__start_%s", secname);
         e_align = exp_unop (ALIGN_K,
                           exp_intop ((bfd_vma) 1 << s->alignment_power));
         lang_add_assignment (exp_assop ('=', ".", e_align));
         lang_add_assignment (exp_provide (symname,
                                       exp_nameop (NAME, "."),
                                       FALSE));
       }
    }

  if (link_info.relocatable || (s->flags & (SEC_LOAD | SEC_ALLOC)) == 0)
    address = exp_intop (0);

  os_tail = ((lang_output_section_statement_type **)
            lang_output_section_statement.tail);
  os = lang_enter_output_section_statement (secname, address, 0, NULL, NULL,
                                       NULL, 0);

  if (add_child == NULL)
    add_child = &os->children;
  lang_add_section (add_child, s, os);

  lang_leave_output_section_statement (0, "*default*", NULL, NULL);

  if (config.build_constructors && *ps == '\0')
    {
      char *symname;

      /* lang_leave_ouput_section_statement resets stat_ptr.
        Put stat_ptr back where we want it.  */
      if (after != NULL)
       stat_ptr = &add;

      symname = (char *) xmalloc (ps - secname + sizeof "__stop_" + 1);
      symname[0] = bfd_get_symbol_leading_char (output_bfd);
      sprintf (symname + (symname[0] != 0), "__stop_%s", secname);
      lang_add_assignment (exp_provide (symname,
                                   exp_nameop (NAME, "."),
                                   FALSE));
    }

  /* Restore the global list pointer.  */
  if (after != NULL)
    stat_ptr = old;

  if (after != NULL && os->bfd_section != NULL)
    {
      asection *snew, *as;

      snew = os->bfd_section;

      /* Shuffle the bfd section list to make the output file look
        neater.  This is really only cosmetic.  */
      if (place->section == NULL
         && after != (&lang_output_section_statement.head
                     ->output_section_statement))
       {
         asection *bfd_section = after->bfd_section;

         /* If the output statement hasn't been used to place any input
            sections (and thus doesn't have an output bfd_section),
            look for the closest prior output statement having an
            output section.  */
         if (bfd_section == NULL)
           bfd_section = output_prev_sec_find (after);

         if (bfd_section != NULL && bfd_section != snew)
           place->section = &bfd_section->next;
       }

      if (place->section == NULL)
       place->section = &output_bfd->sections;

      as = *place->section;

      if (!as)
       {
         /* Put the section at the end of the list.  */

         /* Unlink the section.  */
         bfd_section_list_remove (output_bfd, snew);

         /* Now tack it back on in the right place.  */
         bfd_section_list_append (output_bfd, snew);
       }
      else if (as != snew && as->prev != snew)
       {
         /* Unlink the section.  */
         bfd_section_list_remove (output_bfd, snew);

         /* Now tack it back on in the right place.  */
         bfd_section_list_insert_before (output_bfd, as, snew);
       }

      /* Save the end of this list.  Further ophans of this type will
        follow the one we've just added.  */
      place->section = &snew->next;

      /* The following is non-cosmetic.  We try to put the output
        statements in some sort of reasonable order here, because they
        determine the final load addresses of the orphan sections.
        In addition, placing output statements in the wrong order may
        require extra segments.  For instance, given a typical
        situation of all read-only sections placed in one segment and
        following that a segment containing all the read-write
        sections, we wouldn't want to place an orphan read/write
        section before or amongst the read-only ones.  */
      if (add.head != NULL)
       {
         lang_output_section_statement_type *newly_added_os;

         if (place->stmt == NULL)
           {
             lang_statement_union_type **where;
             lang_statement_union_type **assign = NULL;
             bfd_boolean ignore_first;

             /* Look for a suitable place for the new statement list.
               The idea is to skip over anything that might be inside
               a SECTIONS {} statement in a script, before we find
               another output_section_statement.  Assignments to "dot"
               before an output section statement are assumed to
               belong to it.  An exception to this rule is made for
               the first assignment to dot, otherwise we might put an
               orphan before . = . + SIZEOF_HEADERS or similar
               assignments that set the initial address.  */

             ignore_first = after == (&lang_output_section_statement.head
                                   ->output_section_statement);
             for (where = &after->header.next;
                 *where != NULL;
                 where = &(*where)->header.next)
              {
                switch ((*where)->header.type)
                  {
                  case lang_assignment_statement_enum:
                    if (assign == NULL)
                     {
                       lang_assignment_statement_type *ass;
                       ass = &(*where)->assignment_statement;
                       if (ass->exp->type.node_class != etree_assert
                           && ass->exp->assign.dst[0] == '.'
                           && ass->exp->assign.dst[1] == 0
                           && !ignore_first)
                         assign = where;
                     }
                    ignore_first = FALSE;
                    continue;
                  case lang_wild_statement_enum:
                  case lang_input_section_enum:
                  case lang_object_symbols_statement_enum:
                  case lang_fill_statement_enum:
                  case lang_data_statement_enum:
                  case lang_reloc_statement_enum:
                  case lang_padding_statement_enum:
                  case lang_constructors_statement_enum:
                    assign = NULL;
                    continue;
                  case lang_output_section_statement_enum:
                    if (assign != NULL)
                     where = assign;
                  case lang_input_statement_enum:
                  case lang_address_statement_enum:
                  case lang_target_statement_enum:
                  case lang_output_statement_enum:
                  case lang_group_statement_enum:
                  case lang_afile_asection_pair_statement_enum:
                    break;
                  }
                break;
              }

             *add.tail = *where;
             *where = add.head;

             place->os_tail = &after->next;
           }
         else
           {
             /* Put it after the last orphan statement we added.  */
             *add.tail = *place->stmt;
             *place->stmt = add.head;
           }

         /* Fix the global list pointer if we happened to tack our
            new list at the tail.  */
         if (*old->tail == add.head)
           old->tail = add.tail;

         /* Save the end of this list.  */
         place->stmt = add.tail;

         /* Do the same for the list of output section statements.  */
         newly_added_os = *os_tail;
         *os_tail = NULL;
         newly_added_os->prev = (lang_output_section_statement_type *)
           ((char *) place->os_tail
            - offsetof (lang_output_section_statement_type, next));
         newly_added_os->next = *place->os_tail;
         if (newly_added_os->next != NULL)
           newly_added_os->next->prev = newly_added_os;
         *place->os_tail = newly_added_os;
         place->os_tail = &newly_added_os->next;

         /* Fixing the global list pointer here is a little different.
            We added to the list in lang_enter_output_section_statement,
            trimmed off the new output_section_statment above when
            assigning *os_tail = NULL, but possibly added it back in
            the same place when assigning *place->os_tail.  */
         if (*os_tail == NULL)
           lang_output_section_statement.tail
             = (lang_statement_union_type **) os_tail;
       }
    }
  return os;
}

Here is the call graph for this function:

void lang_leave_group ( void  )

Definition at line 6182 of file ldlang.c.

Here is the caller graph for this function:

void lang_leave_output_section_statement ( fill_type *  ,
const char *  ,
lang_output_section_phdr_list ,
const char *   
)

Definition at line 6056 of file ldlang.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void lang_leave_overlay ( etree_type ,
int  ,
fill_type *  ,
const char *  ,
lang_output_section_phdr_list ,
const char *   
)

Definition at line 6467 of file ldlang.c.

{
  lang_memory_region_type *region;
  lang_memory_region_type *lma_region;
  struct overlay_list *l;
  lang_nocrossref_type *nocrossref;

  lang_get_regions (&region, &lma_region,
                  memspec, lma_memspec,
                  lma_expr != NULL, FALSE);

  nocrossref = NULL;

  /* After setting the size of the last section, set '.' to end of the
     overlay region.  */
  if (overlay_list != NULL)
    overlay_list->os->update_dot_tree
      = exp_assop ('=', ".", exp_binop ('+', overlay_vma, overlay_max));

  l = overlay_list;
  while (l != NULL)
    {
      struct overlay_list *next;

      if (fill != NULL && l->os->fill == NULL)
       l->os->fill = fill;

      l->os->region = region;
      l->os->lma_region = lma_region;

      /* The first section has the load address specified in the
        OVERLAY statement.  The rest are worked out from that.
        The base address is not needed (and should be null) if
        an LMA region was specified.  */
      if (l->next == 0)
       l->os->load_base = lma_expr;
      if (phdrs != NULL && l->os->phdrs == NULL)
       l->os->phdrs = phdrs;

      if (nocrossrefs)
       {
         lang_nocrossref_type *nc;

         nc = xmalloc (sizeof *nc);
         nc->name = l->os->name;
         nc->next = nocrossref;
         nocrossref = nc;
       }

      next = l->next;
      free (l);
      l = next;
    }

  if (nocrossref != NULL)
    lang_add_nocrossref (nocrossref);

  overlay_vma = NULL;
  overlay_list = NULL;
  overlay_max = NULL;
}

Here is the call graph for this function:

Definition at line 6421 of file ldlang.c.

{
  const char *name;
  char *clean, *s2;
  const char *s1;
  char *buf;

  name = current_section->name;

  /* For now, assume that DEFAULT_MEMORY_REGION is the run-time memory
     region and that no load-time region has been specified.  It doesn't
     really matter what we say here, since lang_leave_overlay will
     override it.  */
  lang_leave_output_section_statement (fill, DEFAULT_MEMORY_REGION, phdrs, 0);

  /* Define the magic symbols.  */

  clean = xmalloc (strlen (name) + 1);
  s2 = clean;
  for (s1 = name; *s1 != '\0'; s1++)
    if (ISALNUM (*s1) || *s1 == '_')
      *s2++ = *s1;
  *s2 = '\0';

  buf = xmalloc (strlen (clean) + sizeof "__load_start_");
  sprintf (buf, "__load_start_%s", clean);
  lang_add_assignment (exp_provide (buf,
                                exp_nameop (LOADADDR, name),
                                FALSE));

  buf = xmalloc (strlen (clean) + sizeof "__load_stop_");
  sprintf (buf, "__load_stop_%s", clean);
  lang_add_assignment (exp_provide (buf,
                                exp_binop ('+',
                                          exp_nameop (LOADADDR, name),
                                          exp_nameop (SIZEOF, name)),
                                FALSE));

  free (clean);
}

Here is the call graph for this function:

Definition at line 865 of file ldlang.c.

{
  list->head = NULL;
  list->tail = &list->head;
}

Here is the caller graph for this function:

void lang_map ( void  )

Definition at line 1733 of file ldlang.c.

{
  lang_memory_region_type *m;
  bfd_boolean dis_header_printed = FALSE;
  bfd *p;

  LANG_FOR_EACH_INPUT_STATEMENT (file)
    {
      asection *s;

      if ((file->the_bfd->flags & (BFD_LINKER_CREATED | DYNAMIC)) != 0
         || file->just_syms_flag)
       continue;

      for (s = file->the_bfd->sections; s != NULL; s = s->next)
       if ((s->output_section == NULL
            || s->output_section->owner != output_bfd)
           && (s->flags & (SEC_LINKER_CREATED | SEC_KEEP)) == 0)
         {
           if (! dis_header_printed)
             {
              fprintf (config.map_file, _("\nDiscarded input sections\n\n"));
              dis_header_printed = TRUE;
             }

           print_input_section (s);
         }
    }

  minfo (_("\nMemory Configuration\n\n"));
  fprintf (config.map_file, "%-16s %-18s %-18s %s\n",
          _("Name"), _("Origin"), _("Length"), _("Attributes"));

  for (m = lang_memory_region_list; m != NULL; m = m->next)
    {
      char buf[100];
      int len;

      fprintf (config.map_file, "%-16s ", m->name);

      sprintf_vma (buf, m->origin);
      minfo ("0x%s ", buf);
      len = strlen (buf);
      while (len < 16)
       {
         print_space ();
         ++len;
       }

      minfo ("0x%V", m->length);
      if (m->flags || m->not_flags)
       {
#ifndef BFD64
         minfo ("        ");
#endif
         if (m->flags)
           {
             print_space ();
             lang_map_flags (m->flags);
           }

         if (m->not_flags)
           {
             minfo (" !");
             lang_map_flags (m->not_flags);
           }
       }

      print_nl ();
    }

  fprintf (config.map_file, _("\nLinker script and memory map\n\n"));

  if (! link_info.reduce_memory_overheads)
    {
      obstack_begin (&map_obstack, 1000);
      for (p = link_info.input_bfds; p != (bfd *) NULL; p = p->link_next)
       bfd_map_over_sections (p, init_map_userdata, 0);
      bfd_link_hash_traverse (link_info.hash, sort_def_symbol, 0);
    }
  print_statements ();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1141 of file ldlang.c.

{
  lang_memory_region_type *p;
  lang_memory_region_type *new;

  /* NAME is NULL for LMA memspecs if no region was specified.  */
  if (name == NULL)
    return NULL;

  for (p = lang_memory_region_list; p != NULL; p = p->next)
    if (strcmp (p->name, name) == 0)
      {
       if (create)
         einfo (_("%P:%S: warning: redeclaration of memory region '%s'\n"),
               name);
       return p;
      }

  if (!create && strcmp (name, DEFAULT_MEMORY_REGION))
    einfo (_("%P:%S: warning: memory region %s not declared\n"), name);

  new = stat_alloc (sizeof (lang_memory_region_type));

  new->name = xstrdup (name);
  new->next = NULL;
  new->origin = 0;
  new->length = ~(bfd_size_type) 0;
  new->current = 0;
  new->last_os = NULL;
  new->flags = 0;
  new->not_flags = 0;
  new->had_full_message = FALSE;

  *lang_memory_region_list_tail = new;
  lang_memory_region_list_tail = &new->next;

  return new;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void lang_new_phdr ( const char *  ,
etree_type ,
bfd_boolean  ,
bfd_boolean  ,
etree_type ,
etree_type  
)

Definition at line 6191 of file ldlang.c.

{
  struct lang_phdr *n, **pp;

  n = stat_alloc (sizeof (struct lang_phdr));
  n->next = NULL;
  n->name = name;
  n->type = exp_get_value_int (type, 0, "program header type");
  n->filehdr = filehdr;
  n->phdrs = phdrs;
  n->at = at;
  n->flags = flags;

  for (pp = &lang_phdr_list; *pp != NULL; pp = &(*pp)->next)
    ;
  *pp = n;
}

Here is the call graph for this function:

Definition at line 6729 of file ldlang.c.

{
  struct bfd_elf_version_tree *ret;

  ret = xcalloc (1, sizeof *ret);
  ret->globals.list = globals;
  ret->locals.list = locals;
  ret->match = lang_vers_match;
  ret->name_indx = (unsigned int) -1;
  return ret;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 6695 of file ldlang.c.

{
  struct bfd_elf_version_expr *ret;

  ret = xmalloc (sizeof *ret);
  ret->next = orig;
  ret->pattern = literal_p ? NULL : new;
  ret->symver = 0;
  ret->script = 0;
  ret->symbol = literal_p ? new : realsymbol (new);

  if (lang == NULL || strcasecmp (lang, "C") == 0)
    ret->mask = BFD_ELF_VERSION_C_TYPE;
  else if (strcasecmp (lang, "C++") == 0)
    ret->mask = BFD_ELF_VERSION_CXX_TYPE;
  else if (strcasecmp (lang, "Java") == 0)
    ret->mask = BFD_ELF_VERSION_JAVA_TYPE;
  else
    {
      einfo (_("%X%P: unknown language `%s' in version information\n"),
            lang);
      ret->mask = BFD_ELF_VERSION_C_TYPE;
    }

  return ldemul_new_vers_pattern (ret);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1203 of file ldlang.c.

{
  struct out_section_hash_entry *entry;
  unsigned long hash;

  entry = ((struct out_section_hash_entry *)
          bfd_hash_lookup (&output_section_statement_table, name,
                         FALSE, FALSE));
  if (entry == NULL)
    return NULL;

  hash = entry->root.hash;
  do
    {
      if (entry->s.output_section_statement.constraint != -1)
       return &entry->s.output_section_statement;
      entry = (struct out_section_hash_entry *) entry->root.next;
    }
  while (entry != NULL
        && entry->root.hash == hash
        && strcmp (name, entry->s.output_section_statement.name) == 0);

  return NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1294 of file ldlang.c.

{
  lang_output_section_statement_type *first, *look, *found;
  flagword flags;

  /* We know the first statement on this list is *ABS*.  May as well
     skip it.  */
  first = &lang_output_section_statement.head->output_section_statement;
  first = first->next;

  /* First try for an exact match.  */
  found = NULL;
  for (look = first; look; look = look->next)
    {
      flags = look->flags;
      if (look->bfd_section != NULL)
       {
         flags = look->bfd_section->flags;
         if (match_type && !match_type (output_bfd, look->bfd_section,
                                    sec->owner, sec))
           continue;
       }
      flags ^= sec->flags;
      if (!(flags & (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_READONLY
                   | SEC_CODE | SEC_SMALL_DATA | SEC_THREAD_LOCAL)))
       found = look;
    }
  if (found != NULL)
    {
      if (exact != NULL)
       *exact = found;
      return found;
    }

  if (sec->flags & SEC_CODE)
    {
      /* Try for a rw code section.  */
      for (look = first; look; look = look->next)
       {
         flags = look->flags;
         if (look->bfd_section != NULL)
           {
             flags = look->bfd_section->flags;
             if (match_type && !match_type (output_bfd, look->bfd_section,
                                        sec->owner, sec))
              continue;
           }
         flags ^= sec->flags;
         if (!(flags & (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD
                      | SEC_CODE | SEC_SMALL_DATA | SEC_THREAD_LOCAL)))
           found = look;
       }
    }
  else if (sec->flags & (SEC_READONLY | SEC_THREAD_LOCAL))
    {
      /* .rodata can go after .text, .sdata2 after .rodata.  */
      for (look = first; look; look = look->next)
       {
         flags = look->flags;
         if (look->bfd_section != NULL)
           {
             flags = look->bfd_section->flags;
             if (match_type && !match_type (output_bfd, look->bfd_section,
                                        sec->owner, sec))
              continue;
           }
         flags ^= sec->flags;
         if (!(flags & (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD
                      | SEC_READONLY))
             && !(look->flags & (SEC_SMALL_DATA | SEC_THREAD_LOCAL)))
           found = look;
       }
    }
  else if (sec->flags & SEC_SMALL_DATA)
    {
      /* .sdata goes after .data, .sbss after .sdata.  */
      for (look = first; look; look = look->next)
       {
         flags = look->flags;
         if (look->bfd_section != NULL)
           {
             flags = look->bfd_section->flags;
             if (match_type && !match_type (output_bfd, look->bfd_section,
                                        sec->owner, sec))
              continue;
           }
         flags ^= sec->flags;
         if (!(flags & (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD
                      | SEC_THREAD_LOCAL))
             || ((look->flags & SEC_SMALL_DATA)
                && !(sec->flags & SEC_HAS_CONTENTS)))
           found = look;
       }
    }
  else if (sec->flags & SEC_HAS_CONTENTS)
    {
      /* .data goes after .rodata.  */
      for (look = first; look; look = look->next)
       {
         flags = look->flags;
         if (look->bfd_section != NULL)
           {
             flags = look->bfd_section->flags;
             if (match_type && !match_type (output_bfd, look->bfd_section,
                                        sec->owner, sec))
              continue;
           }
         flags ^= sec->flags;
         if (!(flags & (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD
                      | SEC_SMALL_DATA | SEC_THREAD_LOCAL)))
           found = look;
       }
    }
  else
    {
      /* .bss goes last.  */
      for (look = first; look; look = look->next)
       {
         flags = look->flags;
         if (look->bfd_section != NULL)
           {
             flags = look->bfd_section->flags;
             if (match_type && !match_type (output_bfd, look->bfd_section,
                                        sec->owner, sec))
              continue;
           }
         flags ^= sec->flags;
         if (!(flags & SEC_ALLOC))
           found = look;
       }
    }

  if (found || !match_type)
    return found;

  return lang_output_section_find_by_flags (sec, NULL, NULL);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1283 of file ldlang.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void lang_process ( void  )

Definition at line 5691 of file ldlang.c.

{
  /* Finalize dynamic list.  */
  if (link_info.dynamic_list)
    lang_finalize_version_expr_head (&link_info.dynamic_list->head);

  current_target = default_target;

  /* Open the output file.  */
  lang_for_each_statement (ldlang_open_output);
  init_opb ();

  ldemul_create_output_section_statements ();

  /* Add to the hash table all undefineds on the command line.  */
  lang_place_undefineds ();

  if (!bfd_section_already_linked_table_init ())
    einfo (_("%P%F: Failed to create hash table\n"));

  /* Create a bfd for each input file.  */
  current_target = default_target;
  open_input_bfds (statement_list.head, FALSE);

  link_info.gc_sym_list = &entry_symbol;
  if (entry_symbol.name == NULL)
    link_info.gc_sym_list = ldlang_undef_chain_list_head;

  ldemul_after_open ();

  bfd_section_already_linked_table_free ();

  /* Make sure that we're not mixing architectures.  We call this
     after all the input files have been opened, but before we do any
     other processing, so that any operations merge_private_bfd_data
     does on the output file will be known during the rest of the
     link.  */
  lang_check ();

  /* Handle .exports instead of a version script if we're told to do so.  */
  if (command_line.version_exports_section)
    lang_do_version_exports_section ();

  /* Build all sets based on the information gathered from the input
     files.  */
  ldctor_build_sets ();

  /* Remove unreferenced sections if asked to.  */
  lang_gc_sections ();

  /* Size up the common data.  */
  lang_common ();

  /* Update wild statements.  */
  update_wild_statements (statement_list.head);

  /* Run through the contours of the script and attach input sections
     to the correct output sections.  */
  map_input_to_output_sections (statement_list.head, NULL, NULL);

  /* Find any sections not attached explicitly and handle them.  */
  lang_place_orphans ();

  if (! link_info.relocatable)
    {
      asection *found;

      /* Merge SEC_MERGE sections.  This has to be done after GC of
        sections, so that GCed sections are not merged, but before
        assigning dynamic symbols, since removing whole input sections
        is hard then.  */
      bfd_merge_sections (output_bfd, &link_info);

      /* Look for a text section and set the readonly attribute in it.  */
      found = bfd_get_section_by_name (output_bfd, ".text");

      if (found != NULL)
       {
         if (config.text_read_only)
           found->flags |= SEC_READONLY;
         else
           found->flags &= ~SEC_READONLY;
       }
    }

  /* Do anything special before sizing sections.  This is where ELF
     and other back-ends size dynamic sections.  */
  ldemul_before_allocation ();

  /* We must record the program headers before we try to fix the
     section positions, since they will affect SIZEOF_HEADERS.  */
  lang_record_phdrs ();

  /* Size up the sections.  */
  lang_size_sections (NULL, !command_line.relax);

  /* Now run around and relax if we can.  */
  if (command_line.relax)
    {
      /* We may need more than one relaxation pass.  */
      int i = link_info.relax_pass;

      /* The backend can use it to determine the current pass.  */
      link_info.relax_pass = 0;

      while (i--)
       {
         relax_sections ();
         link_info.relax_pass++;
       }

      /* Final extra sizing to report errors.  */
      lang_do_assignments ();
      lang_reset_memory_regions ();
      lang_size_sections (NULL, TRUE);
    }

  /* See if anything special should be done now we know how big
     everything is.  */
  ldemul_after_allocation ();

  /* Fix any .startof. or .sizeof. symbols.  */
  lang_set_startof ();

  /* Do all the assignments, now that we know the final resting places
     of all the symbols.  */

  lang_do_assignments ();

  ldemul_finish ();

  /* Make sure that the section addresses make sense.  */
  if (! link_info.relocatable
      && command_line.check_section_addresses)
    lang_check_section_addresses ();

  lang_end ();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 6846 of file ldlang.c.

{
  struct bfd_elf_version_tree *t, **pp;
  struct bfd_elf_version_expr *e1;

  if (name == NULL)
    name = "";

  if ((name[0] == '\0' && lang_elf_version_info != NULL)
      || (lang_elf_version_info && lang_elf_version_info->name[0] == '\0'))
    {
      einfo (_("%X%P: anonymous version tag cannot be combined"
              " with other version tags\n"));
      free (version);
      return;
    }

  /* Make sure this node has a unique name.  */
  for (t = lang_elf_version_info; t != NULL; t = t->next)
    if (strcmp (t->name, name) == 0)
      einfo (_("%X%P: duplicate version tag `%s'\n"), name);

  lang_finalize_version_expr_head (&version->globals);
  lang_finalize_version_expr_head (&version->locals);

  /* Check the global and local match names, and make sure there
     aren't any duplicates.  */

  for (e1 = version->globals.list; e1 != NULL; e1 = e1->next)
    {
      for (t = lang_elf_version_info; t != NULL; t = t->next)
       {
         struct bfd_elf_version_expr *e2;

         if (t->locals.htab && e1->symbol)
           {
             e2 = htab_find (t->locals.htab, e1);
             while (e2 && strcmp (e1->symbol, e2->symbol) == 0)
              {
                if (e1->mask == e2->mask)
                  einfo (_("%X%P: duplicate expression `%s'"
                          " in version information\n"), e1->symbol);
                e2 = e2->next;
              }
           }
         else if (!e1->symbol)
           for (e2 = t->locals.remaining; e2 != NULL; e2 = e2->next)
             if (strcmp (e1->pattern, e2->pattern) == 0
                && e1->mask == e2->mask)
              einfo (_("%X%P: duplicate expression `%s'"
                      " in version information\n"), e1->pattern);
       }
    }

  for (e1 = version->locals.list; e1 != NULL; e1 = e1->next)
    {
      for (t = lang_elf_version_info; t != NULL; t = t->next)
       {
         struct bfd_elf_version_expr *e2;

         if (t->globals.htab && e1->symbol)
           {
             e2 = htab_find (t->globals.htab, e1);
             while (e2 && strcmp (e1->symbol, e2->symbol) == 0)
              {
                if (e1->mask == e2->mask)
                  einfo (_("%X%P: duplicate expression `%s'"
                          " in version information\n"),
                        e1->symbol);
                e2 = e2->next;
              }
           }
         else if (!e1->symbol)
           for (e2 = t->globals.remaining; e2 != NULL; e2 = e2->next)
             if (strcmp (e1->pattern, e2->pattern) == 0
                && e1->mask == e2->mask)
              einfo (_("%X%P: duplicate expression `%s'"
                      " in version information\n"), e1->pattern);
       }
    }

  version->deps = deps;
  version->name = name;
  if (name[0] != '\0')
    {
      ++version_index;
      version->vernum = version_index;
    }
  else
    version->vernum = 0;

  for (pp = &lang_elf_version_info; *pp != NULL; pp = &(*pp)->next)
    ;
  *pp = version;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void lang_reset_memory_regions ( void  )

Definition at line 5544 of file ldlang.c.

{
  lang_memory_region_type *p = lang_memory_region_list;
  asection *o;
  lang_output_section_statement_type *os;

  for (p = lang_memory_region_list; p != NULL; p = p->next)
    {
      p->current = p->origin;
      p->last_os = NULL;
    }

  for (os = &lang_output_section_statement.head->output_section_statement;
       os != NULL;
       os = os->next)
    {
      os->processed_vma = FALSE;
      os->processed_lma = FALSE;
    }

  for (o = output_bfd->sections; o != NULL; o = o->next)
    {
      /* Save the last size for possible use by bfd_relax_section.  */
      o->rawsize = o->size;
      o->size = 0;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void lang_section_start ( const char *  ,
union etree_union ,
const segment_type  
)

Definition at line 5875 of file ldlang.c.

{
  lang_address_statement_type *ad;

  ad = new_stat (lang_address_statement, stat_ptr);
  ad->section_name = name;
  ad->address = address;
  ad->segment = segment;
}

Here is the caller graph for this function:

void lang_set_flags ( lang_memory_region_type ,
const char *  ,
int   
)

Definition at line 5365 of file ldlang.c.

{
  flagword *ptr_flags;

  ptr_flags = invert ? &ptr->not_flags : &ptr->flags;
  while (*flags)
    {
      switch (*flags)
       {
       case 'A': case 'a':
         *ptr_flags |= SEC_ALLOC;
         break;

       case 'R': case 'r':
         *ptr_flags |= SEC_READONLY;
         break;

       case 'W': case 'w':
         *ptr_flags |= SEC_DATA;
         break;

       case 'X': case 'x':
         *ptr_flags |= SEC_CODE;
         break;

       case 'L': case 'l':
       case 'I': case 'i':
         *ptr_flags |= SEC_LOAD;
         break;

       default:
         einfo (_("%P%F: invalid syntax in flags\n"));
         break;
       }
      flags++;
    }
}

Here is the call graph for this function:

Definition at line 4769 of file ldlang.c.

{
  expld.phase = lang_allocating_phase_enum;
  expld.dataseg.phase = exp_dataseg_none;

  one_lang_size_sections_pass (relax, check_regions);
  if (expld.dataseg.phase == exp_dataseg_end_seen
      && link_info.relro && expld.dataseg.relro_end)
    {
      /* If DATA_SEGMENT_ALIGN DATA_SEGMENT_RELRO_END pair was seen, try
        to put expld.dataseg.relro on a (common) page boundary.  */
      bfd_vma old_min_base, relro_end, maxpage;

      expld.dataseg.phase = exp_dataseg_relro_adjust;
      old_min_base = expld.dataseg.min_base;
      maxpage = expld.dataseg.maxpagesize;
      expld.dataseg.base += (-expld.dataseg.relro_end
                          & (expld.dataseg.pagesize - 1));
      /* Compute the expected PT_GNU_RELRO segment end.  */
      relro_end = (expld.dataseg.relro_end + expld.dataseg.pagesize - 1)
                & ~(expld.dataseg.pagesize - 1);
      if (old_min_base + maxpage < expld.dataseg.base)
       {
         expld.dataseg.base -= maxpage;
         relro_end -= maxpage;
       }
      lang_reset_memory_regions ();
      one_lang_size_sections_pass (relax, check_regions);
      if (expld.dataseg.relro_end > relro_end)
       {
         /* The alignment of sections between DATA_SEGMENT_ALIGN
            and DATA_SEGMENT_RELRO_END caused huge padding to be
            inserted at DATA_SEGMENT_RELRO_END.  Try some other base.  */
         asection *sec;
         unsigned int max_alignment_power = 0;

         /* Find maximum alignment power of sections between
            DATA_SEGMENT_ALIGN and DATA_SEGMENT_RELRO_END.  */
         for (sec = output_bfd->sections; sec; sec = sec->next)
           if (sec->vma >= expld.dataseg.base
              && sec->vma < expld.dataseg.relro_end
              && sec->alignment_power > max_alignment_power)
             max_alignment_power = sec->alignment_power;

         if (((bfd_vma) 1 << max_alignment_power) < expld.dataseg.pagesize)
           {
             if (expld.dataseg.base - (1 << max_alignment_power)
                < old_min_base)
              expld.dataseg.base += expld.dataseg.pagesize;
             expld.dataseg.base -= (1 << max_alignment_power);
             lang_reset_memory_regions ();
             one_lang_size_sections_pass (relax, check_regions);
           }
       }
      link_info.relro_start = expld.dataseg.base;
      link_info.relro_end = expld.dataseg.relro_end;
    }
  else if (expld.dataseg.phase == exp_dataseg_end_seen)
    {
      /* If DATA_SEGMENT_ALIGN DATA_SEGMENT_END pair was seen, check whether
        a page could be saved in the data segment.  */
      bfd_vma first, last;

      first = -expld.dataseg.base & (expld.dataseg.pagesize - 1);
      last = expld.dataseg.end & (expld.dataseg.pagesize - 1);
      if (first && last
         && ((expld.dataseg.base & ~(expld.dataseg.pagesize - 1))
             != (expld.dataseg.end & ~(expld.dataseg.pagesize - 1)))
         && first + last <= expld.dataseg.pagesize)
       {
         expld.dataseg.phase = exp_dataseg_adjust;
         lang_reset_memory_regions ();
         one_lang_size_sections_pass (relax, check_regions);
       }
    }

  expld.phase = lang_final_phase_enum;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void lang_startup ( const char *  )

Definition at line 6000 of file ldlang.c.

{
  if (startup_file != NULL)
    {
      einfo (_("%P%F: multiple STARTUP files\n"));
    }
  first_file->filename = name;
  first_file->local_sym_name = name;
  first_file->real = TRUE;

  startup_file = name;
}

Here is the call graph for this function:

Definition at line 6134 of file ldlang.c.

{
  *(list->tail) = element;
  list->tail = field;
}

Here is the caller graph for this function:

Definition at line 3003 of file ldlang.c.

{
  struct lang_definedness_hash_entry *defentry
    = (struct lang_definedness_hash_entry *)
    bfd_hash_lookup (&lang_definedness_table, name, FALSE, FALSE);

  /* We've already created this one on the presence of DEFINED in the
     script, so it can't be NULL unless something is borked elsewhere in
     the code.  */
  if (defentry == NULL)
    FAIL ();

  return defentry->iteration;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void lang_track_definedness ( const char *  )

Definition at line 2971 of file ldlang.c.

{
  if (bfd_hash_lookup (&lang_definedness_table, name, TRUE, FALSE) == NULL)
    einfo (_("%P%F: bfd_hash_lookup failed creating symbol %s\n"), name);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 3021 of file ldlang.c.

{
  struct lang_definedness_hash_entry *defentry
    = (struct lang_definedness_hash_entry *)
    bfd_hash_lookup (&lang_definedness_table, name, FALSE, FALSE);

  /* We don't keep track of symbols not tested with DEFINED.  */
  if (defentry == NULL)
    return;

  /* If the symbol was already defined, and not from an earlier statement
     iteration, don't update the definedness iteration, because that'd
     make the symbol seem defined in the linker script at this point, and
     it wasn't; it was defined in some object.  If we do anyway, DEFINED
     would start to yield false before this point and the construct "sym =
     DEFINED (sym) ? sym : X;" would change sym to X despite being defined
     in an object.  */
  if (h->type != bfd_link_hash_undefined
      && h->type != bfd_link_hash_common
      && h->type != bfd_link_hash_new
      && defentry->iteration == -1)
    return;

  defentry->iteration = lang_statement_iteration;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 5431 of file ldlang.c.

{
  bfd **pp;

  lang_statement_append (&file_chain,
                      (lang_statement_union_type *) entry,
                      &entry->next);

  /* The BFD linker needs to have a list of all input BFDs involved in
     a link.  */
  ASSERT (entry->the_bfd->link_next == NULL);
  ASSERT (entry->the_bfd != output_bfd);
  for (pp = &link_info.input_bfds; *pp != NULL; pp = &(*pp)->link_next)
    ;
  *pp = entry->the_bfd;
  entry->the_bfd->usrdata = entry;
  bfd_set_gp_size (entry->the_bfd, g_switch_value);

  /* Look through the sections and check for any which should not be
     included in the link.  We need to do this now, so that we can
     notice when the backend linker tries to report multiple
     definition errors for symbols which are in sections we aren't
     going to link.  FIXME: It might be better to entirely ignore
     symbols which are defined in sections which are going to be
     discarded.  This would require modifying the backend linker for
     each backend which might set the SEC_LINK_ONCE flag.  If we do
     this, we should probably handle SEC_EXCLUDE in the same way.  */

  bfd_map_over_sections (entry->the_bfd, section_already_linked, entry);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void ldlang_add_undef ( const char *  const)

Definition at line 3058 of file ldlang.c.

{
  ldlang_undef_chain_list_type *new =
    stat_alloc (sizeof (ldlang_undef_chain_list_type));

  new->next = ldlang_undef_chain_list_head;
  ldlang_undef_chain_list_head = new;

  new->name = xstrdup (name);

  if (output_bfd != NULL)
    insert_undefined (new->name);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 2399 of file ldlang.c.

{
  char **matching;

  if (entry->loaded)
    return TRUE;

  ldfile_open_file (entry);

  if (! bfd_check_format (entry->the_bfd, bfd_archive)
      && ! bfd_check_format_matches (entry->the_bfd, bfd_object, &matching))
    {
      bfd_error_type err;
      lang_statement_list_type *hold;
      bfd_boolean bad_load = TRUE;
      bfd_boolean save_ldlang_sysrooted_script;
      bfd_boolean save_as_needed, save_add_needed;

      err = bfd_get_error ();

      /* See if the emulation has some special knowledge.  */
      if (ldemul_unrecognized_file (entry))
       return TRUE;

      if (err == bfd_error_file_ambiguously_recognized)
       {
         char **p;

         einfo (_("%B: file not recognized: %E\n"), entry->the_bfd);
         einfo (_("%B: matching formats:"), entry->the_bfd);
         for (p = matching; *p != NULL; p++)
           einfo (" %s", *p);
         einfo ("%F\n");
       }
      else if (err != bfd_error_file_not_recognized
              || place == NULL)
         einfo (_("%F%B: file not recognized: %E\n"), entry->the_bfd);
      else
       bad_load = FALSE;

      bfd_close (entry->the_bfd);
      entry->the_bfd = NULL;

      /* Try to interpret the file as a linker script.  */
      ldfile_open_command_file (entry->filename);

      hold = stat_ptr;
      stat_ptr = place;
      save_ldlang_sysrooted_script = ldlang_sysrooted_script;
      ldlang_sysrooted_script = entry->sysrooted;
      save_as_needed = as_needed;
      as_needed = entry->as_needed;
      save_add_needed = add_needed;
      add_needed = entry->add_needed;

      ldfile_assumed_script = TRUE;
      parser_input = input_script;
      /* We want to use the same -Bdynamic/-Bstatic as the one for
        ENTRY.  */
      config.dynamic_link = entry->dynamic;
      yyparse ();
      ldfile_assumed_script = FALSE;

      ldlang_sysrooted_script = save_ldlang_sysrooted_script;
      as_needed = save_as_needed;
      add_needed = save_add_needed;
      stat_ptr = hold;

      return ! bad_load;
    }

  if (ldemul_recognized_file (entry))
    return TRUE;

  /* We don't call ldlang_add_file for an archive.  Instead, the
     add_symbols entry point will call ldlang_add_file, via the
     add_archive_element callback, for each element of the archive
     which is used.  */
  switch (bfd_get_format (entry->the_bfd))
    {
    default:
      break;

    case bfd_object:
      ldlang_add_file (entry);
      if (trace_files || trace_file_tries)
       info_msg ("%I\n", entry);
      break;

    case bfd_archive:
      check_excluded_libs (entry->the_bfd);

      if (entry->whole_archive)
       {
         bfd *member = NULL;
         bfd_boolean loaded = TRUE;

         for (;;)
           {
             member = bfd_openr_next_archived_file (entry->the_bfd, member);

             if (member == NULL)
              break;

             if (! bfd_check_format (member, bfd_object))
              {
                einfo (_("%F%B: member %B in archive is not an object\n"),
                      entry->the_bfd, member);
                loaded = FALSE;
              }

             if (! ((*link_info.callbacks->add_archive_element)
                   (&link_info, member, "--whole-archive")))
              abort ();

             if (! bfd_link_add_symbols (member, &link_info))
              {
                einfo (_("%F%B: could not read symbols: %E\n"), member);
                loaded = FALSE;
              }
           }

         entry->loaded = loaded;
         return loaded;
       }
      break;
    }

  if (bfd_link_add_symbols (entry->the_bfd, &link_info))
    entry->loaded = TRUE;
  else
    einfo (_("%F%B: could not read symbols: %E\n"), entry->the_bfd);

  return entry->loaded;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 4761 of file ldlang.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void* stat_alloc ( size_t  )

Definition at line 130 of file ldlang.c.

{
  return obstack_alloc (&stat_obstack, size);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 3325 of file ldlang.c.

{
  lang_output_section_statement_type *os;

  /* Run lang_size_sections (if not already done).  */
  if (expld.phase != lang_mark_phase_enum)
    {
      expld.phase = lang_mark_phase_enum;
      expld.dataseg.phase = exp_dataseg_none;
      one_lang_size_sections_pass (NULL, FALSE);
      lang_reset_memory_regions ();
    }

  for (os = &lang_output_section_statement.head->output_section_statement;
       os != NULL;
       os = os->next)
    {
      asection *output_section;
      bfd_boolean exclude;

      if (os->constraint == -1)
       continue;

      output_section = os->bfd_section;
      if (output_section == NULL)
       continue;

      exclude = (output_section->rawsize == 0
               && (output_section->flags & SEC_KEEP) == 0
               && !bfd_section_removed_from_list (output_bfd,
                                              output_section));

      /* Some sections have not yet been sized, notably .gnu.version,
        .dynsym, .dynstr and .hash.  These all have SEC_LINKER_CREATED
        input sections, so don't drop output sections that have such
        input sections unless they are also marked SEC_EXCLUDE.  */
      if (exclude && output_section->map_head.s != NULL)
       {
         asection *s;

         for (s = output_section->map_head.s; s != NULL; s = s->map_head.s)
           if ((s->flags & SEC_LINKER_CREATED) != 0
              && (s->flags & SEC_EXCLUDE) == 0)
             {
              exclude = FALSE;
              break;
             }
       }

      /* TODO: Don't just junk map_head.s, turn them into link_orders.  */
      output_section->map_head.link_order = NULL;
      output_section->map_tail.link_order = NULL;

      if (exclude)
       {
         /* We don't set bfd_section to NULL since bfd_section of the
            removed output section statement may still be used.  */
         if (!os->section_relative_symbol)
           os->ignored = TRUE;
         output_section->flags |= SEC_EXCLUDE;
         bfd_section_list_remove (output_bfd, output_section);
         output_bfd->section_count--;
       }
    }

  /* Stop future calls to lang_add_section from messing with map_head
     and map_tail link_order fields.  */
  stripped_excluded_sections = TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 136 of file ldlang.c.

{
  struct unique_sections *unam;
  const char *secnam;

  if (link_info.relocatable
      && sec->owner != NULL
      && bfd_is_group_section (sec->owner, sec))
    return TRUE;

  secnam = sec->name;
  for (unam = unique_section_list; unam; unam = unam->next)
    if (wildcardp (unam->name)
       ? fnmatch (unam->name, secnam, 0) == 0
       : strcmp (unam->name, secnam) == 0)
      {
       return TRUE;
      }

  return FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 87 of file ldlang.c.

Definition at line 109 of file ldlang.c.

Definition at line 99 of file ldlang.c.

Definition at line 95 of file ldlang.c.

Definition at line 94 of file ldlang.c.

Definition at line 90 of file ldlang.c.

Definition at line 91 of file ldlang.c.

Definition at line 6538 of file ldlang.c.

Definition at line 96 of file ldlang.c.

Definition at line 88 of file ldlang.c.

Definition at line 100 of file ldlang.c.

Definition at line 107 of file ldlang.c.

Definition at line 101 of file ldlang.c.

Definition at line 89 of file ldlang.c.