This repository has been archived by the owner on Jan 29, 2022. It is now read-only.
forked from crystal-lang/crystal
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Begin to create target definition system of our own.
Inspiration taken heavily from Rust.
- Loading branch information
Showing
3 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
abstract struct Crystal::Target | ||
@triple: String? | ||
@endian: String? | ||
@pointer_width: String? | ||
@os: String? | ||
@env: String? | ||
@vendor: String? | ||
@arch: String? | ||
@data_layout: String? | ||
@option: Options? | ||
end | ||
|
||
abstract struct Crystal::Target::Options | ||
@linker: String = ENV["CC"]? || "cc" | ||
@ar: String = ENV["AR"]? || "ar" | ||
@dynamic_linking: Bool = false | ||
@executables: Bool = false | ||
@executable_suffix: String = "" | ||
end |
23 changes: 23 additions & 0 deletions
23
src/compiler/crystal/codegen/target/asmjs_unknown_emscripten.cr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
require "../target" | ||
|
||
module Crystal | ||
struct Target::ASMJS::Emscripten < Target | ||
@triple = "asmjs-unknown-target" | ||
@endian = "little" | ||
@pointer_width = "32" | ||
@os = "emscripten" | ||
@env = "" | ||
@vendor = "unknown" | ||
@data_layout = "e-p:32:32-i64:64-v128:32:128-n32-S128" | ||
@arch = "asmjs" | ||
@option = Options.new | ||
|
||
struct Options < Target::Options | ||
@linker = "emcc" | ||
@ar = "emar" | ||
@dynamic_linking = false | ||
@executables = true | ||
@executable_suffix = ".js" | ||
end | ||
end | ||
end |
15 changes: 15 additions & 0 deletions
15
src/compiler/crystal/codegen/target/x86_64_apple_darwin.cr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
require "../target" | ||
|
||
|
||
module Crystal | ||
struct Target::X86_64::Apple::Darwin < Target | ||
triple = "x86_64-apple-darwin" | ||
endian = "little" | ||
pointer_width = "64" | ||
data_layout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" | ||
arch = "x86_64" | ||
os = "macos" | ||
env = "" | ||
vendor = "apple" | ||
end | ||
end |