Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Wed, 05 Nov 2014 15:36:36 +0100
From: John Spencer <>
Subject: Re: undefined reference to `mcount'

Shwetabh wrote:
> Hello Everyone ,
> I am trying to link a normal hello world program with musl-libc with -pg
> option ( for profiling with gprof) following error i am getting
> shwetabh@...etabh-Aspire-4930:~/study/musl-1.1.5$
> /usr/local/musl/bin/musl-gcc -pg hello.c
> /tmp/ccdspYkY.o: In function `main':
> hello.c:(.text+0xa): undefined reference to `mcount'
> collect2: error: ld returned 1 exit status
> without -pg option i am able to successfully link the program and can able
> to execute it .
> Requesting anyone to please provide the workaround for the error.

there is no workaround.
using the -pg option of gcc emits code that assumes helper functionality 
and special startup code provided by glibc.
as those startup functions need to be written in assembly, no one felt 
the urge to implement them for musl yet.
especially since the "perf" tool (part of the kernel source or 
distributed as a package in your distro) provides a much better 
profiling facility that works with all existing binaries.


Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.