Annotation of htdocs/docs/kernel/elf-notes.html, revision 1.61

1.57      nia         1: <!DOCTYPE html>
1.1       dsieger     2: <html>
                      3: <head>
                      4: <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
                      5: <meta name="generator" content="Website XSL Stylesheet V2.6.0">
                      6: <link rel="home" href="../../." title="Welcome to The NetBSD Project: Of course it runs NetBSD.">
                      7: <link rel="up" href="../../docs/kernel/." title="NetBSD Documentation: Kernel">
                      8: <link rel="previous" href="../../docs/kernel/porting-freebsd-net.html" title="Notes on porting FreeBSD network drivers to NetBSD">
                      9: <link rel="next" href="../../docs/mirror.html" title="NetBSD Mirror FAQ">
                     10: <link rel="first" href="../../docs/kernel/lazyfpu.html" title="NetBSD Documentation: How lazy FPU context switch works">
1.11      dsieger    11: <link rel="stylesheet" href="../../global.css" type="text/css">
1.48      maya       12: <link rel="stylesheet" href="../../donations/thermo/fundraiser.css" type="text/css">
1.1       dsieger    13: 
                     14: 
                     15: 
                     16: <title>NetBSD Documentation: Vendor-specific ELF Note Elements</title>
                     17: </head>
1.49      maya       18: <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
1.1       dsieger    19: <body class="website"><div class="webpage">
1.42      maya       20: <a name="docs-kernel-elf-notes"></a><div id="top"><a href="#mainContent" id="skiplink" tabindex="1">Skip to main content.</a></div>
1.49      maya       21: <input id="hamburger" type="checkbox"><label class="menuicon" for="hamburger"><span></span><span></span><span></span></label><div id="navBar" role="navigation">
1.30      maya       22: <div id="centralHeader"><div id="logo">
1.50      maya       23: <a href="../../"><img id="projectLogo" alt="" height="120" src="../../images/NetBSD-smaller-tb.png"></a><a href="/"><div id="fundraiser">
1.48      maya       24: <br><div id="fundraiser-amount"><div id="fundraiser-raised"></div></div>
                     25: </div></a>
1.30      maya       26: </div></div>
1.6       dsieger    27: <span class="doNotDisplay">
                     28:          Navigation:
1.17      jym        29:        </span><ul>
                     30: <li>
                     31: <a href="../../">
1.51      maya       32:          Home</a><ul>
1.17      jym        33: <li><a href="../../changes/">
                     34:            Recent changes</a></li>
1.33      maya       35: <li><a href="//blog.NetBSD.org/">
1.17      jym        36:            NetBSD blog</a></li>
1.47      maya       37: <li><a href="../../gallery/presentations/">
                     38:            Presentations</a></li>
1.17      jym        39: </ul>
                     40: </li>
                     41: <li>
                     42: <a href="../../about/">
                     43:          About</a><ul>
1.38      maya       44: <li><a href="../../people/developers.html">
1.51      maya       45:            Developers</a></li>
1.17      jym        46: <li><a href="../../gallery/">
1.44      leot       47:            Gallery</a></li>
1.51      maya       48: <li><a href="//wiki.NetBSD.org/ports/">
                     49:            Ports</a></li>
1.56      nia        50: <li><a href="//www.pkgsrc.org/">
1.51      maya       51:            Packages</a></li>
1.17      jym        52: </ul>
                     53: </li>
                     54: <li>
                     55: <a href="../../docs/">
                     56:          Documentation</a><ul>
                     57: <li><a href="../../docs/misc/index.html">
                     58:            FAQ &amp; HOWTOs</a></li>
                     59: <li><a href="../../docs/guide/en/">
                     60:            The Guide</a></li>
1.53      nia        61: <li><a href="//man.NetBSD.org/">
1.17      jym        62:            Manual pages</a></li>
1.33      maya       63: <li><a href="//wiki.NetBSD.org/">
1.17      jym        64:            Wiki</a></li>
                     65: </ul>
                     66: </li>
                     67: <li>
                     68: <a href="../../support/">
                     69:          Support</a><ul>
1.52      leot       70: <li><a href="/community/">
1.51      maya       71:            Community</a></li>
1.52      leot       72: <li><a href="/mailinglists/">
                     73:            Mailing lists</a></li>
1.17      jym        74: <li><a href="../../support/send-pr.html">
1.51      maya       75:            Bug reports</a></li>
1.17      jym        76: <li><a href="../../support/security/">
                     77:            Security</a></li>
                     78: </ul>
                     79: </li>
                     80: <li>
                     81: <a href="../../developers/">
                     82:          Developers</a><ul>
1.35      maya       83: <li><a href="http://cvsweb.NetBSD.org/">
1.51      maya       84:            CVSWeb</a></li>
                     85: <li><a href="//anonhg.NetBSD.org/">
                     86:            Mercurial</a></li>
1.33      maya       87: <li><a href="//nxr.NetBSD.org/">
1.17      jym        88:            Cross-reference</a></li>
1.33      maya       89: <li><a href="//releng.NetBSD.org/">
1.17      jym        90:            Release engineering</a></li>
1.33      maya       91: <li><a href="//wiki.NetBSD.org/projects/">
1.17      jym        92:            Projects list</a></li>
                     93: </ul>
                     94: </li>
                     95: </ul>
1.3       dsieger    96: </div>
1.41      maya       97: <div id="content"><div id="mainContent" class="fullWidth"><div class="rowOfBoxes">
1.3       dsieger    98: <h1>NetBSD Documentation: Vendor-specific ELF Note Elements</h1>
1.1       dsieger    99: <h3 class="title"><a name="introduction"></a></h3>
                    100: <ul>
                    101: <li><a href="#introduction-sub">Introduction</a></li>
                    102: <li><a href="#note-format">Format of an ELF Note Element</a></li>
                    103: <li><a href="#note-names">Known ELF Note Names</a></li>
                    104: <li><a href="#note-contents">Vendor-specific ELF Notes</a></li>
                    105: <li><a href="#note-creation">Creating ELF PT_NOTE Sections</a></li>
                    106: <li><a href="#netbsd-note">Creating a NetBSD ELF PT_NOTE Section</a></li>
                    107: </ul>
                    108: <hr>
                    109: <h3 class="title"></h3>
                    110:     <h4 class="title">
1.39      maya      111: <a name="introduction-sub"></a>Introduction</h4>
1.1       dsieger   112:       <p>
                    113:        Various operating system vendors are shipping ELF binaries and those
                    114:        binaries expect different system call interfaces.  In order to help
                    115:        operating systems correctly determine whether or not they can run an
                    116:        ELF program, and how to run it (e.g. what OS emulation to use), some
                    117:        operating system vendors have begun marking their ELF binaries with
                    118:        vendor-specific note elements, and placing those notes in the
                    119:        binaries' <code class="constant">PT_NOTE</code> sections.
                    120:       </p>
                    121:       <p>
                    122:        This page is meant to be a repository of knowledge about vendor-specific
                    123:        note elements used in binaries <code class="constant">PT_NOTE</code> sections for operating system
                    124:        identification.
                    125:       </p>
                    126: 
                    127:       <p>
                    128:        If your operating system uses vendor-specific note elements to
                    129:        mark its binaries and is not listed here, please send mail to
1.24      mbalmer   130:        <a class="ulink" href="mailto:netbsd-docs@NetBSD.org" target="_top">NetBSD documentation list</a>
1.1       dsieger   131:        with information about those notes.
                    132:       </p>
                    133:     
                    134:       <h4 class="title">
1.39      maya      135: <a name="note-format"></a>Format of an ELF Note Element</h4>
1.1       dsieger   136: 
                    137:       <p>
                    138:        All ELF Note elements have the same basic structure:
                    139:        </p>
1.22      tron      140: <div class="variablelist"><dl class="variablelist">
1.1       dsieger   141: <dt><span class="term"><code class="varname">Name Size</code></span></dt>
                    142: <dd>4 bytes (integer)</dd>
                    143: <dt><span class="term"><code class="varname">Desc Size</code></span></dt>
                    144: <dd>4 bytes (integer)</dd>
                    145: <dt><span class="term"><code class="varname">Type</code></span></dt>
                    146: <dd>4 bytes (usually interpreted as an integer)</dd>
                    147: <dt><span class="term"><code class="varname">Name</code></span></dt>
                    148: <dd>variable size, padded to a 4 byte boundary</dd>
                    149: <dt><span class="term"><code class="varname">Desc</code></span></dt>
                    150: <dd>variable size, padded to a 4 byte boundary</dd>
                    151: </dl></div>
                    152: <p>
                    153:       </p>
                    154:       
                    155:       <p>
                    156:        The "Name Size" and "Desc Size" fields are integers (in the byte order
                    157:        specified by the binary's ELF header) which specify the size of the
                    158:        "Name" and "Desc" fields (excluding padding).
                    159:       </p>
                    160:     
                    161:       <p>
                    162:        The "Name" field specifies the vendor who defined the format of the Note.
                    163:        Typically, vendors use names which are related to their project and/or
                    164:        company names.  For instance, the GNU Project uses "GNU" as its name.
                    165:        No two vendors should use the same ELF Note Name, lest there be confusion
                    166:        when trying to interpret the meanings of notes.
                    167:       </p>
                    168:       
                    169:       <p>
                    170:        The "Type" field is vendor specific, but it is usually treated as an
                    171:        integer which identifies the type of the note.
                    172:       </p>
                    173:       
                    174:       <p>
                    175:        The "Desc" field is vendor specific, and usually contains data which
                    176:        depends on the note type.
                    177:       </p>
                    178:     
                    179:       <h4 class="title">
1.39      maya      180: <a name="note-names"></a>Known ELF Note Names</h4>
1.1       dsieger   181: 
                    182:       <p>
                    183:        The following are the strings known to be used as ELF Note Names, along
                    184:        with the organizations that use them.  Names with lengths that are
                    185:        not a multiples of 4 are padded in the note, but only the given length
                    186:        should be checked.
                    187:       </p>
                    188:       
                    189:       <div class="segmentedlist"><table border="0">
                    190: <thead><tr class="segtitle">
                    191: <th>Note Name String</th>
                    192: <th>Byte encoding of string</th>
                    193: <th>Length</th>
                    194: <th>Organization</th>
                    195: </tr></thead>
                    196: <tbody>
                    197: <tr class="seglistitem">
                    198:          <td class="seg"><code class="code">"NetBSD\0"</code></td>
                    199:          <td class="seg"><code class="code">0x4e 0x65 0x74 0x42 0x53 0x44 0x00</code></td>
                    200:          <td class="seg">7</td>
1.11      dsieger   201:          <td class="seg"><a class="xref" href="#note-contents-netbsd" title="The NetBSD Project">The NetBSD Project</a></td>
1.1       dsieger   202:        </tr>
                    203: <tr class="seglistitem">
1.25      mbalmer   204:          <td class="seg"><code class="code">"PaX\0"</code></td>
                    205:          <td class="seg"><code class="code">0x50 0x61 0x58 0x00</code></td>
                    206:          <td class="seg">4</td>
                    207:          <td class="seg">specific to <a class="xref" href="#note-contents-netbsd" title="The NetBSD Project">The NetBSD Project</a> ? </td>
                    208:        </tr>
                    209: <tr class="seglistitem">
1.1       dsieger   210:          <td class="seg"><code class="code">"GNU\0"</code></td>
                    211:          <td class="seg"><code class="code">0x47 0x4e 0x55 0x00</code></td>
                    212:          <td class="seg">4</td>
1.11      dsieger   213:          <td class="seg"><a class="xref" href="#note-contents-gnu" title="The GNU Project">The GNU Project</a></td>
1.1       dsieger   214:        </tr>
                    215: </tbody>
                    216: </table></div>
                    217:     
                    218:     <h4 class="title">
1.39      maya      219: <a name="note-contents"></a>Vendor-specific ELF Notes</h4>
1.1       dsieger   220:       
                    221:     <p>
                    222:       This section contains information about the formats of ELF notes which
                    223:       vendors use in their <code class="constant">PT_NOTE</code> sections, and is split up by vendor.
                    224:     </p>
                    225: 
1.22      tron      226:     <div class="sect4">
1.1       dsieger   227: <div class="titlepage"><div><div><h5 class="title">
                    228: <a name="note-contents-netbsd"></a>The NetBSD Project</h5></div></div></div>
                    229:       
                    230:       
                    231:       <p>
1.25      mbalmer   232:        There are four vendor-specific ELF Notes for NetBSD and the
                    233:        PaX note also included in this list, as currently it is
                    234:        not know wether it is used with other operating systems
                    235:        as well.</p>
                    236: 
                    237:       <p>The OS Version note 
                    238:        is used to indicate what OS Version
1.1       dsieger   239:        native binaries were built with, and can be used to identify native
1.25      mbalmer   240:        binaries.</p>
1.1       dsieger   241:       <p>
1.25      mbalmer   242:        The format is:
1.1       dsieger   243:        
                    244:        </p>
1.22      tron      245: <div class="variablelist"><dl class="variablelist">
1.1       dsieger   246: <dt><span class="term"><code class="varname">Name Size</code></span></dt>
                    247: <dd>7</dd>
                    248: <dt><span class="term"><code class="varname">Desc Size</code></span></dt>
                    249: <dd>4</dd>
                    250: <dt><span class="term"><code class="varname">Type</code></span></dt>
                    251: <dd>4-byte integer containing the value <code class="code">0x01</code>
                    252: </dd>
                    253: <dt><span class="term"><code class="varname">Name</code></span></dt>
                    254: <dd>
                    255: <code class="code">"NetBSD\0"</code> (padded to 8 bytes)</dd>
                    256: <dt><span class="term"><code class="varname">Desc</code></span></dt>
                    257: <dd>4-byte integer containing the NetBSD OS version constant</dd>
                    258: </dl></div>
                    259: <p>
                    260:       </p>
                    261: 
                    262:       <p>
1.25      mbalmer   263:        The Emulation Name note is used to mark binaries (both native an non-native) with
                    264:        a name that indicates which set of binary emulation code is to be used
                    265:        when they are run.</p>
                    266:       <p>
                    267:        The format is:
1.1       dsieger   268:        </p>
1.22      tron      269: <div class="variablelist"><dl class="variablelist">
1.1       dsieger   270: <dt><span class="term"><code class="varname">Name Size</code></span></dt>
                    271: <dd>7</dd>
                    272: <dt><span class="term"><code class="varname">Desc Size</code></span></dt>
                    273: <dd>variable</dd>
                    274: <dt><span class="term"><code class="varname">Type</code></span></dt>
                    275: <dd>4-byte integer containing the value <code class="code">0x02</code>
                    276: </dd>
                    277: <dt><span class="term"><code class="varname">Name</code></span></dt>
                    278: <dd>
                    279: <code class="code">"NetBSD\0"</code> (padded to 8 bytes)</dd>
                    280: <dt><span class="term"><code class="varname">Desc</code></span></dt>
                    281: <dd>
                    282: <code class="code">NUL</code>-terminated string naming the
                    283:            emulation to be used to run the binary
                    284:            (padded to the next 4-byte boundary)</dd>
                    285: </dl></div>
                    286: <p>
                    287:       </p>
1.24      mbalmer   288: 
                    289:       <p>
1.25      mbalmer   290:        The PaX note encodes execution protection and addrss space
                    291:        layout randomization flags.</p>
                    292:       <p>
                    293:        The format is:
1.24      mbalmer   294:        
                    295:        </p>
                    296: <div class="variablelist"><dl class="variablelist">
                    297: <dt><span class="term"><code class="varname">Name Size</code></span></dt>
                    298: <dd>4</dd>
                    299: <dt><span class="term"><code class="varname">Desc Size</code></span></dt>
                    300: <dd>4</dd>
                    301: <dt><span class="term"><code class="varname">Type</code></span></dt>
                    302: <dd>4-byte integer containing the value <code class="code">0x03</code>
                    303: </dd>
                    304: <dt><span class="term"><code class="varname">Name</code></span></dt>
1.25      mbalmer   305: <dd><code class="code">"PaX\0"</code></dd>
1.24      mbalmer   306: <dt><span class="term"><code class="varname">Desc</code></span></dt>
                    307: <dd>4-byte bitmask with the following bits:
                    308:            <div class="segmentedlist"><table border="0">
                    309: <thead><tr class="segtitle">
                    310: <th>Bit</th>
                    311: <th>Meaning</th>
                    312: </tr></thead>
                    313: <tbody>
                    314: <tr class="seglistitem">
                    315:                <td class="seg"><code class="code">0x01</code></td>
                    316:                <td class="seg">Force enable Mprotect</td>
                    317:              </tr>
                    318: <tr class="seglistitem">
                    319:                <td class="seg"><code class="code">0x02</code></td>
                    320:                <td class="seg">Force disable Mprotect</td>
                    321:              </tr>
                    322: <tr class="seglistitem">
                    323:                <td class="seg"><code class="code">0x04</code></td>
                    324:                <td class="seg">Force enable Segvguard</td>
                    325:              </tr>
                    326: <tr class="seglistitem">
                    327:                <td class="seg"><code class="code">0x08</code></td>
                    328:                <td class="seg">Force disable Segvguard</td>
                    329:              </tr>
                    330: <tr class="seglistitem">
                    331:                <td class="seg"><code class="code">0x10</code></td>
                    332:                <td class="seg">Force enable ASLR</td>
                    333:              </tr>
                    334: <tr class="seglistitem">
                    335:                <td class="seg"><code class="code">0x20</code></td>
                    336:                <td class="seg">Force disable ASLR</td>
                    337:              </tr>
                    338: </tbody>
                    339: </table></div>
                    340:            </dd>
                    341: </dl></div>
                    342: <p>
                    343:       </p>
                    344: 
                    345:       <p>
1.25      mbalmer   346:        The Architecture Note encodes machine architecture details.</p>
                    347:       <p>
                    348:        The format is:
1.24      mbalmer   349:        
                    350:        </p>
                    351: <div class="variablelist"><dl class="variablelist">
                    352: <dt><span class="term"><code class="varname">Name Size</code></span></dt>
                    353: <dd>7</dd>
                    354: <dt><span class="term"><code class="varname">Desc Size</code></span></dt>
                    355: <dd>variable</dd>
                    356: <dt><span class="term"><code class="varname">Type</code></span></dt>
                    357: <dd>4-byte integer containing the value <code class="code">0x05</code>
                    358: </dd>
                    359: <dt><span class="term"><code class="varname">Name</code></span></dt>
                    360: <dd>
                    361: <code class="code">"NetBSD\0"</code> (padded to 8 bytes)</dd>
                    362: <dt><span class="term"><code class="varname">Desc</code></span></dt>
                    363: <dd>A string describing the architecture the binary was
                    364:                      compiled for (for example used on ARM to distinguish
                    365:                      hardware floating point ABI and softfloat)</dd>
                    366: </dl></div>
                    367: <p>
                    368:       </p>
                    369: 
                    370:       <p>
1.25      mbalmer   371:        The Code Model Note encodes code model details.</p>
                    372:       <p>
                    373:        The format is:
1.24      mbalmer   374:        
                    375:        </p>
                    376: <div class="variablelist"><dl class="variablelist">
                    377: <dt><span class="term"><code class="varname">Name Size</code></span></dt>
                    378: <dd>7</dd>
                    379: <dt><span class="term"><code class="varname">Desc Size</code></span></dt>
                    380: <dd>variable</dd>
                    381: <dt><span class="term"><code class="varname">Type</code></span></dt>
                    382: <dd>4-byte integer containing the value <code class="code">0x06</code>
                    383: </dd>
                    384: <dt><span class="term"><code class="varname">Name</code></span></dt>
                    385: <dd>
                    386: <code class="code">"NetBSD\0"</code> (padded to 8 bytes)</dd>
                    387: <dt><span class="term"><code class="varname">Desc</code></span></dt>
                    388: <dd>A string describing the code model the binary was
                    389:                      compiled for. Used for example on sparc64 to tell
                    390:                      binaries compiled with -mcmodel=medlow apart from
1.25      mbalmer   391:                      standard (-mcmodel=medmid) ones, because the former
1.24      mbalmer   392:                      are not eligible for top-down virtual memory
                    393:                      layout.</dd>
                    394: </dl></div>
                    395: <p>
                    396:       </p>
                    397: 
1.1       dsieger   398:     </div>
                    399: 
1.22      tron      400:     <div class="sect4">
1.1       dsieger   401: <div class="titlepage"><div><div><h5 class="title">
                    402: <a name="note-contents-gnu"></a>The GNU Project</h5></div></div></div>
                    403:       
                    404: 
                    405:       <p>
                    406:        Starting with glibc 2.1, the GNU project will be using a single ELF Note
                    407:        to indicate which GNU operating system and which version of that system
                    408:        a binary was built for.  The format of that note is:
                    409:        </p>
1.22      tron      410: <div class="variablelist"><dl class="variablelist">
1.1       dsieger   411: <dt><span class="term"><code class="varname">Name Size</code></span></dt>
                    412: <dd>4</dd>
                    413: <dt><span class="term"><code class="varname">Desc Size</code></span></dt>
                    414: <dd>16</dd>
                    415: <dt><span class="term"><code class="varname">Type</code></span></dt>
                    416: <dd>4-byte integer containing the value <code class="code">0x01</code>
                    417: </dd>
                    418: <dt><span class="term"><code class="varname">Name</code></span></dt>
                    419: <dd><code class="code">"GNU\0"</code></dd>
                    420: <dt><span class="term"><code class="varname">Desc</code></span></dt>
                    421: <dd>
                    422:              Four 4-byte integers containing, in order:
1.15      spz       423:              <div class="orderedlist"><ol class="orderedlist" type="1">
                    424: <li class="listitem">OS (0 = Linux, 1 = Hurd, 2 = Solaris)</li>
                    425: <li class="listitem">Major</li>
                    426: <li class="listitem">Minor</li>
                    427: <li class="listitem">Teeny</li>
1.1       dsieger   428: </ol></div>
                    429:              The major, minor and teeny versions are that of the earliest OS version that supports this ABI.
                    430:            </dd>
                    431: </dl></div>
                    432: <p>
                    433:       </p>
                    434: 
                    435:       <p>
                    436:        For more documentation on the GNU C Library's use of ELF notes,
                    437:        consult the sources:
1.11      dsieger   438:        <a class="ulink" href="http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/abi-tags?cvsroot=glibc" target="_top">abi-tags</a>
1.1       dsieger   439:        and
1.11      dsieger   440:        <a class="ulink" href="http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/csu/abi-note.S?cvsroot=glibc" target="_top">csu/abi-note.S</a>.
1.1       dsieger   441:       </p>
                    442:     </div>
                    443:   
                    444:       <h4 class="title">
1.39      maya      445: <a name="note-creation"></a>Creating ELF <code class="constant">PT_NOTE</code> Sections</h4>
1.1       dsieger   446: 
                    447:       <p>
                    448:        If you're using the GNU binutils 2.8 or greater to create your binaries,
                    449:        you can generate <code class="constant">PT_NOTE</code> sections in your final object files.
                    450:        To create a <code class="constant">PT_NOTE</code> section, create a section in one of your object
                    451:        files (for systems which generate <code class="constant">PT_NOTE</code> entries by default, this
                    452:        is typically the runtime startup code) with a name starting
                    453:        with ".note" and having the "allocate" property set.
                    454:        Put properly formed ELF Notes entries in that section.
                    455:        When final linking is done, all sections which have names starting
                    456:        with ".note" and which are marked "allocate" will be put into <code class="constant">PT_NOTE</code>
                    457:        sections in the final object file.
                    458:       </p>
                    459:       <p>
                    460:        An example of GNU assembler input which will create a <code class="constant">PT_NOTE</code> section
                    461:        during final link is:
                    462:       </p>
                    463: <pre class="programlisting">
                    464:     .section ".note.ident", "a"
                    465:     .p2align 2
                    466:     .long 1f - 0f           # name size (not including padding)
                    467:     .long 3f - 2f           # desc size (not including padding)
                    468:     .long 0x01234567        # type
                    469: 0:  .asciz "NaMe"          # name
                    470: 1:  .p2align 2
                    471: 2:  .long 0x76543210        # desc
                    472:     .long 0x89abcdef
                    473: 3:  .p2align 2
                    474: </pre>
                    475: 
                    476: <p>
                    477:   That example will create a section called ".note.ident", marked
                    478:   "allocate" (so that it will be turned into a
                    479:   <code class="constant">PT_NOTE</code> section during final link), which
                    480:   contains a single note.  That note has a <code class="varname">type</code> of
                    481:   <code class="code">0x012345678</code>, has the <code class="varname">name</code>
                    482:   <code class="code">"NaMe\0"</code>, and has a <code class="varname">desc</code> value
                    483:   consisting of two 4-byte integers, <code class="code">0x76543210</code> and
                    484:   <code class="code">0x89abcdef</code>.
                    485: </p>
                    486:     
                    487:       <h4 class="title">
1.39      maya      488: <a name="netbsd-note"></a>Creating a NetBSD ELF <code class="constant">PT_NOTE</code> Section</h4>
1.1       dsieger   489:       
                    490:       <p>
                    491:        The NetBSD kernel will return ENOEXEC if an ELF binary does not contain
                    492:        a recognized <code class="constant">PT_NOTE</code> section. Normally, <code class="filename">crtbegin.c</code>
                    493:        contains this section
                    494:        for native NetBSD applications. The example below creates such a section
1.10      martin    495:        on NetBSD/sparc. (Other ports may use slightly different assembler syntax,
                    496:        for example arm uses %note - since @ starts a comment,
1.1       dsieger   497:        but, except for endian variations, they all use the same bits.)
                    498:       </p>
                    499: <pre class="programlisting">
1.10      martin    500:         .section ".note.netbsd.ident", "", @note
1.1       dsieger   501:         .long   2f-1f
                    502:         .long   4f-3f
                    503:         .long   1
                    504: 1:      .asciz "NetBSD"
                    505: 2:      .p2align 2
1.10      martin    506: 3:      .long   499003600
1.1       dsieger   507: 4:      .p2align 2
                    508: </pre>
1.3       dsieger   509:     </div></div></div>
                    510: <div class="navfoot"></div>
1.13      mishka    511: <div id="footer"><div id="footerContent"><center>
1.33      maya      512: <span class="footfeed"><a href="//www.NetBSD.org/cgi-bin/feedback.cgi">
1.3       dsieger   513:          Contact</a> |
1.9       kano      514:       </span><span class="footcopy"><a href="../../about/disclaimer.html">
1.3       dsieger   515:       Disclaimer</a> |
                    516: 
1.61    ! maya      517:       <span class="copyright">Copyright © 1994-2025 The NetBSD Foundation, Inc. </span>ALL RIGHTS RESERVED.<br>NetBSD<sup>®</sup> is a registered trademark of The NetBSD
1.3       dsieger   518:        Foundation, Inc.</span>
1.13      mishka    519: </center></div></div>
1.1       dsieger   520: </div></body>
                    521: </html>

CVSweb <webmaster@jp.NetBSD.org>