- Adopt patch from git repo to fix fuild with LLVM 3.1

This commit is contained in:
Dima Panov 2012-06-26 10:13:38 +00:00
parent 6da7053383
commit 29b3026f4a
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=299998
2 changed files with 89 additions and 0 deletions

View File

@ -7,6 +7,7 @@
PORTNAME= clay
PORTVERSION= 0.1.1
PORTREVISION= 1
CATEGORIES= lang
MASTER_SITES= https://github.com/jckarter/${PORTNAME}/tarball/v${PORTVERSION}/
DISTNAME= jckarter-${PORTNAME}-v${PORTVERSION}-0-g${GITVERSION}

View File

@ -0,0 +1,88 @@
diff --git ./CMakeLists.txt ./CMakeLists.txt
index fce24ac..dabedff 100644
--- ./CMakeLists.txt
+++ ./CMakeLists.txt
@@ -23,8 +23,8 @@ if(UNIX)
OUTPUT_VARIABLE LLVM_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
- if(NOT ${LLVM_VERSION} STREQUAL "3.0")
- message(FATAL_ERROR "Clay requires LLVM 3.0.")
+ if(NOT ${LLVM_VERSION} STREQUAL "3.1")
+ message(FATAL_ERROR "Clay requires LLVM 3.1.")
endif()
execute_process(
diff --git ./compiler/src/codegen.cpp ./compiler/src/codegen.cpp
index fb66668..59055b9 100644
--- ./compiler/src/codegen.cpp
+++ ./compiler/src/codegen.cpp
@@ -956,9 +956,7 @@
case STRING_LITERAL : {
StringLiteral *x = (StringLiteral *)expr.ptr();
llvm::Constant *initializer =
- llvm::ConstantArray::get(llvm::getGlobalContext(),
- x->value,
- true);
+ llvm::ConstantDataArray::getString(llvm::getGlobalContext(), x->value, true);
TypePtr type = arrayType(int8Type, x->value.size() + 1);
ostringstream symbolName;
symbolName << "StringConstant " << x->value << " clay";
@@ -2775,7 +2773,7 @@
if(!llvm::ParseAssembly(buf, llvmModule, err,
llvm::getGlobalContext())) {
- err.Print("\n", out);
+ err.print("\n", out);
std::cerr << out.str() << std::endl;
error("llvm assembly parse error");
}
@@ -6151,7 +6149,7 @@
llvm::getGlobalContext())) {
string errBuf;
llvm::raw_string_ostream errOut(errBuf);
- err.Print("\n", errOut);
+ err.print("\n", errOut);
std::cerr << errOut.str() << std::endl;
error("llvm assembly parse error");
}
@@ -6459,7 +6457,7 @@
llvm::CodeModel::Model codeModel = llvm::CodeModel::Default;
llvm::TargetMachine *targetMachine = target->createTargetMachine(
- targetTriple, "", "", reloc, codeModel);
+ targetTriple, "", "", llvm::TargetOptions(), reloc, codeModel);
if (targetMachine != NULL) {
llvmTargetData = targetMachine->getTargetData();
diff --git ./compiler/src/main.cpp ./compiler/src/main.cpp
index 9e73160..85941b9 100644
--- ./compiler/src/main.cpp
+++ ./compiler/src/main.cpp
@@ -119,7 +119,7 @@ static void generateAssembly(llvm::Module *module,
bool debug)
{
if (optLevel < 2 || debug)
- llvm::NoFramePointerElim = true;
+ targetMachine->Options.NoFramePointerElim = 1;
llvm::FunctionPassManager fpasses(module);
@@ -366,7 +366,7 @@ int main2(int argc, char **argv, char const* const* envp) {
string clayFile;
string outputFile;
- string targetTriple = llvm::sys::getHostTriple();
+ string targetTriple = llvm::sys::getDefaultTargetTriple();
string clayScriptImports;
string clayScript;
@@ -553,7 +553,7 @@ int main2(int argc, char **argv, char const* const* envp) {
llvm::errs() << "error: target name missing after -target\n";
return 1;
}
- crossCompiling = targetTriple != llvm::sys::getHostTriple();
+ crossCompiling = targetTriple != llvm::sys::getDefaultTargetTriple();
}
else if (strstr(argv[i], "-Wl") == argv[i]) {
linkerFlags += argv[i] + strlen("-Wl");