GPLv2 release
[centaur.git] / src / libelfu / modelops / relocate.c
index 7f78524acf962b9af6ce1736376fde770bdbe7dd..c5d56521ad72dbe7090a8c2236243aeb41d22fe8 100644 (file)
@@ -1,3 +1,18 @@
+/* This file is part of centaur.
+ *
+ * centaur is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License 2 as
+ * published by the Free Software Foundation.
+
+ * centaur is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with centaur.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
 #include <assert.h>
 #include <stdlib.h>
 #include <string.h>
@@ -36,8 +51,11 @@ int elfu_mRelocate(ElfuElf *metarget, ElfuScn *mstarget, ElfuScn *msrt)
         haveSymval = !elfu_mDynLookupPltAddrByName(metarget,
                                      elfu_mSymtabSymToName(msrt->linkptr, sym),
                                      &s);
-      } else if (sym->shndx == SHN_COMMON) {
-        // TODO: Lookup in .rel.dyn
+        if (!haveSymval) {
+          haveSymval = !elfu_mDynLookupReldynAddrByName(metarget,
+                                       elfu_mSymtabSymToName(msrt->linkptr, sym),
+                                       &s);
+        }
       }
     }