xref: /minix3/libexec/ld.elf_so/sysident.h (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc /* $NetBSD: sysident.h,v 1.17 2014/01/12 19:36:08 joerg Exp $ */
2e83f7ba2SBen Gras 
3e83f7ba2SBen Gras /*
4e83f7ba2SBen Gras  * Copyright (c) 1997 Christopher G. Demetriou
5e83f7ba2SBen Gras  * All rights reserved.
6e83f7ba2SBen Gras  *
7e83f7ba2SBen Gras  * Redistribution and use in source and binary forms, with or without
8e83f7ba2SBen Gras  * modification, are permitted provided that the following conditions
9e83f7ba2SBen Gras  * are met:
10e83f7ba2SBen Gras  * 1. Redistributions of source code must retain the above copyright
11e83f7ba2SBen Gras  *    notice, this list of conditions and the following disclaimer.
12e83f7ba2SBen Gras  * 2. Redistributions in binary form must reproduce the above copyright
13e83f7ba2SBen Gras  *    notice, this list of conditions and the following disclaimer in the
14e83f7ba2SBen Gras  *    documentation and/or other materials provided with the distribution.
15e83f7ba2SBen Gras  * 3. All advertising materials mentioning features or use of this software
16e83f7ba2SBen Gras  *    must display the following acknowledgement:
17e83f7ba2SBen Gras  *          This product includes software developed for the
18e83f7ba2SBen Gras  *          NetBSD Project.  See http://www.NetBSD.org/ for
19e83f7ba2SBen Gras  *          information about NetBSD.
20e83f7ba2SBen Gras  * 4. The name of the author may not be used to endorse or promote products
21e83f7ba2SBen Gras  *    derived from this software without specific prior written permission.
22e83f7ba2SBen Gras  *
23e83f7ba2SBen Gras  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
24e83f7ba2SBen Gras  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
25e83f7ba2SBen Gras  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26e83f7ba2SBen Gras  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
27e83f7ba2SBen Gras  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
28e83f7ba2SBen Gras  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29e83f7ba2SBen Gras  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30e83f7ba2SBen Gras  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31e83f7ba2SBen Gras  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
32e83f7ba2SBen Gras  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33e83f7ba2SBen Gras  *
34e83f7ba2SBen Gras  * <<Id: LICENSE,v 1.2 2000/06/14 15:57:33 cgd Exp>>
35e83f7ba2SBen Gras  */
36e83f7ba2SBen Gras 
37e83f7ba2SBen Gras /*
38e83f7ba2SBen Gras  * Here we define the NetBSD OS Version in an ELF .note section, structured
39e83f7ba2SBen Gras  * like:
40e83f7ba2SBen Gras  *
41e83f7ba2SBen Gras  * [NOTE HEADER]
42e83f7ba2SBen Gras  *	long		name size
43e83f7ba2SBen Gras  *	long		description size
44e83f7ba2SBen Gras  *	long		note type
45e83f7ba2SBen Gras  *
46e83f7ba2SBen Gras  * [NOTE DATUM]
47e83f7ba2SBen Gras  *	string		OS name
48e83f7ba2SBen Gras  *
49e83f7ba2SBen Gras  * OSVERSION notes also have:
50e83f7ba2SBen Gras  *	long		OS version (__NetBSD_Version__ constant from param.h)
51e83f7ba2SBen Gras  *
52e83f7ba2SBen Gras  * The DATUM fields should be padded out such that their actual (not
53e83f7ba2SBen Gras  * declared) sizes % 4 == 0.
54e83f7ba2SBen Gras  *
55e83f7ba2SBen Gras  * These are used by the kernel to determine if this binary is really a
56e83f7ba2SBen Gras  * NetBSD binary, or some other OS's.
57e83f7ba2SBen Gras  */
58e83f7ba2SBen Gras 
59e83f7ba2SBen Gras /* XXX: NetBSD 1.5 compatibility only! */
60e83f7ba2SBen Gras #if __NetBSD_Version__ < 105010000
61e83f7ba2SBen Gras #define	ELF_NOTE_TYPE_NETBSD_TAG	1
62e83f7ba2SBen Gras #endif
63e83f7ba2SBen Gras 
64e83f7ba2SBen Gras #define	__S(x)	__STRING(x)
65e83f7ba2SBen Gras __asm(
66*0a6a1f1dSLionel Sambuc 	".pushsection\t\".note.netbsd.ident\", \"a\"\n"
67e83f7ba2SBen Gras 	"\t.p2align\t2\n\n"
68e83f7ba2SBen Gras 
69e83f7ba2SBen Gras 	"\t.long\t" __S(ELF_NOTE_NETBSD_NAMESZ) "\n"
70e83f7ba2SBen Gras 	"\t.long\t" __S(ELF_NOTE_NETBSD_DESCSZ) "\n"
71e83f7ba2SBen Gras 	"\t.long\t" __S(ELF_NOTE_TYPE_NETBSD_TAG) "\n"
72e83f7ba2SBen Gras 	"\t.ascii\t" __S(ELF_NOTE_NETBSD_NAME) "\n"
73e83f7ba2SBen Gras 	"\t.long\t" __S(__NetBSD_Version__) "\n\n"
74e83f7ba2SBen Gras 
75*0a6a1f1dSLionel Sambuc 	"\t.popsection\n"
76e83f7ba2SBen Gras );
77e83f7ba2SBen Gras 
78e83f7ba2SBen Gras __asm(
79*0a6a1f1dSLionel Sambuc 	".pushsection\t\".note.netbsd.pax\", \"a\"\n"
80e83f7ba2SBen Gras 	"\t.p2align\t2\n\n"
81e83f7ba2SBen Gras 
82e83f7ba2SBen Gras 	"\t.long\t" __S(ELF_NOTE_PAX_NAMESZ) "\n"
83e83f7ba2SBen Gras 	"\t.long\t" __S(ELF_NOTE_PAX_DESCSZ) "\n"
84e83f7ba2SBen Gras 	"\t.long\t" __S(ELF_NOTE_TYPE_PAX_TAG) "\n"
85e83f7ba2SBen Gras 	"\t.ascii\t" __S(ELF_NOTE_PAX_NAME) "\n"
86e83f7ba2SBen Gras 	"\t.long\t" __S(0) "\n\n"
87e83f7ba2SBen Gras 
88*0a6a1f1dSLionel Sambuc 	"\t.popsection\n"
89e83f7ba2SBen Gras );
9084d9c625SLionel Sambuc 
9184d9c625SLionel Sambuc #ifdef ELF_NOTE_MARCH_DESC
9284d9c625SLionel Sambuc __asm(
93*0a6a1f1dSLionel Sambuc 	".pushsection\t\".note.netbsd.march\", \"a\"\n"
9484d9c625SLionel Sambuc 	"\t.p2align\t2\n\n"
9584d9c625SLionel Sambuc 
9684d9c625SLionel Sambuc 	"\t.long\t" __S(ELF_NOTE_MARCH_NAMESZ) "\n"
9784d9c625SLionel Sambuc 	"\t.long\t2f-1f\n"
9884d9c625SLionel Sambuc 	"\t.long\t" __S(ELF_NOTE_TYPE_MARCH_TAG) "\n"
9984d9c625SLionel Sambuc 	"\t.ascii\t" __S(ELF_NOTE_MARCH_NAME) "\n"
10084d9c625SLionel Sambuc 	"1:\t.asciz\t" __S(ELF_NOTE_MARCH_DESC) "\n"
10184d9c625SLionel Sambuc 	"2:\n"
10284d9c625SLionel Sambuc 
103*0a6a1f1dSLionel Sambuc 	"\t.popsection\n"
10484d9c625SLionel Sambuc );
10584d9c625SLionel Sambuc #endif
106