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

Nehal nehalmistry at gmx.net
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
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Nov 29 19:40:03 GMT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Nehal Mistry
>Release:        FreeBSD 5.3-RELEASE i386
>Organization:
>Environment:
System: FreeBSD Nehal.Home 5.3-RELEASE FreeBSD 5.3-RELEASE #0: Fri Nov 5 04:19:18 UTC 2004 root at harlow.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386


	
>Description:
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.
	
>How-To-Repeat:
try to compile the attached test with:
gcc -pg prof_test.c `sdl11-config --cflags --libs`
	
>Fix:

	

--- prof_test.c begins here ---

#include "SDL11/SDL.h"

int main()
{
    SDL_Init(SDL_INIT_TIMER);

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


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list