From d7f8f106b9efaaa99a279070fcdfbac95bad483e Mon Sep 17 00:00:00 2001 From: John Gilmore Date: Fri, 23 Aug 1991 08:56:39 +0000 Subject: [PATCH] * a.out.gnu.h, a.out.sun4.h: Make SEGMENT_SIZE able to depend on the particular a.out being examined. * a.out.sun4.h: Define segment sizes for Sun-3's and Sun-4's. * FIXME: a.out.gnu.h is almost obsolete. * FIXME: a.out.sun4.h should be renamed a.out.sun.h now. --- gas/a.out.gnu.h | 10 ++++++++-- include/a.out.sun4.h | 11 ++++++++++- include/aout64.h | 10 ++++++++-- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/gas/a.out.gnu.h b/gas/a.out.gnu.h index 42941e66f89..24794dcbcda 100755 --- a/gas/a.out.gnu.h +++ b/gas/a.out.gnu.h @@ -100,9 +100,15 @@ enum machine_type { && N_MAGIC(x) != ZMAGIC) #endif +/* By default, segment size is constant. But on some machines, it can + be a function of the a.out header (e.g. machine type). */ +#ifndef N_SEGSIZE +#define N_SEGSIZE(x) SEGMENT_SIZE +#endif + /* This complexity is for encapsulated COFF support */ #ifndef _N_HDROFF -#define _N_HDROFF(x) (SEGMENT_SIZE - sizeof (struct exec)) +#define _N_HDROFF(x) (N_SEGSIZE(x) - sizeof (struct exec)) #endif #ifndef N_TXTOFF @@ -140,7 +146,7 @@ enum machine_type { #ifndef N_DATADDR #define N_DATADDR(x) \ (N_MAGIC(x)==OMAGIC? (N_TXTADDR(x)+(x).a_text) \ - : (SEGMENT_SIZE + ((N_TXTADDR(x)+(x).a_text-1) & ~(SEGMENT_SIZE-1)))) + : (N_SEGSIZE(x) + ((N_TXTADDR(x)+(x).a_text-1) & ~(N_SEGSIZE(x)-1)))) #endif /* Address of bss segment in memory after it is loaded. */ diff --git a/include/a.out.sun4.h b/include/a.out.sun4.h index 4ce569da971..6c456d345e8 100755 --- a/include/a.out.sun4.h +++ b/include/a.out.sun4.h @@ -2,11 +2,20 @@ #define PAGE_SIZE 0x2000 /* 8K. aka NBPG in */ /* Note that some SPARCs have 4K pages, some 8K, some others. */ -#define SEGMENT_SIZE PAGE_SIZE + +#define SEG_SIZE_SPARC PAGE_SIZE +#define SEG_SIZE_SUN3 0x80000 /* Resolution of r/w protection hw */ + #define TEXT_START_ADDR PAGE_SIZE /* Location 0 is not accessible */ /* Non-default definitions of the accessor macros... */ +/* Segment size varies on Sun-3 versus Sun-4. */ + +#define N_SEGSIZE(x) (N_MACHTYPE(x) == M_SPARC? SEG_SIZE_SPARC: \ + N_MACHTYPE(x) == M_68020? SEG_SIZE_SUN3: \ + /* Guess? */ PAGE_SIZE) + /* Offset in a.out file of the text section. For ZMAGIC, the text section actually includes the a.out header. */ diff --git a/include/aout64.h b/include/aout64.h index 16d0b48ddc9..88df3039ee0 100755 --- a/include/aout64.h +++ b/include/aout64.h @@ -72,7 +72,13 @@ enum machine_type { ((exec).a_info = \ ((exec).a_info&0x00ffffff) | (((flags) & 0xff) << 24)) -#define _N_HDROFF(x) (SEGMENT_SIZE - EXEC_BYTES_SIZE) +/* By default, segment size is constant. But on some machines, it can + be a function of the a.out header (e.g. machine type). */ +#ifndef N_SEGSIZE +#define N_SEGSIZE(x) SEGMENT_SIZE +#endif + +#define _N_HDROFF(x) (N_SEGSIZE(x) - EXEC_BYTES_SIZE) /* address in an a.out of the text section. When demand paged, it's set up a bit to make nothing at 0, when an object file it's 0. There's a special hack case when the entry point is < TEXT_START_ADDR @@ -111,7 +117,7 @@ enum machine_type { #define N_DATADDR(x) \ (N_MAGIC(x)==OMAGIC? (N_TXTADDR(x)+(x).a_text) \ - : (SEGMENT_SIZE + ((N_TXTADDR(x)+(x).a_text-1) & ~(SEGMENT_SIZE-1)))) + : (N_SEGSIZE(x) + ((N_TXTADDR(x)+(x).a_text-1) & ~(N_SEGSIZE(x)-1)))) #define N_BSSADDR(x) (N_DATADDR(x) + (x).a_data) -- 2.30.2