[uClibc] 0x10000 PT_LOAD Segment alignment on MIPS makes my ELF files 64 kb big
TINNES Julien RD-MAPS-ISS
julien.tinnes at francetelecom.com
Fri Feb 4 19:20:01 UTC 2005
Hello,
I used uClibc buildroot system to build a toolchain and be able to
compile for a MIPS-1 R3000 big endian processor for an embeded device.
Everything worked fine, however I was surprised because the typical
"Hello Word" program would take more than 68 kB (dynamically linked).
After some research I figured out that the produced ELF executable had a
segment alignment of 0x10000 instead of 0x1000. Because of that my .text
section is padded with almost 64 kB of "0".
I supposed that the produced ld linker assumes MIPS with 64 kB-sized
pages (but I use 4 kB-sized page). I've not been able to find exactly
where it does come from. I tried to change
buildroot/toolchain_build_mips/linux/include/asm/page.h to #define
CONFIG_PAGE_SIZE_4KB and make sure PAGE_SHIFT was 12 and recompiled
everything but it did'nt work.
It seems that the linker would figures out the page size by using
getpagesize() (HAVE_GETPAGESIZE defined in config.h). I looked at
getpagesize() code in uClibc and it seems that it uses the auxiliary
vector table to get it. This auxiliary vector table is initialized with
the value of the auxiliary vector table on the stack when the ELF
program is run, which in turn comes from a field in the ELF file.
That would mean that the used page_size is actually some field in my
linker's ELF binary file, but what has the linker of my linker used then ?
But anyway mips-linux-uclibc-ld is linked against glibc not uClibc, and
I've not checked how getpagesize works on glibc..
Anyone has an idea?
--
Julien TINNES - & france telecom - R&D Division/MAPS/NSS
Research Engineer - Internet/Intranet Security
GPG: C050 EF1A 2919 FD87 57C4 DEDD E778 A9F0 14B9 C7D6
More information about the uClibc
mailing list