Re: Questions about linking.
Diagram (1) is how it is done. When an executable is loaded it is
allocated 2 segments in it's own LDT (5 in reality, but only 2 are
relevant). These are the text and data segment, stack and bss are
loaded into data segment. This segment must be of continuous memory so
having the parts all split up as is (2) wouldn't make sense at all.
-ivan
Re: Questions about linking.
Ivan Kelly 写道:
[color=blue]
> Diagram (1) is how it is done.[/color]
If a1.o and a2.o are included in a liba.a,then the structure of liba.a
likes diagram (1) too.
Is right?
Thanks.
Lxbcyllt.
Re: Questions about linking.
[email]lxbcyllt@jx163.com[/email] wrote:[color=blue]
> Ivan Kelly 写道:
>
> [color=green]
>>Diagram (1) is how it is done.[/color]
>
>
> If a1.o and a2.o are included in a liba.a,then the structure of liba.a
> likes diagram (1) too.
> Is right?
>
> Thanks.
> Lxbcyllt.
> [/color]
Minix 3 doesn't support dynamic linking; we don't even have a ld.so
Also, there is no virtual memory support, so memory is a issue.
Re: Questions about linking.
> Minix 3 doesn't support dynamic linking; we don't even have a ld.so
Thanks for above help.
My other question is about static linking.
For example, if one library (i.e. liba.a) include two functions : f1( )
and f2( ), one object file which calls f1( ) is statically linked with
liba.a to get a executable, then is the f1( ) linked into the
executable or the whole liba.a ?
In other words, does the linker select the necessary stuff , not the
whole, to get the executable?
If so,is it applied to the LIB's global variables which are accessed by
a object file?
Are all the global variables which come from different object files
collected in the LIB's data segment by the linker ?
Thanks.
lxbcyllt.
Re: Questions about linking.
[email]lxbcyllt@jx163.com[/email] wrote:[color=blue][color=green]
>> Minix 3 doesn't support dynamic linking; we don't even have a ld.so[/color]
> Thanks for above help.
>
> My other question is about static linking.
>
> For example, if one library (i.e. liba.a) include two functions : f1( )
> and f2( ), one object file which calls f1( ) is statically linked with
> liba.a to get a executable, then is the f1( ) linked into the
> executable or the whole liba.a ?
>
> In other words, does the linker select the necessary stuff , not the
> whole, to get the executable?
> If so,is it applied to the LIB's global variables which are accessed by
> a object file?
>
> Are all the global variables which come from different object files
> collected in the LIB's data segment by the linker ?[/color]
Libraries are a collection of objects (archive of object files).
Each objects, usually but not necessarily, contains a function and data.
During the linking phase the linker searches the libraries for
unresolved symbols and when it finds them extracts a copy of the object
file which is then linked as any object file in input to the linker.
If a global variable is found in the library the relevant object file is
retrieved from the archive and linked.
Ciao
Giovanni
--
A computer is like an air conditioner,
it stops working when you open Windows.
Registered Linux user #337974 <http://counter.li.org/>