ld and .a file question

Lal learner.kernel@gmail.com
Sat May 29 10:57:00 GMT 2010


Essentially, how do I convert one or more .a files into single .o !

On Sat, May 29, 2010 at 4:51 PM, Lal <learner.kernel@gmail.com> wrote:
> Why ld does not extract symbols from archived file in below example?
>
> -bash-3.00$
> -bash-3.00$ gcc -c test.c
> -bash-3.00$ nm test.o
> 00000018 T fun1
> 00000000 T func2
> 0000002a T main
>         U printf
> -bash-3.00$ ld -r test.o -o test1.o
> -bash-3.00$ nm test1.o
> 00000018 T fun1
> 00000000 T func2
> 0000002a T main
>         U printf
> -bash-3.00$
> -bash-3.00$
> -bash-3.00$ ar rvf lib.a test.o
> r - test.o
> -bash-3.00$ nm lib.a
>
> test.o:
> 00000018 T fun1
> 00000000 T func2
> 0000002a T main
>         U printf
> -bash-3.00$
> -bash-3.00$ ld -r lib.a -o test1.o
> -bash-3.00$ nm test1.o
> -bash-3.00$
>
> I expected test1.o (in 2nd iteration) to have the symbols, but it does not!
>
> Regards
> Lal
>



More information about the Binutils mailing list