Revert "handle a -s option by executing sstrip/strip program" -- related, not a fix. This reverts commit 5cd4393a542ef4c64df7dcbb3fbe3a629666239d.
Unified · Split
| @@ -2292,8 +2292,6 @@ PUB_FUNC int tcc_parse_args(TCCState *s, int argc, char **argv) · 2291 unmodified lines | |||
| 2292 | case TCC_OPTION_dumpversion: | 2292 | case TCC_OPTION_dumpversion: |
| 2293 | printf ("%s\n", TCC_VERSION); | 2293 | printf ("%s\n", TCC_VERSION); |
| 2294 | exit(0); | 2294 | exit(0); |
| 2295 | case TCC_OPTION_s: | ||
| 2296 | s->do_strip = 1; | ||
| 2297 | break; | 2295 | break; |
| 2298 | case TCC_OPTION_traditional: | 2296 | case TCC_OPTION_traditional: |
| 2299 | break; | 2297 | break; |
| @@ -2314,6 +2312,7 @@ PUB_FUNC int tcc_parse_args(TCCState *s, int argc, char **argv) · 14 unmodified lines | |||
| 2314 | break; | 2312 | break; |
| 2315 | case TCC_OPTION_pedantic: | 2313 | case TCC_OPTION_pedantic: |
| 2316 | case TCC_OPTION_pipe: | 2314 | case TCC_OPTION_pipe: |
| 2315 | case TCC_OPTION_s: | ||
| 2317 | /* ignored */ | 2316 | /* ignored */ |
| 2318 | break; | 2317 | break; |
| 2319 | default: | 2318 | default: |
| @@ -622,7 +622,6 @@ struct TCCState { · 621 unmodified lines | |||
| 622 | 622 | ||
| 623 | /* compile with debug symbol (and use them if error during execution) */ | 623 | /* compile with debug symbol (and use them if error during execution) */ |
| 624 | int do_debug; | 624 | int do_debug; |
| 625 | int do_strip; | ||
| 626 | #ifdef CONFIG_TCC_BCHECK | 625 | #ifdef CONFIG_TCC_BCHECK |
| 627 | /* compile with built-in memory and bounds checker */ | 626 | /* compile with built-in memory and bounds checker */ |
| 628 | int do_bounds_check; | 627 | int do_bounds_check; |
| @@ -2018,7 +2018,6 @@ static void alloc_sec_names(TCCState *s1, int file_type, Section *strsec) · 2017 unmodified lines | |||
| 2018 | s->sh_size = s->data_offset; | 2018 | s->sh_size = s->data_offset; |
| 2019 | } else if (s1->do_debug || | 2019 | } else if (s1->do_debug || |
| 2020 | file_type == TCC_OUTPUT_OBJ || | 2020 | file_type == TCC_OUTPUT_OBJ || |
| 2021 | file_type == TCC_OUTPUT_EXE || | ||
| 2022 | (s->sh_flags & SHF_ALLOC) || | 2021 | (s->sh_flags & SHF_ALLOC) || |
| 2023 | i == (s1->nb_sections - 1)) { | 2022 | i == (s1->nb_sections - 1)) { |
| 2024 | /* we output all sections if debug or object file */ | 2023 | /* we output all sections if debug or object file */ |
| @@ -2688,16 +2687,6 @@ static int elf_output_file(TCCState *s1, const char *filename) · 663 unmodified lines | |||
| 2688 | 2687 | ||
| 2689 | /* Create the ELF file with name 'filename' */ | 2688 | /* Create the ELF file with name 'filename' */ |
| 2690 | ret = tcc_write_elf_file(s1, filename, phnum, phdr, file_offset, sec_order); | 2689 | ret = tcc_write_elf_file(s1, filename, phnum, phdr, file_offset, sec_order); |
| 2691 | if (s1->do_strip) { | ||
| 2692 | int rc; | ||
| 2693 | const char *strip_cmd = "sstrip "; // super strip utility from ELFkickers | ||
| 2694 | const char *null_dev = " 2> /dev/null"; | ||
| 2695 | char buf[1050]; | ||
| 2696 | snprintf(buf, sizeof(buf), "%s%s%s", strip_cmd, filename, null_dev); | ||
| 2697 | rc = system(buf); | ||
| 2698 | if (rc) | ||
| 2699 | system(buf+1); // call a strip utility from binutils | ||
| 2700 | } | ||
| 2701 | the_end: | 2690 | the_end: |
| 2702 | tcc_free(s1->symtab_to_dynsym); | 2691 | tcc_free(s1->symtab_to_dynsym); |
| 2703 | tcc_free(sec_order); | 2692 | tcc_free(sec_order); |