Skip to content

Commit 07ac701

Browse files
committed
RISC-V: Align part of functions to 4bytes.
Co-Authored by: Cooper-Qu
1 parent faf3eb7 commit 07ac701

File tree

6 files changed

+6
-3
lines changed

6 files changed

+6
-3
lines changed

newlib/libc/machine/riscv/memcpy.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
#define unlikely(X) __builtin_expect (!!(X), 0)
2121

22-
void *
22+
__attribute__((aligned(4))) void *
2323
__inhibit_loop_to_libcall
2424
memcpy(void *__restrict aa, const void *__restrict bb, size_t n)
2525
{

newlib/libc/machine/riscv/memset.S

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
.text
1313
.global memset
1414
.type memset, @function
15+
.align 2
1516
memset:
1617
#if defined(PREFER_SIZE_OVER_SPEED) && defined(__OPTIMIZE_SIZE__)
1718
mv t1, a0

newlib/libc/machine/riscv/setjmp.S

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
/* int setjmp (jmp_buf); */
1515
.globl setjmp
1616
.type setjmp, @function
17+
.align 2
1718
setjmp:
1819
REG_S ra, 0*SZREG(a0)
1920
REG_S s0, 1*SZREG(a0)

newlib/libc/machine/riscv/strcmp.S

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
.text
2222
.globl strcmp
2323
.type strcmp, @function
24+
.align 2
2425
strcmp:
2526
#if defined(PREFER_SIZE_OVER_SPEED) && defined(__OPTIMIZE_SIZE__)
2627
1:

newlib/libc/machine/riscv/strcpy.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include <string.h>
1313
#include <stdint.h>
1414

15-
char *strcpy(char *dst, const char *src)
15+
__attribute__((aligned(4))) char *strcpy(char *dst, const char *src)
1616
{
1717
char *dst0 = dst;
1818

newlib/libc/machine/riscv/strlen.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include <string.h>
1313
#include <stdint.h>
1414

15-
size_t strlen(const char *str)
15+
__attribute__((aligned(4))) size_t strlen(const char *str)
1616
{
1717
const char *start = str;
1818

0 commit comments

Comments
 (0)