From 5cd4393a542ef4c64df7dcbb3fbe3a629666239d Mon Sep 17 00:00:00 2001 From: seyko Date: Fri, 10 Apr 2015 06:53:48 +0300 Subject: handle a -s option by executing sstrip/strip program --- tccelf.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'tccelf.c') diff --git a/tccelf.c b/tccelf.c index 0adc3dc..5ca5089 100644 --- a/tccelf.c +++ b/tccelf.c @@ -2689,6 +2689,20 @@ 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 + } + } + } the_end: tcc_free(s1->symtab_to_dynsym); tcc_free(sec_order); -- cgit v1.3.1