aboutsummaryrefslogtreecommitdiff
path: root/tools/driver/NativeCompiler.h
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-17 15:10:34 +0000
committer_ov4 <ov4@ov4.org>2026-10-17 15:10:34 +0000
commit1b8851d95c737cf8ebc92977bc96d4bb838568f6 (patch)
tree003af8def6e29b6e4ae4a845a7a753dd58859d22 /tools/driver/NativeCompiler.h
parentdc33cd2faf6fa52486c02e86038c8f8c07c0fe27 (diff)
feat(driver): link INCLUDE_OBJ objects and check EXTERN symbols
Each EXTERN symbol must be defined by an INCLUDE_OBJ object file or by the embedded C library selected with INCLUDE_OBJ "__libc". Objects are linked natively, loaded by the embedded JIT and passed to lli. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tools/driver/NativeCompiler.h')
-rw-r--r--tools/driver/NativeCompiler.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/tools/driver/NativeCompiler.h b/tools/driver/NativeCompiler.h
index 5e13c4d..ffc38f1 100644
--- a/tools/driver/NativeCompiler.h
+++ b/tools/driver/NativeCompiler.h
@@ -1,9 +1,21 @@
#pragma once
#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/StringSet.h"
+#include <string>
+#include <vector>
namespace cps { class CodeGen; }
// Generate a host executable without an external compiler, linker or SDK.
// Failure leaves any existing output intact and reports a diagnostic.
-bool compileNative(const cps::CodeGen &CG, llvm::StringRef OutputPath, const char *Argv0);
+// Objects named by INCLUDE_OBJ are linked after the program object.
+bool compileNative(const cps::CodeGen &CG, llvm::StringRef OutputPath, const char *Argv0,
+ const std::vector<std::string> &Objects);
+
+// Defined global C symbols of an INCLUDE_OBJ object file. Returns false with a
+// message when the file cannot be read or is not an object file.
+bool collectObjectSymbols(llvm::StringRef Path, llvm::StringSet<> &Out, std::string &Error);
+
+// Defined global symbols of the embedded C library (INCLUDE_OBJ "__libc").
+bool collectLibcSymbols(llvm::StringSet<> &Out);