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

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

CVSweb <webmaster@jp.NetBSD.org>