Differential D23161 Diff 66727 graphics/mesa/files/patch-src_gallium_state__trackers_clover_llvm_invocation.cpp
Changeset View
Changeset View
Standalone View
Standalone View
graphics/mesa/files/patch-src_gallium_state__trackers_clover_llvm_invocation.cpp
# fix errors like the following | # fix errors like the following | ||||
# | # | ||||
# llvm/invocation.cpp:(.text+0x1275): undefined reference to `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::c_str() | # llvm/invocation.cpp:(.text+0x1275): undefined reference to `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::c_str() | ||||
const' | const' | ||||
# /usr/bin/ld: ../../../../src/gallium/state_trackers/clover/.libs/libclover.a(libclllvm_la-invocation.o): relocation R_X86_64_PC32 against `_ZNKSt3__112bas | # /usr/bin/ld: ../../../../src/gallium/state_trackers/clover/.libs/libclover.a(libclllvm_la-invocation.o): relocation R_X86_64_PC32 against `_ZNKSt3__112bas | ||||
ic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE5c_strEv' can not be used when making a shared object; recompile with -fPIC | ic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE5c_strEv' can not be used when making a shared object; recompile with -fPIC | ||||
# /usr/bin/ld: final link failed: Bad value | # /usr/bin/ld: final link failed: Bad value | ||||
# | # | ||||
--- src/gallium/state_trackers/clover/llvm/invocation.cpp.orig 2017-04-01 15:33:37 UTC | --- src/gallium/state_trackers/clover/llvm/invocation.cpp.orig 2019-12-18 19:04:21 UTC | ||||
+++ src/gallium/state_trackers/clover/llvm/invocation.cpp | +++ src/gallium/state_trackers/clover/llvm/invocation.cpp | ||||
@@ -93,6 +93,8 @@ namespace { | @@ -181,6 +181,8 @@ namespace { | ||||
return ctx; | return get_lang_standard_from_version_str(device_version); | ||||
} | } | ||||
+ const char* cstr(const std::string& str) { return str.c_str(); } | + const char* cstr(const std::string& str) { return str.c_str(); } | ||||
+ | + | ||||
std::unique_ptr<clang::CompilerInstance> | std::unique_ptr<clang::CompilerInstance> | ||||
create_compiler_instance(const target &target, | create_compiler_instance(const device &dev, | ||||
const std::vector<std::string> &opts, | const std::vector<std::string> &opts, | ||||
@@ -105,8 +107,8 @@ namespace { | @@ -193,8 +195,8 @@ namespace { | ||||
// Parse the compiler options. A file name should be present at the end | // Parse the compiler options. A file name should be present at the end | ||||
// and must have the .cl extension in order for the CompilerInvocation | // and must have the .cl extension in order for the CompilerInvocation | ||||
// class to recognize it as an OpenCL source file. | // class to recognize it as an OpenCL source file. | ||||
- const std::vector<const char *> copts = | - const std::vector<const char *> copts = | ||||
- map(std::mem_fn(&std::string::c_str), opts); | - map(std::mem_fn(&std::string::c_str), opts); | ||||
+ std::vector<const char *> copts(opts.size()); | + std::vector<const char *> copts(opts.size()); | ||||
+ std::transform(opts.begin(), opts.end(), copts.begin(), cstr); | + std::transform(opts.begin(), opts.end(), copts.begin(), cstr); | ||||
if (!clang::CompilerInvocation::CreateFromArgs( | const target &target = dev.ir_target(); | ||||
c->getInvocation(), copts.data(), copts.data() + copts.size(), diag)) | const std::string &device_clc_version = dev.device_clc_version(); |