CSCI.4210 Operating Systems
Fall, 2009
Exercise on the Linker
The following two programs are compiled separately and
then linked together to create an executable file by the
linker.
Show the contents of the definition table and the use table for
One.o and Two.o.
One.c
extern int a(int);
extern int b;
int c;
int d(int x)
{
int y;
y = x * 2;
return y;
}
int main()
{
int e;
c = 7;
b = a(c);
e = d(b);
printf("%d\n",b);
return 0;
}
Two.c
int b;
int d(int);
int a(int x)
{
int z;
z = d(x);
return z;
}