Like others, allow for SunOS .o files.

This commit is contained in:
pk 1994-01-28 21:02:21 +00:00
parent 89583c18ac
commit bc9bb1a343
6 changed files with 222 additions and 162 deletions

View File

@ -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.6 1993/12/08 10:29:02 pk Exp $
* $Id: md.c,v 1.7 1994/01/28 21:02:21 pk Exp $
*/
#include <sys/param.h>
@ -167,33 +167,6 @@ int relocatable_output;
}
}
/*
* 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
N_SETMAGIC((*hp), magic, MID_MACHINE, flags);
/* TEXT_START depends on the value of outheader.a_entry. */
if (!(link_mode & SHAREABLE)) /*WAS: if (entry_symbol) */
hp->a_entry = PAGSIZ;
#else
hp->a_magic = magic;
hp->a_machtype = M_SPARC;
hp->a_toolversion = 1;
hp->a_dynamic = ((flags) & EX_DYNAMIC);
/* SunOS 4.1 N_TXTADDR depends on the value of outheader.a_entry. */
if (!(link_mode & SHAREABLE)) /*WAS: if (entry_symbol) */
hp->a_entry = N_PAGSIZ(*hp);
#endif
}
/*
* Machine dependent part of claim_rrs_reloc().
* On the Sparc the relocation offsets are stored in the r_addend member.
@ -327,3 +300,46 @@ long *savep;
*(long *)where = TRAP;
}
#ifndef RTLD
/*
* 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
N_SETMAGIC((*hp), magic, MID_MACHINE, flags);
/* TEXT_START depends on the value of outheader.a_entry. */
if (!(link_mode & SHAREABLE)) /*WAS: if (entry_symbol) */
hp->a_entry = PAGSIZ;
#else
hp->a_magic = magic;
hp->a_machtype = M_SPARC;
hp->a_toolversion = 1;
hp->a_dynamic = ((flags) & EX_DYNAMIC);
/* SunOS 4.1 N_TXTADDR depends on the value of outheader.a_entry. */
if (!(link_mode & SHAREABLE)) /*WAS: if (entry_symbol) */
hp->a_entry = N_PAGSIZ(*hp);
#endif
}
/*
* Check for acceptable foreign machine Ids
*/
int
md_midcompat(hp)
struct exec *hp;
{
#ifdef NetBSD
#define SUN_M_SPARC 3
return (((md_swap_long(hp->a_midmag)&0x00ff0000) >> 16) == SUN_M_SPARC);
#else
return hp->a_machtype == M_SPARC;
#endif
}
#endif /* RTLD */

View File

@ -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.h,v 1.6 1993/12/08 10:29:04 pk Exp $
* $Id: md.h,v 1.7 1994/01/28 21:04:18 pk Exp $
*/
/*
@ -60,6 +60,10 @@
#define r_symbolnum r_index
#endif /* NetBSD */
#define N_BADMID(ex) \
(N_GETMID(ex) != 0 && N_GETMID(ex) != MID_MACHINE && \
!md_midcompat(&(ex)))
/* Sparc (Sun 4) macros */
#define RELOC_ADDRESS(r) ((r)->r_address)
#define RELOC_EXTERN_P(r) ((r)->r_extern)
@ -139,16 +143,16 @@ typedef struct jmpslot {
#define md_swapout_zsymbols(s,n)
#define md_swapin_reloc(r,n)
#define md_swapout_reloc(r,n)
#define md_swapin_link_dynamic(l)
#define md_swapout_link_dynamic(l)
#define md_swapin_link_dynamic_2(l)
#define md_swapout_link_dynamic_2(l)
#define md_swapin_ld_debug(d)
#define md_swapout_ld_debug(d)
#define md_swapin__dynamic(l)
#define md_swapout__dynamic(l)
#define md_swapin_section_dispatch_table(l)
#define md_swapout_section_dispatch_table(l)
#define md_swapin_so_debug(d)
#define md_swapout_so_debug(d)
#define md_swapin_rrs_hash(f,n)
#define md_swapout_rrs_hash(f,n)
#define md_swapin_link_object(l,n)
#define md_swapout_link_object(l,n)
#define md_swapin_sod(l,n)
#define md_swapout_sod(l,n)
#define md_swapout_jmpslot(j,n)
#define md_swapout_got(g,n)
#define md_swapin_ranlib_hdr(h,n)
@ -168,23 +172,23 @@ void md_swapin_reloc __P((struct relocation_info *, int));
void md_swapout_reloc __P((struct relocation_info *, int));
void md_swapout_jmpslot __P((jmpslot_t *, int));
#define md_swapin_symbols(s,n) swap_symbols(s,n)
#define md_swapout_symbols(s,n) swap_symbols(s,n)
#define md_swapin_zsymbols(s,n) swap_zsymbols(s,n)
#define md_swapout_zsymbols(s,n) swap_zsymbols(s,n)
#define md_swapin_link_dynamic(l) swap_link_dynamic(l)
#define md_swapout_link_dynamic(l) swap_link_dynamic(l)
#define md_swapin_link_dynamic_2(l) swap_link_dynamic_2(l)
#define md_swapout_link_dynamic_2(l) swap_link_dynamic_2(l)
#define md_swapin_ld_debug(d) swap_ld_debug(d)
#define md_swapout_ld_debug(d) swap_ld_debug(d)
#define md_swapin_rrs_hash(f,n) swap_rrs_hash(f,n)
#define md_swapout_rrs_hash(f,n) swap_rrs_hash(f,n)
#define md_swapin_link_object(l,n) swapin_link_object(l,n)
#define md_swapout_link_object(l,n) swapout_link_object(l,n)
#define md_swapout_got(g,n) swap_longs((long*)(g),n)
#define md_swapin_ranlib_hdr(h,n) swap_ranlib_hdr(h,n)
#define md_swapout_ranlib_hdr(h,n) swap_ranlib_hdr(h,n)
#define md_swapin_symbols(s,n) swap_symbols(s,n)
#define md_swapout_symbols(s,n) swap_symbols(s,n)
#define md_swapin_zsymbols(s,n) swap_zsymbols(s,n)
#define md_swapout_zsymbols(s,n) swap_zsymbols(s,n)
#define md_swapin__dynamic(l) swap__dynamic(l)
#define md_swapout__dynamic(l) swap__dynamic(l)
#define md_swapin_section_dispatch_table(l) swap_section_dispatch_table(l)
#define md_swapout_section_dispatch_table(l) swap_section_dispatch_table(l)
#define md_swapin_so_debug(d) swap_so_debug(d)
#define md_swapout_so_debug(d) swap_so_debug(d)
#define md_swapin_rrs_hash(f,n) swap_rrs_hash(f,n)
#define md_swapout_rrs_hash(f,n) swap_rrs_hash(f,n)
#define md_swapin_sod(l,n) swapin_sod(l,n)
#define md_swapout_sod(l,n) swapout_sod(l,n)
#define md_swapout_got(g,n) swap_longs((long*)(g),n)
#define md_swapin_ranlib_hdr(h,n) swap_ranlib_hdr(h,n)
#define md_swapout_ranlib_hdr(h,n) swap_ranlib_hdr(h,n)
#define md_swap_short(x) ( (((x) >> 8) & 0xff) | (((x) & 0xff) << 8) )

View File

@ -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.6 1993/12/08 10:29:02 pk Exp $
* $Id: md.c,v 1.7 1994/01/28 21:02:21 pk Exp $
*/
#include <sys/param.h>
@ -167,33 +167,6 @@ int relocatable_output;
}
}
/*
* 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
N_SETMAGIC((*hp), magic, MID_MACHINE, flags);
/* TEXT_START depends on the value of outheader.a_entry. */
if (!(link_mode & SHAREABLE)) /*WAS: if (entry_symbol) */
hp->a_entry = PAGSIZ;
#else
hp->a_magic = magic;
hp->a_machtype = M_SPARC;
hp->a_toolversion = 1;
hp->a_dynamic = ((flags) & EX_DYNAMIC);
/* SunOS 4.1 N_TXTADDR depends on the value of outheader.a_entry. */
if (!(link_mode & SHAREABLE)) /*WAS: if (entry_symbol) */
hp->a_entry = N_PAGSIZ(*hp);
#endif
}
/*
* Machine dependent part of claim_rrs_reloc().
* On the Sparc the relocation offsets are stored in the r_addend member.
@ -327,3 +300,46 @@ long *savep;
*(long *)where = TRAP;
}
#ifndef RTLD
/*
* 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
N_SETMAGIC((*hp), magic, MID_MACHINE, flags);
/* TEXT_START depends on the value of outheader.a_entry. */
if (!(link_mode & SHAREABLE)) /*WAS: if (entry_symbol) */
hp->a_entry = PAGSIZ;
#else
hp->a_magic = magic;
hp->a_machtype = M_SPARC;
hp->a_toolversion = 1;
hp->a_dynamic = ((flags) & EX_DYNAMIC);
/* SunOS 4.1 N_TXTADDR depends on the value of outheader.a_entry. */
if (!(link_mode & SHAREABLE)) /*WAS: if (entry_symbol) */
hp->a_entry = N_PAGSIZ(*hp);
#endif
}
/*
* Check for acceptable foreign machine Ids
*/
int
md_midcompat(hp)
struct exec *hp;
{
#ifdef NetBSD
#define SUN_M_SPARC 3
return (((md_swap_long(hp->a_midmag)&0x00ff0000) >> 16) == SUN_M_SPARC);
#else
return hp->a_machtype == M_SPARC;
#endif
}
#endif /* RTLD */

View File

@ -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.h,v 1.6 1993/12/08 10:29:04 pk Exp $
* $Id: md.h,v 1.7 1994/01/28 21:04:18 pk Exp $
*/
/*
@ -60,6 +60,10 @@
#define r_symbolnum r_index
#endif /* NetBSD */
#define N_BADMID(ex) \
(N_GETMID(ex) != 0 && N_GETMID(ex) != MID_MACHINE && \
!md_midcompat(&(ex)))
/* Sparc (Sun 4) macros */
#define RELOC_ADDRESS(r) ((r)->r_address)
#define RELOC_EXTERN_P(r) ((r)->r_extern)
@ -139,16 +143,16 @@ typedef struct jmpslot {
#define md_swapout_zsymbols(s,n)
#define md_swapin_reloc(r,n)
#define md_swapout_reloc(r,n)
#define md_swapin_link_dynamic(l)
#define md_swapout_link_dynamic(l)
#define md_swapin_link_dynamic_2(l)
#define md_swapout_link_dynamic_2(l)
#define md_swapin_ld_debug(d)
#define md_swapout_ld_debug(d)
#define md_swapin__dynamic(l)
#define md_swapout__dynamic(l)
#define md_swapin_section_dispatch_table(l)
#define md_swapout_section_dispatch_table(l)
#define md_swapin_so_debug(d)
#define md_swapout_so_debug(d)
#define md_swapin_rrs_hash(f,n)
#define md_swapout_rrs_hash(f,n)
#define md_swapin_link_object(l,n)
#define md_swapout_link_object(l,n)
#define md_swapin_sod(l,n)
#define md_swapout_sod(l,n)
#define md_swapout_jmpslot(j,n)
#define md_swapout_got(g,n)
#define md_swapin_ranlib_hdr(h,n)
@ -168,23 +172,23 @@ void md_swapin_reloc __P((struct relocation_info *, int));
void md_swapout_reloc __P((struct relocation_info *, int));
void md_swapout_jmpslot __P((jmpslot_t *, int));
#define md_swapin_symbols(s,n) swap_symbols(s,n)
#define md_swapout_symbols(s,n) swap_symbols(s,n)
#define md_swapin_zsymbols(s,n) swap_zsymbols(s,n)
#define md_swapout_zsymbols(s,n) swap_zsymbols(s,n)
#define md_swapin_link_dynamic(l) swap_link_dynamic(l)
#define md_swapout_link_dynamic(l) swap_link_dynamic(l)
#define md_swapin_link_dynamic_2(l) swap_link_dynamic_2(l)
#define md_swapout_link_dynamic_2(l) swap_link_dynamic_2(l)
#define md_swapin_ld_debug(d) swap_ld_debug(d)
#define md_swapout_ld_debug(d) swap_ld_debug(d)
#define md_swapin_rrs_hash(f,n) swap_rrs_hash(f,n)
#define md_swapout_rrs_hash(f,n) swap_rrs_hash(f,n)
#define md_swapin_link_object(l,n) swapin_link_object(l,n)
#define md_swapout_link_object(l,n) swapout_link_object(l,n)
#define md_swapout_got(g,n) swap_longs((long*)(g),n)
#define md_swapin_ranlib_hdr(h,n) swap_ranlib_hdr(h,n)
#define md_swapout_ranlib_hdr(h,n) swap_ranlib_hdr(h,n)
#define md_swapin_symbols(s,n) swap_symbols(s,n)
#define md_swapout_symbols(s,n) swap_symbols(s,n)
#define md_swapin_zsymbols(s,n) swap_zsymbols(s,n)
#define md_swapout_zsymbols(s,n) swap_zsymbols(s,n)
#define md_swapin__dynamic(l) swap__dynamic(l)
#define md_swapout__dynamic(l) swap__dynamic(l)
#define md_swapin_section_dispatch_table(l) swap_section_dispatch_table(l)
#define md_swapout_section_dispatch_table(l) swap_section_dispatch_table(l)
#define md_swapin_so_debug(d) swap_so_debug(d)
#define md_swapout_so_debug(d) swap_so_debug(d)
#define md_swapin_rrs_hash(f,n) swap_rrs_hash(f,n)
#define md_swapout_rrs_hash(f,n) swap_rrs_hash(f,n)
#define md_swapin_sod(l,n) swapin_sod(l,n)
#define md_swapout_sod(l,n) swapout_sod(l,n)
#define md_swapout_got(g,n) swap_longs((long*)(g),n)
#define md_swapin_ranlib_hdr(h,n) swap_ranlib_hdr(h,n)
#define md_swapout_ranlib_hdr(h,n) swap_ranlib_hdr(h,n)
#define md_swap_short(x) ( (((x) >> 8) & 0xff) | (((x) & 0xff) << 8) )

View File

@ -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.6 1993/12/08 10:29:02 pk Exp $
* $Id: md.c,v 1.7 1994/01/28 21:02:21 pk Exp $
*/
#include <sys/param.h>
@ -167,33 +167,6 @@ int relocatable_output;
}
}
/*
* 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
N_SETMAGIC((*hp), magic, MID_MACHINE, flags);
/* TEXT_START depends on the value of outheader.a_entry. */
if (!(link_mode & SHAREABLE)) /*WAS: if (entry_symbol) */
hp->a_entry = PAGSIZ;
#else
hp->a_magic = magic;
hp->a_machtype = M_SPARC;
hp->a_toolversion = 1;
hp->a_dynamic = ((flags) & EX_DYNAMIC);
/* SunOS 4.1 N_TXTADDR depends on the value of outheader.a_entry. */
if (!(link_mode & SHAREABLE)) /*WAS: if (entry_symbol) */
hp->a_entry = N_PAGSIZ(*hp);
#endif
}
/*
* Machine dependent part of claim_rrs_reloc().
* On the Sparc the relocation offsets are stored in the r_addend member.
@ -327,3 +300,46 @@ long *savep;
*(long *)where = TRAP;
}
#ifndef RTLD
/*
* 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
N_SETMAGIC((*hp), magic, MID_MACHINE, flags);
/* TEXT_START depends on the value of outheader.a_entry. */
if (!(link_mode & SHAREABLE)) /*WAS: if (entry_symbol) */
hp->a_entry = PAGSIZ;
#else
hp->a_magic = magic;
hp->a_machtype = M_SPARC;
hp->a_toolversion = 1;
hp->a_dynamic = ((flags) & EX_DYNAMIC);
/* SunOS 4.1 N_TXTADDR depends on the value of outheader.a_entry. */
if (!(link_mode & SHAREABLE)) /*WAS: if (entry_symbol) */
hp->a_entry = N_PAGSIZ(*hp);
#endif
}
/*
* Check for acceptable foreign machine Ids
*/
int
md_midcompat(hp)
struct exec *hp;
{
#ifdef NetBSD
#define SUN_M_SPARC 3
return (((md_swap_long(hp->a_midmag)&0x00ff0000) >> 16) == SUN_M_SPARC);
#else
return hp->a_machtype == M_SPARC;
#endif
}
#endif /* RTLD */

View File

@ -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.h,v 1.6 1993/12/08 10:29:04 pk Exp $
* $Id: md.h,v 1.7 1994/01/28 21:04:18 pk Exp $
*/
/*
@ -60,6 +60,10 @@
#define r_symbolnum r_index
#endif /* NetBSD */
#define N_BADMID(ex) \
(N_GETMID(ex) != 0 && N_GETMID(ex) != MID_MACHINE && \
!md_midcompat(&(ex)))
/* Sparc (Sun 4) macros */
#define RELOC_ADDRESS(r) ((r)->r_address)
#define RELOC_EXTERN_P(r) ((r)->r_extern)
@ -139,16 +143,16 @@ typedef struct jmpslot {
#define md_swapout_zsymbols(s,n)
#define md_swapin_reloc(r,n)
#define md_swapout_reloc(r,n)
#define md_swapin_link_dynamic(l)
#define md_swapout_link_dynamic(l)
#define md_swapin_link_dynamic_2(l)
#define md_swapout_link_dynamic_2(l)
#define md_swapin_ld_debug(d)
#define md_swapout_ld_debug(d)
#define md_swapin__dynamic(l)
#define md_swapout__dynamic(l)
#define md_swapin_section_dispatch_table(l)
#define md_swapout_section_dispatch_table(l)
#define md_swapin_so_debug(d)
#define md_swapout_so_debug(d)
#define md_swapin_rrs_hash(f,n)
#define md_swapout_rrs_hash(f,n)
#define md_swapin_link_object(l,n)
#define md_swapout_link_object(l,n)
#define md_swapin_sod(l,n)
#define md_swapout_sod(l,n)
#define md_swapout_jmpslot(j,n)
#define md_swapout_got(g,n)
#define md_swapin_ranlib_hdr(h,n)
@ -168,23 +172,23 @@ void md_swapin_reloc __P((struct relocation_info *, int));
void md_swapout_reloc __P((struct relocation_info *, int));
void md_swapout_jmpslot __P((jmpslot_t *, int));
#define md_swapin_symbols(s,n) swap_symbols(s,n)
#define md_swapout_symbols(s,n) swap_symbols(s,n)
#define md_swapin_zsymbols(s,n) swap_zsymbols(s,n)
#define md_swapout_zsymbols(s,n) swap_zsymbols(s,n)
#define md_swapin_link_dynamic(l) swap_link_dynamic(l)
#define md_swapout_link_dynamic(l) swap_link_dynamic(l)
#define md_swapin_link_dynamic_2(l) swap_link_dynamic_2(l)
#define md_swapout_link_dynamic_2(l) swap_link_dynamic_2(l)
#define md_swapin_ld_debug(d) swap_ld_debug(d)
#define md_swapout_ld_debug(d) swap_ld_debug(d)
#define md_swapin_rrs_hash(f,n) swap_rrs_hash(f,n)
#define md_swapout_rrs_hash(f,n) swap_rrs_hash(f,n)
#define md_swapin_link_object(l,n) swapin_link_object(l,n)
#define md_swapout_link_object(l,n) swapout_link_object(l,n)
#define md_swapout_got(g,n) swap_longs((long*)(g),n)
#define md_swapin_ranlib_hdr(h,n) swap_ranlib_hdr(h,n)
#define md_swapout_ranlib_hdr(h,n) swap_ranlib_hdr(h,n)
#define md_swapin_symbols(s,n) swap_symbols(s,n)
#define md_swapout_symbols(s,n) swap_symbols(s,n)
#define md_swapin_zsymbols(s,n) swap_zsymbols(s,n)
#define md_swapout_zsymbols(s,n) swap_zsymbols(s,n)
#define md_swapin__dynamic(l) swap__dynamic(l)
#define md_swapout__dynamic(l) swap__dynamic(l)
#define md_swapin_section_dispatch_table(l) swap_section_dispatch_table(l)
#define md_swapout_section_dispatch_table(l) swap_section_dispatch_table(l)
#define md_swapin_so_debug(d) swap_so_debug(d)
#define md_swapout_so_debug(d) swap_so_debug(d)
#define md_swapin_rrs_hash(f,n) swap_rrs_hash(f,n)
#define md_swapout_rrs_hash(f,n) swap_rrs_hash(f,n)
#define md_swapin_sod(l,n) swapin_sod(l,n)
#define md_swapout_sod(l,n) swapout_sod(l,n)
#define md_swapout_got(g,n) swap_longs((long*)(g),n)
#define md_swapin_ranlib_hdr(h,n) swap_ranlib_hdr(h,n)
#define md_swapout_ranlib_hdr(h,n) swap_ranlib_hdr(h,n)
#define md_swap_short(x) ( (((x) >> 8) & 0xff) | (((x) & 0xff) << 8) )