]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/uclibc/lib/contrib/uclibc/ldso/ldso/frv/dl-sysdep.h
update
[l4.git] / l4 / pkg / uclibc / lib / contrib / uclibc / ldso / ldso / frv / dl-sysdep.h
1 /* Copyright (C) 2003, 2004 Red Hat, Inc.
2  * Contributed by Alexandre Oliva <aoliva@redhat.com>
3  * Based on ../i386/dl-sysdep.h
4  *
5  * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
6  */
7
8 /*
9  * Various assembly language/system dependent  hacks that are required
10  * so that we can minimize the amount of platform specific code.
11  */
12
13 /*
14  * Define this if the system uses RELOCA.
15  */
16 #undef ELF_USES_RELOCA
17
18 /* JMPREL relocs are inside the DT_RELA table.  */
19 #define ELF_MACHINE_PLTREL_OVERLAP
20
21 #define DL_NO_COPY_RELOCS
22
23 /* Here we define the magic numbers that this dynamic loader should accept */
24 #define MAGIC1 EM_CYGNUS_FRV
25 #undef  MAGIC2
26
27 /* Used for error messages */
28 #define ELF_TARGET "FR-V"
29
30 /* Need bootstrap relocations */
31 #define ARCH_NEEDS_BOOTSTRAP_RELOCS
32
33 extern int _dl_linux_resolve(void) __attribute__((__visibility__("hidden")));
34
35 /* We must force strings used early in the bootstrap into the data
36    segment, such that they are referenced with GOTOFF instead of
37    GPREL, because GPREL needs the GOT to have already been
38    relocated.  */
39 #undef SEND_EARLY_STDERR
40 #define SEND_EARLY_STDERR(S) \
41   do { static char __s[] = (S); SEND_STDERR (__s); } while (0)
42
43 #define DL_RELOC_ADDR(ADDR, LOADADDR) \
44   (__reloc_pointer ((void*)(ADDR), (LOADADDR).map))
45
46 /* Make sure we only load libraries that use the same number of
47    general-purpose and floating-point registers the dynamic loader was
48    compiled for.  */
49 #define DL_CHECK_REG_COUNT(flags) \
50   (((flags & EF_FRV_GPR_MASK) == EF_FRV_GPR_32 ? __FRV_GPR__ == 32 : 1) \
51    && ((flags & EF_FRV_GPR_MASK) == EF_FRV_GPR_64 ? __FRV_GPR__ == 64 : 1) \
52    && ((flags & EF_FRV_FPR_MASK) == EF_FRV_FPR_32 ? __FRV_FPR__ == 32 : 1) \
53    && ((flags & EF_FRV_FPR_MASK) == EF_FRV_FPR_64 ? __FRV_FPR__ == 64 : 1) \
54    && ((flags & EF_FRV_FPR_MASK) == EF_FRV_FPR_NONE ? __FRV_FPR__ == 0 : 1))
55
56 /* We only support loading FDPIC independently-relocatable shared
57    libraries.  It probably wouldn't be too hard to support loading
58    shared libraries that require relocation by the same amount, but we
59    don't know that they exist or would be useful, and the dynamic
60    loader code could leak the whole-library map unless we keeping a
61    bit more state for DL_LOADADDR_UNMAP and DL_LIB_UNMAP, so let's
62    keep things simple for now.  */
63 #define DL_CHECK_LIB_TYPE(epnt, piclib, _dl_progname, libname) \
64 do \
65 { \
66   if (((epnt)->e_flags & EF_FRV_FDPIC) && ! ((epnt)->e_flags & EF_FRV_PIC)) \
67     (piclib) = 2; \
68   else \
69     { \
70       _dl_internal_error_number = LD_ERROR_NOTDYN; \
71       _dl_dprintf(2, "%s: '%s' is not an FDPIC shared library" \
72                   "\n", (_dl_progname), (libname)); \
73       _dl_close(infile); \
74       return NULL; \
75     } \
76 \
77   if (! DL_CHECK_REG_COUNT ((epnt)->e_flags)) \
78     { \
79       _dl_internal_error_number = LD_ERROR_NOTDYN; \
80       _dl_dprintf(2, "%s: '%s' assumes different register counts" \
81                   "\n", (_dl_progname), (libname)); \
82       _dl_close(infile); \
83     } \
84 } \
85 while (0)
86
87 #include "../fdpic/dl-sysdep.h"