{"id":115961,"date":"2026-10-20T15:17:27","date_gmt":"2026-10-20T07:17:27","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/115961.html"},"modified":"2026-10-20T15:17:27","modified_gmt":"2026-10-20T07:17:27","slug":"%e3%80%90linux-system%e3%80%91%e3%80%90elf%e5%8a%a0%e8%bd%bd%e6%8f%ad%e7%a7%98%ef%bc%9a%e4%bb%8e%e7%a3%81%e7%9b%98%e5%88%b0cpu%e7%9a%84%e7%a1%ac%e6%a0%b8%e6%97%85%e7%a8%8b%e3%80%91%e6%b5%81%e9%a3%9f","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/115961.html","title":{"rendered":"\u3010Linux-System\u3011\u3010ELF\u52a0\u8f7d\u63ed\u79d8\uff1a\u4ece\u78c1\u76d8\u5230CPU\u7684\u786c\u6838\u65c5\u7a0b\u3011\u6d41\u98df\u822c\u6295\u5582"},"content":{"rendered":"<p>        \/* MD \/ \u5bcc\u6587\u672c\u4e2d\u7684 .toc\uff08\u542b\u535a\u5ba2\u56ed\u642c\u5bb6\u7b49\u5d4c\u5957\u7ed3\u6784\uff09\uff1b.toc-box \u5728\u4fa7\u680f\uff0c\u4e0d\u53d7\u5f71\u54cd *\/<br \/>\n        #content_views .toc,<br \/>\n        \/* \u7f16\u8f91\u5668\u5e38\u5728\u76ee\u5f55\u524d\u540e\u63d2\u5165\u7a7a p\uff08:empty \u4ecd\u5360 20px\uff09\uff0c\u4e00\u5e76\u53bb\u6389\u907f\u514d\u9876\u7a7a\u9699 *\/<br \/>\n        #content_views.markdown_views &gt; p:empty:has(+ .toc),<br \/>\n        #content_views.markdown_views &gt; .toc + p:empty,<br \/>\n        \/* \u5bcc\u6587\u672c\u65e7\u7248\u76ee\u5f55\u6807\u8bb0 *\/<br \/>\n        #content_views.htmledit_views #main-toc,<br \/>\n        #content_views.htmledit_views #hr-toc,<br \/>\n        #content_views.htmledit_views p[id*=\\&#8221;-toc\\&#8221;] {<br \/>\n          display: none !important;<br \/>\n        }<br \/>\n        \/* \u76ee\u5f55\u53bb\u6389\u540e\uff0c\u7d27\u8ddf\u7684\u9996\u4e2a\u6807\u9898\u4e0d\u518d\u591a\u51fa\u4e00\u5757\u4e0a\u8fb9\u8ddd *\/<br \/>\n        #content_views.markdown_views &gt; .toc + h1,<br \/>\n        #content_views.markdown_views &gt; .toc + h2,<br \/>\n        #content_views.markdown_views &gt; .toc + h3,<br \/>\n        #content_views.markdown_views &gt; .toc + h4,<br \/>\n        #content_views.markdown_views &gt; .toc + p:empty + h1,<br \/>\n        #content_views.markdown_views &gt; .toc + p:empty + h2,<br \/>\n        #content_views.markdown_views &gt; .toc + p:empty + h3,<br \/>\n        #content_views.markdown_views &gt; .toc + p:empty + h4 {<br \/>\n          margin-top: 0 !important;<br \/>\n        }<\/p>\n<h3>&#x1f4dd; \u535a\u5ba2\u5199\u624b\u4e13\u5bb6<\/h3>\n<p>ELF\u7a0b\u5e8f\u52a0\u8f7d\u4e0e\u52a8\u6001\u94fe\u63a5\u539f\u7406&#xff1a;\u4ece\u78c1\u76d8\u4e0a\u7684\u201c0\u5730\u5740\u201d\u5230CPU\u53d6\u6307\u6267\u884c\u7684\u5168\u94fe\u8def\u62c6\u89e3<\/p>\n<p>\u2014\u2014\u4e00\u5802\u628a\u7f16\u8bd1\u539f\u7406\u3001\u6587\u4ef6\u7cfb\u7edf\u3001\u5185\u5b58\u7ba1\u7406\u3001\u8fdb\u7a0b\u52a0\u8f7d\u4e32\u6210\u7ebf\u7684\u786c\u6838\u8bfe<\/p>\n<hr \/>\n<h4>\u5f15\u8a00&#xff1a;\u4e3a\u4ec0\u4e48\u4f60\u5199\u7684C\u4ee3\u7801\u8dd1\u8d77\u6765&#xff0c;\u8fdc\u6bd4\u201c\u7f16\u8bd1-\u8fd0\u884c\u201d\u56db\u4e2a\u5b57\u590d\u6742\u5f97\u591a&#xff1f;<\/h4>\n<p>\u5f88\u591a\u521d\u5b66\u8005\u4ee5\u4e3a&#xff0c;\u7a0b\u5e8f\u7684\u751f\u547d\u5468\u671f\u4e0d\u8fc7\u662f gcc hello.c -o hello \u7136\u540e .\/hello\u3002\u4f46\u8fd9\u5802\u8bfe\u4f1a\u628a\u8fd9\u4e00\u8fc7\u7a0b\u5f7b\u5e95\u62c6\u5f00&#xff1a;\u4f60\u7684\u4ee3\u7801\u662f\u5982\u4f55\u5728\u78c1\u76d8\u4e0a\u62e5\u6709\u201c\u5730\u5740\u201d\u7684&#xff1f;\u53ef\u6267\u884c\u6587\u4ef6\u51ed\u4ec0\u4e48\u4e0d\u662f\u7b80\u5355\u7684\u201c\u4ee3\u7801&#043;\u6570\u636e\u201d\u5806\u5728\u4e00\u8d77&#xff1f;\u64cd\u4f5c\u7cfb\u7edf\u600e\u4e48\u77e5\u9053\u8be5\u628a\u54ea\u6bb5\u52a0\u8f7d\u5230\u54ea\u91cc&#xff1f;\u52a8\u6001\u5e93\u51ed\u4ec0\u4e48\u80fd\u88ab\u201c\u5171\u4eab\u201d&#xff1f;\u4ee5\u53ca&#xff0c;\u4e3a\u4ec0\u4e48\u4f60\u6572\u4e0b\u7684 main \u51fd\u6570&#xff0c;\u6839\u672c\u4e0d\u662f\u7a0b\u5e8f\u8fd0\u884c\u7684\u771f\u6b63\u8d77\u70b9&#xff1f;<\/p>\n<p>\u8fd9\u7bc7\u6587\u7ae0\u5c06\u57fa\u4e8e\u8bfe\u5802\u5b9e\u5f55\u4e0e\u677f\u4e66&#xff0c;\u5b8c\u6574\u68b3\u7406\u4ece\u6e90\u7801\u5230\u8fdb\u7a0b\u3001\u4ece\u9759\u6001\u94fe\u63a5\u5230\u52a8\u6001\u5171\u4eab\u7684\u6bcf\u4e00\u4e2a\u5173\u952e\u8282\u70b9\u3002\u6211\u4eec\u4f1a\u4fdd\u7559\u8bfe\u5802\u4e0a\u6240\u6709\u7684\u5b9e\u6218\u547d\u4ee4&#xff08;readelf\u3001objdump\u3001ldd&#xff09;\u3001\u7ecf\u5178\u793a\u4f8b&#xff08;hello.c &#043; code.c \u94fe\u63a5\u5b9e\u9a8c&#xff09;\u548c\u90a3\u4e9b\u5bb9\u6613\u88ab\u5ffd\u7565\u7684\u201c\u96f6\u788e\u77e5\u8bc6\u70b9\u201d\u2014\u2014\u5305\u62ec\u4e3a\u4ec0\u4e48 .bss \u6bb5 Better Save Space&#xff0c;\u4e3a\u4ec0\u4e48\u5185\u5b58\u7ba1\u7406\u7684\u57fa\u672c\u5355\u4f4d 4KB \u51b3\u5b9a\u4e86 Section \u5408\u5e76\u6210 Segment \u7684\u5fc5\u7136\u6027&#xff0c;\u4ee5\u53ca _start \u51fd\u6570\u5728\u8c03\u7528\u4f60\u7684 main \u4e4b\u524d\u5230\u5e95\u5077\u5077\u5e72\u4e86\u591a\u5c11\u810f\u6d3b\u7d2f\u6d3b\u3002<\/p>\n<hr \/>\n<h4>\u4e00\u3001ELF\u6587\u4ef6\u683c\u5f0f&#xff1a;\u53ef\u6267\u884c\u7a0b\u5e8f\u4e0d\u662f\u201c\u4ee3\u7801&#043;\u6570\u636e\u201d\u90a3\u4e48\u7b80\u5355<\/h4>\n<h5>1.1 \u56db\u5927\u7ec4\u6210\u90e8\u5206\u4e0e\u201c\u53cc\u91cd\u89c6\u89d2\u201d<\/h5>\n<p>\u4e00\u4e2a ELF&#xff08;Executable and Linkable Format&#xff09;\u53ef\u6267\u884c\u7a0b\u5e8f\u7531\u56db\u5927\u5757\u6784\u6210&#xff1a;<\/p>\n<li>ELF Header&#xff1a;\u6587\u4ef6\u7684\u201c\u6237\u53e3\u672c\u201d&#xff0c;\u8bb0\u5f55\u6574\u4e2a\u6587\u4ef6\u7684\u7ba1\u7406\u4fe1\u606f\u3002<\/li>\n<li>Program Header Table&#xff1a;\u7ed9\u64cd\u4f5c\u7cfb\u7edf\u52a0\u8f7d\u5668\u770b\u7684\u201c\u914d\u9001\u5355\u201d&#xff0c;\u63cf\u8ff0\u54ea\u4e9b Section \u8be5\u5408\u5e76\u6210 Segment&#xff0c;\u4ee5\u53ca\u52a0\u8f7d\u5230\u5185\u5b58\u65f6\u7684\u6743\u9650&#xff08;\u8bfb\/\u5199\/\u6267\u884c&#xff09;\u3002<\/li>\n<li>Section Header Table&#xff1a;\u7ed9\u7f16\u8bd1\u5668\u548c\u94fe\u63a5\u5668\u770b\u7684\u201c\u65bd\u5de5\u56fe\u201d&#xff0c;\u63cf\u8ff0 .text\u3001.data\u3001.bss \u7b49\u6bcf\u4e2a\u6570\u636e\u8282\u7684\u5c5e\u6027\u3001\u504f\u79fb\u91cf\u548c\u5927\u5c0f\u3002<\/li>\n<li>\u6570\u636e\u8282&#xff08;Section&#xff09;&#xff1a;\u771f\u6b63\u5b58\u653e\u4ee3\u7801\u3001\u6570\u636e\u3001\u7b26\u53f7\u8868\u7b49\u5185\u5bb9\u7684\u5730\u65b9\u3002<\/li>\n<hr \/>\n<p>&#x1f4cc;\u4e0b\u9762\u662fELF\u6587\u4ef6\u683c\u5f0f\u9884\u89c8\u56fe&#xff1a;<img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261020071723-6ad715837ada8.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<hr \/>\n<p>\u8fd9\u91cc\u6709\u4e00\u4e2a\u8d2f\u7a7f\u5168\u6587\u7684\u6838\u5fc3\u601d\u60f3&#xff1a;ELF \u6587\u4ef6\u5b58\u5728\u4e24\u4e2a\u89c6\u89d2\u3002<\/p>\n<ul>\n<li>\u7f16\u8bd1\u4e0e\u94fe\u63a5\u89c6\u89d2&#xff1a;\u5173\u5fc3 Section Header Table\u3002\u94fe\u63a5\u5668\u628a\u591a\u4e2a .o \u6587\u4ef6\u7684 Section \u5408\u5e76&#xff0c;\u5f62\u6210\u6700\u7ec8\u7684\u53ef\u6267\u884c\u6587\u4ef6\u3002<\/li>\n<li>\u6267\u884c\u4e0e\u52a0\u8f7d\u89c6\u89d2&#xff1a;\u5173\u5fc3 Program Header Table\u3002\u64cd\u4f5c\u7cfb\u7edf\u4e0d\u5173\u5fc3\u4f60\u6709 30 \u4e2a Section&#xff0c;\u5b83\u53ea\u5173\u5fc3\u8be5\u628a\u54ea\u4e9b\u4e1c\u897f\u6253\u5305\u6210\u51e0\u4e2a Segment \u585e\u8fdb\u5185\u5b58\u3002<\/li>\n<\/ul>\n<h5>1.2 Section \u4e0e Segment&#xff1a;\u4e3a\u4ec0\u4e48\u8981\u201c\u5408\u5e76\u201d&#xff1f;<\/h5>\n<p>\u8bfe\u5802\u4e0a\u8001\u5e08\u7528 readelf -S \/usr\/bin\/ls \u505a\u4e86\u4e00\u4e2a\u73b0\u573a\u5b9e\u9a8c\u3002\u8f93\u51fa\u663e\u793a ls \u547d\u4ee4\u8db3\u8db3\u6709 30 \u4e2a Section&#xff08;\u4ece 0 \u7f16\u53f7\u5230 29&#xff09;\u3002\u4f46\u64cd\u4f5c\u7cfb\u7edf\u80fd\u76f4\u63a5\u628a\u8fd9 30 \u4e2a\u5c0f\u788e\u5757\u5206\u522b\u52a0\u8f7d\u8fdb\u5185\u5b58\u5417&#xff1f;<\/p>\n<p>\u4e0d\u80fd\u3002\u56e0\u4e3a\u5185\u5b58\u7ba1\u7406\u7684\u57fa\u672c\u5355\u4f4d\u662f 4KB&#xff08;\u4e00\u9875&#xff09;\u3002 \u78c1\u76d8\u4e0e\u5185\u5b58\u8fdb\u884c I\/O \u4ea4\u4e92\u65f6&#xff0c;\u57fa\u672c\u5355\u4f4d\u4e5f\u662f 4KB\u3002\u5982\u679c\u4e00\u4e2a .text \u53ea\u6709 1KB\u3001\u4e00\u4e2a .rodata \u53ea\u6709 512 \u5b57\u8282&#xff0c;\u5404\u81ea\u72ec\u5360\u4e00\u9875&#xff0c;\u5185\u5b58\u4f1a\u8fc5\u901f\u88ab\u788e\u7247\u6491\u7206\u3002\u8001\u5e08\u4e3e\u4e86\u4e00\u4e2a\u7cbe\u786e\u7684\u4f8b\u5b50&#xff1a;<\/p>\n<p>\u5047\u8bbe\u4ee3\u7801\u6bb5\u5b9e\u9645\u5360 4097 \u5b57\u8282&#xff0c;\u53ea\u8bfb\u6570\u636e\u5360 512 \u5b57\u8282\u3002\u5982\u679c\u4e0d\u5408\u5e76&#xff0c;\u4ee3\u7801\u6bb5\u8981\u5360\u4e24\u9875&#xff08;4096&#043;1 \u5404\u4e00\u9875&#xff09;&#xff0c;\u53ea\u8bfb\u6570\u636e\u72ec\u5360\u4e00\u9875&#xff0c;\u603b\u5171 3 \u9875\u3002\u4f46\u5982\u679c\u628a .text \u548c .rodata \u5408\u5e76\u6210\u4e00\u4e2a Segment&#xff0c;\u603b\u5171 4609 \u5b57\u8282&#xff0c;\u53ea\u9700 2 \u9875 \u5373\u53ef\u88c5\u4e0b\u3002<\/p>\n<p>\u8fd9\u5c31\u662f Section \u5408\u5e76\u4e3a Segment \u7684\u6839\u672c\u539f\u56e0&#xff1a;\u51cf\u5c11\u9875\u9762\u788e\u7247&#xff0c;\u63d0\u9ad8\u5185\u5b58\u5229\u7528\u7387&#xff0c;\u540c\u65f6\u57fa\u4e8e\u6743\u9650\u5b9e\u73b0\u8bbf\u95ee\u63a7\u5236&#xff08;\u4ee3\u7801\u53ea\u8bfb\u3001\u6570\u636e\u53ef\u5199\u3001\u5806\u6808\u53ef\u6267\u884c\u7b49\u6743\u9650\u63a7\u5236&#xff09;\u3002<\/p>\n<p>\u7528 readelf -l \/usr\/bin\/ls \u9a8c\u8bc1&#xff0c;\u539f\u672c\u7684 30 \u4e2a Section \u88ab\u5408\u5e76\u6210\u4e86 9 \u4e2a Program Header&#xff08;Segment&#xff09;\u3002\u8f93\u51fa\u4e2d\u7684 Section to Segment mapping \u6e05\u6670\u663e\u793a\u4e86 .text\u3001.rodata \u5408\u5e76\u4e3a\u53ea\u8bfb\u53ef\u6267\u884c\u7684\u4ee3\u7801\u6bb5&#xff0c;.data\u3001.bss \u5408\u5e76\u4e3a\u53ef\u8bfb\u5199\u7684\u6570\u636e\u6bb5\u3002<\/p>\n<h5>1.3 BSS \u6bb5&#xff1a;Better Save Space<\/h5>\n<p>\u8bfe\u5802\u4e0a\u5bf9 .bss \u7684\u8bb2\u89e3\u975e\u5e38\u751f\u52a8\u3002\u5168\u5c40\u53d8\u91cf\u5206\u4e24\u79cd&#xff1a;\u5df2\u521d\u59cb\u5316\u548c\u672a\u521d\u59cb\u5316\u3002\u5df2\u521d\u59cb\u5316\u7684\u5fc5\u987b\u8bb0\u5f55\u5177\u4f53\u503c&#xff08;\u5982 int a &#061; 10&#xff09;&#xff0c;\u5b58\u5728 .data\u3002\u4f46\u672a\u521d\u59cb\u5316\u7684&#xff08;\u5982 int b;&#xff09;&#xff0c;\u9ed8\u8ba4\u503c\u5168\u662f 0\u3002<\/p>\n<p>\u5982\u679c\u5b9a\u4e49\u4e86 50 \u4e2a\u672a\u521d\u59cb\u5316\u7684 int&#xff0c;\u96be\u9053\u8981\u5728\u78c1\u76d8\u4e0a\u8bb0\u5f55 50 \u4e2a 0 \u5417&#xff1f;\u6ca1\u5fc5\u8981\u3002.bss \u5728\u78c1\u76d8\u4e0a\u53ea\u8bb0\u5f55\u4e00\u4e2a\u603b\u5927\u5c0f&#xff08;\u6bd4\u5982 50&#xff09;&#xff0c;\u52a0\u8f7d\u5230\u5185\u5b58\u65f6\u518d\u4e00\u6b21\u6027\u5f00\u8f9f 50\u00d74&#061;200 \u5b57\u8282\u5e76\u6e05\u96f6\u3002<\/p>\n<p>.bss \u7684\u5168\u79f0\u88ab\u8001\u5e08\u620f\u79f0\u4e3a Better Save Space\u2014\u2014\u5b83\u8282\u7701\u7684\u662f\u78c1\u76d8\u7a7a\u95f4\u3002\u52a0\u8f7d\u65f6\u624d\u771f\u6b63\u5c55\u5f00\u5e76\u521d\u59cb\u5316\u6e05\u96f6&#xff0c;\u8fd9\u4e5f\u662f\u4e3a\u4ec0\u4e48\u672a\u521d\u59cb\u5316\u5168\u5c40\u53d8\u91cf\u5929\u751f\u4e3a 0 \u7684\u5e95\u5c42\u673a\u5236\u3002<\/p>\n<h5>1.4 ELF Header \u7684 Magic \u4e0e\u5165\u53e3\u5730\u5740<\/h5>\n<p>\u7528 readelf -h \u8bfb\u53d6 \/usr\/bin\/ls&#xff0c;\u4f60\u4f1a\u770b\u5230&#xff1a;<\/p>\n<ul>\n<li>\n<p>Magic&#xff1a;\u6587\u4ef6\u5f00\u5934\u4e00\u4e32\u56fa\u5b9a\u9b54\u6570&#xff08;\u5982 7f 45 4c 46&#xff09;&#xff0c;\u64cd\u4f5c\u7cfb\u7edf\u9760\u5b83\u5224\u65ad\u201c\u8fd9\u8d27\u662f\u4e0d\u662f ELF\u201d\u3002\u51e0\u4e4e\u6240\u6709\u4e8c\u8fdb\u5236\u683c\u5f0f&#xff08;\u56fe\u7247\u3001\u97f3\u4e50\u3001\u89c6\u9891&#xff09;\u5f00\u5934\u90fd\u6709 Magic&#xff0c;\u7c7b\u4f3c\u4e8e\u6587\u4ef6\u7684\u201c\u8eab\u4efd\u8bc1\u201d\u3002<img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261020071724-6ad7158405a9f.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<\/li>\n<li>\n<p>Entry point address&#xff1a;\u7a0b\u5e8f\u7684\u5165\u53e3\u5730\u5740\u3002\u5bf9\u4e8e ls&#xff0c;\u5b83\u662f\u4e00\u4e2a\u7c7b\u4f3c 0x401430 \u7684\u865a\u62df\u5730\u5740\u3002\u8fd9\u4e2a\u5730\u5740\u6307\u5411\u7684\u4e0d\u662f\u4f60\u7684 main \u51fd\u6570&#xff0c;\u800c\u662f _start\u3002\u540e\u6587\u4f1a\u8be6\u7ec6\u5c55\u5f00\u3002<\/p>\n<\/li>\n<\/ul>\n<hr \/>\n<p>\u4e0b\u9762\u662f ELF \u6587\u4ef6\u7684\u53cc\u91cd\u89c6\u89d2\u4e0e Section \u5408\u5e76\u4e3a Segment \u7684\u793a\u610f\u56fe&#xff1a;<\/p>\n<p>#mermaid-svg-Tleiinxoa3wUfc0M{font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-Tleiinxoa3wUfc0M .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-Tleiinxoa3wUfc0M .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-Tleiinxoa3wUfc0M .error-icon{fill:#552222;}#mermaid-svg-Tleiinxoa3wUfc0M .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-Tleiinxoa3wUfc0M .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-Tleiinxoa3wUfc0M .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-Tleiinxoa3wUfc0M .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-Tleiinxoa3wUfc0M .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-Tleiinxoa3wUfc0M .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-Tleiinxoa3wUfc0M .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-Tleiinxoa3wUfc0M .marker{fill:#333333;stroke:#333333;}#mermaid-svg-Tleiinxoa3wUfc0M .marker.cross{stroke:#333333;}#mermaid-svg-Tleiinxoa3wUfc0M svg{font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-Tleiinxoa3wUfc0M p{margin:0;}#mermaid-svg-Tleiinxoa3wUfc0M .label{font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;color:#333;}#mermaid-svg-Tleiinxoa3wUfc0M .cluster-label text{fill:#333;}#mermaid-svg-Tleiinxoa3wUfc0M .cluster-label span{color:#333;}#mermaid-svg-Tleiinxoa3wUfc0M .cluster-label span p{background-color:transparent;}#mermaid-svg-Tleiinxoa3wUfc0M .label text,#mermaid-svg-Tleiinxoa3wUfc0M span{fill:#333;color:#333;}#mermaid-svg-Tleiinxoa3wUfc0M .node rect,#mermaid-svg-Tleiinxoa3wUfc0M .node circle,#mermaid-svg-Tleiinxoa3wUfc0M .node ellipse,#mermaid-svg-Tleiinxoa3wUfc0M .node polygon,#mermaid-svg-Tleiinxoa3wUfc0M .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-Tleiinxoa3wUfc0M .rough-node .label text,#mermaid-svg-Tleiinxoa3wUfc0M .node .label text,#mermaid-svg-Tleiinxoa3wUfc0M .image-shape .label,#mermaid-svg-Tleiinxoa3wUfc0M .icon-shape .label{text-anchor:middle;}#mermaid-svg-Tleiinxoa3wUfc0M .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-Tleiinxoa3wUfc0M .rough-node .label,#mermaid-svg-Tleiinxoa3wUfc0M .node .label,#mermaid-svg-Tleiinxoa3wUfc0M .image-shape .label,#mermaid-svg-Tleiinxoa3wUfc0M .icon-shape .label{text-align:center;}#mermaid-svg-Tleiinxoa3wUfc0M .node.clickable{cursor:pointer;}#mermaid-svg-Tleiinxoa3wUfc0M .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-Tleiinxoa3wUfc0M .arrowheadPath{fill:#333333;}#mermaid-svg-Tleiinxoa3wUfc0M .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-Tleiinxoa3wUfc0M .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-Tleiinxoa3wUfc0M .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-Tleiinxoa3wUfc0M .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-Tleiinxoa3wUfc0M .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-Tleiinxoa3wUfc0M .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-Tleiinxoa3wUfc0M .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-Tleiinxoa3wUfc0M .cluster text{fill:#333;}#mermaid-svg-Tleiinxoa3wUfc0M .cluster span{color:#333;}#mermaid-svg-Tleiinxoa3wUfc0M div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-Tleiinxoa3wUfc0M .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-Tleiinxoa3wUfc0M rect.text{fill:none;stroke-width:0;}#mermaid-svg-Tleiinxoa3wUfc0M .icon-shape,#mermaid-svg-Tleiinxoa3wUfc0M .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-Tleiinxoa3wUfc0M .icon-shape p,#mermaid-svg-Tleiinxoa3wUfc0M .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-Tleiinxoa3wUfc0M .icon-shape .label rect,#mermaid-svg-Tleiinxoa3wUfc0M .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-Tleiinxoa3wUfc0M .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-Tleiinxoa3wUfc0M .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-Tleiinxoa3wUfc0M :root{&#8211;mermaid-font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;}<span class=\"edgeLabel\"><\/span><span class=\"edgeLabel\"><\/span><span class=\"edgeLabel\"><\/p>\n<p>\u5408\u5e76 Section<\/p>\n<p><\/span><span class=\"edgeLabel\"><\/p>\n<p>\u6309\u6743\u9650\u6620\u5c04<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>\u5185\u5b58\u4e2d\u7684 Segment<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>\u4ee3\u7801\u6bb5&#xff08;R E&#xff09;.text &#043; .rodata \u5408\u5e76<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>\u6570\u636e\u6bb5&#xff08;RW&#xff09;.data &#043; .bss \u5408\u5e76<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>\u6267\u884c\u4e0e\u52a0\u8f7d\u89c6\u89d2&#xff08;Program Header Table&#xff09;<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>\u64cd\u4f5c\u7cfb\u7edf\u6309 Segment \u52a0\u8f7d<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>\u7f16\u8bd1\u4e0e\u94fe\u63a5\u89c6\u89d2&#xff08;Section Header Table&#xff09;<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>\u94fe\u63a5\u5668\u5408\u5e76 Section<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>\u78c1\u76d8\u4e0a\u7684 ELF \u6587\u4ef6<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>30 \u4e2a Section.text \/ .rodata \/ .data \/ .bss &#8230;<\/p>\n<p><\/span><\/p>\n<p>\u56fe\u89e3&#xff1a; \u78c1\u76d8\u4e0a\u7684 30 \u4e2a Section \u901a\u8fc7\u4e24\u4e2a\u89c6\u89d2\u88ab\u5904\u7406\u2014\u2014\u94fe\u63a5\u5668\u6309 Section \u5408\u5e76&#xff0c;\u64cd\u4f5c\u7cfb\u7edf\u6309 Segment \u52a0\u8f7d&#xff0c;\u6700\u7ec8\u5728\u5185\u5b58\u4e2d\u5f62\u6210\u53ea\u8bfb\u7684\u4ee3\u7801\u6bb5\u4e0e\u53ef\u8bfb\u5199\u7684\u6570\u636e\u6bb5\u3002<\/p>\n<h4>\u4e8c\u3001\u9759\u6001\u94fe\u63a5&#xff1a;\u7b26\u53f7\u89e3\u6790\u4e0e\u5730\u5740\u91cd\u5b9a\u4f4d<\/h4>\n<p>\u9759\u6001\u94fe\u63a5\u7684\u672c\u8d28&#xff0c;\u662f\u628a\u591a\u4e2a .o \u6587\u4ef6\u548c\u9759\u6001\u5e93\u201c\u7cca\u201d\u6210\u4e00\u4e2a\u72ec\u7acb\u7684\u53ef\u6267\u884c\u6587\u4ef6\u3002\u8bfe\u4e0a\u7528 hello.c \u548c code.c \u505a\u4e86\u4e00\u4e2a\u6781\u7b80\u4f46\u8db3\u591f\u8bf4\u660e\u95ee\u9898\u7684\u5b9e\u9a8c\u3002<\/p>\n<h5>2.1 \u5b9e\u9a8c\u73af\u5883&#xff1a;\u4e24\u4e2a C \u6587\u4ef6&#xff0c;\u4e09\u4e2a\u7f16\u8bd1\u9636\u6bb5<\/h5>\n<p><span class=\"token comment\">\/* hello.c *\/<\/span><br \/>\n<span class=\"token keyword\">int<\/span> <span class=\"token function\">run<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span>  <span class=\"token comment\">\/* \u58f0\u660e\u5916\u90e8\u51fd\u6570 *\/<\/span><br \/>\n<span class=\"token keyword\">int<\/span> <span class=\"token function\">main<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token function\">printf<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;hello&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token function\">run<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p><span class=\"token comment\">\/* code.c *\/<\/span><br \/>\n<span class=\"token keyword\">int<\/span> <span class=\"token function\">run<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token function\">printf<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;run func&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u7f16\u8bd1\u4e3a .o&#xff1a;<\/p>\n<p>gcc <span class=\"token parameter variable\">-c<\/span> hello.c <span class=\"token parameter variable\">-o<\/span> hello.o<br \/>\ngcc <span class=\"token parameter variable\">-c<\/span> code.c <span class=\"token parameter variable\">-o<\/span> code.o<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261020071724-6ad715841cc68.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<hr \/>\n<h5>2.2 \u7b26\u53f7\u8868&#xff1a;Defined vs Undefined<\/h5>\n<p>\u7528 readelf -s hello.o \u67e5\u770b\u7b26\u53f7\u8868&#xff1a;<\/p>\n<ul>\n<li>\n<p>main\u3001printf&#xff08;\u5b9e\u9645\u5e95\u5c42\u662f _fputs \u7b49&#xff09;\u5728 hello.o \u4e2d\u6807\u8bb0\u4e3a UND&#xff08;Undefined&#xff09;\u2014\u2014\u6211\u4e0d\u77e5\u9053\u5b83\u4eec\u5728\u54ea\u3002<img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261020071724-6ad715842af65.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<\/li>\n<li>\n<p>run \u540c\u6837\u6807\u8bb0\u4e3a UND&#xff0c;\u56e0\u4e3a hello.c \u91cc\u6ca1\u6709\u5b83\u7684\u5b9a\u4e49\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u800c\u5728 code.o \u4e2d&#xff0c;run \u88ab\u6807\u8bb0\u4e3a FUNC \u4e14\u5df2\u5b9a\u4e49\u3002\u94fe\u63a5\u5668\u7684\u6838\u5fc3\u5de5\u4f5c\u5c31\u662f&#xff1a;\u62ff\u7740\u81ea\u5df1\u672a\u5b9a\u4e49\u7684\u7b26\u53f7&#xff0c;\u53bb\u5176\u4ed6\u6a21\u5757\u627e\u5b9a\u4e49\u3002<img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261020071724-6ad715844ef58.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<hr \/>\n<h5>2.3 \u5730\u5740\u91cd\u5b9a\u4f4d&#xff1a;call \u540e\u9762\u4e3a\u4ec0\u4e48\u5148\u662f 0&#xff1f;<\/h5>\n<p>\u7528 objdump -d hello.o \u53cd\u6c47\u7f16&#xff0c;\u67e5\u770b main \u51fd\u6570\u91cc\u7684\u8c03\u7528&#xff1a;<\/p>\n<p>call   0  &lt;?printf&gt;<br \/>\ncall   0  &lt;run&gt;<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261020071724-6ad7158473bb0.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>\u8001\u5e08\u5f3a\u8c03&#xff1a;\u7f16\u8bd1\u9636\u6bb5\u6839\u672c\u4e0d\u77e5\u9053 printf \u548c run \u5728\u5185\u5b58\u7684\u54ea\u4e2a\u4f4d\u7f6e&#xff0c;\u6240\u4ee5\u7f16\u8bd1\u5668\u53ea\u80fd\u628a\u8df3\u8f6c\u5730\u5740\u6682\u65f6\u586b\u6210 0\u3002\u8fd9\u4e2a 0 \u662f\u4e00\u4e2a\u5360\u4f4d\u7b26\u3002<\/p>\n<p>\u5f53\u6267\u884c\u94fe\u63a5&#xff1a;<\/p>\n<p>gcc hello.o code.o <span class=\"token parameter variable\">-o<\/span> main.exe<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261020071724-6ad715849be24.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>\u94fe\u63a5\u5668\u5b8c\u6210\u4e24\u4ef6\u4e8b&#xff1a;<\/p>\n<li>\u5408\u5e76 Section&#xff1a;\u628a hello.o \u548c code.o \u7684 .text \u5408\u5e76\u6210\u4e00\u4e2a\u5927 .text&#xff0c;.data \u5408\u5e76\u6210\u4e00\u4e2a\u5927 .data\u3002<\/li>\n<li>\u5730\u5740\u91cd\u5b9a\u4f4d&#xff1a;\u786e\u5b9a\u6bcf\u4e2a\u51fd\u6570\u5728\u6700\u7ec8\u53ef\u6267\u884c\u6587\u4ef6\u4e2d\u7684\u865a\u62df\u5730\u5740&#xff08;\u6bd4\u5982 run \u88ab\u5b89\u6392\u5728\u4e86 0x400520&#xff09;&#xff0c;\u7136\u540e\u628a\u6240\u6709 call 0 \u4fee\u6b63\u4e3a call 0x400520\u3002<\/li>\n<p>\u94fe\u63a5\u540e\u518d objdump -d main.exe&#xff0c;\u4f60\u4f1a\u770b\u5230 call \u6307\u4ee4\u540e\u9762\u7684\u5730\u5740\u5df2\u7ecf\u88ab\u586b\u4e0a\u4e86\u771f\u5b9e\u7684\u865a\u62df\u5730\u5740\u3002\u8fd9\u4e2a\u8fc7\u7a0b\u5c31\u53eb\u201c\u94fe\u63a5\u65f6\u5730\u5740\u91cd\u5b9a\u4f4d\u201d\u3002<\/p>\n<p>\u4e5f\u6b63\u56e0 .o \u6587\u4ef6\u91cc\u7684\u5730\u5740\u5728\u94fe\u63a5\u65f6\u4f1a\u88ab\u201c\u91cd\u65b0\u4fee\u6539\u201d&#xff0c;.o \u88ab\u79f0\u4e3a\u53ef\u91cd\u5b9a\u4f4d\u76ee\u6807\u6587\u4ef6&#xff08;Relocatable Object File&#xff09;\u3002<\/p>\n<hr \/>\n<p>\u4e0b\u9762\u662f\u9759\u6001\u94fe\u63a5\u4e2d\u7b26\u53f7\u89e3\u6790\u4e0e\u5730\u5740\u91cd\u5b9a\u4f4d\u7684\u5b8c\u6574\u6d41\u7a0b&#xff1a;<\/p>\n<p>#mermaid-svg-GN2VoRr2yn1QsvV1{font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-GN2VoRr2yn1QsvV1 .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-GN2VoRr2yn1QsvV1 .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-GN2VoRr2yn1QsvV1 .error-icon{fill:#552222;}#mermaid-svg-GN2VoRr2yn1QsvV1 .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-GN2VoRr2yn1QsvV1 .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-GN2VoRr2yn1QsvV1 .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-GN2VoRr2yn1QsvV1 .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-GN2VoRr2yn1QsvV1 .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-GN2VoRr2yn1QsvV1 .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-GN2VoRr2yn1QsvV1 .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-GN2VoRr2yn1QsvV1 .marker{fill:#333333;stroke:#333333;}#mermaid-svg-GN2VoRr2yn1QsvV1 .marker.cross{stroke:#333333;}#mermaid-svg-GN2VoRr2yn1QsvV1 svg{font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-GN2VoRr2yn1QsvV1 p{margin:0;}#mermaid-svg-GN2VoRr2yn1QsvV1 .label{font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;color:#333;}#mermaid-svg-GN2VoRr2yn1QsvV1 .cluster-label text{fill:#333;}#mermaid-svg-GN2VoRr2yn1QsvV1 .cluster-label span{color:#333;}#mermaid-svg-GN2VoRr2yn1QsvV1 .cluster-label span p{background-color:transparent;}#mermaid-svg-GN2VoRr2yn1QsvV1 .label text,#mermaid-svg-GN2VoRr2yn1QsvV1 span{fill:#333;color:#333;}#mermaid-svg-GN2VoRr2yn1QsvV1 .node rect,#mermaid-svg-GN2VoRr2yn1QsvV1 .node circle,#mermaid-svg-GN2VoRr2yn1QsvV1 .node ellipse,#mermaid-svg-GN2VoRr2yn1QsvV1 .node polygon,#mermaid-svg-GN2VoRr2yn1QsvV1 .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-GN2VoRr2yn1QsvV1 .rough-node .label text,#mermaid-svg-GN2VoRr2yn1QsvV1 .node .label text,#mermaid-svg-GN2VoRr2yn1QsvV1 .image-shape .label,#mermaid-svg-GN2VoRr2yn1QsvV1 .icon-shape .label{text-anchor:middle;}#mermaid-svg-GN2VoRr2yn1QsvV1 .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-GN2VoRr2yn1QsvV1 .rough-node .label,#mermaid-svg-GN2VoRr2yn1QsvV1 .node .label,#mermaid-svg-GN2VoRr2yn1QsvV1 .image-shape .label,#mermaid-svg-GN2VoRr2yn1QsvV1 .icon-shape .label{text-align:center;}#mermaid-svg-GN2VoRr2yn1QsvV1 .node.clickable{cursor:pointer;}#mermaid-svg-GN2VoRr2yn1QsvV1 .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-GN2VoRr2yn1QsvV1 .arrowheadPath{fill:#333333;}#mermaid-svg-GN2VoRr2yn1QsvV1 .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-GN2VoRr2yn1QsvV1 .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-GN2VoRr2yn1QsvV1 .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-GN2VoRr2yn1QsvV1 .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-GN2VoRr2yn1QsvV1 .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-GN2VoRr2yn1QsvV1 .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-GN2VoRr2yn1QsvV1 .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-GN2VoRr2yn1QsvV1 .cluster text{fill:#333;}#mermaid-svg-GN2VoRr2yn1QsvV1 .cluster span{color:#333;}#mermaid-svg-GN2VoRr2yn1QsvV1 div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-GN2VoRr2yn1QsvV1 .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-GN2VoRr2yn1QsvV1 rect.text{fill:none;stroke-width:0;}#mermaid-svg-GN2VoRr2yn1QsvV1 .icon-shape,#mermaid-svg-GN2VoRr2yn1QsvV1 .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-GN2VoRr2yn1QsvV1 .icon-shape p,#mermaid-svg-GN2VoRr2yn1QsvV1 .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-GN2VoRr2yn1QsvV1 .icon-shape .label rect,#mermaid-svg-GN2VoRr2yn1QsvV1 .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-GN2VoRr2yn1QsvV1 .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-GN2VoRr2yn1QsvV1 .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-GN2VoRr2yn1QsvV1 :root{&#8211;mermaid-font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;}<span class=\"nodeLabel\"><\/p>\n<p>\u53ef\u6267\u884c\u6587\u4ef6 main.exe<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>\u94fe\u63a5\u9636\u6bb5<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>\u7f16\u8bd1\u9636\u6bb5<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>\u6e90\u7801<\/p>\n<p><\/span><span class=\"edgeLabel\"><\/span><span class=\"edgeLabel\"><\/span><span class=\"edgeLabel\"><\/span><span class=\"edgeLabel\"><\/span><span class=\"edgeLabel\"><\/span><span class=\"edgeLabel\"><\/span><span class=\"edgeLabel\"><\/span><span class=\"nodeLabel\"><\/p>\n<p>hello.cmain() \u8c03\u7528 printf\u3001run<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>code.crun() \u5b9a\u4e49<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>hello.omain: call 0 call 0 <\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>code.orun: FUNC \u5df2\u5b9a\u4e49<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>\u5408\u5e76 Section.text \/ .data<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>\u7b26\u53f7\u89e3\u6790UND \u2192 \u627e\u5230\u5b9a\u4e49<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>\u5730\u5740\u91cd\u5b9a\u4f4dcall 0 \u2192 call 0x400520<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>call 0x400520\u771f\u5b9e\u865a\u62df\u5730\u5740\u5df2\u586b\u5165<\/p>\n<p><\/span><\/p>\n<p>\u56fe\u89e3&#xff1a; \u7f16\u8bd1\u9636\u6bb5 call \u540e\u7684\u5730\u5740\u662f\u5360\u4f4d\u7b26 0&#xff1b;\u94fe\u63a5\u9636\u6bb5\u5b8c\u6210 Section \u5408\u5e76\u3001\u7b26\u53f7\u89e3\u6790\u4e0e\u5730\u5740\u91cd\u5b9a\u4f4d&#xff0c;\u6700\u7ec8\u628a\u771f\u5b9e\u865a\u62df\u5730\u5740\u586b\u5165 call \u6307\u4ee4\u3002<\/p>\n<h4>\u4e09\u3001\u7a0b\u5e8f\u52a0\u8f7d\u4e0e\u865a\u62df\u5730\u5740\u7a7a\u95f4&#xff1a;\u7a0b\u5e8f\u6ca1\u6709\u52a0\u8f7d\u524d&#xff0c;\u6709\u5730\u5740\u5417&#xff1f;<\/h4>\n<p>\u8fd9\u662f\u8bfe\u5802\u4e0a\u629b\u51fa\u7684\u4e00\u4e2a\u6838\u5fc3\u601d\u8003\u9898&#xff0c;\u4e5f\u662f\u5f88\u591a\u64cd\u4f5c\u7cfb\u7edf\u7684\u201c\u5206\u6c34\u5cad\u201d\u77e5\u8bc6\u70b9\u3002<\/p>\n<h5>3.1 \u6709&#xff01;\u78c1\u76d8\u4e0a\u7684\u903b\u8f91\u5730\u5740&#xff0c;\u5c31\u662f\u865a\u62df\u5730\u5740\u7684\u201c\u9884\u89c8\u7248\u201d<\/h5>\n<p>\u7528 objdump -s \u53cd\u6c47\u7f16\u4efb\u4f55\u4e00\u4e2a\u53ef\u6267\u884c\u7a0b\u5e8f&#xff08;\u5982 main.exe&#xff09;&#xff0c;\u6700\u5de6\u4fa7\u4f1a\u770b\u5230\u4e00\u8fde\u4e32\u5730\u5740&#xff1a;0x4003c8\u30010x4003d0\u30010x4003f0\u2026\u2026<img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261020071724-6ad71584b4a32.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>\u8fd9\u4e9b\u5730\u5740\u662f\u4ec0\u4e48&#xff1f;\u5b83\u4eec\u662f\u7a0b\u5e8f\u5728\u78c1\u76d8\u4e0a\u5c31\u5df2\u7ecf\u786e\u5b9a\u7684\u7f16\u5236\u3002\u73b0\u4ee3\u64cd\u4f5c\u7cfb\u7edf\u91c7\u7528 \u5e73\u5766\u6a21\u5f0f&#xff08;Flat Model&#xff09;&#xff0c;\u5373\u53ef\u6267\u884c\u7a0b\u5e8f\u5185\u90e8\u4ece 0 \u5f00\u59cb\u7edf\u4e00\u7f16\u5740\u3002\u8fd9\u4e2a\u78c1\u76d8\u4e0a\u7684\u5730\u5740\u79f0\u4e3a\u903b\u8f91\u5730\u5740\u6216\u7ebf\u6027\u5730\u5740\u3002<\/p>\n<p>\u5728 Linux \u7cfb\u7edf\u4e0b&#xff0c;\u903b\u8f91\u5730\u5740&#xff08;\u78c1\u76d8\u89c6\u89d2&#xff09;\u3001\u865a\u62df\u5730\u5740&#xff08;\u64cd\u4f5c\u7cfb\u7edf\u89c6\u89d2&#xff09;\u3001\u7269\u7406\u5730\u5740&#xff08;\u771f\u5b9e\u5185\u5b58\u89c6\u89d2&#xff09;\u4e09\u4f4d\u4e00\u4f53\u3002\u53ea\u662f\u5728\u78c1\u76d8\u4e0a\u6211\u4eec\u4e60\u60ef\u53eb\u903b\u8f91\u5730\u5740&#xff0c;\u52a0\u8f7d\u5230\u5185\u5b58\u8bed\u5883\u540e&#xff08;\u5728PCB\u7b49\u90a3\u8fb9&#xff09;&#xff0c;\u5b83\u4eec\u5c31\u662f\u865a\u62df\u5730\u5740\u3002\u7a0b\u5e8f\u8fd8\u6ca1\u52a0\u8f7d\u65f6&#xff0c;\u5185\u90e8\u51fd\u6570\u8c03\u7528\u7684\u5730\u5740\u5c31\u5df2\u7ecf\u7f16\u597d\u4e86\u2014\u2014\u5426\u5219\u94fe\u63a5\u5668\u51ed\u4ec0\u4e48\u91cd\u5199 call \u6307\u4ee4&#xff1f;<\/p>\n<h5>3.2 \u52a0\u8f7d\u56db\u6b65\u66f2&#xff1a;\u4ece\u6587\u4ef6\u7cfb\u7edf\u5230 CPU \u53d6\u6307<\/h5>\n<p>\u8001\u5e08\u7528\u4e00\u5f20\u5927\u56fe\u628a\u52a0\u8f7d\u6d41\u7a0b\u4e32\u4e86\u8d77\u6765&#xff1a;<\/p>\n<p>\u7b2c\u4e00\u6b65&#xff1a;\u6587\u4ef6\u7cfb\u7edf\u5b9a\u4f4d<br \/>\n\u64cd\u4f5c\u7cfb\u7edf\u901a\u8fc7\u8def\u5f84\u89e3\u6790\u627e\u5230 inode&#xff0c;\u8fdb\u800c\u627e\u5230\u78c1\u76d8\u4e0a\u7684\u6570\u636e\u5757&#xff08;Data Block&#xff09;\u3002\u53ef\u6267\u884c\u7a0b\u5e8f\u672c\u8d28\u4e0a\u4e5f\u662f\u6587\u4ef6&#xff0c;\u4e5f\u8981\u8d70\u6587\u4ef6\u7cfb\u7edf\u8fd9\u4e00\u5957\u3002<\/p>\n<p>\u7b2c\u4e8c\u6b65&#xff1a;\u521b\u5efa\u8fdb\u7a0b\u9aa8\u67b6<br \/>\n\u5185\u6838\u521b\u5efa task_struct&#xff08;PCB&#xff09;\u3001mm_struct&#xff08;\u5185\u5b58\u63cf\u8ff0\u7b26&#xff09;\u3001vm_area_struct \u94fe\u8868&#xff08;\u865a\u62df\u5185\u5b58\u533a\u57df&#xff09;\u3002\u6b64\u65f6\u8fdb\u7a0b\u6709\u4e86\u201c\u6237\u53e3\u201d&#xff0c;\u4f46\u5730\u5740\u7a7a\u95f4\u8fd8\u662f\u7a7a\u7684\u3002<\/p>\n<p>\u7b2c\u4e09\u6b65&#xff1a;\u521d\u59cb\u5316\u5730\u5740\u7a7a\u95f4\u4e0e\u9875\u8868\u6620\u5c04<br \/>\n\u64cd\u4f5c\u7cfb\u7edf\u8bfb\u53d6 ELF \u7684 Program Header Table&#xff0c;\u7528\u6bcf\u4e2a Segment \u7684\u865a\u62df\u8d77\u6b62\u5730\u5740&#xff08;start ~ end&#xff09;\u53bb\u521d\u59cb\u5316 vm_area_struct \u7684\u5404\u4e2a\u533a\u57df&#xff08;\u4ee3\u7801\u533a\u3001\u6570\u636e\u533a\u3001BSS \u533a\u7b49&#xff09;\u3002\u968f\u540e\u628a\u4ee3\u7801\u548c\u6570\u636e\u52a0\u8f7d\u5230\u7269\u7406\u5185\u5b58&#xff0c;\u5efa\u7acb\u9875\u8868\u6620\u5c04\u2014\u2014\u9875\u8868\u5de6\u534a\u8fb9\u662f\u865a\u62df\u5730\u5740&#xff0c;\u53f3\u534a\u8fb9\u662f\u7269\u7406\u5730\u5740\u3002<\/p>\n<p>\u7b2c\u56db\u6b65&#xff1a;CPU \u542f\u52a8\u6267\u884c<br \/>\n\u8bfb\u53d6 ELF Header \u4e2d\u7684 Entry Point&#xff08;\u5373 _start \u7684\u865a\u62df\u5730\u5740&#xff0c;\u5982 0x400430&#xff09;&#xff0c;\u628a\u5b83\u586b\u5165 CPU \u7684\u6307\u4ee4\u5bc4\u5b58\u5668&#xff08;EIP\/RIP&#xff09;\u3002CPU \u5f00\u59cb\u53d6\u6307\u6267\u884c\u3002<\/p>\n<h5>3.3 \u6743\u9650\u7ba1\u7406\u4e0e\u9875\u8868\u521d\u59cb\u5316<\/h5>\n<p>\u64cd\u4f5c\u7cfb\u7edf\u5e76\u4e0d\u201c\u8ba4\u8bc6\u201d\u54ea\u4e2a\u533a\u57df\u662f\u4ee3\u7801\u3001\u54ea\u4e2a\u662f\u6570\u636e&#xff0c;\u5b83\u53ea\u8bfb ELF \u7684 Program Header\u3002\u5982\u679c\u67d0\u4e2a Segment \u6807\u8bb0\u4e3a R E&#xff08;\u53ea\u8bfb\u3001\u53ef\u6267\u884c&#xff09;&#xff0c;\u64cd\u4f5c\u7cfb\u7edf\u521d\u59cb\u5316\u9875\u8868\u65f6\u5c31\u628a\u8fd9\u6bb5\u6620\u5c04\u4e3a\u53ea\u8bfb&#xff1b;\u5982\u679c\u6807\u8bb0\u4e3a RW&#xff0c;\u5219\u8d4b\u4e88\u8bfb\u5199\u6743\u9650\u3002\u7a0b\u5e8f\u7684\u6743\u9650\u7ba1\u7406&#xff0c;\u5728\u52a0\u8f7d\u90a3\u4e00\u523b\u5c31\u7531 ELF \u683c\u5f0f\u51b3\u5b9a\u4e86\u3002<\/p>\n<h5>3.4 \u4e00\u4e2a\u6781\u6613\u5ffd\u7565\u7684\u7ec6\u8282&#xff1a;_start \u624d\u662f\u5165\u53e3<\/h5>\n<p>\u5f88\u591a\u540c\u5b66\u4ee5\u4e3a\u7a0b\u5e8f\u5165\u53e3\u662f main\u3002\u4f46\u901a\u8fc7 objdump \u548c readelf -h \u90fd\u80fd\u770b\u5230&#xff0c;Entry Point \u6307\u5411\u7684\u662f _start\u3002_start \u7531\u94fe\u63a5\u5668&#xff08;\u6216 C \u8fd0\u884c\u65f6\u5e93&#xff09;\u63d0\u4f9b&#xff0c;\u5b83\u7684\u804c\u8d23\u5305\u62ec&#xff1a;<\/p>\n<ul>\n<li>\u8bbe\u7f6e\u6808\u5e27&#xff1b;<\/li>\n<li>\u521d\u59cb\u5316 .data \u6bb5&#xff08;\u628a\u521d\u59cb\u5316\u7684\u5168\u5c40\u53d8\u91cf\u642c\u5230\u4f4d&#xff09;&#xff1b;<\/li>\n<li>\u6e05\u96f6 .bss \u6bb5&#xff1b;<\/li>\n<li>\u6253\u5f00\u6807\u51c6\u8f93\u5165\u3001\u6807\u51c6\u8f93\u51fa\u3001\u6807\u51c6\u9519\u8bef&#xff1b;<\/li>\n<li>\u8c03\u7528\u52a8\u6001\u94fe\u63a5\u5668&#xff0c;\u52a0\u8f7d\u4f9d\u8d56\u7684\u52a8\u6001\u5e93&#xff1b;<\/li>\n<li>\u6700\u540e\u8c03\u7528 libc_start_main&#xff0c;\u8fdb\u800c\u8c03\u7528\u7528\u6237\u5199\u7684 main\u3002<\/li>\n<\/ul>\n<p>\u4f60\u7684 main \u51fd\u6570\u6267\u884c\u5b8c\u6bd5\u540e&#xff0c;\u63a7\u5236\u6743\u56de\u5230 _start \u7684\u6536\u5c3e\u903b\u8f91&#xff0c;\u5904\u7406\u8fd4\u56de\u503c\u5e76\u8c03\u7528 exit \u7ec8\u6b62\u8fdb\u7a0b\u3002main \u53ea\u662f\u201c\u88ab\u8c03\u7528\u8005\u201d\u3002<\/p>\n<hr \/>\n<p>\u4e0b\u9762\u662f\u7a0b\u5e8f\u52a0\u8f7d\u56db\u6b65\u66f2\u7684\u5b8c\u6574\u6d41\u7a0b&#xff0c;\u4ece\u6587\u4ef6\u7cfb\u7edf\u5b9a\u4f4d\u5230 CPU \u53d6\u6307\u6267\u884c&#xff1a;<\/p>\n<p>#mermaid-svg-MDEZpS1jP6Bac7Pr{font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-MDEZpS1jP6Bac7Pr .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-MDEZpS1jP6Bac7Pr .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-MDEZpS1jP6Bac7Pr .error-icon{fill:#552222;}#mermaid-svg-MDEZpS1jP6Bac7Pr .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-MDEZpS1jP6Bac7Pr .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-MDEZpS1jP6Bac7Pr .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-MDEZpS1jP6Bac7Pr .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-MDEZpS1jP6Bac7Pr .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-MDEZpS1jP6Bac7Pr .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-MDEZpS1jP6Bac7Pr .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-MDEZpS1jP6Bac7Pr .marker{fill:#333333;stroke:#333333;}#mermaid-svg-MDEZpS1jP6Bac7Pr .marker.cross{stroke:#333333;}#mermaid-svg-MDEZpS1jP6Bac7Pr svg{font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-MDEZpS1jP6Bac7Pr p{margin:0;}#mermaid-svg-MDEZpS1jP6Bac7Pr .label{font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;color:#333;}#mermaid-svg-MDEZpS1jP6Bac7Pr .cluster-label text{fill:#333;}#mermaid-svg-MDEZpS1jP6Bac7Pr .cluster-label span{color:#333;}#mermaid-svg-MDEZpS1jP6Bac7Pr .cluster-label span p{background-color:transparent;}#mermaid-svg-MDEZpS1jP6Bac7Pr .label text,#mermaid-svg-MDEZpS1jP6Bac7Pr span{fill:#333;color:#333;}#mermaid-svg-MDEZpS1jP6Bac7Pr .node rect,#mermaid-svg-MDEZpS1jP6Bac7Pr .node circle,#mermaid-svg-MDEZpS1jP6Bac7Pr .node ellipse,#mermaid-svg-MDEZpS1jP6Bac7Pr .node polygon,#mermaid-svg-MDEZpS1jP6Bac7Pr .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-MDEZpS1jP6Bac7Pr .rough-node .label text,#mermaid-svg-MDEZpS1jP6Bac7Pr .node .label text,#mermaid-svg-MDEZpS1jP6Bac7Pr .image-shape .label,#mermaid-svg-MDEZpS1jP6Bac7Pr .icon-shape .label{text-anchor:middle;}#mermaid-svg-MDEZpS1jP6Bac7Pr .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-MDEZpS1jP6Bac7Pr .rough-node .label,#mermaid-svg-MDEZpS1jP6Bac7Pr .node .label,#mermaid-svg-MDEZpS1jP6Bac7Pr .image-shape .label,#mermaid-svg-MDEZpS1jP6Bac7Pr .icon-shape .label{text-align:center;}#mermaid-svg-MDEZpS1jP6Bac7Pr .node.clickable{cursor:pointer;}#mermaid-svg-MDEZpS1jP6Bac7Pr .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-MDEZpS1jP6Bac7Pr .arrowheadPath{fill:#333333;}#mermaid-svg-MDEZpS1jP6Bac7Pr .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-MDEZpS1jP6Bac7Pr .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-MDEZpS1jP6Bac7Pr .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-MDEZpS1jP6Bac7Pr .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-MDEZpS1jP6Bac7Pr .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-MDEZpS1jP6Bac7Pr .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-MDEZpS1jP6Bac7Pr .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-MDEZpS1jP6Bac7Pr .cluster text{fill:#333;}#mermaid-svg-MDEZpS1jP6Bac7Pr .cluster span{color:#333;}#mermaid-svg-MDEZpS1jP6Bac7Pr div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-MDEZpS1jP6Bac7Pr .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-MDEZpS1jP6Bac7Pr rect.text{fill:none;stroke-width:0;}#mermaid-svg-MDEZpS1jP6Bac7Pr .icon-shape,#mermaid-svg-MDEZpS1jP6Bac7Pr .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-MDEZpS1jP6Bac7Pr .icon-shape p,#mermaid-svg-MDEZpS1jP6Bac7Pr .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-MDEZpS1jP6Bac7Pr .icon-shape .label rect,#mermaid-svg-MDEZpS1jP6Bac7Pr .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-MDEZpS1jP6Bac7Pr .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-MDEZpS1jP6Bac7Pr .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-MDEZpS1jP6Bac7Pr :root{&#8211;mermaid-font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;}<span class=\"nodeLabel\"><\/p>\n<p>CPU<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>ELF \u89e3\u6790<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>\u5185\u6838<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>\u6587\u4ef6\u7cfb\u7edf<\/p>\n<p><\/span><span class=\"edgeLabel\"><\/span><span class=\"edgeLabel\"><\/span><span class=\"edgeLabel\"><\/span><span class=\"edgeLabel\"><\/span><span class=\"edgeLabel\"><\/span><span class=\"nodeLabel\"><\/p>\n<p>\u8def\u5f84\u89e3\u6790 \u2192 inode\u627e\u5230\u78c1\u76d8\u6570\u636e\u5757<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>\u521b\u5efa task_struct&#xff08;PCB&#xff09;mm_struct\u3001vm_area_struct<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>\u521d\u59cb\u5316\u5730\u5740\u7a7a\u95f4\u5efa\u7acb\u9875\u8868\u6620\u5c04\u865a\u62df\u5730\u5740 \u2194 \u7269\u7406\u5730\u5740<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>\u8bfb\u53d6 Program Header Table\u6309 Segment \u6743\u9650\u6620\u5c04<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>\u8bfb\u53d6 Entry Point_start \u865a\u62df\u5730\u5740<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>EIP\/RIP \u586b\u5165 _start \u5730\u5740\u5f00\u59cb\u53d6\u6307\u6267\u884c<\/p>\n<p><\/span><\/p>\n<p>\u56fe\u89e3&#xff1a; \u64cd\u4f5c\u7cfb\u7edf\u5148\u901a\u8fc7\u6587\u4ef6\u7cfb\u7edf\u5b9a\u4f4d ELF&#xff0c;\u521b\u5efa\u8fdb\u7a0b\u9aa8\u67b6&#xff0c;\u518d\u6309 Program Header \u521d\u59cb\u5316\u5730\u5740\u7a7a\u95f4\u4e0e\u9875\u8868&#xff0c;\u6700\u540e\u628a _start \u7684\u865a\u62df\u5730\u5740\u586b\u5165 CPU \u6307\u4ee4\u5bc4\u5b58\u5668\u5f00\u59cb\u6267\u884c\u3002<\/p>\n<h4>\u56db\u3001\u52a8\u6001\u94fe\u63a5\u4e0e\u5171\u4eab\u5e93&#xff1a;GOT\/PLT \u4e0e\u5ef6\u8fdf\u7ed1\u5b9a<\/h4>\n<p>\u9759\u6001\u94fe\u63a5\u867d\u7136\u7b80\u5355&#xff0c;\u4f46\u6709\u4e2a\u81f4\u547d\u7f3a\u9677&#xff1a;\u6bcf\u4e2a\u53ef\u6267\u884c\u6587\u4ef6\u90fd\u72ec\u7acb\u62f7\u8d1d\u4e00\u4efd\u5e93\u4ee3\u7801\u3002\u5982\u679c\u7cfb\u7edf\u91cc\u8fd0\u884c\u7740 20 \u4e2a C \u7a0b\u5e8f&#xff0c;\u5185\u5b58\u91cc\u5c31\u6709 20 \u4efd printf \u7684\u4ee3\u7801&#xff0c;\u6d6a\u8d39\u78c1\u76d8\u548c\u5185\u5b58\u3002\u52a8\u6001\u94fe\u63a5&#xff08;Dynamic Linking&#xff09;\u89e3\u51b3\u4e86\u8fd9\u4e2a\u95ee\u9898\u3002<\/p>\n<h5>4.1 \u52a8\u6001\u5e93\u7684\u5b8f\u89c2\u5171\u4eab\u673a\u5236<\/h5>\n<p>\u52a8\u6001\u5e93&#xff08;.so&#xff0c;Shared Object&#xff09;\u662f\u72ec\u7acb\u6587\u4ef6\u3002\u5f53\u8fdb\u7a0b A \u52a0\u8f7d libc.so \u540e&#xff0c;\u5b83\u901a\u8fc7\u9875\u8868\u6620\u5c04\u5230\u81ea\u5df1\u7684\u5171\u4eab\u533a\u3002\u5982\u679c\u8fdb\u7a0b B \u4e5f\u9700\u8981 libc.so&#xff0c;\u5185\u6838\u53ea\u9700\u628a\u540c\u4e00\u4efd\u7269\u7406\u5185\u5b58\u6620\u5c04\u5230 B \u7684\u865a\u62df\u5730\u5740\u7a7a\u95f4\u3002\u4ee3\u7801\u6bb5\u662f\u53ea\u8bfb\u7684&#xff0c;\u6240\u4ee5\u591a\u8fdb\u7a0b\u53ef\u4ee5\u5b89\u5168\u5171\u4eab\u540c\u4e00\u4efd\u7269\u7406\u526f\u672c\u3002\u8fd9\u4e5f\u662f\u4e3a\u4ec0\u4e48\u52a8\u6001\u5e93\u53c8\u53eb\u5171\u4eab\u5e93\u3002<\/p>\n<h5>4.2 \u52a8\u6001\u94fe\u63a5\u5668&#xff08;ld-linux.so&#xff09;<\/h5>\n<p>\u4efb\u4f55\u4e00\u4e2a\u52a8\u6001\u94fe\u63a5\u7684 ELF \u7a0b\u5e8f&#xff0c;\u9664\u4e86\u4f9d\u8d56 C \u6807\u51c6\u5e93&#xff0c;\u8fd8\u4f1a\u9ed8\u8ba4\u4f9d\u8d56\u4e00\u4e2a\u5e93&#xff1a;\/lib64\/ld-linux-x86-64.so.2&#xff08;\u6216\u7c7b\u4f3c\u540d\u79f0&#xff09;\u3002\u8fd9\u5c31\u662f\u52a8\u6001\u94fe\u63a5\u5668\u3002<img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261020071725-6ad71585d10dd.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>\u7a0b\u5e8f\u542f\u52a8\u65f6&#xff0c;_start \u4f1a\u5148\u8c03\u7528\u5b83\u3002\u52a8\u6001\u94fe\u63a5\u5668\u6839\u636e\u73af\u5883\u53d8\u91cf LD_LIBRARY_PATH\u3001\/etc\/ld.so.conf \u914d\u7f6e\u6587\u4ef6\u4ee5\u53ca\u7cfb\u7edf\u9ed8\u8ba4\u8def\u5f84&#xff0c;\u53bb\u641c\u7d22\u5e76\u52a0\u8f7d\u7a0b\u5e8f\u4f9d\u8d56\u7684\u6240\u6709 .so\u3002\u53ea\u6709\u5f53\u8fd9\u4e9b\u5e93\u90fd\u88ab\u627e\u5230\u3001\u6620\u5c04\u3001\u91cd\u5b9a\u4f4d\u5b8c\u6bd5\u540e&#xff0c;\u624d\u4f1a\u628a\u63a7\u5236\u6743\u4ea4\u56de\u7ed9 main\u3002<\/p>\n<h5>4.3 \u4f4d\u7f6e\u65e0\u5173\u4ee3\u7801&#xff08;PIC&#xff09;\u4e0e GOT<\/h5>\n<p>\u52a8\u6001\u5e93\u53ef\u4ee5\u88ab\u52a0\u8f7d\u5230\u5185\u5b58\u7684\u4efb\u610f\u4f4d\u7f6e&#xff0c;\u90a3\u4e48\u5e93\u5185\u90e8\u51fd\u6570\u4e92\u76f8\u8c03\u7528\u65f6\u600e\u4e48\u529e&#xff1f;\u5982\u679c\u5199\u6b7b\u7edd\u5bf9\u5730\u5740&#xff0c;\u5e93\u4e00\u65e6\u88ab\u6620\u5c04\u5230\u4e0d\u540c\u57fa\u5740\u5c31\u5168\u4e71\u5957\u4e86\u3002<\/p>\n<p>\u89e3\u51b3\u65b9\u6848\u662f PIC&#xff08;Position Independent Code&#xff0c;\u4f4d\u7f6e\u65e0\u5173\u4ee3\u7801&#xff09;\u3002\u5e93\u5185\u90e8\u7684\u7f16\u5740\u4e5f\u91c7\u7528\u201c\u4ece 0 \u5f00\u59cb\u7684\u504f\u79fb\u91cf\u201d\u3002\u5f53\u5e93\u88ab\u6620\u5c04\u5230\u8fdb\u7a0b\u865a\u62df\u7a7a\u95f4\u7684\u67d0\u4e2a\u8d77\u59cb\u5730\u5740&#xff08;\u6bd4\u5982 0x7f1234000&#xff09;&#xff0c;\u5e93\u5185\u67d0\u4e2a\u51fd\u6570\u7684\u5165\u53e3\u662f\u5728\u5e93\u5185\u504f\u79fb 0x233 \u5904&#xff0c;\u90a3\u4e48\u5b9e\u9645\u865a\u62df\u5730\u5740\u5c31\u662f\u5e93\u8d77\u59cb\u5730\u5740 &#043; \u504f\u79fb\u91cf\u3002<\/p>\n<p>\u4f46\u8fd9\u8fd8\u4e0d\u591f\u3002\u56e0\u4e3a\u4e3b\u7a0b\u5e8f\u8c03\u7528\u5e93\u51fd\u6570\u65f6&#xff0c;\u4ee3\u7801\u6bb5\u662f\u53ea\u8bfb\u7684&#xff0c;\u4f60\u4e0d\u80fd\u76f4\u63a5\u5728\u4e3b\u7a0b\u5e8f\u7684\u4ee3\u7801\u91cc\u5199\u6b7b\u5e93\u51fd\u6570\u7684\u6700\u7ec8\u5730\u5740\u3002\u600e\u4e48\u529e&#xff1f;<\/p>\n<p>GOT&#xff08;Global Offset Table&#xff0c;\u5168\u5c40\u504f\u79fb\u8868&#xff09;\u767b\u573a\u3002<\/p>\n<ul>\n<li>GOT \u5b58\u653e\u5728\u6570\u636e\u6bb5&#xff08;\u53ef\u8bfb\u5199&#xff09;&#xff0c;\u6bcf\u4e2a\u8fdb\u7a0b\u6709\u81ea\u5df1\u72ec\u7acb\u7684 GOT\u3002<\/li>\n<li>\u53ef\u6267\u884c\u7a0b\u5e8f\u4e0d\u5728\u4ee3\u7801\u6bb5\u76f4\u63a5\u5199 call printf&#xff0c;\u800c\u662f call printf&#064;GOT\u3002<\/li>\n<li>\u94fe\u63a5\u65f6&#xff0c;GOT \u8868\u9879\u5148\u8bb0\u5f55\u5e93\u7684\u504f\u79fb\u91cf\u548c\u5e93\u540d&#xff1b;\u52a0\u8f7d\u5b8c\u6210\u540e&#xff0c;\u52a8\u6001\u94fe\u63a5\u5668\u628a\u5e93\u7684\u5b9e\u9645\u8d77\u59cb\u865a\u62df\u5730\u5740\u586b\u8fdb GOT\u3002<\/li>\n<li>\u4ece\u6b64&#xff0c;\u4ee3\u7801\u6bb5\u4e00\u884c\u4e0d\u6539&#xff0c;\u53ea\u6539\u6570\u636e\u6bb5\u7684 GOT \u8868&#xff0c;\u7a0b\u5e8f\u5c31\u80fd\u6b63\u786e\u8df3\u5230\u5e93\u51fd\u6570\u3002<\/li>\n<\/ul>\n<p>\u8fd9\u5b8c\u7f8e\u89e3\u51b3\u4e86\u201c\u4ee3\u7801\u6bb5\u53ea\u8bfb\u201d\u4e0e\u201c\u9700\u8981\u52a8\u6001\u4fee\u6b63\u5730\u5740\u201d\u4e4b\u95f4\u7684\u77db\u76fe\u3002<\/p>\n<h5>4.4 PLT&#xff1a;\u5ef6\u8fdf\u7ed1\u5b9a&#xff08;Lazy Binding&#xff09;<\/h5>\n<p>\u5982\u679c\u4e00\u4e2a\u7a0b\u5e8f\u4f9d\u8d56 10 \u4e2a\u52a8\u6001\u5e93\u3001\u6d89\u53ca 1000 \u4e2a\u5e93\u51fd\u6570&#xff0c;\u542f\u52a8\u65f6\u5c31\u628a\u8fd9 1000 \u4e2a\u5730\u5740\u5168\u90e8\u89e3\u6790\u5e76\u586b\u5165 GOT&#xff0c;\u4f1a\u975e\u5e38\u6162\u3002\u5f88\u591a\u51fd\u6570\u53ef\u80fd\u6574\u4e2a\u751f\u547d\u5468\u671f\u90fd\u4e0d\u4f1a\u88ab\u8c03\u7528\u3002<\/p>\n<p>PLT&#xff08;Procedure Linkage Table&#xff0c;\u8fc7\u7a0b\u94fe\u63a5\u8868&#xff09; \u5b9e\u73b0\u4e86\u5ef6\u8fdf\u7ed1\u5b9a&#xff1a;<\/p>\n<ul>\n<li>\u4ee3\u7801\u4e2d call printf \u5b9e\u9645\u4e0a\u5148\u8df3\u5230 printf&#064;PLT\u3002<\/li>\n<li>\u7b2c\u4e00\u6b21\u8c03\u7528\u65f6&#xff0c;PLT \u662f\u4e00\u6bb5\u201c\u6869\u4ee3\u7801\u201d&#xff0c;\u5b83\u4f1a\u628a\u63a7\u5236\u6743\u4ea4\u7ed9\u52a8\u6001\u94fe\u63a5\u5668&#xff1a;\u201c\u5e2e\u6211\u627e\u4e00\u4e0b printf \u7684\u771f\u8eab\u5728\u54ea\u201d\u3002<\/li>\n<li>\u52a8\u6001\u94fe\u63a5\u5668\u627e\u5230\u771f\u5b9e\u5730\u5740\u540e&#xff0c;\u628a\u5730\u5740\u5199\u56de GOT \u8868\u3002<\/li>\n<li>\u7b2c\u4e8c\u6b21\u518d\u8c03\u7528 printf&#xff0c;\u76f4\u63a5\u901a\u8fc7 GOT \u8df3\u8f6c\u5230\u771f\u5b9e\u5730\u5740&#xff0c;\u4e0d\u518d\u7ecf\u8fc7 PLT \u89e3\u6790\u3002<\/li>\n<\/ul>\n<p>\u8fd9\u5c31\u662f\u201c\u9996\u6b21\u8c03\u7528\u89e6\u53d1\u91cd\u5b9a\u4f4d&#xff0c;\u540e\u7eed\u8c03\u7528\u76f4\u67e5 GOT\u201d\u7684\u5ef6\u8fdf\u7ed1\u5b9a\u673a\u5236&#xff0c;\u517c\u987e\u4e86\u542f\u52a8\u901f\u5ea6\u4e0e\u8fd0\u884c\u6548\u7387\u3002<\/p>\n<p>\u4e0b\u9762\u662f\u9996\u6b21\u8c03\u7528 printf \u65f6\u5ef6\u8fdf\u7ed1\u5b9a\u7684\u5b8c\u6574\u6d41\u7a0b\u56fe&#xff0c;\u6807\u6ce8\u4e86\u4ee3\u7801\u6bb5&#xff08;\u53ea\u8bfb&#xff09;\u4e0e\u6570\u636e\u6bb5&#xff08;\u53ef\u5199&#xff09;\u7684\u8fb9\u754c&#xff0c;\u4ee5\u53ca GOT \u8868\u9879\u5730\u5740\u7684\u53d8\u5316\u8fc7\u7a0b&#xff1a;<\/p>\n<p>#mermaid-svg-DCXab3lINhPJaEcz{font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-DCXab3lINhPJaEcz .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-DCXab3lINhPJaEcz .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-DCXab3lINhPJaEcz .error-icon{fill:#552222;}#mermaid-svg-DCXab3lINhPJaEcz .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-DCXab3lINhPJaEcz .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-DCXab3lINhPJaEcz .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-DCXab3lINhPJaEcz .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-DCXab3lINhPJaEcz .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-DCXab3lINhPJaEcz .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-DCXab3lINhPJaEcz .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-DCXab3lINhPJaEcz .marker{fill:#333333;stroke:#333333;}#mermaid-svg-DCXab3lINhPJaEcz .marker.cross{stroke:#333333;}#mermaid-svg-DCXab3lINhPJaEcz svg{font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-DCXab3lINhPJaEcz p{margin:0;}#mermaid-svg-DCXab3lINhPJaEcz .label{font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;color:#333;}#mermaid-svg-DCXab3lINhPJaEcz .cluster-label text{fill:#333;}#mermaid-svg-DCXab3lINhPJaEcz .cluster-label span{color:#333;}#mermaid-svg-DCXab3lINhPJaEcz .cluster-label span p{background-color:transparent;}#mermaid-svg-DCXab3lINhPJaEcz .label text,#mermaid-svg-DCXab3lINhPJaEcz span{fill:#333;color:#333;}#mermaid-svg-DCXab3lINhPJaEcz .node rect,#mermaid-svg-DCXab3lINhPJaEcz .node circle,#mermaid-svg-DCXab3lINhPJaEcz .node ellipse,#mermaid-svg-DCXab3lINhPJaEcz .node polygon,#mermaid-svg-DCXab3lINhPJaEcz .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-DCXab3lINhPJaEcz .rough-node .label text,#mermaid-svg-DCXab3lINhPJaEcz .node .label text,#mermaid-svg-DCXab3lINhPJaEcz .image-shape .label,#mermaid-svg-DCXab3lINhPJaEcz .icon-shape .label{text-anchor:middle;}#mermaid-svg-DCXab3lINhPJaEcz .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-DCXab3lINhPJaEcz .rough-node .label,#mermaid-svg-DCXab3lINhPJaEcz .node .label,#mermaid-svg-DCXab3lINhPJaEcz .image-shape .label,#mermaid-svg-DCXab3lINhPJaEcz .icon-shape .label{text-align:center;}#mermaid-svg-DCXab3lINhPJaEcz .node.clickable{cursor:pointer;}#mermaid-svg-DCXab3lINhPJaEcz .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-DCXab3lINhPJaEcz .arrowheadPath{fill:#333333;}#mermaid-svg-DCXab3lINhPJaEcz .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-DCXab3lINhPJaEcz .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-DCXab3lINhPJaEcz .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-DCXab3lINhPJaEcz .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-DCXab3lINhPJaEcz .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-DCXab3lINhPJaEcz .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-DCXab3lINhPJaEcz .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-DCXab3lINhPJaEcz .cluster text{fill:#333;}#mermaid-svg-DCXab3lINhPJaEcz .cluster span{color:#333;}#mermaid-svg-DCXab3lINhPJaEcz div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-DCXab3lINhPJaEcz .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-DCXab3lINhPJaEcz rect.text{fill:none;stroke-width:0;}#mermaid-svg-DCXab3lINhPJaEcz .icon-shape,#mermaid-svg-DCXab3lINhPJaEcz .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-DCXab3lINhPJaEcz .icon-shape p,#mermaid-svg-DCXab3lINhPJaEcz .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-DCXab3lINhPJaEcz .icon-shape .label rect,#mermaid-svg-DCXab3lINhPJaEcz .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-DCXab3lINhPJaEcz .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-DCXab3lINhPJaEcz .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-DCXab3lINhPJaEcz :root{&#8211;mermaid-font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;}<span class=\"nodeLabel\"><\/p>\n<p>\u52a8\u6001\u94fe\u63a5\u5668ld-linux.so<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>\u6570\u636e\u6bb5&#xff08;\u53ef\u5199&#xff0c;RW&#xff09;<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>\u4ee3\u7801\u6bb5&#xff08;\u53ea\u8bfb&#xff0c;R E&#xff09;<\/p>\n<p><\/span><span class=\"edgeLabel\"><\/span><span class=\"edgeLabel\"><\/p>\n<p>\u7b2c\u4e00\u6b21&#xff1a;GOT \u672a\u89e3\u6790<\/p>\n<p><\/span><span class=\"edgeLabel\"><\/span><span class=\"edgeLabel\"><\/span><span class=\"edgeLabel\"><\/span><span class=\"edgeLabel\"><\/p>\n<p>\u56de\u586b GOT \u8868\u9879<\/p>\n<p><\/span><span class=\"edgeLabel\"><\/p>\n<p>\u521d\u59cb\u72b6\u6001<\/p>\n<p><\/span><span class=\"edgeLabel\"><\/p>\n<p>\u7b2c\u4e8c\u6b21\u8c03\u7528\u76f4\u63a5\u8df3\u8f6c<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>call printf&#064;PLT<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>PLT \u6869\u4ee3\u7801jmp *GOT[printf]<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>push \u91cd\u5b9a\u4f4d\u7d22\u5f15&#xff08;\u5982 0x2&#xff09;<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>jmp \u52a8\u6001\u94fe\u63a5\u5668\u5165\u53e3PLT[0]<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>GOT[printf] &#061; PLT&#043;6&#xff08;\u521d\u59cb\u6307\u5411\u4e0b\u4e00\u6761\u6307\u4ee4&#xff09;<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>GOT[printf] &#061; 0x7f&#8230;&#xff08;printf \u771f\u5b9e\u5730\u5740&#xff09;<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>\u67e5\u627e printf \u7b26\u53f7\u5b9a\u4f4d libc.so \u4e2d\u771f\u5b9e\u5730\u5740<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>\u628a\u771f\u5b9e\u5730\u5740\u5199\u56de GOT[printf]<\/p>\n<p><\/span><\/p>\n<p>\u6d41\u7a0b\u89e3\u8bfb&#xff1a;<\/p>\n<li>\u7b2c\u4e00\u6b21\u8c03\u7528&#xff1a;call printf&#064;PLT \u8fdb\u5165 PLT \u6869\u4ee3\u7801&#xff0c;\u6b64\u65f6 GOT[printf] \u8fd8\u6307\u5411 PLT \u5185\u90e8\u7684\u4e0b\u4e00\u6761\u6307\u4ee4&#xff08;PLT&#043;6&#xff09;&#xff0c;\u4e8e\u662f\u7ee7\u7eed push \u91cd\u5b9a\u4f4d\u7d22\u5f15\u5e76\u8df3\u8f6c\u5230\u52a8\u6001\u94fe\u63a5\u5668\u3002<\/li>\n<li>\u52a8\u6001\u94fe\u63a5\u5668\u89e3\u6790&#xff1a;\u6839\u636e\u91cd\u5b9a\u4f4d\u7d22\u5f15\u67e5\u627e printf \u5728 libc.so \u4e2d\u7684\u771f\u5b9e\u865a\u62df\u5730\u5740\u3002<\/li>\n<li>\u56de\u586b GOT&#xff1a;\u52a8\u6001\u94fe\u63a5\u5668\u628a\u771f\u5b9e\u5730\u5740\u5199\u56de\u6570\u636e\u6bb5\u7684 GOT[printf]&#xff0c;\u4ee3\u7801\u6bb5\u4e00\u884c\u672a\u6539\u3002<\/li>\n<li>\u7b2c\u4e8c\u6b21\u8c03\u7528&#xff1a;call printf&#064;PLT \u518d\u6b21\u8fdb\u5165\u6869\u4ee3\u7801&#xff0c;\u6b64\u65f6 GOT[printf] \u5df2\u6307\u5411\u771f\u5b9e\u5730\u5740&#xff0c;\u76f4\u63a5 jmp \u5230 printf \u672c\u4f53&#xff0c;\u4e0d\u518d\u7ecf\u8fc7\u52a8\u6001\u94fe\u63a5\u5668\u3002<\/li>\n<h5>4.5 \u5e93\u4f9d\u8d56\u5e93&#xff1a;\u6bcf\u4e2a ELF \u90fd\u6709\u81ea\u5df1\u7684 GOT<\/h5>\n<p>\u4e0d\u4ec5\u662f\u53ef\u6267\u884c\u7a0b\u5e8f\u8c03\u7528\u52a8\u6001\u5e93&#xff0c;\u52a8\u6001\u5e93\u4e4b\u95f4\u4e5f\u53ef\u4ee5\u76f8\u4e92\u4f9d\u8d56\u3002\u6bd4\u5982\u5e93 A \u8c03\u7528\u5e93 B \u7684\u51fd\u6570\u3002\u56e0\u4e3a\u6bcf\u4e2a ELF&#xff08;\u65e0\u8bba\u53ef\u6267\u884c\u6587\u4ef6\u8fd8\u662f .so&#xff09;\u90fd\u6709\u81ea\u5df1\u7684\u4ee3\u7801\u6bb5\u548c\u6570\u636e\u6bb5&#xff0c;\u6240\u4ee5\u6bcf\u4e2a\u5e93\u90fd\u6709\u81ea\u5df1\u7684 GOT\u3002\u5e93 A \u901a\u8fc7\u67e5\u81ea\u5df1\u7684 GOT&#xff0c;\u627e\u5230\u5e93 B \u7684\u65b9\u6cd5\u5730\u5740\u3002\u8fd9\u4e5f\u662f ELF \u683c\u5f0f\u7edf\u4e00\u6027\u7684\u4f53\u73b0\u3002<\/p>\n<hr \/>\n<h4>\u4e94\u3001\u603b\u7ed3&#xff1a;\u4e00\u5f20\u56fe\u770b\u6e05\u4ece\u6e90\u7801\u5230 CPU \u7684\u5168\u94fe\u8def<\/h4>\n<p>\u8fd9\u5802\u8bfe\u7684\u7ec8\u6781\u610f\u4e49&#xff0c;\u662f\u628a\u770b\u4f3c\u5b64\u7acb\u7684\u7f16\u8bd1\u539f\u7406\u3001\u64cd\u4f5c\u7cfb\u7edf\u6587\u4ef6\u7cfb\u7edf\u3001\u5185\u5b58\u7ba1\u7406\u3001\u8fdb\u7a0b\u52a0\u8f7d\u4e32\u6210\u4e86\u4e00\u6761\u7ebf&#xff1a;<\/p>\n<li>\u7f16\u8bd1\u4e0e\u9759\u6001\u94fe\u63a5&#xff1a;\u591a\u4e2a .c \u2192 .o \u2192 \u5408\u5e76 Section\u3001\u89e3\u6790\u7b26\u53f7\u3001\u5730\u5740\u91cd\u5b9a\u4f4d \u2192 \u751f\u6210 ELF \u53ef\u6267\u884c\u6587\u4ef6\u3002\u6b64\u65f6\u7a0b\u5e8f\u5185\u90e8\u5df2\u57fa\u4e8e\u5e73\u5766\u6a21\u5f0f\u4ece 0 \u7f16\u5740&#xff08;\u903b\u8f91\u5730\u5740\/\u865a\u62df\u5730\u5740&#xff09;\u3002<\/li>\n<li>\u52a0\u8f7d\u51c6\u5907&#xff1a;\u64cd\u4f5c\u7cfb\u7edf\u901a\u8fc7\u6587\u4ef6\u7cfb\u7edf\u627e\u5230 ELF&#xff0c;\u8bfb\u53d6 ELF Header \u62ff\u5230 Entry Point&#xff0c;\u8bfb\u53d6 Program Header \u521d\u59cb\u5316 mm_struct \u548c vm_area_struct\u3002<\/li>\n<li>\u5185\u5b58\u6620\u5c04&#xff1a;Segment \u88ab\u52a0\u8f7d\u5230\u7269\u7406\u5185\u5b58&#xff0c;\u9875\u8868\u5efa\u7acb\u865a\u62df\u5730\u5740\u5230\u7269\u7406\u5730\u5740\u7684\u6620\u5c04\u3002\u6743\u9650\u7531 ELF \u7684 Flag \u4f4d\u51b3\u5b9a\u3002<\/li>\n<li>\u542f\u52a8\u4e0e\u52a8\u6001\u94fe\u63a5&#xff1a;CPU \u7684 EIP \u88ab\u586b\u5165 _start \u865a\u62df\u5730\u5740\u3002_start \u521d\u59cb\u5316\u8fd0\u884c\u73af\u5883&#xff0c;\u8c03\u7528\u52a8\u6001\u94fe\u63a5\u5668\u52a0\u8f7d .so&#xff0c;\u901a\u8fc7 GOT\/PLT \u5b8c\u6210\u8fd0\u884c\u65f6\u91cd\u5b9a\u4f4d\u3002<\/li>\n<li>\u8fdb\u5165 main&#xff1a;\u4e00\u5207\u5c31\u7eea\u540e&#xff0c;\u6700\u7ec8\u8c03\u7528 libc_start_main&#xff0c;\u8fdb\u5165\u7528\u6237\u7f16\u5199\u7684 main \u51fd\u6570\u3002<\/li>\n<p>\u865a\u62df\u5730\u5740\u7a7a\u95f4\u662f\u8fd9\u4e00\u5207\u7684\u6838\u5fc3\u6865\u6881&#xff1a;\u5b83\u8ba9\u7f16\u8bd1\u5668\u3001\u94fe\u63a5\u5668\u3001\u64cd\u4f5c\u7cfb\u7edf\u3001CPU \u80fd\u7528\u540c\u4e00\u5957\u201c\u5730\u5740\u8bed\u8a00\u201d\u5bf9\u8bdd\u3002\u7f16\u8bd1\u5668\u5728\u78c1\u76d8\u4e0a\u6309\u865a\u62df\u5730\u5740\u7f16\u597d\u7a0b\u5e8f&#xff0c;\u64cd\u4f5c\u7cfb\u7edf\u7528\u8fd9\u4e9b\u865a\u62df\u5730\u5740\u521d\u59cb\u5316\u8fdb\u7a0b\u7a7a\u95f4&#xff0c;CPU \u901a\u8fc7\u9875\u8868\u628a\u865a\u62df\u5730\u5740\u7ffb\u8bd1\u4e3a\u7269\u7406\u5730\u5740\u53d6\u6307\u6267\u884c\u3002<\/p>\n<p>\u4e0b\u5802\u8bfe&#xff0c;\u6211\u4eec\u5c06\u8fdb\u5165\u8fdb\u7a0b\u95f4\u901a\u4fe1&#xff08;IPC&#xff09;\u7684\u4e16\u754c&#xff0c;\u5f00\u53d1\u73af\u5883\u4e5f\u5c06\u5207\u6362\u4e3a C&#043;&#043; \u4e0e VS Code\u3002\u4f46\u90a3\u5df2\u7ecf\u662f\u53e6\u4e00\u4e2a\u6545\u4e8b\u4e86\u3002<\/p>\n<hr \/>\n<p>\u9644&#xff1a;\u8bfe\u5802\u6838\u5fc3\u5de5\u5177\u901f\u67e5\u8868<\/p>\n<table>\n<tr>\u5de5\u5177\/\u547d\u4ee4\u4f5c\u7528<\/tr>\n<tbody>\n<tr>\n<td>readelf -S &lt;file&gt;<\/td>\n<td>\u67e5\u770b Section Header Table&#xff08;\u7f16\u8bd1\u94fe\u63a5\u89c6\u89d2&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>readelf -l &lt;file&gt;<\/td>\n<td>\u67e5\u770b Program Header Table \u53ca Section \u2192 Segment \u6620\u5c04&#xff08;\u6267\u884c\u52a0\u8f7d\u89c6\u89d2&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>readelf -h &lt;file&gt;<\/td>\n<td>\u67e5\u770b ELF Header&#xff08;Magic\u3001Entry Point\u3001\u6587\u4ef6\u7c7b\u578b\u7b49&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>readelf -s &lt;file&gt;<\/td>\n<td>\u67e5\u770b\u7b26\u53f7\u8868&#xff08;Defined \/ Undefined \u7b26\u53f7&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>objdump -d &lt;file&gt;<\/td>\n<td>\u53cd\u6c47\u7f16\u4ee3\u7801\u6bb5&#xff0c;\u67e5\u770b call \u6307\u4ee4\u5730\u5740&#xff0c;\u9a8c\u8bc1\u91cd\u5b9a\u4f4d<\/td>\n<\/tr>\n<tr>\n<td>ldd &lt;executable&gt;<\/td>\n<td>\u67e5\u770b\u53ef\u6267\u884c\u6587\u4ef6\u4f9d\u8d56\u7684\u52a8\u6001\u5e93<\/td>\n<\/tr>\n<tr>\n<td>gcc -c<\/td>\n<td>\u7f16\u8bd1\u4e0d\u94fe\u63a5&#xff0c;\u751f\u6210 .o \u53ef\u91cd\u5b9a\u4f4d\u76ee\u6807\u6587\u4ef6<\/td>\n<\/tr>\n<tr>\n<td>.\/a.out \u80cc\u540e\u7684 _start<\/td>\n<td>\u7a0b\u5e8f\u771f\u6b63\u5165\u53e3&#xff0c;\u8d1f\u8d23\u521d\u59cb\u5316\u4e0e\u52a8\u6001\u94fe\u63a5\u8c03\u5ea6<\/td>\n<\/tr>\n<tr>\n<td>file &lt;file&gt;<\/td>\n<td>\u547d\u4ee4\u7528\u4e8e\u8bc6\u522b\u6587\u4ef6\u7c7b\u578b<img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261020071725-6ad71585efda4.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4e0b\u9762\u662f\u6574\u7bc7\u6587\u7ae0\u7684\u5b8c\u6574\u94fe\u8def\u603b\u89c8\u56fe&#xff0c;\u4ece\u6e90\u7801\u5230 CPU \u53d6\u6307\u6267\u884c&#xff1a;<\/p>\n<p>#mermaid-svg-rTKN0xWyUauOkSWv{font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-rTKN0xWyUauOkSWv .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-rTKN0xWyUauOkSWv .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-rTKN0xWyUauOkSWv .error-icon{fill:#552222;}#mermaid-svg-rTKN0xWyUauOkSWv .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-rTKN0xWyUauOkSWv .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-rTKN0xWyUauOkSWv .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-rTKN0xWyUauOkSWv .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-rTKN0xWyUauOkSWv .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-rTKN0xWyUauOkSWv .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-rTKN0xWyUauOkSWv .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-rTKN0xWyUauOkSWv .marker{fill:#333333;stroke:#333333;}#mermaid-svg-rTKN0xWyUauOkSWv .marker.cross{stroke:#333333;}#mermaid-svg-rTKN0xWyUauOkSWv svg{font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-rTKN0xWyUauOkSWv p{margin:0;}#mermaid-svg-rTKN0xWyUauOkSWv .label{font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;color:#333;}#mermaid-svg-rTKN0xWyUauOkSWv .cluster-label text{fill:#333;}#mermaid-svg-rTKN0xWyUauOkSWv .cluster-label span{color:#333;}#mermaid-svg-rTKN0xWyUauOkSWv .cluster-label span p{background-color:transparent;}#mermaid-svg-rTKN0xWyUauOkSWv .label text,#mermaid-svg-rTKN0xWyUauOkSWv span{fill:#333;color:#333;}#mermaid-svg-rTKN0xWyUauOkSWv .node rect,#mermaid-svg-rTKN0xWyUauOkSWv .node circle,#mermaid-svg-rTKN0xWyUauOkSWv .node ellipse,#mermaid-svg-rTKN0xWyUauOkSWv .node polygon,#mermaid-svg-rTKN0xWyUauOkSWv .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-rTKN0xWyUauOkSWv .rough-node .label text,#mermaid-svg-rTKN0xWyUauOkSWv .node .label text,#mermaid-svg-rTKN0xWyUauOkSWv .image-shape .label,#mermaid-svg-rTKN0xWyUauOkSWv .icon-shape .label{text-anchor:middle;}#mermaid-svg-rTKN0xWyUauOkSWv .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-rTKN0xWyUauOkSWv .rough-node .label,#mermaid-svg-rTKN0xWyUauOkSWv .node .label,#mermaid-svg-rTKN0xWyUauOkSWv .image-shape .label,#mermaid-svg-rTKN0xWyUauOkSWv .icon-shape .label{text-align:center;}#mermaid-svg-rTKN0xWyUauOkSWv .node.clickable{cursor:pointer;}#mermaid-svg-rTKN0xWyUauOkSWv .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-rTKN0xWyUauOkSWv .arrowheadPath{fill:#333333;}#mermaid-svg-rTKN0xWyUauOkSWv .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-rTKN0xWyUauOkSWv .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-rTKN0xWyUauOkSWv .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-rTKN0xWyUauOkSWv .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-rTKN0xWyUauOkSWv .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-rTKN0xWyUauOkSWv .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-rTKN0xWyUauOkSWv .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-rTKN0xWyUauOkSWv .cluster text{fill:#333;}#mermaid-svg-rTKN0xWyUauOkSWv .cluster span{color:#333;}#mermaid-svg-rTKN0xWyUauOkSWv div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-rTKN0xWyUauOkSWv .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-rTKN0xWyUauOkSWv rect.text{fill:none;stroke-width:0;}#mermaid-svg-rTKN0xWyUauOkSWv .icon-shape,#mermaid-svg-rTKN0xWyUauOkSWv .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-rTKN0xWyUauOkSWv .icon-shape p,#mermaid-svg-rTKN0xWyUauOkSWv .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-rTKN0xWyUauOkSWv .icon-shape .label rect,#mermaid-svg-rTKN0xWyUauOkSWv .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-rTKN0xWyUauOkSWv .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-rTKN0xWyUauOkSWv .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-rTKN0xWyUauOkSWv :root{&#8211;mermaid-font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;}<span class=\"nodeLabel\"><\/p>\n<p>\u8fdb\u5165 main<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>\u542f\u52a8\u4e0e\u52a8\u6001\u94fe\u63a5<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>\u5185\u5b58\u6620\u5c04<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>\u52a0\u8f7d\u51c6\u5907<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>\u7f16\u8bd1\u4e0e\u9759\u6001\u94fe\u63a5<\/p>\n<p><\/span><span class=\"edgeLabel\"><\/span><span class=\"edgeLabel\"><\/span><span class=\"edgeLabel\"><\/span><span class=\"edgeLabel\"><\/span><span class=\"edgeLabel\"><\/span><span class=\"edgeLabel\"><\/span><span class=\"edgeLabel\"><\/span><span class=\"edgeLabel\"><\/span><span class=\"edgeLabel\"><\/span><span class=\"edgeLabel\"><\/span><span class=\"edgeLabel\"><\/span><span class=\"nodeLabel\"><\/p>\n<p>\u591a\u4e2a .c \u6587\u4ef6<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>.o \u53ef\u91cd\u5b9a\u4f4d\u76ee\u6807\u6587\u4ef6<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>ELF \u53ef\u6267\u884c\u6587\u4ef6&#xff08;\u903b\u8f91\u5730\u5740\u5df2\u7f16\u597d&#xff09;<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>\u6587\u4ef6\u7cfb\u7edf\u5b9a\u4f4d ELF<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>\u8bfb\u53d6 ELF Header\u62ff\u5230 Entry Point<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>\u8bfb\u53d6 Program Header\u521d\u59cb\u5316 mm_struct<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>Segment \u52a0\u8f7d\u5230\u7269\u7406\u5185\u5b58<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>\u9875\u8868\u5efa\u7acb\u865a\u62df\u5730\u5740 \u2194 \u7269\u7406\u5730\u5740<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>_start \u5165\u53e3<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>\u52a8\u6001\u94fe\u63a5\u5668\u52a0\u8f7d .so<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>GOT\/PLT \u8fd0\u884c\u65f6\u91cd\u5b9a\u4f4d<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>libc_start_main \u2192 main<\/p>\n<p><\/span><\/p>\n<p>\u56fe\u89e3&#xff1a; \u4ece\u6e90\u7801\u7f16\u8bd1\u3001\u9759\u6001\u94fe\u63a5\u751f\u6210 ELF&#xff0c;\u5230\u64cd\u4f5c\u7cfb\u7edf\u52a0\u8f7d\u3001\u5185\u5b58\u6620\u5c04\u3001\u52a8\u6001\u94fe\u63a5&#xff0c;\u6700\u7ec8\u8fdb\u5165 main \u51fd\u6570\u2014\u2014\u865a\u62df\u5730\u5740\u7a7a\u95f4\u8d2f\u7a7f\u59cb\u7ec8&#xff0c;\u662f\u8fd9\u4e00\u5207\u7684\u6838\u5fc3\u6865\u6881\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\/* MD \/ \u5bcc\u6587\u672c\u4e2d\u7684 .toc\uff08\u542b\u535a\u5ba2\u56ed\u642c\u5bb6\u7b49\u5d4c\u5957\u7ed3\u6784\uff09\uff1b.toc-box \u5728\u4fa7\u680f\uff0c\u4e0d\u53d7\u5f71\u54cd *\/#content_views .toc,\/* \u7f16\u8f91\u5668\u5e38\u5728\u76ee\u5f55\u524d\u540e\u63d2\u5165\u7a7a p\uff08:empty \u4ecd\u5360 20px\uff09\uff0c\u4e00\u5e76\u53bb\u6389\u907f\u514d\u9876\u7a7a\u9699 *\/#content_views.markdown_views &gt; p:empty:has(+ .toc),#content_views.markdown_views &gt; .toc + p:empty,\/* \u5bcc\u6587\u672c\u65e7\u7248\u76ee\u5f55\u6807\u8bb0 *\/#content<\/p>\n","protected":false},"author":2,"featured_media":115951,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[12392,13154,58,43,305,44],"topic":[],"class_list":["post-115961","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-12392","tag-13154","tag-linux","tag-43","tag-305","tag-44"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u3010Linux-System\u3011\u3010ELF\u52a0\u8f7d\u63ed\u79d8\uff1a\u4ece\u78c1\u76d8\u5230CPU\u7684\u786c\u6838\u65c5\u7a0b\u3011\u6d41\u98df\u822c\u6295\u5582 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/115961.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u3010Linux-System\u3011\u3010ELF\u52a0\u8f7d\u63ed\u79d8\uff1a\u4ece\u78c1\u76d8\u5230CPU\u7684\u786c\u6838\u65c5\u7a0b\u3011\u6d41\u98df\u822c\u6295\u5582 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\/* MD \/ \u5bcc\u6587\u672c\u4e2d\u7684 .toc\uff08\u542b\u535a\u5ba2\u56ed\u642c\u5bb6\u7b49\u5d4c\u5957\u7ed3\u6784\uff09\uff1b.toc-box \u5728\u4fa7\u680f\uff0c\u4e0d\u53d7\u5f71\u54cd *\/#content_views .toc,\/* \u7f16\u8f91\u5668\u5e38\u5728\u76ee\u5f55\u524d\u540e\u63d2\u5165\u7a7a p\uff08:empty \u4ecd\u5360 20px\uff09\uff0c\u4e00\u5e76\u53bb\u6389\u907f\u514d\u9876\u7a7a\u9699 *\/#content_views.markdown_views &gt; p:empty:has(+ .toc),#content_views.markdown_views &gt; .toc + p:empty,\/* \u5bcc\u6587\u672c\u65e7\u7248\u76ee\u5f55\u6807\u8bb0 *\/#content\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/115961.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-10-20T07:17:27+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261020071723-6ad715837ada8.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"19 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/115961.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/115961.html\",\"name\":\"\u3010Linux-System\u3011\u3010ELF\u52a0\u8f7d\u63ed\u79d8\uff1a\u4ece\u78c1\u76d8\u5230CPU\u7684\u786c\u6838\u65c5\u7a0b\u3011\u6d41\u98df\u822c\u6295\u5582 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-10-20T07:17:27+00:00\",\"dateModified\":\"2026-10-20T07:17:27+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/115961.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/115961.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/115961.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u3010Linux-System\u3011\u3010ELF\u52a0\u8f7d\u63ed\u79d8\uff1a\u4ece\u78c1\u76d8\u5230CPU\u7684\u786c\u6838\u65c5\u7a0b\u3011\u6d41\u98df\u822c\u6295\u5582\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u3010Linux-System\u3011\u3010ELF\u52a0\u8f7d\u63ed\u79d8\uff1a\u4ece\u78c1\u76d8\u5230CPU\u7684\u786c\u6838\u65c5\u7a0b\u3011\u6d41\u98df\u822c\u6295\u5582 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/115961.html","og_locale":"zh_CN","og_type":"article","og_title":"\u3010Linux-System\u3011\u3010ELF\u52a0\u8f7d\u63ed\u79d8\uff1a\u4ece\u78c1\u76d8\u5230CPU\u7684\u786c\u6838\u65c5\u7a0b\u3011\u6d41\u98df\u822c\u6295\u5582 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\/* MD \/ \u5bcc\u6587\u672c\u4e2d\u7684 .toc\uff08\u542b\u535a\u5ba2\u56ed\u642c\u5bb6\u7b49\u5d4c\u5957\u7ed3\u6784\uff09\uff1b.toc-box \u5728\u4fa7\u680f\uff0c\u4e0d\u53d7\u5f71\u54cd *\/#content_views .toc,\/* \u7f16\u8f91\u5668\u5e38\u5728\u76ee\u5f55\u524d\u540e\u63d2\u5165\u7a7a p\uff08:empty \u4ecd\u5360 20px\uff09\uff0c\u4e00\u5e76\u53bb\u6389\u907f\u514d\u9876\u7a7a\u9699 *\/#content_views.markdown_views &gt; p:empty:has(+ .toc),#content_views.markdown_views &gt; .toc + p:empty,\/* \u5bcc\u6587\u672c\u65e7\u7248\u76ee\u5f55\u6807\u8bb0 *\/#content","og_url":"https:\/\/www.wsisp.com\/helps\/115961.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-10-20T07:17:27+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261020071723-6ad715837ada8.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"19 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/115961.html","url":"https:\/\/www.wsisp.com\/helps\/115961.html","name":"\u3010Linux-System\u3011\u3010ELF\u52a0\u8f7d\u63ed\u79d8\uff1a\u4ece\u78c1\u76d8\u5230CPU\u7684\u786c\u6838\u65c5\u7a0b\u3011\u6d41\u98df\u822c\u6295\u5582 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-10-20T07:17:27+00:00","dateModified":"2026-10-20T07:17:27+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/115961.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/115961.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/115961.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u3010Linux-System\u3011\u3010ELF\u52a0\u8f7d\u63ed\u79d8\uff1a\u4ece\u78c1\u76d8\u5230CPU\u7684\u786c\u6838\u65c5\u7a0b\u3011\u6d41\u98df\u822c\u6295\u5582"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/115961","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=115961"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/115961\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/115951"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=115961"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=115961"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=115961"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=115961"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}