OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [uClibc/] [ldso/] [ldso/] [sparc/] [ld_sysdep.h] - Blame information for rev 1771

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1325 phoenix
 
2
/*
3
 * Various assmbly language/system dependent  hacks that are required
4
 * so that we can minimize the amount of platform specific code.
5
 */
6
#define LINUXBIN
7
 
8
/*
9
 * Define this if the system uses RELOCA.
10
 */
11
#define ELF_USES_RELOCA
12
 
13
/*
14
 * Get a pointer to the argv array.  On many platforms this can be just
15
 * the address if the first argument, on other platforms we need to
16
 * do something a little more subtle here.  We assume that argc is stored
17
 * at the word just below the argvp that we return here.
18
 */
19
#define GET_ARGV(ARGVP, ARGS) __asm__("\tadd %%fp,68,%0\n" : "=r" (ARGVP));
20
 
21
/*
22
 * Initialization sequence for a GOT.  For the Sparc, this points to the
23
 * PLT, and we need to initialize a couple of the slots.  The PLT should
24
 * look like:
25
 *
26
 *              save %sp, -64, %sp
27
 *              call _dl_linux_resolve
28
 *              nop
29
 *              .word implementation_dependent
30
 */
31
#define INIT_GOT(GOT_BASE,MODULE) \
32
{                               \
33
   GOT_BASE[0] = 0x9de3bfc0;  /* save %sp, -64, %sp */   \
34
   GOT_BASE[1] = 0x40000000 | (((unsigned int) _dl_linux_resolve - (unsigned int) GOT_BASE - 4) >> 2);  \
35
   GOT_BASE[2] = 0x01000000; /* nop */                  \
36
   GOT_BASE[3] = (int) MODULE;                                  \
37
}
38
 
39
/*
40
 * Here is a macro to perform a relocation.  This is only used when
41
 * bootstrapping the dynamic loader.
42
 */
43
#define PERFORM_BOOTSTRAP_RELOC(RELP,REL,SYMBOL,LOAD,SYMTAB) \
44
        switch(ELF32_R_TYPE((RELP)->r_info)) {          \
45
        case R_SPARC_32:                                \
46
          *REL = SYMBOL + (RELP)->r_addend;             \
47
          break;                                        \
48
        case R_SPARC_GLOB_DAT:                          \
49
          *REL = SYMBOL + (RELP)->r_addend;             \
50
          break;                                        \
51
        case R_SPARC_JMP_SLOT:                          \
52
          REL[1] = 0x03000000 | ((SYMBOL >> 10) & 0x3fffff);    \
53
          REL[2] = 0x81c06000 | (SYMBOL & 0x3ff);       \
54
          break;                                        \
55
        case R_SPARC_NONE:                              \
56
          break;                                        \
57
        case R_SPARC_WDISP30:                           \
58
          break;                                        \
59
        case R_SPARC_RELATIVE:                          \
60
          *REL += (unsigned int) LOAD + (RELP)->r_addend; \
61
          break;                                        \
62
        default:                                        \
63
          _dl_exit(1);                                  \
64
        }
65
 
66
 
67
/*
68
 * Transfer control to the user's application, once the dynamic loader
69
 * is done.  The crt calls atexit with $g1 if not null, so we need to
70
 * ensure that it contains NULL.
71
 */
72
 
73
#define START()         \
74
        __asm__ volatile ( \
75
                           "add %%g0,%%g0,%%g1\n\t" \
76
                           "jmpl %0, %%o7\n\t"  \
77
                           "restore %%g0,%%g0,%%g0\n\t" \
78
                        : /*"=r" (status) */ :  \
79
                          "r" (_dl_elf_main): "g1", "o0", "o1")
80
 
81
 
82
 
83
/* Here we define the magic numbers that this dynamic loader should accept */
84
 
85
#define MAGIC1 EM_SPARC
86
#undef  MAGIC2
87
/* Used for error messages */
88
#define ELF_TARGET "Sparc"
89
 
90
#ifndef COMPILE_ASM
91
extern unsigned int _dl_linux_resolver(unsigned int reloc_entry,
92
                                        unsigned int * i);
93
#endif
94
 
95
/*
96
 * Define this if you want a dynamic loader that works on Solaris.
97
 */
98
#define SOLARIS_COMPATIBLE
99
 
100
#define do_rem(result, n, base)     result = (n % base)
101
 
102
/*
103
 * dbx wants the binder to have a specific name.  Mustn't disappoint it.
104
 */
105
#ifdef SOLARIS_COMPATIBLE
106
#define _dl_linux_resolve _elf_rtbndr
107
#endif
108
 
109
/* 4096 bytes alignment */
110
#define PAGE_ALIGN 0xfffff000
111
#define ADDR_ALIGN 0xfff
112
#define OFFS_ALIGN 0x7ffff000

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.