add musl support for host systems using musl=1 flag

This commit is contained in:
e.gavrin
2014-07-29 23:28:11 +04:00
parent 8c5309d131
commit 076af9e1d3
2 changed files with 47 additions and 33 deletions
+17 -3
View File
@@ -98,6 +98,12 @@ else
OPTION_MCU = disable OPTION_MCU = disable
endif endif
ifeq ($(musl),1)
OPTION_MUSL := enable
else
OPTION_MUSL := disable
endif
# #
# Target CPU # Target CPU
# #
@@ -142,7 +148,7 @@ CFLAGS_CORTEXM4 ?= -mlittle-endian -mcpu=cortex-m4 -march=armv7e-m -mthumb \
# Common # Common
# #
CFLAGS_COMMON ?= $(INCLUDES) -std=c99 #-fsanitize=address -fdiagnostics-color=always CFLAGS_COMMON ?= $(INCLUDES) -std=c99
LDFLAGS ?= LDFLAGS ?=
@@ -214,7 +220,15 @@ ifeq ($(OPTION_NDEBUG),enable)
endif endif
ifeq ($(OPTION_MCU),disable) ifeq ($(OPTION_MCU),disable)
DEFINES_JERRY += -D__HOST -DJERRY_SOURCE_BUFFER_SIZE=1048576 DEFINES_JERRY += -D__HOST -DJERRY_SOURCE_BUFFER_SIZE=$$((1024*1024))
CFLAGS_COMMON += -fno-stack-protector
ifeq ($(OPTION_MUSL),enable)
CC := musl-$(CC)
CFLAGS_COMMON += -static
else
CFLAGS_COMMON += -fsanitize=address
endif
else else
CFLAGS_COMMON += -ffunction-sections -fdata-sections -nostdlib CFLAGS_COMMON += -ffunction-sections -fdata-sections -nostdlib
DEFINES_JERRY += -D__TARGET_MCU DEFINES_JERRY += -D__TARGET_MCU
@@ -326,7 +340,7 @@ $(PARSER_TESTS_TARGET): debug.$(TARGET_SYSTEM)
fi fi
$(CHECK_TARGETS): $(TARGET_OF_ACTION) $(CHECK_TARGETS): $(TARGET_OF_ACTION)
@ make unittests @ make unittests testparser
@ mkdir -p $(TARGET_DIR)/check @ mkdir -p $(TARGET_DIR)/check
@ echo "=== Running cppcheck ===" @ echo "=== Running cppcheck ==="
@ cppcheck $(DEFINES_JERRY) `find $(UNITTESTS_SRC_DIR) -name *.[c]` $(SOURCES_JERRY) $(INCLUDES_JERRY) $(INCLUDES_THIRDPARTY) \ @ cppcheck $(DEFINES_JERRY) `find $(UNITTESTS_SRC_DIR) -name *.[c]` $(SOURCES_JERRY) $(INCLUDES_JERRY) $(INCLUDES_THIRDPARTY) \
+30 -30
View File
@@ -18,36 +18,36 @@
*/ */
#include "jerry-libc.h" #include "jerry-libc.h"
//
/** ///**
* memcpy alias to __memcpy (for compiler usage) // * memcpy alias to __memcpy (for compiler usage)
*/ // */
extern void *memcpy(void *s1, const void*s2, size_t n); //extern void *memcpy(void *s1, const void*s2, size_t n);
//
/** ///**
* memset alias to __memset (for compiler usage) // * memset alias to __memset (for compiler usage)
*/ // */
extern void *memset(void *s, int c, size_t n); //extern void *memset(void *s, int c, size_t n);
//
/** ///**
* memcpy alias to __memcpy (for compiler usage) // * memcpy alias to __memcpy (for compiler usage)
*/ // */
void* memcpy(void *s1, /**< destination */ //void* memcpy(void *s1, /**< destination */
const void* s2, /**< source */ // const void* s2, /**< source */
size_t n) /**< bytes number */ // size_t n) /**< bytes number */
{ //{
return __memcpy(s1, s2, n); // return __memcpy(s1, s2, n);
} /* memcpy */ //} /* memcpy */
//
/** ///**
* memset alias to __memset (for compiler usage) // * memset alias to __memset (for compiler usage)
*/ // */
void* memset(void *s, /**< area to set values in */ //void* memset(void *s, /**< area to set values in */
int c, /**< value to set */ // int c, /**< value to set */
size_t n) /**< area size */ // size_t n) /**< area size */
{ //{
return __memset(s, c, n); // return __memset(s, c, n);
} /* memset */ //} /* memset */
/** /**
* memset * memset