summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1995-07-18 20:42:33 +0000
committerRichard M. Stallman <rms@gnu.org>1995-07-18 20:42:33 +0000
commitd84b439a2e5f1b2312a6ff468552cab2f6628bc9 (patch)
tree8c1fb0f427a63078f9ef0d1d6788c1b60e16d9d5
parent165cdd11142edcd56ec9ee2ed4ac311776b7c3ea (diff)
downloademacs-d84b439a2e5f1b2312a6ff468552cab2f6628bc9.tar.gz
(unexec): If not SUNOS4_SHARED_LIBRARIES
or if apparently not dynamically linked, just clear rel and erel.
-rw-r--r--src/unexsunos4.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/unexsunos4.c b/src/unexsunos4.c
index 7b97d077fe0..6bd09900aa7 100644
--- a/src/unexsunos4.c
+++ b/src/unexsunos4.c
@@ -215,10 +215,14 @@ unexec (new_name, a_name, bndry, bss_start, entry)
unsigned long daddr = N_DATADDR (ohdr);
unsigned long rel, erel;
#ifdef SUNOS4
+#ifdef SUNOS4_SHARED_LIBRARIES
extern struct link_dynamic _DYNAMIC;
/* SunOS4.x's ld_rel is relative to N_TXTADDR. */
- if (_DYNAMIC.ld_version < 2)
+ if (!ohdr.a_dynamic)
+ /* This was statically linked. */
+ rel = erel = 0;
+ else if (_DYNAMIC.ld_version < 2)
{
rel = _DYNAMIC.ld_un.ld_1->ld_rel + N_TXTADDR (ohdr);
erel = _DYNAMIC.ld_un.ld_1->ld_hash + N_TXTADDR (ohdr);
@@ -228,6 +232,9 @@ unexec (new_name, a_name, bndry, bss_start, entry)
rel = _DYNAMIC.ld_un.ld_2->ld_rel + N_TXTADDR (ohdr);
erel = _DYNAMIC.ld_un.ld_2->ld_hash + N_TXTADDR (ohdr);
}
+#else /* not SUNOS4_SHARED_LIBRARIES */
+ rel = erel = 0;
+#endif /* not SUNOS4_SHARED_LIBRARIES */
#ifdef sparc
#define REL_INFO_TYPE struct reloc_info_sparc
#else