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

Subversion Repositories or1k

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1325 phoenix
/* CRIS can never use Elf32_Rel relocations. */
2
#define ELF_USES_RELOCA
3
 
4
/*
5
 * Get a pointer to the argv array.  On many platforms this can be just
6
 * the address if the first argument, on other platforms we need to
7
 * do something a little more subtle here.
8
 */
9
#define GET_ARGV(ARGVP, ARGS) ARGVP = ((unsigned long *) ARGS)
10
 
11
/*
12
 * Initialization sequence for a GOT.
13
 */
14
#define INIT_GOT(GOT_BASE,MODULE)                               \
15
{                                                               \
16
        GOT_BASE[1] = (unsigned long) MODULE;                   \
17
        GOT_BASE[2] = (unsigned long) _dl_linux_resolve;        \
18
}
19
 
20
/*
21
 * Here is a macro to perform a relocation.  This is only used when
22
 * bootstrapping the dynamic loader.  RELP is the relocation that we
23
 * are performing, REL is the pointer to the address we are relocating.
24
 * SYMBOL is the symbol involved in the relocation, and LOAD is the
25
 * load address.
26
 */
27
#define PERFORM_BOOTSTRAP_RELOC(RELP, REL, SYMBOL, LOAD, SYMTAB)        \
28
        switch (ELF32_R_TYPE((RELP)->r_info)) {                         \
29
                case R_CRIS_GLOB_DAT:                                   \
30
                case R_CRIS_JUMP_SLOT:                                  \
31
                case R_CRIS_32:                                         \
32
                        *REL = SYMBOL;                                  \
33
                        break;                                          \
34
                case R_CRIS_16_PCREL:                                   \
35
                        *(short *) *REL = SYMBOL + (RELP)->r_addend - *REL - 2; \
36
                        break;                                          \
37
                case R_CRIS_32_PCREL:                                   \
38
                        *REL = SYMBOL + (RELP)->r_addend - *REL - 4;    \
39
                        break;                                          \
40
                case R_CRIS_NONE:                                       \
41
                        break;                                          \
42
                case R_CRIS_RELATIVE:                                   \
43
                        *REL = (unsigned long) LOAD + (RELP)->r_addend; \
44
                        break;                                          \
45
                default:                                                \
46
                        _dl_exit(1);                                    \
47
                        break;                                          \
48
        }
49
 
50
/*
51
 * Transfer control to the user's application once the dynamic loader
52
 * is done. This routine has to exit the current function, then call
53
 * _dl_elf_main.
54
 */
55
#define START() __asm__ volatile ("moveq 0,$r8\n\t" \
56
                                  "move $r8,$srp\n\t" \
57
                                  "move.d %1,$sp\n\t" \
58
                                  "jump %0\n\t" \
59
                                  : : "r" (_dl_elf_main), "r" (args))
60
 
61
/* Defined some magic numbers that this ld.so should accept. */
62
#define MAGIC1 EM_CRIS
63
#undef MAGIC2
64
#define ELF_TARGET "CRIS"
65
 
66
struct elf_resolve;
67
extern unsigned long _dl_linux_resolver(struct elf_resolve *tpnt, int reloc_entry);
68
 
69
/* Cheap modulo implementation, taken from arm/ld_sysdep.h. */
70
static inline unsigned long
71
cris_mod(unsigned long m, unsigned long p)
72
{
73
        unsigned long i, t, inc;
74
 
75
        i = p;
76
        t = 0;
77
 
78
        while (!(i & (1 << 31))) {
79
                i <<= 1;
80
                t++;
81
        }
82
 
83
        t--;
84
 
85
        for (inc = t; inc > 2; inc--) {
86
                i = p << inc;
87
 
88
                if (i & (1 << 31))
89
                        break;
90
 
91
                while (m >= i) {
92
                        m -= i;
93
                        i <<= 1;
94
                        if (i & (1 << 31))
95
                                break;
96
                        if (i < p)
97
                                break;
98
                }
99
        }
100
 
101
        while (m >= p)
102
                m -= p;
103
 
104
        return m;
105
}
106
 
107
#define do_rem(result, n, base) result = cris_mod(n, base);
108
 
109
/* 8192 bytes alignment */
110
#define PAGE_ALIGN 0xffffe000
111
#define ADDR_ALIGN 0x1fff
112
#define OFFS_ALIGN 0xffffe000

powered by: WebSVN 2.1.0

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