This repository was archived by the owner on Sep 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathdietfeatures.h
219 lines (172 loc) · 7.61 KB
/
dietfeatures.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
#ifndef _DIETFEATURES_H
#define _DIETFEATURES_H
/* feel free to comment some of these out to reduce code size */
/* On i386, BSD socket syscalls have traditionally been implemented via
* a multiplexing syscall called "socketcall". But somewhere in the 3.x
* cycle, Linux got real syscalls for socket(), accept() etc, and now
* it would make sense to use those syscalls instead, if only to make
* seccomp sandboxes more platform agnostic. However, if you plan on
* running your program on an ancient kernel, you need the socketcall
* version instead. */
#define WANT_I386_SOCKETCALL
#define WANT_FLOATING_POINT_IN_PRINTF
#define WANT_FLOATING_POINT_IN_SCANF
#define WANT_CHARACTER_CLASSES_IN_SCANF
#define WANT_NULL_PRINTF
/* #define WANT_ERROR_PRINTF */
#define WANT_LONGLONG_PRINTF
#define WANT_LONGLONG_SCANF
/* 128 or 2048 bytes buffer size? */
/* #define WANT_SMALL_STDIO_BUFS */
/* want fread to read() directly if size of data is larger than buffer?
* This costs a few bytes but is worth it if the application is already
* buffering. */
#define WANT_FREAD_OPTIMIZATION
/* this is only for meaningful for ttyname and sysconf_cpus so far */
#define SLASH_PROC_OK
/* use errno_location instead of errno; NEEDED FOR MULTI-THREADING! */
#define WANT_THREAD_SAFE
/* support __thread; NEEDED FOR MULTI-THREADING! */
#define WANT_TLS
/* run constructors/destructors of static objects,
* and functions with __attribute__((constructor)) */
#define WANT_CTOR
/* call __register_frame_info so C++ exception handling works */
#define WANT_EXCEPTIONS
/* GDB support in the dynamic linker */
#define WANT_LD_SO_GDB_SUPPORT
/* do you want smaller or faster string routines? */
#define WANT_FASTER_STRING_ROUTINES
/* define this to have strncpy and stpncpy zero-fill and not just
* zero-terminate the destination string */
/* #define WANT_FULL_POSIX_COMPAT */
/* on i386, Linux has an alternate syscall method since 2002/12/16 */
/* on my Athlon XP, it is twice as fast, but it's only in kernel 2.5 */
/* 20040118: enabling this breaks User Mode Linux! It's their fault. */
#define WANT_SYSENTER
#define WANT_LINKER_WARNINGS
/* you need to define this if you want to run your programs with large
* file support on kernel 2.2 or 2.0 */
#define WANT_LARGEFILE_BACKCOMPAT
/* do you want localtime(3) to read /etc/localtime?
* Needed for daylight saving time etc. */
#define WANT_TZFILE_PARSER
/* do you want the DNS routines to parse and use "domain" and "search"
* lines from /etc/resolv.conf? Normally not used on boot floppies and
* embedded environments. */
#define WANT_FULL_RESOLV_CONF
/* do you want IPv6 transport support in the DNS resolver? */
#define WANT_IPV6_DNS
/* do you want gethostbyname and friends to consult /etc/hosts? */
#define WANT_ETC_HOSTS
/* do you want gethostbyname to understand dotted decimal IP numbers
* directly and not try to resolve them? */
#define WANT_INET_ADDR_DNS
/* do you want math functions high precision rather than fast/small? */
#define WANT_HIGH_PRECISION_MATH
/* do you want support for matherr? */
#define WANT_MATHERR
/* do you want crypt(3) to use MD5 if the salt starts with "$1$"? */
#define WANT_CRYPT_MD5
/* do you want crypt(3) to use SHA256 if the salt starts with "$5$? */
#define WANT_CRYPT_SHA256
/* do you want crypt(3) to use SHA512 if the salt starts with "$6$? */
#define WANT_CRYPT_SHA512
/* do you want diet to include a safeguard dependency to make linking
* against glibc fail? This may fail with older binutils. */
#define WANT_SAFEGUARD
/* This enables zeroconf DNS aka Rendezvous aka Bonjour. */
/* This code will try zeroconf DNS if you ask for host.local or if you
* ask for an unqualified hostname */
#define WANT_PLUGPLAY_DNS
/* This enables LLMNR, the MS variant of zeroconf DNS. This only works
* if you also enabled WANT_PLUGPLAY_DNS */
#define WANT_LLMNR
/* Uncomment this if you want DNS lookups to fail if /etc/hosts contains
* an entry but it's for a different record type */
/* #define WANT_HOSTS_GIVEUP_EARLY */
/* Do you want valgrind support? If enabled, the startup code will
* check for valgrind, and if detected, turn off optimized SIMD string
* routines that cause false positives in valgrind. This enlarges and
* slightly slows down your code! */
#define WANT_VALGRIND_SUPPORT
/* do you want that malloc(0) return a pointer to a "zero-length" object
* that is realloc-able; means realloc(..,size) gives a NEW object (like a
* call to malloc(size)).
* WARNING: this violates C99 */
/* #define WANT_MALLOC_ZERO */
/* do you want free to overwrite freed data immediately, in the hope of
* catching people accessing pointers after they were freed? This does
* a memset with 0x55 as a value. which is not NULL and not -1. Please
* note that this is the shotgun method for debugging, what you really
* want is valgrind. */
/* #define WANT_FREE_OVERWRITE */
/* This enables a stack gap. Basically, the start code does not run
* main but stackgap, which then does alloca(random()) and calls main.
* The effect is that buffer overflow exploits will no longer be able to
* know the address of the buffer. Cost: 62 bytes code on x86. */
/* WARNING: this appears to break with some binutils versions. Works
* for me with binutils 2.15. The symptom is an error message that
* `main' can not be found. */
/* #define WANT_STACKGAP */
/* For SSP initialization, dietlibc usually uses randomness given by the
* kernel in the ELF auxvec. Some very old kernels do not pass this, and
* for them dietlibc will open /dev/urandom to get randomness. Undef
* this if you don't need that bloat. */
// #define WANT_URANDOM_SSP
/* #define this if you want GNU bloat like program_invocation_short_name
* and program_invocation_name to be there. This functionality is not
* portable and adds useless bloat to libc. Help stomp out code
* depending on this! util-linux, I'm looking at you here! */
#define WANT_GNU_STARTUP_BLOAT
/* Include support for ProPolice/SSP, calls guard_setup */
/* ProPolice is part of gcc 4.1 and up, there were patches for earlier
* versions. To make use of this, compile your application with
* -fstack-protector. */
/* If you compile dietlibc without WANT_SSP and then try to link code
* compiled with -fstack-protector against it, the binary will segfault
* when calling that code. */
#if (__GNUC__>4) || ((__GNUC__==4) && (__GNUC_MINOR__>=1))
#define WANT_SSP
#endif
/* Some platforms like x86_64, ppc* or mips do not have a fixed PAGE_SIZE.
* Select WANT_DYN_PAGESIZE to detect the current PAGE_SIZE at runtime. Else,
* define WANT_STATIC_PAGESIZE to a proper value (must be a power of 2)
* matching the configured pagesize of the kernel where your binaries are
* running on.
*
* Selecting WANT_DYN_PAGESIZE enlarges the startup code by around 1-3
* instructions and might add an additional __elfinfo symbol */
#define WANT_DYN_PAGESIZE
/* #define WANT_STATIC_PAGESIZE 0x10000UL */
/* stop uncommenting here ;-) */
/* Several 'syscalls' on x86_64 need vdso set... */
#if defined(__x86_64__) && ! defined(WANT_STACKGAP)
#define WANT_STACKGAP
#endif
#if defined(WANT_SSP) || defined(WANT_STACKGAP) || defined(WANT_TLS)
#define CALL_IN_STARTCODE stackgap
#define CALL_IN_STARTCODE_PIE stackgap_pie
#else
#define CALL_IN_STARTCODE main
#endif
#ifndef WANT_FASTER_STRING_ROUTINES
#define WANT_SMALL_STRING_ROUTINES
#endif
#ifdef __DYN_LIB
/* with shared libraries you MUST have a dynamic aware startcode */
#ifndef WANT_CTOR
#define WANT_CTOR
#endif
/* safeguard crashes with shared objects ... */
#ifdef WANT_SAFEGUARD
#undef WANT_SAFEGUARD
#endif
#endif
#if defined(__x86_64__) && defined(__ILP32__)
#undef WANT_LARGEFILE_BACKCOMPAT
#endif
#ifdef WANT_DYN_PAGESIZE
#define WANT_ELFINFO
#endif
#endif