public inbox for libc-locales@sourceware.org
 help / color / mirror / Atom feed
* ARM dynamic linking
@ 2005-12-29  9:09 johnmc
  0 siblings, 0 replies; only message in thread
From: johnmc @ 2005-12-29  9:09 UTC (permalink / raw)
  To: libc-locales

hi

FOR ARM_ELF:

Can anyone point me to some info on how to build code that can be linked
Dynamically - I want to be able to control which procedures are built
dynamicaly i.e. which use GOTs and PLT code.
I can, using the compile option produce code with the correct linker
directives such as R_ARM_PLT but when I then do a normal link the linker
ignores the directives if it has the addresses in question and links
STATICALLY.
Next I tried linking with the "shared" linker option this seems to have
the affect that it produces the correct code with the static part
accessing the Dynamic part but does not actually link in the dynamic code.
I am sure that i am doing it wrong - here is what I tried
thanks in advance.


I am trying to create a dynamic linker/loader system that uses the minimum
memory so in fact only a few modules will be loadable dynamically the rest
will be static.==========================================================
METHOD 1
#!/bin/bash
echo "Building........"

arm-elf-gcc -c -fpic dyn.c -o dyn.o
arm-elf-gcc -c other.c    -o other.o
arm-elf-gcc -c system.c   -o system.o
arm-elf-gcc -c static.c   -o static.o
arm-elf-gcc -c main.c     -o main.o

echo "compiled........."


#arm-elf-objdump -dr --syms  dyn.o
#arm-elf-objdump -dr --syms  system.o
#arm-elf-objdump -dr --syms  other.o
#arm-elf-objdump -dr --syms  static.o
#arm-elf-objdump -dr --syms  main.o


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


#arm-elf-objdump -dr --syms  dyn.ld

#arm-elf-objdump -dr --syms  main.ld
arm-elf-objdump -dr --syms  out.a

echo "linked........."


echo "Finished........."

exit
==============================================================
METHOD 2


 #!/bin/bash
echo "Building........"

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

echo" finished........"





Download this as a file




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-12-29  9:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-29  9:09 ARM dynamic linking johnmc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).