[oe-commits] org.oe.dev uclibc 0.9.29: blackfin and avr32 updates

koen commit openembedded-commits at lists.openembedded.org
Fri Feb 15 11:07:04 UTC 2008


uclibc 0.9.29: blackfin and avr32 updates

Author: koen at openembedded.org
Branch: org.openembedded.dev
Revision: b53dab09ba9dbaf5d7d8c22be3a0ae0643f47fcd
ViewMTN: http://monotone.openembedded.org/revision/info/b53dab09ba9dbaf5d7d8c22be3a0ae0643f47fcd
Files:
1
packages/uclibc/uclibc-0.9.29/uClibc-0.9.29-002-atmel.1.patch
packages/uclibc/uclibc-0.9.29/uClibc-0.9.29-avr32-fix-sa_onstack.patch
packages/uclibc/uclibc-0.9.29/bfin/uClibc.machine
packages/uclibc/uclibc_0.9.29.bb
Diffs:

#
# mt diff -r12c11447ebe6636a34499f6597e6a9629cca0d23 -rb53dab09ba9dbaf5d7d8c22be3a0ae0643f47fcd
#
# 
# 
# add_file "packages/uclibc/uclibc-0.9.29/uClibc-0.9.29-002-atmel.1.patch"
#  content [b1a4e2194e3a3205defb1102554b7bf2fe0a0686]
# 
# add_file "packages/uclibc/uclibc-0.9.29/uClibc-0.9.29-avr32-fix-sa_onstack.patch"
#  content [d92d542c9cd9b027ad738b2a3cb3b4a0ebd91477]
# 
# patch "packages/uclibc/uclibc-0.9.29/bfin/uClibc.machine"
#  from [39526ec7c7f496de4a427ff4a8ba8f5b8dd7425c]
#    to [55d10ed455668530a6e7d980654040b46265458e]
# 
# patch "packages/uclibc/uclibc_0.9.29.bb"
#  from [919b3638137d8bf173c16723925c4199648693b5]
#    to [edbe56f785cf900a5e6bd127194027122bef9123]
# 
============================================================
--- packages/uclibc/uclibc-0.9.29/uClibc-0.9.29-002-atmel.1.patch	b1a4e2194e3a3205defb1102554b7bf2fe0a0686
+++ packages/uclibc/uclibc-0.9.29/uClibc-0.9.29-002-atmel.1.patch	b1a4e2194e3a3205defb1102554b7bf2fe0a0686
@@ -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, at 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 at 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 at 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%s
>>> DIFF TRUNCATED @ 16K






More information about the Openembedded-commits mailing list