`_L_lock_%=` 如何在 glibc 中变成 `_L_lock_432`?
How does `_L_lock_%=` become `_L_lock_432` in glibc?
我正在阅读 glibc 源代码,试图调试死锁。
在我的堆栈跟踪中,我看到:
#0 0x00007ff58b449eec in __lll_lock_wait_private () from /lib64/libc.so.6
#1 0x00007ff58b3bda31 in _L_lock_423 () from /lib64/libc.so.6
#2 0x00007ff58b3bbca8 in __GI__IO_link_in () from /lib64/libc.so.6
#3 0x00007ff58b3bab92 in __GI__IO_file_init () from /lib64/libc.so.6
但是查看代码,对_L_lock_
的唯一引用是在lowlevellock.h
中的宏lll_lock
中。
我在内联汇编语句中看到一个字符串:
".type _L_lock_%=, @function\n"
这不知何故变成了我的调用堆栈中的函数 _L_lock_423
。 423
从哪里出现? %=
表示法是什么? %= 在汇编中是什么意思?
如gcc docs所述:
‘%=’ - Outputs a number that is unique to each instance of the asm statement in the entire compilation. This option is useful when creating local labels and referring to them multiple times in a single template that generates multiple assembler instructions.
我正在阅读 glibc 源代码,试图调试死锁。
在我的堆栈跟踪中,我看到:
#0 0x00007ff58b449eec in __lll_lock_wait_private () from /lib64/libc.so.6
#1 0x00007ff58b3bda31 in _L_lock_423 () from /lib64/libc.so.6
#2 0x00007ff58b3bbca8 in __GI__IO_link_in () from /lib64/libc.so.6
#3 0x00007ff58b3bab92 in __GI__IO_file_init () from /lib64/libc.so.6
但是查看代码,对_L_lock_
的唯一引用是在lowlevellock.h
中的宏lll_lock
中。
我在内联汇编语句中看到一个字符串:
".type _L_lock_%=, @function\n"
这不知何故变成了我的调用堆栈中的函数 _L_lock_423
。 423
从哪里出现? %=
表示法是什么? %= 在汇编中是什么意思?
如gcc docs所述:
‘%=’ - Outputs a number that is unique to each instance of the asm statement in the entire compilation. This option is useful when creating local labels and referring to them multiple times in a single template that generates multiple assembler instructions.