diff --git a/core/elf.cc b/core/elf.cc
index 7378af41c22f1722e671aeda1cf18ba107dafa93..957ae0a3610a649e1b65187c91fdf8b1edc6f7a6 100644
--- a/core/elf.cc
+++ b/core/elf.cc
@@ -635,10 +635,10 @@ dladdr_info object::lookup_addr(const void* addr)
         }
         symbol_module sm{&sym, this};
         auto s_addr = sm.relocated_addr();
-        if (s_addr < addr) {
+        if (s_addr > addr) {
             continue;
         }
-        if (!best.symbol || sm.relocated_addr() < best.relocated_addr()) {
+        if (!best.symbol || sm.relocated_addr() > best.relocated_addr()) {
             best = sm;
         }
     }