From 9621a7f3f57ad126b7d2ee71780b283c5ede677d Mon Sep 17 00:00:00 2001 From: Penny Zheng Date: Mon, 30 Dec 2019 16:02:11 +0800 Subject: [PATCH 1/3] ABI: only support arm 64-bit platform We only support running Kata Containers on AArch64. Fixes: #107 Signed-off-by: Penny Zheng --- src/agent/src/linux_abi.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/agent/src/linux_abi.rs b/src/agent/src/linux_abi.rs index 69edb20d9d..f0cdc7a302 100644 --- a/src/agent/src/linux_abi.rs +++ b/src/agent/src/linux_abi.rs @@ -16,7 +16,7 @@ pub const SYSFS_PCI_BUS_RESCAN_FILE: &str = "/sys/bus/pci/rescan"; target_arch = "x86" ))] pub const PCI_ROOT_BUS_PATH: &str = "/devices/pci0000:00"; -#[cfg(target_arch = "arm")] +#[cfg(target_arch = "aarch64")] pub const PCI_ROOT_BUS_PATH: &str = "/devices/platform/4010000000.pcie/pci0000:00"; pub const SYSFS_CPU_ONLINE_PATH: &str = "/sys/devices/system/cpu"; From 44b2caa2e53c4c023430e96b38b243142068a7d2 Mon Sep 17 00:00:00 2001 From: Penny Zheng Date: Mon, 30 Dec 2019 16:04:13 +0800 Subject: [PATCH 2/3] AArch64: missing symbols on target `aarch64-unknown-linux-musl` The __addtf3, __subtf3 and __multf3 symbols are used by aarch64-musl, but are not provided by rust compiler-builtins. For now, the only temporary but functional workaround accepted by rust communities is to get them from libgcc. Fixes: #107 Signed-off-by: Penny Zheng --- src/agent/.cargo/config | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 src/agent/.cargo/config diff --git a/src/agent/.cargo/config b/src/agent/.cargo/config new file mode 100644 index 0000000000..e2c49b02fd --- /dev/null +++ b/src/agent/.cargo/config @@ -0,0 +1,11 @@ +## Copyright (c) 2020 ARM Limited +## +## SPDX-License-Identifier: Apache-2.0 +## + +[target.aarch64-unknown-linux-musl] +## The __addtf3, __subtf3 and __multf3 symbols are used by aarch64-musl, +## but are not provided by rust compiler-builtins. +## For now, the only functional workaround accepted by rust communities +## is to get them from libgcc. +rustflags = [ "-C", "link-arg=-lgcc" ] From 7dfc4e0219de92ea2097b28e9bd54d2bf97a39c6 Mon Sep 17 00:00:00 2001 From: Penny Zheng Date: Thu, 9 Jan 2020 11:08:23 +0800 Subject: [PATCH 3/3] linker: `no such file` linking error on AArch64 When using default cc linker, we will have segfault. Debugging with `rust-gdb`, the specific error is as follows: src/string/memcpy.c: No such file or directory. Only changing linker with `aarch64-linux-musl-gcc`, the `rust-agent` could be totally statically linked and run successfully. Fixes: #107 Signed-off-by: Penny Zheng --- src/agent/.cargo/config | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/agent/.cargo/config b/src/agent/.cargo/config index e2c49b02fd..7a843e5d72 100644 --- a/src/agent/.cargo/config +++ b/src/agent/.cargo/config @@ -4,6 +4,10 @@ ## [target.aarch64-unknown-linux-musl] +## Only setting linker with `aarch64-linux-musl-gcc`, the +## `rust-agent` could be totally statically linked. +linker = "aarch64-linux-musl-gcc" + ## The __addtf3, __subtf3 and __multf3 symbols are used by aarch64-musl, ## but are not provided by rust compiler-builtins. ## For now, the only functional workaround accepted by rust communities