~ubuntu-branches/ubuntu/quantal/gclcvs/quantal

« back to all changes in this revision

Viewing changes to h/rt_aix.h

  • Committer: Bazaar Package Importer
  • Author(s): Camm Maguire
  • Date: 2004-06-24 15:13:46 UTC
  • Revision ID: james.westby@ubuntu.com-20040624151346-xh0xaaktyyp7aorc
Tags: 2.7.0-26
C_GC_OFFSET is 2 on m68k-linux

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#define ATT
 
2
#define RT
 
3
#ifndef AIX
 
4
#define AIX
 
5
#endif
 
6
#include "att.h"
 
7
#define HAVE_AOUT <a.out.h>
 
8
 
 
9
 
 
10
#define ADDITIONAL_FEATURES \
 
11
                     ADD_FEATURE("IBMRT"); \
 
12
               ADD_FEATURE("AIX");\
 
13
               ADD_FEATURE("BUGGY-CC"); \
 
14
             ADD_FEATURE("RT")
 
15
 
 
16
#define USE_C_EXTENDED_DIV
 
17
#define USE_C_EXTENDED_MUL
 
18
 
 
19
#define IBMRT
 
20
#define IEEEFLOAT
 
21
 
 
22
#undef SET_REAL_MAXPAGE
 
23
#define SET_REAL_MAXPAGE \
 
24
        real_maxpage= ulimit(3)/PAGESIZE; \
 
25
        if (real_maxpage > MAXPAGE) \
 
26
                real_maxpage = MAXPAGE;
 
27
 
 
28
#define N_DATADDR(header) 
 
29
#define DATA_BEGIN (char *)header.a_dbase
 
30
 
 
31
  
 
32
#undef  MEM_SAVE_LOCALS
 
33
 
 
34
#define MEM_SAVE_LOCALS \
 
35
  struct exec header;\
 
36
  int stsize
 
37
 
 
38
#undef READ_HEADER
 
39
#define READ_HEADER     fread(&header, sizeof(header), 1, original); \
 
40
        data_begin=DATA_BEGIN; \
 
41
        data_end = core_end; \
 
42
        original_data = header.a_data; \
 
43
        header.a_data = data_end - data_begin; \
 
44
        header.a_bss = 0; \
 
45
        if (header.a_flags & A_HDREXT) printf("extended header"); \
 
46
        fwrite(&header, sizeof(header), 1, save);
 
47
 
 
48
/* I don't know why all the bsd versions are subtracting this off
 
49
   I thought the header.a_text was the actual size of the text
 
50
   not including the header */
 
51
 
 
52
#undef FILECPY_HEADER 
 
53
#define FILECPY_HEADER \
 
54
        filecpy(save, original, header.a_text - sizeof(header));
 
55
 
 
56
#undef COPY_TO_SAVE
 
57
#define  COPY_TO_SAVE \
 
58
  filecpy(save, original, header.a_syms+header.a_trsize+header.a_drsize +header.a_lnums); \
 
59
  fread(&stsize, sizeof(stsize), 1, original); \
 
60
  fwrite(&stsize, sizeof(stsize), 1, save); \
 
61
filecpy(save, original, stsize - sizeof(stsize))
 
62
 
 
63
 
 
64
#define LD_COMMAND(command,main,start,input,ldarg,output) \
 
65
  sprintf(command, "ld -d -x -A %s -T %x %s %s -o %s", \
 
66
            main,start,input,ldarg,output)
 
67
/* smallest address data can occur */
 
68
     /* #define DBEGIN  0x20000000 */
 
69
  
 
70
#define SYM_EXTERNAL_P(sym) (((sym)->n_sclass & (~N_SECT)) == C_EXT)
 
71
#define SYM_UNDEF_P(sym) (((sym)->n_sclass & N_SECT) ==  N_UNDF)
 
72
#define NUM_AUX(sym) ((sym)->n_numaux) 
 
73
#define SYM_NAME(p) SYM_NAME1((struct syment *)(p)) 
 
74
#define SYM_NAME1(p) \
 
75
  (((p)->_n._n_n._n_zeroes == 0) ? \
 
76
            &my_string_table[(p)->_n._n_n._n_offset] : \
 
77
               ((p)->_n._n_name[SYMNMLEN -1] ? \
 
78
                                 (strncpy(tem,(p)->_n._n_name,  \
 
79
                                           SYMNMLEN), \
 
80
                                  (char *)tem) : \
 
81
                                  (p)->_n._n_name ))
 
82
 
 
83
              /* the section like N_ABS,N_TEXT,.. */
 
84
#define N_SECTION(sym) (((struct syment *)sym)->n_sclass & N_SECT )
 
85
#define N_TYPE N_SECT  
 
86
 
 
87
/* the header is regared as part of the text */
 
88
#define N_RELOFF(header) A_TRELPOS(header)
 
89
#define N_SYMOFF(header) A_SYMPOS(header)
 
90
#define N_TXTOFF(header) A_TEXTPOS(header)
 
91
#define SYMNMLEN 8
 
92
  
 
93
#define EXT_and_TEXT_BSS_DAT(p) \
 
94
   ((SYM_EXTERNAL_P(p)) && ((N_SECTION(p) == N_TEXT) || \
 
95
                        (N_SECTION(p) == N_DATA) || \
 
96
                        (N_SECTION(p) == N_BSS)))
 
97
 
 
98
#define N_BADMAG(x) BADMAG(x)
 
99
  /* the beginning of the string table: first long will be size of string
 
100
     table */
 
101
#define N_STROFF(x) A_NAMEPOS(x)
 
102
 
 
103
#define MUST_SEEK_TO_STROFF
 
104
 
 
105
  /* in aix we must use the pointer to the constant pool for the init_code,
 
106
     not the actual pointer to the code.  */
 
107
 
 
108
/*   this is no longer valid 
 
109
#define VERIFY_INIT \
 
110
  if (at==0 || *(char **)at!= memory->cfd.cfd_start) \
 
111
    FEerror("init code constant pool bad"); 
 
112
*/
 
113
  /* find the first symbol in the data section:
 
114
     It should begin with with "_init_" and correspond to the
 
115
     beginning of the pcp pool for the init function..*/
 
116
#define FIND_INIT \
 
117
{ if (*ptr==0 && (N_SECTION(sym) == N_DATA) && sym->n_value ) \
 
118
  { char tem [9]; \
 
119
    char *str=SYM_NAME(sym); \
 
120
     dprintf(find init: %s ,str); \
 
121
  if (str[1]=='i'    && str[2]=='n'  && str[3]=='i' && str[4]== 't' \
 
122
      && str[5]=='_' && str[0]== '_' &&  str[strlen(str)-1] !='X')  \
 
123
        *ptr=  sym->n_value ; \
 
124
   else {/* printf("The first data symbol was not the init");*/}  \
 
125
 }}
 
126
  
 
127
#define RELOC_FILE "rel_aix.c"
 
128
 
 
129
#define GETCWD
 
130
  /* the system defines a different getwd */
 
131
#define getwd ourgetwd
 
132
  
 
133
/* these two symbols are too long for the rt pl8cc compiler */
 
134
  
 
135
#define check_type_or_pathname_string_symbol_stream  check_type_or_path_or_strm
 
136
#define check_type_or_Pathname_string_symbol check_type_or_path_sym
 
137
#define TSor_pathname_string_symbol_stream  TSor_path_string_sym_strm  
 
138
#define check_type_or_symbol_string_package check_type_or_sym_str_pack  
 
139
 
 
140
 
 
141
/* If free is likely to be called multiple times on the same block
 
142
   (in contravention of ANSI C) by system functions, don't break on
 
143
   such an error */
 
144
 
 
145
#define NOFREE_ERR
 
146
 
 
147
/* Begin for cmpinclude */
 
148
 
 
149
 
 
150
/* End for cmpinclude */