[Glibc-bsd-commits] r3260 - trunk/glibc-ports/kfreebsd

Aurelien Jarno aurel32 at alioth.debian.org
Tue Feb 8 20:45:52 UTC 2011


Author: aurel32
Date: 2011-02-08 20:45:51 +0000 (Tue, 08 Feb 2011)
New Revision: 3260

Removed:
   trunk/glibc-ports/kfreebsd/dl-machine.h
Modified:
   trunk/glibc-ports/kfreebsd/ldsodefs.h
Log:
Move ELF header validation to ldsodefs.h, similarly to what has been 
done upstream. Also fix bug introduced in r3207, which prevent compiling
dl-load.c.


Deleted: trunk/glibc-ports/kfreebsd/dl-machine.h
===================================================================
--- trunk/glibc-ports/kfreebsd/dl-machine.h	2011-02-08 20:44:07 UTC (rev 3259)
+++ trunk/glibc-ports/kfreebsd/dl-machine.h	2011-02-08 20:45:51 UTC (rev 3260)
@@ -1,32 +0,0 @@
-/* Dynamic linker magic for glibc on FreeBSD kernel.
-   Copyright (C) 2006, 2010 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Aurelien Jarno <aurelien at aurel32.net>, 2006.
-
-   The GNU C Library 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.
-
-   The GNU C Library 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
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include_next <dl-machine.h>
-
-/* Contrary to most kernels which use ELFOSABI_SYSV aka ELFOSABI_NONE,
-   FreeBSD uses ELFOSABI_FREEBSD for the OSABI field. */
-
-#undef VALID_ELF_OSABI
-#define VALID_ELF_OSABI(osabi)		(osabi == ELFOSABI_FREEBSD)
-#undef VALID_ELF_HEADER
-#define VALID_ELF_HEADER(hdr,exp,size) \
-  memcmp (hdr,exp,size-2) == 0 \
-  && VALID_ELF_OSABI (hdr[EI_OSABI]) \
-  && VALID_ELF_ABIVERSION (hdr[EI_ABIVERSION])

Modified: trunk/glibc-ports/kfreebsd/ldsodefs.h
===================================================================
--- trunk/glibc-ports/kfreebsd/ldsodefs.h	2011-02-08 20:44:07 UTC (rev 3259)
+++ trunk/glibc-ports/kfreebsd/ldsodefs.h	2011-02-08 20:45:51 UTC (rev 3260)
@@ -36,4 +36,23 @@
 /* Initialization which is normally done by the dynamic linker.  */
 extern void _dl_non_dynamic_init (void) internal_function;
 
+/* Contrary to most kernels which use ELFOSABI_SYSV aka ELFOSABI_NONE,
+   FreeBSD uses ELFOSABI_FREEBSD for the OSABI field. */
+#define VALID_ELF_HEADER(hdr,exp,size)	(memcmp (hdr, expected2, size) == 0)
+#define VALID_ELF_OSABI(osabi)		(osabi == ELFOSABI_FREEBSD)
+#define VALID_ELF_ABIVERSION(osabi,ver) (ver == 0)
+#define MORE_ELF_HEADER_DATA \
+  static const unsigned char expected2[EI_PAD] =	\
+  {							\
+    [EI_MAG0] = ELFMAG0,				\
+    [EI_MAG1] = ELFMAG1,				\
+    [EI_MAG2] = ELFMAG2,				\
+    [EI_MAG3] = ELFMAG3,				\
+    [EI_CLASS] = ELFW(CLASS),				\
+    [EI_DATA] = byteorder,				\
+    [EI_VERSION] = EV_CURRENT,				\
+    [EI_OSABI] = ELFOSABI_FREEBSD			\
+    [EI_ABIVERSION] = 0					\
+  }
+
 #endif /* ldsodefs.h */




More information about the Glibc-bsd-commits mailing list