aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/uclibc
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2010-01-12 17:59:15 -0800
committerKhem Raj <raj.khem@gmail.com>2010-01-12 18:00:59 -0800
commitecb41b75cdbc4d66c3b31bde94583c2797b8fa1d (patch)
tree3f24621a34f5f7bf288cf25814bcfba2a67e64af /recipes/uclibc
parent1020db745ddb68c3a14805b410d441502f6586dc (diff)
downloadopenembedded-ecb41b75cdbc4d66c3b31bde94583c2797b8fa1d.tar.gz
uclibc-nptl: Fix booting problems on mips nptl.
* This patch fixes the fundamental problems in getting a bootable system based on uclibc nptl for mips. Patch is submitted upstream. Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'recipes/uclibc')
-rw-r--r--recipes/uclibc/uclibc-nptl/uclibc_fix_mips_tls_relocation_and_crt.patch127
-rw-r--r--recipes/uclibc/uclibc_nptl.bb1
2 files changed, 128 insertions, 0 deletions
diff --git a/recipes/uclibc/uclibc-nptl/uclibc_fix_mips_tls_relocation_and_crt.patch b/recipes/uclibc/uclibc-nptl/uclibc_fix_mips_tls_relocation_and_crt.patch
new file mode 100644
index 0000000000..b964da7512
--- /dev/null
+++ b/recipes/uclibc/uclibc-nptl/uclibc_fix_mips_tls_relocation_and_crt.patch
@@ -0,0 +1,127 @@
+Index: git/ldso/ldso/mips/elfinterp.c
+===================================================================
+--- git.orig/ldso/ldso/mips/elfinterp.c 2010-01-12 12:11:37.268037011 -0800
++++ git/ldso/ldso/mips/elfinterp.c 2010-01-12 12:11:56.132037599 -0800
+@@ -148,7 +148,7 @@ int _dl_parse_relocation_information(str
+ unsigned long rel_addr, unsigned long rel_size)
+ {
+ ElfW(Sym) *symtab;
+- ElfW(Rel) *rpnt;
++ ELF_RELOC *rpnt;
+ char *strtab;
+ unsigned long i;
+ unsigned long *got;
+@@ -162,7 +162,7 @@ int _dl_parse_relocation_information(str
+
+ /* Now parse the relocation information */
+ rel_size = rel_size / sizeof(ElfW(Rel));
+- rpnt = (ElfW(Rel) *) rel_addr;
++ rpnt = (ELF_RELOC *) rel_addr;
+
+ symtab = (ElfW(Sym) *) tpnt->dynamic_info[DT_SYMTAB];
+ strtab = (char *) tpnt->dynamic_info[DT_STRTAB];
+@@ -172,8 +172,8 @@ int _dl_parse_relocation_information(str
+ char *symname = NULL;
+ reloc_addr = (unsigned long *) (tpnt->loadaddr +
+ (unsigned long) rpnt->r_offset);
+- reloc_type = ELF_R_TYPE(rpnt->r_info);
+- symtab_index = ELF_R_SYM(rpnt->r_info);
++ reloc_type = ELF32_R_TYPE(rpnt->r_info);
++ symtab_index = ELF32_R_SYM(rpnt->r_info);
+ symbol_addr = 0;
+
+ debug_sym(symtab,strtab,symtab_index);
+@@ -206,12 +206,20 @@ int _dl_parse_relocation_information(str
+ # endif
+ {
+ ElfW(Sym) *sym_tls = &symtab[symtab_index];
+- struct elf_resolve *tpnt_tls = tpnt;
++ struct elf_resolve *tpnt_tls = NULL;
+
+ if (ELF32_ST_BIND(symtab[symtab_index].st_info) != STB_LOCAL) {
+ _dl_find_hash((strtab + symtab[symtab_index].st_name),
+- _dl_symbol_tables, tpnt_tls, 1, &sym_tls);
++ _dl_symbol_tables, tpnt,
++ elf_machine_type_class(reloc_type), &tpnt_tls);
+ }
++#if USE_TLS
++ /* In case of a TLS reloc, tpnt_tls NULL means we have an 'anonymous'
++ symbol. This is the case for a static tls variable, so the lookup
++ module is just that one is referencing the tls variable. */
++ if (!tpnt_tls)
++ tpnt_tls = tpnt;
++#endif
+
+ switch (reloc_type) {
+ case R_MIPS_TLS_DTPMOD64:
+Index: git/libc/sysdeps/linux/mips/crt1.S
+===================================================================
+--- git.orig/libc/sysdeps/linux/mips/crt1.S 2010-01-12 12:11:37.328038307 -0800
++++ git/libc/sysdeps/linux/mips/crt1.S 2010-01-12 12:11:45.720038162 -0800
+@@ -85,29 +85,10 @@
+
+ __start:
+ #ifdef __PIC__
+-#if _MIPS_SIM == _MIPS_SIM_ABI32
+- .frame sp, 24, sp
+- .set noreorder
+- move $0, $31 /* Save old ra. */
+- bal 10f /* Find addr of cpload. */
+- nop
+-10:
+- .cpload $31
+- move $31, $0
+- .set reorder
+- .cprestore 16
+-#else
+- move $0, $31; /* Save old ra. */
+- .set noreorder
+- bal 10f /* Find addr of .cpsetup. */
+- nop
+-10:
+- .set reorder
+- .cpsetup $31, $25, 10b
+- move $31, $0
+-#endif
++ SETUP_GPX($0)
++ SETUP_GPX64($25,$0)
+ #else
+- la $28, _gp /* Setup GP correctly if we're non-PIC. */
++ PTR_LA $28, _gp /* Setup GP correctly if we're non-PIC. */
+ move $31, $0
+ #endif
+
+@@ -118,18 +99,18 @@ __start:
+ /* Allocate space on the stack for seven arguments and
+ * make sure the stack is aligned to double words (8 bytes) */
+
++ and $29, -2 * SZREG
++
+ #if _MIPS_SIM == _MIPS_SIM_ABI32
+- and $29, -2 * 4
+- subu $29, 32
+- la $7, _init /* init */
+- la $8, _fini
+- sw $8, 16($29) /* fini */
+- sw $2, 20($29) /* rtld_fini */
+- sw $29, 24($29) /* stack_end */
+-#else
+- and $29, -2 * PTRSIZE
++ PTR_SUBIU $29, 32
++#endif
+ PTR_LA $7, _init /* init */
+- PTR_LA $8, _fini /* fini */
++ PTR_LA $8, _fini
++#if _MIPS_SIM == _MIPS_SIM_ABI32
++ PTR_S $8, 16($29) /* fini */
++ PTR_S $2, 20($29) /* rtld_fini */
++ PTR_S $29, 24($29) /* stack_end */
++#else
+ move $9, $2 /* rtld_fini */
+ move $10, $29 /* stack_end */
+ #endif
+@@ -148,4 +129,3 @@ __data_start:
+ .weak data_start
+ data_start = __data_start
+
+-
diff --git a/recipes/uclibc/uclibc_nptl.bb b/recipes/uclibc/uclibc_nptl.bb
index 4510a987d9..428c6f62c3 100644
--- a/recipes/uclibc/uclibc_nptl.bb
+++ b/recipes/uclibc/uclibc_nptl.bb
@@ -35,6 +35,7 @@ SRC_URI = "git://uclibc.org/uClibc.git;protocol=git;branch=nptl \
file://ldso_use_arm_dl_linux_resolve_in_thumb_mode.patch;patch=1 \
file://uclibc_arm_remove_duplicate_sysdep_defs.patch;patch=1 \
file://installfix.patch;patch=1 \
+ file://uclibc_fix_mips_tls_relocation_and_crt.patch;patch=1 \
"
S = "${WORKDIR}/git"