* Disabled non-libelf stab files.
* Added a stab-unix.c file which is a placeholder for future nm|objdump implementations. git-svn-id: svn://svn.zoy.org/elk/trunk@119 55e467fa-43c5-0310-a8a2-de718669efc6
This commit is contained in:
parent
27e5b94103
commit
53725cc25f
|
@ -33,6 +33,8 @@ libelk_la_SOURCES = \
|
|||
read.c \
|
||||
special.c \
|
||||
stab.c \
|
||||
$(stab_elf_c) \
|
||||
$(stab_unix_c) \
|
||||
stkmem.c \
|
||||
string.c \
|
||||
symbol.c \
|
||||
|
@ -41,6 +43,12 @@ libelk_la_SOURCES = \
|
|||
vector.c \
|
||||
$(NULL)
|
||||
|
||||
if HAVE_LIBELF
|
||||
stab_elf_c = stab-elf.c
|
||||
else
|
||||
stab_unix_c = stab-unix.c
|
||||
endif
|
||||
|
||||
EXTRA_DIST = \
|
||||
dump-ecoff.c \
|
||||
dump-elf.c \
|
||||
|
@ -52,7 +60,6 @@ EXTRA_DIST = \
|
|||
stab-coff.c \
|
||||
stab-convex.c \
|
||||
stab-ecoff.c \
|
||||
stab-elf.c \
|
||||
stab-hp9k300.c \
|
||||
stab-hp9k800.c \
|
||||
stab-macho.c \
|
||||
|
|
|
@ -28,11 +28,16 @@
|
|||
* THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <libelf.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "kernel.h"
|
||||
|
||||
SYMTAB *
|
||||
Snarf_Symbols (lf)
|
||||
|
@ -144,3 +149,4 @@ Open_File_And_Snarf_Symbols (name)
|
|||
(void)close (f);
|
||||
return tab;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
/* stab-unix.c
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright 1990, 1991, 1992, 1993, 1994, 1995, Oliver Laumann, Berlin
|
||||
* Copyright 2002, 2003 Sam Hocevar <sam@zoy.org>, Paris
|
||||
*
|
||||
* This software was derived from Elk 1.2, which was Copyright 1987, 1988,
|
||||
* 1989, Nixdorf Computer AG and TELES GmbH, Berlin (Elk 1.2 has been written
|
||||
* by Oliver Laumann for TELES Telematic Services, Berlin, in a joint project
|
||||
* between TELES and Nixdorf Microprocessor Engineering, Berlin).
|
||||
*
|
||||
* Oliver Laumann, TELES GmbH, Nixdorf Computer AG and Sam Hocevar, as co-
|
||||
* owners or individual owners of copyright in this software, grant to any
|
||||
* person or company a worldwide, royalty free, license to
|
||||
*
|
||||
* i) copy this software,
|
||||
* ii) prepare derivative works based on this software,
|
||||
* iii) distribute copies of this software or derivative works,
|
||||
* iv) perform this software, or
|
||||
* v) display this software,
|
||||
*
|
||||
* provided that this notice is not removed and that neither Oliver Laumann
|
||||
* nor Teles nor Nixdorf are deemed to have made any representations as to
|
||||
* the suitability of this software for any purpose nor are held responsible
|
||||
* for any defects of this software.
|
||||
*
|
||||
* THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "kernel.h"
|
||||
|
||||
SYMTAB *Snarf_Symbols (FILE *f) {
|
||||
SYMTAB *tab;
|
||||
register SYM *sp, **nextp;
|
||||
|
||||
tab = (SYMTAB *)Safe_Malloc (sizeof (SYMTAB));
|
||||
tab->first = 0;
|
||||
tab->strings = 0;
|
||||
|
||||
return tab;
|
||||
}
|
||||
|
||||
SYMTAB *Open_File_And_Snarf_Symbols (char *name) {
|
||||
int fd;
|
||||
FILE *fp;
|
||||
SYMTAB *tab;
|
||||
|
||||
fprintf (stderr, "trying to find symbols in %s\n", name);
|
||||
|
||||
#ifdef O_BINARY
|
||||
fd = open (name, O_RDONLY|O_BINARY);
|
||||
#else
|
||||
fd = open (name, O_RDONLY);
|
||||
#endif
|
||||
if (fd == -1) {
|
||||
Saved_Errno = errno;
|
||||
Primitive_Error ("can't open file: ~E");
|
||||
}
|
||||
if ((fp = fdopen (fd, "rb")) == NULL) {
|
||||
close (fd);
|
||||
Primitive_Error ("can't fdopen file");
|
||||
}
|
||||
tab = Snarf_Symbols (fp);
|
||||
(void)fclose (fp);
|
||||
return tab;
|
||||
}
|
||||
|
10
src/stab.c
10
src/stab.c
|
@ -39,7 +39,7 @@ void Free_Symbols (SYMTAB *);
|
|||
|
||||
#if defined(CAN_LOAD_LIB) || defined (INIT_OBJECTS)
|
||||
|
||||
#if defined(MACH_O)
|
||||
/*#if defined(MACH_O)
|
||||
# include "stab-macho.c"
|
||||
#elif defined(HAVE_LIBELF)
|
||||
# include "stab-elf.c"
|
||||
|
@ -53,9 +53,11 @@ void Free_Symbols (SYMTAB *);
|
|||
# include "stab-hp9k300.c"
|
||||
#elif defined(hp9000s800) || defined(__hp9000s800) || defined(__hp9000s800__)
|
||||
# include "stab-hp9k800.c"
|
||||
#else
|
||||
#elif defined(HAVE_A_OUT_H)
|
||||
# include "stab-bsd.c"
|
||||
#endif
|
||||
#else
|
||||
# include "stab-unix.c"
|
||||
#endif*/
|
||||
|
||||
static SYMPREFIX Ignore_Prefixes[] = {
|
||||
/* Currently none */
|
||||
|
@ -171,4 +173,4 @@ void Free_Symbols (SYMTAB *tab) {
|
|||
free (tab->strings);
|
||||
free ((char *)tab);
|
||||
}
|
||||
#endif /* CAN_LOAD_OBJ || INIT_OBJECTS */
|
||||
#endif /* CAN_LOAD_LIB || INIT_OBJECTS */
|
||||
|
|
Loading…
Reference in New Issue