summaryrefslogtreecommitdiff
path: root/bfd/simple.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl@lucon.org>2007-07-10 13:49:04 +0000
committerH.J. Lu <hjl@lucon.org>2007-07-10 13:49:04 +0000
commit338f1a3e5d0a45a1de243a522887496b3501c00f (patch)
tree9faabdb08f1a53e2e3854d8e404e4067b389ca71 /bfd/simple.c
parent80be57221a7c48ad5a5a48abecb9c9730cdf6cb2 (diff)
downloadgdb-338f1a3e5d0a45a1de243a522887496b3501c00f.tar.gz
2007-07-10 H.J. Lu <hongjiu.lu@intel.com>
PR binutils/4756 * simple.c (bfd_simple_get_relocated_section_content): Don't apply relocation on executable and shared library.
Diffstat (limited to 'bfd/simple.c')
-rw-r--r--bfd/simple.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/bfd/simple.c b/bfd/simple.c
index 452486834ab..1b92a05791c 100644
--- a/bfd/simple.c
+++ b/bfd/simple.c
@@ -162,7 +162,10 @@ bfd_simple_get_relocated_section_contents (bfd *abfd,
int storage_needed;
void *saved_offsets;
- if (! (sec->flags & SEC_RELOC))
+ /* Don't apply relocation on executable and shared library. See
+ PR 4756. */
+ if ((abfd->flags & (HAS_RELOC | EXEC_P | DYNAMIC)) != HAS_RELOC
+ || ! (sec->flags & SEC_RELOC))
{
bfd_size_type amt = sec->rawsize > sec->size ? sec->rawsize : sec->size;
bfd_size_type size = sec->rawsize ? sec->rawsize : sec->size;