diff options
Diffstat (limited to 'libexec/rtld-aout/i386/md.c')
-rw-r--r-- | libexec/rtld-aout/i386/md.c | 65 |
1 files changed, 38 insertions, 27 deletions
diff --git a/libexec/rtld-aout/i386/md.c b/libexec/rtld-aout/i386/md.c index f78c6cc..311a5f6 100644 --- a/libexec/rtld-aout/i386/md.c +++ b/libexec/rtld-aout/i386/md.c @@ -27,7 +27,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: md.c,v 1.7 1994/01/03 18:35:35 davidg Exp $ + * $Id: md.c,v 1.8 1994/01/19 15:00:37 davidg Exp $ */ #include <sys/param.h> @@ -41,8 +41,6 @@ #include "ld.h" -int netzmagic = 0; - /* * Get relocation addend corresponding to relocation record RP * from address ADDR @@ -90,29 +88,6 @@ unsigned char *addr; } /* - * Initialize (output) exec header such that useful values are - * obtained from subsequent N_*() macro evaluations. - */ -void -md_init_header(hp, magic, flags) -struct exec *hp; -int magic, flags; -{ - if (!netzmagic && (magic == ZMAGIC)) { - hp->a_midmag = magic; - } else { - if (netzmagic) - N_SETMAGIC_NET((*hp), magic, MID_I386, flags); - else - N_SETMAGIC((*hp), magic, MID_I386, flags); - } - - /* TEXT_START depends on the value of outheader.a_entry. */ - if (!(link_mode & SHAREABLE)) /*WAS: if (entry_symbol) */ - hp->a_entry = PAGSIZ; -} - -/* * Machine dependent part of claim_rrs_reloc(). * Set RRS relocation type. */ @@ -251,9 +226,45 @@ long *savep; *(char *)where = TRAP; } -#ifdef NEED_SWAP +#ifndef RTLD + +#ifdef FreeBSD +int netzmagic; +#endif /* + * Initialize (output) exec header such that useful values are + * obtained from subsequent N_*() macro evaluations. + */ +void +md_init_header(hp, magic, flags) +struct exec *hp; +int magic, flags; +{ +#ifdef NetBSD + if (oldmagic || magic == QMAGIC) + hp->a_midmag = magic; + else + N_SETMAGIC((*hp), magic, MID_I386, flags); +#endif +#ifdef FreeBSD + if (oldmagic) + hp->a_midmag = magic; + else if (netzmagic) + N_SETMAGIC_NET((*hp), magic, MID_I386, flags); + else + N_SETMAGIC((*hp), magic, MID_I386, flags); +#endif + + /* TEXT_START depends on the value of outheader.a_entry. */ + if (!(link_mode & SHAREABLE)) /*WAS: if (entry_symbol) */ + hp->a_entry = PAGSIZ; +} +#endif /* RTLD */ + + +#ifdef NEED_SWAP +/* * Byte swap routines for cross-linking. */ |