From 85b80d0fe5a44e750758f5d6156a6832de60f25a Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Wed, 7 Mar 2018 20:31:18 -0700 Subject: [PATCH 1/2] Fix errno.h, add -no-pie to tests Makefile --- include/bits/errno.h | 6 ++++++ include/errno.h | 1 - src/errno/cbindgen.toml | 2 +- src/errno/src/lib.rs | 1 + tests/Makefile | 2 +- 5 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 include/bits/errno.h delete mode 100644 include/errno.h diff --git a/include/bits/errno.h b/include/bits/errno.h new file mode 100644 index 0000000000..7266f57ee2 --- /dev/null +++ b/include/bits/errno.h @@ -0,0 +1,6 @@ +#ifndef _BITS_ERRNO_H +#define _BITS_ERRNO_H + +extern __thread int errno; + +#endif /* _BITS_ERRNO_H */ diff --git a/include/errno.h b/include/errno.h deleted file mode 100644 index 02b7e0c00f..0000000000 --- a/include/errno.h +++ /dev/null @@ -1 +0,0 @@ -extern __thread int errno; diff --git a/src/errno/cbindgen.toml b/src/errno/cbindgen.toml index e71467bc3c..1159d8eda7 100644 --- a/src/errno/cbindgen.toml +++ b/src/errno/cbindgen.toml @@ -1,4 +1,4 @@ -sys_includes = [] +sys_includes = ["bits/errno.h"] include_guard = "_ERRNO_H" language = "C" diff --git a/src/errno/src/lib.rs b/src/errno/src/lib.rs index 3cb5cd036c..a40975c9f9 100644 --- a/src/errno/src/lib.rs +++ b/src/errno/src/lib.rs @@ -4,6 +4,7 @@ extern crate platform; +#[repr(C)] pub enum Errno { // Argument list too long E2BIG = 1, diff --git a/tests/Makefile b/tests/Makefile index 8d87af542c..7d293f7246 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -37,4 +37,4 @@ GCCTAIL=\ ../openlibm/libopenlibm.a %: %.c - gcc -fno-stack-protector -Wall $(GCCHEAD) "$<" $(GCCTAIL) -o "$@" + gcc -no-pie -fno-stack-protector -Wall $(GCCHEAD) "$<" $(GCCTAIL) -o "$@" From f01c669771d0caaac403e05ee29c8b47ff96fab1 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Wed, 7 Mar 2018 20:37:22 -0700 Subject: [PATCH 2/2] Remove thread local from errno, for now --- include/bits/errno.h | 3 ++- src/platform/src/lib.rs | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/bits/errno.h b/include/bits/errno.h index 7266f57ee2..1ade524d96 100644 --- a/include/bits/errno.h +++ b/include/bits/errno.h @@ -1,6 +1,7 @@ #ifndef _BITS_ERRNO_H #define _BITS_ERRNO_H -extern __thread int errno; +//TODO extern __thread int errno; +extern int errno; #endif /* _BITS_ERRNO_H */ diff --git a/src/platform/src/lib.rs b/src/platform/src/lib.rs index 6e5841a965..a327053107 100644 --- a/src/platform/src/lib.rs +++ b/src/platform/src/lib.rs @@ -2,7 +2,7 @@ #![no_std] #![allow(non_camel_case_types)] -#![feature(thread_local)] +//TODO #![feature(thread_local)] #[cfg(all(not(feature = "no_std"), target_os = "linux"))] #[macro_use] @@ -28,7 +28,7 @@ use core::fmt; use types::*; -#[thread_local] +//TODO #[thread_local] #[no_mangle] pub static mut errno: c_int = 0;