gnu/74531: gcc doesn't link correctly if -pg specified

Nehal nehalmistry at
Mon Nov 29 11:40:04 PST 2004

>Number:         74531
>Category:       gnu
>Synopsis:       gcc doesn't link correctly if -pg specified
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Nov 29 19:40:03 GMT 2004
>Originator:     Nehal Mistry
>Release:        FreeBSD 5.3-RELEASE i386
System: FreeBSD Nehal.Home 5.3-RELEASE FreeBSD 5.3-RELEASE #0: Fri Nov 5 04:19:18 UTC 2004 root at i386

compiling the attached test normally with:
    gcc prof_test.c `sdl11-config --cflags --libs`
works fine. but if you want to add profiling support with:
    gcc -pg prof_test.c `sdl11-config --cflags --libs`
it will give a bunch of linking errors. adding '-lc' will 
fix the linking errors, but will core dump when run because of
the linking order. adding '-lpthread -lc' is the only way to 
have it link and run without any problems.

i believe this is a bug, i don't see how profiling should
change the behaviour of linking.
try to compile the attached test with:
gcc -pg prof_test.c `sdl11-config --cflags --libs`


--- prof_test.c begins here ---

#include "SDL11/SDL.h"

int main()

    return 0;
--- prof_test.c ends here ---


More information about the freebsd-bugs mailing list