From 17bed5410358eb96741be2db29d624198cfdd183 Mon Sep 17 00:00:00 2001 From: Robin Randhawa Date: Mon, 25 Feb 2019 19:12:49 +0000 Subject: [PATCH 1/4] aarch64: Fix incorrect init/fini stack manipulation The pre-index operator ('!') was missing at the end of the stp instruction. As a result, the stack pointer wasn't updated after the store of the 64-bit pair and the stored values were basically lost when follow on code used the stack for later store ops. --- src/crti/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/crti/src/lib.rs b/src/crti/src/lib.rs index 9843734faf..eb80c7c57a 100644 --- a/src/crti/src/lib.rs +++ b/src/crti/src/lib.rs @@ -30,7 +30,7 @@ global_asm!(r#" .global _init .type _init,%function _init: - stp x29,x30,[sp,-16] + stp x29,x30,[sp,-16]! mov x29,sp // stp: "stores two doublewords from the first and second argument to memory addressed by addr" // Body will be filled in by gcc and ended by crtn.o @@ -39,7 +39,7 @@ global_asm!(r#" .global _fini .type _fini,%function _fini: - stp x29,x30,[sp,-16] + stp x29,x30,[sp,-16]! mov x29,sp // stp: "stores two doublewords from the first and second argument to memory addressed by addr" // Body will be filled in by gcc and ended by crtn.o From f9f752d74c4f1f56a89c0fcdd5cab63d2380fe09 Mon Sep 17 00:00:00 2001 From: Robin Randhawa Date: Tue, 15 Jan 2019 16:08:50 +0000 Subject: [PATCH 2/4] aarch64-prep: Dummy auxv.h For AArch64, the ring crate depends on the presence of this header and a definition of getauxval. --- src/header/mod.rs | 1 + src/header/sys_auxv/cbindgen.toml | 6 ++++++ src/header/sys_auxv/mod.rs | 11 +++++++++++ 3 files changed, 18 insertions(+) create mode 100644 src/header/sys_auxv/cbindgen.toml create mode 100644 src/header/sys_auxv/mod.rs diff --git a/src/header/mod.rs b/src/header/mod.rs index 901238bfa6..34a1eae146 100644 --- a/src/header/mod.rs +++ b/src/header/mod.rs @@ -30,6 +30,7 @@ pub mod stdio; pub mod stdlib; pub mod string; pub mod strings; +pub mod sys_auxv; pub mod sys_file; pub mod sys_ioctl; pub mod sys_mman; diff --git a/src/header/sys_auxv/cbindgen.toml b/src/header/sys_auxv/cbindgen.toml new file mode 100644 index 0000000000..08b9683cb9 --- /dev/null +++ b/src/header/sys_auxv/cbindgen.toml @@ -0,0 +1,6 @@ +include_guard = "_SYS_AUXV_H" +language = "C" +style = "Tag" + +[enum] +prefix_with_name = true diff --git a/src/header/sys_auxv/mod.rs b/src/header/sys_auxv/mod.rs new file mode 100644 index 0000000000..eeabca08ff --- /dev/null +++ b/src/header/sys_auxv/mod.rs @@ -0,0 +1,11 @@ +//! sys/auxv.h implementation + +use platform::types::*; +use platform::{Pal, Sys}; + +pub const AT_HWCAP: usize = 16; + +#[no_mangle] +pub extern "C" fn getauxval(_t: c_ulong) -> c_ulong { + 0 +} From 23de2ca7ca32ed42e4716b3f06ca0d9ef6534a8c Mon Sep 17 00:00:00 2001 From: Robin Randhawa Date: Fri, 1 Mar 2019 20:34:05 +0000 Subject: [PATCH 3/4] Remove redundant wchar_t and win_t definitions Typically with libc implementations, wchar_t and co are either defined entirely by the libc or, under libc's arrangement, by headers supplied by the compiler. Things like dlmalloc in relibc need these definitions from relibc itself and that's already already furnished by relibc's stddef.h. These additional definitions here are redundant and collide with compiler headers - for example: onig_sys (something that uutils depends on) breaks. Instead, this patch makes the compiler headers define things appropriately. --- include/bits/wchar.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/bits/wchar.h b/include/bits/wchar.h index f0e2dd9a49..1619cb0fab 100644 --- a/include/bits/wchar.h +++ b/include/bits/wchar.h @@ -6,7 +6,9 @@ #define WCHAR_MIN (0) #define WCHAR_MAX (0x7fffffff) -typedef int32_t wchar_t; -typedef uint32_t wint_t; +#define __need_size_t +#define __need_wchar_t +#define __need_wint_t +#define __need_NULL #endif /* _BITS_WCHAR_H */ From 9443eef518f0e43fe3c2c69d0d7e48db8b7cb299 Mon Sep 17 00:00:00 2001 From: Robin Randhawa Date: Sun, 3 Mar 2019 21:42:32 +0000 Subject: [PATCH 4/4] Add wint_t definition to stddef.h Without this the relibc tests would break. With this the relibc tests pass and formerly breaking builds (such as uutils -> onig_sys) pass. --- include/stddef.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/stddef.h b/include/stddef.h index 0ee2d47174..d9fbabd932 100644 --- a/include/stddef.h +++ b/include/stddef.h @@ -7,6 +7,7 @@ typedef signed long long ptrdiff_t; typedef int32_t wchar_t; +typedef int32_t wint_t; typedef unsigned long long size_t;