On Mon, Feb 21, 2022 at 10:20:17AM +0100, Marc Espie wrote: > On Mon, Feb 21, 2022 at 05:36:16PM +0900, Yuichiro NAITO wrote: > > Of course, all programs compiled without '-pg' work fine for me. > > I found this issue when I profile my application with gprof(1). > > For example, following example C source code fails to execute on OpenBSD > > 7.0. > > Profile is partly broken and has been for a while. > > Compiling with -static and removing any pledge() call allow profiling to work.
Yes, and the proposed patch effectively enables -static if -pg is used. I don't know if this the best fix. But this issue keeps popping up and it would be nice to have something that works out of the box. I would not mind this patch going in. Pledge and unveil interfering with profiling is a separate issue which is more obvious when it occurs and can easily be worked around by the developer.
