From c202937302331a914acf56c44f1b80a4d139fd18 Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Wed, 12 Apr 2017 20:45:59 +0200 Subject: [PATCH] Add the new `linker-flavor` field to target json See https://github.com/rust-lang/rust/pull/40018 --- blog/content/post/03-set-up-rust.md | 6 ++++++ x86_64-blog_os.json | 1 + 2 files changed, 7 insertions(+) diff --git a/blog/content/post/03-set-up-rust.md b/blog/content/post/03-set-up-rust.md index f0e43a038..1943bb2f6 100644 --- a/blog/content/post/03-set-up-rust.md +++ b/blog/content/post/03-set-up-rust.md @@ -97,6 +97,7 @@ Rust allows us to define [custom targets] through a JSON configuration file. A m { "llvm-target": "x86_64-unknown-linux-gnu", "data-layout": "e-m:e-i64:64-f80:128-n8:16:32:64-S128", + "linker-flavor": "gcc", "target-endian": "little", "target-pointer-width": "64", "arch": "x86_64", @@ -113,6 +114,11 @@ The `llvm-target` field specifies the target triple that is passed to LLVM. [Tar The `data-layout` field is also passed to LLVM and specifies how data should be laid out in memory. It consists of various specifications seperated by a `-` character. For example, the `e` means little endian and `S128` specifies that the stack should be 128 bits (= 16 byte) aligned. The format is described in detail in the [LLVM documentation][data layout] but there shouldn't be a reason to change this string. +The `linker-flavor` field was recently introduced in [#40018] with the intention to add support for the LLVM linker [LLD], which is platform independent. In the future, this might allow easy cross compilation without the need to install a gcc cross compiler for linking. + +[#40018]: https://github.com/rust-lang/rust/pull/40018 +[LLD]: https://lld.llvm.org/ + The other fields are used for conditional compilation. This allows crate authors to use `cfg` variables to write special code for depending on the OS or the architecture. There isn't any up-to-date documentation about these fields but the [corresponding source code][target specification] is quite readable. [data layout]: http://llvm.org/docs/LangRef.html#data-layout diff --git a/x86_64-blog_os.json b/x86_64-blog_os.json index 85e2b5a7c..0673d7152 100644 --- a/x86_64-blog_os.json +++ b/x86_64-blog_os.json @@ -1,6 +1,7 @@ { "llvm-target": "x86_64-unknown-linux-gnu", "data-layout": "e-m:e-i64:64-f80:128-n8:16:32:64-S128", + "linker-flavor": "gcc", "target-endian": "little", "target-pointer-width": "64", "arch": "x86_64",