OSDN Git Service

- trim any trailing whitespace
[uclinux-h8/uClibc.git] / ldso / ldso / frv / dl-sysdep.h
index d425b5c..32d86ed 100644 (file)
@@ -1,23 +1,9 @@
-     /* Copyright (C) 2003, 2004 Red Hat, Inc.
-       Contributed by Alexandre Oliva <aoliva@redhat.com>
-       Based on ../i386/dl-sysdep.h
-
-This file is part of uClibc.
-
-uClibc is free software; you can redistribute it and/or modify it
-under the terms of the GNU Lesser General Public License as
-published by the Free Software Foundation; either version 2.1 of the
-License, or (at your option) any later version.
-
-uClibc is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with uClibc; see the file COPYING.LIB.  If not, write to
-the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
-USA.  */
+/* Copyright (C) 2003, 2004 Red Hat, Inc.
+ * Contributed by Alexandre Oliva <aoliva@redhat.com>
+ * Based on ../i386/dl-sysdep.h
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
 
 /*
  * Various assembly language/system dependent  hacks that are required
@@ -65,8 +51,6 @@ struct funcdesc_value
 
 extern int _dl_linux_resolve(void) __attribute__((__visibility__("hidden")));
 
-#define do_rem(result, n, base)  result = (n % base)
-
 /* 16KiB page alignment.  Should perhaps be made dynamic using
    getpagesize(), based on AT_PAGESZ from auxvt?  */
 #define PAGE_ALIGN 0xffffc000
@@ -92,7 +76,7 @@ struct funcdesc_ht;
   ((void(*)(void)) _dl_funcdesc_for ((void*)(ADDR), (LOADADDR).got_value))
 
 #define _dl_stabilize_funcdesc(val) \
-  ({ asm ("" : "+m" (*(val))); (val); })
+  ({ __asm__ ("" : "+m" (*(val))); (val); })
 
 #define DL_CALL_FUNC_AT_ADDR(ADDR, LOADADDR, SIGNATURE, ...) \
   ({ struct funcdesc_value fd = { (void*)(ADDR), (LOADADDR).got_value }; \
@@ -129,6 +113,16 @@ struct funcdesc_ht;
 #define DL_ADDR_IN_LOADADDR(ADDR, TPNT, TFROM) \
   (! (TFROM) && __dl_addr_in_loadaddr ((void*)(ADDR), (TPNT)->loadaddr))
 
+/* Make sure we only load libraries that use the same number of
+   general-purpose and floating-point registers the dynamic loader was
+   compiled for.  */
+#define DL_CHECK_REG_COUNT(flags) \
+  (((flags & EF_FRV_GPR_MASK) == EF_FRV_GPR_32 ? __FRV_GPR__ == 32 : 1) \
+   && ((flags & EF_FRV_GPR_MASK) == EF_FRV_GPR_64 ? __FRV_GPR__ == 64 : 1) \
+   && ((flags & EF_FRV_FPR_MASK) == EF_FRV_FPR_32 ? __FRV_FPR__ == 32 : 1) \
+   && ((flags & EF_FRV_FPR_MASK) == EF_FRV_FPR_64 ? __FRV_FPR__ == 64 : 1) \
+   && ((flags & EF_FRV_FPR_MASK) == EF_FRV_FPR_NONE ? __FRV_FPR__ == 0 : 1))
+
 /* We only support loading FDPIC independently-relocatable shared
    libraries.  It probably wouldn't be too hard to support loading
    shared libraries that require relocation by the same amount, but we
@@ -149,8 +143,16 @@ do \
       _dl_close(infile); \
       return NULL; \
     } \
+\
+  if (! DL_CHECK_REG_COUNT ((epnt)->e_flags)) \
+    { \
+      _dl_internal_error_number = LD_ERROR_NOTDYN; \
+      _dl_dprintf(2, "%s: '%s' assumes different register counts" \
+                 "\n", (_dl_progname), (libname)); \
+      _dl_close(infile); \
+    } \
 } \
-while (0)  
+while (0)
 
 /* We want want to apply all relocations in the interpreter during
    bootstrap.  Because of this, we have to skip the interpreter
@@ -172,6 +174,14 @@ while (0)
                       (TPNT)->loadaddr.got_value)                           \
    : DL_RELOC_ADDR ((SYM)->st_value, (TPNT)->loadaddr))
 
+#define DL_GET_READY_TO_RUN_EXTRA_PARMS \
+  , struct elf32_fdpic_loadmap *dl_boot_progmap
+#define DL_GET_READY_TO_RUN_EXTRA_ARGS \
+  , dl_boot_progmap
+
+
+
+
 #ifdef __USE_GNU
 # include <link.h>
 #else