This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ARM dynamic linking


On Thu, Dec 29, 2005 at 10:09:34AM +0100, johnmc@sidsa.es wrote:
> arm-elf-ld  -shared dyn.o                            -o dyn.ld
> arm-elf-ld -r  main.o  other.o system.o static.o     -o main.ld
> arm-elf-ld  main.ld  dyn.ld                          -o out.a

Do not do this.  You should never use "ld" directly to link, if you
don't already know a great deal about the way GCC invokes ld; all the
options, libraries, et cetera it passes are important!

> arm-elf-gcc -c -nostdlib calc_mean.c -o calc_mean.o
> arm-elf-ar  rcs libmean.a      calc_mean.o
> 
> arm-elf-gcc -c -nostdlib -fPIC calc_mean.c -o calc_mean_dyn.o
> arm-elf-gcc -shared -nostdlib --verbose -Wl,-soname,libmean.so.1 -o
> libmean.so.1.0.1  calc_mean_dyn.o
> 
> arm-elf-gcc  -static -nostdlib --verbose main.c -L. -lmean -o
> statically_linked
> arm-elf-gcc main.c -nostdlib --verbose -o dynamically_linked -L. -lmean

Don't use -nostdlib when linking and expect the result to work without
a lot more handholding (startup files, et cetera - especially important
for dynamic linking).

-lmean will search first for "libmean.so" and then for "libmean.a".  If
you creat libmean.so.1.0.1, you need to create a libmean.so ->
libmean.so.1.0.1 symlink, also.  -Wl,--verbose would show you what the
linker searched for.

-- 
Daniel Jacobowitz
CodeSourcery, LLC


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]