rpms/ltrace/devel ltrace-e_entry.patch, NONE, 1.1 ltrace.spec, 1.33, 1.34

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Thu Jun 1 17:42:53 UTC 2006


Author: pmachata

Update of /cvs/dist/rpms/ltrace/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv6493

Modified Files:
	ltrace.spec 
Added Files:
	ltrace-e_entry.patch 
Log Message:
- e_entry patch: use elf's e_entry field instead of looking up _start
  symbol, which failed on stripped binaries.


ltrace-e_entry.patch:
 elf.c                           |   33 +++------------------------------
 options.c                       |    2 +-
 sysdeps/linux-gnu/alpha/arch.h  |    3 ---
 sysdeps/linux-gnu/arm/arch.h    |    3 ---
 sysdeps/linux-gnu/i386/arch.h   |    3 ---
 sysdeps/linux-gnu/ia64/arch.h   |    3 ---
 sysdeps/linux-gnu/m68k/arch.h   |    3 ---
 sysdeps/linux-gnu/ppc/arch.h    |    8 --------
 sysdeps/linux-gnu/s390/arch.h   |    3 ---
 sysdeps/linux-gnu/sparc/arch.h  |    3 ---
 sysdeps/linux-gnu/x86_64/arch.h |    3 ---
 11 files changed, 4 insertions(+), 63 deletions(-)

--- NEW FILE ltrace-e_entry.patch ---
diff -Bburp ltrace-0.4/elf.c ltrace-0.4-pm/elf.c
--- ltrace-0.4/elf.c	2006-06-01 13:34:28.000000000 -0400
+++ ltrace-0.4-pm/elf.c	2006-06-01 13:33:34.000000000 -0400
@@ -359,8 +359,6 @@ struct library_symbol *read_elf(struct p
 	size_t i;
 	struct opt_x_t *xptr;
 	struct library_symbol **lib_tail = NULL;
-	struct opt_x_t *main_cheat;
-	int exit_out = 0;
 
 	elf_version(EV_CURRENT);
 
@@ -406,24 +404,7 @@ struct library_symbol *read_elf(struct p
 		}
 	}
 
-	if (proc->need_to_reinitialize_breakpoints) {
-		/* Add "PLTs_initialized_by_here" to opt_x list, if not already there. */
-		main_cheat = (struct opt_x_t *)malloc(sizeof(struct opt_x_t));
-		if (main_cheat == NULL)
-			error(EXIT_FAILURE, 0, "Couldn allocate memory");
-		main_cheat->next = opt_x;
-		main_cheat->name = PLTs_initialized_by_here;
-
-		for (xptr = opt_x; xptr; xptr = xptr->next)
-			if (strcmp(xptr->name, PLTs_initialized_by_here) == 0
-			    && main_cheat) {
-				free(main_cheat);
-				main_cheat = NULL;
-				break;
-			}
-		if (main_cheat)
-			opt_x = main_cheat;
-	}
+	add_library_symbol (elf_opd2addr (lte, (void*)lte->ehdr.e_entry), "_start", lib_tail, 1, 0);
 
 	for (i = 0; i < lte->symtab_count; ++i) {
 		GElf_Sym sym;
@@ -453,17 +434,9 @@ struct library_symbol *read_elf(struct p
 	}
 	for (xptr = opt_x; xptr; xptr = xptr->next)
 		if ( ! xptr->found) {
-			char *badthing = "WARNING";
-			if (E_ENTRY_NAME && strcmp(xptr->name, E_ENTRY_NAME)) {
-				badthing = "ERROR";
-				exit_out = 1;
-			}
 			fprintf (stderr,
-				 "%s: Couldn't find symbol \"%s\" in file \"%s\"\n",
-			badthing, xptr->name, proc->filename);
-		}
-	if (exit_out) {
-		exit (1);
+				 "WARNING: Couldn't find symbol \"%s\" in file \"%s\"\n",
+				 xptr->name, proc->filename);
 	}
 
 	for (i = 0; i < library_num + 1; ++i)
diff -Bburp ltrace-0.4/options.c ltrace-0.4-pm/options.c
--- ltrace-0.4/options.c	2006-06-01 13:34:28.000000000 -0400
+++ ltrace-0.4-pm/options.c	2006-06-01 13:17:15.000000000 -0400
@@ -55,7 +55,7 @@ struct opt_x_t *opt_x = NULL;
 
 /* Set a break on the routine named here in order to re-initialize breakpoints
    after all the PLTs have been initialzed */
-char *PLTs_initialized_by_here = PLTs_INIT_BY_HERE;
+char *PLTs_initialized_by_here = NULL;
 
 static void usage(void)
 {
diff -Bburp ltrace-0.4/sysdeps/linux-gnu/alpha/arch.h ltrace-0.4-pm/sysdeps/linux-gnu/alpha/arch.h
--- ltrace-0.4/sysdeps/linux-gnu/alpha/arch.h	2006-02-20 16:44:45.000000000 -0500
+++ ltrace-0.4-pm/sysdeps/linux-gnu/alpha/arch.h	2006-06-01 13:25:05.000000000 -0400
@@ -6,6 +6,3 @@
 #define LT_ELF_MACHINE  EM_ALPHA
 #define LT_ELFCLASS2    ELFCLASS64
 #define LT_ELF_MACHINE2	EM_FAKE_ALPHA
-
-#define PLTs_INIT_BY_HERE NULL
-#define E_ENTRY_NAME      "_start"
diff -Bburp ltrace-0.4/sysdeps/linux-gnu/arm/arch.h ltrace-0.4-pm/sysdeps/linux-gnu/arm/arch.h
--- ltrace-0.4/sysdeps/linux-gnu/arm/arch.h	2006-02-20 16:44:45.000000000 -0500
+++ ltrace-0.4-pm/sysdeps/linux-gnu/arm/arch.h	2006-06-01 13:23:43.000000000 -0400
@@ -4,6 +4,3 @@
 
 #define LT_ELFCLASS	ELFCLASS32
 #define LT_ELF_MACHINE	EM_ARM
-
-#define PLTs_INIT_BY_HERE NULL
-#define E_ENTRY_NAME    "_start"
diff -Bburp ltrace-0.4/sysdeps/linux-gnu/i386/arch.h ltrace-0.4-pm/sysdeps/linux-gnu/i386/arch.h
--- ltrace-0.4/sysdeps/linux-gnu/i386/arch.h	2006-02-20 16:44:45.000000000 -0500
+++ ltrace-0.4-pm/sysdeps/linux-gnu/i386/arch.h	2006-06-01 13:26:29.000000000 -0400
@@ -4,6 +4,3 @@
 
 #define LT_ELFCLASS	ELFCLASS32
 #define LT_ELF_MACHINE	EM_386
-
-#define PLTs_INIT_BY_HERE NULL
-#define E_ENTRY_NAME    "_start"
diff -Bburp ltrace-0.4/sysdeps/linux-gnu/ia64/arch.h ltrace-0.4-pm/sysdeps/linux-gnu/ia64/arch.h
--- ltrace-0.4/sysdeps/linux-gnu/ia64/arch.h	2006-02-20 16:44:45.000000000 -0500
+++ ltrace-0.4-pm/sysdeps/linux-gnu/ia64/arch.h	2006-06-01 13:28:07.000000000 -0400
@@ -7,6 +7,3 @@
 
 #define LT_ELFCLASS   ELFCLASS64
 #define LT_ELF_MACHINE EM_IA_64
-
-#define PLTs_INIT_BY_HERE NULL
-#define E_ENTRY_NAME	"_start"
diff -Bburp ltrace-0.4/sysdeps/linux-gnu/m68k/arch.h ltrace-0.4-pm/sysdeps/linux-gnu/m68k/arch.h
--- ltrace-0.4/sysdeps/linux-gnu/m68k/arch.h	2006-02-20 16:44:45.000000000 -0500
+++ ltrace-0.4-pm/sysdeps/linux-gnu/m68k/arch.h	2006-06-01 13:26:00.000000000 -0400
@@ -4,6 +4,3 @@
 
 #define LT_ELFCLASS	ELFCLASS32
 #define LT_ELF_MACHINE	EM_68K
-
-#define PLTs_INIT_BY_HERE NULL
-#define E_ENTRY_NAME    "_start"
diff -Bburp ltrace-0.4/sysdeps/linux-gnu/ppc/arch.h ltrace-0.4-pm/sysdeps/linux-gnu/ppc/arch.h
--- ltrace-0.4/sysdeps/linux-gnu/ppc/arch.h	2006-02-20 16:44:45.000000000 -0500
+++ ltrace-0.4-pm/sysdeps/linux-gnu/ppc/arch.h	2006-06-01 13:24:30.000000000 -0400
@@ -1,7 +1,6 @@
 #define BREAKPOINT_VALUE { 0x7f, 0xe0, 0x00, 0x08 }
 #define BREAKPOINT_LENGTH 4
 #define DECR_PC_AFTER_BREAK 0
-#define E_ENTRY_NAME    "_start"
 
 #define LT_ELFCLASS	ELFCLASS32
 #define LT_ELF_MACHINE	EM_PPC
@@ -8,11 +8,4 @@
 #ifdef __powerpc64__
 #define LT_ELFCLASS2	ELFCLASS64
 #define LT_ELF_MACHINE2	EM_PPC64
-
-#define PLTs_INIT_BY_HERE E_ENTRY_NAME
-
-#else
-
-#define PLTs_INIT_BY_HERE NULL
-
 #endif
diff -Bburp ltrace-0.4/sysdeps/linux-gnu/s390/arch.h ltrace-0.4-pm/sysdeps/linux-gnu/s390/arch.h
--- ltrace-0.4/sysdeps/linux-gnu/s390/arch.h	2006-02-20 16:44:45.000000000 -0500
+++ ltrace-0.4-pm/sysdeps/linux-gnu/s390/arch.h	2006-06-01 13:27:00.000000000 -0400
@@ -16,6 +16,3 @@
 #define LT_ELFCLASS	ELFCLASS32
 #define LT_ELF_MACHINE	EM_S390
 #endif
-
-#define PLTs_INIT_BY_HERE NULL
-#define E_ENTRY_NAME    "_start"
diff -Bburp ltrace-0.4/sysdeps/linux-gnu/sparc/arch.h ltrace-0.4-pm/sysdeps/linux-gnu/sparc/arch.h
--- ltrace-0.4/sysdeps/linux-gnu/sparc/arch.h	2006-02-20 16:44:45.000000000 -0500
+++ ltrace-0.4-pm/sysdeps/linux-gnu/sparc/arch.h	2006-06-01 13:28:39.000000000 -0400
@@ -6,6 +6,3 @@
 #define LT_ELF_MACHINE  EM_SPARC
 #define LT_ELFCLASS2    ELFCLASS32
 #define LT_ELF_MACHINE2	EM_SPARC32PLUS
-
-#define PLTs_INIT_BY_HERE NULL
-#define E_ENTRY_NAME    "_start"
diff -Bburp ltrace-0.4/sysdeps/linux-gnu/x86_64/arch.h ltrace-0.4-pm/sysdeps/linux-gnu/x86_64/arch.h
--- ltrace-0.4/sysdeps/linux-gnu/x86_64/arch.h	2006-02-20 16:44:45.000000000 -0500
+++ ltrace-0.4-pm/sysdeps/linux-gnu/x86_64/arch.h	2006-06-01 13:27:37.000000000 -0400
@@ -7,9 +7,6 @@
 #define LT_ELFCLASS2	ELFCLASS32
 #define LT_ELF_MACHINE2	EM_386
 
-#define PLTs_INIT_BY_HERE NULL
-#define E_ENTRY_NAME    "_start"
-
 /* __NR_fork, __NR_clone, __NR_clone2, __NR_vfork and __NR_execve
    from asm-i386/unistd.h.  */
 #define FORK_EXEC_SYSCALLS , { 2, 120, -1, 190, 11 }


Index: ltrace.spec
===================================================================
RCS file: /cvs/dist/rpms/ltrace/devel/ltrace.spec,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- ltrace.spec	3 May 2006 12:21:41 -0000	1.33
+++ ltrace.spec	1 Jun 2006 17:42:51 -0000	1.34
@@ -1,12 +1,13 @@
 Summary: Tracks runtime library calls from dynamically linked executables.
 Name: ltrace
 Version: 0.4
-Release: 1.5
+Release: 1.6
 Source: ftp://ftp.debian.org/debian/pool/main/l/ltrace/ltrace_%{version}.orig.tar.gz
 Patch0: ltrace-opt_x.patch
 Patch1: ltrace-testsuite.patch
 Patch2: ltrace-opd.patch
 Patch3: ltrace-demangle.patch
+Patch4: ltrace-e_entry.patch
 License: GPL
 Group: Development/Debuggers
 ExclusiveArch: %{ix86} x86_64 ia64 ppc ppc64 s390 s390x alpha sparc
@@ -30,6 +31,7 @@
 %patch1 -p0
 %patch2 -p1
 %patch3 -p2
+%patch4 -p1
 sed -i -e 's/-o root -g root//' Makefile.in
 
 %build
@@ -56,6 +58,10 @@
 %config /etc/ltrace.conf
 
 %changelog
+* Thu Jun  1 2006 Petr Machata <pmachata at redhat.com> - 0.4-1.6
+- e_entry patch: use elf's e_entry field instead of looking up _start
+  symbol, which failed on stripped binaries.
+
 * Tue May  3 2006 Petr Machata <pmachata at redhat.com> - 0.4-1.5
 - Correct a typo that prevented the inclusion of "demangle.h"
 - Adding -Wl,-z,relro




More information about the fedora-cvs-commits mailing list