Update for Sony News port and split of a.out into several variants.

Add write_contents to format-dependent vector.
This commit is contained in:
John Gilmore
1991-05-10 23:41:14 +00:00
parent df77307a2a
commit 66d4e1bb88
3 changed files with 64 additions and 38 deletions

View File

@ -82,41 +82,55 @@ enum machine_type {
/* Code indicating demand-paged executable. */ /* Code indicating demand-paged executable. */
#define ZMAGIC 0413 #define ZMAGIC 0413
/* Address of text segment in memory after it is loaded. */
/* Don't load things at zero, it encourages zero-pointer bugs */
#ifndef TEXT_START_ADDR
#define TEXT_START_ADDR 0x10000
#endif
/* Virtual Address of text segment from the a.out file. For OMAGIC, /* Virtual Address of text segment from the a.out file. For OMAGIC,
(almost always "unlinked .o's" these days), should be zero. (almost always "unlinked .o's" these days), should be zero.
Sun added a kludge so that shared libraries linked ZMAGIC get
an address of zero if a_entry (!!!) is lower than the otherwise
expected text address. These kludges have gotta go!
For linked files, should reflect reality if we know it. */ For linked files, should reflect reality if we know it. */
#ifndef N_TXTADDR #ifndef N_TXTADDR
#define N_TXTADDR(x) \ #define N_TXTADDR(x) (N_MAGIC(x)==OMAGIC? 0 : TEXT_START_ADDR)
(N_MAGIC(x)==OMAGIC? 0 \
: (N_MAGIC(x) == ZMAGIC && (x).a_entry < TEXT_START_ADDR)? 0 \
: TEXT_START_ADDR)
#endif #endif
/* Address of data segment in memory after it is loaded. #ifndef N_BADMAG
Note that it is up to you to define SEGMENT_SIZE #define N_BADMAG(x) (N_MAGIC(x) != OMAGIC \
on machines not listed here. */ && N_MAGIC(x) != NMAGIC \
#if defined(hp300) || defined(pyr) && N_MAGIC(x) != ZMAGIC)
#define SEGMENT_SIZE page_size
#endif #endif
#ifdef sony
#define SEGMENT_SIZE 0x2000 /* This complexity is for encapsulated COFF support */
#endif /* Sony. */ #ifndef _N_HDROFF
#ifdef is68k #define _N_HDROFF(x) (SEGMENT_SIZE - sizeof (struct exec))
#define SEGMENT_SIZE 0x20000
#endif #endif
#if defined(m68k) && defined(PORTAR)
#define PAGE_SIZE 0x400 #ifndef N_TXTOFF
#define SEGMENT_SIZE PAGE_SIZE #define N_TXTOFF(x) (N_MAGIC(x) == ZMAGIC ? \
_N_HDROFF((x)) + sizeof (struct exec) : \
sizeof (struct exec))
#endif
#ifndef N_DATOFF
#define N_DATOFF(x) ( N_TXTOFF(x) + (x).a_text )
#endif
#ifndef N_TRELOFF
#define N_TRELOFF(x) ( N_DATOFF(x) + (x).a_data )
#endif
#ifndef N_DRELOFF
#define N_DRELOFF(x) ( N_TRELOFF(x) + (x).a_trsize )
#endif
#ifndef N_SYMOFF
#define N_SYMOFF(x) ( N_DRELOFF(x) + (x).a_drsize )
#endif
#ifndef N_STROFF
#define N_STROFF(x) ( N_SYMOFF(x) + (x).a_syms )
#endif
/* Address of text segment in memory after it is loaded. */
#ifndef N_TXTADDR
#define N_TXTADDR(x) 0
#endif #endif
#ifndef N_DATADDR #ifndef N_DATADDR

View File

@ -1,19 +1,25 @@
/* SPARC-specific values for a.out files */ /* SPARC-specific values for a.out files */
#define PAGE_SIZE 0x02000 /* 8K. aka NBPG in <sys/param.h> */ #define PAGE_SIZE 0x2000 /* 8K. aka NBPG in <sys/param.h> */
/* Note that some SPARCs have 4K pages, some 8K, some others. */ /* Note that some SPARCs have 4K pages, some 8K, some others. */
#define SEGMENT_SIZE PAGE_SIZE #define SEGMENT_SIZE PAGE_SIZE
#define TEXT_START_ADDR PAGE_SIZE /* Location 0 is not accessible */ #define TEXT_START_ADDR PAGE_SIZE /* Location 0 is not accessible */
#define N_BADMAG(x) \ /* Non-default definitions of the accessor macros... */
(N_MAGIC(x) != OMAGIC && N_MAGIC(x) != NMAGIC \
&& N_MAGIC(x) != ZMAGIC)
/* Offset in a.out file of the text section. For ZMAGIC, the text section
actually includes the a.out header. */
#define N_TXTOFF(x) ( (N_MAGIC((x)) == ZMAGIC) ? 0 : sizeof(struct exec) ) #define N_TXTOFF(x) ( (N_MAGIC((x)) == ZMAGIC) ? 0 : sizeof(struct exec) )
#define N_DATOFF(x) ( N_TXTOFF(x) + (x).a_text )
#define N_TRELOFF(x) ( N_DATOFF(x) + (x).a_data )
#define N_DRELOFF(x) ( N_TRELOFF(x) + (x).a_trsize )
#define N_SYMOFF(x) ( N_DRELOFF(x) + (x).a_drsize )
#define N_STROFF(x) ( N_SYMOFF(x) + (x).a_syms )
/* Virtual Address of text segment from the a.out file. For OMAGIC,
(almost always "unlinked .o's" these days), should be zero.
Sun added a kludge so that shared libraries linked ZMAGIC get
an address of zero if a_entry (!!!) is lower than the otherwise
expected text address. These kludges have gotta go!
For linked files, should reflect reality if we know it. */
#define N_TXTADDR(x) \
(N_MAGIC(x)==OMAGIC? 0 \
: (N_MAGIC(x) == ZMAGIC && (x).a_entry < TEXT_START_ADDR)? 0 \
: TEXT_START_ADDR)

View File

@ -416,6 +416,11 @@ typedef enum
#define BFD_SEND_FMT(bfd, message, arglist) \ #define BFD_SEND_FMT(bfd, message, arglist) \
(((bfd)->xvec->message[(int)((bfd)->format)]) arglist) (((bfd)->xvec->message[(int)((bfd)->format)]) arglist)
/* This is the struct which defines the type of BFD this is. The
"xvec" member of the struct bfd itself points here. Each module
that implements access to a different target under BFD, defines
one of these. */
/* FIXME, these names should be rationalised with the names of the entry points /* FIXME, these names should be rationalised with the names of the entry points
which call them. Too bad we can't have one macro to define them both! */ which call them. Too bad we can't have one macro to define them both! */
typedef struct bfd_target typedef struct bfd_target
@ -458,7 +463,8 @@ typedef struct bfd_target
/* Format-dependent */ /* Format-dependent */
SDEF_FMT (struct bfd_target *, _bfd_check_format, (bfd *));/* file fmt or 0 */ SDEF_FMT (struct bfd_target *, _bfd_check_format, (bfd *));/* file fmt or 0 */
SDEF_FMT (boolean, _bfd_set_format, (bfd *)); /* make it an object file. */ SDEF_FMT (boolean, _bfd_set_format, (bfd *)); /* make it an object file */
SDEF_FMT (boolean, _bfd_write_contents, (bfd *)); /* write it out at close */
/* All these are defined in JUMP_TABLE */ /* All these are defined in JUMP_TABLE */
/* Core files */ /* Core files */