blob: 2d34e1d40091214e6a1fe6eb49c20d7e9245aff2 [file] [log] [blame]
Elliott Hughes180edef2023-11-02 00:08:05 +00001/*
2 * This file is auto-generated. Modifications will be lost.
3 *
4 * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
5 * for more information.
6 */
Ben Cheng655a7c02013-10-16 16:09:24 -07007#ifndef _UAPI__A_OUT_GNU_H__
8#define _UAPI__A_OUT_GNU_H__
9#define __GNU_EXEC_MACROS__
10#ifndef __STRUCT_EXEC_OVERRIDE__
Ben Cheng655a7c02013-10-16 16:09:24 -070011#include <asm/a.out.h>
12#endif
13#ifndef __ASSEMBLY__
14enum machine_type {
Ben Cheng655a7c02013-10-16 16:09:24 -070015#ifdef M_OLDSUN2
Tao Baod7db5942015-01-28 10:07:51 -080016 M__OLDSUN2 = M_OLDSUN2,
Ben Cheng655a7c02013-10-16 16:09:24 -070017#else
Tao Baod7db5942015-01-28 10:07:51 -080018 M_OLDSUN2 = 0,
Ben Cheng655a7c02013-10-16 16:09:24 -070019#endif
20#ifdef M_68010
Tao Baod7db5942015-01-28 10:07:51 -080021 M__68010 = M_68010,
Ben Cheng655a7c02013-10-16 16:09:24 -070022#else
Tao Baod7db5942015-01-28 10:07:51 -080023 M_68010 = 1,
Ben Cheng655a7c02013-10-16 16:09:24 -070024#endif
25#ifdef M_68020
Tao Baod7db5942015-01-28 10:07:51 -080026 M__68020 = M_68020,
Ben Cheng655a7c02013-10-16 16:09:24 -070027#else
Tao Baod7db5942015-01-28 10:07:51 -080028 M_68020 = 2,
Ben Cheng655a7c02013-10-16 16:09:24 -070029#endif
30#ifdef M_SPARC
Tao Baod7db5942015-01-28 10:07:51 -080031 M__SPARC = M_SPARC,
Ben Cheng655a7c02013-10-16 16:09:24 -070032#else
Tao Baod7db5942015-01-28 10:07:51 -080033 M_SPARC = 3,
Ben Cheng655a7c02013-10-16 16:09:24 -070034#endif
Tao Baod7db5942015-01-28 10:07:51 -080035 M_386 = 100,
36 M_MIPS1 = 151,
37 M_MIPS2 = 152
Ben Cheng655a7c02013-10-16 16:09:24 -070038};
Ben Cheng655a7c02013-10-16 16:09:24 -070039#ifndef N_MAGIC
40#define N_MAGIC(exec) ((exec).a_info & 0xffff)
41#endif
Tao Baod7db5942015-01-28 10:07:51 -080042#define N_MACHTYPE(exec) ((enum machine_type) (((exec).a_info >> 16) & 0xff))
Ben Cheng655a7c02013-10-16 16:09:24 -070043#define N_FLAGS(exec) (((exec).a_info >> 24) & 0xff)
Tao Baod7db5942015-01-28 10:07:51 -080044#define N_SET_INFO(exec,magic,type,flags) ((exec).a_info = ((magic) & 0xffff) | (((int) (type) & 0xff) << 16) | (((flags) & 0xff) << 24))
45#define N_SET_MAGIC(exec,magic) ((exec).a_info = (((exec).a_info & 0xffff0000) | ((magic) & 0xffff)))
46#define N_SET_MACHTYPE(exec,machtype) ((exec).a_info = ((exec).a_info & 0xff00ffff) | ((((int) (machtype)) & 0xff) << 16))
Tao Baod7db5942015-01-28 10:07:51 -080047#define N_SET_FLAGS(exec,flags) ((exec).a_info = ((exec).a_info & 0x00ffffff) | (((flags) & 0xff) << 24))
Ben Cheng655a7c02013-10-16 16:09:24 -070048#define OMAGIC 0407
49#define NMAGIC 0410
50#define ZMAGIC 0413
Ben Cheng655a7c02013-10-16 16:09:24 -070051#define QMAGIC 0314
52#define CMAGIC 0421
53#ifndef N_BADMAG
Tao Baod7db5942015-01-28 10:07:51 -080054#define N_BADMAG(x) (N_MAGIC(x) != OMAGIC && N_MAGIC(x) != NMAGIC && N_MAGIC(x) != ZMAGIC && N_MAGIC(x) != QMAGIC)
Ben Cheng655a7c02013-10-16 16:09:24 -070055#endif
Tao Baod7db5942015-01-28 10:07:51 -080056#define _N_HDROFF(x) (1024 - sizeof(struct exec))
Ben Cheng655a7c02013-10-16 16:09:24 -070057#ifndef N_TXTOFF
Tao Baod7db5942015-01-28 10:07:51 -080058#define N_TXTOFF(x) (N_MAGIC(x) == ZMAGIC ? _N_HDROFF((x)) + sizeof(struct exec) : (N_MAGIC(x) == QMAGIC ? 0 : sizeof(struct exec)))
Ben Cheng655a7c02013-10-16 16:09:24 -070059#endif
60#ifndef N_DATOFF
61#define N_DATOFF(x) (N_TXTOFF(x) + (x).a_text)
62#endif
Ben Cheng655a7c02013-10-16 16:09:24 -070063#ifndef N_TRELOFF
64#define N_TRELOFF(x) (N_DATOFF(x) + (x).a_data)
65#endif
66#ifndef N_DRELOFF
Ben Cheng655a7c02013-10-16 16:09:24 -070067#define N_DRELOFF(x) (N_TRELOFF(x) + N_TRSIZE(x))
68#endif
69#ifndef N_SYMOFF
70#define N_SYMOFF(x) (N_DRELOFF(x) + N_DRSIZE(x))
Ben Cheng655a7c02013-10-16 16:09:24 -070071#endif
72#ifndef N_STROFF
73#define N_STROFF(x) (N_SYMOFF(x) + N_SYMSIZE(x))
74#endif
Ben Cheng655a7c02013-10-16 16:09:24 -070075#ifndef N_TXTADDR
76#define N_TXTADDR(x) (N_MAGIC(x) == QMAGIC ? PAGE_SIZE : 0)
77#endif
Ben Cheng655a7c02013-10-16 16:09:24 -070078#include <unistd.h>
79#if defined(__i386__) || defined(__mc68000__)
80#define SEGMENT_SIZE 1024
Ben Cheng655a7c02013-10-16 16:09:24 -070081#else
82#ifndef SEGMENT_SIZE
83#define SEGMENT_SIZE getpagesize()
84#endif
Ben Cheng655a7c02013-10-16 16:09:24 -070085#endif
Ben Cheng655a7c02013-10-16 16:09:24 -070086#define _N_SEGMENT_ROUND(x) ALIGN(x, SEGMENT_SIZE)
Tao Baod7db5942015-01-28 10:07:51 -080087#define _N_TXTENDADDR(x) (N_TXTADDR(x) + (x).a_text)
Ben Cheng655a7c02013-10-16 16:09:24 -070088#ifndef N_DATADDR
Tao Baod7db5942015-01-28 10:07:51 -080089#define N_DATADDR(x) (N_MAGIC(x) == OMAGIC ? (_N_TXTENDADDR(x)) : (_N_SEGMENT_ROUND(_N_TXTENDADDR(x))))
Ben Cheng655a7c02013-10-16 16:09:24 -070090#endif
91#ifndef N_BSSADDR
Ben Cheng655a7c02013-10-16 16:09:24 -070092#define N_BSSADDR(x) (N_DATADDR(x) + (x).a_data)
93#endif
94#ifndef N_NLIST_DECLARED
95struct nlist {
Tao Baod7db5942015-01-28 10:07:51 -080096 union {
97 char * n_name;
98 struct nlist * n_next;
99 long n_strx;
Tao Baod7db5942015-01-28 10:07:51 -0800100 } n_un;
101 unsigned char n_type;
102 char n_other;
103 short n_desc;
Tao Baod7db5942015-01-28 10:07:51 -0800104 unsigned long n_value;
Ben Cheng655a7c02013-10-16 16:09:24 -0700105};
106#endif
107#ifndef N_UNDF
Ben Cheng655a7c02013-10-16 16:09:24 -0700108#define N_UNDF 0
109#endif
110#ifndef N_ABS
111#define N_ABS 2
Ben Cheng655a7c02013-10-16 16:09:24 -0700112#endif
113#ifndef N_TEXT
114#define N_TEXT 4
115#endif
Ben Cheng655a7c02013-10-16 16:09:24 -0700116#ifndef N_DATA
117#define N_DATA 6
118#endif
119#ifndef N_BSS
Ben Cheng655a7c02013-10-16 16:09:24 -0700120#define N_BSS 8
121#endif
122#ifndef N_FN
123#define N_FN 15
Ben Cheng655a7c02013-10-16 16:09:24 -0700124#endif
125#ifndef N_EXT
126#define N_EXT 1
127#endif
Ben Cheng655a7c02013-10-16 16:09:24 -0700128#ifndef N_TYPE
129#define N_TYPE 036
130#endif
131#ifndef N_STAB
Ben Cheng655a7c02013-10-16 16:09:24 -0700132#define N_STAB 0340
133#endif
134#define N_INDR 0xa
135#define N_SETA 0x14
Ben Cheng655a7c02013-10-16 16:09:24 -0700136#define N_SETT 0x16
137#define N_SETD 0x18
138#define N_SETB 0x1A
139#define N_SETV 0x1C
Ben Cheng655a7c02013-10-16 16:09:24 -0700140#ifndef N_RELOCATION_INFO_DECLARED
Tao Baod7db5942015-01-28 10:07:51 -0800141struct relocation_info {
142 int r_address;
143 unsigned int r_symbolnum : 24;
Tao Baod7db5942015-01-28 10:07:51 -0800144 unsigned int r_pcrel : 1;
145 unsigned int r_length : 2;
146 unsigned int r_extern : 1;
Tao Baod7db5942015-01-28 10:07:51 -0800147 unsigned int r_pad : 4;
Ben Cheng655a7c02013-10-16 16:09:24 -0700148};
Ben Cheng655a7c02013-10-16 16:09:24 -0700149#endif
Ben Cheng655a7c02013-10-16 16:09:24 -0700150#endif
151#endif