summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ldso/Makefile3
-rw-r--r--ldso/ldso/Makefile4
-rw-r--r--ldso/ldso/arm/dl-debug.h44
-rw-r--r--ldso/ldso/arm/elfinterp.c75
-rw-r--r--ldso/ldso/cris/dl-debug.h42
-rw-r--r--ldso/ldso/cris/elfinterp.c72
-rw-r--r--ldso/ldso/dl-debug.c106
-rw-r--r--ldso/ldso/frv/dl-debug.h43
-rw-r--r--ldso/ldso/frv/elfinterp.c79
-rw-r--r--ldso/ldso/i386/dl-debug.h36
-rw-r--r--ldso/ldso/i386/elfinterp.c69
-rw-r--r--ldso/ldso/ldso.c4
-rw-r--r--ldso/ldso/mips/dl-debug.h45
-rw-r--r--ldso/ldso/mips/elfinterp.c78
-rw-r--r--ldso/ldso/powerpc/dl-debug.h44
-rw-r--r--ldso/ldso/powerpc/elfinterp.c78
-rw-r--r--ldso/ldso/sh/dl-debug.h41
-rw-r--r--ldso/ldso/sh/elfinterp.c74
-rw-r--r--ldso/ldso/sh64/dl-debug.h79
-rw-r--r--ldso/ldso/sh64/elfinterp.c112
-rw-r--r--ldso/ldso/x86_64/dl-debug.h36
-rw-r--r--ldso/libdl/libdl.c1
22 files changed, 526 insertions, 639 deletions
diff --git a/ldso/Makefile b/ldso/Makefile
index afbe5d08a..f0d1ca56d 100644
--- a/ldso/Makefile
+++ b/ldso/Makefile
@@ -35,7 +35,7 @@ ldso libdl shared:
echo "Skipping $@ target"
endif
-HEADERS = $(patsubst %, include/%, elf.h dl-startup.h dl-syscalls.h dl-sysdep.h)
+HEADERS = $(patsubst %, include/%, elf.h dl-startup.h dl-syscalls.h dl-sysdep.h dl-debug.h)
headers: $(HEADERS) include/dl-progname.h
include/dl-progname.h:
echo "const char *_dl_progname=\""$(UCLIBC_LDSO)"\";" \
@@ -47,6 +47,7 @@ $(HEADERS):
$(LN) -fs ../ldso/$(TARGET_ARCH)/dl-startup.h include/
$(LN) -fs ../ldso/$(TARGET_ARCH)/dl-syscalls.h include/
$(LN) -fs ../ldso/$(TARGET_ARCH)/dl-sysdep.h include/
+ $(LN) -fs ../ldso/$(TARGET_ARCH)/dl-debug.h include/
clean:
set -e ; for d in $(DIRS) ; do $(MAKE) -C $$d $@ ; done
diff --git a/ldso/ldso/Makefile b/ldso/ldso/Makefile
index c0bfc81e3..3aaafb76e 100644
--- a/ldso/ldso/Makefile
+++ b/ldso/ldso/Makefile
@@ -36,7 +36,7 @@ ifeq ($(DODEBUG),y)
# Not really much point in including debugging info, since gdb
# can't really debug ldso, since gdb requires help from ldso to
# debug things....
-XXFLAGS+=-Os #-g3
+XXFLAGS+=-Os -g3
else
XXFLAGS+=$(OPTIMIZATION)
endif
@@ -91,7 +91,7 @@ $(AOBJS): %.o : %.S
$(CC) $(XXFLAGS) $(ASFLAGS) -I../libdl -c $< -o $@
$(STRIPTOOL) -x -R .note -R .comment $*.o
-ldso.o: $(CSRC) dl-elf.c dl-hash.c dl-startup.c \
+ldso.o: $(CSRC) dl-elf.c dl-hash.c dl-startup.c dl-debug.c \
$(TARGET_ARCH)/*.h $(TARGET_ARCH)/*.c $(TOPDIR)ldso/include/*.h
clean:
diff --git a/ldso/ldso/arm/dl-debug.h b/ldso/ldso/arm/dl-debug.h
new file mode 100644
index 000000000..d5103202c
--- /dev/null
+++ b/ldso/ldso/arm/dl-debug.h
@@ -0,0 +1,44 @@
+/* vi: set sw=4 ts=4: */
+/* ARM ELF shared library loader suppport
+ *
+ * Copyright (C) 2001-2004 Erik Andersen
+ *
+ * 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[] =
+{
+ [0] "R_ARM_NONE", "R_ARM_PC24", "R_ARM_ABS32", "R_ARM_REL32",
+ [4] "R_ARM_PC13", "R_ARM_ABS16", "R_ARM_ABS12", "R_ARM_THM_ABS5",
+ [8] "R_ARM_ABS8", "R_ARM_SBREL32","R_ARM_THM_PC22", "R_ARM_THM_PC8",
+ [12] "R_ARM_AMP_VCALL9", "R_ARM_SWI24", "R_ARM_THM_SWI8", "R_ARM_XPC25",
+ [16] "R_ARM_THM_XPC22",
+ [20] "R_ARM_COPY", "R_ARM_GLOB_DAT","R_ARM_JUMP_SLOT", "R_ARM_RELATIVE",
+ [24] "R_ARM_GOTOFF", "R_ARM_GOTPC", "R_ARM_GOT32", "R_ARM_PLT32",
+ [32] "R_ARM_ALU_PCREL_7_0","R_ARM_ALU_PCREL_15_8","R_ARM_ALU_PCREL_23_15","R_ARM_LDR_SBREL_11_0",
+ [36] "R_ARM_ALU_SBREL_19_12","R_ARM_ALU_SBREL_27_20",
+ [100] "R_ARM_GNU_VTENTRY","R_ARM_GNU_VTINHERIT","R_ARM_THM_PC11","R_ARM_THM_PC9",
+ [249] "R_ARM_RXPC25", "R_ARM_RSBREL32", "R_ARM_THM_RPC22", "R_ARM_RREL32",
+ [253] "R_ARM_RABS22", "R_ARM_RPC24", "R_ARM_RBASE",
+};
diff --git a/ldso/ldso/arm/elfinterp.c b/ldso/ldso/arm/elfinterp.c
index 228a1cee2..8086250ac 100644
--- a/ldso/ldso/arm/elfinterp.c
+++ b/ldso/ldso/arm/elfinterp.c
@@ -27,79 +27,6 @@
* SUCH DAMAGE.
*/
-#if defined (__SUPPORT_LD_DEBUG__)
-static const char *_dl_reltypes_tab[] =
-{
- [0] "R_ARM_NONE", "R_ARM_PC24", "R_ARM_ABS32", "R_ARM_REL32",
- [4] "R_ARM_PC13", "R_ARM_ABS16", "R_ARM_ABS12", "R_ARM_THM_ABS5",
- [8] "R_ARM_ABS8", "R_ARM_SBREL32","R_ARM_THM_PC22", "R_ARM_THM_PC8",
- [12] "R_ARM_AMP_VCALL9", "R_ARM_SWI24", "R_ARM_THM_SWI8", "R_ARM_XPC25",
- [16] "R_ARM_THM_XPC22",
- [20] "R_ARM_COPY", "R_ARM_GLOB_DAT","R_ARM_JUMP_SLOT", "R_ARM_RELATIVE",
- [24] "R_ARM_GOTOFF", "R_ARM_GOTPC", "R_ARM_GOT32", "R_ARM_PLT32",
- [32] "R_ARM_ALU_PCREL_7_0","R_ARM_ALU_PCREL_15_8","R_ARM_ALU_PCREL_23_15","R_ARM_LDR_SBREL_11_0",
- [36] "R_ARM_ALU_SBREL_19_12","R_ARM_ALU_SBREL_27_20",
- [100] "R_ARM_GNU_VTENTRY","R_ARM_GNU_VTINHERIT","R_ARM_THM_PC11","R_ARM_THM_PC9",
- [249] "R_ARM_RXPC25", "R_ARM_RSBREL32", "R_ARM_THM_RPC22", "R_ARM_RREL32",
- [253] "R_ARM_RABS22", "R_ARM_RPC24", "R_ARM_RBASE",
-};
-
-static const char *
-_dl_reltypes(int type)
-{
- static char buf[22];
- const char *str;
-
- if (type >= (sizeof (_dl_reltypes_tab)/sizeof(_dl_reltypes_tab[0])) ||
- NULL == (str = _dl_reltypes_tab[type]))
- {
- str =_dl_simple_ltoa( buf, (unsigned long)(type));
- }
- return str;
-}
-
-static
-void debug_sym(Elf32_Sym *symtab,char *strtab,int symtab_index)
-{
- if(_dl_debug_symbols)
- {
- if(symtab_index){
- _dl_dprintf(_dl_debug_file, "\n%s\tvalue=%x\tsize=%x\tinfo=%x\tother=%x\tshndx=%x",
- strtab + symtab[symtab_index].st_name,
- symtab[symtab_index].st_value,
- symtab[symtab_index].st_size,
- symtab[symtab_index].st_info,
- symtab[symtab_index].st_other,
- symtab[symtab_index].st_shndx);
- }
- }
-}
-
-static void debug_reloc(Elf32_Sym *symtab,char *strtab, ELF_RELOC *rpnt)
-{
- if(_dl_debug_reloc)
- {
- int symtab_index;
- const char *sym;
- symtab_index = ELF32_R_SYM(rpnt->r_info);
- sym = symtab_index ? strtab + symtab[symtab_index].st_name : "sym=0x0";
-
-#ifdef ELF_USES_RELOCA
- _dl_dprintf(_dl_debug_file, "\n%s\toffset=%x\taddend=%x %s",
- _dl_reltypes(ELF32_R_TYPE(rpnt->r_info)),
- rpnt->r_offset,
- rpnt->r_addend,
- sym);
-#else
- _dl_dprintf(_dl_debug_file, "\n%s\toffset=%x %s",
- _dl_reltypes(ELF32_R_TYPE(rpnt->r_info)),
- rpnt->r_offset,
- sym);
-#endif
- }
-}
-#endif
-
/* Program to load an ELF binary on a linux system, and run it.
References to symbols in sharable libraries can be resolved by either
an ELF sharable library or a linux style of shared library. */
@@ -201,10 +128,8 @@ _dl_parse(struct elf_resolve *tpnt, struct dyn_elf *scope,
symtab_index = ELF32_R_SYM(rpnt->r_info);
-#if defined (__SUPPORT_LD_DEBUG__)
debug_sym(symtab,strtab,symtab_index);
debug_reloc(symtab,strtab,rpnt);
-#endif
res = reloc_fnc (tpnt, scope, rpnt, symtab, strtab);
diff --git a/ldso/ldso/cris/dl-debug.h b/ldso/ldso/cris/dl-debug.h
new file mode 100644
index 000000000..f6c03d21f
--- /dev/null
+++ b/ldso/ldso/cris/dl-debug.h
@@ -0,0 +1,42 @@
+/*
+ * CRIS ELF shared library loader support.
+ *
+ * Program to load an elf binary on a linux system, and run it.
+ * References to symbols in sharable libraries can be resolved
+ * by either an ELF sharable library or a linux style of shared
+ * library.
+ *
+ * Copyright (C) 2002-2004, Axis Communications AB
+ * All rights reserved
+ *
+ * Author: Tobias Anderberg, <tobiasa@axis.com>
+ *
+ * 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[] = {
+ [0] "R_CRIS_NONE", "R_CRIS_8", "R_CRIS_16", "R_CRIS_32",
+ [4] "R_CRIS_8_PCREL", "R_CRIS_16_PCREL", "R_CRIS_32_PCREL", "R_CRIS_GNU_VTINHERIT",
+ [8] "R_CRIS_GNU_VTENTRY", "R_CRIS_COPY", "R_CRIS_GLOB_DAT", "R_CRIS_JUMP_SLOT",
+ [16] "R_CRIS_RELATIVE", "R_CRIS_16_GOT", "R_CRIS_32_GOT", "R_CRIS_16_GOTPLT",
+ [32] "R_CRIS_32_GOTPLT", "R_CRIS_32_GOTREL", "R_CRIS_32_PLT_GOTREL", "R_CRIS_32_PLT_PCREL",
+};
diff --git a/ldso/ldso/cris/elfinterp.c b/ldso/ldso/cris/elfinterp.c
index 5932fd0f1..abf4167a5 100644
--- a/ldso/ldso/cris/elfinterp.c
+++ b/ldso/ldso/cris/elfinterp.c
@@ -35,76 +35,6 @@
#include "ldso.h"
-/* Support for the LD_DEBUG variable. */
-#if defined (__SUPPORT_LD_DEBUG__)
-static const char *_dl_reltypes_tab[] = {
- [0] "R_CRIS_NONE", "R_CRIS_8", "R_CRIS_16", "R_CRIS_32",
- [4] "R_CRIS_8_PCREL", "R_CRIS_16_PCREL", "R_CRIS_32_PCREL", "R_CRIS_GNU_VTINHERIT",
- [8] "R_CRIS_GNU_VTENTRY", "R_CRIS_COPY", "R_CRIS_GLOB_DAT", "R_CRIS_JUMP_SLOT",
- [16] "R_CRIS_RELATIVE", "R_CRIS_16_GOT", "R_CRIS_32_GOT", "R_CRIS_16_GOTPLT",
- [32] "R_CRIS_32_GOTPLT", "R_CRIS_32_GOTREL", "R_CRIS_32_PLT_GOTREL", "R_CRIS_32_PLT_PCREL",
-};
-
-static const char *
-_dl_reltypes(int type)
-{
- static char buf[22];
- const char *str;
-
- if (type >= (sizeof(_dl_reltypes_tab)/sizeof(_dl_reltypes_tab[0])) ||
- NULL == (str = _dl_reltypes_tab[type])) {
- str = _dl_simple_ltoa(buf, (unsigned long)type);
- }
-
- return str;
-}
-
-static void
-debug_sym(Elf32_Sym *symtab, char *strtab, int symtab_index)
-{
- if (_dl_debug_symbols) {
- if (symtab_index) {
- _dl_dprintf(_dl_debug_file,
- "\n%s\n\tvalue=%x\tsize=%x\tinfo=%x\tother=%x\tshndx=%x",
- strtab + symtab[symtab_index].st_name,
- symtab[symtab_index].st_value,
- symtab[symtab_index].st_size,
- symtab[symtab_index].st_info,
- symtab[symtab_index].st_other,
- symtab[symtab_index].st_shndx);
- }
- }
-}
-
-static void
-debug_reloc(Elf32_Sym *symtab, char *strtab, ELF_RELOC *rpnt)
-{
- if (_dl_debug_reloc) {
- int symtab_index;
- const char *sym;
-
- symtab_index = ELF32_R_SYM(rpnt->r_info);
- sym = symtab_index ? strtab + symtab[symtab_index].st_name : "sym=0x0";
-
- if (_dl_debug_symbols)
- _dl_dprintf(_dl_debug_file, "\n\t");
- else
- _dl_dprintf(_dl_debug_file, "\n%s\n\t", sym);
-
-#ifdef ELF_USES_RELOCA
- _dl_dprintf(_dl_debug_file, "%s\toffset=%x\taddend=%x",
- _dl_reltypes(ELF32_R_TYPE(rpnt->r_info)),
- rpnt->r_offset,
- rpnt->r_addend);
-#else
- _dl_dprintf(_dl_debug_file, "%s\toffset=%x\n",
- _dl_reltypes(ELF32_R_TYPE(rpnt->r_info)),
- rpnt->r_offset);
-#endif
- }
-}
-#endif /* __SUPPORT_LD_DEBUG__ */
-
/* Defined in resolve.S. */
extern int _dl_linux_resolve(void);
@@ -192,10 +122,8 @@ _dl_parse(struct elf_resolve *tpnt, struct dyn_elf *scope,
symtab_index = ELF32_R_SYM(rpnt->r_info);
-#if defined (__SUPPORT_LD_DEBUG__)
debug_sym(symtab, strtab, symtab_index);
debug_reloc(symtab, strtab, rpnt);
-#endif
/* Pass over to actual relocation function. */
res = reloc_fnc(tpnt, scope, rpnt, symtab, strtab);
diff --git a/ldso/ldso/dl-debug.c b/ldso/ldso/dl-debug.c
new file mode 100644
index 000000000..7ce8bfbce
--- /dev/null
+++ b/ldso/ldso/dl-debug.c
@@ -0,0 +1,106 @@
+/* vi: set sw=4 ts=4: */
+/* common debug code for ELF shared library loader
+ *
+ * Copyright (c) 1994-2000 Eric Youngdale, Peter MacDonald,
+ * David Engel, Hongjiu Lu and Mitch D'Souza
+ * Copyright (C) 2001-2004 Erik Andersen
+ * Copyright (C) 2002-2004, Axis Communications AB
+ * Copyright (C) 2003, 2004 Red Hat, Inc.
+ * Copyright (C) 2002, Steven J. Hill (sjhill@realitydiluted.com)
+ * Copyright (C) 2001-2002 David A. Schleef
+ * Copyright (C) 2004 Joakim Tjernlund
+ * Copyright (C) 2002, Stefan Allius <allius@atecom.com> and
+ * Eddie C. Dost <ecd@atecom.com>
+ * Copyright (C) 2003, 2004, 2005 Paul Mundt <lethal@linux-sh.org>
+ *
+ * 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.
+ */
+
+#include "ldso.h"
+
+#if defined (__SUPPORT_LD_DEBUG__)
+
+/* include the arch-specific _dl_reltypes_tab */
+#include "dl-debug.h"
+
+static const char *_dl_reltypes(int type)
+{
+ static char buf[50];
+ const char *str;
+ int tabsize;
+
+ tabsize = (int)(sizeof(_dl_reltypes_tab) / sizeof(_dl_reltypes_tab[0]));
+
+ if (type >= tabsize || (str = _dl_reltypes_tab[type]) == NULL)
+ str = _dl_simple_ltoa(buf, (unsigned long)type);
+
+ return str;
+}
+static void debug_sym(ElfW(Sym) *symtab, char *strtab, int symtab_index)
+{
+ if (!_dl_debug_symbols || !symtab_index)
+ return;
+
+ _dl_dprintf(_dl_debug_file,
+ "\n%s\n\tvalue=%x\tsize=%x\tinfo=%x\tother=%x\tshndx=%x",
+ strtab + symtab[symtab_index].st_name,
+ symtab[symtab_index].st_value,
+ symtab[symtab_index].st_size,
+ symtab[symtab_index].st_info,
+ symtab[symtab_index].st_other,
+ symtab[symtab_index].st_shndx);
+}
+
+static void debug_reloc(ElfW(Sym) *symtab, char *strtab, ELF_RELOC *rpnt)
+{
+ if (!_dl_debug_reloc)
+ return;
+
+ if (_dl_debug_symbols) {
+ _dl_dprintf(_dl_debug_file, "\n\t");
+ } else {
+ int symtab_index;
+ const char *sym;
+
+ symtab_index = ELF_R_SYM(rpnt->r_info);
+ sym = symtab_index ? strtab + symtab[symtab_index].st_name : "sym=0x0";
+
+ _dl_dprintf(_dl_debug_file, "\n%s\n\t", sym);
+ }
+
+ _dl_dprintf(_dl_debug_file, "%s\toffset=%x",
+ _dl_reltypes(ELF_R_TYPE(rpnt->r_info)),
+ rpnt->r_offset);
+#ifdef ELF_USES_RELOCA
+ _dl_dprintf(_dl_debug_file, "\taddend=%x", rpnt->r_addend);
+#endif
+ _dl_dprintf(_dl_debug_file, "\n");
+}
+
+#else
+
+#define debug_sym(symtab, strtab, symtab_index)
+#define debug_reloc(symtab, strtab, rpnt)
+
+#endif /* __SUPPORT_LD_DEBUG__ */
diff --git a/ldso/ldso/frv/dl-debug.h b/ldso/ldso/frv/dl-debug.h
new file mode 100644
index 000000000..8d392d319
--- /dev/null
+++ b/ldso/ldso/frv/dl-debug.h
@@ -0,0 +1,43 @@
+/* FR-V FDPIC ELF shared library loader suppport
+ Copyright (C) 2003, 2004 Red Hat, Inc.
+ Contributed by Alexandre Oliva <aoliva@redhat.com>
+ Lots of code copied from ../i386/elfinterp.c, so:
+ Copyright (c) 1994-2000 Eric Youngdale, Peter MacDonald,
+ David Engel, Hongjiu Lu and Mitch D'Souza
+ Copyright (C) 2001-2002, Erik Andersen
+ All rights reserved.
+
+This file is part of uClibc.
+
+uClibc is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of the
+License, or (at your option) any later version.
+
+uClibc 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 Lesser General Public
+License along with uClibc; see the file COPYING.LIB. If not, write to
+the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
+USA. */
+
+static const char *_dl_reltypes_tab[] =
+{
+ [0] "R_FRV_NONE", "R_FRV_32",
+ [2] "R_FRV_LABEL16", "R_FRV_LABEL24",
+ [4] "R_FRV_LO16", "R_FRV_HI16",
+ [6] "R_FRV_GPREL12", "R_FRV_GPRELU12",
+ [8] "R_FRV_GPREL32", "R_FRV_GPRELHI", "R_FRV_GPRELLO",
+ [11] "R_FRV_GOT12", "R_FRV_GOTHI", "R_FRV_GOTLO",
+ [14] "R_FRV_FUNCDESC",
+ [15] "R_FRV_FUNCDESC_GOT12", "R_FRV_FUNCDESC_GOTHI", "R_FRV_FUNCDESC_GOTLO",
+ [18] "R_FRV_FUNCDESC_VALUE", "R_FRV_FUNCDESC_GOTOFF12",
+ [20] "R_FRV_FUNCDESC_GOTOFFHI", "R_FRV_FUNCDESC_GOTOFFLO",
+ [22] "R_FRV_GOTOFF12", "R_FRV_GOTOFFHI", "R_FRV_GOTOFFLO",
+#if 0
+ [200] "R_FRV_GNU_VTINHERIT", "R_FRV_GNU_VTENTRY"
+#endif
+};
diff --git a/ldso/ldso/frv/elfinterp.c b/ldso/ldso/frv/elfinterp.c
index 9ab1a9777..cccf9b70c 100644
--- a/ldso/ldso/frv/elfinterp.c
+++ b/ldso/ldso/frv/elfinterp.c
@@ -26,83 +26,6 @@ USA. */
#include <sys/cdefs.h> /* __attribute_used__ */
-#if defined (__SUPPORT_LD_DEBUG__)
-static const char *_dl_reltypes_tab[] =
-{
- [0] "R_FRV_NONE", "R_FRV_32",
- [2] "R_FRV_LABEL16", "R_FRV_LABEL24",
- [4] "R_FRV_LO16", "R_FRV_HI16",
- [6] "R_FRV_GPREL12", "R_FRV_GPRELU12",
- [8] "R_FRV_GPREL32", "R_FRV_GPRELHI", "R_FRV_GPRELLO",
- [11] "R_FRV_GOT12", "R_FRV_GOTHI", "R_FRV_GOTLO",
- [14] "R_FRV_FUNCDESC",
- [15] "R_FRV_FUNCDESC_GOT12", "R_FRV_FUNCDESC_GOTHI", "R_FRV_FUNCDESC_GOTLO",
- [18] "R_FRV_FUNCDESC_VALUE", "R_FRV_FUNCDESC_GOTOFF12",
- [20] "R_FRV_FUNCDESC_GOTOFFHI", "R_FRV_FUNCDESC_GOTOFFLO",
- [22] "R_FRV_GOTOFF12", "R_FRV_GOTOFFHI", "R_FRV_GOTOFFLO",
-#if 0
- [200] "R_FRV_GNU_VTINHERIT", "R_FRV_GNU_VTENTRY"
-#endif
-};
-
-static const char *
-_dl_reltypes(int type)
-{
- static char buf[22];
- const char *str;
-
- if (type >= (int)(sizeof (_dl_reltypes_tab)/sizeof(_dl_reltypes_tab[0])) ||
- NULL == (str = _dl_reltypes_tab[type]))
- {
- str =_dl_simple_ltoa( buf, (unsigned long)(type));
- }
- return str;
-}
-
-static
-void debug_sym(Elf32_Sym *symtab,char *strtab,int symtab_index)
-{
- if(_dl_debug_symbols)
- {
- if(symtab_index){
- _dl_dprintf(_dl_debug_file, "\n%s\n\tvalue=%x\tsize=%x\tinfo=%x\tother=%x\tshndx=%x",
- strtab + symtab[symtab_index].st_name,
- symtab[symtab_index].st_value,
- symtab[symtab_index].st_size,
- symtab[symtab_index].st_info,
- symtab[symtab_index].st_other,
- symtab[symtab_index].st_shndx);
- }
- }
-}
-
-static void debug_reloc(Elf32_Sym *symtab,char *strtab, ELF_RELOC *rpnt)
-{
- if(_dl_debug_reloc)
- {
- int symtab_index;
- const char *sym;
- symtab_index = ELF32_R_SYM(rpnt->r_info);
- sym = symtab_index ? strtab + symtab[symtab_index].st_name : "sym=0x0";
-
- if(_dl_debug_symbols)
- _dl_dprintf(_dl_debug_file, "\n\t");
- else
- _dl_dprintf(_dl_debug_file, "\n%s\n\t", sym);
-#ifdef ELF_USES_RELOCA
- _dl_dprintf(_dl_debug_file, "%s\toffset=%x\taddend=%x",
- _dl_reltypes(ELF32_R_TYPE(rpnt->r_info)),
- rpnt->r_offset,
- rpnt->r_addend);
-#else
- _dl_dprintf(_dl_debug_file, "%s\toffset=%x\n",
- _dl_reltypes(ELF32_R_TYPE(rpnt->r_info)),
- rpnt->r_offset);
-#endif
- }
-}
-#endif
-
/* Program to load an ELF binary on a linux system, and run it.
References to symbols in sharable libraries can be resolved by either
an ELF sharable library or a linux style of shared library. */
@@ -213,10 +136,8 @@ _dl_parse(struct elf_resolve *tpnt, struct dyn_elf *scope,
int res;
symtab_index = ELF32_R_SYM(rpnt->r_info);
-#if defined (__SUPPORT_LD_DEBUG__)
debug_sym(symtab,strtab,symtab_index);
debug_reloc(symtab,strtab,rpnt);
-#endif
res = reloc_fnc (tpnt, scope, rpnt, symtab, strtab);
diff --git a/ldso/ldso/i386/dl-debug.h b/ldso/ldso/i386/dl-debug.h
new file mode 100644
index 000000000..72a01f8df
--- /dev/null
+++ b/ldso/ldso/i386/dl-debug.h
@@ -0,0 +1,36 @@
+/* vi: set sw=4 ts=4: */
+/* i386 ELF shared library loader suppport
+ *
+ * Copyright (c) 1994-2000 Eric Youngdale, Peter MacDonald,
+ * David Engel, Hongjiu Lu and Mitch D'Souza
+ * Copyright (C) 2001-2004 Erik Andersen
+ *
+ * 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[] = {
+ [0] "R_386_NONE", "R_386_32", "R_386_PC32", "R_386_GOT32",
+ [4] "R_386_PLT32", "R_386_COPY", "R_386_GLOB_DAT", "R_386_JMP_SLOT",
+ [8] "R_386_RELATIVE", "R_386_GOTOFF", "R_386_GOTPC",
+};
diff --git a/ldso/ldso/i386/elfinterp.c b/ldso/ldso/i386/elfinterp.c
index 6ec30325b..6292a2df8 100644
--- a/ldso/ldso/i386/elfinterp.c
+++ b/ldso/ldso/i386/elfinterp.c
@@ -31,73 +31,6 @@
#include "ldso.h"
-#if defined (__SUPPORT_LD_DEBUG__)
-static const char *_dl_reltypes_tab[] = {
- [0] "R_386_NONE", "R_386_32", "R_386_PC32", "R_386_GOT32",
- [4] "R_386_PLT32", "R_386_COPY", "R_386_GLOB_DAT", "R_386_JMP_SLOT",
- [8] "R_386_RELATIVE", "R_386_GOTOFF", "R_386_GOTPC",
-};
-
-static const char *
-_dl_reltypes(int type)
-{
- static char buf[22];
- const char *str;
-
- if (type >= (int)(sizeof(_dl_reltypes_tab)/sizeof(_dl_reltypes_tab[0])) ||
- NULL == (str = _dl_reltypes_tab[type])) {
- str = _dl_simple_ltoa(buf, (unsigned long)type);
- }
-
- return str;
-}
-
-static void
-debug_sym(Elf32_Sym *symtab, char *strtab, int symtab_index)
-{
- if (_dl_debug_symbols) {
- if (symtab_index) {
- _dl_dprintf(_dl_debug_file,
- "\n%s\n\tvalue=%x\tsize=%x\tinfo=%x\tother=%x\tshndx=%x",
- strtab + symtab[symtab_index].st_name,
- symtab[symtab_index].st_value,
- symtab[symtab_index].st_size,
- symtab[symtab_index].st_info,
- symtab[symtab_index].st_other,
- symtab[symtab_index].st_shndx);
- }
- }
-}
-
-static void
-debug_reloc(Elf32_Sym *symtab, char *strtab, ELF_RELOC *rpnt)
-{
- if (_dl_debug_reloc) {
- int symtab_index;
- const char *sym;
-
- symtab_index = ELF32_R_SYM(rpnt->r_info);
- sym = symtab_index ? strtab + symtab[symtab_index].st_name : "sym=0x0";
-
- if (_dl_debug_symbols)
- _dl_dprintf(_dl_debug_file, "\n\t");
- else
- _dl_dprintf(_dl_debug_file, "\n%s\n\t", sym);
-
-#ifdef ELF_USES_RELOCA
- _dl_dprintf(_dl_debug_file, "%s\toffset=%x\taddend=%x",
- _dl_reltypes(ELF32_R_TYPE(rpnt->r_info)),
- rpnt->r_offset,
- rpnt->r_addend);
-#else
- _dl_dprintf(_dl_debug_file, "%s\toffset=%x\n",
- _dl_reltypes(ELF32_R_TYPE(rpnt->r_info)),
- rpnt->r_offset);
-#endif
- }
-}
-#endif /* __SUPPORT_LD_DEBUG__ */
-
/* Program to load an ELF binary on a linux system, and run it.
References to symbols in sharable libraries can be resolved by either
an ELF sharable library or a linux style of shared library. */
@@ -196,10 +129,8 @@ _dl_parse(struct elf_resolve *tpnt, struct dyn_elf *scope,
symtab_index = ELF32_R_SYM(rpnt->r_info);
-#if defined (__SUPPORT_LD_DEBUG__)
debug_sym(symtab, strtab, symtab_index);
debug_reloc(symtab, strtab, rpnt);
-#endif
res = reloc_fnc(tpnt, scope, rpnt, symtab, strtab);
diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c
index 8ef70c893..4b31bcfa9 100644
--- a/ldso/ldso/ldso.c
+++ b/ldso/ldso/ldso.c
@@ -33,6 +33,9 @@
#include "ldso.h"
#include "unsecvars.h"
+/* Pull in common debug code */
+#include "dl-debug.c"
+
#define ALLOW_ZERO_PLTGOT
/* Pull in the value of _dl_progname */
@@ -122,7 +125,6 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, unsigned long load_addr,
ElfW(Addr) relro_addr = 0;
size_t relro_size = 0;
-
/* Wahoo!!! We managed to make a function call! Get malloc
* setup so we can use _dl_dprintf() to print debug noise
* instead of the SEND_STDERR macros used in dl-startup.c */
diff --git a/ldso/ldso/mips/dl-debug.h b/ldso/ldso/mips/dl-debug.h
new file mode 100644
index 000000000..f2a3865e3
--- /dev/null
+++ b/ldso/ldso/mips/dl-debug.h
@@ -0,0 +1,45 @@
+/* vi: set sw=4 ts=4: */
+/* mips/mipsel ELF shared library loader suppport
+ *
+ Copyright (C) 2002, Steven J. Hill (sjhill@realitydiluted.com)
+ *
+ * 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[] =
+{
+ [0] "R_MIPS_NONE", "R_MIPS_16", "R_MIPS_32",
+ [3] "R_MIPS_REL32", "R_MIPS_26", "R_MIPS_HI16",
+ [6] "R_MIPS_LO16", "R_MIPS_GPREL16", "R_MIPS_LITERAL",
+ [9] "R_MIPS_GOT16", "R_MIPS_PC16", "R_MIPS_CALL16",
+ [12] "R_MIPS_GPREL32",
+ [16] "R_MIPS_SHIFT5", "R_MIPS_SHIFT6", "R_MIPS_64",
+ [19] "R_MIPS_GOT_DISP", "R_MIPS_GOT_PAGE", "R_MIPS_GOT_OFST",
+ [22] "R_MIPS_GOT_HI16", "R_MIPS_GOT_LO16", "R_MIPS_SUB",
+ [25] "R_MIPS_INSERT_A", "R_MIPS_INSERT_B", "R_MIPS_DELETE",
+ [28] "R_MIPS_HIGHER", "R_MIPS_HIGHEST", "R_MIPS_CALL_HI16",
+ [31] "R_MIPS_CALL_LO16", "R_MIPS_SCN_DISP", "R_MIPS_REL16",
+ [34] "R_MIPS_ADD_IMMEDIATE", "R_MIPS_PJUMP", "R_MIPS_RELGOT",
+ [37] "R_MIPS_JALR",
+};
diff --git a/ldso/ldso/mips/elfinterp.c b/ldso/ldso/mips/elfinterp.c
index 595653000..18b5799d9 100644
--- a/ldso/ldso/mips/elfinterp.c
+++ b/ldso/ldso/mips/elfinterp.c
@@ -27,82 +27,6 @@
* SUCH DAMAGE.
*/
-#if defined (__SUPPORT_LD_DEBUG__)
-static const char *_dl_reltypes_tab[] =
-{
- [0] "R_MIPS_NONE", "R_MIPS_16", "R_MIPS_32",
- [3] "R_MIPS_REL32", "R_MIPS_26", "R_MIPS_HI16",
- [6] "R_MIPS_LO16", "R_MIPS_GPREL16", "R_MIPS_LITERAL",
- [9] "R_MIPS_GOT16", "R_MIPS_PC16", "R_MIPS_CALL16",
- [12] "R_MIPS_GPREL32",
- [16] "R_MIPS_SHIFT5", "R_MIPS_SHIFT6", "R_MIPS_64",
- [19] "R_MIPS_GOT_DISP", "R_MIPS_GOT_PAGE", "R_MIPS_GOT_OFST",
- [22] "R_MIPS_GOT_HI16", "R_MIPS_GOT_LO16", "R_MIPS_SUB",
- [25] "R_MIPS_INSERT_A", "R_MIPS_INSERT_B", "R_MIPS_DELETE",
- [28] "R_MIPS_HIGHER", "R_MIPS_HIGHEST", "R_MIPS_CALL_HI16",
- [31] "R_MIPS_CALL_LO16", "R_MIPS_SCN_DISP", "R_MIPS_REL16",
- [34] "R_MIPS_ADD_IMMEDIATE", "R_MIPS_PJUMP", "R_MIPS_RELGOT",
- [37] "R_MIPS_JALR",
-};
-
-static const char *
-_dl_reltypes(int type)
-{
- static char buf[22];
- const char *str;
-
- if (type >= (int)(sizeof (_dl_reltypes_tab)/sizeof(_dl_reltypes_tab[0])) ||
- NULL == (str = _dl_reltypes_tab[type]))
- {
- str =_dl_simple_ltoa( buf, (unsigned long)(type));
- }
- return str;
-}
-
-static
-void debug_sym(Elf32_Sym *symtab,char *strtab,int symtab_index)
-{
- if(_dl_debug_symbols)
- {
- if(symtab_index){
- _dl_dprintf(_dl_debug_file, "\n%s\n\tvalue=%x\tsize=%x\tinfo=%x\tother=%x\tshndx=%x",
- strtab + symtab[symtab_index].st_name,
- symtab[symtab_index].st_value,
- symtab[symtab_index].st_size,
- symtab[symtab_index].st_info,
- symtab[symtab_index].st_other,
- symtab[symtab_index].st_shndx);
- }
- }
-}
-
-static void debug_reloc(Elf32_Sym *symtab,char *strtab, ELF_RELOC *rpnt)
-{
- if(_dl_debug_reloc)
- {
- int symtab_index;
- const char *sym;
- symtab_index = ELF32_R_SYM(rpnt->r_info);
- sym = symtab_index ? strtab + symtab[symtab_index].st_name : "sym=0x0";
-
- if(_dl_debug_symbols)
- _dl_dprintf(_dl_debug_file, "\n\t");
- else
- _dl_dprintf(_dl_debug_file, "\n%s\n\t", sym);
-#ifdef ELF_USES_RELOCA
- _dl_dprintf(_dl_debug_file, "%s\toffset=%x\taddend=%x",
- _dl_reltypes(ELF32_R_TYPE(rpnt->r_info)),
- rpnt->r_offset,
- rpnt->r_addend);
-#else
- _dl_dprintf(_dl_debug_file, "%s\toffset=%x\n",
- _dl_reltypes(ELF32_R_TYPE(rpnt->r_info)),
- rpnt->r_offset);
-#endif
- }
-}
-#endif
-
extern int _dl_runtime_resolve(void);
#define OFFSET_GP_GOT 0x7ff0
@@ -195,9 +119,9 @@ int _dl_parse_relocation_information(struct dyn_elf *xpnt,
symtab_index = ELF32_R_SYM(rpnt->r_info);
symbol_addr = 0;
-#if defined (__SUPPORT_LD_DEBUG__)
debug_sym(symtab,strtab,symtab_index);
debug_reloc(symtab,strtab,rpnt);
+#if defined (__SUPPORT_LD_DEBUG__)
if (reloc_addr)
old_val = *reloc_addr;
#endif
diff --git a/ldso/ldso/powerpc/dl-debug.h b/ldso/ldso/powerpc/dl-debug.h
new file mode 100644
index 000000000..cf203d25e
--- /dev/null
+++ b/ldso/ldso/powerpc/dl-debug.h
@@ -0,0 +1,44 @@
+/* vi: set sw=4 ts=4: */
+/* powerpc shared library loader suppport
+ *
+ * Copyright (C) 2001-2002 David A. Schleef
+ * Copyright (C) 2003-2004 Erik Andersen
+ * Copyright (C) 2004 Joakim Tjernlund
+ *
+ * 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_PPC_NONE", "R_PPC_ADDR32", "R_PPC_ADDR24", "R_PPC_ADDR16",
+ "R_PPC_ADDR16_LO", "R_PPC_ADDR16_HI", "R_PPC_ADDR16_HA",
+ "R_PPC_ADDR14", "R_PPC_ADDR14_BRTAKEN", "R_PPC_ADDR14_BRNTAKEN",
+ "R_PPC_REL24", "R_PPC_REL14", "R_PPC_REL14_BRTAKEN",
+ "R_PPC_REL14_BRNTAKEN", "R_PPC_GOT16", "R_PPC_GOT16_LO",
+ "R_PPC_GOT16_HI", "R_PPC_GOT16_HA", "R_PPC_PLTREL24",
+ "R_PPC_COPY", "R_PPC_GLOB_DAT", "R_PPC_JMP_SLOT", "R_PPC_RELATIVE",
+ "R_PPC_LOCAL24PC", "R_PPC_UADDR32", "R_PPC_UADDR16", "R_PPC_REL32",
+ "R_PPC_PLT32", "R_PPC_PLTREL32", "R_PPC_PLT16_LO", "R_PPC_PLT16_HI",
+ "R_PPC_PLT16_HA", "R_PPC_SDAREL16", "R_PPC_SECTOFF",
+ "R_PPC_SECTOFF_LO", "R_PPC_SECTOFF_HI", "R_PPC_SECTOFF_HA",
+};
diff --git a/ldso/ldso/powerpc/elfinterp.c b/ldso/ldso/powerpc/elfinterp.c
index dd2aa5aac..4ec459854 100644
--- a/ldso/ldso/powerpc/elfinterp.c
+++ b/ldso/ldso/powerpc/elfinterp.c
@@ -29,80 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined (__SUPPORT_LD_DEBUG__)
-static const char *_dl_reltypes_tab[] =
- { "R_PPC_NONE", "R_PPC_ADDR32", "R_PPC_ADDR24", "R_PPC_ADDR16",
- "R_PPC_ADDR16_LO", "R_PPC_ADDR16_HI", "R_PPC_ADDR16_HA",
- "R_PPC_ADDR14", "R_PPC_ADDR14_BRTAKEN", "R_PPC_ADDR14_BRNTAKEN",
- "R_PPC_REL24", "R_PPC_REL14", "R_PPC_REL14_BRTAKEN",
- "R_PPC_REL14_BRNTAKEN", "R_PPC_GOT16", "R_PPC_GOT16_LO",
- "R_PPC_GOT16_HI", "R_PPC_GOT16_HA", "R_PPC_PLTREL24",
- "R_PPC_COPY", "R_PPC_GLOB_DAT", "R_PPC_JMP_SLOT", "R_PPC_RELATIVE",
- "R_PPC_LOCAL24PC", "R_PPC_UADDR32", "R_PPC_UADDR16", "R_PPC_REL32",
- "R_PPC_PLT32", "R_PPC_PLTREL32", "R_PPC_PLT16_LO", "R_PPC_PLT16_HI",
- "R_PPC_PLT16_HA", "R_PPC_SDAREL16", "R_PPC_SECTOFF",
- "R_PPC_SECTOFF_LO", "R_PPC_SECTOFF_HI", "R_PPC_SECTOFF_HA",
-};
-
-static const char *
-_dl_reltypes(int type)
-{
- static char buf[22];
- const char *str;
-
- if (type >= (int)(sizeof (_dl_reltypes_tab)/sizeof(_dl_reltypes_tab[0])) ||
- NULL == (str = _dl_reltypes_tab[type]))
- {
- str =_dl_simple_ltoa( buf, (unsigned long)(type));
- }
- return str;
-}
-
-static
-void debug_sym(Elf32_Sym *symtab,char *strtab,int symtab_index)
-{
- if(_dl_debug_symbols)
- {
- if(symtab_index){
- _dl_dprintf(_dl_debug_file, "\n%s\n\tvalue=%x\tsize=%x\tinfo=%x\tother=%x\tshndx=%x",
- strtab + symtab[symtab_index].st_name,
- symtab[symtab_index].st_value,
- symtab[symtab_index].st_size,
- symtab[symtab_index].st_info,
- symtab[symtab_index].st_other,
- symtab[symtab_index].st_shndx);
- }
- }
-}
-
-static
-void debug_reloc(Elf32_Sym *symtab,char *strtab, ELF_RELOC *rpnt)
-{
- if(_dl_debug_reloc)
- {
- int symtab_index;
- const char *sym;
- symtab_index = ELF32_R_SYM(rpnt->r_info);
- sym = symtab_index ? strtab + symtab[symtab_index].st_name : "sym=0x0";
-
- if(_dl_debug_symbols)
- _dl_dprintf(_dl_debug_file, "\n\t");
- else
- _dl_dprintf(_dl_debug_file, "\n%s\n\t", sym);
-#ifdef ELF_USES_RELOCA
- _dl_dprintf(_dl_debug_file, "%s\toffset=%x\taddend=%x",
- _dl_reltypes(ELF32_R_TYPE(rpnt->r_info)),
- rpnt->r_offset,
- rpnt->r_addend);
-#else
- _dl_dprintf(_dl_debug_file, "%s\toffset=%x\n",
- _dl_reltypes(ELF32_R_TYPE(rpnt->r_info)),
- rpnt->r_offset);
-#endif
- }
-}
-#endif
-
extern int _dl_linux_resolve(void);
void _dl_init_got(unsigned long *plt,struct elf_resolve *tpnt)
@@ -190,10 +116,10 @@ unsigned long _dl_linux_resolver(struct elf_resolve *tpnt, int reloc_entry)
strtab = (char *)tpnt->dynamic_info[DT_STRTAB];
symname = strtab + symtab[symtab_index].st_name;
-#if defined (__SUPPORT_LD_DEBUG__)
debug_sym(symtab,strtab,symtab_index);
debug_reloc(symtab,strtab,this_reloc);
+#if defined (__SUPPORT_LD_DEBUG__)
if (unlikely(ELF32_R_TYPE(this_reloc->r_info) != R_PPC_JMP_SLOT)) {
_dl_dprintf(2, "%s: Incorrect relocation type in jump relocation\n", _dl_progname);
_dl_exit(1);
@@ -437,10 +363,8 @@ _dl_parse(struct elf_resolve *tpnt, struct dyn_elf *scope,
symtab_index = ELF32_R_SYM(rpnt->r_info);
-#if defined (__SUPPORT_LD_DEBUG__)
debug_sym(symtab,strtab,symtab_index);
debug_reloc(symtab,strtab,rpnt);
-#endif
res = reloc_fnc (tpnt, scope, rpnt, symtab, strtab);
diff --git a/ldso/ldso/sh/dl-debug.h b/ldso/ldso/sh/dl-debug.h
new file mode 100644
index 000000000..e862da1ee
--- /dev/null
+++ b/ldso/ldso/sh/dl-debug.h
@@ -0,0 +1,41 @@
+/* vi: set sw=4 ts=4: */
+/* SuperH ELF shared library loader suppport
+ *
+ * Copyright (C) 2002, Stefan Allius <allius@atecom.com> and
+ * Eddie C. Dost <ecd@atecom.com>
+ *
+ * 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[] =
+{
+ [0] "R_SH_NONE", "R_SH_DIR32", "R_SH_REL32", "R_SH_DIR8WPN",
+ [4] "R_SH_IND12W", "R_SH_DIR8WPL", "R_SH_DIR8WPZ", "R_SH_DIR8BP",
+ [8] "R_SH_DIR8W", "R_SH_DIR8L",
+ [25] "R_SH_SWITCH16","R_SH_SWITCH32","R_SH_USES",
+ [28] "R_SH_COUNT", "R_SH_ALIGN", "R_SH_CODE", "R_SH_DATA",
+ [32] "R_SH_LABEL", "R_SH_SWITCH8", "R_SH_GNU_VTINHERIT","R_SH_GNU_VTENTRY",
+[160] "R_SH_GOT32", "R_SH_PLT32", "R_SH_COPY", "R_SH_GLOB_DAT",
+[164] "R_SH_JMP_SLOT","R_SH_RELATIVE","R_SH_GOTOFF", "R_SH_GOTPC",
+};
diff --git a/ldso/ldso/sh/elfinterp.c b/ldso/ldso/sh/elfinterp.c
index 794910c6d..393435bbb 100644
--- a/ldso/ldso/sh/elfinterp.c
+++ b/ldso/ldso/sh/elfinterp.c
@@ -28,78 +28,6 @@
* SUCH DAMAGE.
*/
-#if defined (__SUPPORT_LD_DEBUG__)
-static const char *_dl_reltypes_tab[] =
-{
- [0] "R_SH_NONE", "R_SH_DIR32", "R_SH_REL32", "R_SH_DIR8WPN",
- [4] "R_SH_IND12W", "R_SH_DIR8WPL", "R_SH_DIR8WPZ", "R_SH_DIR8BP",
- [8] "R_SH_DIR8W", "R_SH_DIR8L",
- [25] "R_SH_SWITCH16","R_SH_SWITCH32","R_SH_USES",
- [28] "R_SH_COUNT", "R_SH_ALIGN", "R_SH_CODE", "R_SH_DATA",
- [32] "R_SH_LABEL", "R_SH_SWITCH8", "R_SH_GNU_VTINHERIT","R_SH_GNU_VTENTRY",
-[160] "R_SH_GOT32", "R_SH_PLT32", "R_SH_COPY", "R_SH_GLOB_DAT",
-[164] "R_SH_JMP_SLOT","R_SH_RELATIVE","R_SH_GOTOFF", "R_SH_GOTPC",
-};
-
-static const char *
-_dl_reltypes(int type)
-{
- static char buf[22];
- const char *str;
-
- if (type >= (int)(sizeof (_dl_reltypes_tab)/sizeof(_dl_reltypes_tab[0])) ||
- NULL == (str = _dl_reltypes_tab[type]))
- {
- str =_dl_simple_ltoa( buf, (unsigned long)(type));
- }
- return str;
-}
-
-static
-void debug_sym(Elf32_Sym *symtab,char *strtab,int symtab_index)
-{
- if(_dl_debug_symbols)
- {
- if(symtab_index){
- _dl_dprintf(_dl_debug_file, "\n%s\tvalue=%x\tsize=%x\tinfo=%x\tother=%x\tshndx=%x",
- strtab + symtab[symtab_index].st_name,
- symtab[symtab_index].st_value,
- symtab[symtab_index].st_size,
- symtab[symtab_index].st_info,
- symtab[symtab_index].st_other,
- symtab[symtab_index].st_shndx);
- }
- }
-}
-
-static void debug_reloc(Elf32_Sym *symtab,char *strtab, ELF_RELOC *rpnt)
-{
- if(_dl_debug_reloc)
- {
- int symtab_index;
- const char *sym;
- symtab_index = ELF32_R_SYM(rpnt->r_info);
- sym = symtab_index ? strtab + symtab[symtab_index].st_name : "sym=0x0";
-
- if(_dl_debug_symbols)
- _dl_dprintf(_dl_debug_file, "\n\t");
- else
- _dl_dprintf(_dl_debug_file, "\n%s\n\t", sym);
-
-#ifdef ELF_USES_RELOCA
- _dl_dprintf(_dl_debug_file, "%s\toffset=%x\taddend=%x",
- _dl_reltypes(ELF32_R_TYPE(rpnt->r_info)),
- rpnt->r_offset,
- rpnt->r_addend);
-#else
- _dl_dprintf(_dl_debug_file, "%s\toffset=%x\n",
- _dl_reltypes(ELF32_R_TYPE(rpnt->r_info)),
- rpnt->r_offset);
-#endif
- }
-}
-#endif
-
/* Program to load an ELF binary on a linux system, and run it.
References to symbols in sharable libraries can be resolved by either
an ELF sharable library or a linux style of shared library. */
@@ -199,10 +127,8 @@ _dl_parse(struct elf_resolve *tpnt, struct dyn_elf *scope,
int res;
symtab_index = ELF32_R_SYM(rpnt->r_info);
-#if defined (__SUPPORT_LD_DEBUG__)
debug_sym(symtab,strtab,symtab_index);
debug_reloc(symtab,strtab,rpnt);
-#endif
res = reloc_fnc (tpnt, scope, rpnt, symtab, strtab);
diff --git a/ldso/ldso/sh64/dl-debug.h b/ldso/ldso/sh64/dl-debug.h
new file mode 100644
index 000000000..485aac7fa
--- /dev/null
+++ b/ldso/ldso/sh64/dl-debug.h
@@ -0,0 +1,79 @@
+/* vi: set sw=8 ts=8: */
+/*
+ * ldso/ldso/sh64/elfinterp.c
+ *
+ * SuperH (sh64) ELF shared library loader suppport
+ *
+ * Copyright (C) 2003, 2004, 2005 Paul Mundt <lethal@linux-sh.org>
+ *
+ * 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[] = {
+ /* SHcompact relocs */
+ [0] = "R_SH_NONE", "R_SH_DIR32",
+ "R_SH_REL32", "R_SH_DIR8WPN",
+ [4] = "R_SH_IND12W", "R_SH_DIR8WPL",
+ "R_SH_DIR8WPZ", "R_SH_DIR8BP",
+ [8] = "R_SH_DIR8W", "R_SH_DIR8L",
+ [25] = "R_SH_SWITCH16", "R_SH_SWITCH32",
+ "R_SH_USES", "R_SH_COUNT",
+ [29] = "R_SH_ALIGN", "R_SH_CODE",
+ "R_SH_DATA", "R_SH_LABEL",
+ [33] = "R_SH_SWITCH8", "R_SH_GNU_VTINHERIT",
+ "R_SH_GNU_VTENTRY",
+ [160] = "R_SH_GOT32", "R_SH_PLT32",
+ "R_SH_COPY", "R_SH_GLOB_DAT",
+ [164] = "R_SH_JMP_SLOT", "R_SH_RELATIVE",
+ "R_SH_GOTOFF", "R_SH_GOTPC",
+
+ /* SHmedia relocs */
+ [45] = "R_SH_DIR5U", "R_SH_DIR6U",
+ "R_SH_DIR6S", "R_SH_DIR10S",
+ [49] = "R_SH_DIR10SW", "R_SH_DIR10SL",
+ "R_SH_DIR10SQ",
+ [169] = "R_SH_GOT_LOW16", "R_SH_GOT_MEDLOW16",
+ "R_SH_GOT_MEDHI16", "R_SH_GOT_HI16",
+ [173] = "R_SH_GOTPLT_LOW16", "R_SH_GOTPLT_MEDLOW16",
+ "R_SH_GOTPLT_MEDHI16", "R_SH_GOTPLT_HI16",
+ [177] = "R_SH_PLT_LOW16", "R_SH_PLT_MEDLOW16",
+ "R_SH_PLT_MEDHI16", "R_SH_PLT_HI16",
+ [181] = "R_SH_GOTOFF_LOW16", "R_SH_GOTOFF_MEDLOW16",
+ "R_SH_GOTOFF_MEDHI16", "R_SH_GOTOFF_HI16",
+ [185] = "R_SH_GOTPC_LOW16", "R_SH_GOTPC_MEDLOW16",
+ "R_SH_GOTPC_MEDHI16", "R_SH_GOTPC_HI16",
+ [189] = "R_SH_GOT10BY4", "R_SH_GOTPLT10BY4",
+ "R_SH_GOT10BY8", "R_SH_GOTPLT10BY8",
+ [193] = "R_SH_COPY64", "R_SH_GLOB_DAT64",
+ "R_SH_JMP_SLOT64", "R_SH_RELATIVE64",
+ [197] = "R_SH_RELATIVE_LOW16", "R_SH_RELATIVE_MEDLOW16",
+ "R_SH_RELATIVE_MEDHI16","R_SH_RELATIVE_HI16",
+ [242] = "R_SH_SHMEDIA_CODE", "R_SH_PT_16",
+ "R_SH_IMMS16", "R_SH_IMMU16",
+ [246] = "R_SH_IMM_LOW16", "R_SH_IMM_LOW16_PCREL",
+ "R_SH_IMM_MEDLOW16", "R_SH_IMM_MEDLOW16_PCREL",
+ [250] = "R_SH_IMM_MEDHI16", "R_SH_IMM_MEDHI16_PCREL",
+ "R_SH_IMM_HI16", "R_SH_IMM_HI16_PCREL",
+ [254] = "R_SH_64", "R_SH_64_PCREL",
+};
diff --git a/ldso/ldso/sh64/elfinterp.c b/ldso/ldso/sh64/elfinterp.c
index 6ac096b32..c20314a85 100644
--- a/ldso/ldso/sh64/elfinterp.c
+++ b/ldso/ldso/sh64/elfinterp.c
@@ -30,116 +30,6 @@
* SUCH DAMAGE.
*/
-#ifdef __SUPPORT_LD_DEBUG__
-static const char *_dl_reltypes_tab[] = {
- /* SHcompact relocs */
- [0] = "R_SH_NONE", "R_SH_DIR32",
- "R_SH_REL32", "R_SH_DIR8WPN",
- [4] = "R_SH_IND12W", "R_SH_DIR8WPL",
- "R_SH_DIR8WPZ", "R_SH_DIR8BP",
- [8] = "R_SH_DIR8W", "R_SH_DIR8L",
- [25] = "R_SH_SWITCH16", "R_SH_SWITCH32",
- "R_SH_USES", "R_SH_COUNT",
- [29] = "R_SH_ALIGN", "R_SH_CODE",
- "R_SH_DATA", "R_SH_LABEL",
- [33] = "R_SH_SWITCH8", "R_SH_GNU_VTINHERIT",
- "R_SH_GNU_VTENTRY",
- [160] = "R_SH_GOT32", "R_SH_PLT32",
- "R_SH_COPY", "R_SH_GLOB_DAT",
- [164] = "R_SH_JMP_SLOT", "R_SH_RELATIVE",
- "R_SH_GOTOFF", "R_SH_GOTPC",
-
- /* SHmedia relocs */
- [45] = "R_SH_DIR5U", "R_SH_DIR6U",
- "R_SH_DIR6S", "R_SH_DIR10S",
- [49] = "R_SH_DIR10SW", "R_SH_DIR10SL",
- "R_SH_DIR10SQ",
- [169] = "R_SH_GOT_LOW16", "R_SH_GOT_MEDLOW16",
- "R_SH_GOT_MEDHI16", "R_SH_GOT_HI16",
- [173] = "R_SH_GOTPLT_LOW16", "R_SH_GOTPLT_MEDLOW16",
- "R_SH_GOTPLT_MEDHI16", "R_SH_GOTPLT_HI16",
- [177] = "R_SH_PLT_LOW16", "R_SH_PLT_MEDLOW16",
- "R_SH_PLT_MEDHI16", "R_SH_PLT_HI16",
- [181] = "R_SH_GOTOFF_LOW16", "R_SH_GOTOFF_MEDLOW16",
- "R_SH_GOTOFF_MEDHI16", "R_SH_GOTOFF_HI16",
- [185] = "R_SH_GOTPC_LOW16", "R_SH_GOTPC_MEDLOW16",
- "R_SH_GOTPC_MEDHI16", "R_SH_GOTPC_HI16",
- [189] = "R_SH_GOT10BY4", "R_SH_GOTPLT10BY4",
- "R_SH_GOT10BY8", "R_SH_GOTPLT10BY8",
- [193] = "R_SH_COPY64", "R_SH_GLOB_DAT64",
- "R_SH_JMP_SLOT64", "R_SH_RELATIVE64",
- [197] = "R_SH_RELATIVE_LOW16", "R_SH_RELATIVE_MEDLOW16",
- "R_SH_RELATIVE_MEDHI16","R_SH_RELATIVE_HI16",
- [242] = "R_SH_SHMEDIA_CODE", "R_SH_PT_16",
- "R_SH_IMMS16", "R_SH_IMMU16",
- [246] = "R_SH_IMM_LOW16", "R_SH_IMM_LOW16_PCREL",
- "R_SH_IMM_MEDLOW16", "R_SH_IMM_MEDLOW16_PCREL",
- [250] = "R_SH_IMM_MEDHI16", "R_SH_IMM_MEDHI16_PCREL",
- "R_SH_IMM_HI16", "R_SH_IMM_HI16_PCREL",
- [254] = "R_SH_64", "R_SH_64_PCREL",
-};
-
-static const char *_dl_reltypes(int type)
-{
- static char buf[22];
- const char *str;
- int tabsize;
-
- tabsize = sizeof(_dl_reltypes_tab)/sizeof(_dl_reltypes_tab[0]);
- str = _dl_reltypes_tab[type];
-
- if (type >= tabsize || str == NULL)
- str =_dl_simple_ltoa(buf, (unsigned long)(type));
-
- return str;
-}
-
-static void debug_sym(Elf32_Sym *symtab, char *strtab, int symtab_index)
-{
- if (!_dl_debug_symbols || !symtab_index)
- return;
-
- _dl_dprintf(_dl_debug_file,
- "\n%s\tvalue=%x\tsize=%x\tinfo=%x\tother=%x\tshndx=%x",
- strtab + symtab[symtab_index].st_name,
- symtab[symtab_index].st_value,
- symtab[symtab_index].st_size,
- symtab[symtab_index].st_info,
- symtab[symtab_index].st_other,
- symtab[symtab_index].st_shndx);
-}
-
-static void debug_reloc(Elf32_Sym *symtab, char *strtab, ELF_RELOC *rpnt)
-{
- if (!_dl_debug_reloc)
- return;
-
- if (_dl_debug_symbols) {
- _dl_dprintf(_dl_debug_file, "\n\t");
- } else {
- int symtab_index;
- const char *sym;
-
- symtab_index = ELF32_R_SYM(rpnt->r_info);
- sym = symtab_index ? strtab + symtab[symtab_index].st_name
- : "sym=0x0";
-
- _dl_dprintf(_dl_debug_file, "\n%s\n\t", sym);
- }
-
- _dl_dprintf(_dl_debug_file, "%s\toffset=%x",
- _dl_reltypes(ELF32_R_TYPE(rpnt->r_info)),
- rpnt->r_offset);
-
-#ifdef ELF_USES_RELOCA
- _dl_dprintf(_dl_debug_file, "\taddend=%x", rpnt->r_addend);
-#endif
-
- _dl_dprintf(_dl_debug_file, "\n");
-
-}
-#endif /* __SUPPORT_LD_DEBUG__ */
-
/* Program to load an ELF binary on a linux system, and run it.
References to symbols in sharable libraries can be resolved by either
an ELF sharable library or a linux style of shared library. */
@@ -242,10 +132,8 @@ static int _dl_parse(struct elf_resolve *tpnt, struct dyn_elf *scope,
int res;
symtab_index = ELF32_R_SYM(rpnt->r_info);
-#ifdef __SUPPORT_LD_DEBUG__
debug_sym(symtab,strtab,symtab_index);
debug_reloc(symtab,strtab,rpnt);
-#endif
res = reloc_fnc (tpnt, scope, rpnt, symtab, strtab);
if (res == 0)
diff --git a/ldso/ldso/x86_64/dl-debug.h b/ldso/ldso/x86_64/dl-debug.h
new file mode 100644
index 000000000..21412bd03
--- /dev/null
+++ b/ldso/ldso/x86_64/dl-debug.h
@@ -0,0 +1,36 @@
+/* vi: set sw=4 ts=4: */
+/* x86_64 debug code for ELF shared library loader suppport
+ *
+ * Copyright (c) 1994-2000 Eric Youngdale, Peter MacDonald,
+ * David Engel, Hongjiu Lu and Mitch D'Souza
+ * Copyright (C) 2001-2004 Erik Andersen
+ *
+ * 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[] = {
+ [0] "R_X86_64_NONE", "R_X86_64_64", "R_X86_64_PC32", "R_X86_64_GOT32",
+ [4] "R_X86_64_PLT32", "R_X86_64_COPY", "R_X86_64_GLOB_DAT", "R_X86_64_JUMP_SLOT",
+ [8] "R_X86_64_RELATIVE", "R_X86_64_GOTPCREL", "R_X86_64_32"
+};
diff --git a/ldso/libdl/libdl.c b/ldso/libdl/libdl.c
index 4c8af8ad9..cf36f1482 100644
--- a/ldso/libdl/libdl.c
+++ b/ldso/libdl/libdl.c
@@ -83,6 +83,7 @@ size_t _dl_pagesize = PAGE_SIZE; /* Store the page size for use later
/* This global variable is also to communicate with debuggers such as gdb. */
struct r_debug *_dl_debug_addr = NULL;
#define _dl_malloc malloc
+#include "../ldso/dl-debug.c"
#include "dl-progname.h"
#include "../ldso/dl-hash.c"
#define _dl_trace_loaded_objects 0