shithub: scc

Download patch

ref: f12340649ae0ee8b3e2f5ccdb2fcdaf10ec7bf67
parent: babb36b25d4bb677fbebbd21209d6b5cbbee8669
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Sat Aug 24 11:19:14 EDT 2019

[libmach] Rework of Objsym structure

The main purpose of this rework is to get rid of Obj prefixed
types and simplify the interface of the library.

--- a/include/scc/scc/mach.h
+++ b/include/scc/scc/mach.h
@@ -30,10 +30,13 @@
 
 struct objsym {
 	char *name;
-	int type;
-	int sec;
 	unsigned long long size;
 	unsigned long long value;
+	void *aux;
+	int index;
+	char class;
+	char type;
+
 	Objsym *next, *hash;
 };
 
--- a/src/cmd/ld/pass3.c
+++ b/src/cmd/ld/pass3.c
@@ -22,11 +22,11 @@
 			 * we have an error in our code.
 			 */
 			aux = lookup(sym->name);
-			aux->value += obj->secs[sym->sec].base;
+			aux->value += obj->secs[sym->index].base;
 		case 't':
 		case 'd':
 		case 'b':
-			sym->value += obj->secs[sym->sec].base;
+			sym->value += obj->secs[sym->index].base;
 		case 'U':
 		case 'N':
 		case '?':
--- a/src/libmach/coff32/coff32read.c
+++ b/src/libmach/coff32/coff32read.c
@@ -513,7 +513,7 @@
 		sym->type = t;
 		sym->value = ent->n_value;
 		sym->size = (sym->type == 'C') ? ent->n_value : 0;
-		sym->sec = ent->n_scnum-1;
+		sym->index = ent->n_scnum-1;
 	}
 
 	return i;