<div>Hi,</div><div> </div><div>Recently I have started reading tutorials for writing a small kernel. All such tutorials mention use of linker scripts. I have </div><div>read few articles on linker scritps but I am stuck on one thing. I am unable to understand the use of defining new symbols in linker scripts.</div>
<div>Using a linker script to arrange different sections in the object file is understandable but defining symbols which are not referenced anywhere in the script </div><div>is confusing. An example is the use of symbols sbss and ebss in the bss section as show in the script below</div>
<div> </div><div> </div><div>ENTRY (loader)</div><div>SECTIONS<br>{<br> . = 0x00100000;</div><div> .text ALIGN (0x1000) :<br> {<br> *(.text)<br> }</div><div> .rodata ALIGN (0x1000) :<br> {<br> *(.rodata*)<br>
}</div><div> .data ALIGN (0x1000) :<br> {<br> *(.data)<br> }</div><div> .bss :<br> {<br> sbss = .;<br> *(COMMON)<br> *(.bss)<br> ebss = .;<br> }<br>}<br></div><div>
</div><div>Please explain how defining such symbols is useful.</div><div> </div><div>Thanks</div><div>Vaibhav Jain</div><div><span style="font:14px/18px Arial,"Liberation Sans","DejaVu Sans",sans-serif;text-align:left;color:rgb(0,0,0);text-transform:none;text-indent:0px;letter-spacing:normal;word-spacing:0px;float:none;display:inline!important;white-space:normal;font-size-adjust:none;font-stretch:normal;background-color:rgb(255,255,255)"></span> </div>