forked from KolibriOS/kolibrios
TCC: Add -nobss option to not include BSS sections in output file.
git-svn-id: svn://kolibrios.org@8154 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
9c0ca4f346
commit
0fe740bca1
Binary file not shown.
@ -1,7 +1,7 @@
|
|||||||
CC = kos32-gcc
|
CC = kos32-gcc
|
||||||
LD = kos32-ld
|
LD = kos32-ld
|
||||||
|
|
||||||
SDK_DIR:= $(abspath ../../../contrib/sdk)
|
SDK_DIR:= $(abspath ../../../../../contrib/sdk)
|
||||||
|
|
||||||
#gcc 4.8
|
#gcc 4.8
|
||||||
#LDFLAGS = -static -nostdlib -T $(SDK_DIR)/sources/newlib/static.lds
|
#LDFLAGS = -static -nostdlib -T $(SDK_DIR)/sources/newlib/static.lds
|
||||||
|
@ -2038,7 +2038,8 @@ enum {
|
|||||||
TCC_OPTION_MD,
|
TCC_OPTION_MD,
|
||||||
TCC_OPTION_MF,
|
TCC_OPTION_MF,
|
||||||
TCC_OPTION_x,
|
TCC_OPTION_x,
|
||||||
TCC_OPTION_stack
|
TCC_OPTION_stack,
|
||||||
|
TCC_OPTION_nobss
|
||||||
};
|
};
|
||||||
|
|
||||||
#define TCC_OPTION_HAS_ARG 0x0001
|
#define TCC_OPTION_HAS_ARG 0x0001
|
||||||
@ -2100,6 +2101,7 @@ static const TCCOption tcc_options[] = {
|
|||||||
{ "MF", TCC_OPTION_MF, TCC_OPTION_HAS_ARG },
|
{ "MF", TCC_OPTION_MF, TCC_OPTION_HAS_ARG },
|
||||||
{ "x", TCC_OPTION_x, TCC_OPTION_HAS_ARG },
|
{ "x", TCC_OPTION_x, TCC_OPTION_HAS_ARG },
|
||||||
{ "stack", TCC_OPTION_stack, TCC_OPTION_HAS_ARG | TCC_OPTION_NOSEP},
|
{ "stack", TCC_OPTION_stack, TCC_OPTION_HAS_ARG | TCC_OPTION_NOSEP},
|
||||||
|
{ "nobss", TCC_OPTION_nobss, 0 },
|
||||||
{ NULL, 0, 0 },
|
{ NULL, 0, 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2432,6 +2434,9 @@ ST_FUNC int tcc_parse_args1(TCCState *s, int argc, char **argv)
|
|||||||
s->pe_stack_size = strtoul(optarg+1, NULL, 10);
|
s->pe_stack_size = strtoul(optarg+1, NULL, 10);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
case TCC_OPTION_nobss:
|
||||||
|
s->nobss = 1;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
if (s->warn_unsupported) {
|
if (s->warn_unsupported) {
|
||||||
unsupported_option:
|
unsupported_option:
|
||||||
|
@ -128,6 +128,8 @@ static void help(void)
|
|||||||
" -Bdir use 'dir' as tcc internal library and include path\n"
|
" -Bdir use 'dir' as tcc internal library and include path\n"
|
||||||
" -MD generate target dependencies for make\n"
|
" -MD generate target dependencies for make\n"
|
||||||
" -MF depfile put generated dependencies here\n"
|
" -MF depfile put generated dependencies here\n"
|
||||||
|
"For KolibriOS only:\n"
|
||||||
|
" -nobss do not emit BSS section into file\n"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -871,6 +871,7 @@ struct TCCState {
|
|||||||
int do_bench; /* option -bench */
|
int do_bench; /* option -bench */
|
||||||
int gen_deps; /* option -MD */
|
int gen_deps; /* option -MD */
|
||||||
char *deps_outfile; /* option -MF */
|
char *deps_outfile; /* option -MF */
|
||||||
|
int nobss; /* option -nobss, omit BSS section (KolibriOS-only) */
|
||||||
ParseArgsState *parse_args_state;
|
ParseArgsState *parse_args_state;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -273,14 +273,17 @@ int tcc_output_me(TCCState* s1,const char *filename)
|
|||||||
fwrite(si->data,1,si->data_size,f);
|
fwrite(si->data,1,si->data_size,f);
|
||||||
for (si=me.data_sections;si;si=si->next)
|
for (si=me.data_sections;si;si=si->next)
|
||||||
fwrite(si->data,1,si->data_size,f);
|
fwrite(si->data,1,si->data_size,f);
|
||||||
for (si=me.bss_sections;si;si=si->next)
|
if (!s1->nobss)
|
||||||
{
|
{
|
||||||
if (si->data == NULL)
|
for (si=me.bss_sections;si;si=si->next)
|
||||||
{
|
{
|
||||||
// printf("\nError! BSS data is NULL! size:%i",(int)si->data_size);
|
if (si->data == NULL)
|
||||||
si->data = calloc(si->data_size, 1);
|
{
|
||||||
}
|
// printf("\nError! BSS data is NULL! size:%i",(int)si->data_size);
|
||||||
fwrite(si->data, 1, si->data_size, f);
|
si->data = calloc(si->data_size, 1);
|
||||||
|
}
|
||||||
|
fwrite(si->data, 1, si->data_size, f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
if (me.bss_sections) // Siemargl testin, what we lose
|
if (me.bss_sections) // Siemargl testin, what we lose
|
||||||
|
Loading…
Reference in New Issue
Block a user