Created
June 17, 2014 17:11
-
-
Save jroelofs/dbcdbd23f1c1e7a5f539 to your computer and use it in GitHub Desktop.
-ffreestanding memcpy for copy-ctors
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat copy_ctor.cpp | |
struct Foo { | |
char big[10240]; | |
}; | |
Foo fooCopy(const Foo * const in) { | |
return Foo(*in); | |
} | |
$ ./clang++ -target arm-none-eabi copy_ctor.cpp -c | |
$ ./arm-none-eabi-objdump -d copy_ctor.o | |
copy_ctor.o: file format elf32-littlearm | |
Disassembly of section .text: | |
00000000 <_Z7fooCopyPK3Foo>: | |
0: e92d4800 push {fp, lr} | |
4: e1a0b00d mov fp, sp | |
8: e24dd010 sub sp, sp, #16 | |
c: e1a02001 mov r2, r1 | |
10: e1a03000 mov r3, r0 | |
14: e50b1004 str r1, [fp, #-4] | |
18: e3a0cb0a mov ip, #10240 ; 0x2800 | |
1c: e58d2008 str r2, [sp, #8] | |
20: e1a0200c mov r2, ip | |
24: e58d3004 str r3, [sp, #4] | |
28: ebfffffe bl 0 <__aeabi_memcpy> | |
2c: e1a0d00b mov sp, fp | |
30: e8bd4800 pop {fp, lr} | |
34: e12fff1e bx lr | |
$ ./clang++ -target arm-none-eabi copy_ctor.cpp -c -ffreestanding | |
$ ./arm-none-eabi-objdump -d copy_ctor.o | |
copy_ctor.o: file format elf32-littlearm | |
Disassembly of section .text: | |
00000000 <_Z7fooCopyPK3Foo>: | |
0: e92d4800 push {fp, lr} | |
4: e1a0b00d mov fp, sp | |
8: e24dd010 sub sp, sp, #16 | |
c: e1a02001 mov r2, r1 | |
10: e1a03000 mov r3, r0 | |
14: e50b1004 str r1, [fp, #-4] | |
18: e3a0cb0a mov ip, #10240 ; 0x2800 | |
1c: e58d2008 str r2, [sp, #8] | |
20: e1a0200c mov r2, ip | |
24: e58d3004 str r3, [sp, #4] | |
28: ebfffffe bl 0 <__aeabi_memcpy> | |
2c: e1a0d00b mov sp, fp | |
30: e8bd4800 pop {fp, lr} | |
34: e12fff1e bx lr |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment