Pass -export-dynamic to gcc when compiling with -native and the link is
performed with -export-dynamic (aka. -disable-internalize).
Patch by Nicholas Riley!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22601 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/gccld/GenerateCode.cpp b/tools/gccld/GenerateCode.cpp
index 56aaf7d..fa4a8fd 100644
--- a/tools/gccld/GenerateCode.cpp
+++ b/tools/gccld/GenerateCode.cpp
@@ -325,8 +325,7 @@
return sys::Program::ExecuteAndWait(llc, &args[0]);
}
-/// GenerateAssembly - generates a native assembly language source file from the
-/// specified bytecode file.
+/// GenerateCFile - generates a C source file from the specified bytecode file.
int llvm::GenerateCFile(const std::string &OutputFile,
const std::string &InputFile,
const sys::Path &llc,
@@ -344,8 +343,8 @@
return sys::Program::ExecuteAndWait(llc, &args[0]);
}
-/// GenerateNative - generates a native assembly language source file from the
-/// specified assembly source file.
+/// GenerateNative - generates a native executable file from the specified
+/// assembly source file.
///
/// Inputs:
/// InputFilename - The name of the output bytecode file.
@@ -365,6 +364,7 @@
const std::vector<std::string> &Libraries,
const sys::Path &gcc, char ** const envp,
bool Shared,
+ bool ExportAllAsDynamic,
const std::string &RPath,
const std::string &SOName,
bool Verbose) {
@@ -400,6 +400,7 @@
args.push_back(InputFilename.c_str());
if (Shared) args.push_back("-shared");
+ if (ExportAllAsDynamic) args.push_back("-export-dynamic");
if (!RPath.empty()) {
std::string rp = "-Wl,-rpath," + RPath;
args.push_back(rp.c_str());