Skip to content

Commit ebce40a

Browse files
author
kr-2003
committed
compiler-rt added in oop build
1 parent 610d717 commit ebce40a

File tree

3 files changed

+22
-4
lines changed

3 files changed

+22
-4
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ jobs:
7979
clang-runtime: '20'
8080
cling: Off
8181
cppyy: Off
82-
llvm_enable_projects: "clang"
82+
llvm_enable_projects: "clang;compiler-rt"
8383
llvm_targets_to_build: "host;NVPTX"
8484
coverage: true
8585
oop-jit: On

lib/CppInterOp/Compatibility.h

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,26 @@ createClangInterpreter(std::vector<const char*>& args, int stdin_fd = 0,
279279
std::string SlabAllocateSizeString = "";
280280
std::unique_ptr<llvm::orc::ExecutorProcessControl> EPC;
281281

282+
auto DefaultForkRedirection = [=] {
283+
auto redirect = [](int from, int to) {
284+
if (from != to) {
285+
dup2(from, to);
286+
close(from);
287+
}
288+
};
289+
290+
// TODO: stdin and stderr redirection is not necessary.
291+
redirect(0, STDIN_FILENO);
292+
redirect(stdout_fd, STDOUT_FILENO);
293+
redirect(2, STDERR_FILENO);
294+
295+
setvbuf(stdout, nullptr, _IONBF, 0);
296+
setvbuf(stderr, nullptr, _IONBF, 0);
297+
};
298+
282299
EPC = ExitOnError(launchExecutor(OOPExecutor, UseSharedMemory,
283-
SlabAllocateSizeString, stdin_fd,
284-
stdout_fd, stderr_fd));
300+
SlabAllocateSizeString,
301+
DefaultForkRedirection));
285302

286303
#ifdef __APPLE__
287304
std::string OrcRuntimePath =

unittests/CppInterOp/main.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#include "Utils.h"
22
#include <gtest/gtest.h>
3+
#include <string>
34

4-
void parseCustomArguments(int argc, char** argv) {
5+
static void parseCustomArguments(int argc, char** argv) {
56
for (int i = 1; i < argc; ++i) {
67
std::string arg(argv[i]);
78
if (arg == "--use-oop-jit") {

0 commit comments

Comments
 (0)