home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-04-19 | 34.0 KB | 1,449 lines |
- *** 1.26 1992/03/22 21:44:03
- --- Changelog 1992/04/19 17:00:12
- ***************
- *** 272,274 ****
- --- 272,297 ----
- free demangled storage.
-
- ----------------------------- Patchlevel 26 ---------------------------------
- +
- + ld.c:: Michal
- + clean up compiler noise.
- +
- + cnm.c:: andreas
- + adjust proto for ckfread; correctly count symbols if
- + WORD_ALIGNED
- +
- + cplusdem.c:: andreas
- + some names couldn't be demangled (like template
- + functions, static members)
- +
- + ld.c:: andreas
- + adjust protos for mywrite, xmalloc, xrealloc;
- + initialize gst_symboltable and gst_symbols if CROSSATARI
- +
- + strip.c:: andreas
- + preserve long symbols, avoid warnings about cast
- +
- + sym-ld.c:: andreas
- + write only the symbols since this is all what gdb needs
- +
- + ----------------------------- Patchlevel 27 ---------------------------------
- *** 1.24 1992/03/22 21:44:03
- --- PatchLev.h 1992/04/19 17:00:13
- ***************
- *** 1,4 ****
- ! #define PatchLevel "26"
-
- /*
- * the Patch Level above is to identify the version
- --- 1,4 ----
- ! #define PatchLevel "27"
-
- /*
- * the Patch Level above is to identify the version
- *** 1.5 1992/01/14 19:45:23
- --- cnm.c 1992/04/19 17:00:14
- ***************
- *** 81,87 ****
- int fill8 P_((char *s));
- int not_glob P_((int x));
- void sflags P_((int x));
- ! void ckfread P_((char *buf, int siz, int n, FILE *fp));
- int readhead P_((struct hdr *h, int n, FILE *fd));
- int readsyms P_((struct xsym *syms, int n, FILE *fd));
-
- --- 81,87 ----
- int fill8 P_((char *s));
- int not_glob P_((int x));
- void sflags P_((int x));
- ! void ckfread P_((void *buf, int siz, int n, FILE *fp));
- int readhead P_((struct hdr *h, int n, FILE *fd));
- int readsyms P_((struct xsym *syms, int n, FILE *fd));
-
- ***************
- *** 230,236 ****
- --- 230,240 ----
- }
- len = h.tsize + h.dsize;
- fseek(fd, len, 1);
- + #ifndef WORD_ALIGNED
- return h.syms / sizeof(struct sym);
- + #else
- + return h.syms / 14;
- + #endif
- }
-
- void
- ***************
- *** 315,321 ****
-
- #ifdef WORD_ALIGNED
- void ckfread(buf, siz, n, fp)
- ! char *buf;
- int siz, n;
- FILE *fp;
- {
- --- 319,325 ----
-
- #ifdef WORD_ALIGNED
- void ckfread(buf, siz, n, fp)
- ! void *buf;
- int siz, n;
- FILE *fp;
- {
- *** 1.2 1992/03/08 17:23:52
- --- cplusdem.c 1992/04/19 17:00:15
- ***************
- *** 166,171 ****
- --- 166,177 ----
- "cm", ",", /* ansi */
- "nop", "", /* old (for operator=) */
- "as", "=", /* ansi */
- + "cond", "?:", /* old */
- + "cn", "?:", /* psuedo-ansi */
- + "max", ">?", /* old */
- + "mx", ">?", /* psuedo-ansi */
- + "min", "<?", /* old */
- + "mn", "<?", /* psuedo-ansi */
- };
-
- /* Beware: these aren't '\0' terminated. */
- ***************
- *** 186,194 ****
- static void string_appends (string *p, string *s);
- static void string_appendn (string *p, const char *s, int n);
- static void string_prepend (string *p, const char *s);
- - #if 0
- static void string_prepends (string *p, string *s);
- - #endif
- static void string_prependn (string *p, const char *s, int n);
- static int get_count (const char **type, int *count);
- static int do_args (const char **type, string *decl);
- --- 192,198 ----
- ***************
- *** 195,200 ****
- --- 199,207 ----
- static int do_type (const char **type, string *result);
- static int do_arg (const char **type, string *result);
- static int do_args (const char **type, string *decl);
- + static int do_cuv_prefix (const char **type, string *result, int *non_empty);
- + static int do_builtin_type (const char **type, string *result, int *non_empty);
- + static int do_template_args (const char **type, string *result);
- static void munge_function_name (string *name);
- static void remember_type (const char *type, int len);
- #else
- ***************
- *** 214,219 ****
- --- 221,229 ----
- static int do_type ();
- static int do_arg ();
- static int do_args ();
- + static int do_cuv_prefix ();
- + static int do_builtin_type ();
- + static int do_template_args ();
- static void munge_function_name ();
- static void remember_type ();
- #endif
- ***************
- *** 275,286 ****
- destructor = 1;
- p = type;
- }
- - /* static data member */
- - else if (*type != '_' && (strchr (type, CPLUS_MARKER) != NULL))
- - {
- - static_type = 1;
- - p = type;
- - }
- /* virtual table "_vt$" */
- else if (type[0] == '_' && type[1] == 'v' && type[2] == 't' && type[3] == CPLUS_MARKER)
- {
- --- 285,290 ----
- ***************
- *** 290,295 ****
- --- 294,305 ----
- strcat (tem, " virtual table");
- return tem;
- }
- + /* static data member */
- + else if (type[0] == '_' && type[1] != '_' && (strchr (type, CPLUS_MARKER) != NULL))
- + {
- + static_type = 1;
- + p = type + 1;
- + }
- else return NULL;
- }
-
- ***************
- *** 323,334 ****
- string_appendn (&decl, "", 1);
- munge_function_name (&decl);
- if (decl.b[0] == '_')
- ! {
- ! string_delete (&decl);
- ! return NULL;
- ! }
- ! else
- ! p += 2;
- }
- else
- {
- --- 333,340 ----
- string_appendn (&decl, "", 1);
- munge_function_name (&decl);
- if (decl.b[0] == '_')
- ! decl.p--;
- ! p += 2;
- }
- else
- {
- ***************
- *** 351,363 ****
- {
- case 'C':
- /* a const member function */
- ! if (!isdigit (p[1]))
- {
- string_delete (&decl);
- return NULL;
- }
- - p += 1;
- - const_flag = 1;
- /* fall through */
- case '0':
- case '1':
- --- 357,371 ----
- {
- case 'C':
- /* a const member function */
- ! p += 1;
- ! const_flag = 1;
- ! if (*p == 't')
- ! goto template;
- ! if (!isdigit (*p))
- {
- string_delete (&decl);
- return NULL;
- }
- /* fall through */
- case '0':
- case '1':
- ***************
- *** 416,597 ****
- break;
- /* template additions */
- case 't':
- p += 1;
- {
- ! int r, i;
- ! int non_empty = 0;
- string tname;
- string trawname;
-
- - string temp;
- - int need_comma = 0;
- -
- string_init(&tname);
- string_init(&trawname);
- !
- /* get template name */
- if (!get_simple_count (&p, &r))
- {
- ! string_delete (&decl);
- ! return 0;
- }
- string_appendn (&tname, p, r);
- string_appendn (&trawname, p, r);
- - string_appendn (&trawname, "", 1);
- p += r;
- string_append (&tname, "<");
- ! /* get size of template parameter list */
- ! if (!get_count (&p, &r))
- ! return 0;
- ! for (i = 0; i < r; i++)
- {
- ! if (need_comma)
- ! string_append (&tname, ", ");
- ! /* Z for type parameters */
- ! if (*p == 'Z')
- ! {
- ! p += 1;
- !
- ! success = do_type (&p, &temp);
- ! string_appendn (&temp, "", 1);
- ! if (success)
- ! string_append (&tname, temp.b);
- ! string_delete(&temp);
- ! if (!success)
- ! break;
- ! }
- ! /* otherwise, value parameter */
- ! else
- ! {
- ! const char *old_p = p;
- ! int is_pointer = 0;
- ! int is_real = 0;
- ! int is_integral = 0;
- ! int done = 0;
- !
- ! success = do_type (&p, &temp);
- ! string_appendn (&temp, "", 1);
- ! if (success)
- ! string_append (&tname, temp.b);
- ! string_delete(&temp);
- ! if (!success)
- ! break;
- ! string_append (&tname, "=");
- ! while (*old_p && !done)
- ! {
- ! switch (*old_p)
- ! {
- ! case 'P':
- ! case 'R':
- ! done = is_pointer = 1;
- ! break;
- ! case 'C': /* const */
- ! case 'U': /* unsigned */
- ! case 'V': /* volatile */
- ! case 'F': /* function */
- ! case 'M': /* member function */
- ! case 'O': /* ??? */
- ! old_p++;
- ! continue;
- ! case 'Q': /* repetition of following */
- ! case 'T': /* remembered type */
- ! abort();
- ! break;
- ! case 'v': /* void */
- ! abort();
- ! break;
- ! case 'x': /* long long */
- ! case 'l': /* long */
- ! case 'i': /* int */
- ! case 's': /* short */
- ! case 'c': /* char */
- ! done = is_integral = 1;
- ! break;
- ! case 'r': /* long double */
- ! case 'd': /* double */
- ! case 'f': /* float */
- ! done = is_real = 1;
- ! break;
- ! default:
- ! abort();
- ! }
- ! }
- ! if (is_integral)
- ! {
- ! if (*p == 'm')
- ! {
- ! string_appendn (&tname, "-", 1);
- ! p++;
- ! }
- ! while (isdigit (*p))
- ! {
- ! string_appendn (&tname, p, 1);
- ! p++;
- ! }
- ! }
- ! else if (is_real)
- ! {
- ! if (*p == 'm')
- ! {
- ! string_appendn (&tname, "-", 1);
- ! p++;
- ! }
- ! while (isdigit (*p))
- ! {
- ! string_appendn (&tname, p, 1);
- ! p++;
- ! }
- ! if (*p == '.') /* fraction */
- ! {
- ! string_appendn (&tname, ".", 1);
- ! p++;
- ! while (isdigit (*p))
- ! {
- ! string_appendn (&tname, p, 1);
- ! p++;
- ! }
- ! }
- ! if (*p == 'e') /* exponent */
- ! {
- ! string_appendn (&tname, "e", 1);
- ! p++;
- ! while (isdigit (*p))
- ! {
- ! string_appendn (&tname, p, 1);
- ! p++;
- ! }
- ! }
- ! }
- ! else if (is_pointer)
- ! {
- ! int symbol_len;
- !
- ! if (!get_count (&p, &symbol_len))
- ! {
- ! success = 0;
- ! break;
- ! }
- ! string_appendn (&tname, p, symbol_len);
- ! p += symbol_len;
- ! }
- ! }
- ! need_comma = 1;
- }
- string_append (&tname, ">::");
- if (destructor)
- string_append(&tname, "~");
- ! if (constructor || destructor) {
- ! string_appendn (&trawname, "", 1);
- ! string_append (&tname, trawname.b);
- ! }
- string_delete(&trawname);
- !
- if (!success) {
- string_delete(&tname);
- return 0;
- }
- ! string_appendn (&tname, "", 1);
- ! string_prepend (&decl, tname.b);
- string_delete (&tname);
-
- if (static_type)
- --- 424,468 ----
- break;
- /* template additions */
- case 't':
- + template:
- p += 1;
- {
- ! int r;
- string tname;
- string trawname;
-
- string_init(&tname);
- string_init(&trawname);
- !
- /* get template name */
- if (!get_simple_count (&p, &r))
- {
- ! success = 0;
- ! break;
- }
- string_appendn (&tname, p, r);
- string_appendn (&trawname, p, r);
- p += r;
- string_append (&tname, "<");
- ! success = do_template_args (&p, &tname);
- ! if (!success)
- {
- ! string_delete (&tname);
- ! string_delete (&trawname);
- ! break;
- }
- string_append (&tname, ">::");
- if (destructor)
- string_append(&tname, "~");
- ! if (constructor || destructor)
- ! string_appends (&tname, &trawname);
- string_delete(&trawname);
- !
- if (!success) {
- string_delete(&tname);
- return 0;
- }
- ! string_prepends (&decl, &tname);
- string_delete (&tname);
-
- if (static_type)
- ***************
- *** 602,609 ****
- }
- else
- success = do_args (&p, &decl);
- ! break;
- }
- }
-
- for (i = 0; i < ntypes; i++)
- --- 473,482 ----
- }
- else
- success = do_args (&p, &decl);
- ! if (const_flag)
- ! string_append (&decl, " const");
- }
- + break;
- }
-
- for (i = 0; i < ntypes; i++)
- ***************
- *** 686,692 ****
- case 'Q':
- n = (*type)[1] - '0';
- if (n < 0 || n > 9)
- ! success = 0;
- *type += 2;
- while (n-- > 0)
- do_type (type, result);
- --- 559,568 ----
- case 'Q':
- n = (*type)[1] - '0';
- if (n < 0 || n > 9)
- ! {
- ! success = 0;
- ! break;
- ! }
- *type += 2;
- while (n-- > 0)
- do_type (type, result);
- ***************
- *** 842,850 ****
- }
- }
-
- ! int
- do_cuv_prefix (type, result, non_empty)
- ! char **type;
- string* result;
- int* non_empty;
- {
- --- 718,726 ----
- }
- }
-
- ! static int
- do_cuv_prefix (type, result, non_empty)
- ! const char **type;
- string* result;
- int* non_empty;
- {
- ***************
- *** 887,895 ****
- return success;
- }
-
- ! int
- do_builtin_type (type, result, non_empty)
- ! char **type;
- string* result;
- int *non_empty;
- {
- --- 763,771 ----
- return success;
- }
-
- ! static int
- do_builtin_type (type, result, non_empty)
- ! const char **type;
- string* result;
- int *non_empty;
- {
- ***************
- *** 991,996 ****
- --- 867,890 ----
- string_appendn (result, *type, n);
- *type += n;
- break;
- + case 't':
- + *type += 1;
- + /* get template name */
- + if (!get_simple_count (type, &n))
- + {
- + success = 0;
- + break;
- + }
- + if (*non_empty)
- + string_append (result, " ");
- + string_appendn (result, *type, n);
- + *type += n;
- + string_append (result, "<");
- + if (!do_template_args (type, result))
- + success = 0;
- + else
- + string_append (result, ">");
- + break;
- default:
- success = 0;
- break;
- ***************
- *** 998,1003 ****
- --- 892,1045 ----
- return success;
- }
-
- + static int
- + do_template_args (type, result)
- + const char **type;
- + string *result;
- + {
- + int r, i;
- +
- + string temp;
- + int need_comma = 0;
- + int success;
- +
- + /* get size of template parameter list */
- + if (!get_count (type, &r))
- + return 0;
- + for (i = 0; i < r; i++)
- + {
- + if (need_comma)
- + string_append (result, ", ");
- + /* Z for type parameters */
- + if (**type == 'Z')
- + {
- + *type += 1;
- +
- + success = do_type (type, &temp);
- + if (success)
- + string_appends (result, &temp);
- + string_delete(&temp);
- + if (!success)
- + break;
- + }
- + /* otherwise, value parameter */
- + else
- + {
- + const char *old_p = *type;
- + int is_pointer = 0;
- + int is_real = 0;
- + int is_integral = 0;
- + int done = 0;
- +
- + success = do_type (type, &temp);
- + if (success)
- + string_appends (result, &temp);
- + string_delete(&temp);
- + if (!success)
- + break;
- + string_append (result, "=");
- + while (*old_p && !done)
- + {
- + switch (*old_p)
- + {
- + case 'P':
- + case 'R':
- + done = is_pointer = 1;
- + break;
- + case 'C': /* const */
- + case 'U': /* unsigned */
- + case 'V': /* volatile */
- + case 'F': /* function */
- + case 'M': /* member function */
- + case 'O': /* ??? */
- + old_p++;
- + continue;
- + case 'Q': /* repetition of following */
- + case 'T': /* remembered type */
- + abort();
- + break;
- + case 'v': /* void */
- + abort();
- + break;
- + case 'x': /* long long */
- + case 'l': /* long */
- + case 'i': /* int */
- + case 's': /* short */
- + case 'c': /* char */
- + done = is_integral = 1;
- + break;
- + case 'r': /* long double */
- + case 'd': /* double */
- + case 'f': /* float */
- + done = is_real = 1;
- + break;
- + default:
- + abort();
- + }
- + }
- + if (is_integral)
- + {
- + if (**type == 'm')
- + {
- + string_appendn (result, "-", 1);
- + *type++;
- + }
- + while (isdigit (**type))
- + {
- + string_appendn (result, *type, 1);
- + *type++;
- + }
- + }
- + else if (is_real)
- + {
- + if (**type == 'm')
- + {
- + string_appendn (result, "-", 1);
- + *type++;
- + }
- + while (isdigit (**type))
- + {
- + string_appendn (result, *type, 1);
- + *type++;
- + }
- + if (**type == '.') /* fraction */
- + {
- + string_appendn (result, ".", 1);
- + *type++;
- + while (isdigit (**type))
- + {
- + string_appendn (result, *type, 1);
- + *type++;
- + }
- + }
- + if (**type == 'e') /* exponent */
- + {
- + string_appendn (result, "e", 1);
- + *type++;
- + while (isdigit (**type))
- + {
- + string_appendn (result, *type, 1);
- + *type++;
- + }
- + }
- + }
- + else if (is_pointer)
- + {
- + int symbol_len;
- +
- + if (!get_count (type, &symbol_len))
- + {
- + success = 0;
- + break;
- + }
- + string_appendn (result, *type, symbol_len);
- + *type += symbol_len;
- + }
- + }
- + need_comma = 1;
- + }
- + }
- +
- /* `result' will be initialised in do_type; it will be freed on failure */
-
- static int
- ***************
- *** 1321,1327 ****
- string_prependn (p, s, strlen (s));
- }
-
- - #if 0
- static void
- string_prepends (p, s)
- string *p, *s;
- --- 1363,1368 ----
- ***************
- *** 1330,1336 ****
- return;
- string_prependn (p, s->b, s->p - s->b);
- }
- - #endif
-
- static void
- string_prependn (p, s, n)
- --- 1371,1376 ----
- *** 1.31 1992/03/22 21:44:03
- --- ld.c 1992/04/19 17:00:16
- ***************
- *** 468,474 ****
- #define RELOC_TYPE(r) ((r)->r_symbolnum)
- #define RELOC_SYMBOL(r) ((r)->r_symbolnum)
- #define RELOC_MEMORY_ADD_P(r) 1
- ! /* #define RELOC_ADD_EXTRA(r) 0 /* Don't need to define */
- #define RELOC_PCREL_P(r) ((r)->r_pcrel)
- #define RELOC_VALUE_RIGHTSHIFT(r) 0
- #define RELOC_TARGET_SIZE(r) ((r)->r_length)
- --- 468,474 ----
- #define RELOC_TYPE(r) ((r)->r_symbolnum)
- #define RELOC_SYMBOL(r) ((r)->r_symbolnum)
- #define RELOC_MEMORY_ADD_P(r) 1
- ! /* #define RELOC_ADD_EXTRA(r) 0 */ /* Don't need to define */
- #define RELOC_PCREL_P(r) ((r)->r_pcrel)
- #define RELOC_VALUE_RIGHTSHIFT(r) 0
- #define RELOC_TARGET_SIZE(r) ((r)->r_length)
- ***************
- *** 1108,1119 ****
- void fatal_with_file P_((char *string, struct file_entry *entry));
- void perror_name P_((char *name));
- void perror_file P_((struct file_entry *entry));
- ! void mywrite P_((char *buf, int count, int eltsize, FILE *desc));
- void padfile P_((int padding, FILE *outdesc));
- char *concat P_((char *s1, char *s2, char *s3));
- int parse P_((char *arg, char *format, char *error));
- ! int xmalloc P_((int size));
- ! int xrealloc P_((char *ptr, int size));
- int write_minix_sym P_((struct nlist *p, char *str, int gflag, int fflag));
- void write_minix_syms P_((struct file_entry *entry, int *syms_written_addr));
- void do_write_minix_out P_((void));
- --- 1108,1119 ----
- void fatal_with_file P_((char *string, struct file_entry *entry));
- void perror_name P_((char *name));
- void perror_file P_((struct file_entry *entry));
- ! void mywrite P_((void *buf, int count, int eltsize, FILE *desc));
- void padfile P_((int padding, FILE *outdesc));
- char *concat P_((char *s1, char *s2, char *s3));
- int parse P_((char *arg, char *format, char *error));
- ! void *xmalloc P_((int size));
- ! void *xrealloc P_((void *ptr, int size));
- int write_minix_sym P_((struct nlist *p, char *str, int gflag, int fflag));
- void write_minix_syms P_((struct file_entry *entry, int *syms_written_addr));
- void do_write_minix_out P_((void));
- ***************
- *** 1125,1131 ****
- #ifndef bcopy
- void bcopy (), bzero ();
- #endif
- ! int malloc (), realloc ();
- #ifndef alloca
- int alloca ();
- #endif
- --- 1125,1131 ----
- #ifndef bcopy
- void bcopy (), bzero ();
- #endif
- ! void *malloc (), *realloc ();
- #ifndef alloca
- int alloca ();
- #endif
- ***************
- *** 1159,1165 ****
-
- /* Initialize the data about options. */
-
- ! #ifdef atarist
- gst_symboltable = 0;
- gst_symbols = 0;
- #endif
- --- 1159,1165 ----
-
- /* Initialize the data about options. */
-
- ! #if defined(atarist) || defined(CROSSATARI)
- gst_symboltable = 0;
- gst_symbols = 0;
- #endif
- ***************
- *** 1573,1579 ****
- /* else "*(cpp = cp) = '\0'" =>> end */
- n_search_dirs++;
- search_dirs =
- ! (char **) xrealloc(search_dirs, n_search_dirs*sizeof(char *));
- search_dirs[n_search_dirs-1] = concat(cpp, "", "");
- #ifdef DEBUG
- fprintf(stderr, "... '%s'\n", search_dirs[n_search_dirs-1]);
- --- 1573,1580 ----
- /* else "*(cpp = cp) = '\0'" =>> end */
- n_search_dirs++;
- search_dirs =
- ! (char **) xrealloc((char *)search_dirs,
- ! n_search_dirs*sizeof(char *));
- search_dirs[n_search_dirs-1] = concat(cpp, "", "");
- #ifdef DEBUG
- fprintf(stderr, "... '%s'\n", search_dirs[n_search_dirs-1]);
- ***************
- *** 1590,1596 ****
- int n = sizeof standard_search_dirs / sizeof standard_search_dirs[0];
- n_search_dirs += n;
- search_dirs
- ! = (char **) xrealloc (search_dirs, n_search_dirs * sizeof (char *));
- bcopy (standard_search_dirs, &search_dirs[n_search_dirs - n],
- n * sizeof (char *));
- }
- --- 1591,1598 ----
- int n = sizeof standard_search_dirs / sizeof standard_search_dirs[0];
- n_search_dirs += n;
- search_dirs
- ! = (char **) xrealloc ((char *)search_dirs,
- ! n_search_dirs * sizeof (char *));
- bcopy (standard_search_dirs, &search_dirs[n_search_dirs - n],
- n * sizeof (char *));
- }
- ***************
- *** 1614,1620 ****
-
- cl_refs_allocated *= 2;
- cmdline_references = (struct glosym **)
- ! xrealloc (cmdline_references,
- cl_refs_allocated * sizeof (struct glosym *));
- ptr = cmdline_references + diff;
- }
- --- 1616,1622 ----
-
- cl_refs_allocated *= 2;
- cmdline_references = (struct glosym **)
- ! xrealloc ((char *)cmdline_references,
- cl_refs_allocated * sizeof (struct glosym *));
- ptr = cmdline_references + diff;
- }
- ***************
- *** 1690,1696 ****
- case 'L':
- n_search_dirs++;
- search_dirs
- ! = (char **) xrealloc (search_dirs, n_search_dirs * sizeof (char *));
- search_dirs[n_search_dirs - 1] = arg;
- return;
-
- --- 1692,1699 ----
- case 'L':
- n_search_dirs++;
- search_dirs
- ! = (char **) xrealloc ((char *)search_dirs,
- ! n_search_dirs * sizeof (char *));
- search_dirs[n_search_dirs - 1] = arg;
- return;
-
- ***************
- *** 1902,1908 ****
- file_open (entry)
- register struct file_entry *entry;
- {
- ! register FILE *desc;
-
- if (entry->superfile)
- return file_open (entry->superfile);
- --- 1905,1911 ----
- file_open (entry)
- register struct file_entry *entry;
- {
- ! register FILE *desc = NULL;
-
- if (entry->superfile)
- return file_open (entry->superfile);
- ***************
- *** 3228,3234 ****
- fprintf (outfile, " ");
- print_file_name (entry, outfile);
- if (entry->just_syms_flag)
- ! fprintf (outfile, " symbols only\n", 0);
- else
- fprintf (outfile, " text %x(%x), data %x(%x), bss %x(%x) hex\n",
- entry->text_start_address, entry->header.a_text,
- --- 3231,3237 ----
- fprintf (outfile, " ");
- print_file_name (entry, outfile);
- if (entry->just_syms_flag)
- ! fprintf (outfile, " symbols only\n");
- else
- fprintf (outfile, " text %x(%x), data %x(%x), bss %x(%x) hex\n",
- entry->text_start_address, entry->header.a_text,
- ***************
- *** 3987,3993 ****
- #endif /* BYTE_SWAP */
-
- # ifndef WORD_ALIGNED
- ! mywrite (&outheader, sizeof outheader, 1, outdesc);
- # else
- # ifndef MINIX
- mywrite (&outheader.a_magic , sizeof outheader.a_magic , 1, outdesc);
- --- 3990,3996 ----
- #endif /* BYTE_SWAP */
-
- # ifndef WORD_ALIGNED
- ! mywrite ((char *)&outheader, sizeof outheader, 1, outdesc);
- # else
- # ifndef MINIX
- mywrite (&outheader.a_magic , sizeof outheader.a_magic , 1, outdesc);
- ***************
- *** 4046,4052 ****
- /* Write out the set element vectors */
-
- if (set_vector_count)
- ! mywrite (set_vectors, set_symbol_count + 2 * set_vector_count, sizeof (unsigned long), outdesc);
-
- if (trace_files)
- fprintf (stderr, "\n");
- --- 4049,4057 ----
- /* Write out the set element vectors */
-
- if (set_vector_count)
- ! mywrite ((char *) set_vectors,
- ! set_symbol_count + 2 * set_vector_count,
- ! sizeof (unsigned long), outdesc);
-
- if (trace_files)
- fprintf (stderr, "\n");
- ***************
- *** 4350,4356 ****
- relocation >>= RELOC_VALUE_RIGHTSHIFT(p);
-
- /* Unshifted mask for relocation */
- ! mask = 1 << RELOC_TARGET_BITSIZE(p) - 1;
- mask |= mask - 1;
- relocation &= mask;
-
- --- 4355,4361 ----
- relocation >>= RELOC_VALUE_RIGHTSHIFT(p);
-
- /* Unshifted mask for relocation */
- ! mask = 1 << (RELOC_TARGET_BITSIZE(p) - 1);
- mask |= mask - 1;
- relocation &= mask;
-
- ***************
- *** 4763,4773 ****
- sym.a_value = p->n_value;
-
- #ifndef WORD_ALIGNED
- ! mywrite(&sym, sizeof sym, 1, outdesc);
- if (i > 0)
- {
- (void) strncpy ((char *) &sym, str, (size_t)i);
- ! mywrite(&sym, sizeof sym, 1, outdesc);
- }
- #else
- mywrite(sym.a_name , sizeof sym.a_name , 1, outdesc);
- --- 4768,4778 ----
- sym.a_value = p->n_value;
-
- #ifndef WORD_ALIGNED
- ! mywrite((char *)&sym, sizeof sym, 1, outdesc);
- if (i > 0)
- {
- (void) strncpy ((char *) &sym, str, (size_t)i);
- ! mywrite((char *)&sym, sizeof sym, 1, outdesc);
- }
- #else
- mywrite(sym.a_name , sizeof sym.a_name , 1, outdesc);
- ***************
- *** 5742,5748 ****
-
- void
- mywrite (buf, count, eltsize, desc)
- ! char *buf;
- int count;
- int eltsize;
- FILE *desc;
- --- 5747,5753 ----
-
- void
- mywrite (buf, count, eltsize, desc)
- ! void *buf;
- int count;
- int eltsize;
- FILE *desc;
- ***************
- *** 5808,5818 ****
-
- /* Like malloc but get fatal error if memory is exhausted. */
-
- ! int
- xmalloc (size)
- int size;
- {
- ! register int result = malloc (size);
- if (!result)
- fatal ("virtual memory exhausted", 0);
- return result;
- --- 5813,5823 ----
-
- /* Like malloc but get fatal error if memory is exhausted. */
-
- ! void *
- xmalloc (size)
- int size;
- {
- ! register void *result = malloc (size);
- if (!result)
- fatal ("virtual memory exhausted", 0);
- return result;
- ***************
- *** 5820,5831 ****
-
- /* Like realloc but get fatal error if memory is exhausted. */
-
- ! int
- xrealloc (ptr, size)
- ! char *ptr;
- int size;
- {
- ! register int result = realloc (ptr, size);
- if (!result)
- fatal ("virtual memory exhausted", 0);
- return result;
- --- 5825,5836 ----
-
- /* Like realloc but get fatal error if memory is exhausted. */
-
- ! void *
- xrealloc (ptr, size)
- ! void *ptr;
- int size;
- {
- ! register void *result = realloc (ptr, size);
- if (!result)
- fatal ("virtual memory exhausted", 0);
- return result;
- *** 1.5 1992/01/14 19:45:23
- --- strip.c 1992/04/19 17:00:18
- ***************
- *** 49,57 ****
-
- #include <fcntl.h>
-
- - #ifdef __GNUC__
- - #define NULL ((void *)0)
- - #endif
- #define NEWBUFSIZ 16384L
-
- char mybuf[NEWBUFSIZ];
- --- 49,54 ----
- ***************
- *** 58,67 ****
- char tmpname[128];
-
- #define SYMLEN 8
-
- ! typedef char symstr_t[SYMLEN];
- ! symstr_t stklist[] = {{'_', '_', 's', 't', 'k', 's', 'i', 'z',},
- ! {'\0'}};
-
- #ifdef atarist
- long _stksize = 1L;
- --- 55,64 ----
- char tmpname[128];
-
- #define SYMLEN 8
- + #define GST_SYMLEN 22
-
- ! typedef char symstr_t[GST_SYMLEN];
- ! symstr_t stklist[] = {"__stksize", "__initial_stack"};
-
- #ifdef atarist
- long _stksize = 1L;
- ***************
- *** 124,130 ****
- --argc;
- argv++;
- }
- ! if ((symstr_t *) 0 == (nmlist = mklist (*argv)))
- usage ("cannot create a list of reserved names\r\n");
- select = sel_listed;
- break;
- --- 121,127 ----
- --argc;
- argv++;
- }
- ! if ((symstr_t *) NULL == (nmlist = mklist (*argv)))
- usage ("cannot create a list of reserved names\r\n");
- select = sel_listed;
- break;
- ***************
- *** 227,233 ****
-
- #if !__STDC__ && !__cplusplus
- # ifndef offsetof
- ! # define offsetof(TYPE, MEMBER) ((unsigned long) &((TYPE *)0)->MEMBER)
- # endif
- # ifndef CROSSHPUX
- typedef unsigned long size_t;
- --- 224,230 ----
-
- #if !__STDC__ && !__cplusplus
- # ifndef offsetof
- ! # define offsetof(TYPE, MEMBER) ((unsigned long) &((TYPE *)0L)->MEMBER)
- # endif
- # ifndef CROSSHPUX
- typedef unsigned long size_t;
- ***************
- *** 305,311 ****
- close (fd);
- return 0x80;
- }
- ! if ((long(*)())0 == select) { /* remove whole symbol table */
- lbytes = 0L;
- if (lseek (fd, sbytes, 1) < 0) {
- report (name);
- --- 302,308 ----
- close (fd);
- return 0x80;
- }
- ! if (NULL == select) { /* remove whole symbol table */
- lbytes = 0L;
- if (lseek (fd, sbytes, 1) < 0) {
- report (name);
- ***************
- *** 410,416 ****
- char * fname;
- {
- FILE *fp;
- ! symstr_t *list = (symstr_t *) 0;
- int left = 0;
- int pos = 0;
- int i;
- --- 407,413 ----
- char * fname;
- {
- FILE *fp;
- ! symstr_t *list = (symstr_t *) NULL;
- int left = 0;
- int pos = 0;
- int i;
- ***************
- *** 418,424 ****
- --- 415,425 ----
- char lbuf[LBUFSIZE];
- char *in, *out;
-
- + #ifdef atarist
- + if (NULL == (fp = fopen (fname, "rt"))) {
- + #else
- if (NULL == (fp = fopen (fname, "r"))) {
- + #endif
- report (fname);
- report (" -- ");
- usage ("cannot open this file\r\n");
- ***************
- *** 427,433 ****
- while (NULL != fgets (lbuf, LBUFSIZE, fp)) {
- if (0 == left) {
- max_size += NMSTEP;
- ! if ((symstr_t *)0 == list) {
- list = (symstr_t *) malloc ( max_size * sizeof (symstr_t));
- }
- else {
- --- 428,434 ----
- while (NULL != fgets (lbuf, LBUFSIZE, fp)) {
- if (0 == left) {
- max_size += NMSTEP;
- ! if ((symstr_t *) NULL == list) {
- list = (symstr_t *) malloc ( max_size * sizeof (symstr_t));
- }
- else {
- ***************
- *** 435,441 ****
- max_size * sizeof (symstr_t));
-
- }
- ! if ((symstr_t *)0 == list) {
- report ("out of memory making symbol list\r\n");
- exit (-3);
- }
- --- 436,442 ----
- max_size * sizeof (symstr_t));
-
- }
- ! if ((symstr_t *) NULL == list) {
- report ("out of memory making symbol list\r\n");
- exit (-3);
- }
- ***************
- *** 448,456 ****
- if ('\n' == *in)
- continue; /* empty line - skip it */
- out = &list[pos][0];
- ! for (i = SYMLEN; i > 0; --i) {
- if ('\n' == *in || ' ' == *in || '\t' == *in) {
- ! *out = '\0';
- break;
- }
- *out++ = *in++;
- --- 449,457 ----
- if ('\n' == *in)
- continue; /* empty line - skip it */
- out = &list[pos][0];
- ! for (i = GST_SYMLEN; i > 0; --i) {
- if ('\n' == *in || ' ' == *in || '\t' == *in) {
- ! while (i-- > 0) *out++ = '\0';
- break;
- }
- *out++ = *in++;
- ***************
- *** 458,464 ****
- pos++;
- --left;
- } /* while */
- ! if ((symstr_t *)0 != list) {
- list[pos][0] = '\0'; /* terminate created list */
- }
- return (list);
- --- 459,465 ----
- pos++;
- --left;
- } /* while */
- ! if ((symstr_t *) NULL != list) {
- list[pos][0] = '\0'; /* terminate created list */
- }
- return (list);
- ***************
- *** 530,536 ****
- symstr_t *kname;
- struct asym cur_sym, spare;
-
- ! if ((symstr_t *) 0 == nmlist)
- return (0L);
-
- while (sbytes) {
- --- 531,537 ----
- symstr_t *kname;
- struct asym cur_sym, spare;
-
- ! if ((symstr_t *) NULL == nmlist)
- return (0L);
-
- while (sbytes) {
- ***************
- *** 541,548 ****
- }
- for (kname = nmlist; '\0' != **kname; kname++) {
- if (0 == strncmp (&(*kname)[0], &cur_sym.a_name[0], SYMLEN)) {
- ! if (A_LNAM & cur_sym.a_type) { /* if extended */
- ! cur_sym.a_type ^= A_LNAM;
- if ((long)SIZEOF_ASYM != lread (fd, &spare,
- (long)SIZEOF_ASYM)) {
- report ("error on reading symbol table\r\n");
- --- 542,548 ----
- }
- for (kname = nmlist; '\0' != **kname; kname++) {
- if (0 == strncmp (&(*kname)[0], &cur_sym.a_name[0], SYMLEN)) {
- ! if ((A_LNAM & cur_sym.a_type) == A_LNAM) { /* if extended */
- if ((long)SIZEOF_ASYM != lread (fd, &spare,
- (long)SIZEOF_ASYM)) {
- report ("error on reading symbol table\r\n");
- ***************
- *** 549,554 ****
- --- 549,557 ----
- goto leave; /* skip two loop levels */
- }
- sbytes -= SIZEOF_ASYM;
- + if (strncmp (&(*kname)[SYMLEN], (char *)&spare,
- + GST_SYMLEN-SYMLEN))
- + continue;
- }
- if ((long)SIZEOF_ASYM != lwrite (tfd, &cur_sym,
- (long)SIZEOF_ASYM)) {
- ***************
- *** 555,560 ****
- --- 558,572 ----
- report ("error on writing symbol table\r\n");
- goto leave;
- }
- + if ((cur_sym.a_type & A_LNAM) == A_LNAM)
- + {
- + if (lwrite (tfd, &spare, (long)SIZEOF_ASYM) != SIZEOF_ASYM)
- + {
- + report ("error on writing symbol table\r\n");
- + goto leave;
- + }
- + lbytes += SIZEOF_ASYM;
- + }
- lbytes += SIZEOF_ASYM;
- break;
- }
- ***************
- *** 564,570 ****
- leave:
- if (nmlist != stklist) {
- free (nmlist);
- ! nmlist = (symstr_t *) 0;
- }
- return (lbytes);
- }
- --- 576,582 ----
- leave:
- if (nmlist != stklist) {
- free (nmlist);
- ! nmlist = (symstr_t *) NULL;
- }
- return (lbytes);
- }
- *** 1.17 1992/03/22 21:44:03
- --- sym-ld.c 1992/04/19 17:00:19
- ***************
- *** 175,180 ****
- --- 175,183 ----
- # include <unistd.h>
- # endif
- #endif /* atarist */
- +
- + #define ONLY_SYMBOLS
- +
- #endif
-
- /* If compiled with GNU C, use the built-in alloca */
- ***************
- *** 3439,3444 ****
- --- 3442,3449 ----
- /* Output the a.out header. */
- write_header ();
-
- + /* for the atari, we only want the symbols */
- + #if !defined(ONLY_SYMBOLS)
- /* Output the text and data segments, relocating as we go. */
- write_text ();
- write_data ();
- ***************
- *** 3446,3451 ****
- --- 3451,3457 ----
- /* Output the merged relocation info, if requested with `-r'. */
- if (relocatable_output)
- write_rel ();
- + #endif
-
- /* Output the symbol table (both globals and locals). */
- write_syms ();
- ***************
- *** 3466,3474 ****
- --- 3472,3486 ----
- write_header ()
- {
- outheader.a_info = magic;
- + #if defined(ONLY_SYMBOLS)
- + outheader.a_text = 0;
- + outheader.a_data = 0;
- + outheader.a_bss = 0;
- + #else
- outheader.a_text = text_size;
- outheader.a_data = data_size;
- outheader.a_bss = bss_size;
- + #endif
- outheader.a_entry = (entry_symbol ? entry_symbol->value
- : text_start + entry_offset);
- #ifdef COFF_ENCAPSULATE
- ***************
- *** 3592,3597 ****
- --- 3604,3610 ----
- #endif
- }
-
- + #if !defined(ONLY_SYMBOLS)
- /* Relocate the text segment of each input file
- and write to the output file. */
-
- ***************
- *** 3614,3619 ****
- --- 3627,3633 ----
-
- padfile (text_pad, outdesc);
- }
- + #endif /* !ONLY_SYMBOLS */
-
- int
- text_offset (entry)
- ***************
- *** 3670,3675 ****
- --- 3684,3691 ----
- }
- }
-
- + #if !defined(ONLY_SYMBOLS)
- +
- /* Read the text segment contents of ENTRY, relocate them,
- and write the result to the output file.
- If `-r', save the text relocation for later reuse. */
- ***************
- *** 4073,4078 ****
- --- 4089,4096 ----
- }
- mywrite (entry->datarel, 1, entry->header.a_drsize, outdesc);
- }
- +
- + #endif /* !ONLY_SYMBOLS */
-
- void write_file_syms ();
- void write_string_table ();
-