Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 4 Nov 2011 10:38:59 +0100 (MET)
From: Pavel Kankovsky <peak@...o.troja.mff.cuni.cz>
To: owl-dev@...ts.openwall.com
Subject: Re: gcc -fomit-frame-pointer

On Fri, 4 Nov 2011, Solar Designer wrote:

> I think we could want to use "-fno-omit-frame-pointer
> -momit-leaf-frame-pointer" in our %optflags_lib_i686, even though this
> has slight performance impact.  Otherwise backtraces probably don't work
> even when debugging own code compiled with frame pointers enabled if it
> happens to crash or is interrupted while in a library.

It is possible to get a stack backtrace if explicit stack frame unwinding
data is available either in the form of DWARF CFI (in .debug_frame...) or
in the form of so-called exception frames (in .eh_frame...).

The latter is better for programs that need to introspect their own stacks
(assuming the can interpret the data) or for programs without debugging
info (stripped or not generated at all; on the other hand, .eh_frame can
add a considerable amount of bloat). It is enabled by -fexceptions (see
below), -funwind-tables or -fasynchronous-unwind-tables.


And to answer a related question from your another email:

> 7. What's the deal with Fedora's use of -fexceptions?  Why do they do it?

The options makes it possible to propagate exceptions through C code.
Example: a C++ program calls a function in a C library, the function
invokes a callback in the programs, and the callback throws an exception.
All hell breaks loose if the library was not compiled with -fexceptions.
(On the other hand, the converse is not necessarily true. All hell might
break loose even if -fexceptions is used. It depends on the function
whether it can handle being interrupted that way.)

As an extra free bonus -fexceptions makes the compiler generate
exceptions frames (see above) and that makes frame unwinding possible
even with -fomit-frame-pointer.

I am not sure what was their intention.


-- 
Pavel Kankovsky aka Peak                          / Jeremiah 9:21        \
"For death is come up into our MS Windows(tm)..." \ 21st century edition /


Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.