From 033144fd9cca599cd2e19cad504bedc50030c127 Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Tue, 6 Mar 2018 09:31:12 +0100 Subject: [PATCH 1/3] No need to install LLD on travis/appveyor anymore Rust now ships a LLD binary. --- .appveyor.yml | 4 +--- .travis.yml | 17 ----------------- 2 files changed, 1 insertion(+), 20 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 654c2e4c..821a03f7 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -65,9 +65,7 @@ install: build: false before_test: - - mkdir bin - - mklink "bin\ld.exe" "C:\Program Files\LLVM\bin\lld.exe" - - set PATH=%CD%\bin;C:\msys64\mingw%MSYS_BITS%\bin;C:\msys64\usr\bin;%PATH% + - set PATH=C:\msys64\mingw%MSYS_BITS%\bin;C:\msys64\usr\bin;%PATH% - rustup component add rust-src - set RUST_BACKTRACE=1 - if not exist %USERPROFILE%\.cargo\bin\cargo-install-update.exe cargo install cargo-update diff --git a/.travis.yml b/.travis.yml index 55bd2489..da67f69c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,29 +19,12 @@ os: - linux - osx -addons: - apt: - sources: - - llvm-toolchain-trusty-5.0 - packages: - - lld-5.0 - cache: directories: - $HOME/.cargo - $HOME/.xargo - $TRAVIS_BUILD_DIR/target -before_install: - - | - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then - set -e - LLVM_URL="https://releases.llvm.org/5.0.1/clang+llvm-5.0.1-x86_64-apple-darwin.tar.xz" - travis_retry wget -O llvm.tar.xz -nv ${LLVM_URL} - tar -xJ -f llvm.tar.xz - export PATH="`pwd`/clang+llvm-5.0.1-final-x86_64-apple-darwin/bin:$PATH" - fi - before_script: - rustup component add rust-src - (test -x $HOME/.cargo/bin/cargo-install-update || cargo install cargo-update) From d7e17b2f56ba2c12b256e3e79673ac5d8b63a7de Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Tue, 6 Mar 2018 09:49:45 +0100 Subject: [PATCH 2/3] Set `linker-flavor` to `ld.lld`, leave `linker` at default --- .../second-edition/posts/02-minimal-rust-kernel/index.md | 5 ++--- x86_64-blog_os.json | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/blog/content/second-edition/posts/02-minimal-rust-kernel/index.md b/blog/content/second-edition/posts/02-minimal-rust-kernel/index.md index 3cfa8c48..a6593467 100644 --- a/blog/content/second-edition/posts/02-minimal-rust-kernel/index.md +++ b/blog/content/second-edition/posts/02-minimal-rust-kernel/index.md @@ -132,11 +132,10 @@ We add the following build-related entries: ```json -"linker-flavor": "ld", -"linker": "ld.lld", +"linker-flavor": "ld.lld", ``` -Instead of using the platform's default linker (which might not support Linux targets), we use the cross platform [LLD] linker for linking our kernel. +Instead of using the platform's default linker (which might not support Linux targets), we use the cross platform [LLD] linker for linking our kernel. LLD is shipped with Rust since the `2018-03-05` nightly. [LLD]: https://lld.llvm.org/ diff --git a/x86_64-blog_os.json b/x86_64-blog_os.json index c8c39b29..83d1a54d 100644 --- a/x86_64-blog_os.json +++ b/x86_64-blog_os.json @@ -6,8 +6,7 @@ "target-pointer-width": "64", "target-c-int-width": "32", "os": "none", - "linker-flavor": "ld", - "linker": "ld.lld", + "linker-flavor": "ld.lld", "executables": true, "features": "-mmx,-sse,+soft-float", "disable-redzone": true, From db812fe7c8c3ddc0ef86a38f620fbc798e240997 Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Tue, 6 Mar 2018 09:57:46 +0100 Subject: [PATCH 3/3] =?UTF-8?q?Remove=20=E2=80=9CInstalling=20LLD=E2=80=9D?= =?UTF-8?q?=20guide?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../extra/installing-lld/index.md | 18 ------------------ .../posts/02-minimal-rust-kernel/index.md | 4 ---- 2 files changed, 22 deletions(-) delete mode 100644 blog/content/second-edition/extra/installing-lld/index.md diff --git a/blog/content/second-edition/extra/installing-lld/index.md b/blog/content/second-edition/extra/installing-lld/index.md deleted file mode 100644 index 94237b41..00000000 --- a/blog/content/second-edition/extra/installing-lld/index.md +++ /dev/null @@ -1,18 +0,0 @@ -+++ -title = "Installing LLD" -order = 3 -path = "installing-lld" -template = "second-edition/extra.html" -+++ - -[LLD] is the linker by the LLVM project. It has the big advantage that it is a cross-linker by default. This means that you can link libraries and executables for all kinds of platforms with the same LLD installation. - -[LLD]: https://lld.llvm.org/ - -There are plans to distribute LLD together with the Rust compiler, but is not quite there yet. So you have to install it manually. On this page, we try to describe the installation procedure for as many platforms as possible, so if you have additional information for any listed or unlisted platform, please send a pull request on the [Github repo](https://github.com/phil-opp/blog_os)! - -## Linux -On most Linux distributions LLD can be installed through the package manager. For example, for Debian and Ubuntu there is are official apt sources at . - -## Other Platforms -For Windows and Mac you can download a pre-built LLVM release from , which contains LLD. If there are no pre-compiled versions for your platform (e.g. some other Linux distribution), you can download the source code and [build it yourself](https://lld.llvm.org/#build). diff --git a/blog/content/second-edition/posts/02-minimal-rust-kernel/index.md b/blog/content/second-edition/posts/02-minimal-rust-kernel/index.md index a6593467..37508129 100644 --- a/blog/content/second-edition/posts/02-minimal-rust-kernel/index.md +++ b/blog/content/second-edition/posts/02-minimal-rust-kernel/index.md @@ -259,10 +259,6 @@ Let's try it: Finished dev [unoptimized + debuginfo] target(s) in 0.29 secs ``` -(If you're getting a linking error because LLD could not be found, see our “[Installing LLD]” guide.) - -[Installing LLD]: ./second-edition/extra/installing-lld/index.md - It worked! We see that `xargo` cross-compiled the `core` library for our new custom target and then continued to compile our `blog_os` crate. Now we are able to build our kernel for a bare metal target. However, our `_start` entry point, which will be called by the boot loader, is still empty. So let's output something to screen from it.