Rev 5 | Rev 8 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 5 | Rev 7 | ||
|---|---|---|---|
| Line 51... | Line 51... | ||
| 51 | #define IS_TARGET_INTEL 0 |
51 | #define IS_TARGET_INTEL 0 |
| 52 | #define TARGET_TRIPLE "aarch64-unknown-nto-qnx8.0.0" |
52 | #define TARGET_TRIPLE "aarch64-unknown-nto-qnx8.0.0" |
| 53 | #else |
53 | #else |
| 54 | #error unsupported platform (not x86_64, not aarch64le). Please implement! |
54 | #error unsupported platform (not x86_64, not aarch64le). Please implement! |
| 55 | #endif |
55 | #endif |
| - | 56 | #define COMPILER "clang" |
|
| 56 | #define LINKER TARGET_TRIPLE "-ld" |
57 | #define LINKER TARGET_TRIPLE "-ld" |
| 57 | 58 | ||
| 58 | 59 | ||
| 59 | #define ARGMODE_SINGLE 0 |
60 | #define ARGMODE_SINGLE 0 |
| 60 | #define ARGMODE_HASVAL 1 |
61 | #define ARGMODE_HASVAL 1 |
| Line 164... | Line 165... | ||
| 164 | || ARGV_CONTAINS_SINGLEARG ("-c") |
165 | || ARGV_CONTAINS_SINGLEARG ("-c") |
| 165 | || ARGV_CONTAINS_SINGLEARG ("-M") |
166 | || ARGV_CONTAINS_SINGLEARG ("-M") |
| 166 | || ARGV_CONTAINS_SINGLEARG ("-MM") |
167 | || ARGV_CONTAINS_SINGLEARG ("-MM") |
| 167 | || ARGV_CONTAINS_SINGLEARG ("-E") |
168 | || ARGV_CONTAINS_SINGLEARG ("-E") |
| 168 | || ARGV_CONTAINS_SINGLEARG ("-S")) |
169 | || ARGV_CONTAINS_SINGLEARG ("-S")) |
| 169 | { |
- | |
| 170 | argv[0] = "clang"; |
- | |
| 171 | execvpe ( |
170 | execvpe (COMPILER, argv, envp); // by leaving argv[0] untouched, we will be invoking Clang as 'gcc', which will give it a supplemental hint about how to behave |
| 172 | } |
- | |
| 173 | 171 | ||
| 174 | // collect source files |
172 | // collect source and object files in two separate lists |
| 175 | for (arg_index = 1; arg_index < argc; arg_index++) |
173 | for (arg_index = 1; arg_index < argc; arg_index++) |
| 176 | if ((strcmp (argv[arg_index - 1], "-o") != 0) // this arg is NOT preceded by "-o"... |
174 | if ((strcmp (argv[arg_index - 1], "-o") != 0) // this arg is NOT preceded by "-o"... |
| 177 | && (access (argv[arg_index], 0) == 0) // ... this arg is an existing file... |
175 | && (access (argv[arg_index], 0) == 0) // ... this arg is an existing file... |
| 178 | && ((arg = strrchr (argv[arg_index], '.')) != NULL)) // this filename has an extension (FIXME: what if "-x <language>" is specified?) |
176 | && ((arg = strrchr (argv[arg_index], '.')) != NULL)) // this filename has an extension (FIXME: what if "-x <language>" is specified?) |
| 179 | { |
177 | { |
| Line 191... | Line 189... | ||
| 191 | ADD_O_ARG (argv[arg_index]); // this file is NOT one of the known file extensions: add to object files list |
189 | ADD_O_ARG (argv[arg_index]); // this file is NOT one of the known file extensions: add to object files list |
| 192 | } |
190 | } |
| 193 | 191 | ||
| 194 | // if we have zero .o file, OR if we have some source files, we have to compile first |
192 | // if we have zero .o file, OR if we have some source files, we have to compile first |
| 195 | if ((sarg_count > 0) || (oarg_count == 0)) |
193 | if ((sarg_count > 0) || (oarg_count == 0)) |
| 196 | { |
- | |
| 197 | argv[0] = "clang"; |
- | |
| 198 | execvpe ( |
194 | execvpe (COMPILER, argv, envp); // by leaving argv[0] untouched, we will be invoking Clang as 'gcc', which will give it a supplemental hint about how to behave |
| 199 | } |
- | |
| 200 | 195 | ||
| 201 | // collect -l flags |
196 | // collect -l flags |
| 202 | for (arg_index = 1; arg_index < argc; arg_index++) |
197 | for (arg_index = 1; arg_index < argc; arg_index++) |
| 203 | if ((strncmp (argv[arg_index], "-l", 2) == 0) && ((argv[arg_index])[2] != 0)) |
198 | if ((strncmp (argv[arg_index], "-l", 2) == 0) && ((argv[arg_index])[2] != 0)) |
| 204 | ADD_L_ARG (argv[arg_index]); |
199 | ADD_L_ARG (argv[arg_index]); |