Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 77987
b: refs/heads/master
c: 9ad21c3
h: refs/heads/master
i:
  77985: 8969303
  77983: 04f2b31
v: v3
  • Loading branch information
Sam Ravnborg committed Jan 28, 2008
1 parent 84a9959 commit cb0475a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 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: d1f25e6658943569f2713dfde1b9d74e2f6c7243
refs/heads/master: 9ad21c3f3ecffeb56be7b35030d7ec2f30b6fe11
19 changes: 17 additions & 2 deletions trunk/scripts/mod/modpost.c
Original file line number Diff line number Diff line change
Expand Up @@ -776,10 +776,13 @@ static int secref_whitelist(const char *modname, const char *tosec,
* In other cases the symbol needs to be looked up in the symbol table
* based on section and address.
* **/
static Elf_Sym *find_elf_symbol(struct elf_info *elf, Elf_Addr addr,
static Elf_Sym *find_elf_symbol(struct elf_info *elf, Elf64_Sword addr,
Elf_Sym *relsym)
{
Elf_Sym *sym;
Elf_Sym *near = NULL;
Elf64_Sword distance = 20;
Elf64_Sword d;

if (relsym->st_name != 0)
return relsym;
Expand All @@ -790,8 +793,20 @@ static Elf_Sym *find_elf_symbol(struct elf_info *elf, Elf_Addr addr,
continue;
if (sym->st_value == addr)
return sym;
/* Find a symbol nearby - addr are maybe negative */
d = sym->st_value - addr;
if (d < 0)
d = addr - sym->st_value;
if (d < distance) {
distance = d;
near = sym;
}
}
return NULL;
/* We need a close match */
if (distance < 20)
return near;
else
return NULL;
}

static inline int is_arm_mapping_symbol(const char *str)
Expand Down
2 changes: 2 additions & 0 deletions trunk/scripts/mod/modpost.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#define Elf_Shdr Elf32_Shdr
#define Elf_Sym Elf32_Sym
#define Elf_Addr Elf32_Addr
#define Elf_Sword Elf64_Sword
#define Elf_Section Elf32_Half
#define ELF_ST_BIND ELF32_ST_BIND
#define ELF_ST_TYPE ELF32_ST_TYPE
Expand All @@ -31,6 +32,7 @@
#define Elf_Shdr Elf64_Shdr
#define Elf_Sym Elf64_Sym
#define Elf_Addr Elf64_Addr
#define Elf_Sword Elf64_Sxword
#define Elf_Section Elf64_Half
#define ELF_ST_BIND ELF64_ST_BIND
#define ELF_ST_TYPE ELF64_ST_TYPE
Expand Down

0 comments on commit cb0475a

Please sign in to comment.