If a module has a main, but it is defined externally, refuse to run it.
authorChris Lattner <sabre@nondot.org>
Thu, 1 Dec 2005 22:48:23 +0000 (22:48 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 1 Dec 2005 22:48:23 +0000 (22:48 +0000)
Attempting to run it will find lli's main, which isn't the desired effect.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24569 91177308-0d34-0410-b5e6-96231b3b80d8

tools/lli/lli.cpp

index c1b7478a3769ba4372eeac91b6378c46c0ce4ab2..93eb6fce5d1dea6c18cecca3f60848736e6ea4df 100644 (file)
@@ -85,7 +85,7 @@ int main(int argc, char **argv, char * const *envp) {
     // EnvVars to determine envp.
     //
     Function *Fn = MP->getModule()->getMainFunction();
-    if (!Fn) {
+    if (!Fn || Fn->isExternal()) {
       std::cerr << "'main' function not found in module.\n";
       return -1;
     }