[Native] Drop explicit -fPIC flag setup
We don't need to explicitly set -fPIC flag everywhere
because since d82109cc92
it is set by default for all ClangArgs users.
This commit is contained in:
@@ -46,9 +46,6 @@ val libclang =
|
|||||||
val cflags = mutableListOf( "-I$llvmDir/include",
|
val cflags = mutableListOf( "-I$llvmDir/include",
|
||||||
"-I${project(":kotlin-native:libclangext").projectDir.absolutePath}/src/main/include",
|
"-I${project(":kotlin-native:libclangext").projectDir.absolutePath}/src/main/include",
|
||||||
*platformManager.hostPlatform.clang.hostCompilerArgsForJni)
|
*platformManager.hostPlatform.clang.hostCompilerArgsForJni)
|
||||||
if (!HostManager.hostIsMingw) {
|
|
||||||
cflags += "-fPIC"
|
|
||||||
}
|
|
||||||
|
|
||||||
val ldflags = mutableListOf("$llvmDir/$libclang", "-L${libclangextDir.absolutePath}", "-lclangext")
|
val ldflags = mutableListOf("$llvmDir/$libclang", "-L${libclangextDir.absolutePath}", "-lclangext")
|
||||||
|
|
||||||
|
|||||||
@@ -4,13 +4,11 @@ headerFilter = clang-c/**
|
|||||||
|
|
||||||
compiler = clang
|
compiler = clang
|
||||||
|
|
||||||
compilerOpts = -std=c99 -fPIC
|
compilerOpts = -std=c99
|
||||||
linkerOpts.linux = -Wl,-z,noexecstack
|
linkerOpts.linux = -Wl,-z,noexecstack
|
||||||
|
|
||||||
linker = clang++
|
linker = clang++
|
||||||
|
|
||||||
linkerOpts = -fPIC
|
|
||||||
|
|
||||||
strictEnums = CXErrorCode CXCursorKind CXTypeKind CXDiagnosticSeverity CXLoadDiag_Error CXSaveError \
|
strictEnums = CXErrorCode CXCursorKind CXTypeKind CXDiagnosticSeverity CXLoadDiag_Error CXSaveError \
|
||||||
CXTUResourceUsageKind CXLinkageKind CXVisibilityKind CXLanguageKind CXCallingConv CXChildVisitResult \
|
CXTUResourceUsageKind CXLinkageKind CXVisibilityKind CXLanguageKind CXCallingConv CXChildVisitResult \
|
||||||
CXTokenKind CXEvalResultKind CXVisitorResult CXResult CXIdxEntityKind
|
CXTokenKind CXEvalResultKind CXVisitorResult CXResult CXIdxEntityKind
|
||||||
|
|||||||
@@ -36,9 +36,6 @@ native {
|
|||||||
val hostLibffiDir = rootProject.project(":kotlin-native").extra["${host}LibffiDir"]
|
val hostLibffiDir = rootProject.project(":kotlin-native").extra["${host}LibffiDir"]
|
||||||
val cflags = mutableListOf("-I$hostLibffiDir/include",
|
val cflags = mutableListOf("-I$hostLibffiDir/include",
|
||||||
*platformManager.hostPlatform.clang.hostCompilerArgsForJni)
|
*platformManager.hostPlatform.clang.hostCompilerArgsForJni)
|
||||||
if (!HostManager.hostIsMingw) {
|
|
||||||
cflags += "-fPIC"
|
|
||||||
}
|
|
||||||
suffixes {
|
suffixes {
|
||||||
(".c" to ".$obj") {
|
(".c" to ".$obj") {
|
||||||
tool(*platformManager.hostPlatform.clang.clangC("").toTypedArray())
|
tool(*platformManager.hostPlatform.clang.clangC("").toTypedArray())
|
||||||
|
|||||||
@@ -49,17 +49,11 @@ kotlinNativeInterop {
|
|||||||
dependsOn ":kotlin-native:llvmDebugInfoC:${NativePluginKt.lib("debugInfo")}"
|
dependsOn ":kotlin-native:llvmDebugInfoC:${NativePluginKt.lib("debugInfo")}"
|
||||||
dependsOn ":kotlin-native:llvmCoverageMappingC:${NativePluginKt.lib("coverageMapping")}"
|
dependsOn ":kotlin-native:llvmCoverageMappingC:${NativePluginKt.lib("coverageMapping")}"
|
||||||
defFile 'llvm.def'
|
defFile 'llvm.def'
|
||||||
if (!project.parent.convention.plugins.platformInfo.isWindows())
|
|
||||||
compilerOpts "-fPIC"
|
|
||||||
compilerOpts "-I$llvmDir/include", "-I${rootProject.project(':kotlin-native:llvmDebugInfoC').projectDir}/src/main/include", "-I${rootProject.project(':kotlin-native:llvmCoverageMappingC').projectDir}/src/main/include"
|
compilerOpts "-I$llvmDir/include", "-I${rootProject.project(':kotlin-native:llvmDebugInfoC').projectDir}/src/main/include", "-I${rootProject.project(':kotlin-native:llvmCoverageMappingC').projectDir}/src/main/include"
|
||||||
linkerOpts "-L$llvmDir/lib", "-L${rootProject.project(':kotlin-native:llvmDebugInfoC').buildDir}", "-L${rootProject.project(':kotlin-native:llvmCoverageMappingC').buildDir}"
|
linkerOpts "-L$llvmDir/lib", "-L${rootProject.project(':kotlin-native:llvmDebugInfoC').buildDir}", "-L${rootProject.project(':kotlin-native:llvmCoverageMappingC').buildDir}"
|
||||||
}
|
}
|
||||||
|
|
||||||
files {
|
files {
|
||||||
if (!project.project(":kotlin-native").convention.plugins.platformInfo.isWindows()) {
|
|
||||||
compilerOpts '-fPIC'
|
|
||||||
linkerOpts '-fPIC'
|
|
||||||
}
|
|
||||||
linker 'clang++'
|
linker 'clang++'
|
||||||
linkOutputs ":kotlin-native:common:${hostName}Files"
|
linkOutputs ":kotlin-native:common:${hostName}Files"
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ linkerOpts = -fvisibility-inlines-hidden \
|
|||||||
-ldebugInfo -lcoverageMapping
|
-ldebugInfo -lcoverageMapping
|
||||||
|
|
||||||
# ./llvm-config --libs analysis bitreader bitwriter core linker target coverage analysis ipo instrumentation lto objcarcopts arm aarch64 webassembly x86 mips
|
# ./llvm-config --libs analysis bitreader bitwriter core linker target coverage analysis ipo instrumentation lto objcarcopts arm aarch64 webassembly x86 mips
|
||||||
linkerOpts.osx = -fPIC \
|
linkerOpts.osx = \
|
||||||
-Wl,-search_paths_first -Wl,-headerpad_max_install_names \
|
-Wl,-search_paths_first -Wl,-headerpad_max_install_names \
|
||||||
-lpthread -lz -lm -lcurses -Wl,-U,_futimens -Wl,-U,_LLVMDumpType \
|
-lpthread -lz -lm -lcurses -Wl,-U,_futimens -Wl,-U,_LLVMDumpType \
|
||||||
-Wl,-exported_symbols_list,llvm.list \
|
-Wl,-exported_symbols_list,llvm.list \
|
||||||
@@ -41,7 +41,7 @@ linkerOpts.osx = -fPIC \
|
|||||||
|
|
||||||
|
|
||||||
# ./llvm-config --libs analysis bitreader bitwriter core linker target coverage analysis ipo instrumentation lto arm aarch64 webassembly x86 mips
|
# ./llvm-config --libs analysis bitreader bitwriter core linker target coverage analysis ipo instrumentation lto arm aarch64 webassembly x86 mips
|
||||||
linkerOpts.linux = -fPIC \
|
linkerOpts.linux = \
|
||||||
-Wl,-z,noexecstack \
|
-Wl,-z,noexecstack \
|
||||||
-lrt -ldl -lpthread -lz -lm \
|
-lrt -ldl -lpthread -lz -lm \
|
||||||
-lLLVMMipsDisassembler -lLLVMMipsCodeGen -lLLVMMipsAsmParser -lLLVMMipsDesc -lLLVMMipsInfo -lLLVMMipsAsmPrinter \
|
-lLLVMMipsDisassembler -lLLVMMipsCodeGen -lLLVMMipsAsmParser -lLLVMMipsDesc -lLLVMMipsInfo -lLLVMMipsAsmPrinter \
|
||||||
|
|||||||
+1
-1
@@ -92,7 +92,7 @@ open class CompileToBitcode @Inject constructor(
|
|||||||
listOfNotNull("-std=c++17", "-Werror", "-O2",
|
listOfNotNull("-std=c++17", "-Werror", "-O2",
|
||||||
"-Wall", "-Wextra",
|
"-Wall", "-Wextra",
|
||||||
"-Wno-unused-parameter", // False positives with polymorphic functions.
|
"-Wno-unused-parameter", // False positives with polymorphic functions.
|
||||||
"-fPIC".takeIf { !HostManager().targetByName(target).isMINGW })
|
)
|
||||||
}
|
}
|
||||||
return commonFlags + sanitizerFlags + languageFlags + compilerArgs
|
return commonFlags + sanitizerFlags + languageFlags + compilerArgs
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,9 +31,6 @@ native {
|
|||||||
"-Isrc/main/include",
|
"-Isrc/main/include",
|
||||||
"-I${project.findProperty("llvmDir")}/include",
|
"-I${project.findProperty("llvmDir")}/include",
|
||||||
"-DLLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING=1")
|
"-DLLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING=1")
|
||||||
if (!org.jetbrains.kotlin.konan.target.HostManager.hostIsMingw) {
|
|
||||||
cxxflags += "-fPIC"
|
|
||||||
}
|
|
||||||
if (libclangextEnabled) {
|
if (libclangextEnabled) {
|
||||||
cxxflags += "-DLIBCLANGEXT_ENABLE=1"
|
cxxflags += "-DLIBCLANGEXT_ENABLE=1"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,9 +45,6 @@ native {
|
|||||||
cxxflags += "-DKONAN_MACOS=1"
|
cxxflags += "-DKONAN_MACOS=1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!HostManager.hostIsMingw) {
|
|
||||||
cxxflags += "-fPIC"
|
|
||||||
}
|
|
||||||
suffixes {
|
suffixes {
|
||||||
(".cpp" to ".$obj") {
|
(".cpp" to ".$obj") {
|
||||||
tool(*platformManager.hostPlatform.clang.clangCXX("").toTypedArray())
|
tool(*platformManager.hostPlatform.clang.clangCXX("").toTypedArray())
|
||||||
|
|||||||
@@ -35,9 +35,6 @@ native {
|
|||||||
"-I${llvmDir}/include",
|
"-I${llvmDir}/include",
|
||||||
"-I${projectDir}/src/main/include"
|
"-I${projectDir}/src/main/include"
|
||||||
)
|
)
|
||||||
if (!HostManager.hostIsMingw) {
|
|
||||||
cxxflags += "-fPIC"
|
|
||||||
}
|
|
||||||
suffixes {
|
suffixes {
|
||||||
(".cpp" to ".$obj") {
|
(".cpp" to ".$obj") {
|
||||||
tool(*platformManager.hostPlatform.clang.clangCXX("").toTypedArray())
|
tool(*platformManager.hostPlatform.clang.clangCXX("").toTypedArray())
|
||||||
|
|||||||
Reference in New Issue
Block a user