Skip to content

Commit

Permalink
libc/machine: Implement ARM aeabi_xxx API called by clang
Browse files Browse the repository at this point in the history
specified here:
https://developer.arm.com/documentation/ihi0043/latest

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
  • Loading branch information
xiaoxiang781216 committed Feb 20, 2022
1 parent 746b68b commit 9764040
Show file tree
Hide file tree
Showing 13 changed files with 419 additions and 0 deletions.
5 changes: 5 additions & 0 deletions libs/libc/machine/arm/Make.defs
Expand Up @@ -42,6 +42,11 @@ else ifeq ($(CONFIG_ARCH_ARMV8M),y) # All ARMv8-M
include $(TOPDIR)/libs/libc/machine/arm/armv8-m/Make.defs
endif

CSRCS += aeabi_memclr.c aeabi_memclr4.c aeabi_memclr8.c
CSRCS += aeabi_memcpy.c aeabi_memcpy4.c aeabi_memcpy8.c
CSRCS += aeabi_memmove.c aeabi_memmove4.c aeabi_memmove8.c
CSRCS += aeabi_memset.c aeabi_memset4.c aeabi_memset8.c

ifeq ($(CONFIG_CXX_EXCEPTION),y)
CSRCS += gnu_unwind_find_exidx.c
endif
Expand Down
34 changes: 34 additions & 0 deletions libs/libc/machine/arm/aeabi_memclr.c
@@ -0,0 +1,34 @@
/****************************************************************************
* libs/libc/machine/arm/aeabi_memclr.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/

/****************************************************************************
* Included Files
****************************************************************************/

#include <string.h>

/****************************************************************************
* Public Functions
****************************************************************************/

void weak_function __aeabi_memclr(FAR void *s, size_t n)
{
memset(s, 0, n);
}
34 changes: 34 additions & 0 deletions libs/libc/machine/arm/aeabi_memclr4.c
@@ -0,0 +1,34 @@
/****************************************************************************
* libs/libc/machine/arm/aeabi_memclr4.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/

/****************************************************************************
* Included Files
****************************************************************************/

#include <string.h>

/****************************************************************************
* Public Functions
****************************************************************************/

void weak_function __aeabi_memclr4(FAR void *s, size_t n)
{
memset(s, 0, n);
}
34 changes: 34 additions & 0 deletions libs/libc/machine/arm/aeabi_memclr8.c
@@ -0,0 +1,34 @@
/****************************************************************************
* libs/libc/machine/arm/aeabi_memclr8.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/

/****************************************************************************
* Included Files
****************************************************************************/

#include <string.h>

/****************************************************************************
* Public Functions
****************************************************************************/

void weak_function __aeabi_memclr8(FAR void *s, size_t n)
{
memset(s, 0, n);
}
35 changes: 35 additions & 0 deletions libs/libc/machine/arm/aeabi_memcpy.c
@@ -0,0 +1,35 @@
/****************************************************************************
* libs/libc/machine/arm/aeabi_memcpy.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/

/****************************************************************************
* Included Files
****************************************************************************/

#include <string.h>

/****************************************************************************
* Public Functions
****************************************************************************/

void weak_function
__aeabi_memcpy(FAR void *dest, FAR const void *src, size_t n)
{
memcpy(dest, src, n);
}
35 changes: 35 additions & 0 deletions libs/libc/machine/arm/aeabi_memcpy4.c
@@ -0,0 +1,35 @@
/****************************************************************************
* libs/libc/machine/arm/aeabi_memcpy4.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/

/****************************************************************************
* Included Files
****************************************************************************/

#include <string.h>

/****************************************************************************
* Public Functions
****************************************************************************/

void weak_function
__aeabi_memcpy4(FAR void *dest, FAR const void *src, size_t n)
{
memcpy(dest, src, n);
}
35 changes: 35 additions & 0 deletions libs/libc/machine/arm/aeabi_memcpy8.c
@@ -0,0 +1,35 @@
/****************************************************************************
* libs/libc/machine/arm/aeabi_memcpy8.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/

/****************************************************************************
* Included Files
****************************************************************************/

#include <string.h>

/****************************************************************************
* Public Functions
****************************************************************************/

void weak_function
__aeabi_memcpy8(FAR void *dest, FAR const void *src, size_t n)
{
memcpy(dest, src, n);
}
35 changes: 35 additions & 0 deletions libs/libc/machine/arm/aeabi_memmove.c
@@ -0,0 +1,35 @@
/****************************************************************************
* libs/libc/machine/arm/aeabi_memmove.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/

/****************************************************************************
* Included Files
****************************************************************************/

#include <string.h>

/****************************************************************************
* Public Functions
****************************************************************************/

void weak_function
__aeabi_memmove(FAR void *dest, FAR const void *src, size_t n)
{
memmove(dest, src, n);
}
35 changes: 35 additions & 0 deletions libs/libc/machine/arm/aeabi_memmove4.c
@@ -0,0 +1,35 @@
/****************************************************************************
* libs/libc/machine/arm/aeabi_memmove4.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/

/****************************************************************************
* Included Files
****************************************************************************/

#include <string.h>

/****************************************************************************
* Public Functions
****************************************************************************/

void weak_function
__aeabi_memmove4(FAR void *dest, FAR const void *src, size_t n)
{
memmove(dest, src, n);
}
35 changes: 35 additions & 0 deletions libs/libc/machine/arm/aeabi_memmove8.c
@@ -0,0 +1,35 @@
/****************************************************************************
* libs/libc/machine/arm/aeabi_memmove8.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/

/****************************************************************************
* Included Files
****************************************************************************/

#include <string.h>

/****************************************************************************
* Public Functions
****************************************************************************/

void weak_function
__aeabi_memmove8(FAR void *dest, FAR const void *src, size_t n)
{
memmove(dest, src, n);
}
34 changes: 34 additions & 0 deletions libs/libc/machine/arm/aeabi_memset.c
@@ -0,0 +1,34 @@
/****************************************************************************
* libs/libc/machine/arm/aeabi_memset.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/

/****************************************************************************
* Included Files
****************************************************************************/

#include <string.h>

/****************************************************************************
* Public Functions
****************************************************************************/

void weak_function __aeabi_memset(FAR void *s, size_t n, int c)
{
memset(s, c, n);
}

0 comments on commit 9764040

Please sign in to comment.