• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2   In OpenSSL, opensslconf.h was generated by Configure script with
3   specifying a target argument, where it includes several defines that
4   depend on OS and architecture platform.
5 
6   In node, we statically mapped --dest-os and --dest-cpu options in
7   configure to the target of Configure in OpenSSL and make
8   `deps/openssl/conf/openssconf.h` so as to include each file
9   according to its target by checking pre-defined compiler macros.
10 
11   Included opnesslconf.h files for supported target architectures can
12   be generated by `Makefile` and stored under
13   `archs/{target}/asm/opensslconf.h`. The Makefile also fixes several
14   defines to meet node build requirements.
15 
16   Here is a map table of configure options in node, target arch of
17   Configure in OpenSSL and CI support.
18 
19   | --dest-os | --dest-cpu | OpenSSL target arch  | CI  |
20   | --------- | ---------- | -------------------- | --- |
21   | aix       | ppc        | aix-gcc              | o   |
22   | aix       | ppc64      | aix64-gcc-as         | o   |
23   | linux     | ia32       | linux-elf            | o   |
24   | linux     | x32        | linux-x32            | -   |
25   | linux     | x64        | linux-x86_64         | o   |
26   | linux     | arm        | linux-armv4          | o   |
27   | linux     | arm64      | linux-aarch64        | o   |
28   | linux     | ppc        | linux-ppc            | o   |
29   | linux     | ppc64      | linux-ppc64          | o   |
30   | linux     | ppc64      | linux-ppc64le        | o   | (node_byteoder: little)
31   | linux     | s390       | linux32-s390x        | o   |
32   | linux     | s390x      | linux64-s390x        | o   |
33   | mac       | ia32       | darwin-i386-cc       | -   |
34   | mac       | x64        | darwin64-x86-cc      | o   |
35   | mac       | arm64      | darwin64-arm64-cc    | -   |
36   | win       | ia32       | VC-WIN32             | -   |
37   | win       | x64        | VC-WIN64A            | o   |
38   | solaris   | ia32       | solaris-x86-gcc      | o   |
39   | solaris   | x64        | solaris64-x86_64-gcc | o   |
40   | freebsd   | ia32       | BSD-x86              | -   |
41   | freebsd   | x64        | BSD-x86_64           | o   |
42   | openbsd   | ia32       | BSD-x86              | -   |
43   | openbsd   | x64        | BSD-x86_64           | -   |
44   | others    | others     | linux-elf            | -   |
45 
46   --dest-os and --dest-cpu are mapped to pre-defined macros.
47 
48   | --dest-os          | pre-defined macro         |
49   | ------------------ | ------------------------- |
50   | aix                | _AIX                      |
51   | win                | _WIN32                    |
52   | win(64bit)         | _WIN64                    |
53   | mac                | __APPLE__ && __MACH__     |
54   | solaris            | __sun                     |
55   | freebsd            | __FreeBSD__               |
56   | openbsd            | __OpenBSD__               |
57   | linux (not andorid)| __linux__ && !__ANDROID__ |
58   | android            | __ANDROID__               |
59 
60   | --dest-cpu | pre-defined macro |
61   | ---------- | ----------------- |
62   | arm        | __arm__           |
63   | arm64      | __aarch64__       |
64   | ia32       | __i386__          |
65   | ia32(win)  | _M_IX86           |
66   | mips       | __mips__          |
67   | mipsel     | __MIPSEL__        |
68   | x32        | __ILP32__         |
69   | x64        | __x86_64__        |
70   | x64(win)   | _M_X64            |
71   | ppc        | __PPC__           |
72   |            | _ARCH_PPC         |
73   | ppc64      | __PPC64__         |
74   |            | _ARCH_PPC64       |
75   | s390       | __s390__          |
76   | s390x      | __s390x__         |
77 
78   These are the list which is not implemented yet.
79 
80   | --dest-os | --dest-cpu | OpenSSL target arch  | CI  |
81   | --------- | ---------- | -------------------- | --- |
82   | linux     | mips       | linux-mips32,linux-mips64,linux64-mips64? | --- |
83   | linux     | mipsel     | ?                    | --- |
84   | android   | ia32       | android-x86          | --- |
85   | android   | arm        | android-armv7        | --- |
86   | android   | mips       | android-mips         | --- |
87   | android   | mipsel     | ?                    | --- |
88 
89   Supported target arch list in OpenSSL can be obtained by typing
90   `deps/openssl/openssl/Configure LIST`.
91 
92 */
93 
94 #if defined(OPENSSL_LINUX) && defined(__i386__)
95 # include "./archs/linux-elf/asm/include/openssl/opensslconf.h"
96 #elif defined(OPENSSL_LINUX) && defined(__x86_64__)
97 # include "./archs/linux-x86_64/asm/include/openssl/opensslconf.h"
98 #elif defined(OPENSSL_LINUX) && defined(__arm__)
99 # include "./archs/linux-armv4/asm/include/openssl/opensslconf.h"
100 #elif defined(OPENSSL_LINUX) && defined(__aarch64__)
101 # include "./archs/linux-aarch64/asm/include/openssl/opensslconf.h"
102 #elif defined(__APPLE__) && defined(__MACH__) && defined(__i386__)
103 # include "./archs/darwin-i386-cc/asm/include/openssl/opensslconf.h"
104 #elif defined(__APPLE__) && defined(__MACH__) && defined(__x86_64__)
105 # include "./archs/darwin64-x86_64-cc/asm/include/openssl/opensslconf.h"
106 #elif defined(__APPLE__) && defined(__MACH__) && defined(__arm64__)
107 # include "./archs/darwin64-arm64-cc/asm/include/openssl/opensslconf.h"
108 #elif defined(_WIN32) && defined(_M_IX86)
109 # include "./archs/VC-WIN32/asm/include/openssl/opensslconf.h"
110 #elif defined(_WIN32) && defined(_M_X64)
111 # include "./archs/VC-WIN64A/asm/include/openssl/opensslconf.h"
112 #elif (defined(__FreeBSD__) || defined(__OpenBSD__)) && defined(__i386__)
113 # include "./archs/BSD-x86/asm/include/openssl/opensslconf.h"
114 #elif (defined(__FreeBSD__) || defined(__OpenBSD__)) && defined(__x86_64__)
115 # include "./archs/BSD-x86_64/asm/include/openssl/opensslconf.h"
116 #elif defined(__sun) && defined(__i386__)
117 # include "./archs/solaris-x86-gcc/asm/include/openssl/opensslconf.h"
118 #elif defined(__sun) && defined(__x86_64__)
119 # include "./archs/solaris64-x86_64-gcc/asm/include/openssl/opensslconf.h"
120 #elif defined(OPENSSL_LINUX) && defined(__PPC64__) && defined(L_ENDIAN)
121 # include "./archs/linux-ppc64le/asm/include/openssl/opensslconf.h"
122 #elif defined(OPENSSL_LINUX) && defined(__PPC64__)
123 # include "./archs/linux-ppc64/asm/include/openssl/opensslconf.h"
124 #elif defined(OPENSSL_LINUX) && !defined(__PPC64__) && defined(__ppc__)
125 # include "./archs/linux-ppc/asm/include/openssl/opensslconf.h"
126 #elif defined(_AIX) && defined(_ARCH_PPC64)
127 # include "./archs/aix64-gcc-as/asm/include/openssl/opensslconf.h"
128 #elif defined(_AIX) && !defined(_ARCH_PPC64) && defined(_ARCH_PPC)
129 # include "./archs/aix-gcc/asm/include/openssl/opensslconf.h"
130 #elif defined(OPENSSL_LINUX) && defined(__s390x__)
131 # include "./archs/linux64-s390x/asm/include/openssl/opensslconf.h"
132 #elif defined(OPENSSL_LINUX) && defined(__s390__)
133 # include "./archs/linux32-s390x/asm/include/openssl/opensslconf.h"
134 #elif defined(OPENSSL_LINUX) && defined(__mips64) && defined(__MIPSEL__)
135 # include "./archs/linux64-mips64/asm/include/openssl/opensslconf.h"
136 #else
137 # include "./archs/linux-elf/asm/include/openssl/opensslconf.h"
138 #endif
139