Files
revive/crates/lld-sys/src/linker.cpp
T
xermicus 45a082d9a8 LLVM 18
Signed-off-by: xermicus <cyrill@parity.io>
2024-04-10 10:05:48 +02:00

23 lines
679 B
C++

#include "lld/Common/Driver.h"
#include "lld/Common/CommonLinkerContext.h"
#include "llvm/Support/CrashRecoveryContext.h"
LLD_HAS_DRIVER(elf);
extern "C" bool LLDELFLink(const char *argv[], size_t length)
{
bool canRunAgain;
{
llvm::ArrayRef<const char *> args(argv, length);
llvm::CrashRecoveryContext crc;
if (!crc.RunSafely([&]()
{ canRunAgain = lld::elf::link(args, llvm::outs(), llvm::errs(), false, false); }))
return false;
}
llvm::CrashRecoveryContext crc;
return canRunAgain && crc.RunSafely([&]()
{ lld::CommonLinkerContext::destroy(); });
}