ref: 67d90c41c1d5ef13d67cc0a3ce2bd7de1cc53037
parent: 6ce3d85eb82efc253c36de268867cb8e22ea812f
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Tue Dec 12 05:48:58 EST 2017
[as] Preserve order of the symbols in the output file It is a bit annoying to have the symbols in inverse state, and for this reason the link insertion strategy is changed.
--- a/as/symbol.c
+++ b/as/symbol.c
@@ -41,7 +41,7 @@
static Symbol *hashtbl[HASHSIZ];
static Alloc *tmpalloc;
-Symbol *linesym, *symlist;
+Symbol *linesym, *symlist, *symlast;
#ifndef NDEBUG
void
@@ -95,9 +95,16 @@
sym->value = 0;
sym->section = cursec;
sym->hash = *list;
- sym->next = symlist;
+ sym->next = NULL;
- return symlist = *list = sym;
+ *list = sym;
+ if (symlast)
+ symlast->next = sym;
+ symlast = sym;
+ if (!symlist)
+ symlist = sym;
+
+ return sym;
}
Symbol *