<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.sarg.dev/index.php?action=history&amp;feed=atom&amp;title=Code_segment</id>
	<title>Code segment - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.sarg.dev/index.php?action=history&amp;feed=atom&amp;title=Code_segment"/>
	<link rel="alternate" type="text/html" href="https://wiki.sarg.dev/index.php?title=Code_segment&amp;action=history"/>
	<updated>2026-06-22T21:36:18Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.2</generator>
	<entry>
		<id>https://wiki.sarg.dev/index.php?title=Code_segment&amp;diff=624930&amp;oldid=prev</id>
		<title>imported&gt;Theki at 13:02, 31 October 2024</title>
		<link rel="alternate" type="text/html" href="https://wiki.sarg.dev/index.php?title=Code_segment&amp;diff=624930&amp;oldid=prev"/>
		<updated>2024-10-31T13:02:34Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Short description|Portion of an object file containing executable instructions}}&lt;br /&gt;
[[File:Program memory layout.svg|thumb|383x383px|This shows the typical layout of a simple computer&amp;#039;s program memory with the text, various data, and [[call stack|stack]] and [[heap (programming) |heap]] sections.]]&lt;br /&gt;
&lt;br /&gt;
In [[computing]], a &amp;#039;&amp;#039;&amp;#039;code segment&amp;#039;&amp;#039;&amp;#039;, also known as a &amp;#039;&amp;#039;&amp;#039;text segment&amp;#039;&amp;#039;&amp;#039; or simply as &amp;#039;&amp;#039;&amp;#039;text&amp;#039;&amp;#039;&amp;#039;, is a portion of an [[object file]] or the corresponding section of the program&amp;#039;s [[virtual address space]] that contains [[executable]] [[instruction (computer science)|instructions]].&amp;lt;ref name=&amp;quot;jason&amp;quot;&amp;gt;{{Cite web&lt;br /&gt;
 | url = http://www.cs.uwm.edu/classes/cs315/Bacon/Lecture/HTML/ch10s04.html&lt;br /&gt;
 | title = Chapter 10. Subprogram Calls and the Stack&lt;br /&gt;
 | at = Section 10.4. Memory Segments&lt;br /&gt;
 | date = 2012-03-13&lt;br /&gt;
 | accessdate = 2014-05-02&lt;br /&gt;
 | author = Jason W. Bacon&lt;br /&gt;
 | website = cs.uwm.edu&lt;br /&gt;
 | archive-date = 2014-05-02&lt;br /&gt;
 | archive-url = https://web.archive.org/web/20140502115622/http://www.cs.uwm.edu/classes/cs315/Bacon/Lecture/HTML/ch10s04.html&lt;br /&gt;
 | url-status = dead&lt;br /&gt;
 }}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Segment==&lt;br /&gt;
The term &amp;quot;segment&amp;quot; comes from the [[memory segment]], which is a historical approach to [[memory management]] that has been succeeded by [[paging]]. When a program is stored in an object file, the code segment is a part of this file; when the [[Loader (computing)|loader]] places a program into [[main memory|memory]] so that it may be executed, various memory regions are allocated (in particular, as pages), corresponding to both the segments in the object files and to segments only needed at run time. For example, the code segment of an object file is loaded into a corresponding code segment in memory.&lt;br /&gt;
&lt;br /&gt;
The code segment in memory is typically read-only and has a fixed size, so on [[embedded system]]s it can usually be placed in [[read-only memory]] (ROM), without the need for loading. If the code segment is not read-only, then the particular [[computer architecture|architecture]] allows [[self-modifying code]]. Fixed-position or [[position-independent code]] may be shared in memory by several processes in segmented or paged memory systems.&amp;lt;ref name=&amp;quot;jason&amp;quot;/&amp;gt;&amp;lt;ref&amp;gt;{{Cite web&lt;br /&gt;
 | url = http://www.beingdeveloper.com/memory-layout-of-a-program/&lt;br /&gt;
 | title = Code Segment and Data Segment: Memory Layout of a Program&lt;br /&gt;
 | date = 2012-09-20&lt;br /&gt;
 | accessdate = 2014-05-02&lt;br /&gt;
 | author = Kai Wang&lt;br /&gt;
 | website = beingdeveloper.com&lt;br /&gt;
 | archive-date = 2014-05-02&lt;br /&gt;
 | archive-url = https://web.archive.org/web/20140502121214/http://www.beingdeveloper.com/memory-layout-of-a-program/&lt;br /&gt;
 | url-status = dead&lt;br /&gt;
 }}&amp;lt;/ref&amp;gt; As a memory region, the code segment may be placed below the heap or stack in order to prevent [[Heap overflow|heap]] and [[stack overflow]]s from overwriting it.&amp;lt;ref&amp;gt;{{Cite conference&lt;br /&gt;
 | doi = 10.1109/ISCIT.2005.1567023&lt;br /&gt;
 | title = Buffer overflow protection based on adjusting code segment limit&lt;br /&gt;
 | conference = IEEE International Symposium on Communications and Information Technology&lt;br /&gt;
 | date = October 2005 &lt;br /&gt;
 | author1 = Yu-An Tan | author2 = Ji-yan Zheng | author3 = Yuan-Da Cao | author4 = Xue-lan Zhang&lt;br /&gt;
 | publisher = [[IEEE]]&lt;br /&gt;
}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
{{Portal|Computer programming}}&lt;br /&gt;
* [[.bss]]&lt;br /&gt;
* [[Data segment]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
{{Reflist}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Executable file formats]]&lt;br /&gt;
[[Category:Memory management]]&lt;/div&gt;</summary>
		<author><name>imported&gt;Theki</name></author>
	</entry>
</feed>