R
R
Robotex2013-06-26 13:55:43
GCC
Robotex, 2013-06-26 13:55:43

What is flag_function_sections in gcc sources?

I'm trying to compile gcc-4.2 sources (or rather llvm-gcc-4.2). However, I am getting an error:

../../llvm-gcc-4.2-2.9/gcc/toplev.c: In function ‘process_options’:
../../llvm-gcc-4.2-2.9/gcc/toplev.c:1995:11: error: ‘flag_function_sections’ undeclared (first use in this function)
../../llvm-gcc-4.2-2.9/gcc/toplev.c:1995:11: note: each undeclared identifier is reported only once for each function it appears in

What kind of variable is this and where should it be declared (there are also flag_data_sections nearby)?
When I made the announcement:
int flag_function_sections = 0;
  int flag_data_sections = 0;

the error went away, but got out in another file (I feel there are many such places). So what is this variable and how to correctly declare it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Door, 2013-06-26
@Door

gcc 4.7.0The definition is not found in the source flag_function_sections, it appears in the file gcc/common.opt:

ffunction-sections
Common Report Var(flag_function_sections)
Place each function into its own section

File description:
Options for the language- and target-independent parts of the compiler

Found some old toplev.c file . There is something
/* Nonzero means place each function into its own section on those platforms
   which support arbitrary section names and unlimited numbers of sections.  */

int flag_function_sections = 0;

/* ... and similar for data.  */

int flag_data_sections = 0;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question