/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1988 AT&T */
/* All Rights Reserved */
/*
* University Copyright- Copyright (c) 1982, 1986, 1988
* The Regents of the University of California
* All Rights Reserved
*
* University Acknowledgment- Portions of this document are derived from
* software developed by the University of California, Berkeley, and its
* contributors.
*/
/*LINTLIBRARY*/
#include "libelf.h"
#include <stdlib.h>
#include <unistd.h>
#include <nlist.h>
#include <string.h>
#include "aouthdr.h"
#include "filehdr.h"
#include "scnhdr.h"
#include "reloc.h"
#endif /* COFF_NLIST_SUPPORTED */
#include "linenum.h"
#include "syms.h"
#ifndef FLEXNAMES
#endif
static int num_in_buf = 0;
static char *next_entry = (char *)0;
#endif /* COFF_NLIST_SUPPORTED */
/* forward declarations */
static int _elf_nlist(int, struct nlist *);
static int end_elf_job(int);
static int _coff_nlist(int, struct nlist *);
static void sym_close(int);
static int fill_sym_buf(int, int);
#endif /* COFF_NLIST_SUPPORTED */
int
{
struct nlist *p;
int fd;
p->n_type = 0;
p->n_value = 0L;
p->n_scnum = 0;
p->n_sclass = 0;
p->n_numaux = 0;
}
return (-1);
return (-1);
}
return (-1);
}
if (ISELF) {
/*
* right now can only handle 32-bit architectures
* XX64 work to come? ELFCLASS64?
*/
return (-1);
}
}
else
#else /* COFF_NLIST_SUPPORTED */
return (-1);
#endif /* COFF_NLIST_SUPPORTED */
}
static int
{
int i;
int nreq;
return (end_elf_job(fd));
/* count the number of symbols requested */
;
/* read file header and section header table */
sizeof (Elf32_Ehdr), ELF_T_EHDR)) == 0)
return (end_elf_job(fd));
return (end_elf_job(fd));
}
ELF_T_SHDR)) == 0) {
return (end_elf_job(fd));
}
/* find symbol table section */
break;
return (end_elf_job(fd));
}
return (end_elf_job(fd));
}
/* read string table */
return (end_elf_job(fd));
}
return (end_elf_job(fd));
}
struct nlist *p;
char *name;
return (end_elf_job(fd));
}
if (name == 0)
continue;
continue;
}
nreq--;
break;
}
}
/*
* Currently there is only one symbol table section
* in an object file, but this restriction may be
* relaxed in the future.
*/
return (nreq);
}
/*
* allocate memory of size memsize and read size bytes
* starting at offset from fd - the file data are
* translated in place using the low-level libelf
* translation routines
*/
static Elf_Data *
{
char *p;
if (size == 0)
return (0);
return (0);
return (0);
}
free(p);
return (0);
}
free(p);
return (0);
}
free(p);
return (0);
}
return (ddst);
}
static int
{
return (-1);
}
static int
{
long n;
#if FLEXNAMES
char *strtab = (char *)0;
long strtablen;
#endif
struct syment *q;
long sa;
int nreq;
return (-1);
}
return (-1);
}
return (-1);
}
q = &sym;
/* count the number of symbols requested */
;
while (n) {
return (-1);
}
n -= (q->n_numaux + 1L);
continue;
/*
* For 6.0, the name in an object file is
* either stored in the eight long character
* array, or in a string table at the end
* of the object file. If the name is in the
* string table, the eight characters are
* thought of as a pair of longs, (n_zeroes
* and n_offset) the first of which is zero
* and the second is the offset of the name
* in the string table.
*/
#if FLEXNAMES
if (q->n_zeroes == 0L) /* in string table */
{
if (strtab == (char *)0) /* need it */
{
if (home == -1L) {
return (-1);
}
sizeof (long)) != sizeof (long) ||
(unsigned)strtablen)) ==
(char *)0 ||
strtablen - sizeof (long)) !=
strtablen - sizeof (long) ||
if (strtab != (char *)0)
return (-1);
}
}
if (q->n_offset < sizeof (long) ||
if (strtab != (char *)0)
return (-1);
}
p->n_name)) {
continue;
}
}
else
#endif /* FLEXNAMES */
{
continue;
}
}
nreq--;
break;
}
}
#if FLEXNAMES
if (strtab != (char *)0)
#endif
return (nreq);
}
static void
{
num_in_buf = 0;
next_entry = (char *)0;
}
/* buffered read of symbol table */
static int
{
long where = 0L;
return (-1);
}
if (!num_in_buf) {
return (-1);
}
num_in_buf--;
return (-1);
}
return (-1);
}
num_in_buf--;
next_entry += size;
return (0);
}
static int
{
return (-1);
num_in_buf /= size;
next_entry = &(sym_buf[0]);
return (0);
}
#endif /* COFF_NLIST_SUPPORTED */