On 2023-11-23 06:13, Theo Buehler wrote:
On Thu, Nov 23, 2023 at 06:04:42AM -0700, j...@bitminer.ca wrote:
SYNOPSIS: using -pg with cc results in segfault
CATEGORY: system
ENVIRONMENT:
System : OpenBSD 7.4
Details : OpenBSD 7.4-current (GENERIC) #1399: Wed Nov 22
08:12:44 MST 2023
dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC
Architecture: OpenBSD.amd64
Machine : amd64
DESCRIPTION:
Is gprof and related compiler switches expected to work?
Or, in reading the backtrace, is there an issue with issetugid?
Or, is this some syscall issue (see end of dmesg)?
HOW-TO-REPEAT:
$ cat m.c
#include <stdio.h>
#include <math.h>
int
main() {
printf("m.c PI is %f\n", M_PI);
}
$ cc -o m.x m.c -lm
$ ./m.x
m.c PI is 3.141593
$ cc -o m.x -pg m.c -lm
I forget what the explanation was that you run into the issetugid()
in ld.so, but the workaround is to link statically.
Right, this one
https://marc.info/?l=openbsd-bugs&m=168111266409055&w=2
I should have searched a little harder...thanks for the tip.
J
$ ./m.x
Segmentation fault