This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: problem in glibc backtrace done inside nptl library

On Tue, Jun 17, 2008 at 12:27 PM, Vinu Rajashekhar <> wrote:
> I used addr2line function and it is showing the functions,
> but I used the -fno-inline and -fno-inline-functions in compiling the files
> like pthread_mutex_init.c and other nptl files, is there something else
> I need to add to make it not inline like in the linking stage ?
> I couldnt use the -O0 flag because there is some problem during glibc build
> if I use that.

>From the glibc FAQ:
1.23.   Why do I get:
        `#error "glibc cannot be compiled without optimization"',
        when trying to compile GNU libc with GNU CC?

{AJ,CO} There are a couple of reasons why the GNU C library will not work
correctly if it is not complied with optimzation.

In the early startup of the dynamic loader (_dl_start), before
relocation of the PLT, you cannot make function calls. You must inline
the functions you will use during early startup, or call compiler
builtins (__builtin_*).

Without optimizations enabled GNU CC will not inline functions. The
early startup of the dynamic loader will make function calls via an
unrelocated PLT and crash.

Without auditing the dynamic linker code it would be difficult to remove
this requirement.

Another reason is that nested functions must be inlined in many cases to
avoid executable stacks.

In practice there is no reason to compile without optimizations, therefore
we require that GNU libc be compiled with optimizations enabled.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]