Created
November 30, 2021 16:52
-
-
Save earlephilhower/60a11311c7c86445cfcd28ef38a31c52 to your computer and use it in GitHub Desktop.
GCC assembly output
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
#include <Arduino.h> | |
void addresses(const char* const begin, const char* const end) { | |
::printf("%p:%p -> (%u)\n", begin, end, end - begin); | |
} | |
#if 0 | |
template <size_t Size> | |
void addresses(const char (&buf)[Size]) { | |
addresses(std::begin(buf), std::end(buf)); | |
} | |
#elif 1 | |
#define addresses(X)\ | |
addresses(&X[0], &X[sizeof(X)]) | |
#else | |
template <size_t Size> | |
void addresses(const char (&buf)[Size]) { | |
addresses(&buf[0], &buf[Size]); | |
} | |
#endif | |
#if 0 | |
#define EMPTY_STRING "" | |
#define COMMA_STRING "," | |
#else | |
static const char EMPTY_STRING[] = ""; | |
static const char COMMA_STRING[] = ","; | |
#endif | |
void test() { | |
addresses(EMPTY_STRING); | |
addresses(COMMA_STRING); | |
} | |
void setup() { | |
Serial.begin(115200); | |
delay(1000); | |
::puts("\n\n\n"); | |
test(); | |
} | |
void loop() { | |
delay(100); | |
} |
earle@server:~/Arduino/hardware/esp8266com/esp8266$ cat a.s
.file "a.cpp"
.text
.section .rodata.str1.1,"aMS",@progbits,1
.LC0:
.string "%p:%p -> (%u)\n"
.text
.literal_position
.literal .LC1, .LC0
.align 4
.global _Z9addressesPKcS0_
.type _Z9addressesPKcS0_, @function
_Z9addressesPKcS0_:
.LFB1030:
sub a5, a3, a2
mov.n a4, a3
mov.n a3, a2
l32r a2, .LC1
addi sp, sp, -16
.LCFI0:
s32i.n a0, sp, 12
.LCFI1:
call0 printf
l32i.n a0, sp, 12
addi sp, sp, 16
ret.n
.LFE1030:
.size _Z9addressesPKcS0_, .-_Z9addressesPKcS0_
.section .rodata.str1.1
.LC2:
.string ""
.LC5:
.string ","
.text
.literal_position
.literal .LC3, .LC2+1
.literal .LC4, .LC2
.literal .LC6, .LC5+2
.literal .LC7, .LC5
.align 4
.global _Z4testv
.type _Z4testv, @function
_Z4testv:
.LFB1032:
l32r a3, .LC3
l32r a2, .LC4
addi sp, sp, -16
.LCFI2:
s32i.n a0, sp, 12
.LCFI3:
call0 _Z9addressesPKcS0_
l32r a3, .LC6
l32r a2, .LC7
call0 _Z9addressesPKcS0_
l32i.n a0, sp, 12
addi sp, sp, 16
ret.n
.LFE1032:
.size _Z4testv, .-_Z4testv
.section .eh_frame,"a",@progbits
.Lframe1:
.4byte .LECIE1-.LSCIE1
.LSCIE1:
.4byte 0
.byte 0x3
.string ""
.uleb128 0x1
.sleb128 -4
.uleb128 0
.byte 0xc
.uleb128 0x1
.uleb128 0
.align 4
.LECIE1:
.LSFDE1:
.4byte .LEFDE1-.LASFDE1
.LASFDE1:
.4byte .LASFDE1-.Lframe1
.4byte .LFB1030
.4byte .LFE1030-.LFB1030
.byte 0x4
.4byte .LCFI0-.LFB1030
.byte 0xe
.uleb128 0x10
.byte 0x4
.4byte .LCFI1-.LCFI0
.byte 0x80
.uleb128 0x1
.align 4
.LEFDE1:
.LSFDE3:
.4byte .LEFDE3-.LASFDE3
.LASFDE3:
.4byte .LASFDE3-.Lframe1
.4byte .LFB1032
.4byte .LFE1032-.LFB1032
.byte 0x4
.4byte .LCFI2-.LFB1032
.byte 0xe
.uleb128 0x10
.byte 0x4
.4byte .LCFI3-.LCFI2
.byte 0x80
.uleb128 0x1
.align 4
.LEFDE3:
.ident "GCC: (GNU) 10.3.0"
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
earle@server:~/Arduino/hardware/esp8266com/esp8266$ ./tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-g++ -S -Os /tmp/a.cpp