[PATCH v2] libcsupport: Address *tors FIXME
Kinsey Moore
kinsey.moore at oarcorp.com
Mon Jun 29 16:52:21 UTC 2020
This introduces the CPU_USE_LIBC_INIT_FINI_ARRAY define for use by
CPU ports to determine which global constructor and destructor methods
are used instead of placing architecture defines where they shouldn't
be.
Close #4018
---
cpukit/libcsupport/src/newlibc_exit.c | 5 +----
cpukit/score/cpu/arm/include/rtems/score/cpu.h | 2 ++
cpukit/score/cpu/or1k/include/rtems/score/cpu.h | 2 ++
cpukit/score/cpu/riscv/include/rtems/score/cpu.h | 2 ++
cpukit/score/src/threadhandler.c | 3 +--
5 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/cpukit/libcsupport/src/newlibc_exit.c b/cpukit/libcsupport/src/newlibc_exit.c
index 650b692c74..67dec1393a 100644
--- a/cpukit/libcsupport/src/newlibc_exit.c
+++ b/cpukit/libcsupport/src/newlibc_exit.c
@@ -17,11 +17,8 @@
#include <stdio.h>
#include <unistd.h>
-/* FIXME: These defines are a blatant hack */
-
#if defined(__USE_INIT_FINI__)
- #if defined(__ARM_EABI__) || defined(__riscv) \
- || defined(__or1k__) || defined(__or1knd__)
+ #if defined(CPU_USE_LIBC_INIT_FINI_ARRAY)
#define FINI_SYMBOL __libc_fini_array
#else
#define FINI_SYMBOL _fini
diff --git a/cpukit/score/cpu/arm/include/rtems/score/cpu.h b/cpukit/score/cpu/arm/include/rtems/score/cpu.h
index b7b48a3ac3..b90fb1f394 100644
--- a/cpukit/score/cpu/arm/include/rtems/score/cpu.h
+++ b/cpukit/score/cpu/arm/include/rtems/score/cpu.h
@@ -153,6 +153,8 @@
#define CPU_USE_GENERIC_BITFIELD_CODE TRUE
+#define CPU_USE_LIBC_INIT_FINI_ARRAY TRUE
+
#define CPU_MAXIMUM_PROCESSORS 32
#ifdef ARM_MULTILIB_HAS_THREAD_ID_REGISTER
diff --git a/cpukit/score/cpu/or1k/include/rtems/score/cpu.h b/cpukit/score/cpu/or1k/include/rtems/score/cpu.h
index 39920bebc3..6790694b05 100644
--- a/cpukit/score/cpu/or1k/include/rtems/score/cpu.h
+++ b/cpukit/score/cpu/or1k/include/rtems/score/cpu.h
@@ -435,6 +435,8 @@ void _CPU_Context_Initialize(
#define CPU_USE_GENERIC_BITFIELD_CODE TRUE
+#define CPU_USE_LIBC_INIT_FINI_ARRAY TRUE
+
#endif /* ASM */
#define CPU_SIZEOF_POINTER 4
diff --git a/cpukit/score/cpu/riscv/include/rtems/score/cpu.h b/cpukit/score/cpu/riscv/include/rtems/score/cpu.h
index e08307d372..501973a6dc 100644
--- a/cpukit/score/cpu/riscv/include/rtems/score/cpu.h
+++ b/cpukit/score/cpu/riscv/include/rtems/score/cpu.h
@@ -219,6 +219,8 @@ extern void _CPU_Fatal_halt(uint32_t source, uint32_t error) RTEMS_NO_RETURN;
#define CPU_USE_GENERIC_BITFIELD_DATA TRUE
+#define CPU_USE_LIBC_INIT_FINI_ARRAY TRUE
+
#define CPU_MAXIMUM_PROCESSORS 32
typedef uint16_t Priority_bit_map_Word;
diff --git a/cpukit/score/src/threadhandler.c b/cpukit/score/src/threadhandler.c
index acbe186a53..0502ea9d19 100644
--- a/cpukit/score/src/threadhandler.c
+++ b/cpukit/score/src/threadhandler.c
@@ -29,8 +29,7 @@
* initialization this target and compiler version uses.
*/
#if defined(__USE_INIT_FINI__)
- #if defined(__ARM_EABI__) || defined(__riscv) \
- || defined(__or1k__) || defined(__or1knd__)
+ #if defined(CPU_USE_LIBC_INIT_FINI_ARRAY)
#define INIT_NAME __libc_init_array
#else
#define INIT_NAME _init
--
2.20.1
More information about the devel
mailing list