fixed byte order in 'desc' field

This commit is contained in:
ceriel 1990-12-19 11:23:25 +00:00
parent 6cc07a7651
commit 5926babe03

View file

@ -453,6 +453,16 @@ cvlong(l)
*p++ = x >> 24; *p++ = x >> 24;
} }
cvshort(s)
short *s;
{
int x = *s;
char *p = (char *) s;
*p++ = x;
*p = x >> 8;
}
int int
is_rest_local(A, i) is_rest_local(A, i)
register int i; register int i;
@ -489,7 +499,8 @@ emit_symtab()
ACKnames = A; ACKnames = A;
for (; i; i--, A++) { for (; i; i--, A++) {
M->value = A->on_valu; M->value = A->on_valu;
if (A->on_type & S_SCT || M->desc = A->on_desc;
if ((A->on_type & S_SCT) ||
(A->on_type & S_ETC) == S_FIL) { (A->on_type & S_ETC) == S_FIL) {
static int rest_local; static int rest_local;
if (! unresolved || rest_local || (rest_local = is_rest_local(A, i))) { if (! unresolved || rest_local || (rest_local = is_rest_local(A, i))) {
@ -497,7 +508,10 @@ emit_symtab()
continue; continue;
} }
} }
if (A->on_type & S_COM) { if (A->on_type & S_STB) {
M->type = A->on_type >> 8;
}
else if (A->on_type & S_COM) {
M->type = N_UNDF | N_EXT; M->type = N_UNDF | N_EXT;
} }
else switch(A->on_type & S_TYP) { else switch(A->on_type & S_TYP) {
@ -560,6 +574,7 @@ emit_symtab()
else M->name = outhead.oh_nchar + 3; /* pointer to nullbyte */ else M->name = outhead.oh_nchar + 3; /* pointer to nullbyte */
cvlong(&(M->name)); cvlong(&(M->name));
cvlong(&(M->value)); cvlong(&(M->value));
cvshort(&(M->desc));
} }
writef(MACHnames, sizeof(struct sym), (long) outhead.oh_nname); writef(MACHnames, sizeof(struct sym), (long) outhead.oh_nname);
free(MACHnames); free(MACHnames);