Fix symfind.
authorLaurent Desnogues <laurent.desnogues@gmail.com>
Thu, 30 Jul 2009 17:23:49 +0000 (19:23 +0200)
committerAnthony Liguori <aliguori@us.ibm.com>
Mon, 10 Aug 2009 18:05:25 +0000 (13:05 -0500)
this patch fixes an issue in symfind.

Assume you have the following symbols:

Address  Size
0045bca0 00000080 T s0
0045bd20 00000112 T s1

You'll notice that s1 is s0 + size.

So the current symfind will find that address 0045bd20 belongs to s0
instead of s1.

Laurent

Signed-off-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Message-Id:

elf_ops.h
linux-user/elfload.c

index 699651c9e157d6ec8cfefcd77bc4e147f025b5bd..15928cbb5b2b98e60382ec6e63c5ed432b6c9783 100644 (file)
--- a/elf_ops.h
+++ b/elf_ops.h
@@ -67,7 +67,7 @@ static int glue(symfind, SZ)(const void *s0, const void *s1)
     int result = 0;
     if (key->st_value < sym->st_value) {
         result = -1;
-    } else if (key->st_value > sym->st_value + sym->st_size) {
+    } else if (key->st_value >= sym->st_value + sym->st_size) {
         result = 1;
     }
     return result;
index a38167d3339e29070477c88d5ae008b8266741fd..4f04b98287a2555747f2685e4e699d0622d279e0 100644 (file)
@@ -1199,7 +1199,7 @@ static int symfind(const void *s0, const void *s1)
     int result = 0;
     if (key->st_value < sym->st_value) {
         result = -1;
-    } else if (key->st_value > sym->st_value + sym->st_size) {
+    } else if (key->st_value >= sym->st_value + sym->st_size) {
         result = 1;
     }
     return result;