hi,
I have a problem with return some smalll struct in registers, instead of
memory.
I added -freg-struct-return option to C flags, but compiler omitted it.
My sample code looks like:
1 | typedef struct
|
2 | {
|
3 | unsigned int a;
|
4 | unsigned int b;
|
5 | } my_struct;
|
6 |
|
7 | my_struct my_func ( unsigned int a, unsigned int b )
|
8 | {
|
9 | my_struct s;
|
10 |
|
11 | s.a = a;
|
12 | s.b = b;
|
13 |
|
14 | return s;
|
15 | }
|
compiled with specified flags
1 | CFLAGS = -c -Os -freg-struct-return -mthumb -mbig-endian -save-temps
|
as a result I got
1 | my_func:
|
2 | str r1, [r0, #4]
|
3 | str r2, [r0]
|
4 | bx lr
|
but I expected something like
1 | my_func:
|
2 | mov r2, r0
|
3 | mov r0, r1
|
4 | mov r1, r2
|
5 | bx lr
|
I'm using latest yagarto build but I noticed that problem on other
toolchain too. Thanks for any hints.
best regards,
Bartłomiej Kubica