mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-03-03 11:03:14 +01:00
Factor out the code to find gcc, and add a command-line option to override the
default executable name. This should help cross-compilation by allowing a cross-gcc to be specified from the configuration file instead of only through the CC environment variable.
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
#include "gen/logger.h"
|
||||
#include "gen/cl_options.h"
|
||||
#include "gen/optimizer.h"
|
||||
#include "gen/programs.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -216,25 +217,16 @@ int linkObjToExecutable(const char* argv0)
|
||||
// error string
|
||||
std::string errstr;
|
||||
|
||||
const char *cc;
|
||||
#if !_WIN32
|
||||
cc = getenv("CC");
|
||||
if (!cc)
|
||||
#endif
|
||||
cc = "gcc";
|
||||
|
||||
// find gcc for linking
|
||||
llvm::sys::Path gcc = llvm::sys::Program::FindProgramByName(cc);
|
||||
if (gcc.isEmpty())
|
||||
{
|
||||
gcc.set(cc);
|
||||
}
|
||||
llvm::sys::Path gcc = getGcc();
|
||||
// get a string version for argv[0]
|
||||
std::string gccStr = gcc.toString();
|
||||
|
||||
// build arguments
|
||||
std::vector<const char*> args;
|
||||
|
||||
// first the program name ??
|
||||
args.push_back(cc);
|
||||
args.push_back(gccStr.c_str());
|
||||
|
||||
// object files
|
||||
for (int i = 0; i < global.params.objfiles->dim; i++)
|
||||
|
||||
Reference in New Issue
Block a user