CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
66 lines
2.7 KiB
C++
66 lines
2.7 KiB
C++
//===--- InterfaceStubs.cpp - Base InterfaceStubs Implementations C++ ---===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "InterfaceStubs.h"
|
|
#include "clang/Driver/CommonArgs.h"
|
|
#include "clang/Driver/Compilation.h"
|
|
#include "llvm/Support/Path.h"
|
|
|
|
namespace clang {
|
|
namespace driver {
|
|
namespace tools {
|
|
namespace ifstool {
|
|
void Merger::ConstructJob(Compilation &C, const JobAction &JA,
|
|
const InputInfo &Output, const InputInfoList &Inputs,
|
|
const llvm::opt::ArgList &Args,
|
|
const char *LinkingOutput) const {
|
|
std::string Merger = getToolChain().GetProgramPath(getShortName());
|
|
// TODO: Use IFS library directly in the future.
|
|
llvm::opt::ArgStringList CmdArgs;
|
|
CmdArgs.push_back("--input-format=IFS");
|
|
const bool WriteBin = !Args.getLastArg(options::OPT_emit_merged_ifs);
|
|
CmdArgs.push_back(WriteBin ? "--output-format=ELF" : "--output-format=IFS");
|
|
CmdArgs.push_back("-o");
|
|
|
|
// Normally we want to write to a side-car file ending in ".ifso" so for
|
|
// example if `clang -emit-interface-stubs -shared -o libhello.so` were
|
|
// invoked then we would like to get libhello.so and libhello.ifso. If the
|
|
// stdout stream is given as the output file (ie `-o -`), that is the one
|
|
// exception where we will just append to the same filestream as the normal
|
|
// output.
|
|
SmallString<128> OutputFilename(Output.getFilename());
|
|
if (OutputFilename != "-") {
|
|
if (Args.hasArg(options::OPT_shared))
|
|
llvm::sys::path::replace_extension(OutputFilename,
|
|
(WriteBin ? "ifso" : "ifs"));
|
|
else
|
|
OutputFilename += (WriteBin ? ".ifso" : ".ifs");
|
|
}
|
|
|
|
CmdArgs.push_back(Args.MakeArgString(OutputFilename.c_str()));
|
|
|
|
// Here we append the input files. If the input files are object files, then
|
|
// we look for .ifs files present in the same location as the object files.
|
|
for (const auto &Input : Inputs) {
|
|
if (!Input.isFilename())
|
|
continue;
|
|
SmallString<128> InputFilename(Input.getFilename());
|
|
if (Input.getType() == types::TY_Object)
|
|
llvm::sys::path::replace_extension(InputFilename, ".ifs");
|
|
CmdArgs.push_back(Args.MakeArgString(InputFilename.c_str()));
|
|
}
|
|
|
|
C.addCommand(std::make_unique<Command>(JA, *this, ResponseFileSupport::None(),
|
|
Args.MakeArgString(Merger), CmdArgs,
|
|
Inputs, Output));
|
|
}
|
|
} // namespace ifstool
|
|
} // namespace tools
|
|
} // namespace driver
|
|
} // namespace clang
|