[uClibc]Address alignment in dynamic linker
Tobias Anderberg
tobias.anderberg at axis.com
Thu May 16 13:22:35 UTC 2002
Hi!
While finishing up the port for the CRIS architecture I noticed that
the address alignment done in the dynamic linker is hardcoded for
architectures with a page size of 4k. Naturally this doesn't work
very well on architectures with another page size!
So I propose the use of macros when doing the alignments. Though I
havn't found the optimal place where to define these macros, I'm
leaning on defining them in ../ldso/ldso/<arch>/ld_sysdep.h, like:
#define PAGE_ALIGN 0xffffe000 /* 8k pages */
#define ADDR_ALIGN 0x1ff
Then in ../ldso/ldso/readelflib1.c, for instance, we do something
like the following on every alignment:
status = _dl_mmap((char *) ((piclib ? libaddr : 0) +
(ppnt->p_vaddr & PAGE_ALIGN)), (ppnt->p_vaddr & ADDR_ALIGN)
+ ppnt->p_filesz, LXFLAGS(ppnt->p_flags), flags, infile,
ppnt->p_offset & PAGE_ALIGN);
Ideas on name and place of macros are welcome! :-)
Any thoughts on this?
/tobba
More information about the uClibc
mailing list