Skip to content

Regain control over the SDK libraries for Rust #269

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions ledger_secure_sdk_sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ impl SDKBuilder<'_> {

let gcc_toolchain = if sysroot.is_empty() {
// path for Debian-based systems
String::from("/usr/lib/arm-none-eabi")
String::from("/usr/lib/picolibc/arm-none-eabi")
} else {
format!("{sysroot}")
};
Expand Down Expand Up @@ -302,13 +302,13 @@ impl SDKBuilder<'_> {
// Set ARM pre-compiled libraries path
self.device.arm_libs = match self.device.name {
DeviceName::NanoX => {
let mut path = self.device.c_sdk.display().to_string();
path.push_str("/arch/st33/lib");
let mut path = self.gcc_toolchain.display().to_string();
path.push_str("/lib/thumb/v7-m/nofp");
path
}
DeviceName::NanoSPlus | DeviceName::Flex | DeviceName::Stax => {
let mut path = self.device.c_sdk.display().to_string();
path.push_str("/arch/st33k1/lib");
let mut path = self.gcc_toolchain.display().to_string();
path.push_str("/lib/thumb/v8-m.main/nofp");
path
}
};
Expand Down Expand Up @@ -434,11 +434,9 @@ impl SDKBuilder<'_> {

command.compile("ledger-secure-sdk");

/* Link with libc, libm and libgcc */
/* Link with libc */
let path = self.device.arm_libs.clone();
println!("cargo:rustc-link-lib=c");
println!("cargo:rustc-link-lib=m");
println!("cargo:rustc-link-lib=gcc");

println!("cargo:rustc-link-search={path}");
Ok(())
Expand Down
2 changes: 0 additions & 2 deletions ledger_secure_sdk_sys/link.ld
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,6 @@ SECTIONS
/DISCARD/ :
{
libc.a ( * )
libm.a ( * )
libgcc.a ( * )
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
*(.debug_info)
}
Expand Down
Loading