From 9cba52f0aedbb95671e8a14e3fd5ff98381ff2b0 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Thu, 8 Aug 2002 14:35:49 +0000 Subject: 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 --- ldso/ldso/sparc/boot1_arch.h | 2 +- ldso/ldso/sparc/dl-startup.h | 2 +- ldso/ldso/sparc/elfinterp.c | 56 +++++++++++++++++++++++++++----------------- 3 files changed, 36 insertions(+), 24 deletions(-) (limited to 'ldso/ldso/sparc') diff --git a/ldso/ldso/sparc/boot1_arch.h b/ldso/ldso/sparc/boot1_arch.h index 2f8fe1357..cd1f016a6 100644 --- a/ldso/ldso/sparc/boot1_arch.h +++ b/ldso/ldso/sparc/boot1_arch.h @@ -4,4 +4,4 @@ * can be done. */ -#define DL_BOOT(X) void _dl_boot (X) +#define LD_BOOT(X) void _dl_boot (X) diff --git a/ldso/ldso/sparc/dl-startup.h b/ldso/ldso/sparc/dl-startup.h index 2f8fe1357..cd1f016a6 100644 --- a/ldso/ldso/sparc/dl-startup.h +++ b/ldso/ldso/sparc/dl-startup.h @@ -4,4 +4,4 @@ * can be done. */ -#define DL_BOOT(X) void _dl_boot (X) +#define LD_BOOT(X) void _dl_boot (X) diff --git a/ldso/ldso/sparc/elfinterp.c b/ldso/ldso/sparc/elfinterp.c index 3270a0821..60ec4b0e8 100644 --- a/ldso/ldso/sparc/elfinterp.c +++ b/ldso/ldso/sparc/elfinterp.c @@ -1,21 +1,33 @@ -/* Run an ELF binary on a linux system. +/* vi: set sw=4 ts=4: */ +/* sparc ELF shared library loader suppport + * + * Copyright (c) 1994-2000 Eric Youngdale, Peter MacDonald, + * David Engel, Hongjiu Lu and Mitch D'Souza + * + * 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) 1995, 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 @@ -91,20 +103,20 @@ unsigned int _dl_linux_resolver(unsigned int reloc_entry, unsigned int * plt) _dl_dprintf(2, "symtab_index %d\n", symtab_index); -#ifdef DL_DEBUG_SYMBOLS +#ifdef LD_DEBUG_SYMBOLS _dl_dprintf(2, "Resolving symbol %s\n", strtab + symtab[symtab_index].st_name); #endif /* Get the address of the GOT entry */ new_addr = _dl_find_hash(strtab + symtab[symtab_index].st_name, - tpnt->symbol_scope, tpnt, 0); + tpnt->symbol_scope, tpnt, resolver); if(!new_addr) { _dl_dprintf(2, "%s: can't resolve symbol '%s'\n", _dl_progname, strtab + symtab[symtab_index].st_name); _dl_exit(31); }; -#ifdef DL_NEVER_FIXUP_SYMBOLS +#ifdef LD_NEVER_FIXUP_SYMBOLS if((unsigned int) got_addr < 0x40000000) { _dl_dprintf(2, "Calling library function: %s\n", strtab + symtab[symtab_index].st_name); @@ -202,7 +214,7 @@ int _dl_parse_relocation_information(struct elf_resolve * tpnt, int rel_addr, symbol_addr = (unsigned int) _dl_find_hash(strtab + symtab[symtab_index].st_name, tpnt->symbol_scope, - (reloc_type == R_SPARC_JMP_SLOT ? tpnt : NULL), 0); + (reloc_type == R_SPARC_JMP_SLOT ? tpnt : NULL), symbolrel); if(!symbol_addr && ELF32_ST_BIND(symtab [symtab_index].st_info) == STB_GLOBAL) { @@ -319,7 +331,7 @@ int _dl_parse_copy_information(struct dyn_elf * xpnt, int rel_addr, symbol_addr = (unsigned int) _dl_find_hash(strtab + symtab[symtab_index].st_name, - xpnt->next, NULL, 1); + xpnt->next, NULL, copyrel); if(!symbol_addr) { _dl_dprintf(2, "%s: can't resolve symbol '%s'\n", _dl_progname, strtab + symtab[symtab_index].st_name); -- cgit v1.2.3