Back to index

glibc  2.9
Defines | Functions
dl-machine.h File Reference
#include <sys/param.h>

Go to the source code of this file.

Defines

#define ELF_MACHINE_NAME   "CRIS"
#define CALL_FN(x)   "jsr " #x
#define TRAMPOLINE_TEMPLATE(tramp_name, fixup_name)   "; Trampoline for " #fixup_name "\n\ .globl " #tramp_name "\n\ .type " #tramp_name ", @function\n\" #tramp_name ":\n\ push $r13\n\ push $r12\n\ push $r11\n\ push $r10\n\ push $r9\n\ push $srp\n\ move.d [$sp+6*4],$r11\n\ move $mof,$r10\n\ " CALL_FN (fixup_name) "\n\ move.d $r10,[$sp+6*4]\n\ pop $srp\n\ pop $r9\n\ pop $r10\n\ pop $r11\n\ pop $r12\n\ pop $r13\n\ jump [$sp+]\n\ .size " #tramp_name ", . - " #tramp_name "\n"
#define ELF_MACHINE_RUNTIME_TRAMPOLINE
#define ELF_MACHINE_USER_ADDRESS_MASK   0xf8000000UL
#define RTLD_START   asm ("\ .text\n\ .globl _start\n\ .type _start,@function\n\_start:\n\ move.d $sp,$r10\n\ " CALL_FN (_dl_start) "\n\ /* FALLTHRU */\n\\n\ .globl _dl_start_user\n\ .type _dl_start_user,@function\n\_dl_start_user:\n\ ; Save the user entry point address in R1.\n\ move.d $r10,$r1\n\ ; Point R0 at the GOT.\n\ move.d $pc,$r0\n\ sub.d .:GOTOFF,$r0\n\ ; See if we were run as a command with the executable file\n\ ; name as an extra leading argument.\n\ move.d [$r0+_dl_skip_args:GOT16],$r13\n\ move.d [$r13],$r9\n\ ; Get the original argument count\n\ move.d [$sp],$r11\n\ ; Subtract _dl_skip_args from it.\n\ sub.d $r9,$r11\n\ ; Adjust the stack pointer to skip _dl_skip_args words.\n\ addi $r9.d,$sp\n\ ; Put the new argc in place as expected by the user entry.\n\ move.d $r11,[$sp]\n\ ; Call _dl_init (struct link_map *main_map, int argc, char **argv, char **env)\n\ ; env: skip scaled argc and skip stored argc and NULL at end of argv[].\n\ move.d $sp,$r13\n\ addi $r11.d,$r13\n\ addq 8,$r13\n\ ; argv: skip stored argc.\n\ move.d $sp,$r12\n\ addq 4,$r12\n\ ; main_map: at _dl_loaded.\n\ move.d [$r0+_rtld_local:GOT16],$r9\n\ move.d [$r9],$r10\n\ move.d _dl_init_internal:PLTG,$r9\n\ add.d $r0,$r9\n\ jsr $r9\n\ ; Pass our finalizer function to the user in R10.\n\ move.d [$r0+_dl_fini:GOT16],$r10\n\ ; Terminate the frame-pointer.\n\ moveq 0,$r8\n\ ; Cause SEGV if user entry returns.\n\ move $r8,$srp\n\ ; Jump to the user's entry point.\n\ jump $r1\n\ .size _dl_start_user, . - _dl_start_user\n\ .previous");
#define elf_machine_type_class(type)
#define ELF_MACHINE_JMP_SLOT   R_CRIS_JUMP_SLOT
#define ELF_MACHINE_NO_REL   1
#define DL_PLATFORM_INIT   dl_platform_init ()

Functions

static int elf_machine_matches_host (const Elf32_Ehdr *ehdr)
static Elf32_Addr elf_machine_dynamic (void)
static Elf32_Addr elf_machine_load_address (void)
static int elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
static void __attribute__ ((unused)) dl_platform_init(void)
static Elf32_Addr elf_machine_fixup_plt (struct link_map *map, lookup_t t, const Elf32_Rela *reloc, Elf32_Addr *reloc_addr, Elf32_Addr value)
static Elf32_Addr elf_machine_plt_value (struct link_map *map, const Elf32_Rela *reloc, Elf32_Addr value)

Define Documentation

#define CALL_FN (   x)    "jsr " #x

Definition at line 33 of file dl-machine.h.

#define DL_PLATFORM_INIT   dl_platform_init ()

Definition at line 252 of file dl-machine.h.

Definition at line 245 of file dl-machine.h.

#define ELF_MACHINE_NAME   "CRIS"

Definition at line 23 of file dl-machine.h.

#define ELF_MACHINE_NO_REL   1

Definition at line 248 of file dl-machine.h.

Value:
asm (TRAMPOLINE_TEMPLATE (_dl_runtime_resolve, fixup) \
     TRAMPOLINE_TEMPLATE (_dl_runtime_profile, profile_fixup));

Definition at line 155 of file dl-machine.h.

Value:

Definition at line 239 of file dl-machine.h.

#define ELF_MACHINE_USER_ADDRESS_MASK   0xf8000000UL

Definition at line 168 of file dl-machine.h.

#define RTLD_START   asm ("\ .text\n\ .globl _start\n\ .type _start,@function\n\_start:\n\ move.d $sp,$r10\n\ " CALL_FN (_dl_start) "\n\ /* FALLTHRU */\n\\n\ .globl _dl_start_user\n\ .type _dl_start_user,@function\n\_dl_start_user:\n\ ; Save the user entry point address in R1.\n\ move.d $r10,$r1\n\ ; Point R0 at the GOT.\n\ move.d $pc,$r0\n\ sub.d .:GOTOFF,$r0\n\ ; See if we were run as a command with the executable file\n\ ; name as an extra leading argument.\n\ move.d [$r0+_dl_skip_args:GOT16],$r13\n\ move.d [$r13],$r9\n\ ; Get the original argument count\n\ move.d [$sp],$r11\n\ ; Subtract _dl_skip_args from it.\n\ sub.d $r9,$r11\n\ ; Adjust the stack pointer to skip _dl_skip_args words.\n\ addi $r9.d,$sp\n\ ; Put the new argc in place as expected by the user entry.\n\ move.d $r11,[$sp]\n\ ; Call _dl_init (struct link_map *main_map, int argc, char **argv, char **env)\n\ ; env: skip scaled argc and skip stored argc and NULL at end of argv[].\n\ move.d $sp,$r13\n\ addi $r11.d,$r13\n\ addq 8,$r13\n\ ; argv: skip stored argc.\n\ move.d $sp,$r12\n\ addq 4,$r12\n\ ; main_map: at _dl_loaded.\n\ move.d [$r0+_rtld_local:GOT16],$r9\n\ move.d [$r9],$r10\n\ move.d _dl_init_internal:PLTG,$r9\n\ add.d $r0,$r9\n\ jsr $r9\n\ ; Pass our finalizer function to the user in R10.\n\ move.d [$r0+_dl_fini:GOT16],$r10\n\ ; Terminate the frame-pointer.\n\ moveq 0,$r8\n\ ; Cause SEGV if user entry returns.\n\ move $r8,$srp\n\ ; Jump to the user's entry point.\n\ jump $r1\n\ .size _dl_start_user, . - _dl_start_user\n\ .previous");

Definition at line 174 of file dl-machine.h.

#define TRAMPOLINE_TEMPLATE (   tramp_name,
  fixup_name 
)    "; Trampoline for " #fixup_name "\n\ .globl " #tramp_name "\n\ .type " #tramp_name ", @function\n\" #tramp_name ":\n\ push $r13\n\ push $r12\n\ push $r11\n\ push $r10\n\ push $r9\n\ push $srp\n\ move.d [$sp+6*4],$r11\n\ move $mof,$r10\n\ " CALL_FN (fixup_name) "\n\ move.d $r10,[$sp+6*4]\n\ pop $srp\n\ pop $r9\n\ pop $r10\n\ pop $r11\n\ pop $r12\n\ pop $r13\n\ jump [$sp+]\n\ .size " #tramp_name ", . - " #tramp_name "\n"

Definition at line 131 of file dl-machine.h.


Function Documentation

static void __attribute__ ( (unused)  ) [inline, static]

Definition at line 254 of file dl-machine.h.

{
  if (GL(dl_platform) != NULL && *GL(dl_platform) == '\0')
    /* Avoid an empty string which would disturb us.  */
    GL(dl_platform) = NULL;
}
static Elf32_Addr elf_machine_dynamic ( void  ) [inline, static]

Definition at line 49 of file dl-machine.h.

{
  /* Don't just set this to an asm variable "r0" since that's not logical
     (like, the variable is uninitialized and the register is fixed) and
     may make GCC trip over itself doing register allocation.  Yes, I'm
     paranoid.  Why do you ask?  */
  Elf32_Addr *got;

  __asm__ ("move.d $r0,%0" : "=rm" (got));
  return *got;
}

Here is the call graph for this function:

static Elf32_Addr elf_machine_fixup_plt ( struct link_map map,
lookup_t  t,
const Elf32_Rela reloc,
Elf32_Addr reloc_addr,
Elf32_Addr  value 
) [inline, static]

Definition at line 263 of file dl-machine.h.

{
  return *reloc_addr = value;
}

Here is the caller graph for this function:

static Elf32_Addr elf_machine_load_address ( void  ) [inline, static]

Definition at line 71 of file dl-machine.h.

{
  Elf32_Addr gotaddr_diff;
  __asm__ ("sub.d [$r0+_dl_start:GOT16],$r0,%0\n\t"
          "add.d _dl_start:GOTOFF,%0" : "=r" (gotaddr_diff));
  return gotaddr_diff;
}

Here is the call graph for this function:

static int elf_machine_matches_host ( const Elf32_Ehdr ehdr) [inline, static]

Definition at line 39 of file dl-machine.h.

{
  return ehdr->e_machine == EM_CRIS;
}

Here is the caller graph for this function:

static Elf32_Addr elf_machine_plt_value ( struct link_map map,
const Elf32_Rela reloc,
Elf32_Addr  value 
) [inline, static]

Definition at line 272 of file dl-machine.h.

{
  return value + reloc->r_addend;
}
static int elf_machine_runtime_setup ( struct link_map l,
int  lazy,
int  profile 
) [inline, static]

Definition at line 83 of file dl-machine.h.

{
  Elf32_Addr *got;
  extern void _dl_runtime_resolve (Elf32_Word);
  extern void _dl_runtime_profile (Elf32_Word);

  if (l->l_info[DT_JMPREL] && lazy)
    {
      /* The GOT entries for functions in the PLT have not yet been
        filled in.  Their initial contents will arrange when called
        to push an offset into the .rela.plt section, push
        _GLOBAL_OFFSET_TABLE_[1], and then jump to
        _GLOBAL_OFFSET_TABLE_[2].  */
      got = (Elf32_Addr *) D_PTR (l, l_info[DT_PLTGOT]);
      got[1] = (Elf32_Addr) l;     /* Identify this shared object.  */

      /* The got[2] entry contains the address of a function which gets
        called to get the address of a so far unresolved function and
        jump to it.  The profiling extension of the dynamic linker allows
        to intercept the calls to collect information.  In this case we
        don't store the address in the GOT so that all future calls also
        end in this function.  */
      if (__builtin_expect (profile, 0))
       {
         got[2] = (Elf32_Addr) &_dl_runtime_profile;

         if (_dl_name_match_p (GL(dl_profile), l))
           {
             /* This is the object we are looking for.  Say that we really
               want profiling and the timers are started.  */
             GL(dl_profile_map) = l;
           }
       }
      else
       /* This function will get called to fix up the GOT entry indicated by
          the offset on the stack, and then jump to the resolved address.  */
       got[2] = (Elf32_Addr) &_dl_runtime_resolve;
    }

  return lazy;
}

Here is the call graph for this function: