summaryrefslogtreecommitdiff
path: root/ldso/ldso/powerpc
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-08-08 14:35:49 +0000
committerEric Andersen <andersen@codepoet.org>2002-08-08 14:35:49 +0000
commit9cba52f0aedbb95671e8a14e3fd5ff98381ff2b0 (patch)
treedd82b29998103d7d8ba34351e6fc3a12dc0ed7ac /ldso/ldso/powerpc
parent4c69b9f793fc1eae9190d8ba26dba25db616272f (diff)
Patch from Stefan Allius and Edie C. Dost to add SuperH
shared library support. This also adds some cleaner error handling, which I (Erik) then ported over to x86 and arm. In addition Stefan added the following fixes: - in hash.c was the lvalue handling of global library functions wrong. To fix this I had to change the prototype of _dl_find_hash. (==> TIS and ELF spec. Vers. 1.2) - in ldso.c was the order of the .init sections calls wrong. Before we call the initialization code of a library we have to check that all dependend libraries are already initialized. This can easily made by calling it in the revers loading order. For this I added a previous pointer chain. - in ldso.c the ELF magics wasn't checked fo PPC, MIPS and SH architecture
Diffstat (limited to 'ldso/ldso/powerpc')
-rw-r--r--ldso/ldso/powerpc/boot1_arch.h2
-rw-r--r--ldso/ldso/powerpc/dl-startup.h2
-rw-r--r--ldso/ldso/powerpc/elfinterp.c56
3 files changed, 35 insertions, 25 deletions
diff --git a/ldso/ldso/powerpc/boot1_arch.h b/ldso/ldso/powerpc/boot1_arch.h
index 0e2e1f055..ae7939eb2 100644
--- a/ldso/ldso/powerpc/boot1_arch.h
+++ b/ldso/ldso/powerpc/boot1_arch.h
@@ -17,5 +17,5 @@ _dl_boot:
");
#define _dl_boot _dl_boot2
-#define DL_BOOT(X) static void * __attribute__ ((unused)) _dl_boot (X)
+#define LD_BOOT(X) static void * __attribute__ ((unused)) _dl_boot (X)
diff --git a/ldso/ldso/powerpc/dl-startup.h b/ldso/ldso/powerpc/dl-startup.h
index 0e2e1f055..ae7939eb2 100644
--- a/ldso/ldso/powerpc/dl-startup.h
+++ b/ldso/ldso/powerpc/dl-startup.h
@@ -17,5 +17,5 @@ _dl_boot:
");
#define _dl_boot _dl_boot2
-#define DL_BOOT(X) static void * __attribute__ ((unused)) _dl_boot (X)
+#define LD_BOOT(X) static void * __attribute__ ((unused)) _dl_boot (X)
diff --git a/ldso/ldso/powerpc/elfinterp.c b/ldso/ldso/powerpc/elfinterp.c
index 5ecef1a02..4d263df2f 100644
--- a/ldso/ldso/powerpc/elfinterp.c
+++ b/ldso/ldso/powerpc/elfinterp.c
@@ -1,22 +1,32 @@
-//#define DL_DEBUG
-/* Run an ELF binary on a linux system.
+/* vi: set sw=4 ts=4: */
+/* i386 ELF shared library loader suppport
+ *
+ * Copyright (C) 2001-2002, David A. Schleef
+ *
+ * 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.
+ */
- Copyright (C) 1993, Eric Youngdale.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, 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 General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
#ifndef VERBOSE_DLINKER
#define VERBOSE_DLINKER
#endif
@@ -49,7 +59,7 @@ static const char *_dl_reltypes[] =
working. */
-#ifdef DL_DEBUG_SYMBOLS
+#ifdef LD_DEBUG_SYMBOLS
static void debug_sym(Elf32_Sym *symtab,char *strtab,int symtab_index);
static void debug_reloc(ELF_RELOC *rpnt);
#define DPRINTF(fmt,args...) _dl_dprintf(2,fmt,args)
@@ -161,7 +171,7 @@ unsigned long _dl_linux_resolver(struct elf_resolve *tpnt, int reloc_entry)
/* Get the address of the GOT entry */
targ_addr = (unsigned long) _dl_find_hash(
strtab + symtab[symtab_index].st_name,
- tpnt->symbol_scope, tpnt, 0);
+ tpnt->symbol_scope, tpnt, resolver);
if (!targ_addr) {
_dl_dprintf(2, "%s: can't resolve symbol '%s'\n",
_dl_progname, strtab + symtab[symtab_index].st_name);
@@ -338,7 +348,7 @@ int _dl_parse_relocation_information(struct elf_resolve *tpnt,
symbol_addr = (unsigned long) _dl_find_hash(strtab + symtab[symtab_index].st_name,
tpnt->symbol_scope,
- (reloc_type == R_PPC_JMP_SLOT ? tpnt : NULL), 0);
+ (reloc_type == R_PPC_JMP_SLOT ? tpnt : NULL), symbolrel);
/*
* We want to allow undefined references to weak symbols - this might
@@ -499,7 +509,7 @@ int _dl_parse_copy_information(struct dyn_elf *xpnt, unsigned long rel_addr,
symbol_addr = (unsigned long) _dl_find_hash(strtab +
symtab[symtab_index].st_name, xpnt->next,
- NULL, 1);
+ NULL, copyrel);
if (!symbol_addr) {
_dl_dprintf(2, "%s: can't resolve symbol '%s'\n",
_dl_progname, strtab + symtab[symtab_index].st_name);
@@ -551,7 +561,7 @@ static void fixup_jmpslot(unsigned long reloc_addr, unsigned long targ_addr)
#endif
-#ifdef DL_DEBUG_SYMBOLS
+#ifdef LD_DEBUG_SYMBOLS
static void debug_sym(Elf32_Sym *symtab,char *strtab,int symtab_index)
{
if(symtab_index){