for targets which don't support variable length arrays.
Unified · Split
| @@ -2689,18 +2689,14 @@ static int elf_output_file(TCCState *s1, const char *filename) · 2688 unmodified lines | ||
| 2689 | 2689 | /* Create the ELF file with name 'filename' */ |
| 2690 | 2690 | ret = tcc_write_elf_file(s1, filename, phnum, phdr, file_offset, sec_order); |
| 2691 | 2691 | if (s1->do_strip) { |
| 2692 | − const char *strip = "sstrip "; // super strip utility from ELFkickers | |
| 2693 | − const char *null = " 2> /dev/null"; | |
| 2694 | − int len = strlen(strip) + strlen(filename) + strlen(null) + 1; | |
| 2695 | − { | |
| 2696 | − int rc; | |
| 2697 | − char buf[len]; | |
| 2698 | − sprintf(buf, "%s%s%s", strip, filename, null); | |
| 2699 | − rc = system(buf); | |
| 2700 | − if (rc) { | |
| 2701 | − system(buf+1); // call a strip utility from binutils | |
| 2702 | − } | |
| 2703 | − } | |
| 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 | |
| 2704 | 2700 | } |
| 2705 | 2701 | the_end: |
| 2706 | 2702 | tcc_free(s1->symtab_to_dynsym); |