我正在尝试制作一个概念证明程序,以查看GNU as
是否有一种方法来定义类似于.asciz的UTF-16字符串,而无需使用外部C来定义UTF-16字符串。
GNU汇编程序是否具有.asciz的UTF-16版本以使以下代码更清晰? (使用gcc test.S -o test
编译)
.global _WinMain@16
.section .text
// windows application entry takes 16 bytes on stack
// that it is responsible of getting rid of
// along with return address, before returning.
_WinMain@16:
// ascii version
push $_ascii_msg
call _puts
add $4, %esp
// brute force unicode version
push $_brute_unicode_msg
call __putws
add $4, %esp
mov $0, %eax
ret $16
_ascii_msg:
.asciz "Hello, World!"
// ascii conveniently occupies first 256 bytes of the unicode table.
_brute_unicode_msg:
.word 'H', 'e', 'l', 'l', 'o', ',', ' ', 'W', 'o', 'r', 'l', 'd', '!', 0