Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 23725
b: refs/heads/master
c: 43c74d1
h: refs/heads/master
i:
  23723: 7cab4a0
v: v3
  • Loading branch information
Sam Ravnborg committed Mar 5, 2006
1 parent fbf34d2 commit 7d85b9f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e835a39c1c1f023ef443f735b0e98b08660ae0e4
refs/heads/master: 43c74d179596ba1f8eceb8c6a5c7e11afe233662
17 changes: 16 additions & 1 deletion trunk/scripts/mod/modpost.c
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,10 @@ static Elf_Sym *find_elf_symbol(struct elf_info *elf, Elf_Addr addr,
}

/*
* Find symbols before or equal addr and after addr - in the section sec
* Find symbols before or equal addr and after addr - in the section sec.
* If we find two symbols with equal offset prefer one with a valid name.
* The ELF format may have a better way to detect what type of symbol
* it is, but this works for now.
**/
static void find_symbols_between(struct elf_info *elf, Elf_Addr addr,
const char *sec,
Expand Down Expand Up @@ -587,13 +590,25 @@ static void find_symbols_between(struct elf_info *elf, Elf_Addr addr,
beforediff = addr - sym->st_value;
*before = sym;
}
else if ((addr - sym->st_value) == beforediff) {
/* equal offset, valid name? */
const char *name = elf->strtab + sym->st_name;
if (name && strlen(name))
*before = sym;
}
}
else
{
if ((sym->st_value - addr) < afterdiff) {
afterdiff = sym->st_value - addr;
*after = sym;
}
else if ((sym->st_value - addr) == afterdiff) {
/* equal offset, valid name? */
const char *name = elf->strtab + sym->st_name;
if (name && strlen(name))
*after = sym;
}
}
}
}
Expand Down

0 comments on commit 7d85b9f

Please sign in to comment.