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

P

prix prad

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?

Pritam
 
P

prix prad

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?

Pritam

I basically looked at
http://stackoverflow.com/questions/715502/how-do-linkers-decide-what-parts-of-libraries-to-include

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
 
K

Keith Thompson

prix prad said:
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?

That's not a C question. You might try asking in gnu.gcc.help.
 
P

prix prad

That's not a C question.  You might try asking in gnu.gcc.help.

--
Keith Thompson (The_Other_Keith) (e-mail address removed)  <http://www.ghoti.net/~kst>
Nokia
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

Sure, will do.
Thanks,
Pritam
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top