| 1 | /* Copyright (C) 1999-2022 Free Software Foundation, Inc. |
| 2 | This file is part of the GNU C Library. |
| 3 | |
| 4 | The GNU C Library is free software; you can redistribute it and/or |
| 5 | modify it under the terms of the GNU Lesser General Public |
| 6 | License as published by the Free Software Foundation; either |
| 7 | version 2.1 of the License, or (at your option) any later version. |
| 8 | |
| 9 | The GNU C Library is distributed in the hope that it will be useful, |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | Lesser General Public License for more details. |
| 13 | |
| 14 | You should have received a copy of the GNU Lesser General Public |
| 15 | License along with the GNU C Library; if not, see |
| 16 | <https://www.gnu.org/licenses/>. */ |
| 17 | |
| 18 | #ifndef _UNISTD_H |
| 19 | # error "Never include this file directly. Use <unistd.h> instead" |
| 20 | #endif |
| 21 | |
| 22 | #include <bits/wordsize.h> |
| 23 | |
| 24 | /* This header should define the following symbols under the described |
| 25 | situations. A value `1' means that the model is always supported, |
| 26 | `-1' means it is never supported. Undefined means it cannot be |
| 27 | statically decided. |
| 28 | |
| 29 | _POSIX_V7_ILP32_OFF32 32bit int, long, pointers, and off_t type |
| 30 | _POSIX_V7_ILP32_OFFBIG 32bit int, long, and pointers and larger off_t type |
| 31 | |
| 32 | _POSIX_V7_LP64_OFF32 64bit long and pointers and 32bit off_t type |
| 33 | _POSIX_V7_LPBIG_OFFBIG 64bit long and pointers and large off_t type |
| 34 | |
| 35 | The macros _POSIX_V6_ILP32_OFF32, _POSIX_V6_ILP32_OFFBIG, |
| 36 | _POSIX_V6_LP64_OFF32, _POSIX_V6_LPBIG_OFFBIG, _XBS5_ILP32_OFF32, |
| 37 | _XBS5_ILP32_OFFBIG, _XBS5_LP64_OFF32, and _XBS5_LPBIG_OFFBIG were |
| 38 | used in previous versions of the Unix standard and are available |
| 39 | only for compatibility. |
| 40 | */ |
| 41 | |
| 42 | #if __WORDSIZE == 64 |
| 43 | |
| 44 | /* Environments with 32-bit wide pointers are optionally provided. |
| 45 | Therefore following macros aren't defined: |
| 46 | # undef _POSIX_V7_ILP32_OFF32 |
| 47 | # undef _POSIX_V7_ILP32_OFFBIG |
| 48 | # undef _POSIX_V6_ILP32_OFF32 |
| 49 | # undef _POSIX_V6_ILP32_OFFBIG |
| 50 | # undef _XBS5_ILP32_OFF32 |
| 51 | # undef _XBS5_ILP32_OFFBIG |
| 52 | and users need to check at runtime. */ |
| 53 | |
| 54 | /* We also have no use (for now) for an environment with bigger pointers |
| 55 | and offsets. */ |
| 56 | # define _POSIX_V7_LPBIG_OFFBIG -1 |
| 57 | # define _POSIX_V6_LPBIG_OFFBIG -1 |
| 58 | # define _XBS5_LPBIG_OFFBIG -1 |
| 59 | |
| 60 | /* By default we have 64-bit wide `long int', pointers and `off_t'. */ |
| 61 | # define _POSIX_V7_LP64_OFF64 1 |
| 62 | # define _POSIX_V6_LP64_OFF64 1 |
| 63 | # define _XBS5_LP64_OFF64 1 |
| 64 | |
| 65 | #else /* __WORDSIZE == 32 */ |
| 66 | |
| 67 | /* We have 32-bit wide `int', `long int' and pointers and all platforms |
| 68 | support LFS. -mx32 has 64-bit wide `off_t'. */ |
| 69 | # define _POSIX_V7_ILP32_OFFBIG 1 |
| 70 | # define _POSIX_V6_ILP32_OFFBIG 1 |
| 71 | # define _XBS5_ILP32_OFFBIG 1 |
| 72 | |
| 73 | # ifndef __x86_64__ |
| 74 | /* -m32 has 32-bit wide `off_t'. */ |
| 75 | # define _POSIX_V7_ILP32_OFF32 1 |
| 76 | # define _POSIX_V6_ILP32_OFF32 1 |
| 77 | # define _XBS5_ILP32_OFF32 1 |
| 78 | # endif |
| 79 | |
| 80 | /* We optionally provide an environment with the above size but an 64-bit |
| 81 | side `off_t'. Therefore we don't define _POSIX_V7_ILP32_OFFBIG. */ |
| 82 | |
| 83 | /* Environments with 64-bit wide pointers can be provided, |
| 84 | so these macros aren't defined: |
| 85 | # undef _POSIX_V7_LP64_OFF64 |
| 86 | # undef _POSIX_V7_LPBIG_OFFBIG |
| 87 | # undef _POSIX_V6_LP64_OFF64 |
| 88 | # undef _POSIX_V6_LPBIG_OFFBIG |
| 89 | # undef _XBS5_LP64_OFF64 |
| 90 | # undef _XBS5_LPBIG_OFFBIG |
| 91 | and sysconf tests for it at runtime. */ |
| 92 | |
| 93 | #endif /* __WORDSIZE == 32 */ |
| 94 | |
| 95 | #define __ILP32_OFF32_CFLAGS "-m32" |
| 96 | #define __ILP32_OFF32_LDFLAGS "-m32" |
| 97 | #if defined __x86_64__ && defined __ILP32__ |
| 98 | # define __ILP32_OFFBIG_CFLAGS "-mx32" |
| 99 | # define __ILP32_OFFBIG_LDFLAGS "-mx32" |
| 100 | #else |
| 101 | # define __ILP32_OFFBIG_CFLAGS "-m32 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" |
| 102 | # define __ILP32_OFFBIG_LDFLAGS "-m32" |
| 103 | #endif |
| 104 | #define __LP64_OFF64_CFLAGS "-m64" |
| 105 | #define __LP64_OFF64_LDFLAGS "-m64" |
| 106 | |