{"id":78035,"date":"2026-02-25T23:41:58","date_gmt":"2026-02-25T15:41:58","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/78035.html"},"modified":"2026-02-25T23:41:58","modified_gmt":"2026-02-25T15:41:58","slug":"gcc%e7%bc%96%e8%af%917%e9%93%be%e6%8e%a5%e8%84%9a%e6%9c%aclinkerscripts","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/78035.html","title":{"rendered":"GCC\u7f16\u8bd1(7)\u94fe\u63a5\u811a\u672cLinkerScripts"},"content":{"rendered":"<h2>GCC\u7f16\u8bd1(7)\u94fe\u63a5\u811a\u672cLinkerScripts<\/h2>\n<p><b><font face=\"\u4eff\u5b8b\"> Author: Once Day Date: 2026\u5e742\u670825\u65e5<\/font><\/b> <\/p>\n<p><b><font face=\"\u4eff\u5b8b\">\u4e00\u4f4d\u70ed\u8877\u4e8eLinux\u5b66\u4e60\u548c\u5f00\u53d1\u7684\u83dc\u9e1f&#xff0c;\u8bd5\u56fe\u8c31\u5199\u4e00\u573a\u5192\u9669\u4e4b\u65c5&#xff0c;\u4e5f\u8bb8\u7ec8\u70b9\u53ea\u662f\u4e00\u573a\u767d\u65e5\u68a6\u2026<\/font><\/b> <\/p>\n<p><b><font face=\"\u4eff\u5b8b\"> \u6f2b\u6f2b\u957f\u8def&#xff0c;\u6709\u4eba\u5bf9\u4f60\u5fae\u7b11\u8fc7\u561b\u2026<\/font><\/b> <\/p>\n<p><b>\u5168\u7cfb\u5217\u6587\u7ae0\u53ef\u53c2\u8003\u4e13\u680f: \u7f16\u8bd1\u6784\u5efa\u5de5\u5177\u94fe_Once-Day\u7684\u535a\u5ba2-CSDN\u535a\u5ba2<\/b><\/p>\n<p><b>\u53c2\u8003\u6587\u7ae0:<\/b><\/p>\n<ul>\n<li>GNU LD Linker Scripts<\/li>\n<li>\u94fe\u63a5\u811a\u672c(Linker Scripts)\u8bed\u6cd5\u548c\u89c4\u5219\u89e3\u6790<\/li>\n<li>\u94fe\u63a5\u811a\u672c\u7684\u4f5c\u7528\u53ca\u683c\u5f0f<\/li>\n<li>GCC\u4e4b\u7f16\u8bd1(7)Linker\u94fe\u63a5\u811a\u672c_gcc \u94fe\u63a5\u811a\u672c-CSDN\u535a\u5ba2<\/li>\n<\/ul>\n<hr \/>\n<h4>\u6587\u7ae0\u76ee\u5f55<\/h4>\n<ul>\n<li>GCC\u7f16\u8bd1(7)\u94fe\u63a5\u811a\u672cLinkerScripts<\/li>\n<li>\n<ul>\n<li>\n<ul>\n<li>\n<ul>\n<li>1. LinkerScripts\u6982\u8ff0<\/li>\n<li>2. LinkerScripts\u7b80\u5355\u793a\u4f8b<\/li>\n<li>3. \u57fa\u7840\u547d\u4ee4<\/li>\n<li>4. \u7b26\u53f7\u8d4b\u503c<\/li>\n<li>5. SECTIONS\u547d\u4ee4<\/li>\n<li>6. MEMORY\u547d\u4ee4<\/li>\n<li>7. PHDRS\u547d\u4ee4<\/li>\n<li>8. \u7b26\u53f7\u7248\u672c\u547d\u4ee4<\/li>\n<li>9. \u94fe\u63a5\u5668\u811a\u672c\u4e2d\u7684\u8868\u8fbe\u5f0f<\/li>\n<li>10. \u5185\u7f6e\u51fd\u6570<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h5>1. LinkerScripts\u6982\u8ff0<\/h5>\n<p>\u5728 ELF \u4f53\u7cfb\u4e0b&#xff0c;object file \u662f\u94fe\u63a5\u5668\u5904\u7406\u7684\u57fa\u672c\u5355\u5143&#xff0c;\u65e2\u53ef\u4ee5\u662f\u7f16\u8bd1\u4ea7\u751f\u7684\u53ef\u91cd\u5b9a\u4f4d\u6587\u4ef6&#xff08;.o&#xff09;&#xff0c;\u4e5f\u53ef\u4ee5\u662f\u5171\u4eab\u5e93\u6216\u6700\u7ec8\u53ef\u6267\u884c\u6587\u4ef6\u3002\u53ef\u91cd\u5b9a\u4f4d\u6587\u4ef6\u4ee5 section \u4e3a\u7ec4\u7ec7\u6838\u5fc3&#xff0c;\u4fdd\u5b58\u4ee3\u7801\u3001\u6570\u636e\u3001\u7b26\u53f7\u4e0e\u91cd\u5b9a\u4f4d\u4fe1\u606f&#xff1b;\u800c\u53ef\u6267\u884c\u6587\u4ef6\u5728\u88c5\u8f7d\u9636\u6bb5\u5219\u4ee5 segment \u4e3a\u5355\u4f4d\u7531\u52a0\u8f7d\u5668\u89e3\u6790\u3002\u94fe\u63a5\u5668\u7684\u804c\u8d23\u662f\u5728\u591a\u4e2a\u8f93\u5165 object file \u4e4b\u95f4\u89e3\u6790\u7b26\u53f7\u3001\u5408\u5e76\u540c\u540d section&#xff0c;\u5e76\u4f9d\u636e\u94fe\u63a5\u811a\u672c\u751f\u6210\u65b0\u7684\u8f93\u51fa\u5e03\u5c40\u3002<\/p>\n<p>section \u662f\u903b\u8f91\u5212\u5206&#xff0c;\u5178\u578b\u5982 .text\u3001.data\u3001.bss\u3001.rodata\u3002\u6bcf\u4e2a section \u5177\u6709\u5c5e\u6027\u6807\u5fd7&#xff08;\u5982 SHF_ALLOC\u3001SHF_EXECINSTR&#xff09;&#xff0c;\u51b3\u5b9a\u5176\u662f\u5426\u53c2\u4e0e\u88c5\u8f7d\u53ca\u8bbf\u95ee\u6743\u9650\u3002segment \u5219\u6765\u6e90\u4e8e ELF \u4e2d\u7684 Program Header&#xff0c;\u7531\u4e00\u4e2a\u6216\u591a\u4e2a\u5c5e\u6027\u76f8\u8fd1\u7684 section \u805a\u5408\u800c\u6210&#xff0c;\u4f8b\u5982\u4e00\u4e2a PT_LOAD \u6bb5\u901a\u5e38\u540c\u65f6\u8986\u76d6 .text \u4e0e .rodata\u3002\u7b80\u8a00\u4e4b&#xff0c;section \u9762\u5411\u94fe\u63a5&#xff0c;segment \u9762\u5411\u8fd0\u884c\u65f6\u52a0\u8f7d\u3002<\/p>\n<p>\u5185\u5b58\u5e03\u5c40\u7684\u6838\u5fc3\u6982\u5ff5\u662f VMA \u4e0e LMA\u3002VMA&#xff08;Virtual Memory Address&#xff09;\u8868\u793a\u7a0b\u5e8f\u8fd0\u884c\u65f6\u8bbf\u95ee\u8be5\u6bb5\u5185\u5bb9\u6240\u4f7f\u7528\u7684\u865a\u62df\u5730\u5740&#xff1b;LMA&#xff08;Load Memory Address&#xff09;\u8868\u793a\u8be5\u5185\u5bb9\u5728\u955c\u50cf\u6587\u4ef6\u6216\u7269\u7406\u5b58\u50a8\u4e2d\u7684\u52a0\u8f7d\u5730\u5740\u3002\u4e24\u8005\u5728\u684c\u9762\u7cfb\u7edf\u4e2d\u5f80\u5f80\u4e00\u81f4&#xff0c;\u4f46\u5728\u5d4c\u5165\u5f0f\u573a\u666f\u4e0b\u5e38\u5e38\u5206\u79bb&#xff0c;\u4f8b\u5982\u4ee3\u7801\u5728 Flash \u4e2d\u52a0\u8f7d\u3001\u6570\u636e\u5728 RAM \u4e2d\u8fd0\u884c&#xff1a;<\/p>\n<p>SECTIONS {<br \/>\n  .text 0x08000000 : { *(.text) }<br \/>\n  .data 0x20000000 : AT(0x08010000) { *(.data) }<br \/>\n}<\/p>\n<p>\u6b64\u5904 .data \u7684 VMA \u4e3a 0x20000000&#xff0c;\u800c LMA \u4f4d\u4e8e Flash \u5730\u5740 0x08010000\u3002\u542f\u52a8\u4ee3\u7801\u9700\u5728\u590d\u4f4d\u540e\u5c06 .data \u4ece LMA \u62f7\u8d1d\u5230 VMA\u3002<\/p>\n<p>\u94fe\u63a5\u8fc7\u7a0b\u53ef\u4ee5\u62bd\u8c61\u4e3a\u4ece\u8f93\u5165 section \u5230\u8f93\u51fa section&#xff0c;\u518d\u5230\u8fd0\u884c\u65f6 segment \u7684\u6620\u5c04\u5173\u7cfb&#xff1a;<\/p>\n<p>  #mermaid-svg-YpNV4KuELmgWrdHV{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-YpNV4KuELmgWrdHV .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-YpNV4KuELmgWrdHV .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-YpNV4KuELmgWrdHV .error-icon{fill:#552222;}#mermaid-svg-YpNV4KuELmgWrdHV .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-YpNV4KuELmgWrdHV .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-YpNV4KuELmgWrdHV .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-YpNV4KuELmgWrdHV .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-YpNV4KuELmgWrdHV .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-YpNV4KuELmgWrdHV .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-YpNV4KuELmgWrdHV .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-YpNV4KuELmgWrdHV .marker{fill:#333333;stroke:#333333;}#mermaid-svg-YpNV4KuELmgWrdHV .marker.cross{stroke:#333333;}#mermaid-svg-YpNV4KuELmgWrdHV svg{font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-YpNV4KuELmgWrdHV p{margin:0;}#mermaid-svg-YpNV4KuELmgWrdHV .label{font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;color:#333;}#mermaid-svg-YpNV4KuELmgWrdHV .cluster-label text{fill:#333;}#mermaid-svg-YpNV4KuELmgWrdHV .cluster-label span{color:#333;}#mermaid-svg-YpNV4KuELmgWrdHV .cluster-label span p{background-color:transparent;}#mermaid-svg-YpNV4KuELmgWrdHV .label text,#mermaid-svg-YpNV4KuELmgWrdHV span{fill:#333;color:#333;}#mermaid-svg-YpNV4KuELmgWrdHV .node rect,#mermaid-svg-YpNV4KuELmgWrdHV .node circle,#mermaid-svg-YpNV4KuELmgWrdHV .node ellipse,#mermaid-svg-YpNV4KuELmgWrdHV .node polygon,#mermaid-svg-YpNV4KuELmgWrdHV .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-YpNV4KuELmgWrdHV .rough-node .label text,#mermaid-svg-YpNV4KuELmgWrdHV .node .label text,#mermaid-svg-YpNV4KuELmgWrdHV .image-shape .label,#mermaid-svg-YpNV4KuELmgWrdHV .icon-shape .label{text-anchor:middle;}#mermaid-svg-YpNV4KuELmgWrdHV .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-YpNV4KuELmgWrdHV .rough-node .label,#mermaid-svg-YpNV4KuELmgWrdHV .node .label,#mermaid-svg-YpNV4KuELmgWrdHV .image-shape .label,#mermaid-svg-YpNV4KuELmgWrdHV .icon-shape .label{text-align:center;}#mermaid-svg-YpNV4KuELmgWrdHV .node.clickable{cursor:pointer;}#mermaid-svg-YpNV4KuELmgWrdHV .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-YpNV4KuELmgWrdHV .arrowheadPath{fill:#333333;}#mermaid-svg-YpNV4KuELmgWrdHV .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-YpNV4KuELmgWrdHV .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-YpNV4KuELmgWrdHV .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-YpNV4KuELmgWrdHV .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-YpNV4KuELmgWrdHV .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-YpNV4KuELmgWrdHV .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-YpNV4KuELmgWrdHV .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-YpNV4KuELmgWrdHV .cluster text{fill:#333;}#mermaid-svg-YpNV4KuELmgWrdHV .cluster span{color:#333;}#mermaid-svg-YpNV4KuELmgWrdHV 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-YpNV4KuELmgWrdHV .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-YpNV4KuELmgWrdHV rect.text{fill:none;stroke-width:0;}#mermaid-svg-YpNV4KuELmgWrdHV .icon-shape,#mermaid-svg-YpNV4KuELmgWrdHV .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-YpNV4KuELmgWrdHV .icon-shape p,#mermaid-svg-YpNV4KuELmgWrdHV .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-YpNV4KuELmgWrdHV .icon-shape rect,#mermaid-svg-YpNV4KuELmgWrdHV .image-shape rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-YpNV4KuELmgWrdHV .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-YpNV4KuELmgWrdHV .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-YpNV4KuELmgWrdHV :root{&#8211;mermaid-font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;}<\/p>\n<p>         <span class=\"edgeLabel\"><\/span><\/p>\n<p>         <span class=\"edgeLabel\"><\/span><\/p>\n<p>         <span class=\"edgeLabel\"><\/span><\/p>\n<p>         <span class=\"edgeLabel\"><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>Input .o Sections<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>Linker Script Mapping<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>Output Sections<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>Program Headers<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>Runtime Segments<\/p>\n<p><\/span><\/p>\n<p>\u94fe\u63a5\u811a\u672c\u901a\u8fc7 SECTIONS\u3001MEMORY\u3001AT() \u7b49\u8bed\u53e5\u7cbe\u786e\u63a7\u5236\u4e0a\u8ff0\u6620\u5c04&#xff0c;\u4f7f\u5f00\u53d1\u8005\u80fd\u591f\u5b9a\u4e49\u4ee3\u7801\u4e0e\u6570\u636e\u7684\u6392\u5217\u987a\u5e8f\u3001\u5730\u5740\u5206\u5e03\u53ca\u52a0\u8f7d\u7b56\u7565\u3002\u8fd9\u79cd\u673a\u5236\u5728\u64cd\u4f5c\u7cfb\u7edf\u5185\u6838\u3001Bootloader \u4ee5\u53ca\u591a\u5b58\u50a8\u4ecb\u8d28\u5d4c\u5165\u5f0f\u7cfb\u7edf\u4e2d\u5c24\u4e3a\u5173\u952e\u3002<\/p>\n<h5>2. LinkerScripts\u7b80\u5355\u793a\u4f8b<\/h5>\n<p>\u94fe\u63a5\u5668\u811a\u672c\u672c\u8d28\u662f\u9762\u5411 ld \u7684\u9886\u57df\u4e13\u7528\u8bed\u8a00&#xff0c;\u5176\u8bed\u6cd5\u7ed3\u6784\u8f83\u4e3a\u7b80\u6d01&#xff0c;\u4f46\u8868\u8fbe\u80fd\u529b\u6781\u5f3a\u3002\u6bcf\u6761\u8bed\u53e5\u8981\u4e48\u662f\u63a7\u5236\u7c7b\u5173\u952e\u5b57&#xff08;\u5982 SECTIONS\u3001MEMORY\u3001ENTRY&#xff09;&#xff0c;\u8981\u4e48\u662f\u7b26\u53f7\u8d4b\u503c\u8868\u8fbe\u5f0f&#xff0c;\u4f8b\u5982\u5bf9\u4f4d\u7f6e\u8ba1\u6570\u5668 . \u8fdb\u884c\u4fee\u6539\u3002\u8bed\u53e5\u4e4b\u95f4\u4ee5\u5206\u53f7\u5206\u9694&#xff0c;\u7a7a\u767d\u5b57\u7b26\u4ec5\u8d77\u5230\u5206\u9694\u4f5c\u7528\u3002\u5b57\u7b26\u4e32\u901a\u5e38\u53ef\u76f4\u63a5\u4e66\u5199&#xff0c;\u82e5\u6587\u4ef6\u540d\u5305\u542b\u9017\u53f7\u7b49\u7279\u6b8a\u5b57\u7b26&#xff0c;\u5219\u9700\u4f7f\u7528\u53cc\u5f15\u53f7\u5305\u88f9&#xff0c;\u8bed\u6cd5\u89c4\u5219\u4e0e C \u7c7b\u4f3c\u3002<\/p>\n<p>\u811a\u672c\u652f\u6301 C \u98ce\u683c\u6ce8\u91ca \/* &#8230; *\/&#xff0c;\u5728\u8bed\u6cd5\u4e0a\u7b49\u540c\u4e8e\u7a7a\u683c&#xff0c;\u56e0\u6b64\u53ef\u4ee5\u5b89\u5168\u63d2\u5165\u5230\u4efb\u610f\u8bed\u53e5\u4e4b\u95f4\u3002\u8fd9\u79cd\u8bbe\u8ba1\u4f7f\u811a\u672c\u65e2\u4fdd\u6301\u53ef\u8bfb\u6027&#xff0c;\u53c8\u4fbf\u4e8e\u7248\u672c\u63a7\u5236\u5ba1\u67e5\u3002\u5728\u5927\u578b\u5d4c\u5165\u5f0f\u5de5\u7a0b\u4e2d&#xff0c;\u5e38\u901a\u8fc7\u6ce8\u91ca\u8bf4\u660e\u5185\u5b58\u5e03\u5c40\u4e0e\u786c\u4ef6\u5730\u5740\u7a7a\u95f4\u7684\u6620\u5c04\u5173\u7cfb&#xff0c;\u4ece\u800c\u907f\u514d\u9b54\u6570\u96be\u4ee5\u7406\u89e3\u7684\u95ee\u9898\u3002<\/p>\n<p>\u6838\u5fc3\u7ed3\u6784\u901a\u5e38\u56f4\u7ed5 SECTIONS \u5c55\u5f00&#xff0c;\u7528\u4e8e\u5b9a\u4e49\u8f93\u51fa\u8282\u7684\u6392\u5217\u4e0e\u5730\u5740\u3002\u4f4d\u7f6e\u8ba1\u6570\u5668 . \u8868\u793a\u5f53\u524d\u8f93\u51fa\u5730\u5740&#xff0c;\u4fee\u6539\u5b83\u76f8\u5f53\u4e8e\u663e\u5f0f\u8df3\u8f6c\u5e03\u5c40\u4f4d\u7f6e\u3002\u4f8b\u5982&#xff1a;<\/p>\n<p>SECTIONS<br \/>\n{<br \/>\n  . &#061; 0x10000;<br \/>\n  .text : { *(.text) }<\/p>\n<p>  . &#061; 0x8000000;<br \/>\n  .data : { *(.data) }<br \/>\n  .bss  : { *(.bss) }<br \/>\n}<\/p>\n<p>\u4e0a\u8ff0\u811a\u672c\u9996\u5148\u5c06 .text \u653e\u7f6e\u5728 0x10000&#xff0c;\u968f\u540e\u5c06\u4f4d\u7f6e\u8ba1\u6570\u5668\u8df3\u8f6c\u81f3 0x8000000&#xff0c;\u518d\u4f9d\u6b21\u5e03\u7f6e .data \u4e0e .bss\u3002*(.text) \u8868\u793a\u6536\u96c6\u6240\u6709\u8f93\u5165\u6587\u4ef6\u4e2d\u7684 .text \u6bb5\u5e76\u5408\u5e76\u5230\u5f53\u524d\u8f93\u51fa\u6bb5\u3002\u94fe\u63a5\u5668\u5728\u6b64\u9636\u6bb5\u5b8c\u6210\u7b26\u53f7\u91cd\u5b9a\u4f4d\u4e0e\u5730\u5740\u5206\u914d\u3002<\/p>\n<p>\u4ece\u6267\u884c\u6d41\u7a0b\u770b&#xff0c;\u94fe\u63a5\u5668\u8bfb\u53d6\u811a\u672c\u540e\u5efa\u7acb\u5185\u90e8\u5730\u5740\u7a7a\u95f4\u6a21\u578b&#xff0c;\u518d\u6309\u811a\u672c\u987a\u5e8f\u5408\u5e76\u8f93\u5165\u8282\u5e76\u66f4\u65b0\u4f4d\u7f6e\u8ba1\u6570\u5668&#xff1a;<\/p>\n<p>  #mermaid-svg-uaJF3C9yk4BOx2bv{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-uaJF3C9yk4BOx2bv .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-uaJF3C9yk4BOx2bv .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-uaJF3C9yk4BOx2bv .error-icon{fill:#552222;}#mermaid-svg-uaJF3C9yk4BOx2bv .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-uaJF3C9yk4BOx2bv .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-uaJF3C9yk4BOx2bv .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-uaJF3C9yk4BOx2bv .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-uaJF3C9yk4BOx2bv .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-uaJF3C9yk4BOx2bv .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-uaJF3C9yk4BOx2bv .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-uaJF3C9yk4BOx2bv .marker{fill:#333333;stroke:#333333;}#mermaid-svg-uaJF3C9yk4BOx2bv .marker.cross{stroke:#333333;}#mermaid-svg-uaJF3C9yk4BOx2bv svg{font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-uaJF3C9yk4BOx2bv p{margin:0;}#mermaid-svg-uaJF3C9yk4BOx2bv .label{font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;color:#333;}#mermaid-svg-uaJF3C9yk4BOx2bv .cluster-label text{fill:#333;}#mermaid-svg-uaJF3C9yk4BOx2bv .cluster-label span{color:#333;}#mermaid-svg-uaJF3C9yk4BOx2bv .cluster-label span p{background-color:transparent;}#mermaid-svg-uaJF3C9yk4BOx2bv .label text,#mermaid-svg-uaJF3C9yk4BOx2bv span{fill:#333;color:#333;}#mermaid-svg-uaJF3C9yk4BOx2bv .node rect,#mermaid-svg-uaJF3C9yk4BOx2bv .node circle,#mermaid-svg-uaJF3C9yk4BOx2bv .node ellipse,#mermaid-svg-uaJF3C9yk4BOx2bv .node polygon,#mermaid-svg-uaJF3C9yk4BOx2bv .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-uaJF3C9yk4BOx2bv .rough-node .label text,#mermaid-svg-uaJF3C9yk4BOx2bv .node .label text,#mermaid-svg-uaJF3C9yk4BOx2bv .image-shape .label,#mermaid-svg-uaJF3C9yk4BOx2bv .icon-shape .label{text-anchor:middle;}#mermaid-svg-uaJF3C9yk4BOx2bv .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-uaJF3C9yk4BOx2bv .rough-node .label,#mermaid-svg-uaJF3C9yk4BOx2bv .node .label,#mermaid-svg-uaJF3C9yk4BOx2bv .image-shape .label,#mermaid-svg-uaJF3C9yk4BOx2bv .icon-shape .label{text-align:center;}#mermaid-svg-uaJF3C9yk4BOx2bv .node.clickable{cursor:pointer;}#mermaid-svg-uaJF3C9yk4BOx2bv .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-uaJF3C9yk4BOx2bv .arrowheadPath{fill:#333333;}#mermaid-svg-uaJF3C9yk4BOx2bv .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-uaJF3C9yk4BOx2bv .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-uaJF3C9yk4BOx2bv .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-uaJF3C9yk4BOx2bv .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-uaJF3C9yk4BOx2bv .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-uaJF3C9yk4BOx2bv .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-uaJF3C9yk4BOx2bv .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-uaJF3C9yk4BOx2bv .cluster text{fill:#333;}#mermaid-svg-uaJF3C9yk4BOx2bv .cluster span{color:#333;}#mermaid-svg-uaJF3C9yk4BOx2bv 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-uaJF3C9yk4BOx2bv .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-uaJF3C9yk4BOx2bv rect.text{fill:none;stroke-width:0;}#mermaid-svg-uaJF3C9yk4BOx2bv .icon-shape,#mermaid-svg-uaJF3C9yk4BOx2bv .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-uaJF3C9yk4BOx2bv .icon-shape p,#mermaid-svg-uaJF3C9yk4BOx2bv .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-uaJF3C9yk4BOx2bv .icon-shape rect,#mermaid-svg-uaJF3C9yk4BOx2bv .image-shape rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-uaJF3C9yk4BOx2bv .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-uaJF3C9yk4BOx2bv .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-uaJF3C9yk4BOx2bv :root{&#8211;mermaid-font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;}<\/p>\n<p>         <span class=\"edgeLabel\"><\/span><\/p>\n<p>         <span class=\"edgeLabel\"><\/span><\/p>\n<p>         <span class=\"edgeLabel\"><\/span><\/p>\n<p>         <span class=\"edgeLabel\"><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>Parse Script<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>Initialize Location Counter<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>Map Input Sections<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>Assign VMA\/LMA<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>Emit ELF Output<\/p>\n<p><\/span><\/p>\n<p>\u8fd9\u79cd\u673a\u5236\u4f7f\u5f00\u53d1\u8005\u80fd\u591f\u7cbe\u786e\u63a7\u5236\u955c\u50cf\u5e03\u5c40&#xff0c;\u4f8b\u5982\u5c06\u4ee3\u7801\u4e0e\u6570\u636e\u653e\u5165\u4e0d\u540c\u7269\u7406\u533a\u57df&#xff0c;\u6216\u5728\u88f8\u673a\u73af\u5883\u4e0b\u6784\u5efa\u56fa\u5b9a\u5730\u5740\u7684\u542f\u52a8\u6620\u50cf\u3002<\/p>\n<h5>3. \u57fa\u7840\u547d\u4ee4<\/h5>\n<p>\u94fe\u63a5\u811a\u672c\u9664 SECTIONS \u5916&#xff0c;\u8fd8\u63d0\u4f9b\u82e5\u5e72\u57fa\u7840\u547d\u4ee4&#xff0c;\u7528\u4e8e\u63a7\u5236\u5165\u53e3\u7b26\u53f7\u3001\u8f93\u5165\u6587\u4ef6\u3001\u76ee\u6807\u683c\u5f0f\u4ee5\u53ca\u5185\u5b58\u6a21\u578b\u3002\u8fd9\u4e9b\u547d\u4ee4\u901a\u5e38\u4f4d\u4e8e\u811a\u672c\u9876\u5c42&#xff0c;\u4e0e\u6bb5\u5e03\u5c40\u5171\u540c\u6784\u6210\u5b8c\u6574\u7684\u94fe\u63a5\u63cf\u8ff0\u3002\u5408\u7406\u4f7f\u7528\u5b83\u4eec&#xff0c;\u53ef\u4ee5\u66ff\u4ee3\u5927\u91cf\u547d\u4ee4\u884c\u9009\u9879&#xff0c;\u4f7f\u6784\u5efa\u8fc7\u7a0b\u5177\u5907\u53ef\u91cd\u590d\u6027\u4e0e\u53ef\u79fb\u690d\u6027\u3002<\/p>\n<p>\u8bbe\u7f6e\u7a0b\u5e8f\u5165\u53e3\u70b9\u901a\u5e38\u4f7f\u7528 ENTRY(symbol)\u3002\u8be5\u547d\u4ee4\u6307\u5b9a ELF \u5934\u4e2d\u7684 e_entry \u5b57\u6bb5&#xff0c;\u51b3\u5b9a\u88c5\u8f7d\u540e CPU \u8df3\u8f6c\u7684\u9996\u5730\u5740\u3002\u82e5\u672a\u663e\u5f0f\u6307\u5b9a&#xff0c;\u94fe\u63a5\u5668\u4f1a\u6309\u9ed8\u8ba4\u89c4\u5219\u67e5\u627e _start\u3002\u4f8b\u5982&#xff1a;<\/p>\n<p>ENTRY(_start)<\/p>\n<p>\u5728\u88f8\u673a\u6216\u81ea\u5b9a\u4e49\u542f\u52a8\u6d41\u7a0b\u4e2d&#xff0c;\u5165\u53e3\u7b26\u53f7\u53ef\u80fd\u6765\u81ea\u542f\u52a8\u6c47\u7f16\u6587\u4ef6&#xff0c;\u5fc5\u987b\u786e\u4fdd\u8be5\u7b26\u53f7\u5728\u6700\u7ec8\u7b26\u53f7\u8868\u4e2d\u53ef\u89c1&#xff0c;\u5426\u5219\u4f1a\u4ea7\u751f\u672a\u5b9a\u4e49\u5f15\u7528\u3002<\/p>\n<p>\u5904\u7406\u8f93\u5165\u6587\u4ef6\u53ef\u901a\u8fc7 INPUT()\u3001GROUP()\u3001SEARCH_DIR() \u7b49\u547d\u4ee4\u5b8c\u6210\u3002INPUT() \u7b49\u4ef7\u4e8e\u5728\u547d\u4ee4\u884c\u6307\u5b9a\u76ee\u6807\u6587\u4ef6&#xff1b;GROUP() \u7528\u4e8e\u89e3\u51b3\u9759\u6001\u5e93\u7684\u5faa\u73af\u4f9d\u8d56&#xff0c;\u94fe\u63a5\u5668\u4f1a\u5728\u7ec4\u5185\u591a\u8f6e\u89e3\u6790&#xff1b;SEARCH_DIR() \u5219\u6269\u5c55\u5e93\u641c\u7d22\u8def\u5f84\u3002\u4f8b\u5982&#xff1a;<\/p>\n<p>SEARCH_DIR(&#034;\/opt\/lib&#034;);<br \/>\nGROUP(libc.a libm.a)<\/p>\n<p>\u8fd9\u4e9b\u547d\u4ee4\u672c\u8d28\u4e0a\u5f71\u54cd\u7b26\u53f7\u89e3\u6790\u987a\u5e8f\u4e0e\u5e93\u7684\u91cd\u5b9a\u4f4d\u51b3\u7b56\u3002<\/p>\n<p>\u5904\u7406\u76ee\u6807\u6587\u4ef6\u683c\u5f0f\u4e3b\u8981\u4f9d\u8d56 OUTPUT_FORMAT() \u4e0e OUTPUT_ARCH()\u3002\u524d\u8005\u6307\u5b9a\u751f\u6210\u6587\u4ef6\u7684\u683c\u5f0f&#xff08;\u5982 elf64-x86-64&#xff09;&#xff0c;\u540e\u8005\u6307\u5b9a\u4f53\u7cfb\u7ed3\u6784&#xff0c;\u4ece\u800c\u7ea6\u675f\u91cd\u5b9a\u4f4d\u7c7b\u578b\u4e0e\u6307\u4ee4\u96c6\u3002\u4f8b\u5982&#xff1a;<\/p>\n<p>OUTPUT_FORMAT(&#034;elf32-littlearm&#034;)<br \/>\nOUTPUT_ARCH(arm)<\/p>\n<p>\u8fd9\u5728\u4ea4\u53c9\u7f16\u8bd1\u6216\u751f\u6210\u7279\u5b9a ABI \u6620\u50cf\u65f6\u5c24\u4e3a\u5173\u952e\u3002<\/p>\n<p>\u4e3a\u5185\u5b58\u533a\u57df\u5206\u914d\u522b\u540d\u901a\u5e38\u7ed3\u5408 MEMORY \u4e0e REGION_ALIAS() \u4f7f\u7528\u3002MEMORY \u5b9a\u4e49\u7269\u7406\u5b58\u50a8\u533a\u5c5e\u6027&#xff0c;REGION_ALIAS() \u4e3a\u4e0d\u540c\u903b\u8f91\u6bb5\u63d0\u4f9b\u7edf\u4e00\u5f15\u7528\u540d&#xff0c;\u4fbf\u4e8e\u591a\u5e73\u53f0\u590d\u7528\u811a\u672c&#xff1a;<\/p>\n<p>MEMORY {<br \/>\n  FLASH (rx) : ORIGIN &#061; 0x08000000, LENGTH &#061; 512K<br \/>\n  RAM   (rwx): ORIGIN &#061; 0x20000000, LENGTH &#061; 128K<br \/>\n}<br \/>\nREGION_ALIAS(&#034;REGION_TEXT&#034;, FLASH)<\/p>\n<p>\u5176\u4ed6\u5e38\u89c1\u547d\u4ee4\u8fd8\u5305\u62ec INCLUDE() \u7528\u4e8e\u62c6\u5206\u811a\u672c\u6a21\u5757\u3001EXTERN() \u5f3a\u5236\u4fdd\u7559\u7b26\u53f7\u3001PROVIDE() \u5b9a\u4e49\u5f31\u7b26\u53f7\u9ed8\u8ba4\u503c\u7b49\u3002\u8fd9\u4e9b\u673a\u5236\u4f7f\u94fe\u63a5\u811a\u672c\u4e0d\u4ec5\u63cf\u8ff0\u5e03\u5c40&#xff0c;\u8fd8\u80fd\u53c2\u4e0e\u7b26\u53f7\u51b3\u7b56\u4e0e\u6784\u5efa\u7b56\u7565\u63a7\u5236\u3002<\/p>\n<h5>4. \u7b26\u53f7\u8d4b\u503c<\/h5>\n<p>\u94fe\u63a5\u811a\u672c\u4e2d\u7684\u7b26\u53f7\u8d4b\u503c\u672c\u8d28\u662f\u5bf9\u5730\u5740\u8868\u8fbe\u5f0f\u6c42\u503c&#xff0c;\u5e76\u5c06\u7ed3\u679c\u5199\u5165\u7b26\u53f7\u8868\u3002\u8bed\u6cd5\u4e0a\u652f\u6301\u4e0e C \u4e00\u81f4\u7684\u8d4b\u503c\u4e0e\u590d\u5408\u8d4b\u503c\u8fd0\u7b97\u7b26&#xff0c;\u4f8b\u5982 &#061;, &#043;&#061;, &amp;&#061; \u7b49&#xff0c;\u4f46\u5176\u8bed\u4e49\u59cb\u7ec8\u56f4\u7ed5\u5730\u5740\u8ba1\u7b97\u5c55\u5f00\u3002\u6700\u5e38\u89c1\u7684\u64cd\u4f5c\u5bf9\u8c61\u662f\u4f4d\u7f6e\u8ba1\u6570\u5668 .&#xff0c;\u5b83\u8868\u793a\u5f53\u524d\u8f93\u51fa\u8282\u7684 VMA&#xff0c;\u56e0\u6b64\u5e38\u7528\u4e8e\u8bb0\u5f55\u6bb5\u7ed3\u675f\u5730\u5740\u6216\u8fdb\u884c\u5bf9\u9f50\u63a7\u5236\u3002<\/p>\n<p>\u4f8b\u5982\u5728\u6bb5\u5185\u90e8\u5b9a\u4e49 _etext &#061; .;&#xff0c;\u8868\u793a\u5c06 .text \u7ed3\u675f\u65f6\u7684\u5730\u5740\u5199\u5165\u7b26\u53f7 _etext\u3002\u800c _bdata &#061; (. &#043; 3) &amp; ~3; \u5219\u901a\u8fc7\u4f4d\u8fd0\u7b97\u5b9e\u73b0 4 \u5b57\u8282\u5bf9\u9f50\u3002\u8fd9\u7c7b\u8868\u8fbe\u5f0f\u5728\u88f8\u673a\u7cfb\u7edf\u4e2d\u7528\u4e8e\u6784\u9020\u6570\u636e\u590d\u5236\u8fb9\u754c\u6216\u5806\u6808\u8d77\u59cb\u5730\u5740&#xff1a;<\/p>\n<p>.text : {<br \/>\n  *(.text)<br \/>\n  _etext &#061; .;<br \/>\n}<br \/>\n_bdata &#061; ALIGN(4);<br \/>\n.data : { *(.data) }<\/p>\n<p>\u5bf9\u4e8e ELF \u76ee\u6807&#xff0c;\u82e5\u5e0c\u671b\u7b26\u53f7\u4ec5\u5728\u672c\u76ee\u6807\u6587\u4ef6\u5185\u90e8\u53ef\u89c1\u4e14\u4e0d\u5bfc\u51fa\u5230\u52a8\u6001\u7b26\u53f7\u8868&#xff0c;\u53ef\u4f7f\u7528 HIDDEN(symbol &#061; expression)\u3002\u8be5\u8bed\u6cd5\u4f1a\u5c06\u7b26\u53f7\u6807\u8bb0\u4e3a STV_HIDDEN&#xff0c;\u4ece\u800c\u907f\u514d\u4e0e\u5171\u4eab\u5e93\u4ea7\u751f\u7b26\u53f7\u51b2\u7a81\u3002\u8fd9\u5728\u6784\u5efa\u8fd0\u884c\u65f6\u8f85\u52a9\u8fb9\u754c\u7b26\u53f7\u65f6\u5c24\u4e3a\u91cd\u8981\u3002<\/p>\n<p>\u5728\u67d0\u4e9b\u573a\u666f\u4e0b&#xff0c;\u4ec5\u5f53\u7b26\u53f7\u672a\u88ab\u5176\u4ed6\u76ee\u6807\u6587\u4ef6\u5b9a\u4e49\u65f6\u624d\u5e0c\u671b\u63d0\u4f9b\u9ed8\u8ba4\u503c&#xff0c;\u53ef\u4ee5\u4f7f\u7528 PROVIDE(symbol &#061; expression)\u3002\u94fe\u63a5\u5668\u53ea\u6709\u5728\u7b26\u53f7\u672a\u89e3\u6790\u65f6\u624d\u4f1a\u521b\u5efa\u8be5\u5b9a\u4e49&#xff0c;\u907f\u514d\u8986\u76d6\u7528\u6237\u5b9e\u73b0\u3002\u4f8b\u5982\u4e3a\u5e94\u7528\u7a0b\u5e8f\u63d0\u4f9b\u5f31\u9ed8\u8ba4\u6808\u9876&#xff1a;<\/p>\n<p>PROVIDE(_stack_top &#061; ORIGIN(RAM) &#043; LENGTH(RAM));<\/p>\n<p>\u9700\u8981\u6ce8\u610f&#xff0c;\u94fe\u63a5\u811a\u672c\u4e2d\u5b9a\u4e49\u7684\u201c\u7b26\u53f7\u201d\u5e76\u975e\u9ad8\u7ea7\u8bed\u8a00\u53d8\u91cf&#xff0c;\u800c\u662f\u4e00\u4e2a\u5730\u5740\u6807\u7b7e&#xff0c;\u6ca1\u6709\u5b58\u50a8\u5355\u5143\u3002\u6e90\u4ee3\u7801\u4e2d\u901a\u5e38\u901a\u8fc7\u58f0\u660e\u4e3a\u5916\u90e8\u6570\u7ec4\u6216\u6307\u9488\u7684\u65b9\u5f0f\u8bbf\u95ee\u5176\u5730\u5740&#xff1a;<\/p>\n<p><span class=\"token keyword\">extern<\/span> <span class=\"token keyword\">char<\/span> _etext<span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">extern<\/span> <span class=\"token keyword\">char<\/span> _bdata<span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p><span class=\"token class-name\">size_t<\/span> text_size <span class=\"token operator\">&#061;<\/span> _bdata <span class=\"token operator\">&#8211;<\/span> _etext<span class=\"token punctuation\">;<\/span><\/p>\n<p>\u8fd9\u91cc\u8bbf\u95ee\u7684\u662f\u7b26\u53f7\u5730\u5740\u672c\u8eab&#xff0c;\u800c\u4e0d\u662f\u7b26\u53f7\u201c\u6240\u5b58\u50a8\u7684\u503c\u201d\u3002\u7406\u89e3\u8fd9\u4e00\u70b9\u5bf9\u4e8e\u6b63\u786e\u5904\u7406\u542f\u52a8\u4ee3\u7801\u548c\u6bb5\u590d\u5236\u903b\u8f91\u81f3\u5173\u91cd\u8981\u3002<\/p>\n<h5>5. SECTIONS\u547d\u4ee4<\/h5>\n<p>SECTIONS \u662f\u94fe\u63a5\u811a\u672c\u7684\u6838\u5fc3\u7ed3\u6784&#xff0c;\u5b83\u5b9a\u4e49\u4e86\u4ece\u8f93\u5165\u8282\u5230\u8f93\u51fa\u8282\u7684\u6620\u5c04\u89c4\u5219&#xff0c;\u4ee5\u53ca\u8f93\u51fa\u8282\u5728\u865a\u62df\u5730\u5740\u7a7a\u95f4\u4e2d\u7684\u6392\u5217\u65b9\u5f0f\u3002\u94fe\u63a5\u5668\u5728\u89e3\u6790\u5b8c\u6240\u6709\u8f93\u5165\u6587\u4ef6\u540e&#xff0c;\u4f1a\u6309\u811a\u672c\u4e2d SECTIONS \u7684\u63cf\u8ff0\u6784\u5efa\u65b0\u7684\u8282\u8868\u4e0e\u7a0b\u5e8f\u5934&#xff0c;\u4ece\u800c\u51b3\u5b9a\u6700\u7ec8 ELF \u7684 VMA\u3001LMA \u4e0e\u6bb5\u6743\u9650\u5c5e\u6027\u3002<\/p>\n<p>\u5176\u57fa\u672c\u8bed\u6cd5\u662f\u4e00\u4e2a\u547d\u4ee4\u5757&#xff0c;\u5176\u4e2d\u6bcf\u6761 sections-command \u90fd\u53c2\u4e0e\u8f93\u51fa\u5e03\u5c40\u63a7\u5236\u3002\u5e38\u89c1\u5f62\u5f0f\u5305\u62ec\u7b26\u53f7\u8d4b\u503c\u3001ENTRY \u6307\u5b9a\u5165\u53e3\u3001\u8f93\u51fa\u8282\u63cf\u8ff0\u4ee5\u53ca\u8986\u76d6&#xff08;OVERLAY&#xff09;\u5b9a\u4e49\u3002\u7531\u4e8e\u4f4d\u7f6e\u8ba1\u6570\u5668 . \u5728\u8be5\u4f5c\u7528\u57df\u5185\u53ef\u76f4\u63a5\u4f7f\u7528&#xff0c;\u5c06\u7b26\u53f7\u5b9a\u4e49\u4e0e\u8282\u63cf\u8ff0\u653e\u5728\u540c\u4e00\u533a\u57df&#xff0c;\u6709\u52a9\u4e8e\u5728\u903b\u8f91\u4e0a\u8d34\u8fd1\u5b9e\u9645\u5e03\u5c40&#xff0c;\u589e\u5f3a\u811a\u672c\u53ef\u8bfb\u6027\u4e0e\u53ef\u7ef4\u62a4\u6027\u3002<\/p>\n<p>\u5178\u578b\u7684\u8f93\u51fa\u8282\u63cf\u8ff0\u5f62\u5f0f\u5982\u4e0b&#xff1a;<\/p>\n<p>SECTIONS<br \/>\n{<br \/>\n  . &#061; 0x10000;<br \/>\n  .text : {<br \/>\n    *(.text)<br \/>\n    _etext &#061; .;<br \/>\n  }<\/p>\n<p>  .data : {<br \/>\n    _sdata &#061; .;<br \/>\n    *(.data)<br \/>\n    _edata &#061; .;<br \/>\n  }<br \/>\n}<\/p>\n<p>\u6b64\u7ed3\u6784\u4f53\u73b0\u4e86\u4e24\u4e2a\u5173\u952e\u673a\u5236&#xff1a;\u5176\u4e00&#xff0c;\u8f93\u5165\u8282\u901a\u8fc7\u901a\u914d\u7b26\u6a21\u5f0f\u805a\u5408\u5230\u6307\u5b9a\u8f93\u51fa\u8282&#xff1b;\u5176\u4e8c&#xff0c;\u4f4d\u7f6e\u8ba1\u6570\u5668\u5728\u6bcf\u6b21\u653e\u7f6e\u5185\u5bb9\u540e\u9012\u589e&#xff0c;\u4ece\u800c\u9a71\u52a8\u540e\u7eed\u5730\u5740\u5206\u914d\u3002\u7b26\u53f7\u8d4b\u503c\u4e0e\u8282\u5e03\u5c40\u5929\u7136\u8026\u5408\u3002<\/p>\n<p>\u82e5\u811a\u672c\u4e2d\u5b8c\u5168\u7701\u7565 SECTIONS&#xff0c;\u94fe\u63a5\u5668\u4f1a\u91c7\u7528\u9ed8\u8ba4\u7b56\u7565&#xff1a;\u6309\u8f93\u5165\u6587\u4ef6\u4e2d\u8282\u9996\u6b21\u51fa\u73b0\u7684\u987a\u5e8f\u751f\u6210\u540c\u540d\u8f93\u51fa\u8282&#xff0c;\u5e76\u4ece\u5730\u5740\u96f6\u5f00\u59cb\u987a\u5e8f\u6392\u5e03\u3002\u8fd9\u79cd\u884c\u4e3a\u9002\u7528\u4e8e\u5bbf\u4e3b\u7cfb\u7edf\u7684\u5e38\u89c4\u53ef\u6267\u884c\u7a0b\u5e8f&#xff0c;\u4f46\u5728\u88f8\u673a\u6216\u591a\u5b58\u50a8\u533a\u57df\u7cfb\u7edf\u4e2d\u5f80\u5f80\u4e0d\u6ee1\u8db3\u9700\u6c42&#xff0c;\u56e0\u6b64\u663e\u5f0f\u5b9a\u4e49 SECTIONS \u6210\u4e3a\u7cbe\u786e\u63a7\u5236\u5185\u5b58\u6620\u50cf\u7684\u5fc5\u8981\u624b\u6bb5\u3002<\/p>\n<p>\u4ece\u5185\u90e8\u6d41\u7a0b\u770b&#xff0c;\u94fe\u63a5\u5668\u4f1a\u4f9d\u6b21\u6267\u884c\u5982\u4e0b\u6b65\u9aa4&#xff1a;<\/p>\n<p>  #mermaid-svg-VKOXJsbJL82pjNR4{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-VKOXJsbJL82pjNR4 .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-VKOXJsbJL82pjNR4 .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-VKOXJsbJL82pjNR4 .error-icon{fill:#552222;}#mermaid-svg-VKOXJsbJL82pjNR4 .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-VKOXJsbJL82pjNR4 .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-VKOXJsbJL82pjNR4 .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-VKOXJsbJL82pjNR4 .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-VKOXJsbJL82pjNR4 .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-VKOXJsbJL82pjNR4 .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-VKOXJsbJL82pjNR4 .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-VKOXJsbJL82pjNR4 .marker{fill:#333333;stroke:#333333;}#mermaid-svg-VKOXJsbJL82pjNR4 .marker.cross{stroke:#333333;}#mermaid-svg-VKOXJsbJL82pjNR4 svg{font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-VKOXJsbJL82pjNR4 p{margin:0;}#mermaid-svg-VKOXJsbJL82pjNR4 .label{font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;color:#333;}#mermaid-svg-VKOXJsbJL82pjNR4 .cluster-label text{fill:#333;}#mermaid-svg-VKOXJsbJL82pjNR4 .cluster-label span{color:#333;}#mermaid-svg-VKOXJsbJL82pjNR4 .cluster-label span p{background-color:transparent;}#mermaid-svg-VKOXJsbJL82pjNR4 .label text,#mermaid-svg-VKOXJsbJL82pjNR4 span{fill:#333;color:#333;}#mermaid-svg-VKOXJsbJL82pjNR4 .node rect,#mermaid-svg-VKOXJsbJL82pjNR4 .node circle,#mermaid-svg-VKOXJsbJL82pjNR4 .node ellipse,#mermaid-svg-VKOXJsbJL82pjNR4 .node polygon,#mermaid-svg-VKOXJsbJL82pjNR4 .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-VKOXJsbJL82pjNR4 .rough-node .label text,#mermaid-svg-VKOXJsbJL82pjNR4 .node .label text,#mermaid-svg-VKOXJsbJL82pjNR4 .image-shape .label,#mermaid-svg-VKOXJsbJL82pjNR4 .icon-shape .label{text-anchor:middle;}#mermaid-svg-VKOXJsbJL82pjNR4 .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-VKOXJsbJL82pjNR4 .rough-node .label,#mermaid-svg-VKOXJsbJL82pjNR4 .node .label,#mermaid-svg-VKOXJsbJL82pjNR4 .image-shape .label,#mermaid-svg-VKOXJsbJL82pjNR4 .icon-shape .label{text-align:center;}#mermaid-svg-VKOXJsbJL82pjNR4 .node.clickable{cursor:pointer;}#mermaid-svg-VKOXJsbJL82pjNR4 .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-VKOXJsbJL82pjNR4 .arrowheadPath{fill:#333333;}#mermaid-svg-VKOXJsbJL82pjNR4 .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-VKOXJsbJL82pjNR4 .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-VKOXJsbJL82pjNR4 .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-VKOXJsbJL82pjNR4 .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-VKOXJsbJL82pjNR4 .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-VKOXJsbJL82pjNR4 .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-VKOXJsbJL82pjNR4 .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-VKOXJsbJL82pjNR4 .cluster text{fill:#333;}#mermaid-svg-VKOXJsbJL82pjNR4 .cluster span{color:#333;}#mermaid-svg-VKOXJsbJL82pjNR4 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-VKOXJsbJL82pjNR4 .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-VKOXJsbJL82pjNR4 rect.text{fill:none;stroke-width:0;}#mermaid-svg-VKOXJsbJL82pjNR4 .icon-shape,#mermaid-svg-VKOXJsbJL82pjNR4 .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-VKOXJsbJL82pjNR4 .icon-shape p,#mermaid-svg-VKOXJsbJL82pjNR4 .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-VKOXJsbJL82pjNR4 .icon-shape rect,#mermaid-svg-VKOXJsbJL82pjNR4 .image-shape rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-VKOXJsbJL82pjNR4 .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-VKOXJsbJL82pjNR4 .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-VKOXJsbJL82pjNR4 :root{&#8211;mermaid-font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;}<\/p>\n<p>         <span class=\"edgeLabel\"><\/span><\/p>\n<p>         <span class=\"edgeLabel\"><\/span><\/p>\n<p>         <span class=\"edgeLabel\"><\/span><\/p>\n<p>         <span class=\"edgeLabel\"><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>Collect Input Sections<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>Apply SECTIONS Mapping<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>Assign Addresses via Location Counter<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>Generate Output Section Table<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>Build Program Headers<\/p>\n<p><\/span><\/p>\n<p>SECTIONS \u5b9e\u9645\u4e0a\u662f\u94fe\u63a5\u9636\u6bb5\u5730\u5740\u7a7a\u95f4\u5efa\u6a21\u7684\u63cf\u8ff0\u8bed\u8a00&#xff0c;\u5176\u8868\u8fbe\u80fd\u529b\u51b3\u5b9a\u4e86\u6700\u7ec8\u7a0b\u5e8f\u5728\u7269\u7406\u4e0e\u865a\u62df\u7a7a\u95f4\u4e2d\u7684\u7ec4\u7ec7\u5f62\u6001\u3002<\/p>\n<h5>6. MEMORY\u547d\u4ee4<\/h5>\n<p>MEMORY \u547d\u4ee4\u7528\u4e8e\u663e\u5f0f\u63cf\u8ff0\u76ee\u6807\u7cfb\u7edf\u7684\u7269\u7406\u5185\u5b58\u5e03\u5c40&#xff0c;\u662f\u5d4c\u5165\u5f0f\u4e0e\u88f8\u673a\u573a\u666f\u4e2d\u4e0d\u53ef\u6216\u7f3a\u7684\u673a\u5236\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b&#xff0c;\u94fe\u63a5\u5668\u5047\u5b9a\u5730\u5740\u7a7a\u95f4\u8fde\u7eed\u4e14\u65e0\u9650\u5236&#xff0c;\u800c MEMORY \u5219\u4e3a\u5176\u5efa\u7acb\u53ef\u7528\u533a\u57df\u6a21\u578b&#xff0c;\u4f7f\u94fe\u63a5\u9636\u6bb5\u5177\u5907\u5bb9\u91cf\u7ea6\u675f\u4e0e\u5c5e\u6027\u68c0\u67e5\u80fd\u529b\u3002\u94fe\u63a5\u5668\u4e0d\u4f1a\u81ea\u52a8\u91cd\u6392\u8282\u4ee5\u9002\u914d\u533a\u57df&#xff0c;\u800c\u662f\u5728\u8d85\u51fa\u5bb9\u91cf\u65f6\u7ed9\u51fa\u9519\u8bef\u6216\u8b66\u544a\u3002<\/p>\n<p>\u5176\u8bed\u6cd5\u4ee5\u533a\u57df\u4e3a\u5355\u4f4d\u5b9a\u4e49\u5185\u5b58\u5757&#xff0c;\u5305\u62ec\u540d\u79f0\u3001\u5c5e\u6027\u3001\u8d77\u59cb\u5730\u5740\u4e0e\u957f\u5ea6\u3002\u4f8b\u5982&#xff1a;<\/p>\n<p>MEMORY<br \/>\n{<br \/>\n  FLASH (rx)  : ORIGIN &#061; 0x08000000, LENGTH &#061; 512K<br \/>\n  RAM   (rwx) : ORIGIN &#061; 0x20000000, LENGTH &#061; 128K<br \/>\n}<\/p>\n<p>\u5176\u4e2d (rx) \u8868\u793a\u53ef\u8bfb\u53ef\u6267\u884c&#xff0c;(rwx) \u8868\u793a\u53ef\u8bfb\u5199\u53ef\u6267\u884c\u3002\u8fd9\u4e9b\u5c5e\u6027\u7528\u4e8e\u5339\u914d\u8f93\u51fa\u8282\u7684\u8bbf\u95ee\u7279\u6027&#xff0c;\u82e5\u8282\u5c5e\u6027\u4e0e\u533a\u57df\u4e0d\u517c\u5bb9&#xff0c;\u94fe\u63a5\u5668\u5c06\u62a5\u9519\u3002<\/p>\n<p>MEMORY \u672c\u8eab\u5e76\u4e0d\u5206\u914d\u8282&#xff0c;\u771f\u6b63\u7684\u6620\u5c04\u53d1\u751f\u5728 SECTIONS \u4e2d&#xff0c;\u901a\u8fc7 &gt;region \u8bed\u6cd5\u7ed1\u5b9a\u8f93\u51fa\u8282\u5230\u6307\u5b9a\u5185\u5b58\u5757\u3002\u4f8b\u5982&#xff1a;<\/p>\n<p>SECTIONS<br \/>\n{<br \/>\n  .text : { *(.text) } &gt; FLASH<br \/>\n  .data : { *(.data) } &gt; RAM AT &gt; FLASH<br \/>\n}<\/p>\n<p>\u6b64\u5904 .text \u88ab\u653e\u7f6e\u5230 FLASH&#xff0c;\u800c .data \u7684\u8fd0\u884c\u5730\u5740\u5728 RAM&#xff0c;\u52a0\u8f7d\u5730\u5740\u5728 FLASH\u3002\u94fe\u63a5\u5668\u636e\u6b64\u8ba1\u7b97 VMA\/LMA&#xff0c;\u5e76\u751f\u6210\u76f8\u5e94\u7684\u7a0b\u5e8f\u5934\u3002<\/p>\n<p>\u5185\u90e8\u6d41\u7a0b\u53ef\u7406\u89e3\u4e3a\u4e24\u9636\u6bb5\u7ea6\u675f\u7cfb\u7edf&#xff1a;\u9996\u5148\u89e3\u6790 MEMORY \u5efa\u7acb\u533a\u57df\u8868&#xff1b;\u968f\u540e\u5728\u5904\u7406 SECTIONS \u65f6&#xff0c;\u5c06\u4f4d\u7f6e\u8ba1\u6570\u5668\u9650\u5236\u5728\u6307\u5b9a\u533a\u57df\u8303\u56f4\u5185&#xff0c;\u5e76\u68c0\u67e5\u5269\u4f59\u7a7a\u95f4\u3002<\/p>\n<p>  #mermaid-svg-4NsA9BOVsUu71Lgh{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-4NsA9BOVsUu71Lgh .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-4NsA9BOVsUu71Lgh .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-4NsA9BOVsUu71Lgh .error-icon{fill:#552222;}#mermaid-svg-4NsA9BOVsUu71Lgh .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-4NsA9BOVsUu71Lgh .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-4NsA9BOVsUu71Lgh .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-4NsA9BOVsUu71Lgh .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-4NsA9BOVsUu71Lgh .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-4NsA9BOVsUu71Lgh .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-4NsA9BOVsUu71Lgh .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-4NsA9BOVsUu71Lgh .marker{fill:#333333;stroke:#333333;}#mermaid-svg-4NsA9BOVsUu71Lgh .marker.cross{stroke:#333333;}#mermaid-svg-4NsA9BOVsUu71Lgh svg{font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-4NsA9BOVsUu71Lgh p{margin:0;}#mermaid-svg-4NsA9BOVsUu71Lgh .label{font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;color:#333;}#mermaid-svg-4NsA9BOVsUu71Lgh .cluster-label text{fill:#333;}#mermaid-svg-4NsA9BOVsUu71Lgh .cluster-label span{color:#333;}#mermaid-svg-4NsA9BOVsUu71Lgh .cluster-label span p{background-color:transparent;}#mermaid-svg-4NsA9BOVsUu71Lgh .label text,#mermaid-svg-4NsA9BOVsUu71Lgh span{fill:#333;color:#333;}#mermaid-svg-4NsA9BOVsUu71Lgh .node rect,#mermaid-svg-4NsA9BOVsUu71Lgh .node circle,#mermaid-svg-4NsA9BOVsUu71Lgh .node ellipse,#mermaid-svg-4NsA9BOVsUu71Lgh .node polygon,#mermaid-svg-4NsA9BOVsUu71Lgh .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-4NsA9BOVsUu71Lgh .rough-node .label text,#mermaid-svg-4NsA9BOVsUu71Lgh .node .label text,#mermaid-svg-4NsA9BOVsUu71Lgh .image-shape .label,#mermaid-svg-4NsA9BOVsUu71Lgh .icon-shape .label{text-anchor:middle;}#mermaid-svg-4NsA9BOVsUu71Lgh .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-4NsA9BOVsUu71Lgh .rough-node .label,#mermaid-svg-4NsA9BOVsUu71Lgh .node .label,#mermaid-svg-4NsA9BOVsUu71Lgh .image-shape .label,#mermaid-svg-4NsA9BOVsUu71Lgh .icon-shape .label{text-align:center;}#mermaid-svg-4NsA9BOVsUu71Lgh .node.clickable{cursor:pointer;}#mermaid-svg-4NsA9BOVsUu71Lgh .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-4NsA9BOVsUu71Lgh .arrowheadPath{fill:#333333;}#mermaid-svg-4NsA9BOVsUu71Lgh .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-4NsA9BOVsUu71Lgh .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-4NsA9BOVsUu71Lgh .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-4NsA9BOVsUu71Lgh .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-4NsA9BOVsUu71Lgh .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-4NsA9BOVsUu71Lgh .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-4NsA9BOVsUu71Lgh .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-4NsA9BOVsUu71Lgh .cluster text{fill:#333;}#mermaid-svg-4NsA9BOVsUu71Lgh .cluster span{color:#333;}#mermaid-svg-4NsA9BOVsUu71Lgh 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-4NsA9BOVsUu71Lgh .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-4NsA9BOVsUu71Lgh rect.text{fill:none;stroke-width:0;}#mermaid-svg-4NsA9BOVsUu71Lgh .icon-shape,#mermaid-svg-4NsA9BOVsUu71Lgh .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-4NsA9BOVsUu71Lgh .icon-shape p,#mermaid-svg-4NsA9BOVsUu71Lgh .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-4NsA9BOVsUu71Lgh .icon-shape rect,#mermaid-svg-4NsA9BOVsUu71Lgh .image-shape rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-4NsA9BOVsUu71Lgh .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-4NsA9BOVsUu71Lgh .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-4NsA9BOVsUu71Lgh :root{&#8211;mermaid-font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;}<\/p>\n<p>         <span class=\"edgeLabel\"><\/span><\/p>\n<p>         <span class=\"edgeLabel\"><\/span><\/p>\n<p>         <span class=\"edgeLabel\"><\/span><\/p>\n<p>         <span class=\"edgeLabel\"><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>Parse MEMORY Regions<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>Build Region Table<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>Assign Sections via SECTIONS<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>Check Region Overflow<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>Emit ELF with VMA\/LMA<\/p>\n<p><\/span><\/p>\n<p>\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f&#xff0c;MEMORY \u63d0\u4f9b\u4e86\u9759\u6001\u8d44\u6e90\u9a8c\u8bc1\u80fd\u529b&#xff0c;\u4f7f\u94fe\u63a5\u9636\u6bb5\u5373\u53ef\u53d1\u73b0\u5185\u5b58\u6ea2\u51fa\u95ee\u9898&#xff0c;\u800c\u65e0\u9700\u4f9d\u8d56\u8fd0\u884c\u65f6\u68c0\u6d4b\u3002<\/p>\n<h5>7. PHDRS\u547d\u4ee4<\/h5>\n<p>\u5728 ELF \u4f53\u7cfb\u4e2d&#xff0c;Program Header&#xff08;\u7a0b\u5e8f\u5934&#xff09;\u63cf\u8ff0\u7684\u662f\u201c\u5982\u4f55\u88c5\u8f7d\u201d&#xff0c;\u800c\u975e\u201c\u5982\u4f55\u7ec4\u7ec7\u201d\u3002\u5b83\u4ee5 segment \u4e3a\u5355\u4f4d\u5b9a\u4e49\u52a0\u8f7d\u5730\u5740\u3001\u6587\u4ef6\u504f\u79fb\u3001\u5185\u5b58\u5927\u5c0f\u53ca\u8bbf\u95ee\u6743\u9650\u3002\u8fd0\u884c\u65f6\u52a0\u8f7d\u5668\u4f9d\u636e\u8fd9\u4e9b\u6761\u76ee\u5efa\u7acb\u5185\u5b58\u6620\u5c04&#xff0c;\u4f8b\u5982\u5c06 PT_LOAD \u7c7b\u578b\u6bb5\u6620\u5c04\u4e3a\u53ef\u6267\u884c\u6216\u53ef\u5199\u533a\u57df\u3002\u53ef\u901a\u8fc7 objdump -p a.out \u67e5\u770b\u7a0b\u5e8f\u5934\u5185\u5bb9\u3002<\/p>\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b&#xff0c;ld \u4f1a\u6839\u636e\u8f93\u51fa\u8282\u5c5e\u6027\u81ea\u52a8\u751f\u6210\u5408\u7406\u7684\u7a0b\u5e8f\u5934&#xff0c;\u4f8b\u5982\u5c06\u53ef\u6267\u884c\u8282\u5408\u5e76\u4e3a\u4e00\u4e2a PT_LOAD \u6bb5\u3001\u5c06\u53ef\u5199\u6570\u636e\u653e\u5165\u53e6\u4e00\u4e2a\u6bb5&#xff0c;\u5e76\u751f\u6210 PT_PHDR\u3001PT_INTERP \u7b49\u8f85\u52a9\u6761\u76ee\u3002\u7136\u800c\u5728\u5185\u6838\u3001Bootloader \u6216\u591a\u955c\u50cf\u7cfb\u7edf\u4e2d&#xff0c;\u5f80\u5f80\u9700\u8981\u7cbe\u786e\u63a7\u5236\u6bb5\u8fb9\u754c\u3001\u5bf9\u9f50\u65b9\u5f0f\u6216\u52a0\u8f7d\u987a\u5e8f&#xff0c;\u6b64\u65f6\u53ef\u4f7f\u7528 PHDRS \u547d\u4ee4\u663e\u5f0f\u5b9a\u4e49\u7a0b\u5e8f\u5934\u3002<\/p>\n<p>PHDRS \u5141\u8bb8\u5b9a\u4e49\u6bb5\u540d\u3001\u7c7b\u578b\u53ca\u6807\u5fd7\u4f4d&#xff0c;\u4f8b\u5982&#xff1a;<\/p>\n<p>PHDRS<br \/>\n{<br \/>\n  text PT_LOAD FLAGS(5);   \/* R &#043; X *\/<br \/>\n  data PT_LOAD FLAGS(6);   \/* R &#043; W *\/<br \/>\n}<\/p>\n<p>SECTIONS<br \/>\n{<br \/>\n  .text : { *(.text) } :text<br \/>\n  .data : { *(.data) } :data<br \/>\n}<\/p>\n<p>\u5176\u4e2d FLAGS(5) \u8868\u793a PF_R | PF_X\u3002\u8f93\u51fa\u8282\u901a\u8fc7 :phdr_name \u7ed1\u5b9a\u5230\u6307\u5b9a\u7a0b\u5e8f\u5934&#xff0c;\u4ece\u800c\u7cbe\u786e\u63a7\u5236\u8282\u5230\u6bb5\u7684\u6620\u5c04\u5173\u7cfb\u3002\u82e5\u811a\u672c\u4e2d\u51fa\u73b0 PHDRS&#xff0c;\u94fe\u63a5\u5668\u5c06\u4e0d\u518d\u81ea\u52a8\u751f\u6210\u5176\u4ed6\u7a0b\u5e8f\u5934&#xff0c;\u5fc5\u987b\u5b8c\u6574\u5b9a\u4e49\u6240\u9700\u6761\u76ee\u3002<\/p>\n<p>\u9700\u8981\u6ce8\u610f&#xff0c;PHDRS \u4ec5\u5728\u751f\u6210 ELF \u8f93\u51fa\u65f6\u751f\u6548&#xff0c;\u5bf9\u4e8e binary \u6216 srec \u7b49\u683c\u5f0f\u4f1a\u88ab\u5ffd\u7565\u3002\u5176\u5185\u90e8\u5904\u7406\u6d41\u7a0b\u5927\u81f4\u5982\u4e0b&#xff1a;<\/p>\n<p>  #mermaid-svg-0QcbHi6RXL907jmE{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-0QcbHi6RXL907jmE .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-0QcbHi6RXL907jmE .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-0QcbHi6RXL907jmE .error-icon{fill:#552222;}#mermaid-svg-0QcbHi6RXL907jmE .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-0QcbHi6RXL907jmE .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-0QcbHi6RXL907jmE .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-0QcbHi6RXL907jmE .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-0QcbHi6RXL907jmE .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-0QcbHi6RXL907jmE .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-0QcbHi6RXL907jmE .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-0QcbHi6RXL907jmE .marker{fill:#333333;stroke:#333333;}#mermaid-svg-0QcbHi6RXL907jmE .marker.cross{stroke:#333333;}#mermaid-svg-0QcbHi6RXL907jmE svg{font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-0QcbHi6RXL907jmE p{margin:0;}#mermaid-svg-0QcbHi6RXL907jmE .label{font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;color:#333;}#mermaid-svg-0QcbHi6RXL907jmE .cluster-label text{fill:#333;}#mermaid-svg-0QcbHi6RXL907jmE .cluster-label span{color:#333;}#mermaid-svg-0QcbHi6RXL907jmE .cluster-label span p{background-color:transparent;}#mermaid-svg-0QcbHi6RXL907jmE .label text,#mermaid-svg-0QcbHi6RXL907jmE span{fill:#333;color:#333;}#mermaid-svg-0QcbHi6RXL907jmE .node rect,#mermaid-svg-0QcbHi6RXL907jmE .node circle,#mermaid-svg-0QcbHi6RXL907jmE .node ellipse,#mermaid-svg-0QcbHi6RXL907jmE .node polygon,#mermaid-svg-0QcbHi6RXL907jmE .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-0QcbHi6RXL907jmE .rough-node .label text,#mermaid-svg-0QcbHi6RXL907jmE .node .label text,#mermaid-svg-0QcbHi6RXL907jmE .image-shape .label,#mermaid-svg-0QcbHi6RXL907jmE .icon-shape .label{text-anchor:middle;}#mermaid-svg-0QcbHi6RXL907jmE .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-0QcbHi6RXL907jmE .rough-node .label,#mermaid-svg-0QcbHi6RXL907jmE .node .label,#mermaid-svg-0QcbHi6RXL907jmE .image-shape .label,#mermaid-svg-0QcbHi6RXL907jmE .icon-shape .label{text-align:center;}#mermaid-svg-0QcbHi6RXL907jmE .node.clickable{cursor:pointer;}#mermaid-svg-0QcbHi6RXL907jmE .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-0QcbHi6RXL907jmE .arrowheadPath{fill:#333333;}#mermaid-svg-0QcbHi6RXL907jmE .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-0QcbHi6RXL907jmE .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-0QcbHi6RXL907jmE .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-0QcbHi6RXL907jmE .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-0QcbHi6RXL907jmE .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-0QcbHi6RXL907jmE .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-0QcbHi6RXL907jmE .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-0QcbHi6RXL907jmE .cluster text{fill:#333;}#mermaid-svg-0QcbHi6RXL907jmE .cluster span{color:#333;}#mermaid-svg-0QcbHi6RXL907jmE 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-0QcbHi6RXL907jmE .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-0QcbHi6RXL907jmE rect.text{fill:none;stroke-width:0;}#mermaid-svg-0QcbHi6RXL907jmE .icon-shape,#mermaid-svg-0QcbHi6RXL907jmE .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-0QcbHi6RXL907jmE .icon-shape p,#mermaid-svg-0QcbHi6RXL907jmE .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-0QcbHi6RXL907jmE .icon-shape rect,#mermaid-svg-0QcbHi6RXL907jmE .image-shape rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-0QcbHi6RXL907jmE .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-0QcbHi6RXL907jmE .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-0QcbHi6RXL907jmE :root{&#8211;mermaid-font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;}<\/p>\n<p>         <span class=\"edgeLabel\"><\/span><\/p>\n<p>         <span class=\"edgeLabel\"><\/span><\/p>\n<p>         <span class=\"edgeLabel\"><\/span><\/p>\n<p>         <span class=\"edgeLabel\"><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>Parse PHDRS<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>Create Program Header Table<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>Bind Output Sections<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>Compute Offsets &amp; Alignment<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>Emit ELF Headers<\/p>\n<p><\/span><\/p>\n<p>\u901a\u8fc7\u663e\u5f0f\u63a7\u5236\u7a0b\u5e8f\u5934&#xff0c;\u53ef\u4ee5\u786e\u4fdd\u52a0\u8f7d\u5668\u6309\u9884\u671f\u65b9\u5f0f\u6620\u5c04\u5185\u5b58\u533a\u57df&#xff0c;\u907f\u514d\u56e0\u9ed8\u8ba4\u6bb5\u5408\u5e76\u7b56\u7565\u5bfc\u81f4\u6743\u9650\u6216\u5730\u5740\u5e03\u5c40\u4e0d\u7b26\u5408\u7cfb\u7edf\u7ea6\u675f\u3002<\/p>\n<h5>8. \u7b26\u53f7\u7248\u672c\u547d\u4ee4<\/h5>\n<p>\u5728 ELF \u5171\u4eab\u5e93\u4e2d&#xff0c;\u7b26\u53f7\u4e0d\u4ec5\u5177\u6709\u53ef\u89c1\u6027\u5c5e\u6027&#xff08;STV_DEFAULT\u3001STV_HIDDEN&#xff09;&#xff0c;\u8fd8\u53ef\u4ee5\u7ed1\u5b9a\u5230\u7279\u5b9a\u7248\u672c\u8282\u70b9\u3002ld \u901a\u8fc7 &#8211;version-script \u8bfb\u53d6\u7248\u672c\u811a\u672c&#xff0c;\u5728\u94fe\u63a5\u9636\u6bb5\u751f\u6210 .gnu.version* \u76f8\u5173\u6bb5&#xff0c;\u4ece\u800c\u6784\u5efa\u7b26\u53f7\u7248\u672c\u6811\u3002\u8be5\u673a\u5236\u65e2\u80fd\u63a7\u5236\u5bfc\u51fa\u96c6\u5408&#xff0c;\u53c8\u80fd\u7ef4\u6301 ABI \u5411\u540e\u517c\u5bb9&#xff0c;\u662f\u5927\u578b\u57fa\u7840\u5e93\u6f14\u8fdb\u7684\u6838\u5fc3\u624b\u6bb5\u3002<\/p>\n<p>\u7248\u672c\u811a\u672c\u4ee5\u201c\u7248\u672c\u8282\u70b9\u201d\u4e3a\u57fa\u672c\u5355\u5143&#xff0c;\u8282\u70b9\u4e4b\u95f4\u5f62\u6210\u6709\u5411\u7ee7\u627f\u5173\u7cfb\u3002\u793a\u4f8b\u4e2d VERS_1.2 \u7ee7\u627f VERS_1.1&#xff0c;VERS_2.0 \u7ee7\u627f VERS_1.2&#xff0c;\u5f62\u6210\u94fe\u5f0f\u6f14\u8fdb\u7ed3\u6784\u3002\u6bcf\u4e2a\u8282\u70b9\u53ef\u5b9a\u4e49 global \u4e0e local \u7b26\u53f7\u96c6\u5408&#xff1b;\u672a\u663e\u5f0f\u58f0\u660e\u7684\u7b26\u53f7\u9ed8\u8ba4\u7ee7\u627f\u4e0a\u7ea7\u89c4\u5219\u3002local: \u5757\u4f1a\u5c06\u5339\u914d\u7b26\u53f7\u964d\u7ea7\u4e3a\u5c40\u90e8&#xff0c;\u4ece\u52a8\u6001\u7b26\u53f7\u8868\u4e2d\u79fb\u9664&#xff0c;\u4ece\u800c\u4e0d\u5bf9\u5916\u5bfc\u51fa\u3002<\/p>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p>VERS_1.1 {<br \/>\n  global: foo1;<br \/>\n  local: old*; original*; new*;<br \/>\n};<\/p>\n<p>\u8868\u793a\u4ec5 foo1 \u4ee5 VERS_1.1 \u7248\u672c\u5bf9\u5916\u53ef\u89c1&#xff0c;\u5176\u4f59\u5339\u914d\u524d\u7f00\u7684\u7b26\u53f7\u5728\u5171\u4eab\u5e93\u5916\u4e0d\u53ef\u89e3\u6790\u3002\u540e\u7eed\u8282\u70b9\u82e5\u5199\u6210&#xff1a;<\/p>\n<p>VERS_1.2 { foo2; } VERS_1.1;<\/p>\n<p>\u5219 foo2 \u7ed1\u5b9a\u5230 VERS_1.2&#xff0c;\u540c\u65f6\u7ee7\u627f VERS_1.1 \u7684\u5bfc\u51fa\u7b26\u53f7\u3002\u52a8\u6001\u94fe\u63a5\u5668\u5728\u89e3\u6790\u65f6\u4f1a\u6839\u636e\u53ef\u6267\u884c\u6587\u4ef6\u4e2d\u8bb0\u5f55\u7684\u7248\u672c\u9700\u6c42&#xff0c;\u9009\u62e9\u5339\u914d\u8282\u70b9&#xff0c;\u4ece\u800c\u4fdd\u8bc1\u65e7\u7a0b\u5e8f\u4ecd\u53ef\u7ed1\u5b9a\u65e7\u5b9e\u73b0\u3002<\/p>\n<p>\u5bf9 C&#043;&#043; \u7b26\u53f7&#xff0c;\u7248\u672c\u811a\u672c\u652f\u6301 extern &#034;C&#043;&#043;&#034; \u5757\u4e0e\u7b7e\u540d\u5b57\u7b26\u4e32\u5339\u914d&#xff0c;\u4f8b\u5982&#xff1a;<\/p>\n<p>extern &#034;C&#043;&#043;&#034; {<br \/>\n  ns::*;<br \/>\n  &#034;f(int, double)&#034;;<br \/>\n};<\/p>\n<p>\u5176\u5339\u914d\u5bf9\u8c61\u662f\u7ecf\u8fc7 demangle \u5904\u7406\u540e\u7684\u7b26\u53f7\u540d&#xff0c;\u800c\u975e\u539f\u59cb mangled name\u3002\u8fd9\u5bf9\u4e8e\u6a21\u677f\u4e0e\u547d\u540d\u7a7a\u95f4\u63a7\u5236\u5c24\u4e3a\u91cd\u8981\u3002<\/p>\n<p>\u6784\u5efa\u6d41\u7a0b\u53ef\u6982\u62ec\u4e3a&#xff1a;<\/p>\n<p>  #mermaid-svg-YkECZx20lMadCOKk{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-YkECZx20lMadCOKk .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-YkECZx20lMadCOKk .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-YkECZx20lMadCOKk .error-icon{fill:#552222;}#mermaid-svg-YkECZx20lMadCOKk .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-YkECZx20lMadCOKk .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-YkECZx20lMadCOKk .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-YkECZx20lMadCOKk .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-YkECZx20lMadCOKk .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-YkECZx20lMadCOKk .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-YkECZx20lMadCOKk .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-YkECZx20lMadCOKk .marker{fill:#333333;stroke:#333333;}#mermaid-svg-YkECZx20lMadCOKk .marker.cross{stroke:#333333;}#mermaid-svg-YkECZx20lMadCOKk svg{font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-YkECZx20lMadCOKk p{margin:0;}#mermaid-svg-YkECZx20lMadCOKk .label{font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;color:#333;}#mermaid-svg-YkECZx20lMadCOKk .cluster-label text{fill:#333;}#mermaid-svg-YkECZx20lMadCOKk .cluster-label span{color:#333;}#mermaid-svg-YkECZx20lMadCOKk .cluster-label span p{background-color:transparent;}#mermaid-svg-YkECZx20lMadCOKk .label text,#mermaid-svg-YkECZx20lMadCOKk span{fill:#333;color:#333;}#mermaid-svg-YkECZx20lMadCOKk .node rect,#mermaid-svg-YkECZx20lMadCOKk .node circle,#mermaid-svg-YkECZx20lMadCOKk .node ellipse,#mermaid-svg-YkECZx20lMadCOKk .node polygon,#mermaid-svg-YkECZx20lMadCOKk .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-YkECZx20lMadCOKk .rough-node .label text,#mermaid-svg-YkECZx20lMadCOKk .node .label text,#mermaid-svg-YkECZx20lMadCOKk .image-shape .label,#mermaid-svg-YkECZx20lMadCOKk .icon-shape .label{text-anchor:middle;}#mermaid-svg-YkECZx20lMadCOKk .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-YkECZx20lMadCOKk .rough-node .label,#mermaid-svg-YkECZx20lMadCOKk .node .label,#mermaid-svg-YkECZx20lMadCOKk .image-shape .label,#mermaid-svg-YkECZx20lMadCOKk .icon-shape .label{text-align:center;}#mermaid-svg-YkECZx20lMadCOKk .node.clickable{cursor:pointer;}#mermaid-svg-YkECZx20lMadCOKk .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-YkECZx20lMadCOKk .arrowheadPath{fill:#333333;}#mermaid-svg-YkECZx20lMadCOKk .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-YkECZx20lMadCOKk .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-YkECZx20lMadCOKk .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-YkECZx20lMadCOKk .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-YkECZx20lMadCOKk .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-YkECZx20lMadCOKk .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-YkECZx20lMadCOKk .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-YkECZx20lMadCOKk .cluster text{fill:#333;}#mermaid-svg-YkECZx20lMadCOKk .cluster span{color:#333;}#mermaid-svg-YkECZx20lMadCOKk 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-YkECZx20lMadCOKk .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-YkECZx20lMadCOKk rect.text{fill:none;stroke-width:0;}#mermaid-svg-YkECZx20lMadCOKk .icon-shape,#mermaid-svg-YkECZx20lMadCOKk .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-YkECZx20lMadCOKk .icon-shape p,#mermaid-svg-YkECZx20lMadCOKk .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-YkECZx20lMadCOKk .icon-shape rect,#mermaid-svg-YkECZx20lMadCOKk .image-shape rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-YkECZx20lMadCOKk .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-YkECZx20lMadCOKk .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-YkECZx20lMadCOKk :root{&#8211;mermaid-font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;}<\/p>\n<p>         <span class=\"edgeLabel\"><\/span><\/p>\n<p>         <span class=\"edgeLabel\"><\/span><\/p>\n<p>         <span class=\"edgeLabel\"><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>Compile Objects<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>ld &#8211;version-script<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>Generate .dynsym &amp; .gnu.version<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>Runtime Version Check by ld.so<\/p>\n<p><\/span><\/p>\n<p>\u901a\u8fc7\u7248\u672c\u811a\u672c\u96c6\u4e2d\u7ba1\u7406\u7b26\u53f7\u5bfc\u51fa&#xff0c;\u6bd4\u5728\u6e90\u7801\u4e2d\u5206\u6563\u4f7f\u7528 __attribute__((visibility)) \u66f4\u5177\u5168\u5c40\u4e00\u81f4\u6027&#xff0c;\u540c\u65f6\u63d0\u4f9b ABI \u6f14\u8fdb\u6240\u9700\u7684\u591a\u7248\u672c\u5171\u5b58\u80fd\u529b\u3002<\/p>\n<h5>9. \u94fe\u63a5\u5668\u811a\u672c\u4e2d\u7684\u8868\u8fbe\u5f0f<\/h5>\n<p>ld \u7684\u94fe\u63a5\u5668\u811a\u672c\u91c7\u7528\u4e0e C \u7c7b\u4f3c\u7684\u8868\u8fbe\u5f0f\u8bed\u6cd5&#xff0c;\u4f46\u8bed\u4e49\u66f4\u8d34\u8fd1\u5730\u5740\u8ba1\u7b97\u4e0e\u6bb5\u5e03\u5c40\u63a7\u5236\u3002\u6240\u6709\u8868\u8fbe\u5f0f\u6309\u6574\u6570\u8fd0\u7b97&#xff0c;\u4f4d\u5bbd\u53d6\u51b3\u4e8e\u76ee\u6807\u67b6\u6784&#xff0c;\u5e38\u89c1\u4e3a 32 \u6216 64 \u4f4d\u3002\u8868\u8fbe\u5f0f\u5728\u811a\u672c\u89e3\u6790\u9636\u6bb5\u6216\u5206\u914d\u9636\u6bb5\u6c42\u503c&#xff0c;\u5176\u6838\u5fc3\u4f5c\u7528\u662f\u51b3\u5b9a\u8f93\u51fa\u6bb5\u7684\u5730\u5740\u3001\u5927\u5c0f\u4e0e\u7b26\u53f7\u503c&#xff0c;\u800c\u975e\u751f\u6210\u8fd0\u884c\u65f6\u4ee3\u7801\u3002<\/p>\n<p>\u5e38\u91cf\u4e0e\u7b26\u53f7\u662f\u8868\u8fbe\u5f0f\u7684\u57fa\u7840\u5355\u5143\u3002\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528\u5341\u8fdb\u5236\u3001\u5341\u516d\u8fdb\u5236\u5e38\u91cf&#xff0c;\u4e5f\u53ef\u4ee5\u5f15\u7528\u5df2\u5b9a\u4e49\u7b26\u53f7\u6216\u5185\u5efa\u7b26\u53f7\u3002\u4f8b\u5982&#xff1a;<\/p>\n<p>_start &#061; 0x80000000;<br \/>\n_stack_top &#061; ORIGIN(RAM) &#043; LENGTH(RAM);<\/p>\n<p>\u7b26\u53f7\u5728\u811a\u672c\u4e2d\u672c\u8d28\u662f\u53ef\u91cd\u65b0\u8d4b\u503c\u7684\u5730\u5740\u6807\u7b7e&#xff0c;\u8d4b\u503c\u8bed\u53e5\u4f1a\u5f71\u54cd\u540e\u7eed\u5730\u5740\u8ba1\u7b97\u3002\u672a\u5b9a\u4e49\u7b26\u53f7\u82e5\u672a\u88ab\u89e3\u6790&#xff0c;\u5c06\u5728\u94fe\u63a5\u9636\u6bb5\u62a5\u9519\u3002<\/p>\n<p>\u4f4d\u7f6e\u8ba1\u6570\u5668 . \u662f\u811a\u672c\u4e2d\u6700\u5173\u952e\u7684\u7279\u6b8a\u7b26\u53f7&#xff0c;\u5b83\u8868\u793a\u5f53\u524d\u8f93\u51fa\u6bb5\u7684\u5730\u5740\u504f\u79fb\u3002\u5bf9 . \u7684\u8d4b\u503c\u4f1a\u79fb\u52a8\u6bb5\u5e03\u5c40\u4f4d\u7f6e&#xff0c;\u4f8b\u5982&#xff1a;<\/p>\n<p>.text : {<br \/>\n    *(.text)<br \/>\n    . &#061; ALIGN(16);<br \/>\n    *(.rodata)<br \/>\n}<\/p>\n<p>\u8fd9\u91cc ALIGN(16) \u662f\u8868\u8fbe\u5f0f\u51fd\u6570&#xff0c;\u8fd4\u56de\u5bf9\u9f50\u540e\u7684\u503c&#xff0c;. \u88ab\u66f4\u65b0&#xff0c;\u4ece\u800c\u63a7\u5236\u540e\u7eed section \u7684\u5bf9\u9f50\u65b9\u5f0f\u3002\u5bf9 . \u7684\u4fee\u6539\u76f4\u63a5\u5f71\u54cd\u6700\u7ec8 ELF \u7684\u6bb5\u5e03\u5c40\u3002<\/p>\n<p>\u8868\u8fbe\u5f0f\u8fd8\u652f\u6301\u7b97\u672f\u3001\u4f4d\u8fd0\u7b97\u4e0e\u6761\u4ef6\u8868\u8fbe\u5f0f&#xff0c;\u4f8b\u5982&#xff1a;<\/p>\n<p>_etext &#061; .;<br \/>\n_data_size &#061; _edata &#8211; _sdata;<\/p>\n<p>\u8fd9\u4e9b\u8868\u8fbe\u5f0f\u5728\u94fe\u63a5\u9636\u6bb5\u6c42\u503c&#xff0c;\u7528\u4e8e\u751f\u6210\u8fb9\u754c\u7b26\u53f7&#xff0c;\u4f9b\u542f\u52a8\u4ee3\u7801\u6216\u8fd0\u884c\u65f6\u4f7f\u7528\u3002\u8868\u8fbe\u5f0f\u6240\u5728\u7684 section \u51b3\u5b9a\u5176\u8bed\u4e49\u4f4d\u7f6e&#xff0c;\u4f8b\u5982\u5728 SECTIONS \u5757\u5916\u8d4b\u503c\u4e0e\u5728\u6bb5\u5185\u90e8\u8d4b\u503c&#xff0c;\u5176\u5730\u5740\u542b\u4e49\u4e0d\u540c\u3002<\/p>\n<p>\u5b64\u513f section \u6307\u672a\u5728\u811a\u672c\u4e2d\u663e\u5f0f\u6307\u5b9a\u7684\u8f93\u5165 section&#xff0c;ld \u4f1a\u6839\u636e\u89c4\u5219\u81ea\u52a8\u653e\u5165\u5408\u9002\u4f4d\u7f6e\u3002\u82e5\u8868\u8fbe\u5f0f\u5f15\u7528\u4e86\u5b64\u513f section \u76f8\u5173\u7b26\u53f7&#xff0c;\u5176\u6700\u7ec8\u503c\u4f9d\u8d56\u94fe\u63a5\u5668\u653e\u7f6e\u987a\u5e8f&#xff0c;\u56e0\u6b64\u5728\u590d\u6742\u811a\u672c\u4e2d\u5efa\u8bae\u663e\u5f0f\u5217\u51fa\u5173\u952e section&#xff0c;\u4ee5\u907f\u514d\u5730\u5740\u6f02\u79fb\u9020\u6210\u7684\u4e0d\u786e\u5b9a\u6027\u3002<\/p>\n<h5>10. \u5185\u7f6e\u51fd\u6570<\/h5>\n<p>\u94fe\u63a5\u5668\u811a\u672c\u4e2d\u7684\u5185\u7f6e\u51fd\u6570\u672c\u8d28\u4e0a\u662f\u4e3a\u5730\u5740\u8ba1\u7b97\u4e0e\u6bb5\u63a7\u5236\u670d\u52a1\u7684\u201c\u8bed\u4e49\u5de5\u5177\u201d&#xff0c;\u5b83\u4eec\u5728\u94fe\u63a5\u9636\u6bb5\u7531 ld \u89e3\u91ca\u6267\u884c&#xff0c;\u800c\u975e\u751f\u6210\u76ee\u6807\u4ee3\u7801\u3002\u8fd9\u4e9b\u51fd\u6570\u901a\u5e38\u56f4\u7ed5\u5185\u5b58\u533a\u57df\u3001\u5bf9\u9f50\u63a7\u5236\u3001\u6bb5\u8fb9\u754c\u4e0e\u7b26\u53f7\u5b58\u5728\u6027\u5224\u65ad\u5c55\u5f00&#xff0c;\u662f\u7f16\u5199\u590d\u6742 SECTIONS \u5e03\u5c40\u65f6\u7684\u6838\u5fc3\u80fd\u529b\u3002<\/p>\n<p>\u5bf9\u9f50\u4e0e\u5730\u5740\u8ba1\u7b97\u51fd\u6570\u6700\u4e3a\u5e38\u7528\u3002ALIGN(n) \u5c06\u5f53\u524d\u4f4d\u7f6e\u5411\u4e0a\u5bf9\u9f50\u5230 n \u7684\u6574\u6570\u500d&#xff0c;\u5e38\u7528\u4e8e\u6bb5\u5185\u7ed3\u6784\u5bf9\u9f50&#xff1b;BLOCK(n) \u4e0e\u5176\u8bed\u4e49\u7c7b\u4f3c\u4f46\u4f5c\u7528\u4e8e\u6bb5\u8d77\u59cb\u4f4d\u7f6e\u3002\u4f8b\u5982&#xff1a;<\/p>\n<p>.text : {<br \/>\n    *(.text)<br \/>\n    . &#061; ALIGN(16);<br \/>\n}<\/p>\n<p>\u8fd9\u91cc\u901a\u8fc7\u4fee\u6539 . \u5b9e\u73b0\u6307\u4ee4\u5bf9\u9f50\u3002NEXT(n) \u5219\u8fd4\u56de\u4e0b\u4e00\u4e2a\u6ee1\u8db3\u5bf9\u9f50\u8981\u6c42\u7684\u5730\u5740\u503c&#xff0c;\u5e38\u7528\u4e8e\u5206\u914d\u7279\u5b9a\u8fb9\u754c\u3002<\/p>\n<p>\u5185\u5b58\u533a\u57df\u76f8\u5173\u51fd\u6570\u5e38\u4e0e MEMORY \u914d\u5408\u4f7f\u7528\u3002ORIGIN(name) \u8fd4\u56de\u533a\u57df\u8d77\u59cb\u5730\u5740&#xff0c;LENGTH(name) \u8fd4\u56de\u533a\u57df\u957f\u5ea6&#xff0c;\u4f7f\u811a\u672c\u5177\u5907\u5e73\u53f0\u65e0\u5173\u6027&#xff1a;<\/p>\n<p>MEMORY {<br \/>\n    RAM (rwx) : ORIGIN &#061; 0x80000000, LENGTH &#061; 128K<br \/>\n}<br \/>\n_stack_top &#061; ORIGIN(RAM) &#043; LENGTH(RAM);<\/p>\n<p>\u8fd9\u79cd\u5199\u6cd5\u907f\u514d\u786c\u7f16\u7801\u5730\u5740&#xff0c;\u63d0\u9ad8\u53ef\u79fb\u690d\u6027\u3002<\/p>\n<p>\u6bb5\u8fb9\u754c\u4e0e\u52a0\u8f7d\u5730\u5740\u63a7\u5236\u4f9d\u8d56 ADDR(section) \u4e0e LOADADDR(section)\u3002\u524d\u8005\u8fd4\u56de\u8fd0\u884c\u5730\u5740&#xff08;VMA&#xff09;&#xff0c;\u540e\u8005\u8fd4\u56de\u52a0\u8f7d\u5730\u5740&#xff08;LMA&#xff09;&#xff0c;\u5728\u533a\u5206 AT&gt; \u5e03\u5c40\u65f6\u5c24\u4e3a\u91cd\u8981\u3002\u4f8b\u5982&#xff1a;<\/p>\n<p>.data : AT(ADDR(.text) &#043; SIZEOF(.text)) {<br \/>\n    *(.data)<br \/>\n}<\/p>\n<p>\u6b64\u5916&#xff0c;SIZEOF(section) \u4e0e SIZEOF_HEADERS \u7528\u4e8e\u83b7\u53d6\u6bb5\u5927\u5c0f\u4e0e ELF \u5934\u90e8\u5927\u5c0f&#xff0c;\u5e38\u7528\u4e8e\u751f\u6210\u542f\u52a8\u4ee3\u7801\u6240\u9700\u7684\u8fb9\u754c\u7b26\u53f7\u3002<\/p>\n<p>\u7b26\u53f7\u5224\u5b9a\u7c7b\u51fd\u6570\u5982 DEFINED(symbol) \u4e0e PROVIDE(symbol &#061; expr) \u63d0\u4f9b\u5f31\u5b9a\u4e49\u673a\u5236\u3002\u5f53\u7528\u6237\u4ee3\u7801\u5df2\u5b9a\u4e49\u7b26\u53f7\u65f6\u4e0d\u8986\u76d6&#xff0c;\u5426\u5219\u63d0\u4f9b\u9ed8\u8ba4\u503c&#xff1a;<\/p>\n<p>PROVIDE(_heap_start &#061; .);<\/p>\n<p>\u8fd9\u5728\u6784\u5efa\u901a\u7528\u8fd0\u884c\u65f6\u6846\u67b6\u65f6\u975e\u5e38\u5173\u952e&#xff0c;\u53ef\u907f\u514d\u91cd\u590d\u5b9a\u4e49\u9519\u8bef&#xff0c;\u540c\u65f6\u5141\u8bb8\u4e0a\u5c42\u8986\u76d6\u9ed8\u8ba4\u5e03\u5c40\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260225154156-699f1844d8304.png\" alt=\"Alt\" height=\"200\" \/><\/p>\n<h3>Once Day<\/h3>\n<h3><\/h3>\n<p><b>\u4e5f\u4fe1\u7f8e\u4eba\u7ec8\u4f5c\u571f&#xff0c;\u4e0d\u582a\u5e7d\u68a6\u592a\u5306\u5306&#8230;&#8230;<\/b><\/p>\n<p><b>\u5982\u679c\u8fd9\u7bc7\u6587\u7ae0\u4e3a\u60a8\u5e26\u6765\u4e86\u5e2e\u52a9\u6216\u542f\u53d1&#xff0c;\u4e0d\u59a8\u70b9\u4e2a\u8d5e&#x1f44d;\u548c\u5173\u6ce8&#xff01;<\/b><\/p>\n<p><b>(&#xff61;\u25d5\u203f\u25d5&#xff61;)\u611f\u8c22\u60a8\u7684\u9605\u8bfb\u4e0e\u652f\u6301~~~<\/b><\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>GCC\u7f16\u8bd1(7)\u94fe\u63a5\u811a\u672cLinkerScripts Author: Once Day Date: 2026\u5e742\u670825\u65e5  \u4e00\u4f4d\u70ed\u8877\u4e8eLinux\u5b66\u4e60\u548c\u5f00\u53d1\u7684\u83dc\u9e1f&#xff0c;\u8bd5\u56fe\u8c31\u5199\u4e00\u573a\u5192\u9669\u4e4b\u65c5&#xff0c;\u4e5f\u8bb8\u7ec8\u70b9\u53ea\u662f\u4e00\u573a\u767d\u65e5\u68a6\u2026  \u6f2b\u6f2b\u957f\u8def&#xff0c;\u6709\u4eba\u5bf9\u4f60\u5fae\u7b11\u8fc7\u561b\u2026  \u5168\u7cfb\u5217\u6587\u7ae0\u53ef\u53c2\u8003\u4e13\u680f: \u7f16\u8bd1\u6784\u5efa\u5de5\u5177\u94fe_Once-Day\u7684\u535a\u5ba2-CSDN\u535a\u5ba2 \u53c2\u8003\u6587\u7ae0: GNU LD Linker Scripts\u94fe\u63a5\u811a\u672c(Linker Scripts)\u8bed\u6cd5\u548c\u89c4\u5219\u89e3\u6790\u94fe\u63a5\u811a\u672c\u7684<\/p>\n","protected":false},"author":2,"featured_media":78034,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[8576,8577,55,174],"topic":[],"class_list":["post-78035","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-8576","tag-8577","tag-c"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>GCC\u7f16\u8bd1(7)\u94fe\u63a5\u811a\u672cLinkerScripts - \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\/78035.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"GCC\u7f16\u8bd1(7)\u94fe\u63a5\u811a\u672cLinkerScripts - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"GCC\u7f16\u8bd1(7)\u94fe\u63a5\u811a\u672cLinkerScripts Author: Once Day Date: 2026\u5e742\u670825\u65e5 \u4e00\u4f4d\u70ed\u8877\u4e8eLinux\u5b66\u4e60\u548c\u5f00\u53d1\u7684\u83dc\u9e1f&#xff0c;\u8bd5\u56fe\u8c31\u5199\u4e00\u573a\u5192\u9669\u4e4b\u65c5&#xff0c;\u4e5f\u8bb8\u7ec8\u70b9\u53ea\u662f\u4e00\u573a\u767d\u65e5\u68a6\u2026 \u6f2b\u6f2b\u957f\u8def&#xff0c;\u6709\u4eba\u5bf9\u4f60\u5fae\u7b11\u8fc7\u561b\u2026 \u5168\u7cfb\u5217\u6587\u7ae0\u53ef\u53c2\u8003\u4e13\u680f: \u7f16\u8bd1\u6784\u5efa\u5de5\u5177\u94fe_Once-Day\u7684\u535a\u5ba2-CSDN\u535a\u5ba2 \u53c2\u8003\u6587\u7ae0: GNU LD Linker Scripts\u94fe\u63a5\u811a\u672c(Linker Scripts)\u8bed\u6cd5\u548c\u89c4\u5219\u89e3\u6790\u94fe\u63a5\u811a\u672c\u7684\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/78035.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-02-25T15:41:58+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260225154156-699f1844d8304.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=\"20 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/78035.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/78035.html\",\"name\":\"GCC\u7f16\u8bd1(7)\u94fe\u63a5\u811a\u672cLinkerScripts - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-02-25T15:41:58+00:00\",\"dateModified\":\"2026-02-25T15:41:58+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/78035.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/78035.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/78035.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"GCC\u7f16\u8bd1(7)\u94fe\u63a5\u811a\u672cLinkerScripts\"}]},{\"@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":"GCC\u7f16\u8bd1(7)\u94fe\u63a5\u811a\u672cLinkerScripts - \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\/78035.html","og_locale":"zh_CN","og_type":"article","og_title":"GCC\u7f16\u8bd1(7)\u94fe\u63a5\u811a\u672cLinkerScripts - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"GCC\u7f16\u8bd1(7)\u94fe\u63a5\u811a\u672cLinkerScripts Author: Once Day Date: 2026\u5e742\u670825\u65e5 \u4e00\u4f4d\u70ed\u8877\u4e8eLinux\u5b66\u4e60\u548c\u5f00\u53d1\u7684\u83dc\u9e1f&#xff0c;\u8bd5\u56fe\u8c31\u5199\u4e00\u573a\u5192\u9669\u4e4b\u65c5&#xff0c;\u4e5f\u8bb8\u7ec8\u70b9\u53ea\u662f\u4e00\u573a\u767d\u65e5\u68a6\u2026 \u6f2b\u6f2b\u957f\u8def&#xff0c;\u6709\u4eba\u5bf9\u4f60\u5fae\u7b11\u8fc7\u561b\u2026 \u5168\u7cfb\u5217\u6587\u7ae0\u53ef\u53c2\u8003\u4e13\u680f: \u7f16\u8bd1\u6784\u5efa\u5de5\u5177\u94fe_Once-Day\u7684\u535a\u5ba2-CSDN\u535a\u5ba2 \u53c2\u8003\u6587\u7ae0: GNU LD Linker Scripts\u94fe\u63a5\u811a\u672c(Linker Scripts)\u8bed\u6cd5\u548c\u89c4\u5219\u89e3\u6790\u94fe\u63a5\u811a\u672c\u7684","og_url":"https:\/\/www.wsisp.com\/helps\/78035.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-02-25T15:41:58+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260225154156-699f1844d8304.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"20 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/78035.html","url":"https:\/\/www.wsisp.com\/helps\/78035.html","name":"GCC\u7f16\u8bd1(7)\u94fe\u63a5\u811a\u672cLinkerScripts - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-02-25T15:41:58+00:00","dateModified":"2026-02-25T15:41:58+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/78035.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/78035.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/78035.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"GCC\u7f16\u8bd1(7)\u94fe\u63a5\u811a\u672cLinkerScripts"}]},{"@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\/78035","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=78035"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/78035\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/78034"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=78035"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=78035"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=78035"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=78035"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}