public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Why does -g force .cfi_* directives?
@ 2021-02-18  5:21 Fangrui Song
  2021-02-19 22:51 ` Jim Wilson
  0 siblings, 1 reply; 9+ messages in thread
From: Fangrui Song @ 2021-02-18  5:21 UTC (permalink / raw)
  To: gcc-help; +Cc: i

g++ -fno-exceptions -fno-asynchronous-unwind-tables -S a.cc => no
.cfi_* directive
g++ -fno-exceptions -fno-asynchronous-unwind-tables -g -S a.cc =>
there are .cfi_* directive

C++ exceptions passing through -fno-exceptions frames have undefined behaviors.
Without .eh_frame, the traditional behavior is std::terminate() as a
result of _Unwind_RaiseException returning _URC_END_OF_STACK.

So -fno-asynchronous-unwind-tables is a good way to detect C++
exceptions passing through -fno-exceptions frames.
-g (imagine a build which always turns on debug information) forcing
.cfi_* defeats such usage.
(I can understand that if .debug_frame is used (rare), -g always forces .cfi_*)

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-02-26  7:09 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-18  5:21 Why does -g force .cfi_* directives? Fangrui Song
2021-02-19 22:51 ` Jim Wilson
2021-02-20  0:36   ` Fangrui Song
2021-02-20  0:38     ` Fangrui Song
2021-02-20  3:53     ` Jim Wilson
2021-02-20  4:30       ` -fno-asynchronous-unwind-tables && .cfi_* in inline asm Fangrui Song
2021-02-22 19:08         ` Jim Wilson
2021-02-20 19:43       ` Why does -g force .cfi_* directives? Segher Boessenkool
2021-02-26  7:09         ` Fangrui Song

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).