From a924bd4dc61c64eee409277de188dfcf440bc060 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Vejpustek?= Date: Fri, 22 Oct 2021 20:05:21 +0200 Subject: [PATCH] build(core): do not link gen_context.o to trezor_lib --- core/embed/rust/build.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/core/embed/rust/build.rs b/core/embed/rust/build.rs index 6b261f6e2..e7fd1f9bc 100644 --- a/core/embed/rust/build.rs +++ b/core/embed/rust/build.rs @@ -190,8 +190,9 @@ fn link_core_objects() { let crate_path = env::var("CARGO_MANIFEST_DIR").unwrap(); let build_path = format!("{}/../../build/unix", crate_path); - // List of object filenames to ignore in the `embed` directory. + // List of object filenames to ignore in the `embed` and `vendor` directory let embed_blocklist = [OsStr::new("main_main.o")]; + let vendor_blocklist = [OsStr::new("gen_context.o")]; // Collect all objects that the `core` library uses, and link it in. We have to // make sure to avoid the object with the `_main` symbol, so we don't get any @@ -205,8 +206,14 @@ fn link_core_objects() { cc.object(obj); } } + for obj in glob::glob(&format!("{}/vendor/**/*.o", build_path)).unwrap() { - cc.object(obj.unwrap()); + let obj = obj.unwrap(); + if vendor_blocklist.contains(&obj.file_name().unwrap()) { + // Ignore. + } else { + cc.object(obj); + } } // Compile all the objects into a static library and link it in automatically.