[fpc-pascal] Trying to use gprof profiler, but linking keeps failing
mailinglists at geldenhuys.co.uk
mailinglists at geldenhuys.co.uk
Tue Mar 17 14:21:03 CET 2026
Hi. I wanted to use gprof to profile a binary of mine that has
performance problems. I'm trying to recompiled the fpgui framework and
the program with -O- and -pg but the framework fails at the linking
stage.
Linking target/fpgui-framework
bootstrap_program.pas(126,1) Warning: "crtbegin.o" not found, this will
probably cause a linking failure
bootstrap_program.pas(126,1) Warning: "crtend.o" not found, this will
probably cause a linking failure
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libc_nonshared.a(atexit.oS): in
function `atexit':
(.text+0x7): undefined reference to `__dso_handle'
/usr/bin/ld: target/fpgui-framework: hidden symbol `__dso_handle' isn't
defined
/usr/bin/ld: final link failed: bad value
bootstrap_program.pas(126,1) Error: Error while linking
bootstrap_program.pas(126,1) Fatal: There were 1 errors compiling
module, stopping
Fatal: Compilation aborted
Error: /data/devel/fpc-3.2.2/x86_64-linux/bin/ppcx64 returned an error
exitcode
Any ideas? I then did a google search and Gemini came back with this:
The -pg (gprof) flag doesn't work well with Free Pascal — it tries to
link against C runtime profiling infrastructure (crtbegin.o,
__dso_handle) that FPC's linker setup doesn't support.
Is this true?
Regards,
Graeme
More information about the fpc-pascal
mailing list