DEBUGINFO: makes debug info stab usable from konan compiler

This commit is contained in:
Vasily Levchenko
2017-04-14 16:27:44 +03:00
committed by vvlevchenko
parent 05c25e4e0a
commit 84d62eb471
4 changed files with 8 additions and 30 deletions
+7 -17
View File
@@ -128,12 +128,11 @@ List<String> llvmLinkerOpts() {
'-lLLVMCore', '-lLLVMCore',
'-lLLVMSupport', '-lLLVMSupport',
'-lLLVMDebugInfoCodeView', '-lLLVMDebugInfoCodeView',
'-lLLVMLinker' '-lLLVMLinker',
"-ldebugInfo"
] ]
final List<String> res = new ArrayList<>() final List<String> res = ["-L$llvmDir/lib", "-L${project(':llvmDebugInfoC').buildDir}/libs/debugInfo/static"]
res << "-L$llvmDir/lib"
if (isLinux()) { if (isLinux()) {
res.addAll(["-Wl,-Bstatic", "-Wl,--whole-archive"] res.addAll(["-Wl,-Bstatic", "-Wl,--whole-archive"]
@@ -146,20 +145,13 @@ List<String> llvmLinkerOpts() {
return res return res
} }
kotlinNativeInterop { kotlinNativeInterop {
llvm { llvm {
defFile 'llvm.def'
compilerOpts "-fPIC", "-I$llvmDir/include"
linkerOpts llvmLinkerOpts()
}
debugInfo {
dependsOn ":llvmDebugInfoC:debugInfoStaticLibrary" dependsOn ":llvmDebugInfoC:debugInfoStaticLibrary"
defFile '../llvmDebugInfoC/debugInfo.def' defFile 'llvm.def'
compilerOpts "-fPIC", "-I$llvmDir/include", "-I${project(':llvmDebugInfoC').projectDir}/src/main/include" compilerOpts "-fPIC", "-I$llvmDir/include", "-I${project(':llvmDebugInfoC').projectDir}/src/main/include"
if (isLinux()) { linkerOpts llvmLinkerOpts()
linker 'clang++'
}
} }
hash { // TODO: copy-pasted from ':common:compileHash' hash { // TODO: copy-pasted from ':common:compileHash'
@@ -193,7 +185,6 @@ dependencies {
compilerCompile kotlinCompilerModule compilerCompile kotlinCompilerModule
compilerCompile kotlinNativeInterop['llvm'].configuration compilerCompile kotlinNativeInterop['llvm'].configuration
compilerCompile kotlinNativeInterop['hash'].configuration compilerCompile kotlinNativeInterop['hash'].configuration
compilerCompile kotlinNativeInterop['debugInfo'].configuration
cli_bcCompile "org.jetbrains.kotlin:kotlin-runtime:$kotlin_version" cli_bcCompile "org.jetbrains.kotlin:kotlin-runtime:$kotlin_version"
cli_bcCompile sourceSets.compiler.output cli_bcCompile sourceSets.compiler.output
@@ -274,8 +265,7 @@ task jars(type: Jar) {
from 'build/classes/cli_bc', from 'build/classes/cli_bc',
'build/classes/compiler', 'build/classes/compiler',
'build/classes/hashInteropStubs', 'build/classes/hashInteropStubs',
'build/classes/llvmInteropStubs', 'build/classes/llvmInteropStubs'
'build/classes/debugInfoInteropStubs'
dependsOn 'build', ':runtime:hostRuntime', 'external_jars' dependsOn 'build', ':runtime:hostRuntime', 'external_jars'
} }
+1 -1
View File
@@ -1,5 +1,5 @@
headers = llvm-c/Core.h llvm-c/ExecutionEngine.h llvm-c/Target.h llvm-c/Analysis.h llvm-c/BitWriter.h \ headers = llvm-c/Core.h llvm-c/ExecutionEngine.h llvm-c/Target.h llvm-c/Analysis.h llvm-c/BitWriter.h \
llvm-c/BitReader.h llvm-c/Linker.h llvm-c/BitReader.h llvm-c/Linker.h DebugInfoC.h
compilerOpts = -std=c99 -fPIC \ compilerOpts = -std=c99 -fPIC \
-Wall -W -Wno-unused-parameter -Wwrite-strings -Wmissing-field-initializers \ -Wall -W -Wno-unused-parameter -Wwrite-strings -Wmissing-field-initializers \
-5
View File
@@ -239,11 +239,6 @@ task dist_compiler(type: Copy) {
args '-add_rpath', '@loader_path/', args '-add_rpath', '@loader_path/',
'dist/konan/nativelib/libclangstubs.dylib' 'dist/konan/nativelib/libclangstubs.dylib'
} }
exec {
commandLine "install_name_tool"
args '-add_rpath', '@loader_path/',
'dist/konan/nativelib/libdebugInfostubs.dylib'
}
} }
} }
} }
-7
View File
@@ -1,7 +0,0 @@
headers = DebugInfoC.h
compilerOpts=-fPIC
linkerOpts.osx = -Wl,-all_load -L../llvmDebugInfoC/build/libs/debugInfo/static -ldebugInfo
linkerOpts.linux = --Wl,--whole-archive -L../llvmDebugInfoC/build/libs/debugInfo/static -ldebugInfo --Wl,--no-whole-archive -lLLVMCore -lLLVMSupport
compilerOpts.osx = -IllvmDebugInfoC/include -Idependencies/all/clang+llvm-3.9.0-darwin-macos/include
compilerOpts.linux = -IllvmDebugInfoC/include -Idependencies/all/clang+llvm-3.9.0-linux-x86-64/include