From c32f0e21e71f43e64a7b98c9d96d4c513d42ba37 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Sat, 19 Sep 2020 21:00:04 +0900 Subject: [PATCH] Add -s option --- main.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/main.c b/main.c index a1763c4..1fcaed6 100644 --- a/main.c +++ b/main.c @@ -14,6 +14,8 @@ static bool opt_cc1; static bool opt_hash_hash_hash; static char *opt_o; +static StringArray ld_extra_args; + char *base_file; static char *output_file; @@ -167,6 +169,11 @@ static void parse_args(int argc, char **argv) { continue; } + if (!strcmp(argv[i], "-s")) { + strarray_push(&ld_extra_args, "-s"); + continue; + } + if (!strcmp(argv[i], "-cc1-input")) { base_file = argv[++i]; continue; @@ -451,6 +458,9 @@ static void run_linker(StringArray *inputs, char *output) { strarray_push(&arr, "-L/usr/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++) strarray_push(&arr, inputs->data[i]);