Move crt* files location to konan.properties
This commit is contained in:
committed by
Stanislav Erokhin
parent
e6d202a2aa
commit
ecd3ea261c
@@ -413,6 +413,8 @@ linkerDynamicFlags.linux_x64 = -shared
|
||||
dynamicLinker.linux_x64 = /lib64/ld-linux-x86-64.so.2
|
||||
# targetSysRoot relative
|
||||
abiSpecificLibraries.linux_x64 = lib usr/lib ../lib64 lib64 usr/lib64
|
||||
# targetSysRoot relative
|
||||
crtFilesLocation.linux_x64 = usr/lib
|
||||
runtimeDefinitions.linux_x64 = USE_GCC_UNWIND=1 KONAN_LINUX=1 KONAN_X64=1 \
|
||||
USE_ELF_SYMBOLS=1 ELFSIZE=64 KONAN_HAS_CXX11_EXCEPTION_FUNCTIONS=1
|
||||
|
||||
@@ -457,6 +459,8 @@ clangDynamicFlags.linux_arm32_hfp = -mrelocation-model pic
|
||||
dynamicLinker.linux_arm32_hfp = /lib/ld-linux-armhf.so.3
|
||||
# targetSysRoot relative
|
||||
abiSpecificLibraries.linux_arm32_hfp = lib usr/lib
|
||||
# targetSysRoot relative
|
||||
crtFilesLocation.linux_arm32_hfp = usr/lib
|
||||
runtimeDefinitions.linux_arm32_hfp = USE_GCC_UNWIND=1 KONAN_LINUX=1 \
|
||||
KONAN_ARM32=1 USE_ELF_SYMBOLS=1 ELFSIZE=32 KONAN_NO_UNALIGNED_ACCESS=1
|
||||
|
||||
@@ -499,6 +503,8 @@ clangDynamicFlags.linux_arm64 = -mrelocation-model pic
|
||||
dynamicLinker.linux_arm64 = /lib/ld-linux-aarch64.so.1
|
||||
# targetSysRoot relative
|
||||
abiSpecificLibraries.linux_arm64 = lib usr/lib
|
||||
# targetSysRoot relative
|
||||
crtFilesLocation.linux_arm64 = usr/lib
|
||||
runtimeDefinitions.linux_arm64 = USE_GCC_UNWIND=1 KONAN_LINUX=1 KONAN_ARM64=1 \
|
||||
USE_ELF_SYMBOLS=1 ELFSIZE=64
|
||||
|
||||
@@ -531,6 +537,8 @@ clangDynamicFlags.linux_mips32 = -mrelocation-model pic
|
||||
dynamicLinker.linux_mips32 = /lib/ld.so.1
|
||||
# targetSysRoot relative
|
||||
abiSpecificLibraries.linux_mips32 = lib usr/lib
|
||||
# targetSysRoot relative
|
||||
crtFilesLocation.linux_mips32 = usr/lib
|
||||
# TODO: reconsider KONAN_NO_64BIT_ATOMIC, once target MIPS can do proper 64-bit load/store/CAS.
|
||||
runtimeDefinitions.linux_mips32 = USE_GCC_UNWIND=1 KONAN_LINUX=1 KONAN_MIPS32=1 \
|
||||
USE_ELF_SYMBOLS=1 ELFSIZE=32 KONAN_NO_64BIT_ATOMIC=1 KONAN_NO_UNALIGNED_ACCESS=1
|
||||
@@ -564,6 +572,8 @@ clangDynamicFlags.linux_mipsel32 = -mrelocation-model pic
|
||||
dynamicLinker.linux_mipsel32 = /lib/ld.so.1
|
||||
# targetSysRoot relative
|
||||
abiSpecificLibraries.linux_mipsel32 = lib usr/lib
|
||||
# targetSysRoot relative
|
||||
crtFilesLocation.linux_mipsel32 = usr/lib
|
||||
# TODO: reconsider KONAN_NO_64BIT_ATOMIC, once target MIPS can do proper 64-bit load/store/CAS.
|
||||
runtimeDefinitions.linux_mipsel32 = USE_GCC_UNWIND=1 KONAN_LINUX=1 \
|
||||
KONAN_MIPSEL32=1 USE_ELF_SYMBOLS=1 ELFSIZE=32 KONAN_NO_64BIT_ATOMIC=1 KONAN_NO_UNALIGNED_ACCESS=1
|
||||
|
||||
+1
@@ -93,6 +93,7 @@ interface GccConfigurables : TargetableConfigurables, ClangFlags {
|
||||
val libGcc get() = targetString("libGcc")!!
|
||||
val dynamicLinker get() = targetString("dynamicLinker")!!
|
||||
val abiSpecificLibraries get() = targetList("abiSpecificLibraries")
|
||||
val crtFilesLocation get() = targetString("crtFilesLocation")!!
|
||||
val linkerGccFlags get() = targetList("linkerGccFlags")
|
||||
}
|
||||
|
||||
|
||||
@@ -345,11 +345,7 @@ class GccBasedLinker(targetProperties: GccConfigurables)
|
||||
|
||||
val isMips = target == KonanTarget.LINUX_MIPS32 || target == KonanTarget.LINUX_MIPSEL32
|
||||
val dynamic = kind == LinkerOutputKind.DYNAMIC_LIBRARY
|
||||
val crtPrefix = when (val bitness = configurables.target.architecture.bitness) {
|
||||
32 -> "usr/lib"
|
||||
64 -> "usr/lib64"
|
||||
else -> error("Unexpected target bitness: $bitness")
|
||||
}
|
||||
val crtPrefix = "$absoluteTargetSysRoot/$crtFilesLocation"
|
||||
// TODO: Can we extract more to the konan.configurables?
|
||||
return listOf(Command(linker).apply {
|
||||
+"--sysroot=${absoluteTargetSysRoot}"
|
||||
@@ -363,8 +359,8 @@ class GccBasedLinker(targetProperties: GccConfigurables)
|
||||
+dynamicLinker
|
||||
+"-o"
|
||||
+executable
|
||||
if (!dynamic) +"$absoluteTargetSysRoot/$crtPrefix/crt1.o"
|
||||
+"$absoluteTargetSysRoot/$crtPrefix/crti.o"
|
||||
if (!dynamic) +"$crtPrefix/crt1.o"
|
||||
+"$crtPrefix/crti.o"
|
||||
+if (dynamic) "$libGcc/crtbeginS.o" else "$libGcc/crtbegin.o"
|
||||
+"-L$libGcc"
|
||||
if (!isMips) +"--hash-style=gnu" // MIPS doesn't support hash-style=gnu
|
||||
@@ -379,7 +375,7 @@ class GccBasedLinker(targetProperties: GccConfigurables)
|
||||
+linkerKonanFlags
|
||||
+linkerGccFlags
|
||||
+if (dynamic) "$libGcc/crtendS.o" else "$libGcc/crtend.o"
|
||||
+"$absoluteTargetSysRoot/$crtPrefix/crtn.o"
|
||||
+"$crtPrefix/crtn.o"
|
||||
+libraries
|
||||
+linkerArgs
|
||||
if (mimallocEnabled) +mimallocLinkerDependencies
|
||||
|
||||
Reference in New Issue
Block a user