2018-06-22 17:38:00 +02:00
|
|
|
/*
|
2023-09-05 17:13:13 +00:00
|
|
|
* Copyright (C) 2020-2023 Intel Corporation
|
2018-06-22 17:38:00 +02:00
|
|
|
*
|
2018-09-18 09:11:08 +02:00
|
|
|
* SPDX-License-Identifier: MIT
|
2018-06-22 17:38:00 +02:00
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2023-09-05 17:13:13 +00:00
|
|
|
#include "shared/offline_compiler/source/ocloc_api.h"
|
2020-02-27 16:17:08 +01:00
|
|
|
#include "shared/offline_compiler/source/offline_compiler.h"
|
2022-01-12 15:27:20 +00:00
|
|
|
#include "shared/offline_compiler/source/offline_linker.h"
|
2020-02-27 16:17:08 +01:00
|
|
|
#include "shared/offline_compiler/source/utilities/linux/safety_guard_linux.h"
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/os_interface/os_library.h"
|
2020-02-24 10:22:30 +01:00
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
using namespace NEO;
|
2018-06-22 17:38:00 +02:00
|
|
|
|
|
|
|
|
int buildWithSafetyGuard(OfflineCompiler *compiler) {
|
|
|
|
|
SafetyGuardLinux safetyGuard;
|
2023-09-05 17:13:13 +00:00
|
|
|
int retVal = OCLOC_COMPILATION_CRASH;
|
2018-06-22 17:38:00 +02:00
|
|
|
|
|
|
|
|
return safetyGuard.call<int, OfflineCompiler, decltype(&OfflineCompiler::build)>(compiler, &OfflineCompiler::build, retVal);
|
|
|
|
|
}
|
2022-01-12 15:27:20 +00:00
|
|
|
|
|
|
|
|
int linkWithSafetyGuard(OfflineLinker *linker) {
|
|
|
|
|
SafetyGuardLinux safetyGuard{};
|
2023-09-05 17:13:13 +00:00
|
|
|
int returnValueOnCrash{OCLOC_COMPILATION_CRASH};
|
2022-01-12 15:27:20 +00:00
|
|
|
|
|
|
|
|
return safetyGuard.call(linker, &OfflineLinker::execute, returnValueOnCrash);
|
|
|
|
|
}
|