aboutsummaryrefslogtreecommitdiff
path: root/src/zig_llvm.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2017-04-13 01:15:25 -0400
committerAndrew Kelley <superjoe30@gmail.com>2017-04-13 01:15:25 -0400
commitbf67427c67dac00ca10ed7423ae8d99e2901262f (patch)
treea728030e7ea78935a7ccc5591d2b54428a5c734d /src/zig_llvm.cpp
parent41144a8566a6fbd779403f6b69424bb640c94a7f (diff)
downloadzig-bf67427c67dac00ca10ed7423ae8d99e2901262f.tar.gz
zig-bf67427c67dac00ca10ed7423ae8d99e2901262f.zip
fix crash when using zig to link
without explicit dynamic linker
Diffstat (limited to 'src/zig_llvm.cpp')
-rw-r--r--src/zig_llvm.cpp81
1 files changed, 0 insertions, 81 deletions
diff --git a/src/zig_llvm.cpp b/src/zig_llvm.cpp
index e2641cd63e..5256af1b09 100644
--- a/src/zig_llvm.cpp
+++ b/src/zig_llvm.cpp
@@ -768,89 +768,8 @@ LLVMValueRef ZigLLVMBuildNUWShl(LLVMBuilderRef builder, LLVMValueRef LHS, LLVMVa
return wrap(unwrap(builder)->CreateShl(unwrap(LHS), unwrap(RHS), name, false, true));
}
-//------------------------------------
-
#include "buffer.hpp"
-enum FloatAbi {
- FloatAbiHard,
- FloatAbiSoft,
- FloatAbiSoftFp,
-};
-
-static FloatAbi get_float_abi(const Triple &triple) {
- if (triple.getEnvironment() == Triple::GNUEABIHF ||
- triple.getEnvironment() == Triple::EABIHF ||
- triple.getEnvironment() == Triple::MuslEABIHF)
- {
- return FloatAbiHard;
- } else {
- zig_panic("TODO: user needs to input if they want hard or soft floating point");
- }
-}
-
-Buf *get_dynamic_linker(LLVMTargetMachineRef target_machine_ref) {
- TargetMachine *target_machine = reinterpret_cast<TargetMachine*>(target_machine_ref);
- const Triple &triple = target_machine->getTargetTriple();
-
- const Triple::ArchType arch = triple.getArch();
-
- if (triple.getEnvironment() == Triple::Android) {
- if (triple.isArch64Bit()) {
- return buf_create_from_str("/system/bin/linker64");
- } else {
- return buf_create_from_str("/system/bin/linker");
- }
- } else if (arch == Triple::x86 ||
- arch == Triple::sparc ||
- arch == Triple::sparcel)
- {
- return buf_create_from_str("/lib/ld-linux.so.2");
- } else if (arch == Triple::aarch64) {
- return buf_create_from_str("/lib/ld-linux-aarch64.so.1");
- } else if (arch == Triple::aarch64_be) {
- return buf_create_from_str("/lib/ld-linux-aarch64_be.so.1");
- } else if (arch == Triple::arm || arch == Triple::thumb) {
- if (triple.getEnvironment() == Triple::GNUEABIHF ||
- get_float_abi(triple) == FloatAbiHard)
- {
- return buf_create_from_str("/lib/ld-linux-armhf.so.3");
- } else {
- return buf_create_from_str("/lib/ld-linux.so.3");
- }
- } else if (arch == Triple::armeb || arch == Triple::thumbeb) {
- if (triple.getEnvironment() == Triple::GNUEABIHF ||
- get_float_abi(triple) == FloatAbiHard)
- {
- return buf_create_from_str("/lib/ld-linux-armhf.so.3");
- } else {
- return buf_create_from_str("/lib/ld-linux.so.3");
- }
- } else if (arch == Triple::mips || arch == Triple::mipsel ||
- arch == Triple::mips64 || arch == Triple::mips64el)
- {
- // when you want to solve this TODO, grep clang codebase for
- // getLinuxDynamicLinker
- zig_panic("TODO figure out MIPS dynamic linker name");
- } else if (arch == Triple::ppc) {
- return buf_create_from_str("/lib/ld.so.1");
- } else if (arch == Triple::ppc64) {
- return buf_create_from_str("/lib64/ld64.so.2");
- } else if (arch == Triple::ppc64le) {
- return buf_create_from_str("/lib64/ld64.so.2");
- } else if (arch == Triple::systemz) {
- return buf_create_from_str("/lib64/ld64.so.1");
- } else if (arch == Triple::sparcv9) {
- return buf_create_from_str("/lib64/ld-linux.so.2");
- } else if (arch == Triple::x86_64 &&
- triple.getEnvironment() == Triple::GNUX32)
- {
- return buf_create_from_str("/libx32/ld-linux-x32.so.2");
- } else {
- return buf_create_from_str("/lib64/ld-linux-x86-64.so.2");
- }
-}
-
bool ZigLLDLink(ZigLLVM_ObjectFormatType oformat, const char **args, size_t arg_count, Buf *diag_buf) {
ArrayRef<const char *> array_ref_args(args, arg_count);