summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/uclibc/uclibc-0.9.29/bfin/uClibc.machine68
-rw-r--r--packages/uclibc/uclibc-0.9.29/uClibc-0.9.29-002-atmel.1.patch3546
-rw-r--r--packages/uclibc/uclibc-0.9.29/uClibc-0.9.29-avr32-fix-sa_onstack.patch31
-rw-r--r--packages/uclibc/uclibc_0.9.29.bb4
4 files changed, 3622 insertions, 27 deletions
diff --git a/packages/uclibc/uclibc-0.9.29/bfin/uClibc.machine b/packages/uclibc/uclibc-0.9.29/bfin/uClibc.machine
index cef409289c..0c565238e5 100644
--- a/packages/uclibc/uclibc-0.9.29/bfin/uClibc.machine
+++ b/packages/uclibc/uclibc-0.9.29/bfin/uClibc.machine
@@ -1,6 +1,6 @@
#
# Automatically generated make config: don't edit
-# Fri Aug 10 19:05:32 2007
+# Sat Oct 20 20:22:28 2007
#
# TARGET_alpha is not set
# TARGET_arm is not set
@@ -33,11 +33,10 @@ TARGET_ARCH="bfin"
FORCE_OPTIONS_FOR_ARCH=y
TARGET_SUBARCH=""
# UCLIBC_FORMAT_ELF is not set
-# UCLIBC_FORMAT_FDPIC_ELF is not set
+UCLIBC_FORMAT_FDPIC_ELF=y
# UCLIBC_FORMAT_FLAT is not set
# UCLIBC_FORMAT_FLAT_SEP_DATA is not set
-UCLIBC_FORMAT_SHARED_FLAT=y
-UCLIBC_SHARED_FLAT_ID=1
+# UCLIBC_FORMAT_SHARED_FLAT is not set
ARCH_LITTLE_ENDIAN=y
#
@@ -50,8 +49,8 @@ ARCH_HAS_NO_MMU=y
#
UCLIBC_HAS_FLOATS=y
UCLIBC_HAS_FPU=y
-DO_C99_MATH=y
-KERNEL_HEADERS="/media/hda4/OE/build/tmp-new/angstrom/cross/bfin-angstrom-uclinux-uclibc/include"
+# DO_C99_MATH is not set
+KERNEL_HEADERS="/usr/include"
# UCLIBC_UCLINUX_BROKEN_MUNMAP is not set
EXCLUDE_BRK=y
HAVE_DOT_CONFIG=y
@@ -60,12 +59,22 @@ HAVE_DOT_CONFIG=y
# General Library Settings
#
# HAVE_NO_PIC is not set
-# DOPIC is not set
-HAVE_NO_SHARED=y
-ARCH_HAS_NO_LDSO=y
+DOPIC=y
+# HAVE_NO_SHARED is not set
+# ARCH_HAS_NO_LDSO is not set
+HAVE_SHARED=y
+# FORCE_SHAREABLE_TEXT_SEGMENTS is not set
+LDSO_LDD_SUPPORT=y
+LDSO_CACHE_SUPPORT=y
+# LDSO_PRELOAD_FILE_SUPPORT is not set
+LDSO_BASE_FILENAME="ld.so"
+UCLIBC_STATIC_LDCONFIG=y
+LDSO_RUNPATH=y
UCLIBC_CTOR_DTOR=y
# HAS_NO_THREADS is not set
-# UCLIBC_HAS_THREADS is not set
+UCLIBC_HAS_THREADS=y
+# PTHREADS_DEBUG_SUPPORT is not set
+LINUXTHREADS_OLD=y
UCLIBC_HAS_LFS=y
MALLOC=y
# MALLOC_SIMPLE is not set
@@ -73,24 +82,24 @@ MALLOC=y
# MALLOC_GLIBC_COMPAT is not set
UCLIBC_DYNAMIC_ATEXIT=y
# COMPAT_ATEXIT is not set
-UCLIBC_SUSV3_LEGACY=y
-UCLIBC_SUSV3_LEGACY_MACROS=y
-# UCLIBC_HAS_SHADOW is not set
+# UCLIBC_SUSV3_LEGACY is not set
+# UCLIBC_SUSV3_LEGACY_MACROS is not set
+UCLIBC_HAS_SHADOW=y
# UCLIBC_HAS_PROGRAM_INVOCATION_NAME is not set
UCLIBC_HAS___PROGNAME=y
UNIX98PTY_ONLY=y
ASSUME_DEVPTS=y
UCLIBC_HAS_TM_EXTENSIONS=y
-# UCLIBC_HAS_TZ_CACHING is not set
-# UCLIBC_HAS_TZ_FILE is not set
+UCLIBC_HAS_TZ_CACHING=y
+UCLIBC_HAS_TZ_FILE=y
+UCLIBC_HAS_TZ_FILE_READ_MANY=y
+UCLIBC_TZ_FILE_PATH="/etc/TZ"
#
# Networking Support
#
# UCLIBC_HAS_IPV6 is not set
-UCLIBC_HAS_RPC=y
-UCLIBC_HAS_FULL_RPC=y
-UCLIBC_HAS_REENTRANT_RPC=y
+# UCLIBC_HAS_RPC is not set
# UCLIBC_USE_NETLINK is not set
#
@@ -103,18 +112,19 @@ UCLIBC_HAS_CTYPE_SIGNED=y
UCLIBC_HAS_CTYPE_UNSAFE=y
# UCLIBC_HAS_CTYPE_CHECKED is not set
# UCLIBC_HAS_CTYPE_ENFORCED is not set
-UCLIBC_HAS_WCHAR=y
+# UCLIBC_HAS_WCHAR is not set
# UCLIBC_HAS_LOCALE is not set
# UCLIBC_HAS_HEXADECIMAL_FLOATS is not set
# UCLIBC_HAS_GLIBC_CUSTOM_PRINTF is not set
+# USE_OLD_VFPRINTF is not set
UCLIBC_PRINTF_SCANF_POSITIONAL_ARGS=9
# UCLIBC_HAS_SCANF_GLIBC_A_FLAG is not set
# UCLIBC_HAS_STDIO_BUFSIZ_NONE is not set
-UCLIBC_HAS_STDIO_BUFSIZ_256=y
+# UCLIBC_HAS_STDIO_BUFSIZ_256 is not set
# UCLIBC_HAS_STDIO_BUFSIZ_512 is not set
# UCLIBC_HAS_STDIO_BUFSIZ_1024 is not set
# UCLIBC_HAS_STDIO_BUFSIZ_2048 is not set
-# UCLIBC_HAS_STDIO_BUFSIZ_4096 is not set
+UCLIBC_HAS_STDIO_BUFSIZ_4096=y
# UCLIBC_HAS_STDIO_BUFSIZ_8192 is not set
UCLIBC_HAS_STDIO_BUILTIN_BUFFER_NONE=y
# UCLIBC_HAS_STDIO_BUILTIN_BUFFER_4 is not set
@@ -149,8 +159,9 @@ UCLIBC_HAS_GLOB=y
#
# Library Installation Options
#
-RUNTIME_PREFIX="/"
-DEVEL_PREFIX="//usr"
+SHARED_LIB_LOADER_PREFIX="$(RUNTIME_PREFIX)lib"
+RUNTIME_PREFIX="/usr/$(TARGET_ARCH)-linux-uclibc/"
+DEVEL_PREFIX="/usr/$(TARGET_ARCH)-linux-uclibc/usr/"
MULTILIB=""
#
@@ -159,16 +170,21 @@ MULTILIB=""
# UCLIBC_HAS_ARC4RANDOM is not set
# HAVE_NO_SSP is not set
# UCLIBC_HAS_SSP is not set
-# UCLIBC_BUILD_NOEXECSTACK is not set
+UCLIBC_BUILD_RELRO=y
+# UCLIBC_BUILD_NOW is not set
+UCLIBC_BUILD_NOEXECSTACK=y
#
# uClibc development/debugging options
#
-CROSS_COMPILER_PREFIX="bfin-elf-"
+CROSS_COMPILER_PREFIX=""
UCLIBC_EXTRA_CFLAGS=""
# DODEBUG is not set
-# DOSTRIP is not set
+# DODEBUG_PT is not set
+DOSTRIP=y
# DOASSERTS is not set
+# SUPPORT_LD_DEBUG is not set
+# SUPPORT_LD_DEBUG_EARLY is not set
# UCLIBC_MALLOC_DEBUGGING is not set
WARNINGS="-Wall"
# EXTRA_WARNINGS is not set
diff --git a/packages/uclibc/uclibc-0.9.29/uClibc-0.9.29-002-atmel.1.patch b/packages/uclibc/uclibc-0.9.29/uClibc-0.9.29-002-atmel.1.patch
new file mode 100644
index 0000000000..d275ac2302
--- /dev/null
+++ b/packages/uclibc/uclibc-0.9.29/uClibc-0.9.29-002-atmel.1.patch
@@ -0,0 +1,3546 @@
+diff --git a/Rules.mak b/Rules.mak
+index d054bbb..55381cf 100644
+--- a/Rules.mak
++++ b/Rules.mak
+@@ -313,6 +313,12 @@ ifeq ($(TARGET_ARCH),frv)
+ UCLIBC_LDSO=ld.so.1
+ endif
+
++ifeq ($(strip $(TARGET_ARCH)),avr32)
++ CPU_CFLAGS-$(CONFIG_AVR32_AP7) += -march=ap
++ CPU_CFLAGS-$(CONFIG_LINKRELAX) += -mrelax
++ CPU_LDFLAGS-$(CONFIG_LINKRELAX) += --relax
++endif
++
+ # Keep the check_gcc from being needlessly executed
+ ifndef PIEFLAG
+ ifneq ($(UCLIBC_BUILD_PIE),y)
+diff --git a/extra/Configs/Config.avr32 b/extra/Configs/Config.avr32
+new file mode 100644
+index 0000000..8d70e6e
+--- /dev/null
++++ b/extra/Configs/Config.avr32
+@@ -0,0 +1,31 @@
++#
++# For a description of the syntax of this configuration file,
++# see extra/config/Kconfig-language.txt
++#
++
++config TARGET_ARCH
++ string
++ default "avr32"
++
++config FORCE_OPTIONS_FOR_ARCH
++ bool
++ default y
++ select ARCH_BIG_ENDIAN
++ select FORCE_SHAREABLE_TEXT_SEGMENTS
++
++config ARCH_CFLAGS
++ string
++
++choice
++ prompt "Target CPU Type"
++ default CONFIG_AVR32_AP7
++
++config CONFIG_AVR32_AP7
++ bool "AVR32 AP7"
++ select ARCH_HAS_MMU
++
++endchoice
++
++config LINKRELAX
++ bool "Enable linker optimizations"
++ default y
+diff --git a/extra/Configs/Config.in b/extra/Configs/Config.in
+index 8eab394..10c9f7b 100644
+--- a/extra/Configs/Config.in
++++ b/extra/Configs/Config.in
+@@ -16,6 +16,9 @@ config TARGET_alpha
+ config TARGET_arm
+ bool "arm"
+
++config TARGET_avr32
++ bool "avr32"
++
+ config TARGET_bfin
+ bool "bfin"
+
+@@ -92,6 +95,10 @@ if TARGET_arm
+ source "extra/Configs/Config.arm"
+ endif
+
++if TARGET_avr32
++source "extra/Configs/Config.avr32"
++endif
++
+ if TARGET_bfin
+ source "extra/Configs/Config.bfin"
+ endif
+diff --git a/extra/Configs/defconfigs/avr32 b/extra/Configs/defconfigs/avr32
+new file mode 100644
+index 0000000..0b890a2
+--- /dev/null
++++ b/extra/Configs/defconfigs/avr32
+@@ -0,0 +1 @@
++TARGET_avr32=y
+diff --git a/include/elf.h b/include/elf.h
+index 19805d7..ab90160 100644
+--- a/include/elf.h
++++ b/include/elf.h
+@@ -354,6 +354,8 @@ typedef struct
+ /* NIOS magic number - no EABI available. */
+ #define EM_NIOS32 0xFEBB
+
++#define EM_AVR32 0x18ad
++
+ /* V850 backend magic number. Written in the absense of an ABI. */
+ #define EM_CYGNUS_V850 0x9080
+
+@@ -2828,6 +2830,55 @@ typedef Elf32_Addr Elf32_Conflict;
+ /* Keep this the last entry. */
+ #define R_V850_NUM 25
+
++/* Atmel AVR32 relocations. */
++#define R_AVR32_NONE 0
++#define R_AVR32_32 1
++#define R_AVR32_16 2
++#define R_AVR32_8 3
++#define R_AVR32_32_PCREL 4
++#define R_AVR32_16_PCREL 5
++#define R_AVR32_8_PCREL 6
++#define R_AVR32_DIFF32 7
++#define R_AVR32_DIFF16 8
++#define R_AVR32_DIFF8 9
++#define R_AVR32_GOT32 10
++#define R_AVR32_GOT16 11
++#define R_AVR32_GOT8 12
++#define R_AVR32_21S 13
++#define R_AVR32_16U 14
++#define R_AVR32_16S 15
++#define R_AVR32_8S 16
++#define R_AVR32_8S_EXT 17
++#define R_AVR32_22H_PCREL 18
++#define R_AVR32_18W_PCREL 19
++#define R_AVR32_16B_PCREL 20
++#define R_AVR32_16N_PCREL 21
++#define R_AVR32_14UW_PCREL 22
++#define R_AVR32_11H_PCREL 23
++#define R_AVR32_10UW_PCREL 24
++#define R_AVR32_9H_PCREL 25
++#define R_AVR32_9UW_PCREL 26
++#define R_AVR32_HI16 27
++#define R_AVR32_LO16 28
++#define R_AVR32_GOTPC 29
++#define R_AVR32_GOTCALL 30
++#define R_AVR32_LDA_GOT 31
++#define R_AVR32_GOT21S 32
++#define R_AVR32_GOT18SW 33
++#define R_AVR32_GOT16S 34
++#define R_AVR32_GOT7UW 35
++#define R_AVR32_32_CPENT 36
++#define R_AVR32_CPCALL 37
++#define R_AVR32_16_CP 38
++#define R_AVR32_9W_CP 39
++#define R_AVR32_RELATIVE 40
++#define R_AVR32_GLOB_DAT 41
++#define R_AVR32_JMP_SLOT 42
++#define R_AVR32_ALIGN 43
++#define R_AVR32_NUM 44
++
++/* AVR32 dynamic tags */
++#define DT_AVR32_GOTSZ 0x70000001 /* Total size of GOT in bytes */
+
+ /* Renesas H8/300 Relocations */
+ #define R_H8_NONE 0
+diff --git a/ldso/include/dl-string.h b/ldso/include/dl-string.h
+index 32c5bf8..eb43bd9 100644
+--- a/ldso/include/dl-string.h
++++ b/ldso/include/dl-string.h
+@@ -285,7 +285,8 @@ static __always_inline char * _dl_simple_ltoahex(char * local, unsigned long i)
+ /* On some arches constant strings are referenced through the GOT.
+ * This requires that load_addr must already be defined... */
+ #if defined(mc68000) || defined(__arm__) || defined(__thumb__) || \
+- defined(__mips__) || defined(__sh__) || defined(__powerpc__)
++ defined(__mips__) || defined(__sh__) || defined(__powerpc__) || \
++ defined(__avr32__)
+ # define CONSTANT_STRING_GOT_FIXUP(X) \
+ if ((X) < (const char *) load_addr) (X) += load_addr
+ # define NO_EARLY_SEND_STDERR
+diff --git a/ldso/include/dl-syscall.h b/ldso/include/dl-syscall.h
+index b42416a..4404219 100644
+--- a/ldso/include/dl-syscall.h
++++ b/ldso/include/dl-syscall.h
+@@ -55,69 +55,69 @@
+ dynamic linking at all, so we cannot return any error codes.
+ We just punt if there is an error. */
+ #define __NR__dl_exit __NR_exit
+-static inline _syscall1(void, _dl_exit, int, status);
++static __always_inline _syscall1(void, _dl_exit, int, status);
+
+ #define __NR__dl_close __NR_close
+-static inline _syscall1(int, _dl_close, int, fd);
++static __always_inline _syscall1(int, _dl_close, int, fd);
+
+ #define __NR__dl_open __NR_open
+-static inline _syscall3(int, _dl_open, const char *, fn, int, flags,
++static __always_inline _syscall3(int, _dl_open, const char *, fn, int, flags,
+ __kernel_mode_t, mode);
+
+ #define __NR__dl_write __NR_write
+-static inline _syscall3(unsigned long, _dl_write, int, fd,
++static __always_inline _syscall3(unsigned long, _dl_write, int, fd,
+ const void *, buf, unsigned long, count);
+
+ #define __NR__dl_read __NR_read
+-static inline _syscall3(unsigned long, _dl_read, int, fd,
++static __always_inline _syscall3(unsigned long, _dl_read, int, fd,
+ const void *, buf, unsigned long, count);
+
+ #define __NR__dl_mprotect __NR_mprotect
+-static inline _syscall3(int, _dl_mprotect, const void *, addr,
++static __always_inline _syscall3(int, _dl_mprotect, const void *, addr,
+ unsigned long, len, int, prot);
+
+ #define __NR__dl_stat __NR_stat
+-static inline _syscall2(int, _dl_stat, const char *, file_name,
++static __always_inline _syscall2(int, _dl_stat, const char *, file_name,
+ struct stat *, buf);
+
+ #define __NR__dl_fstat __NR_fstat
+-static inline _syscall2(int, _dl_fstat, int, fd, struct stat *, buf);
++static __always_inline _syscall2(int, _dl_fstat, int, fd, struct stat *, buf);
+
+ #define __NR__dl_munmap __NR_munmap
+-static inline _syscall2(int, _dl_munmap, void *, start, unsigned long, length);
++static __always_inline _syscall2(int, _dl_munmap, void *, start, unsigned long, length);
+
+ #ifdef __NR_getxuid
+ # define __NR_getuid __NR_getxuid
+ #endif
+ #define __NR__dl_getuid __NR_getuid
+-static inline _syscall0(uid_t, _dl_getuid);
++static __always_inline _syscall0(uid_t, _dl_getuid);
+
+ #ifndef __NR_geteuid
+ # define __NR_geteuid __NR_getuid
+ #endif
+ #define __NR__dl_geteuid __NR_geteuid
+-static inline _syscall0(uid_t, _dl_geteuid);
++static __always_inline _syscall0(uid_t, _dl_geteuid);
+
+ #ifdef __NR_getxgid
+ # define __NR_getgid __NR_getxgid
+ #endif
+ #define __NR__dl_getgid __NR_getgid
+-static inline _syscall0(gid_t, _dl_getgid);
++static __always_inline _syscall0(gid_t, _dl_getgid);
+
+ #ifndef __NR_getegid
+ # define __NR_getegid __NR_getgid
+ #endif
+ #define __NR__dl_getegid __NR_getegid
+-static inline _syscall0(gid_t, _dl_getegid);
++static __always_inline _syscall0(gid_t, _dl_getegid);
+
+ #ifdef __NR_getxpid
+ # define __NR_getpid __NR_getxpid
+ #endif
+ #define __NR__dl_getpid __NR_getpid
+-static inline _syscall0(gid_t, _dl_getpid);
++static __always_inline _syscall0(gid_t, _dl_getpid);
+
+ #define __NR__dl_readlink __NR_readlink
+-static inline _syscall3(int, _dl_readlink, const char *, path, char *, buf,
++static __always_inline _syscall3(int, _dl_readlink, const char *, path, char *, buf,
+ size_t, bufsiz);
+
+ #ifdef __UCLIBC_HAS_SSP__
+@@ -146,14 +146,14 @@ static inline _syscall2(int, _dl_gettimeofday, struct timeval *, tv,
+ #if defined(__UCLIBC_MMAP_HAS_6_ARGS__) && defined(__NR_mmap)
+
+ # define __NR__dl_mmap __NR_mmap
+-static inline _syscall6(void *, _dl_mmap, void *, start, size_t, length,
++static __always_inline _syscall6(void *, _dl_mmap, void *, start, size_t, length,
+ int, prot, int, flags, int, fd, off_t, offset);
+
+ /* then try mmap2() */
+ #elif defined(__NR_mmap2)
+
+ # define __NR___syscall_mmap2 __NR_mmap2
+-static inline _syscall6(__ptr_t, __syscall_mmap2, __ptr_t, addr, size_t, len,
++static __always_inline _syscall6(__ptr_t, __syscall_mmap2, __ptr_t, addr, size_t, len,
+ int, prot, int, flags, int, fd, off_t, offset);
+
+ /* Some architectures always use 12 as page shift for mmap2() eventhough the
+@@ -164,7 +164,7 @@ static inline _syscall6(__ptr_t, __syscall_mmap2, __ptr_t, addr, size_t, len,
+ # define MMAP2_PAGE_SHIFT 12
+ #endif
+
+-static inline void * _dl_mmap(void * addr, unsigned long size, int prot,
++static __always_inline void * _dl_mmap(void * addr, unsigned long size, int prot,
+ int flags, int fd, unsigned long offset)
+ {
+ if (offset & ((1 << MMAP2_PAGE_SHIFT) - 1))
+@@ -177,8 +177,8 @@ static inline void * _dl_mmap(void * addr, unsigned long size, int prot,
+ #elif defined(__NR_mmap)
+
+ # define __NR__dl_mmap_real __NR_mmap
+-static inline _syscall1(void *, _dl_mmap_real, unsigned long *, buffer);
+-static inline void * _dl_mmap(void * addr, unsigned long size, int prot,
++static __always_inline _syscall1(void *, _dl_mmap_real, unsigned long *, buffer);
++static __always_inline void * _dl_mmap(void * addr, unsigned long size, int prot,
+ int flags, int fd, unsigned long offset)
+ {
+ unsigned long buffer[6];
+diff --git a/ldso/ldso/avr32/dl-debug.h b/ldso/ldso/avr32/dl-debug.h
+new file mode 100644
+index 0000000..fe35539
+--- /dev/null
++++ b/ldso/ldso/avr32/dl-debug.h
+@@ -0,0 +1,45 @@
++/*
++ * AVR32 ELF shared libary loader support
++ *
++ * Copyright (C) 2005-2007 Atmel Corporation
++ * All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ * 1. Redistributions of source code must retain the above copyright
++ * notice, this list of conditions and the following disclaimer.
++ * 2. The name of the above contributors may not be
++ * used to endorse or promote products derived from this software
++ * without specific prior written permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND
++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
++ * ARE DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE
++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
++ * SUCH DAMAGE.
++ */
++
++static const char *_dl_reltypes_tab[] = {
++ "R_AVR32_NONE",
++ "R_AVR32_32", "R_AVR32_16", "R_AVR32_8",
++ "R_AVR32_32_PCREL", "R_AVR32_16_PCREL", "R_AVR32_8_PCREL",
++ "R_AVR32_DIFF32", "R_AVR32_DIFF16", "R_AVR32_DIFF8",
++ "R_AVR32_GOT32", "R_AVR32_GOT16", "R_AVR32_GOT8",
++ "R_AVR32_21S", "R_AVR32_16U", "R_AVR32_16S", "R_AVR32_8S", "R_AVR32_8S_EXT",
++ "R_AVR32_22H_PCREL", "R_AVR32_18W_PCREL", "R_AVR32_16B_PCREL",
++ "R_AVR32_16N_PCREL", "R_AVR32_14UW_PCREL", "R_AVR32_11H_PCREL",
++ "R_AVR32_10UW_PCREL", "R_AVR32_9H_PCREL", "R_AVR32_9UW_PCREL",
++ "R_AVR32_HI16", "R_AVR32_LO16",
++ "R_AVR32_GOTPC", "R_AVR32_GOTCALL", "R_AVR32_LDA_GOT",
++ "R_AVR32_GOT21S", "R_AVR32_GOT18SW", "R_AVR32_GOT16S", "R_AVR32_GOT7UW",
++ "R_AVR32_32_CPENT", "R_AVR32_CPCALL", "R_AVR32_16_CP", "R_AVR32_9W_CP",
++ "R_AVR32_RELATIVE", "R_AVR32_GLOB_DAT", "R_AVR32_JMP_SLOT",
++ "R_AVR32_ALIGN",
++};
+diff --git a/ldso/ldso/avr32/dl-startup.h b/ldso/ldso/avr32/dl-startup.h
+new file mode 100644
+index 0000000..3b9a641
+--- /dev/null
++++ b/ldso/ldso/avr32/dl-startup.h
+@@ -0,0 +1,112 @@
++/*
++ * Architecture specific code used by dl-startup.c
++ *
++ * Copyright (C) 2005-2007 Atmel Corporation
++ *
++ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
++ */
++
++/* This is the library loader's main entry point. Let _dl_boot2 do its
++ * initializations and jump to the application's entry point
++ * afterwards. */
++asm( " .text\n"
++ " .global _start\n"
++ " .type _start,@function\n"
++ "_start:\n"
++ /* All arguments are on the stack initially */
++ " mov r12, sp\n"
++ " rcall _dl_start\n"
++ /* Returns user entry point in r12. Save it. */
++ " mov r0, r12\n"
++ /* We're PIC, so get the Global Offset Table */
++ " lddpc r6, .L_GOT\n"
++ ".L_RGOT:\n"
++ " rsub r6, pc\n"
++ /* Adjust argc and argv according to _dl_skip_args */
++ " ld.w r1, r6[_dl_skip_args@got]\n"
++ " ld.w r1, r1[0]\n"
++ " ld.w r2, sp++\n"
++ " sub r2, r1\n"
++ " add sp, sp, r1 << 2\n"
++ " st.w --sp, r2\n"
++ /* Load the finalizer function */
++ " ld.w r12, r6[_dl_fini@got]\n"
++ /* Jump to the user's entry point */
++ " mov pc, r0\n\n"
++
++ " .align 2\n"
++ ".L_GOT:"
++ " .long .L_RGOT - _GLOBAL_OFFSET_TABLE_\n"
++ " .size _start, . - _start\n"
++ " .previous\n");
++
++/* Get a pointer to the argv array. On many platforms this can be just
++ * the address if the first argument, on other platforms we need to
++ * do something a little more subtle here. */
++#define GET_ARGV(ARGVP, ARGS) ARGVP = ((unsigned long *)ARGS + 1)
++
++
++/* We can't call functions before the GOT has been initialized */
++#define NO_FUNCS_BEFORE_BOOTSTRAP
++
++/*
++ * Relocate the GOT during dynamic loader bootstrap. This will add
++ * the load address to all entries in the GOT, which is necessary
++ * because the linker doesn't generate R_AVR32_RELATIVE relocs for the
++ * GOT.
++ */
++static __always_inline
++void PERFORM_BOOTSTRAP_GOT(struct elf_resolve *tpnt)
++{
++ Elf32_Addr i, nr_got;
++ register Elf32_Addr *__r6 __asm__("r6");
++ Elf32_Addr *got = __r6;
++
++ nr_got = tpnt->dynamic_info[DT_AVR32_GOTSZ_IDX] / sizeof(*got);
++ for (i = 2; i < nr_got; i++)
++ got[i] += tpnt->loadaddr;
++}
++
++#define PERFORM_BOOTSTRAP_GOT(tpnt) PERFORM_BOOTSTRAP_GOT(tpnt)
++
++/* Handle relocation of the symbols in the dynamic loader. */
++static __always_inline
++void PERFORM_BOOTSTRAP_RELOC(ELF_RELOC *rpnt, unsigned long *reloc_addr,
++ unsigned long symbol_addr,
++ unsigned long load_addr, Elf32_Sym *symtab)
++{
++ switch(ELF32_R_TYPE(rpnt->r_info)) {
++ case R_AVR32_NONE:
++ break;
++ case R_AVR32_GLOB_DAT:
++ case R_AVR32_JMP_SLOT:
++ *reloc_addr = symbol_addr;
++ break;
++ case R_AVR32_RELATIVE:
++ SEND_STDERR_DEBUG("Applying RELATIVE relocation: ");
++ SEND_ADDRESS_STDERR_DEBUG(load_addr, 0);
++ SEND_STDERR_DEBUG(" + ");
++ SEND_ADDRESS_STDERR_DEBUG(rpnt->r_addend, 1);
++ *reloc_addr = load_addr + rpnt->r_addend;
++ break;
++ default:
++ SEND_STDERR("BOOTSTRAP_RELOC: unhandled reloc_type ");
++ SEND_NUMBER_STDERR(ELF32_R_TYPE(rpnt->r_info), 1);
++ SEND_STDERR("REL, SYMBOL, LOAD: ");
++ SEND_ADDRESS_STDERR(reloc_addr, 0);
++ SEND_STDERR(", ");
++ SEND_ADDRESS_STDERR(symbol_addr, 0);
++ SEND_STDERR(", ");
++ SEND_ADDRESS_STDERR(load_addr, 1);
++ _dl_exit(1);
++ }
++}
++
++/* Transfer control to the user's application, once the dynamic loader
++ * is done. This routine has to exit the current function, then call
++ * the _dl_elf_main function.
++ *
++ * Since our _dl_boot will simply call whatever is returned by
++ * _dl_boot2, we can just return the address we're supposed to
++ * call. */
++#define START() return _dl_elf_main;
+diff --git a/ldso/ldso/avr32/dl-syscalls.h b/ldso/ldso/avr32/dl-syscalls.h
+new file mode 100644
+index 0000000..996bb87
+--- /dev/null
++++ b/ldso/ldso/avr32/dl-syscalls.h
+@@ -0,0 +1,6 @@
++/* We can't use the real errno in ldso, since it has not yet
++ * been dynamicly linked in yet. */
++#include "sys/syscall.h"
++extern int _dl_errno;
++#undef __set_errno
++#define __set_errno(X) {(_dl_errno) = (X);}
+diff --git a/ldso/ldso/avr32/dl-sysdep.h b/ldso/ldso/avr32/dl-sysdep.h
+new file mode 100644
+index 0000000..1a30172
+--- /dev/null
++++ b/ldso/ldso/avr32/dl-sysdep.h
+@@ -0,0 +1,105 @@
++/*
++ * Various assembly language/system dependent hacks that are required
++ * so that we can minimize the amount of platform specific code.
++ *
++ * Copyright (C) 2004-2007 Atmel Corporation
++ *
++ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
++ */
++
++/* Define this if the system uses RELOCA. */
++#define ELF_USES_RELOCA
++
++#include <elf.h>
++
++#define ARCH_NUM 1
++#define DT_AVR32_GOTSZ_IDX (DT_NUM + OS_NUM)
++
++#define ARCH_DYNAMIC_INFO(dpnt, dynamic, debug_addr) \
++ do { \
++ if (dpnt->d_tag == DT_AVR32_GOTSZ) \
++ dynamic[DT_AVR32_GOTSZ_IDX] = dpnt->d_un.d_val; \
++ } while (0)
++
++/* Initialization sequence for the application/library GOT. */
++#define INIT_GOT(GOT_BASE,MODULE) \
++ do { \
++ unsigned long i, nr_got; \
++ \
++ GOT_BASE[0] = (unsigned long) _dl_linux_resolve; \
++ GOT_BASE[1] = (unsigned long) MODULE; \
++ \
++ /* Add load address displacement to all GOT entries */ \
++ nr_got = MODULE->dynamic_info[DT_AVR32_GOTSZ_IDX] / 4; \
++ for (i = 2; i < nr_got; i++) \
++ GOT_BASE[i] += (unsigned long)MODULE->loadaddr; \
++ } while (0)
++
++#define do_rem(result, n, base) ((result) = (n) % (base))
++
++/* Here we define the magic numbers that this dynamic loader should accept */
++#define MAGIC1 EM_AVR32
++#undef MAGIC2
++
++/* Used for error messages */
++#define ELF_TARGET "AVR32"
++
++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)
++
++/* AVR32 doesn't need any COPY relocs */
++#define DL_NO_COPY_RELOCS
++
++/* 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)
++{
++ register Elf32_Addr *got asm ("r6");
++ return *got;
++}
++
++/* Return the run-time load address of the shared object. */
++static inline Elf32_Addr
++elf_machine_load_address (void)
++{
++ extern void __dl_start asm("_dl_start");
++ Elf32_Addr got_addr = (Elf32_Addr) &__dl_start;
++ Elf32_Addr pcrel_addr;
++
++ asm (" lddpc %0, 2f\n"
++ "1: add %0, pc\n"
++ " rjmp 3f\n"
++ " .align 2\n"
++ "2: .long _dl_start - 1b\n"
++ "3:\n"
++ : "=r"(pcrel_addr) : : "cc");
++
++ return pcrel_addr - got_addr;
++}
++
++/*
++ * Perform any RELATIVE relocations specified by DT_RELCOUNT.
++ * Currently, we don't use that tag, but we might in the future as
++ * this would reduce the startup time somewhat (although probably not by much).
++ */
++static inline void
++elf_machine_relative (Elf32_Addr load_off, const Elf32_Addr rel_addr,
++ Elf32_Word relative_count)
++{
++ Elf32_Rela *rpnt = (void *)rel_addr;
++
++ do {
++ Elf32_Addr *reloc_addr;
++ reloc_addr = (void *)(load_off + (rpnt++)->r_offset);
++ *reloc_addr = load_off + rpnt->r_addend;
++ } while (--relative_count);
++}
+diff --git a/ldso/ldso/avr32/elfinterp.c b/ldso/ldso/avr32/elfinterp.c
+new file mode 100644
+index 0000000..196292b
+--- /dev/null
++++ b/ldso/ldso/avr32/elfinterp.c
+@@ -0,0 +1,191 @@
++/*
++ * AVR32 ELF shared library loader suppport
++ *
++ * Copyright (C) 2004-2006 Atmel Corporation
++ *
++ * All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ * 1. Redistributions of source code must retain the above copyright
++ * notice, this list of conditions and the following disclaimer.
++ * 2. The name of the above contributors may not be
++ * used to endorse or promote products derived from this software
++ * without specific prior written permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND
++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
++ * ARE DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE
++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
++ * SUCH DAMAGE.
++ */
++
++unsigned long _dl_linux_resolver(unsigned long got_offset, unsigned long *got)
++{
++ struct elf_resolve *tpnt = (struct elf_resolve *)got[1];
++ Elf32_Sym *sym;
++ unsigned long local_gotno;
++ unsigned long gotsym;
++ unsigned long new_addr;
++ char *strtab, *symname;
++ unsigned long *entry;
++ unsigned long sym_index = got_offset / 4;
++
++#if 0
++ local_gotno = tpnt->dynamic_info[DT_AVR32_LOCAL_GOTNO];
++ gotsym = tpnt->dynamic_info[DT_AVR32_GOTSYM];
++
++ sym = ((Elf32_Sym *)(tpnt->dynamic_info[DT_SYMTAB] + tpnt->loadaddr))
++ + sym_index;
++ strtab = (char *)(tpnt->dynamic_info[DT_STRTAB] + tpnt->loadaddr);
++ symname = strtab + sym->st_name;
++
++#if 0
++ new_addr = (unsigned long) _dl_find_hash(strtab + sym->st_name,
++ tpnt->symbol_scope, tpnt,
++ resolver);
++#endif
++
++ entry = (unsigned long *)(got + local_gotno + sym_index - gotsym);
++ *entry = new_addr;
++#endif
++
++ return new_addr;
++}
++
++static int
++_dl_parse(struct elf_resolve *tpnt, struct dyn_elf *scope,
++ unsigned long rel_addr, unsigned long rel_size,
++ int (*reloc_func)(struct elf_resolve *tpnt, struct dyn_elf *scope,
++ Elf32_Rela *rpnt, Elf32_Sym *symtab, char *strtab))
++{
++ Elf32_Sym *symtab;
++ Elf32_Rela *rpnt;
++ char *strtab;
++ int i;
++
++ rpnt = (Elf32_Rela *)rel_addr;
++ rel_size /= sizeof(Elf32_Rela);
++ symtab = (Elf32_Sym *)tpnt->dynamic_info[DT_SYMTAB];
++ strtab = (char *)tpnt->dynamic_info[DT_STRTAB];
++
++ for (i = 0; i < rel_size; i++, rpnt++) {
++ int symtab_index, res;
++
++ symtab_index = ELF32_R_SYM(rpnt->r_info);
++
++ debug_sym(symtab, strtab, symtab_index);
++ debug_reloc(symtab, strtab, rpnt);
++
++ res = reloc_func(tpnt, scope, rpnt, symtab, strtab);
++
++ if (res == 0)
++ continue;
++
++ _dl_dprintf(2, "\n%s: ", _dl_progname);
++
++ if (symtab_index)
++ _dl_dprintf(2, "symbol '%s': ",
++ strtab + symtab[symtab_index].st_name);
++
++ if (res < 0) {
++ int reloc_type = ELF32_R_TYPE(rpnt->r_info);
++#if defined(__SUPPORT_LD_DEBUG__)
++ _dl_dprintf(2, "can't handle reloc type %s\n",
++ _dl_reltypes(reloc_type));
++#else
++ _dl_dprintf(2, "can't handle reloc type %x\n",
++ reloc_type);
++#endif
++ _dl_exit(-res);
++ } else {
++ _dl_dprintf(2, "can't resolve symbol\n");
++ return res;
++ }
++ }
++
++ return 0;
++}
++
++static int _dl_do_reloc(struct elf_resolve *tpnt, struct dyn_elf *scope,
++ Elf32_Rela *rpnt, Elf32_Sym *symtab, char *strtab)
++{
++ int reloc_type;
++ int symtab_index;
++ char *symname;
++ unsigned long *reloc_addr;
++ unsigned long symbol_addr;
++#if defined(__SUPPORT_LD_DEBUG__)
++ unsigned long old_val;
++#endif
++
++ reloc_addr = (unsigned long *)(tpnt->loadaddr + rpnt->r_offset);
++ reloc_type = ELF32_R_TYPE(rpnt->r_info);
++ symtab_index = ELF32_R_SYM(rpnt->r_info);
++ symbol_addr = 0;
++ symname = strtab + symtab[symtab_index].st_name;
++
++ if (symtab_index) {
++ symbol_addr = (unsigned long)
++ _dl_find_hash(strtab + symtab[symtab_index].st_name,
++ tpnt->symbol_scope, tpnt,
++ elf_machine_type_class(reloc_type));
++
++ /* Allow undefined references to weak symbols */
++ if (!symbol_addr &&
++ ELF32_ST_BIND(symtab[symtab_index].st_info) != STB_WEAK) {
++ _dl_dprintf(2, "%s: can't resolve symbol '%s'\n",
++ _dl_progname, symname);
++ return 0;
++ }
++ }
++
++#if defined(__SUPPORT_LD_DEBUG__)
++ old_val = *reloc_addr;
++#endif
++ switch (reloc_type) {
++ case R_AVR32_NONE:
++ break;
++ case R_AVR32_GLOB_DAT:
++ case R_AVR32_JMP_SLOT:
++ *reloc_addr = symbol_addr + rpnt->r_addend;
++ break;
++ case R_AVR32_RELATIVE:
++ *reloc_addr = (unsigned long)tpnt->loadaddr
++ + rpnt->r_addend;
++ break;
++ default:
++ return -1;
++ }
++
++#if defined(__SUPPORT_LD_DEBUG__)
++ if (_dl_debug_reloc && _dl_debug_detail)
++ _dl_dprintf(_dl_debug_file, "\tpatched: %x ==> %x @ %x\n",
++ old_val, *reloc_addr);
++#endif
++
++ return 0;
++}
++
++void _dl_parse_lazy_relocation_information(struct dyn_elf *rpnt,
++ unsigned long rel_addr,
++ unsigned long rel_size)
++{
++ /* TODO: Might want to support this in order to get faster
++ * startup times... */
++}
++
++int _dl_parse_relocation_information(struct dyn_elf *rpnt,
++ unsigned long rel_addr,
++ unsigned long rel_size)
++{
++ return _dl_parse(rpnt->dyn, rpnt->dyn->symbol_scope, rel_addr, rel_size,
++ _dl_do_reloc);
++}
+diff --git a/ldso/ldso/avr32/resolve.S b/ldso/ldso/avr32/resolve.S
+new file mode 100644
+index 0000000..e3cb7f4
+--- /dev/null
++++ b/ldso/ldso/avr32/resolve.S
+@@ -0,0 +1,28 @@
++/*
++ * Linux dynamic resolving code for AVR32. Fixes up the GOT entry as
++ * indicated in register r12 and jumps to the resolved address.
++ *
++ * This file is subject to the terms and conditions of the GNU Lesser General
++ * Public License. See the file "COPYING.LIB" in the main directory of this
++ * archive for more details.
++ *
++ * Copyright (C) 2004-2007 Atmel Corporation
++ */
++
++#define ip r5
++
++ .text
++ .global _dl_linux_resolve
++ .type _dl_linux_resolve,@function
++_dl_linux_resolve:
++ /* The PLT code pushed r8 for us. It contains the address of this
++ function's GOT entry, that is entry 0. ip contains the address
++ of the GOT entry of the function we wanted to call. */
++ stm --sp, r9-r12, lr
++ mov r11, r8
++ sub r12, ip, r8
++ rcall _dl_linux_resolver
++ mov ip, r12
++ popm r8-r12,lr
++ mov pc, ip
++ .size _dl_linux_resolve, . - _dl_linux_resolve
+diff --git a/ldso/ldso/dl-startup.c b/ldso/ldso/dl-startup.c
+index 5cf1d04..d4294ec 100644
+--- a/ldso/ldso/dl-startup.c
++++ b/ldso/ldso/dl-startup.c
+@@ -217,7 +217,9 @@ DL_START(unsigned long args)
+ /* some arches (like MIPS) we have to tweak the GOT before relocations */
+ PERFORM_BOOTSTRAP_GOT(tpnt);
+
+-#else
++#endif
++
++#if !defined(PERFORM_BOOTSTRAP_GOT) || defined(__avr32__)
+
+ /* OK, now do the relocations. We do not do a lazy binding here, so
+ that once we are done, we have considerably more flexibility. */
+diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c
+index f4e6cac..9cdc3fe 100644
+--- a/libc/inet/resolv.c
++++ b/libc/inet/resolv.c
+@@ -1643,7 +1643,7 @@ int attribute_hidden __read_etc_hosts_r(FILE * fp, const char * name, int type,
+ *result=result_buf;
+ ret=NETDB_SUCCESS;
+ #ifdef __UCLIBC_HAS_IPV6__
+- } else if (type == AF_INET6 && inet_pton(AF_INET6, alias[0], in6) > 0) {
++ } else if (type == AF_INET6 && inet_pton(AF_INET6, alias[0], in6) > 0) {
+ DPRINTF("Found INET6\n");
+ addr_list6[0] = in6;
+ addr_list6[1] = 0;
+@@ -1658,8 +1658,8 @@ int attribute_hidden __read_etc_hosts_r(FILE * fp, const char * name, int type,
+ } else {
+ DPRINTF("Error\n");
+ ret=TRY_AGAIN;
+- break; /* bad ip address */
+- }
++ continue; /* bad ip address, keep searching */
++ }
+
+ if (action!=GETHOSTENT) {
+ fclose(fp);
+diff --git a/libc/string/avr32/Makefile b/libc/string/avr32/Makefile
+new file mode 100644
+index 0000000..e19e9d9
+--- /dev/null
++++ b/libc/string/avr32/Makefile
+@@ -0,0 +1,26 @@
++# Makefile for uClibc
++#
++# Copyright (C) 2000-2003 Erik Andersen <andersen@uclibc.org>
++#
++# This program is free software; you can redistribute it and/or modify it under
++# the terms of the GNU Library General Public License as published by the Free
++# Software Foundation; either version 2 of the License, or (at your option) any
++# later version.
++#
++# This program is distributed in the hope that it will be useful, but WITHOUT
++# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
++# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
++# details.
++#
++# You should have received a copy of the GNU Library General Public License
++# along with this program; if not, write to the Free Software Foundation, Inc.,
++# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
++
++top_srcdir := ../../../
++top_builddir := ../../../
++
++all: objs
++
++include $(top_builddir)Rules.mak
++include ../Makefile.in
++include $(top_srcdir)Makerules
+diff --git a/libc/string/avr32/bcopy.S b/libc/string/avr32/bcopy.S
+new file mode 100644
+index 0000000..87c1e04
+--- /dev/null
++++ b/libc/string/avr32/bcopy.S
+@@ -0,0 +1,26 @@
++/*
++ * Copyright (C) 2004-2007 Atmel Corporation
++ *
++ * This file is subject to the terms and conditions of the GNU Lesser General
++ * Public License. See the file "COPYING.LIB" in the main directory of this
++ * archive for more details.
++ */
++