Incorporate more small improvements

This commit is contained in:
Justine Tunney 2023-07-23 10:57:18 -07:00
parent 1d4eb08fa1
commit f83eb440f7
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
20 changed files with 121 additions and 256 deletions

View file

@ -100,8 +100,14 @@ static struct SymbolTable *OpenSymbolTableImpl(const char *filename) {
for (j = i = 0; i < m; ++i) {
sym = symtab + (stp[i] & 0x7fffffff);
x = stp[i] >> 32;
if (j && x == t->symbols[j - 1].x) --j;
if (j && t->symbols[j - 1].y >= x) t->symbols[j - 1].y = x - 1;
if (j && x == t->symbols[j - 1].x) {
// when two symbols have an identical address value, favor the
// symbol that was defined earlier in the elf data structures.
continue;
}
if (j && t->symbols[j - 1].y >= x) {
t->symbols[j - 1].y = x - 1;
}
t->names[j] = sym->st_name;
t->symbols[j].x = x;
if (sym->st_size) {