Merge pull request #295 from danc86/fix-lto

libstd-rs: embed bitcode for LTO
This commit is contained in:
Cody Schafer
2021-02-07 00:27:42 -05:00
committed by GitHub
3 changed files with 29 additions and 0 deletions

View File

@@ -12,6 +12,8 @@ DEPENDS_append_libc-musl = " libunwind"
DEPENDS_remove_riscv32 = "libunwind"
DEPENDS_remove_riscv64 = "libunwind"
# Embed bitcode in order to allow compiling both with and without LTO
RUSTFLAGS += "-Cembed-bitcode=yes"
# Needed so cargo can find libbacktrace
RUSTFLAGS += "-L ${STAGING_LIBDIR} -C link-arg=-Wl,-soname,libstd.so"

View File

@@ -0,0 +1,23 @@
From fa40b874f6470ec11a8fd7b0c9909d0cdd2d6feb Mon Sep 17 00:00:00 2001
From: Dan Callaghan <dan.callaghan@opengear.com>
Date: Fri, 5 Feb 2021 08:56:34 +1000
Subject: [PATCH] enable LTO
---
Cargo.toml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/Cargo.toml b/Cargo.toml
index 7a2f6c8..cdb6b5d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -3,3 +3,6 @@
name = "rust-hello-world"
version = "0.0.1"
authors = ["Cody P Schafer <dev@codyps.com>"]
+
+[profile.release]
+lto = true
--
2.28.0

View File

@@ -4,6 +4,10 @@ SRC_URI = "git://github.com/jmesmon/rust-hello-world.git;protocol=https"
SRCREV="e0fa23f1a3cb1eb1407165bd2fc36d2f6e6ad728"
LIC_FILES_CHKSUM="file://COPYRIGHT;md5=e6b2207ac3740d2d01141c49208c2147"
SRC_URI += "\
file://0001-enable-LTO.patch \
"
SUMMARY = "Hello World by Cargo for Rust"
HOMEPAGE = "https://github.com/jmesmon/rust-hello-world"
LICENSE = "MIT | Apache-2.0"