Add -s option

This commit is contained in:
Rui Ueyama 2020-09-19 21:00:04 +09:00
parent bc2527944a
commit c32f0e21e7
1 changed files with 10 additions and 0 deletions

10
main.c
View File

@ -14,6 +14,8 @@ static bool opt_cc1;
static bool opt_hash_hash_hash; static bool opt_hash_hash_hash;
static char *opt_o; static char *opt_o;
static StringArray ld_extra_args;
char *base_file; char *base_file;
static char *output_file; static char *output_file;
@ -167,6 +169,11 @@ static void parse_args(int argc, char **argv) {
continue; continue;
} }
if (!strcmp(argv[i], "-s")) {
strarray_push(&ld_extra_args, "-s");
continue;
}
if (!strcmp(argv[i], "-cc1-input")) { if (!strcmp(argv[i], "-cc1-input")) {
base_file = argv[++i]; base_file = argv[++i];
continue; continue;
@ -451,6 +458,9 @@ static void run_linker(StringArray *inputs, char *output) {
strarray_push(&arr, "-L/usr/lib"); strarray_push(&arr, "-L/usr/lib");
strarray_push(&arr, "-L/lib"); strarray_push(&arr, "-L/lib");
for (int i = 0; i < ld_extra_args.len; i++)
strarray_push(&arr, ld_extra_args.data[i]);
for (int i = 0; i < inputs->len; i++) for (int i = 0; i < inputs->len; i++)
strarray_push(&arr, inputs->data[i]); strarray_push(&arr, inputs->data[i]);