summaryrefslogtreecommitdiff
path: root/elf/check-textrel.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-12-22 20:10:10 +0000
committerUlrich Drepper <drepper@redhat.com>2004-12-22 20:10:10 +0000
commita334319f6530564d22e775935d9c91663623a1b4 (patch)
treeb5877475619e4c938e98757d518bb1e9cbead751 /elf/check-textrel.c
parent0ecb606cb6cf65de1d9fc8a919bceb4be476c602 (diff)
(CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.
Diffstat (limited to 'elf/check-textrel.c')
-rw-r--r--elf/check-textrel.c26
1 files changed, 5 insertions, 21 deletions
diff --git a/elf/check-textrel.c b/elf/check-textrel.c
index 1a9a5ecdff..ec97e4b0c9 100644
--- a/elf/check-textrel.c
+++ b/elf/check-textrel.c
@@ -1,5 +1,5 @@
/* Check for text relocations in DSOs.
- Copyright (C) 2002, 2003, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contribute by Ulrich Drepper <drepper@redhat.com>. 2002.
@@ -79,36 +79,20 @@ AB(handle_file) (const char *fname, int fd)
/* Search for the PT_DYNAMIC entry. */
size_t cnt;
- E(Phdr) *dynphdr = NULL;
for (cnt = 0; cnt < phnum; ++cnt)
if (SWAP (phdr[cnt].p_type) == PT_DYNAMIC)
- dynphdr = &phdr[cnt];
- else if (SWAP (phdr[cnt].p_type) == PT_LOAD
- && (SWAP (phdr[cnt].p_flags) & (PF_X | PF_W)) == (PF_X | PF_W))
- {
- printf ("%s: segment %zu is executable and writable\n",
- fname, cnt);
-#if !defined __sparc__ \
- && !defined __alpha__ \
- && (!defined __powerpc__ || defined __powerpc64__ || defined HAVE_PPC_SECURE_PLT)
- /* sparc, sparc64, alpha and powerpc32 (the last one only when using
- -mbss-plt) are expected to have PF_X | PF_W segment containing .plt
- section, it is part of their ABI. It is bad security wise, nevertheless
- this test shouldn't fail because of this. */
- return 1;
-#endif
- }
+ break;
- if (dynphdr == NULL)
+ if (cnt == phnum)
{
printf ("%s: no DYNAMIC segment found\n", fname);
return 1;
}
/* Read the dynamic segment. */
- size_t pmemsz = SWAP(dynphdr->p_memsz);
+ size_t pmemsz = SWAP(phdr[cnt].p_memsz);
E(Dyn) *dyn = alloca (pmemsz);
- if (pread (fd, dyn, pmemsz, SWAP(dynphdr->p_offset)) != pmemsz)
+ if (pread (fd, dyn, pmemsz, SWAP(phdr[cnt].p_offset)) != pmemsz)
goto read_error;
/* Search for an DT_TEXTREL entry of DT_FLAGS with the DF_TEXTREL