Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Nov 2004 11:38:33 -0800 (PST)
From:      Nehal <nehalmistry@gmx.net>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   gnu/74531: gcc doesn't link correctly if -pg specified
Message-ID:  <200411291938.iATJcX0o022815@Nehal.Home>
Resent-Message-ID: <200411291940.iATJe4WL090993@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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@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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200411291938.iATJcX0o022815>