about summary refs log tree commit diff
path: root/elf/check-textrel.c
diff options
context:
space:
mode:
Diffstat (limited to 'elf/check-textrel.c')
-rw-r--r--elf/check-textrel.c30
1 files changed, 26 insertions, 4 deletions
diff --git a/elf/check-textrel.c b/elf/check-textrel.c
index 43e0206ab8..c0592a2336 100644
--- a/elf/check-textrel.c
+++ b/elf/check-textrel.c
@@ -1,3 +1,23 @@
+/* Check for text relocations in DSOs.
+   Copyright (C) 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contribute by Ulrich Drepper <drepper@redhat.com>. 2002.
+
+   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 <byteswap.h>
 #include <elf.h>
 #include <endian.h>
@@ -77,13 +97,15 @@ AB(handle_file) (const char *fname, int fd)
      bit set.  */
   for (cnt = 0; (cnt + 1) * sizeof (E(Dyn)) - 1 < pmemsz; ++cnt)
     {
-      if (dyn[cnt].d_tag == DT_NULL)
+      unsigned int tag = SWAP (dyn[cnt].d_tag);
+
+      if (tag == DT_NULL)
 	/* We reached the end.  */
 	break;
 
-      if (dyn[cnt].d_tag == DT_TEXTREL
-	  || (dyn[cnt].d_tag == DT_FLAGS
-	      && (dyn[cnt].d_un.d_val & DF_TEXTREL) != 0))
+      if (tag == DT_TEXTREL
+	  || (tag == DT_FLAGS
+	      && (SWAP (dyn[cnt].d_un.d_val) & DF_TEXTREL) != 0))
 	{
 	  /* Urgh!  The DSO has text relocations.  */
 	  printf ("%s: text relocations used\n", fname);