[英]Show macro expansions in GNU Assembler - AS - listing. Preprocess only?
I can't seem to find any command switch to show me the expansions of my macro definitions.我似乎找不到任何命令开关来显示我的宏定义的扩展。
Is there a way to do this with the GNU Assembler?有没有办法用 GNU 汇编器做到这一点?
For example, if I have a macro like this:例如,如果我有这样的宏:
.macro MACROA a
mov \a,%rax
.endm
MACROA $10
I'd like to see the expansions of this like so:我想看到这样的扩展:
; MACROA $10
mov $10, %rax
I vaguely remember seeing this but don't know where anymore.我隐约记得看到这个,但不知道在哪里了。
I tried the -a
switch but it doesn't generate expansions, only opcodes are printed next to the macro我尝试了
-a
开关,但它不生成扩展,只在宏旁边打印操作码
> as x.s -a
GAS LISTING x.s page 1
1
2
3 .text
4
5 .macro MACROA a
6 mov \a, %rax
7 .endm
8
9 _start:
10 0000 48C7C00A MACROA $10
10 000000
GAS LISTING x.s page 2
DEFINED SYMBOLS
x.s:9 .text:0000000000000000 _start
NO UNDEFINED SYMBOLS
as -a -am
enables listings with macro expansion. as -a -am
启用带有宏扩展的列表。
...
5 MACROA 10
5 0000 488B0425 > mov 10,%rax
5 0A000000
# load from absolute address 10, not mov $10, %rax.
# That's why as -Os doesn't optimize it to a 5-byte mov to eax
...
The man page implies that -am
alone would turn on listings, as well as set the listing style to include macro expansion.手册页暗示仅
-am
将打开列表,并将列表样式设置为包含宏扩展。 But in current versions of GAS (eg Binutils 2.36.1 on my system), that is not the case.但在当前版本的 GAS(例如我系统上的 Binutils 2.36.1)中,情况并非如此。 A separate listing option like bare
-a
is necessary to actually turn on listings.要实际打开列表,需要一个单独的列表选项,例如 bare
-a
。
This is a bug in GAS's option parsing;这是 GAS 的选项解析中的一个错误; feel free to report it.
随时报告。 I think they use https://sourceware.org/bugzilla/
我认为他们使用https://sourceware.org/bugzilla/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.