{"id":3051,"date":"2019-06-28T11:20:24","date_gmt":"2019-06-28T03:20:24","guid":{"rendered":"https:\/\/www.linuxcool.com\/?p=3051"},"modified":"2019-06-28T11:20:26","modified_gmt":"2019-06-28T03:20:26","slug":"objdump","status":"publish","type":"post","link":"https:\/\/www.linuxcool.com\/objdump","title":{"rendered":"objdump\u547d\u4ee4 – \u67e5\u770b\u76ee\u6807\u6587\u4ef6\u6784\u6210\u7684gcc\u5de5\u5177"},"content":{"rendered":"\n

objdump\u547d\u4ee4\u662f\u7528\u67e5\u770b\u76ee\u6807\u6587\u4ef6\u6216\u8005\u53ef\u6267\u884c\u7684\u76ee\u6807\u6587\u4ef6\u7684\u6784\u6210\u7684gcc\u5de5\u5177\u3002<\/p>\n\n\n\n

objdump\u6709\u70b9\u50cf\u5feb\u901f\u67e5\u770b\u4e4b\u7c7b\u7684\u5de5\u5177\uff0c\u5c31\u662f\u4ee5\u4e00\u79cd\u53ef\u9605\u8bfb\u7684\u683c\u5f0f\u8ba9\u4f60\u66f4\u591a\u5730\u4e86\u89e3\u4e8c\u8fdb\u5236\u6587\u4ef6\u53ef\u80fd\u5e26\u6709\u7684\u9644\u52a0\u4fe1\u606f\u3002<\/p>\n\n\n\n

\u8bed\u6cd5\u683c\u5f0f\uff1a <\/strong>objdump [\u53c2\u6570] [\u6587\u4ef6] <\/p>\n\n\n\n

\u5e38\u7528\u53c2\u6570\uff1a<\/strong><\/p>\n\n\n\n
-a<\/td>\u663e\u793a\u6863\u6848\u5e93\u7684\u6210\u5458\u4fe1\u606f\uff0c\u7c7b\u4f3cls -l\u5c06lib*.a\u7684\u4fe1\u606f\u5217\u51fa <\/td><\/tr>
-g <\/td>\u663e\u793a\u8c03\u8bd5\u4fe1\u606f<\/td><\/tr>
-d<\/td>\u4eceobjfile\u4e2d\u53cd\u6c47\u7f16\u90a3\u4e9b\u7279\u5b9a\u6307\u4ee4\u673a\u5668\u7801\u7684section<\/td><\/tr>
-D<\/td>\u4e0e -d \u7c7b\u4f3c\uff0c\u4f46\u53cd\u6c47\u7f16\u6240\u6709section<\/td><\/tr>
-f<\/td>\u663e\u793aobjfile\u4e2d\u6bcf\u4e2a\u6587\u4ef6\u7684\u6574\u4f53\u5934\u90e8\u6458\u8981\u4fe1\u606f <\/td><\/tr>
-H<\/td>\u7b80\u77ed\u7684\u5e2e\u52a9\u4fe1\u606f<\/td><\/tr>
-s<\/td>\u663e\u793a\u6307\u5b9asection\u7684\u5b8c\u6574\u5185\u5bb9\u3002\u9ed8\u8ba4\u6240\u6709\u7684\u975e\u7a7asection\u90fd\u4f1a\u88ab\u663e\u793a<\/td><\/tr><\/tbody><\/table>\n\n\n\n

\u53c2\u8003\u5b9e\u4f8b<\/strong><\/p>\n\n\n\n

\u67e5\u770b\u6863\u6848\u5e93\u6587\u4ef6\u4e2d\u7684\u4fe1\u606f\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# objdump -a libmy2.a <\/pre>\n\n\n\n

\u663e\u793amytest.o\u6587\u4ef6\u4e2d\u7684text\u6bb5\u7684\u5185\u5bb9\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# objdump --section=.text -s mytest.o<\/pre>\n\n\n\n

<\/p>\n","protected":false},"excerpt":{"rendered":"

objdump\u547d\u4ee4\u662f\u7528\u67e5\u770b\u76ee\u6807\u6587\u4ef6\u6216\u8005\u53ef\u6267\u884c\u7684\u76ee\u6807\u6587\u4ef6\u7684\u6784\u6210\u7684gcc\u5de5\u5177\u3002 objdump\u6709\u70b9\u50cf\u5feb\u901f\u67e5\u770b\u4e4b\u7c7b\u7684 […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/3051"}],"collection":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/comments?post=3051"}],"version-history":[{"count":6,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/3051\/revisions"}],"predecessor-version":[{"id":3630,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/3051\/revisions\/3630"}],"wp:attachment":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/media?parent=3051"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/categories?post=3051"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/tags?post=3051"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}