aboutsummaryrefslogtreecommitdiff
path: root/tccelf.c
diff options
context:
space:
mode:
authorseyko <seyko2@gmail.com>2015-04-10 17:35:54 +0300
committerseyko <seyko2@gmail.com>2015-04-10 17:35:54 +0300
commit92efee6e52e6ae1a8cad8fa89da2db11b796295f (patch)
treeb99184cffe2613b8162d82c4ea8089c1258c7c01 /tccelf.c
parentd81611b6416a397f69272bffdb90506869e3fce8 (diff)
downloadtinycc-92efee6e52e6ae1a8cad8fa89da2db11b796295f.tar.gz
tinycc-92efee6e52e6ae1a8cad8fa89da2db11b796295f.tar.bz2
fix "handle a -s option" commit
for targets which don't support variable length arrays.
Diffstat (limited to 'tccelf.c')
-rw-r--r--tccelf.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/tccelf.c b/tccelf.c
index 98815e5..b9ca8b7 100644
--- a/tccelf.c
+++ b/tccelf.c
@@ -2689,18 +2689,14 @@ static int elf_output_file(TCCState *s1, const char *filename)
/* Create the ELF file with name 'filename' */
ret = tcc_write_elf_file(s1, filename, phnum, phdr, file_offset, sec_order);
if (s1->do_strip) {
- const char *strip = "sstrip "; // super strip utility from ELFkickers
- const char *null = " 2> /dev/null";
- int len = strlen(strip) + strlen(filename) + strlen(null) + 1;
- {
- int rc;
- char buf[len];
- sprintf(buf, "%s%s%s", strip, filename, null);
- rc = system(buf);
- if (rc) {
- system(buf+1); // call a strip utility from binutils
- }
- }
+ int rc;
+ const char *strip_cmd = "sstrip "; // super strip utility from ELFkickers
+ const char *null_dev = " 2> /dev/null";
+ char buf[1050];
+ snprintf(buf, sizeof(buf), "%s%s%s", strip_cmd, filename, null_dev);
+ rc = system(buf);
+ if (rc)
+ system(buf+1); // call a strip utility from binutils
}
the_end:
tcc_free(s1->symtab_to_dynsym);