Browse Source

make lemote boot with uClibc

- patches for uClibc to work with pagesize != 4k
- use gcc extension to avoid -O2 compile
- use ld.so for 64 bit archs

big thanks to thorsten glaser helping out here.
Waldemar Brodkorb 16 years ago
parent
commit
96404c63d3

+ 0 - 6
package/uclibc/Makefile

@@ -18,9 +18,7 @@ do-install:
 	${INSTALL_DIR} $(IDIR_UCLIBC)/lib $(IDIR_UCLIBC)/etc
 	# create timezone file
 	echo 'CET-1CEST-2,M3.5.0/02:00:00,M10.5.0/03:00:00' > $(IDIR_UCLIBC)/etc/TZ
-ifneq (${CPU_ARCH},x86_64)
 	$(CP) $(STAGING_DIR)/lib/libgcc_s.so.* $(IDIR_UCLIBC)/lib/
-endif
 	$(CP) $(STAGING_DIR)/lib/libc.so.* $(IDIR_UCLIBC)/lib/
 	$(CP) $(STAGING_DIR)/lib/libuClibc-$(PKG_VERSION).so $(IDIR_UCLIBC)/lib/
 	$(CP) $(STAGING_DIR)/lib/ld*-uClibc-$(PKG_VERSION).so $(IDIR_UCLIBC)/lib/
@@ -30,11 +28,7 @@ endif
 		$(CP) $(STAGING_DIR)/lib/$$file-$(PKG_VERSION).so $(IDIR_UCLIBC)/lib/; \
 	done
 	# create links for ldd / gcc
-ifneq (${CPU_ARCH},x86_64)
 	cd $(IDIR_UCLIBC)/lib && ln -sf ld-uClibc.so.0 ld.so
-else
-	cd $(IDIR_UCLIBC)/lib && ln -sf ld64-uClibc.so.0 ld.so
-endif
 	cd $(IDIR_UCLIBC)/lib && ln -sf libc.so.0 libc.so
 	cd $(IDIR_UCLIBC)/lib && ln -sf libgcc_s.so.1 libgcc_s.so
 

+ 4 - 0
target/lemote/files/etc/inittab

@@ -0,0 +1,4 @@
+::sysinit:/etc/init.d/rcS
+::shutdown:/etc/init.d/rcK
+tty::respawn:/sbin/getty -i -L tty 115200 vt100
+tty1::respawn:/sbin/getty -i -L tty1 115200 vt100

+ 41 - 30
target/lemote/kernel.config

@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
 # Linux kernel version: 2.6.30
-# Sun Jun 14 18:50:00 2009
+# Sun Jun 21 18:23:45 2009
 #
 CONFIG_MIPS=y
 
@@ -119,9 +119,9 @@ CONFIG_CPU_SUPPORTS_64BIT_KERNEL=y
 #
 # CONFIG_32BIT is not set
 CONFIG_64BIT=y
-# CONFIG_PAGE_SIZE_4KB is not set
+CONFIG_PAGE_SIZE_4KB=y
 # CONFIG_PAGE_SIZE_8KB is not set
-CONFIG_PAGE_SIZE_16KB=y
+# CONFIG_PAGE_SIZE_16KB is not set
 # CONFIG_PAGE_SIZE_32KB is not set
 # CONFIG_PAGE_SIZE_64KB is not set
 CONFIG_BOARD_SCACHE=y
@@ -210,11 +210,7 @@ CONFIG_SYSFS_DEPRECATED=y
 CONFIG_SYSFS_DEPRECATED_V2=y
 # CONFIG_RELAY is not set
 # CONFIG_NAMESPACES is not set
-CONFIG_BLK_DEV_INITRD=y
-CONFIG_INITRAMFS_SOURCE=""
-CONFIG_RD_GZIP=y
-# CONFIG_RD_BZIP2 is not set
-# CONFIG_RD_LZMA is not set
+# CONFIG_BLK_DEV_INITRD is not set
 CONFIG_CC_OPTIMIZE_FOR_SIZE=y
 CONFIG_SYSCTL=y
 CONFIG_ANON_INODES=y
@@ -274,7 +270,6 @@ CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_CFQ is not set
 # CONFIG_DEFAULT_NOOP is not set
 CONFIG_DEFAULT_IOSCHED="anticipatory"
-# CONFIG_PROBE_INITRD_HEADER is not set
 CONFIG_FREEZER=y
 
 #
@@ -466,7 +461,7 @@ CONFIG_BLK_DEV_IDECD=m
 CONFIG_BLK_DEV_IDECD_VERBOSE_ERRORS=y
 # CONFIG_BLK_DEV_IDETAPE is not set
 CONFIG_IDE_TASK_IOCTL=y
-CONFIG_IDE_PROC_FS=y
+# CONFIG_IDE_PROC_FS is not set
 
 #
 # IDE chipset support/bugfixes
@@ -701,27 +696,26 @@ CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
 #
 CONFIG_INPUT_KEYBOARD=y
 CONFIG_KEYBOARD_ATKBD=y
-CONFIG_KEYBOARD_SUNKBD=m
-CONFIG_KEYBOARD_LKKBD=m
-CONFIG_KEYBOARD_XTKBD=m
-CONFIG_KEYBOARD_NEWTON=m
+# CONFIG_KEYBOARD_SUNKBD is not set
+# CONFIG_KEYBOARD_LKKBD is not set
+# CONFIG_KEYBOARD_XTKBD is not set
+# CONFIG_KEYBOARD_NEWTON is not set
 # CONFIG_KEYBOARD_STOWAWAY is not set
 CONFIG_INPUT_MOUSE=y
 CONFIG_MOUSE_PS2=y
-CONFIG_MOUSE_PS2_ALPS=y
-CONFIG_MOUSE_PS2_LOGIPS2PP=y
-CONFIG_MOUSE_PS2_SYNAPTICS=y
-CONFIG_MOUSE_PS2_TRACKPOINT=y
+# CONFIG_MOUSE_PS2_ALPS is not set
+# CONFIG_MOUSE_PS2_LOGIPS2PP is not set
+# CONFIG_MOUSE_PS2_SYNAPTICS is not set
+# CONFIG_MOUSE_PS2_TRACKPOINT is not set
 # CONFIG_MOUSE_PS2_ELANTECH is not set
 # CONFIG_MOUSE_PS2_TOUCHKIT is not set
-CONFIG_MOUSE_SERIAL=m
+# CONFIG_MOUSE_SERIAL is not set
 # CONFIG_MOUSE_APPLETOUCH is not set
 # CONFIG_MOUSE_BCM5974 is not set
-CONFIG_MOUSE_INPORT=m
-# CONFIG_MOUSE_ATIXL is not set
-CONFIG_MOUSE_LOGIBM=m
-CONFIG_MOUSE_PC110PAD=m
-CONFIG_MOUSE_VSXXXAA=m
+# CONFIG_MOUSE_INPORT is not set
+# CONFIG_MOUSE_LOGIBM is not set
+# CONFIG_MOUSE_PC110PAD is not set
+# CONFIG_MOUSE_VSXXXAA is not set
 # CONFIG_INPUT_JOYSTICK is not set
 # CONFIG_INPUT_TABLET is not set
 # CONFIG_INPUT_TOUCHSCREEN is not set
@@ -733,7 +727,7 @@ CONFIG_MOUSE_VSXXXAA=m
 CONFIG_SERIO=y
 CONFIG_SERIO_I8042=y
 # CONFIG_SERIO_SERPORT is not set
-# CONFIG_SERIO_PCIPS2 is not set
+CONFIG_SERIO_PCIPS2=y
 CONFIG_SERIO_LIBPS2=y
 # CONFIG_SERIO_RAW is not set
 # CONFIG_GAMEPORT is not set
@@ -902,11 +896,30 @@ CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
 CONFIG_FONT_8x8=y
 CONFIG_FONT_8x16=y
 CONFIG_LOGO=y
-CONFIG_LOGO_LINUX_MONO=y
-CONFIG_LOGO_LINUX_VGA16=y
+# CONFIG_LOGO_LINUX_MONO is not set
+# CONFIG_LOGO_LINUX_VGA16 is not set
 CONFIG_LOGO_LINUX_CLUT224=y
 # CONFIG_SOUND is not set
-# CONFIG_HID_SUPPORT is not set
+CONFIG_HID_SUPPORT=y
+CONFIG_HID=y
+# CONFIG_HID_DEBUG is not set
+# CONFIG_HIDRAW is not set
+
+#
+# USB Input Devices
+#
+# CONFIG_USB_HID is not set
+# CONFIG_HID_PID is not set
+
+#
+# USB HID Boot Protocol drivers
+#
+# CONFIG_USB_KBD is not set
+# CONFIG_USB_MOUSE is not set
+
+#
+# Special HID drivers
+#
 CONFIG_USB_SUPPORT=y
 CONFIG_USB_ARCH_HAS_HCD=y
 CONFIG_USB_ARCH_HAS_OHCI=y
@@ -1239,8 +1252,6 @@ CONFIG_GENERIC_FIND_LAST_BIT=y
 CONFIG_CRC32=y
 # CONFIG_CRC7 is not set
 # CONFIG_LIBCRC32C is not set
-CONFIG_ZLIB_INFLATE=y
-CONFIG_DECOMPRESS_GZIP=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT=y
 CONFIG_HAS_DMA=y

+ 4 - 5
target/lemote/uclibc.config

@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
 # Version: 0.9.30.1
-# Thu May 28 14:45:13 2009
+# Mon Jun 22 21:54:05 2009
 #
 # TARGET_alpha is not set
 # TARGET_arm is not set
@@ -60,7 +60,7 @@ UCLIBC_HAS_FLOATS=y
 UCLIBC_HAS_FPU=y
 DO_C99_MATH=y
 UCLIBC_HAS_FENV=y
-KERNEL_HEADERS=""
+KERNEL_HEADERS="/home/wbx/openadk/toolchain_build_mips64el/libc_dev/usr/include"
 HAVE_DOT_CONFIG=y
 
 #
@@ -73,9 +73,8 @@ DOPIC=y
 HAVE_SHARED=y
 # FORCE_SHAREABLE_TEXT_SEGMENTS is not set
 LDSO_LDD_SUPPORT=y
-LDSO_CACHE_SUPPORT=y
+# LDSO_CACHE_SUPPORT is not set
 # LDSO_PRELOAD_FILE_SUPPORT is not set
-LDSO_BASE_FILENAME="ld.so"
 # UCLIBC_STATIC_LDCONFIG is not set
 LDSO_RUNPATH=y
 UCLIBC_CTOR_DTOR=y
@@ -228,6 +227,6 @@ DOSTRIP=y
 # SUPPORT_LD_DEBUG_EARLY is not set
 # UCLIBC_MALLOC_DEBUGGING is not set
 WARNINGS="-Wall"
-EXTRA_WARNINGS=y
+# EXTRA_WARNINGS is not set
 # DOMULTI is not set
 # UCLIBC_MJN3_ONLY is not set

+ 0 - 5
toolchain/uClibc/Makefile

@@ -8,11 +8,6 @@ include ../rules.mk
 include Makefile.inc
 include ${TOPDIR}/mk/buildhlp.mk
 
-#workaround for mips and gcc 4.4, where -Os does not inline code in ld.so
-ifeq ($(ARCH),mips)
-TARGET_CFLAGS:=$(subst Os,O2,$(TARGET_CFLAGS))
-endif
-
 $(WRKBUILD)/.headers:
 	$(SED) 's,^CROSS=.*,CROSS=$(TARGET_CROSS),g' $(WRKBUILD)/Rules.mak
 	sed -e 's^KERNEL_HEADERS.*$$KERNEL_HEADERS=\"${TOOLCHAIN_SYSROOT}/usr/include\"' \

+ 0 - 360
toolchain/uClibc/patches/always_inline.patch

@@ -1,360 +0,0 @@
-diff -Nur uClibc-0.9.30.1.orig/ldso/ldso/arm/dl-sysdep.h uClibc-0.9.30.1/ldso/ldso/arm/dl-sysdep.h
---- uClibc-0.9.30.1.orig/ldso/ldso/arm/dl-sysdep.h	2008-09-25 10:35:20.000000000 +0200
-+++ uClibc-0.9.30.1/ldso/ldso/arm/dl-sysdep.h	2009-06-18 16:37:16.000000000 +0200
-@@ -15,7 +15,7 @@
-   GOT_BASE[1] = (unsigned long) MODULE; \
- }
- 
--static __inline__ unsigned long arm_modulus(unsigned long m, unsigned long p)
-+static __always_inline unsigned long arm_modulus(unsigned long m, unsigned long p)
- {
- 	unsigned long i,t,inc;
- 	i=p; t=0;
-@@ -72,7 +72,7 @@
-    first element of the GOT.  We used to use the PIC register to do this
-    without a constant pool reference, but GCC 4.2 will use a pseudo-register
-    for the PIC base, so it may not be in r10.  */
--static __inline__ Elf32_Addr __attribute__ ((unused))
-+static __always_inline Elf32_Addr __attribute__ ((unused))
- elf_machine_dynamic (void)
- {
-   Elf32_Addr dynamic;
-@@ -104,7 +104,7 @@
- }
- 
- /* Return the run-time load address of the shared object.  */
--static __inline__ Elf32_Addr __attribute__ ((unused))
-+static __always_inline Elf32_Addr __attribute__ ((unused))
- elf_machine_load_address (void)
- {
- 	extern void __dl_start __asm__ ("_dl_start");
-@@ -128,7 +128,7 @@
- 	return pcrel_addr - got_addr;
- }
- 
--static __inline__ void
-+static __always_inline void
- elf_machine_relative (Elf32_Addr load_off, const Elf32_Addr rel_addr,
- 		      Elf32_Word relative_count)
- {
-diff -Nur uClibc-0.9.30.1.orig/ldso/ldso/bfin/dl-sysdep.h uClibc-0.9.30.1/ldso/ldso/bfin/dl-sysdep.h
---- uClibc-0.9.30.1.orig/ldso/ldso/bfin/dl-sysdep.h	2008-07-23 13:23:36.000000000 +0200
-+++ uClibc-0.9.30.1/ldso/ldso/bfin/dl-sysdep.h	2009-06-18 16:37:37.000000000 +0200
-@@ -213,7 +213,7 @@
- #endif
- 
- #include <elf.h>
--static __inline__ void
-+static __always_inline void
- elf_machine_relative (DL_LOADADDR_TYPE load_off, const Elf32_Addr rel_addr,
- 		      Elf32_Word relative_count)
- {
-diff -Nur uClibc-0.9.30.1.orig/ldso/ldso/cris/dl-sysdep.h uClibc-0.9.30.1/ldso/ldso/cris/dl-sysdep.h
---- uClibc-0.9.30.1.orig/ldso/ldso/cris/dl-sysdep.h	2008-07-23 13:19:00.000000000 +0200
-+++ uClibc-0.9.30.1/ldso/ldso/cris/dl-sysdep.h	2009-06-18 16:37:42.000000000 +0200
-@@ -39,7 +39,7 @@
-      || ((type) == R_CRIS_GLOB_DAT)) * ELF_RTYPE_CLASS_PLT)	\
-    | (((type) == R_CRIS_COPY) * ELF_RTYPE_CLASS_COPY))
- 
--static __inline__ Elf32_Addr
-+static __always_inline Elf32_Addr
- elf_machine_dynamic(void)
- {
- 	/* Don't just set this to an asm variable "r0" since that's not logical
-@@ -61,7 +61,7 @@
-    there's some other symbol we could use, that we don't *have* to force a
-    GOT entry for.  */
- 
--static __inline__ Elf32_Addr
-+static __always_inline Elf32_Addr
- elf_machine_load_address(void)
- {
- 	Elf32_Addr gotaddr_diff;
-@@ -95,7 +95,7 @@
- 	return gotaddr_diff;
- }
- 
--static __inline__ void
-+static __always_inline void
- elf_machine_relative(Elf32_Addr load_off, const Elf32_Addr rel_addr,
-                      Elf32_Word relative_count)
- {
-diff -Nur uClibc-0.9.30.1.orig/ldso/ldso/i386/dl-sysdep.h uClibc-0.9.30.1/ldso/ldso/i386/dl-sysdep.h
---- uClibc-0.9.30.1.orig/ldso/ldso/i386/dl-sysdep.h	2008-09-15 18:36:11.000000000 +0200
-+++ uClibc-0.9.30.1/ldso/ldso/i386/dl-sysdep.h	2009-06-18 16:37:53.000000000 +0200
-@@ -42,8 +42,8 @@
- /* Return the link-time address of _DYNAMIC.  Conveniently, this is the
-    first element of the GOT.  This must be inlined in a function which
-    uses global data.  */
--static __inline__ Elf32_Addr elf_machine_dynamic (void) attribute_unused;
--static __inline__ Elf32_Addr
-+static __always_inline Elf32_Addr elf_machine_dynamic (void) attribute_unused;
-+static __always_inline Elf32_Addr
- elf_machine_dynamic (void)
- {
- 	register Elf32_Addr *got __asm__ ("%ebx");
-@@ -52,8 +52,8 @@
- 
- 
- /* Return the run-time load address of the shared object.  */
--static __inline__ Elf32_Addr elf_machine_load_address (void) attribute_unused;
--static __inline__ Elf32_Addr
-+static __always_inline Elf32_Addr elf_machine_load_address (void) attribute_unused;
-+static __always_inline Elf32_Addr
- elf_machine_load_address (void)
- {
- 	/* It doesn't matter what variable this is, the reference never makes
-@@ -66,7 +66,7 @@
- 	return addr;
- }
- 
--static __inline__ void
-+static __always_inline void
- elf_machine_relative (Elf32_Addr load_off, const Elf32_Addr rel_addr,
- 		      Elf32_Word relative_count)
- {
-diff -Nur uClibc-0.9.30.1.orig/ldso/ldso/m68k/dl-sysdep.h uClibc-0.9.30.1/ldso/ldso/m68k/dl-sysdep.h
---- uClibc-0.9.30.1.orig/ldso/ldso/m68k/dl-sysdep.h	2008-09-15 18:36:11.000000000 +0200
-+++ uClibc-0.9.30.1/ldso/ldso/m68k/dl-sysdep.h	2009-06-18 16:37:58.000000000 +0200
-@@ -41,7 +41,7 @@
- /* Return the link-time address of _DYNAMIC.  Conveniently, this is the
-    first element of the GOT.  This must be inlined in a function which
-    uses global data.  */
--static __inline__ Elf32_Addr
-+static __always_inline Elf32_Addr
- elf_machine_dynamic (void)
- {
- 	register Elf32_Addr *got __asm__ ("%a5");
-@@ -50,7 +50,7 @@
- 
- 
- /* Return the run-time load address of the shared object.  */
--static __inline__ Elf32_Addr
-+static __always_inline Elf32_Addr
- elf_machine_load_address (void)
- {
- 	Elf32_Addr addr;
-@@ -60,7 +60,7 @@
- 	return addr;
- }
- 
--static __inline__ void
-+static __always_inline void
- elf_machine_relative (Elf32_Addr load_off, const Elf32_Addr rel_addr,
- 		      Elf32_Word relative_count)
- {
-diff -Nur uClibc-0.9.30.1.orig/ldso/ldso/mips/dl-sysdep.h uClibc-0.9.30.1/ldso/ldso/mips/dl-sysdep.h
---- uClibc-0.9.30.1.orig/ldso/ldso/mips/dl-sysdep.h	2008-09-15 18:36:11.000000000 +0200
-+++ uClibc-0.9.30.1/ldso/ldso/mips/dl-sysdep.h	2009-06-18 16:38:03.000000000 +0200
-@@ -163,7 +163,7 @@
- 
- #define OFFSET_GP_GOT 0x7ff0
- 
--static __inline__ ElfW(Addr) *
-+static __always_inline ElfW(Addr) *
- elf_mips_got_from_gpreg (ElfW(Addr) gpreg)
- {
- 	/* FIXME: the offset of gp from GOT may be system-dependent. */
-@@ -173,7 +173,7 @@
- /* Return the link-time address of _DYNAMIC.  Conveniently, this is the
-    first element of the GOT.  This must be inlined in a function which
-    uses global data.  We assume its $gp points to the primary GOT.  */
--static __inline__ ElfW(Addr)
-+static __always_inline ElfW(Addr)
- elf_machine_dynamic (void)
- {
- 	register ElfW(Addr) gp __asm__ ("$28");
-@@ -192,7 +192,7 @@
- #endif
- 
- /* Return the run-time load address of the shared object.  */
--static __inline__ ElfW(Addr)
-+static __always_inline ElfW(Addr)
- elf_machine_load_address (void)
- {
- 	ElfW(Addr) addr;
-@@ -208,7 +208,7 @@
- 	return addr;
- }
- 
--static __inline__ void
-+static __always_inline void
- elf_machine_relative (ElfW(Addr) load_off, const ElfW(Addr) rel_addr,
- 		      ElfW(Word) relative_count)
- {
-diff -Nur uClibc-0.9.30.1.orig/ldso/ldso/powerpc/dl-sysdep.h uClibc-0.9.30.1/ldso/ldso/powerpc/dl-sysdep.h
---- uClibc-0.9.30.1.orig/ldso/ldso/powerpc/dl-sysdep.h	2008-09-15 18:36:11.000000000 +0200
-+++ uClibc-0.9.30.1/ldso/ldso/powerpc/dl-sysdep.h	2009-06-18 16:38:09.000000000 +0200
-@@ -90,7 +90,7 @@
- #define ELF_MACHINE_PLTREL_OVERLAP 1
- 
- /* Return the value of the GOT pointer.  */
--static __inline__ Elf32_Addr * __attribute__ ((const))
-+static __always_inline Elf32_Addr * __attribute__ ((const))
- ppc_got (void)
- {
- 	Elf32_Addr *got;
-@@ -109,14 +109,14 @@
- 
- /* Return the link-time address of _DYNAMIC, stored as
-    the first value in the GOT. */
--static __inline__ Elf32_Addr __attribute__ ((const))
-+static __always_inline Elf32_Addr __attribute__ ((const))
- elf_machine_dynamic (void)
- {
- 	return *ppc_got();
- }
- 
- /* Return the run-time load address of the shared object.  */
--static __inline__ Elf32_Addr __attribute__ ((const))
-+static __always_inline Elf32_Addr __attribute__ ((const))
- elf_machine_load_address (void)
- {
-   Elf32_Addr *branchaddr;
-@@ -164,7 +164,7 @@
-   return runtime_dynamic - elf_machine_dynamic ();
- }
- 
--static __inline__ void
-+static __always_inline void
- elf_machine_relative (Elf32_Addr load_off, const Elf32_Addr rel_addr,
- 		      Elf32_Word relative_count)
- {
-diff -Nur uClibc-0.9.30.1.orig/ldso/ldso/sh/dl-sysdep.h uClibc-0.9.30.1/ldso/ldso/sh/dl-sysdep.h
---- uClibc-0.9.30.1.orig/ldso/ldso/sh/dl-sysdep.h	2008-09-15 18:36:11.000000000 +0200
-+++ uClibc-0.9.30.1/ldso/ldso/sh/dl-sysdep.h	2009-06-18 16:38:18.000000000 +0200
-@@ -25,7 +25,7 @@
- struct elf_resolve;
- extern unsigned long _dl_linux_resolver(struct elf_resolve * tpnt, int reloc_entry);
- 
--static __inline__ unsigned int
-+static __always_inline unsigned int
- _dl_urem(unsigned int n, unsigned int base)
- {
-   int res;
-@@ -100,7 +100,7 @@
- /* Return the link-time address of _DYNAMIC.  Conveniently, this is the
-    first element of the GOT.  This must be inlined in a function which
-    uses global data.  */
--static __inline__ Elf32_Addr __attribute__ ((unused))
-+static __always_inline Elf32_Addr __attribute__ ((unused))
- elf_machine_dynamic (void)
- {
- 	register Elf32_Addr *got;
-@@ -109,7 +109,7 @@
- }
- 
- /* Return the run-time load address of the shared object.  */
--static __inline__ Elf32_Addr __attribute__ ((unused))
-+static __always_inline Elf32_Addr __attribute__ ((unused))
- elf_machine_load_address (void)
- {
- 	Elf32_Addr addr;
-@@ -151,7 +151,7 @@
-     } \
-   }
- 
--static __inline__ void
-+static __always_inline void
- elf_machine_relative (Elf32_Addr load_off, const Elf32_Addr rel_addr,
- 		      Elf32_Word relative_count)
- {
-diff -Nur uClibc-0.9.30.1.orig/ldso/ldso/sh64/dl-sysdep.h uClibc-0.9.30.1/ldso/ldso/sh64/dl-sysdep.h
---- uClibc-0.9.30.1.orig/ldso/ldso/sh64/dl-sysdep.h	2008-09-15 18:36:11.000000000 +0200
-+++ uClibc-0.9.30.1/ldso/ldso/sh64/dl-sysdep.h	2009-06-18 16:38:14.000000000 +0200
-@@ -42,7 +42,7 @@
- /* Return the link-time address of _DYNAMIC.  Conveniently, this is the
-    first element of the GOT.  This must be inlined in a function which
-    uses global data.  */
--static __inline__ Elf32_Addr elf_machine_dynamic(void)
-+static __always_inline Elf32_Addr elf_machine_dynamic(void)
- {
- 	register Elf32_Addr *got;
- 
-@@ -70,7 +70,7 @@
- }
- 
- /* Return the run-time load address of the shared object.  */
--static __inline__ Elf32_Addr elf_machine_load_address(void)
-+static __always_inline Elf32_Addr elf_machine_load_address(void)
- {
- 	Elf32_Addr addr;
- 
-@@ -123,7 +123,7 @@
- 	}						\
- }
- 
--static __inline__ void
-+static __always_inline void
- elf_machine_relative(Elf32_Addr load_off, const Elf32_Addr rel_addr,
- 		     Elf32_Word relative_count)
- {
-diff -Nur uClibc-0.9.30.1.orig/ldso/ldso/sparc/dl-sysdep.h uClibc-0.9.30.1/ldso/ldso/sparc/dl-sysdep.h
---- uClibc-0.9.30.1.orig/ldso/ldso/sparc/dl-sysdep.h	2008-09-15 18:36:11.000000000 +0200
-+++ uClibc-0.9.30.1/ldso/ldso/sparc/dl-sysdep.h	2009-06-18 16:38:23.000000000 +0200
-@@ -49,7 +49,7 @@
- 
- #ifndef COMPILE_ASM
- /* Cheap modulo implementation, taken from arm/ld_sysdep.h. */
--static __inline__ unsigned long
-+static __always_inline unsigned long
- sparc_mod(unsigned long m, unsigned long p)
- {
- 	unsigned long i, t, inc;
-@@ -127,7 +127,7 @@
- /* Return the link-time address of _DYNAMIC.  Conveniently, this is the
-    first element of the GOT.  This must be inlined in a function which
-    uses global data.  */
--static __inline__ Elf32_Addr
-+static __always_inline Elf32_Addr
- elf_machine_dynamic (void)
- {
- 	register Elf32_Addr *got __asm__ ("%l7");
-@@ -138,7 +138,7 @@
- }
- 
- /* Return the run-time load address of the shared object.  */
--static __inline__ Elf32_Addr
-+static __always_inline Elf32_Addr
- elf_machine_load_address (void)
- {
- 	register Elf32_Addr *pc __asm__ ("%o7"), *got __asm__ ("%l7");
-@@ -157,7 +157,7 @@
- 	return (Elf32_Addr) got - *got + (pc[2] - pc[3]) * 4 - 4;
- }
- 
--static __inline__ void
-+static __always_inline void
- elf_machine_relative (Elf32_Addr load_off, const Elf32_Addr rel_addr,
- 		      Elf32_Word relative_count)
- {
-diff -Nur uClibc-0.9.30.1.orig/ldso/ldso/xtensa/dl-sysdep.h uClibc-0.9.30.1/ldso/ldso/xtensa/dl-sysdep.h
---- uClibc-0.9.30.1.orig/ldso/ldso/xtensa/dl-sysdep.h	2008-07-23 13:19:00.000000000 +0200
-+++ uClibc-0.9.30.1/ldso/ldso/xtensa/dl-sysdep.h	2009-06-18 16:38:39.000000000 +0200
-@@ -87,7 +87,7 @@
-   (((type) == R_XTENSA_JMP_SLOT) * ELF_RTYPE_CLASS_PLT)
- 
- /* Return the link-time address of _DYNAMIC.  */
--static __inline__ Elf32_Addr
-+static __always_inline Elf32_Addr
- elf_machine_dynamic (void)
- {
-   /* This function is only used while bootstrapping the runtime linker.
-@@ -97,7 +97,7 @@
- }
- 
- /* Return the run-time load address of the shared object.  */
--static __inline__ Elf32_Addr
-+static __always_inline Elf32_Addr
- elf_machine_load_address (void)
- {
-   Elf32_Addr addr, tmp;
-@@ -118,7 +118,7 @@
-   return addr - 3;
- }
- 
--static __inline__ void
-+static __always_inline void
- elf_machine_relative (Elf32_Addr load_off, const Elf32_Addr rel_addr,
- 		      Elf32_Word relative_count)
- {

+ 77 - 0
toolchain/uClibc/patches/extension-insteadof-inline.patch

@@ -0,0 +1,77 @@
+diff -Nur uClibc-0.9.30.1.orig/ldso/ldso/mips/dl-sysdep.h uClibc-0.9.30.1/ldso/ldso/mips/dl-sysdep.h
+--- uClibc-0.9.30.1.orig/ldso/ldso/mips/dl-sysdep.h	2008-09-15 18:36:11.000000000 +0200
++++ uClibc-0.9.30.1/ldso/ldso/mips/dl-sysdep.h	2009-06-21 19:08:44.487613137 +0200
+@@ -163,22 +163,25 @@
+ 
+ #define OFFSET_GP_GOT 0x7ff0
+ 
+-static __inline__ ElfW(Addr) *
+-elf_mips_got_from_gpreg (ElfW(Addr) gpreg)
+-{
+-	/* FIXME: the offset of gp from GOT may be system-dependent. */
+-	return (ElfW(Addr) *) (gpreg - OFFSET_GP_GOT);
+-}
++#define elf_mips_got_from_gpreg(gpreg) __extension__({			\
++	ElfW(Addr) *elf_mips_got_from_gpreg_res;			\
++									\
++	/* FIXME: the offset of gp from GOT may be system-dependent. */	\
++	elf_mips_got_from_gpreg_res = gpreg - OFFSET_GP_GOT;		\
++	(elf_mips_got_from_gpreg_res);					\
++})
+ 
+ /* Return the link-time address of _DYNAMIC.  Conveniently, this is the
+    first element of the GOT.  This must be inlined in a function which
+    uses global data.  We assume its $gp points to the primary GOT.  */
+-static __inline__ ElfW(Addr)
+-elf_machine_dynamic (void)
+-{
+-	register ElfW(Addr) gp __asm__ ("$28");
+-	return *elf_mips_got_from_gpreg (gp);
+-}
++#define elf_machine_dynamic() __extension__({				\
++	register ElfW(Addr) elf_machine_dynamic_gp __asm__("$28");	\
++	ElfW(Addr) elf_machine_dynamic_res;				\
++									\
++	elf_machine_dynamic_res = *elf_mips_got_from_gpreg(		\
++	    elf_machine_dynamic_gp);					\
++	(elf_machine_dynamic_res);					\
++})
+ 
+ #define STRINGXP(X) __STRING(X)
+ #define STRINGXV(X) STRINGV_(X)
+@@ -192,21 +195,20 @@
+ #endif
+ 
+ /* Return the run-time load address of the shared object.  */
+-static __inline__ ElfW(Addr)
+-elf_machine_load_address (void)
+-{
+-	ElfW(Addr) addr;
+-	__asm__ ("        .set noreorder\n"
+-	     "        " STRINGXP (PTR_LA) " %0, 0f\n"
+-	     "        bltzal $0, 0f\n"
+-	     "        nop\n"
+-	     "0:      " STRINGXP (PTR_SUBU) " %0, $31, %0\n"
+-	     "        .set reorder\n"
+-	     :        "=r" (addr)
+-	     :        /* No inputs */
+-	     :        "$31");
+-	return addr;
+-}
++#define elf_machine_load_address() __extension__({			\
++	ElfW(Addr) elf_machine_load_address_addr;			\
++									\
++	__asm__ ("        .set noreorder\n"				\
++	     "        " STRINGXP (PTR_LA) " %0, 0f\n"			\
++	     "        bltzal $0, 0f\n"					\
++	     "        nop\n"						\
++	     "0:      " STRINGXP (PTR_SUBU) " %0, $31, %0\n"		\
++	     "        .set reorder\n"					\
++	     :        "=r" (elf_machine_load_address_addr)		\
++	     :        /* No inputs */					\
++	     :        "$31");						\
++	(elf_machine_load_address_addr);				\
++})
+ 
+ static __inline__ void
+ elf_machine_relative (ElfW(Addr) load_off, const ElfW(Addr) rel_addr,

+ 17 - 0
toolchain/uClibc/patches/nold64.patch

@@ -0,0 +1,17 @@
+diff -Nur uClibc-0.9.30.1.orig/Rules.mak uClibc-0.9.30.1/Rules.mak
+--- uClibc-0.9.30.1.orig/Rules.mak	2009-03-02 22:10:04.000000000 +0100
++++ uClibc-0.9.30.1/Rules.mak	2009-06-18 20:11:42.336906659 +0200
+@@ -97,12 +97,11 @@
+ LIBC := libc
+ SHARED_MAJORNAME := $(LIBC).so.$(MAJOR_VERSION)
+ ifneq ($(findstring  $(TARGET_ARCH) , hppa64 ia64 mips64 powerpc64 s390x sparc64 x86_64 ),)
+-UCLIBC_LDSO_NAME := ld64-uClibc
+ ARCH_NATIVE_BIT := 64
+ else
+-UCLIBC_LDSO_NAME := ld-uClibc
+ ARCH_NATIVE_BIT := 32
+ endif
++UCLIBC_LDSO_NAME := ld-uClibc
+ UCLIBC_LDSO := $(UCLIBC_LDSO_NAME).so.$(MAJOR_VERSION)
+ NONSHARED_LIBNAME := uclibc_nonshared.a
+ libc := $(top_builddir)lib/$(SHARED_MAJORNAME)

+ 276 - 0
toolchain/uClibc/patches/pagesize-fix.patch

@@ -0,0 +1,276 @@
+diff -Nur uClibc-0.9.30.1.orig/ldso/include/ldso.h uClibc-0.9.30.1/ldso/include/ldso.h
+--- uClibc-0.9.30.1.orig/ldso/include/ldso.h	2008-05-30 16:35:31.000000000 +0200
++++ uClibc-0.9.30.1/ldso/include/ldso.h	2009-06-21 19:34:42.324963528 +0200
+@@ -39,6 +39,19 @@
+ #include <dl-elf.h>
+ #include <dl-hash.h>
+ 
++/* common align masks, if not specified by sysdep headers */
++#ifndef ADDR_ALIGN
++#define ADDR_ALIGN (_dl_pagesize - 1)
++#endif
++
++#ifndef PAGE_ALIGN
++#define PAGE_ALIGN (~ADDR_ALIGN)
++#endif
++
++#ifndef OFFS_ALIGN
++#define OFFS_ALIGN (PAGE_ALIGN & ~(1ul << (sizeof(_dl_pagesize) * 8 - 1)))
++#endif
++
+ /* For INIT/FINI dependency sorting. */
+ struct init_fini_list {
+ 	struct init_fini_list *next;
+diff -Nur uClibc-0.9.30.1.orig/ldso/ldso/arm/dl-sysdep.h uClibc-0.9.30.1/ldso/ldso/arm/dl-sysdep.h
+--- uClibc-0.9.30.1.orig/ldso/ldso/arm/dl-sysdep.h	2008-09-25 10:35:20.000000000 +0200
++++ uClibc-0.9.30.1/ldso/ldso/arm/dl-sysdep.h	2009-06-21 19:34:42.324963528 +0200
+@@ -55,11 +55,6 @@
+ struct elf_resolve;
+ unsigned long _dl_linux_resolver(struct elf_resolve * tpnt, int reloc_entry);
+ 
+-/* 4096 bytes alignment */
+-#define PAGE_ALIGN 0xfffff000
+-#define ADDR_ALIGN 0xfff
+-#define OFFS_ALIGN 0x7ffff000
+-
+ /* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry, so
+    PLT entries should not be allowed to define the value.
+    ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one
+diff -Nur uClibc-0.9.30.1.orig/ldso/ldso/avr32/dl-sysdep.h uClibc-0.9.30.1/ldso/ldso/avr32/dl-sysdep.h
+--- uClibc-0.9.30.1.orig/ldso/ldso/avr32/dl-sysdep.h	2008-11-03 16:54:24.000000000 +0100
++++ uClibc-0.9.30.1/ldso/ldso/avr32/dl-sysdep.h	2009-06-21 19:34:42.324963528 +0200
+@@ -46,11 +46,6 @@
+ 
+ unsigned long _dl_linux_resolver(unsigned long got_offset, unsigned long *got);
+ 
+-/* 4096 bytes alignment */
+-#define PAGE_ALIGN 0xfffff000
+-#define ADDR_ALIGN 0xfff
+-#define OFFS_ALIGN 0x7ffff000
+-
+ #define elf_machine_type_class(type)				\
+ 	((type == R_AVR32_JMP_SLOT) * ELF_RTYPE_CLASS_PLT)
+ 
+diff -Nur uClibc-0.9.30.1.orig/ldso/ldso/bfin/dl-sysdep.h uClibc-0.9.30.1/ldso/ldso/bfin/dl-sysdep.h
+--- uClibc-0.9.30.1.orig/ldso/ldso/bfin/dl-sysdep.h	2008-07-23 13:23:36.000000000 +0200
++++ uClibc-0.9.30.1/ldso/ldso/bfin/dl-sysdep.h	2009-06-21 19:34:42.324963528 +0200
+@@ -67,12 +67,6 @@
+ 
+ extern int _dl_linux_resolve(void) __attribute__((__visibility__("hidden")));
+ 
+-/* 4KiB page alignment.  Should perhaps be made dynamic using
+-   getpagesize(), based on AT_PAGESZ from auxvt?  */
+-#define PAGE_ALIGN 0xfffff000
+-#define ADDR_ALIGN 0xfff
+-#define OFFS_ALIGN 0x7ffff000
+-
+ struct funcdesc_ht;
+ 
+ #undef SEND_EARLY_STDERR
+diff -Nur uClibc-0.9.30.1.orig/ldso/ldso/cris/dl-sysdep.h uClibc-0.9.30.1/ldso/ldso/cris/dl-sysdep.h
+--- uClibc-0.9.30.1.orig/ldso/ldso/cris/dl-sysdep.h	2008-07-23 13:19:00.000000000 +0200
++++ uClibc-0.9.30.1/ldso/ldso/cris/dl-sysdep.h	2009-06-21 19:34:42.324963528 +0200
+@@ -18,11 +18,6 @@
+ struct elf_resolve;
+ extern unsigned long _dl_linux_resolver(struct elf_resolve *tpnt, int reloc_entry);
+ 
+-/* 8192 bytes alignment */
+-#define PAGE_ALIGN 0xffffe000
+-#define ADDR_ALIGN 0x1fff
+-#define OFFS_ALIGN 0xffffe000
+-
+ /* The union of reloc-type-classes where the reloc TYPE is a member.
+ 
+    TYPE is in the class ELF_RTYPE_CLASS_PLT if it can describe a
+diff -Nur uClibc-0.9.30.1.orig/ldso/ldso/frv/dl-sysdep.h uClibc-0.9.30.1/ldso/ldso/frv/dl-sysdep.h
+--- uClibc-0.9.30.1.orig/ldso/ldso/frv/dl-sysdep.h	2008-07-23 13:23:36.000000000 +0200
++++ uClibc-0.9.30.1/ldso/ldso/frv/dl-sysdep.h	2009-06-21 19:34:42.324963528 +0200
+@@ -51,12 +51,6 @@
+ 
+ extern int _dl_linux_resolve(void) __attribute__((__visibility__("hidden")));
+ 
+-/* 16KiB page alignment.  Should perhaps be made dynamic using
+-   getpagesize(), based on AT_PAGESZ from auxvt?  */
+-#define PAGE_ALIGN 0xffffc000
+-#define ADDR_ALIGN 0x3fff
+-#define OFFS_ALIGN 0x7fffc000
+-
+ struct funcdesc_ht;
+ 
+ /* We must force strings used early in the bootstrap into the data
+diff -Nur uClibc-0.9.30.1.orig/ldso/ldso/i386/dl-sysdep.h uClibc-0.9.30.1/ldso/ldso/i386/dl-sysdep.h
+--- uClibc-0.9.30.1.orig/ldso/ldso/i386/dl-sysdep.h	2008-09-15 18:36:11.000000000 +0200
++++ uClibc-0.9.30.1/ldso/ldso/i386/dl-sysdep.h	2009-06-21 19:34:42.328963480 +0200
+@@ -25,11 +25,6 @@
+ struct elf_resolve;
+ extern unsigned long _dl_linux_resolver(struct elf_resolve * tpnt, int reloc_entry);
+ 
+-/* 4096 bytes alignment */
+-#define PAGE_ALIGN 0xfffff000
+-#define ADDR_ALIGN 0xfff
+-#define OFFS_ALIGN 0x7ffff000
+-
+ /* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry or
+    TLS variable, so undefined references should not be allowed to
+    define the value.
+diff -Nur uClibc-0.9.30.1.orig/ldso/ldso/m68k/dl-sysdep.h uClibc-0.9.30.1/ldso/ldso/m68k/dl-sysdep.h
+--- uClibc-0.9.30.1.orig/ldso/ldso/m68k/dl-sysdep.h	2008-09-15 18:36:11.000000000 +0200
++++ uClibc-0.9.30.1/ldso/ldso/m68k/dl-sysdep.h	2009-06-21 19:34:42.328963480 +0200
+@@ -25,11 +25,6 @@
+ struct elf_resolve;
+ extern unsigned long _dl_linux_resolver (struct elf_resolve *, int);
+ 
+-/* 4096 bytes alignment */
+-#define PAGE_ALIGN 0xfffff000
+-#define ADDR_ALIGN 0xfff
+-#define OFFS_ALIGN 0x7ffff000
+-
+ /* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry, so
+    PLT entries should not be allowed to define the value.
+    ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one
+diff -Nur uClibc-0.9.30.1.orig/ldso/ldso/mips/dl-sysdep.h uClibc-0.9.30.1/ldso/ldso/mips/dl-sysdep.h
+--- uClibc-0.9.30.1.orig/ldso/ldso/mips/dl-sysdep.h	2008-09-15 18:36:11.000000000 +0200
++++ uClibc-0.9.30.1/ldso/ldso/mips/dl-sysdep.h	2009-06-22 20:51:04.324542339 +0200
+@@ -148,14 +148,9 @@
+ 
+ /* 4096 bytes alignment */
+ #if _MIPS_SIM == _MIPS_SIM_ABI64
+-#define PAGE_ALIGN (~0xfffUL)
+-#define ADDR_ALIGN 0xfffUL
+-#define OFFS_ALIGN (0x10000000000UL-0x1000)
+-#else	/* O32 || N32 */
+-#define PAGE_ALIGN 0xfffff000
+-#define ADDR_ALIGN 0xfff
+-#define OFFS_ALIGN 0x7ffff000
+-#endif	/* O32 || N32 */
++#define OFFS_ALIGN (0x10000000000UL-_dl_pagesize)
++#endif
++/* O32 || N32 */
+ 
+ #define elf_machine_type_class(type)		ELF_RTYPE_CLASS_PLT
+ /* MIPS does not have COPY relocs */
+diff -Nur uClibc-0.9.30.1.orig/ldso/ldso/powerpc/dl-sysdep.h uClibc-0.9.30.1/ldso/ldso/powerpc/dl-sysdep.h
+--- uClibc-0.9.30.1.orig/ldso/ldso/powerpc/dl-sysdep.h	2008-09-15 18:36:11.000000000 +0200
++++ uClibc-0.9.30.1/ldso/ldso/powerpc/dl-sysdep.h	2009-06-21 19:34:42.328963480 +0200
+@@ -67,11 +67,6 @@
+ extern unsigned long _dl_linux_resolver(struct elf_resolve * tpnt, int reloc_entry);
+ void _dl_init_got(unsigned long *lpnt,struct elf_resolve *tpnt);
+ 
+-/* 4096 bytes alignment */
+-#define PAGE_ALIGN 0xfffff000
+-#define ADDR_ALIGN 0xfff
+-#define OFFS_ALIGN 0x7ffff000
+-
+ /* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry, so
+    PLT entries should not be allowed to define the value.
+    ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one
+diff -Nur uClibc-0.9.30.1.orig/ldso/ldso/sh/dl-sysdep.h uClibc-0.9.30.1/ldso/ldso/sh/dl-sysdep.h
+--- uClibc-0.9.30.1.orig/ldso/ldso/sh/dl-sysdep.h	2008-09-15 18:36:11.000000000 +0200
++++ uClibc-0.9.30.1/ldso/ldso/sh/dl-sysdep.h	2009-06-21 19:34:42.328963480 +0200
+@@ -83,11 +83,6 @@
+ 
+ #define do_rem(result, n, base)     ((result) = _dl_urem((n), (base)))
+ 
+-/* 4096 bytes alignment */
+-#define PAGE_ALIGN 0xfffff000
+-#define ADDR_ALIGN 0xfff
+-#define OFFS_ALIGN 0x7ffff000
+-
+ /* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry or
+    TLS variable, so undefined references should not be allowed to
+    define the value.
+diff -Nur uClibc-0.9.30.1.orig/ldso/ldso/sh64/dl-sysdep.h uClibc-0.9.30.1/ldso/ldso/sh64/dl-sysdep.h
+--- uClibc-0.9.30.1.orig/ldso/ldso/sh64/dl-sysdep.h	2008-09-15 18:36:11.000000000 +0200
++++ uClibc-0.9.30.1/ldso/ldso/sh64/dl-sysdep.h	2009-06-21 19:34:42.328963480 +0200
+@@ -25,11 +25,6 @@
+ struct elf_resolve;
+ extern unsigned long _dl_linux_resolver(struct elf_resolve * tpnt, int reloc_entry);
+ 
+-/* 4096 bytes alignment */
+-#define PAGE_ALIGN 0xfffff000
+-#define ADDR_ALIGN 0xfff
+-#define OFFS_ALIGN 0x7ffff000
+-
+ /* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry or
+    TLS variable, so undefined references should not be allowed to
+    define the value.
+diff -Nur uClibc-0.9.30.1.orig/ldso/ldso/sparc/dl-sysdep.h uClibc-0.9.30.1/ldso/ldso/sparc/dl-sysdep.h
+--- uClibc-0.9.30.1.orig/ldso/ldso/sparc/dl-sysdep.h	2008-09-15 18:36:11.000000000 +0200
++++ uClibc-0.9.30.1/ldso/ldso/sparc/dl-sysdep.h	2009-06-21 19:34:42.332963990 +0200
+@@ -89,18 +89,6 @@
+ #define do_rem(result, n, base) ((result) = sparc_mod(n, base))
+ #endif
+ 
+-/* 4096 bytes alignment */
+-#if defined(__sparc_v9__)
+-/* ...but 8192 is required for mmap() on sparc64 kernel */
+-#define PAGE_ALIGN 0xffffe000
+-#define ADDR_ALIGN 0x1fff
+-#define OFFS_ALIGN 0x7fffe000
+-#elif defined(__sparc_v8__)
+-#define PAGE_ALIGN 0xfffff000
+-#define ADDR_ALIGN 0xfff
+-#define OFFS_ALIGN 0x7ffff000
+-#endif
+-
+ /* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry, so
+    PLT entries should not be allowed to define the value.
+    ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one
+diff -Nur uClibc-0.9.30.1.orig/ldso/ldso/x86_64/dl-sysdep.h uClibc-0.9.30.1/ldso/ldso/x86_64/dl-sysdep.h
+--- uClibc-0.9.30.1.orig/ldso/ldso/x86_64/dl-sysdep.h	2006-03-08 04:58:13.000000000 +0100
++++ uClibc-0.9.30.1/ldso/ldso/x86_64/dl-sysdep.h	2009-06-21 19:34:42.332963990 +0200
+@@ -41,11 +41,6 @@
+ struct elf_resolve;
+ extern unsigned long _dl_linux_resolver(struct elf_resolve * tpnt, int reloc_entry);
+ 
+-/* 4096 bytes alignment */
+-#define PAGE_ALIGN 0xfffff000
+-#define ADDR_ALIGN 0xfff
+-#define OFFS_ALIGN 0x7ffff000
+-
+ /* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry or
+    TLS variable, so undefined references should not be allowed to
+    define the value.
+diff -Nur uClibc-0.9.30.1.orig/ldso/ldso/xtensa/dl-sysdep.h uClibc-0.9.30.1/ldso/ldso/xtensa/dl-sysdep.h
+--- uClibc-0.9.30.1.orig/ldso/ldso/xtensa/dl-sysdep.h	2008-07-23 13:19:00.000000000 +0200
++++ uClibc-0.9.30.1/ldso/ldso/xtensa/dl-sysdep.h	2009-06-21 19:34:42.332963990 +0200
+@@ -76,11 +76,6 @@
+ struct elf_resolve;
+ extern unsigned long _dl_linux_resolver (struct elf_resolve *, int);
+ 
+-/* 4096 bytes alignment */
+-#define PAGE_ALIGN 0xfffff000
+-#define ADDR_ALIGN 0xfff
+-#define OFFS_ALIGN 0x7ffff000
+-
+ /* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry, so
+    undefined references should not be allowed to define the value.  */
+ #define elf_machine_type_class(type) \
+diff -Nur uClibc-0.9.30.1.orig/libc/sysdeps/linux/mips/bits/uClibc_page.h uClibc-0.9.30.1/libc/sysdeps/linux/mips/bits/uClibc_page.h
+--- uClibc-0.9.30.1.orig/libc/sysdeps/linux/mips/bits/uClibc_page.h	2004-08-14 01:39:45.000000000 +0200
++++ uClibc-0.9.30.1/libc/sysdeps/linux/mips/bits/uClibc_page.h	2009-06-22 21:04:53.505363149 +0200
+@@ -20,15 +20,17 @@
+ #ifndef _UCLIBC_PAGE_H
+ #define _UCLIBC_PAGE_H
+ 
+-/* PAGE_SIZE of mips is sortof wierd, and depends on how the kernel
+- * happens to have been configured.  It might use 4KB, 16K or 64K
+- * pages.  To avoid using the current kernel configuration settings,
+- * uClibc will simply use 4KB on mips and call it good. */
+-#if 0
+-#define PAGE_SHIFT	16
++/* This approach sucks, one should really use sysconf(_SC_PAGESIZE)
++ * instead. The current mips64 kernel only seems to boot with a 16K
++ * page size on a Loongson 2f notebook, so we hardcode it to 16K on
++ * MIPS64 (matching the kernel developer's default) and 4K otherwise.
++ */
++#ifdef __mips64
+ #define PAGE_SHIFT	14
+-#endif
++#else
+ #define PAGE_SHIFT	12
++#endif
++
+ #define PAGE_SIZE	(1UL << PAGE_SHIFT)
+ #define PAGE_MASK	(~(PAGE_SIZE-1))
+