What does code pattern like .size X,.-X do?

感情迁移 提交于 2020-01-11 09:21:50

问题


My question is about some popular but not well documented code I have found in ARM CORTEX M startup files like this STM32.

The 'pattern' is:

.size X,.-X

,where X is a symbol or label.

I have found this answer and understand how .size directive and dot special symbol work, but still complete line seems to do nothing to me. The result of the operation .-X isn't stored anywhere.

Could anybody explain what the line does?


回答1:


That is placed at the end of function X, and the size of the function is the difference between the end of the function and the beginning. . is the current location so it's saying .size x is the difference between here and the label x.



来源:https://stackoverflow.com/questions/52818114/what-does-code-pattern-like-size-x-x-do

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!