PERFORCE change 135754 for review
John Birrell
jb at FreeBSD.org
Tue Feb 19 23:13:50 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=135754
Change 135754 by jb at jb_freebsd1 on 2008/02/19 23:13:11
Add hook variables for the CTF data arrays and ensure that
the memory gets freed with other stuff.
Affected files ...
.. //depot/projects/dtrace/src/sys/kern/link_elf.c#16 edit
.. //depot/projects/dtrace/src/sys/kern/link_elf_obj.c#13 edit
Differences ...
==== //depot/projects/dtrace/src/sys/kern/link_elf.c#16 (text+ko) ====
@@ -63,6 +63,10 @@
#include <sys/link_elf.h>
+#ifdef DDB_CTF
+#include <net/zlib.h>
+#endif
+
#include "linker_if.h"
#define MAXSEGS 4
@@ -101,6 +105,9 @@
caddr_t strbase; /* malloc'ed string base */
caddr_t ctftab; /* CTF table */
long ctfcnt; /* number of bytes in CTF table */
+ caddr_t ctfoff; /* CTF offset table */
+ caddr_t typoff; /* Type offset table */
+ long typlen; /* Number of type entries. */
#ifdef GDB
struct link_map gdb; /* hooks for gdb */
#endif
@@ -127,7 +134,7 @@
int (*)(const char *, void *),
void *);
static int link_elf_each_function_nameval(linker_file_t,
- int (*)(linker_file_t, linker_symval_t*, void *),
+ linker_function_nameval_callback_t,
void *);
static void link_elf_reloc_local(linker_file_t);
static Elf_Addr elf_lookup(linker_file_t lf, Elf_Size symidx, int deps);
@@ -917,6 +924,10 @@
free(ef->strbase, M_LINKER);
if (ef->ctftab)
free(ef->ctftab, M_LINKER);
+ if (ef->ctfoff)
+ free(ef->ctfoff, M_LINKER);
+ if (ef->typoff)
+ free(ef->typoff, M_LINKER);
}
static void
@@ -1236,7 +1247,7 @@
static int
link_elf_each_function_nameval(linker_file_t file,
- int (*callback)(linker_file_t, linker_symval_t *, void *), void *opaque)
+ linker_function_nameval_callback_t callback, void *opaque)
{
linker_symval_t symval;
elf_file_t ef = (elf_file_t)file;
@@ -1250,7 +1261,7 @@
error = link_elf_symbol_values(file, (c_linker_sym_t) symp, &symval);
if (error)
return (error);
- error = callback(file, &symval, opaque);
+ error = callback(file, i, &symval, opaque);
if (error)
return (error);
}
==== //depot/projects/dtrace/src/sys/kern/link_elf_obj.c#13 (text+ko) ====
@@ -58,6 +58,10 @@
#include <sys/link_elf.h>
+#ifdef DDB_CTF
+#include <net/zlib.h>
+#endif
+
#include "linker_if.h"
typedef struct {
@@ -108,6 +112,9 @@
caddr_t ctftab; /* CTF table */
long ctfcnt; /* number of bytes in CTF table */
+ caddr_t ctfoff; /* CTF offset table */
+ caddr_t typoff; /* Type offset table */
+ long typlen; /* Number of type entries. */
} *elf_file_t;
@@ -130,7 +137,7 @@
static int link_elf_each_function_name(linker_file_t,
int (*)(const char *, void *), void *);
static int link_elf_each_function_nameval(linker_file_t,
- int (*)(linker_file_t, linker_symval_t*, void *),
+ linker_function_nameval_callback_t,
void *);
static void link_elf_reloc_local(linker_file_t);
@@ -823,6 +830,10 @@
free(ef->progtab, M_LINKER);
if (ef->ctftab)
free(ef->ctftab, M_LINKER);
+ if (ef->ctfoff)
+ free(ef->ctfoff, M_LINKER);
+ if (ef->typoff)
+ free(ef->typoff, M_LINKER);
if (file->filename != NULL)
preload_delete_name(file->filename);
/* XXX reclaim module memory? */
@@ -857,6 +868,10 @@
free(ef->shstrtab, M_LINKER);
if (ef->ctftab)
free(ef->ctftab, M_LINKER);
+ if (ef->ctfoff)
+ free(ef->ctfoff, M_LINKER);
+ if (ef->typoff)
+ free(ef->typoff, M_LINKER);
}
static const char *
@@ -1080,7 +1095,7 @@
static int
link_elf_each_function_nameval(linker_file_t file,
- int (*callback)(linker_file_t, linker_symval_t *, void *), void *opaque)
+ linker_function_nameval_callback_t callback, void *opaque)
{
linker_symval_t symval;
elf_file_t ef = (elf_file_t)file;
@@ -1094,7 +1109,7 @@
error = link_elf_symbol_values(file, (c_linker_sym_t) symp, &symval);
if (error)
return (error);
- error = callback(file, &symval, opaque);
+ error = callback(file, i, &symval, opaque);
if (error)
return (error);
}
More information about the p4-projects
mailing list