When using -pg in combination with optimizations (e.g. -O3), compiled programs crash in the profiling routine mcount().
This is because mcount (on x86_64 at least) relies on the frame pointer to be valid. See test case to reproduce.
This diff makes sure that the driver does not pass -fomit-frame-pointer or -momit-leaf-frame-pointer to the frontend when -pg is used. Currently, clang gives an error if -fomit-frame-pointer is used in combination with -pg, but -momit-leaf-frame-pointer was forgotten.
Also, disable frame pointer elimination in the frontend when -pg is set.
The behavior is consistent with gcc now: clang produces an error if -fomit-frame-pointer is used with -pg, and silently disables -momit-leaf-frame-pointer when -pg is used.