Rev 12 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 12 | Rev 13 | ||
|---|---|---|---|
| Line 54... | Line 54... | ||
| 54 | #define IS_TARGET_INTEL 0 |
54 | #define IS_TARGET_INTEL 0 |
| 55 | #define TARGET_TRIPLE "aarch64-unknown-nto-qnx8.0.0" |
55 | #define TARGET_TRIPLE "aarch64-unknown-nto-qnx8.0.0" |
| 56 | #else |
56 | #else |
| 57 | #error unsupported platform (not x86_64, not aarch64le). Please implement! |
57 | #error unsupported platform (not x86_64, not aarch64le). Please implement! |
| 58 | #endif |
58 | #endif |
| 59 | #define COMPILER "clang" |
59 | #define COMPILER "clang" |
| 60 | #define LINKER TARGET_TRIPLE "-ld" |
60 | #define LINKER TARGET_TRIPLE "-ld" |
| 61 | //#define LINKER "ld.lld" |
61 | //#define LINKER "ld.lld" |
| 62 | 62 | ||
| 63 | 63 | ||
| 64 | #define ARGMODE_SINGLE 0 |
64 | #define ARGMODE_SINGLE 0 |
| Line 238... | Line 238... | ||
| 238 | { |
238 | { |
| 239 | if (ARGV_CONTAINS_SINGLEARG ("-c")) |
239 | if (ARGV_CONTAINS_SINGLEARG ("-c")) |
| 240 | for (arg_index = 1; arg_index < argc; arg_index++) |
240 | for (arg_index = 1; arg_index < argc; arg_index++) |
| 241 | if (strcmp (argv[arg_index], "-shared") == 0) |
241 | if (strcmp (argv[arg_index], "-shared") == 0) |
| 242 | argv[arg_index] = ""; // HACK for GNU autotools: when compiling, wipe out the -shared flag to avoid a warning |
242 | argv[arg_index] = ""; // HACK for GNU autotools: when compiling, wipe out the -shared flag to avoid a warning |
| 243 | 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 |
243 | execvpe (COMPILER EXECUTABLE_SUFFIX, 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 |
| 244 | } |
244 | } |
| 245 | 245 | ||
| 246 | // collect source and object files in two separate lists |
246 | // collect source and object files in two separate lists |
| 247 | for (arg_index = 1; arg_index < argc; arg_index++) |
247 | for (arg_index = 1; arg_index < argc; arg_index++) |
| 248 | if ((strcmp (argv[arg_index - 1], "-o") != 0) // this arg is NOT preceded by "-o"... |
248 | if ((strcmp (argv[arg_index - 1], "-o") != 0) // this arg is NOT preceded by "-o"... |
| Line 268... | Line 268... | ||
| 268 | { |
268 | { |
| 269 | if (ARGV_CONTAINS_SINGLEARG ("-c")) |
269 | if (ARGV_CONTAINS_SINGLEARG ("-c")) |
| 270 | for (arg_index = 1; arg_index < argc; arg_index++) |
270 | for (arg_index = 1; arg_index < argc; arg_index++) |
| 271 | if (strcmp (argv[arg_index], "-shared") == 0) |
271 | if (strcmp (argv[arg_index], "-shared") == 0) |
| 272 | argv[arg_index] = ""; // HACK for GNU autotools: when compiling, wipe out the -shared flag to avoid a warning |
272 | argv[arg_index] = ""; // HACK for GNU autotools: when compiling, wipe out the -shared flag to avoid a warning |
| 273 | 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 |
273 | execvpe (COMPILER EXECUTABLE_SUFFIX, 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 |
| 274 | } |
274 | } |
| 275 | 275 | ||
| 276 | // collect -l flags |
276 | // collect -l flags |
| 277 | for (arg_index = 1; arg_index < argc; arg_index++) |
277 | for (arg_index = 1; arg_index < argc; arg_index++) |
| 278 | if ((strncmp (argv[arg_index], "-l", 2) == 0) && ((argv[arg_index])[2] != 0)) |
278 | if ((strncmp (argv[arg_index], "-l", 2) == 0) && ((argv[arg_index])[2] != 0)) |
| Line 1197... | Line 1197... | ||
| 1197 | for (arg_index = 0; arg_index < linker_argc; arg_index++) |
1197 | for (arg_index = 0; arg_index < linker_argc; arg_index++) |
| 1198 | fprintf (stderr, "%s%s%s\n", (arg_index > 0 ? "\t" : ""), linker_argv[arg_index], ((size_t) arg_index + 1 < linker_argc ? " \\" : "")); |
1198 | fprintf (stderr, "%s%s%s\n", (arg_index > 0 ? "\t" : ""), linker_argv[arg_index], ((size_t) arg_index + 1 < linker_argc ? " \\" : "")); |
| 1199 | fputs ("LINKER DRIVER: CONSTRUCTED COMMAND LINE END\n", stderr); |
1199 | fputs ("LINKER DRIVER: CONSTRUCTED COMMAND LINE END\n", stderr); |
| 1200 | } |
1200 | } |
| 1201 | 1201 | ||
| 1202 | execvpe (LINKER, linker_argv, envp); |
1202 | execvpe (LINKER EXECUTABLE_SUFFIX, linker_argv, envp); |
| 1203 | return (1); // unreachable code |
1203 | return (1); // unreachable code |
| 1204 | } |
1204 | } |