| 492 | } |
| 493 | |
| 494 | host_program::host_program_entry host_context::create_host_program_internal(const host_device& dev floor_unused /* TODO: use device */, |
| 495 | const std::optional<std::string> elf_bin_file_name, |
| 496 | const uint8_t* elf_bin_data, |
| 497 | const size_t elf_bin_size, |
| 498 | const std::vector<toolchain::function_info>& function_info, |
| 499 | const bool& silence_debug_output) { |
| 500 | host_program::host_program_entry ret; |
| 501 | ret.functions = function_info; |
| 502 | |
| 503 | std::unique_ptr<elf_binary> bin; |
| 504 | if (elf_bin_file_name && !elf_bin_file_name->empty()) { |
| 505 | bin = std::make_unique<elf_binary>(*elf_bin_file_name); |
| 506 | } else if (elf_bin_data != nullptr && elf_bin_size > 0) { |
| 507 | bin = std::make_unique<elf_binary>(elf_bin_data, elf_bin_size); |
| 508 | } else { |
| 509 | log_error("invalid ELF binary specification"); |
| 510 | return {}; |
| 511 | } |
| 512 | if (!bin->is_valid()) { |
| 513 | log_error("failed to load ELF binary"); |
| 514 | return {}; |
| 515 | } |
| 516 | ret.program = std::move(bin); |
| 517 | |
| 518 | if (!silence_debug_output) { |
| 519 | log_debug("successfully created host program!"); |
| 520 | } |
| 521 | |
| 522 | ret.valid = true; |
| 523 | floor_return_no_nrvo(ret); |
| 524 | } |
| 525 | |
| 526 | std::shared_ptr<device_program> host_context::add_precompiled_program_file(const std::string& file_name floor_unused, |
| 527 | const std::vector<toolchain::function_info>& functions floor_unused) { |