Removing musl libc usage. Linking to libgcc (for __aeabi_* routines on ARM target).

This commit is contained in:
Ruben Ayrapetyan
2014-11-18 21:13:54 +03:00
parent 988288c9e4
commit 9f7e17e9fd
6 changed files with 27 additions and 52 deletions
+3 -11
View File
@@ -45,10 +45,8 @@ export TARGET_RELEASE_MODES = release
export TARGET_PC_SYSTEMS = linux export TARGET_PC_SYSTEMS = linux
export TARGET_MCU_SYSTEMS = $(addprefix stm32f,3 4) export TARGET_MCU_SYSTEMS = $(addprefix stm32f,3 4)
export TARGET_PC_MODS = musl sanitize valgrind cp cp_minimal mem_stats \ export TARGET_PC_MODS = sanitize valgrind cp cp_minimal mem_stats \
musl-valgrind \ cp-valgrind
valgrind-cp \
musl-cp_minimal musl-mem_stats musl-cp_minimal-mem_stats \
export TARGET_MCU_MODS = cp_minimal export TARGET_MCU_MODS = cp_minimal
@@ -87,14 +85,8 @@ all: precommit
PRECOMMIT_CHECK_TARGETS_NO_VALGRIND_LIST= debug.linux.check \ PRECOMMIT_CHECK_TARGETS_NO_VALGRIND_LIST= debug.linux.check \
release.linux.check release.linux.check
PRECOMMIT_CHECK_TARGETS_VALGRIND_LIST= debug.linux-valgrind.check \ PRECOMMIT_CHECK_TARGETS_VALGRIND_LIST= debug.linux-valgrind.check \
release.linux-musl-valgrind.check \
debug.linux-valgrind-cp.check
# debug.linux-musl-valgrind.check \
release.linux-valgrind.check \ release.linux-valgrind.check \
release.linux.check \ release.linux-cp-valgrind.check
debug.linux-sanitize.check \
release.linux-sanitize.check \
push: ./tools/push.sh push: ./tools/push.sh
@ ./tools/push.sh @ ./tools/push.sh
+5 -30
View File
@@ -150,16 +150,6 @@ ifeq ($(OPTION_OVERRIDE_DISABLE_OPTIMIZE),enable)
OPTION_OPTIMIZE = disable OPTION_OPTIMIZE = disable
endif endif
ifeq ($(filter musl,$(TARGET_MODS)), musl)
ifeq ($(OPTION_MCU),enable)
$(error MCU target doesn\'t support LIBC_MUSL)
endif
OPTION_LIBC := musl
else
OPTION_LIBC := raw
endif
# CompactProfile mode # CompactProfile mode
ifeq ($(OPTION_MCU),enable) ifeq ($(OPTION_MCU),enable)
OPTION_COMPACT_PROFILE := enable OPTION_COMPACT_PROFILE := enable
@@ -180,10 +170,6 @@ else
endif endif
ifeq ($(filter sanitize,$(TARGET_MODS)), sanitize) ifeq ($(filter sanitize,$(TARGET_MODS)), sanitize)
ifeq ($(OPTION_LIBC),musl)
$(error ASAN and LIBC_MUSL are mutually exclusive)
endif
OPTION_SANITIZE := enable OPTION_SANITIZE := enable
else else
OPTION_SANITIZE := disable OPTION_SANITIZE := disable
@@ -249,9 +235,8 @@ CFLAGS_CORTEXM4 ?= -mlittle-endian -mcpu=cortex-m4 -march=armv7e-m -mthumb \
# Common # Common
# #
CFLAGS_COMMON ?= $(INCLUDES) -std=c99 CFLAGS_COMMON ?= $(INCLUDES) -std=c99 -nostdlib
LDFLAGS ?= -lgcc
LDFLAGS ?=
ifeq ($(OPTION_OPTIMIZE),enable) ifeq ($(OPTION_OPTIMIZE),enable)
CFLAGS_COMMON += $(CFLAGS_OPTIMIZE) CFLAGS_COMMON += $(CFLAGS_OPTIMIZE)
@@ -341,19 +326,9 @@ INCLUDES_JERRY = \
-I src/libcoreint \ -I src/libcoreint \
-I src/libintstructs -I src/libintstructs
# libc ifeq ($(OPTION_SANITIZE),enable)
ifeq ($(OPTION_LIBC),musl) CFLAGS_COMMON += -fsanitize=address
CC := musl-$(CC) LDFLAGS += -lasan
DEFINES_JERRY += -DLIBC_MUSL
CFLAGS_COMMON += -static
else
DEFINES_JERRY += -DLIBC_RAW
CFLAGS_COMMON += -nostdlib
ifeq ($(OPTION_SANITIZE),enable)
CFLAGS_COMMON += -fsanitize=address
LDFLAGS += -lasan
endif
endif endif
ifeq ($(OPTION_NDEBUG),enable) ifeq ($(OPTION_NDEBUG),enable)
+1 -5
View File
@@ -19,11 +19,7 @@
/** /**
* Limit of data (system heap, engine's data except engine's own heap) * Limit of data (system heap, engine's data except engine's own heap)
*/ */
#ifdef LIBC_RAW #define CONFIG_MEM_DATA_LIMIT_MINUS_HEAP_SIZE 1024
# define CONFIG_MEM_DATA_LIMIT_MINUS_HEAP_SIZE 1024
#else /* !LIBC_RAW */
# define CONFIG_MEM_DATA_LIMIT_MINUS_HEAP_SIZE 16384
#endif /* !LIBC_RAW */
/** /**
* Limit of stack size * Limit of stack size
+1
View File
@@ -31,6 +31,7 @@ typedef signed long ssize_t;
* Attributes * Attributes
*/ */
#define __unused __attribute__((unused)) #define __unused __attribute__((unused))
#define __used __attribute__((used))
#define __packed __attribute__((packed)) #define __packed __attribute__((packed))
#define __noreturn __attribute__((noreturn)) #define __noreturn __attribute__((noreturn))
#define __noinline __attribute__((noinline)) #define __noinline __attribute__((noinline))
+17 -4
View File
@@ -19,9 +19,6 @@
#include "jerry-libc.h" #include "jerry-libc.h"
FIXME(#ifndef LIBC_MUSL should be removed from here when own libc will be implemented)
#ifndef LIBC_MUSL
/** /**
* memcpy alias to __memcpy (for compiler usage) * memcpy alias to __memcpy (for compiler usage)
*/ */
@@ -85,7 +82,23 @@ CALL_PRAGMA(GCC pop_options)
CALL_PRAGMA(GCC diagnostic pop) CALL_PRAGMA(GCC diagnostic pop)
#endif /* __GNUC__ */ #endif /* __GNUC__ */
#endif /* LIBC_MUSL */ /**
* Unreachable stubs for routines that are never called,
* but referenced from third-party libraries.
*/
#define JRT_UNREACHABLE_STUB_FOR(...) \
extern __VA_ARGS__; \
__used __VA_ARGS__ \
{ \
JERRY_UNREACHABLE (); \
}
JRT_UNREACHABLE_STUB_FOR(int raise (int sig_no __unused))
#ifdef __TARGET_HOST_ARMv7
JRT_UNREACHABLE_STUB_FOR(void __aeabi_unwind_cpp_pr0 (void))
#endif /* __TARGET_HOST_ARMv7 */
#undef JRT_UNREACHABLE_STUB_FOR
/** /**
* memset * memset
@@ -8,9 +8,7 @@
# error "!__TARGET_HOST_x64 && !__TARGET_HOST_x86 && !__TARGET_HOST_ARMv7" # error "!__TARGET_HOST_x64 && !__TARGET_HOST_x86 && !__TARGET_HOST_ARMv7"
#endif /* !__TARGET_HOST_x64 && !__TARGET_HOST_x86 && !__TARGET_HOST_ARMv7 */ #endif /* !__TARGET_HOST_x64 && !__TARGET_HOST_x86 && !__TARGET_HOST_ARMv7 */
#ifdef LIBC_RAW
.global _start .global _start
_start: _start:
_START _START
.end _start .end _start
#endif /* LIBC_RAW */