This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Building glibc with -finstrument-functions
- From: Bogdan Harjoc <harjoc at gmail dot com>
- To: libc-help at sourceware dot org
- Date: Fri, 25 Aug 2017 16:15:27 +0300
- Subject: Building glibc with -finstrument-functions
- Authentication-results: sourceware.org; auth=none
I'm trying to log the calls made by an app prior to a crash, including
libc calls. I've used the -finstrument-functions support in gcc with
my own libs but I can't build glibc with this instrumentation (I tried
with glibc 2.26 and 2.19, and gcc 6.3 and 5.4).
I added -finstrument-functions to libc_extra_cflags in 'configure' but
the build fails with "undefined reference to __libc_multiple_libcs"
and "multiple definition of _dl_signal_error" when linking
libc_pic.os. Building works fine without the instrumentation flags.
(running "CFLAGS=-finstrument-functions ./configure" doesn't work
because the configure tests fail since they don't define
__cyg_profile_func_enter/_exit).
I'm currently trying to figure out how to add instrumentation per
module (stdlib, io, string, etc) and looking through
libc/foo/Makefile's, it should be possible using e.g. CFLAGS_stdlib =
-finstrument-functions but the flag doesn't show up in gcc commands.
Is there a way to add per-module flags to the glibc build, or is glibc
known not to work with -finstrument-functions ?
Thanks,
Bogdan