Replace GCC with LLVM for LiteOS-m

Signed-off-by: peshkovivan <peshkov.ivan@huawei-partners.com>
This commit is contained in:
peshkovivan 2023-10-02 13:00:07 +03:00
parent e22e8525e9
commit d7576df916
5 changed files with 105 additions and 96 deletions

View File

@ -52,7 +52,7 @@
.macro SIGNAL_CONTEXT_RESTORE .macro SIGNAL_CONTEXT_RESTORE
push {r12, lr} push {r12, lr}
blx OsSignalTaskContextRestore bl OsSignalTaskContextRestore
pop {r12, lr} pop {r12, lr}
cmp r0, #0 cmp r0, #0
mov r1, r0 mov r1, r0
@ -162,7 +162,7 @@ HalTaskSwitch:
SIGNAL_CONTEXT_RESTORE SIGNAL_CONTEXT_RESTORE
push {r12, lr} push {r12, lr}
blx OsSchedTaskSwitch bl OsSchedTaskSwitch
pop {r12, lr} pop {r12, lr}
cmp r0, #0 cmp r0, #0
mov r0, lr mov r0, lr

View File

@ -127,7 +127,7 @@ Description: initialization of CPUP Daemon
Input : None Input : None
Return : LOS_OK or Error Information Return : LOS_OK or Error Information
*****************************************************************************/ *****************************************************************************/
LITE_OS_SEC_TEXT_INIT UINT32 OsCpupDaemonInit() LITE_OS_SEC_TEXT_INIT UINT32 OsCpupDaemonInit(void)
{ {
#if (LOSCFG_BASE_CORE_SWTMR == 1) #if (LOSCFG_BASE_CORE_SWTMR == 1)
(VOID)OsCpupGuardCreator(); (VOID)OsCpupGuardCreator();
@ -144,7 +144,7 @@ Description: initialization of CPUP
Input : None Input : None
Return : LOS_OK or Error Information Return : LOS_OK or Error Information
*****************************************************************************/ *****************************************************************************/
LITE_OS_SEC_TEXT_INIT UINT32 OsCpupInit() LITE_OS_SEC_TEXT_INIT UINT32 OsCpupInit(void)
{ {
UINT32 size; UINT32 size;
CHAR *cpupMem = NULL; CHAR *cpupMem = NULL;

View File

@ -208,8 +208,7 @@ static UINT32 Testcase(VOID)
ret = LOS_EventDestroy(&g_eventCB3); ret = LOS_EventDestroy(&g_eventCB3);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT); ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
return LOS_OK; // cleanup resources after tests
EXIT: EXIT:
LOS_SwtmrDelete(g_swtmrId3); LOS_SwtmrDelete(g_swtmrId3);
LOS_SwtmrDelete(g_swtmrId2); LOS_SwtmrDelete(g_swtmrId2);

View File

@ -119,9 +119,19 @@ LITE_TEST_CASE(PosixMathFuncTestSuite, testMathAbs001, Function | MediumTest | L
*/ */
LITE_TEST_CASE(PosixMathFuncTestSuite, testMathAbs002, Function | MediumTest | Level1) LITE_TEST_CASE(PosixMathFuncTestSuite, testMathAbs002, Function | MediumTest | Level1)
{ {
// the first case ( abs(-2147483648) ) is UB
// quote from "man abs": "Trying to take the absolute value of the most negative integer is not defined."
// so this case is disabled for non-GCC toolchains
#ifdef LOSCFG_COMPILER_GCC
const int testCount = 3; const int testCount = 3;
int testValues[] = {-2147483648, -2147483647, 2147483647}; int testValues[] = {-2147483648, -2147483647, 2147483647};
int expected[] = {-2147483648, 2147483647, 2147483647}; int expected[] = {-2147483648, 2147483647, 2147483647};
#else
const int testCount = 2;
int testValues[] = {-2147483647, 2147483647};
int expected[] = {2147483647, 2147483647};
#endif
int ret; int ret;
for (int i = 0; i < testCount; ++i) { for (int i = 0; i < testCount; ++i) {
ret = abs(testValues[i]); ret = abs(testValues[i]);

View File

@ -355,7 +355,7 @@ LITE_TEST_CASE(MqueueFuncTestSuite, TestMqOpenENOSPC, Function | MediumTest | Le
*/ */
LITE_TEST_CASE(MqueueFuncTestSuite, TestMqCloseEBADF, Function | MediumTest | Level2) LITE_TEST_CASE(MqueueFuncTestSuite, TestMqCloseEBADF, Function | MediumTest | Level2)
{ {
ICUNIT_TRACK_EQUAL(mq_close(NULL), -1, -1); ICUNIT_TRACK_EQUAL(mq_close((mqd_t)NULL), -1, -1);
ICUNIT_TRACK_EQUAL(errno, EBADF, errno); ICUNIT_TRACK_EQUAL(errno, EBADF, errno);
return 0; return 0;
} }
@ -411,7 +411,7 @@ LITE_TEST_CASE(MqueueFuncTestSuite, TestMqSendEBADFEMSGSIZE, Function | MediumTe
queue = mq_open(qName, O_CREAT | O_RDWR | O_NONBLOCK, S_IRUSR | S_IWUSR, &attr); queue = mq_open(qName, O_CREAT | O_RDWR | O_NONBLOCK, S_IRUSR | S_IWUSR, &attr);
ICUNIT_ASSERT_NOT_EQUAL(queue, (mqd_t)-1, queue); ICUNIT_ASSERT_NOT_EQUAL(queue, (mqd_t)-1, queue);
ret = mq_send(NULL, MQ_MSG, 1, MQ_MSG_PRIO); ret = mq_send((mqd_t)NULL, MQ_MSG, 1, MQ_MSG_PRIO);
ICUNIT_TRACK_EQUAL(ret, -1, ret); ICUNIT_TRACK_EQUAL(ret, -1, ret);
ICUNIT_TRACK_EQUAL(errno, EBADF, errno); ICUNIT_TRACK_EQUAL(errno, EBADF, errno);