Last active
April 4, 2024 16:06
-
-
Save laqieer/24dcba67310e9695f157e88ad716b248 to your computer and use it in GitHub Desktop.
Example to write string in UTF-8 encoded source file but tell compiler to store string in SJIS
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
#!/bin/sh | |
arm-none-eabi-gcc -S test.c | |
# https://gcc.gnu.org/onlinedocs/cpp/Invocation.html#index-fexec-charset | |
arm-none-eabi-gcc -S test.c -o test_sjis.s -fexec-charset=sjis |
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
const char s[] = "ああ"; |
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
.cpu arm7tdmi | |
.eabi_attribute 20, 1 | |
.eabi_attribute 21, 1 | |
.eabi_attribute 23, 3 | |
.eabi_attribute 24, 1 | |
.eabi_attribute 25, 1 | |
.eabi_attribute 26, 1 | |
.eabi_attribute 30, 6 | |
.eabi_attribute 34, 0 | |
.eabi_attribute 18, 4 | |
.file "test.c" | |
.text | |
.global s | |
.section .rodata | |
.align 2 | |
.type s, %object | |
.size s, 7 | |
s: | |
.ascii "\343\201\202\343\201\202\000" | |
.ident "GCC: (15:9-2019-q4-0ubuntu1) 9.2.1 20191025 (release) [ARM/arm-9-branch revision 277599]" |
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
.cpu arm7tdmi | |
.eabi_attribute 20, 1 | |
.eabi_attribute 21, 1 | |
.eabi_attribute 23, 3 | |
.eabi_attribute 24, 1 | |
.eabi_attribute 25, 1 | |
.eabi_attribute 26, 1 | |
.eabi_attribute 30, 6 | |
.eabi_attribute 34, 0 | |
.eabi_attribute 18, 4 | |
.file "test.c" | |
.text | |
.global s | |
.section .rodata | |
.align 2 | |
.type s, %object | |
.size s, 5 | |
s: | |
.ascii "\202\240\202\240\000" | |
.ident "GCC: (15:9-2019-q4-0ubuntu1) 9.2.1 20191025 (release) [ARM/arm-9-branch revision 277599]" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment