Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How do we find out which object file is pulled in by the linker?

6 views
Skip to first unread message

Pritam

unread,
Nov 20, 2009, 8:51:23 PM11/20/09
to
Hi,
Two object files foo_1.o and foo_2.o each have the same function a()
defined and they
have no other functions. foo_1.o is in a library specified prior to
the library including
foo_2.o

The linker would pull in only foo_1.o in this case. What option can I
give to gcc / ld to verify the above statement?

I looked at
http://stackoverflow.com/questions/715502/how-do-linkers-decide-what-...

and


http://www.lurklurk.org/linkers/linkers.html#staticlibs


I understand the theory behind it, I am looking at how to get the
visible proof w.r.t. what the linker is actually doing w.r.t. pulling
in the object
files.

Pritam

Jan Seiffert

unread,
Nov 20, 2009, 9:00:42 PM11/20/09
to
Pritam schrieb:

This is not a GCC problem, but a problem with the linker.
You propably use the GNU binutils linker.
Please have a look at the Manual.
Maybe the --trace option helps.

(when invoking gcc as the linker driver pass it with -Wl,--trace to the linker)

> Pritam

Greetings
Jan

--
If you're sending someone Styrofoam, what do you pack it in?

Pritam

unread,
Nov 20, 2009, 9:25:46 PM11/20/09
to
> If you're sending someone Styrofoam, what do you pack it in?- Hide quoted text -
>
> - Show quoted text -

Excellent! That's exactly what I was looking for.
Cheers,
Pritam

0 new messages