Revert "output all sections if we produce an executable file"
-- Not a fix This reverts commit089ce6235c
. Revert "handle a -s option by executing sstrip/strip program" -- related, not a fix. This reverts commit5cd4393a54
.
This commit is contained in:
parent
9c5bb16447
commit
2d6aa65067
3 changed files with 1 additions and 14 deletions
3
libtcc.c
3
libtcc.c
|
@ -2292,8 +2292,6 @@ PUB_FUNC int tcc_parse_args(TCCState *s, int argc, char **argv)
|
||||||
case TCC_OPTION_dumpversion:
|
case TCC_OPTION_dumpversion:
|
||||||
printf ("%s\n", TCC_VERSION);
|
printf ("%s\n", TCC_VERSION);
|
||||||
exit(0);
|
exit(0);
|
||||||
case TCC_OPTION_s:
|
|
||||||
s->do_strip = 1;
|
|
||||||
break;
|
break;
|
||||||
case TCC_OPTION_traditional:
|
case TCC_OPTION_traditional:
|
||||||
break;
|
break;
|
||||||
|
@ -2314,6 +2312,7 @@ PUB_FUNC int tcc_parse_args(TCCState *s, int argc, char **argv)
|
||||||
break;
|
break;
|
||||||
case TCC_OPTION_pedantic:
|
case TCC_OPTION_pedantic:
|
||||||
case TCC_OPTION_pipe:
|
case TCC_OPTION_pipe:
|
||||||
|
case TCC_OPTION_s:
|
||||||
/* ignored */
|
/* ignored */
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
1
tcc.h
1
tcc.h
|
@ -622,7 +622,6 @@ struct TCCState {
|
||||||
|
|
||||||
/* compile with debug symbol (and use them if error during execution) */
|
/* compile with debug symbol (and use them if error during execution) */
|
||||||
int do_debug;
|
int do_debug;
|
||||||
int do_strip;
|
|
||||||
#ifdef CONFIG_TCC_BCHECK
|
#ifdef CONFIG_TCC_BCHECK
|
||||||
/* compile with built-in memory and bounds checker */
|
/* compile with built-in memory and bounds checker */
|
||||||
int do_bounds_check;
|
int do_bounds_check;
|
||||||
|
|
11
tccelf.c
11
tccelf.c
|
@ -2018,7 +2018,6 @@ static void alloc_sec_names(TCCState *s1, int file_type, Section *strsec)
|
||||||
s->sh_size = s->data_offset;
|
s->sh_size = s->data_offset;
|
||||||
} else if (s1->do_debug ||
|
} else if (s1->do_debug ||
|
||||||
file_type == TCC_OUTPUT_OBJ ||
|
file_type == TCC_OUTPUT_OBJ ||
|
||||||
file_type == TCC_OUTPUT_EXE ||
|
|
||||||
(s->sh_flags & SHF_ALLOC) ||
|
(s->sh_flags & SHF_ALLOC) ||
|
||||||
i == (s1->nb_sections - 1)) {
|
i == (s1->nb_sections - 1)) {
|
||||||
/* we output all sections if debug or object file */
|
/* we output all sections if debug or object file */
|
||||||
|
@ -2688,16 +2687,6 @@ static int elf_output_file(TCCState *s1, const char *filename)
|
||||||
|
|
||||||
/* Create the ELF file with name 'filename' */
|
/* Create the ELF file with name 'filename' */
|
||||||
ret = tcc_write_elf_file(s1, filename, phnum, phdr, file_offset, sec_order);
|
ret = tcc_write_elf_file(s1, filename, phnum, phdr, file_offset, sec_order);
|
||||||
if (s1->do_strip) {
|
|
||||||
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:
|
the_end:
|
||||||
tcc_free(s1->symtab_to_dynsym);
|
tcc_free(s1->symtab_to_dynsym);
|
||||||
tcc_free(sec_order);
|
tcc_free(sec_order);
|
||||||
|
|
Loading…
Reference in a new issue