summaryrefslogtreecommitdiff
path: root/usr/src/cmd/sgs
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/cmd/sgs')
-rw-r--r--usr/src/cmd/sgs/dump/common/dump.c24
-rw-r--r--usr/src/cmd/sgs/dump/common/dump.h11
-rw-r--r--usr/src/cmd/sgs/dump/common/fcns.c83
-rw-r--r--usr/src/cmd/sgs/elfdump/common/_elfdump.h17
-rw-r--r--usr/src/cmd/sgs/elfdump/common/elfdump.c620
-rw-r--r--usr/src/cmd/sgs/elfdump/common/elfdump.msg142
-rw-r--r--usr/src/cmd/sgs/elfdump/common/lintsup.c12
-rw-r--r--usr/src/cmd/sgs/elfdump/common/main.c313
-rw-r--r--usr/src/cmd/sgs/elfdump/common/struct_layout.h6
-rw-r--r--usr/src/cmd/sgs/elfedit/Makefile.com12
-rw-r--r--usr/src/cmd/sgs/elfedit/Makefile.targ8
-rw-r--r--usr/src/cmd/sgs/elfedit/common/_elfedit.h6
-rw-r--r--usr/src/cmd/sgs/elfedit/common/elfconst.c1692
-rw-r--r--usr/src/cmd/sgs/elfedit/common/elfedit.c11
-rw-r--r--usr/src/cmd/sgs/elfedit/common/elfedit.msg768
-rw-r--r--usr/src/cmd/sgs/elfedit/common/lintsup.c5
-rw-r--r--usr/src/cmd/sgs/elfedit/common/mapfile-vers4
-rw-r--r--usr/src/cmd/sgs/elfedit/common/util_machelf.c138
-rw-r--r--usr/src/cmd/sgs/elfedit/modules/common/cap.c35
-rw-r--r--usr/src/cmd/sgs/elfedit/modules/common/dyn.c102
-rw-r--r--usr/src/cmd/sgs/elfedit/modules/common/ehdr.c84
-rw-r--r--usr/src/cmd/sgs/elfedit/modules/common/ehdr.msg5
-rw-r--r--usr/src/cmd/sgs/elfedit/modules/common/mapfile-vers4
-rw-r--r--usr/src/cmd/sgs/elfedit/modules/common/phdr.c208
-rw-r--r--usr/src/cmd/sgs/elfedit/modules/common/shdr.c216
-rw-r--r--usr/src/cmd/sgs/elfedit/modules/common/str.c5
-rw-r--r--usr/src/cmd/sgs/elfedit/modules/common/sym.c56
-rw-r--r--usr/src/cmd/sgs/elfedit/modules/common/syminfo.c11
-rw-r--r--usr/src/cmd/sgs/include/conv.h1199
-rw-r--r--usr/src/cmd/sgs/include/debug.h23
-rw-r--r--usr/src/cmd/sgs/include/elfedit.h81
-rw-r--r--usr/src/cmd/sgs/include/libld.h1
-rw-r--r--usr/src/cmd/sgs/include/sgsmsg.h56
-rw-r--r--usr/src/cmd/sgs/libconv/Makefile.com74
-rw-r--r--usr/src/cmd/sgs/libconv/Makefile.targ11
-rw-r--r--usr/src/cmd/sgs/libconv/common/_conv.h70
-rw-r--r--usr/src/cmd/sgs/libconv/common/cap.c159
-rw-r--r--usr/src/cmd/sgs/libconv/common/cap.msg17
-rw-r--r--usr/src/cmd/sgs/libconv/common/cap_machelf.c128
-rw-r--r--usr/src/cmd/sgs/libconv/common/config.c59
-rw-r--r--usr/src/cmd/sgs/libconv/common/corenote.c1153
-rw-r--r--usr/src/cmd/sgs/libconv/common/dl.c48
-rw-r--r--usr/src/cmd/sgs/libconv/common/dwarf.c50
-rw-r--r--usr/src/cmd/sgs/libconv/common/dynamic.c1072
-rw-r--r--usr/src/cmd/sgs/libconv/common/dynamic.msg491
-rw-r--r--usr/src/cmd/sgs/libconv/common/dynamic_machelf.c139
-rw-r--r--usr/src/cmd/sgs/libconv/common/elf.c1037
-rw-r--r--usr/src/cmd/sgs/libconv/common/elf.msg504
-rw-r--r--usr/src/cmd/sgs/libconv/common/globals.c431
-rw-r--r--usr/src/cmd/sgs/libconv/common/globals_machelf.c286
-rw-r--r--usr/src/cmd/sgs/libconv/common/group.c41
-rw-r--r--usr/src/cmd/sgs/libconv/common/lintsup.c75
-rw-r--r--usr/src/cmd/sgs/libconv/common/llib-lconv313
-rw-r--r--usr/src/cmd/sgs/libconv/common/phdr.c306
-rw-r--r--usr/src/cmd/sgs/libconv/common/phdr.msg110
-rw-r--r--usr/src/cmd/sgs/libconv/common/sections.c569
-rw-r--r--usr/src/cmd/sgs/libconv/common/sections.msg288
-rw-r--r--usr/src/cmd/sgs/libconv/common/sections_machelf.c71
-rw-r--r--usr/src/cmd/sgs/libconv/common/segments.c33
-rw-r--r--usr/src/cmd/sgs/libconv/common/symbols.c411
-rw-r--r--usr/src/cmd/sgs/libconv/common/symbols.msg132
-rw-r--r--usr/src/cmd/sgs/libconv/common/symbols_machelf.c47
-rw-r--r--usr/src/cmd/sgs/libconv/common/symbols_sparc_machelf.c51
-rw-r--r--usr/src/cmd/sgs/libconv/common/syminfo.c166
-rw-r--r--usr/src/cmd/sgs/libconv/common/syminfo.msg47
-rw-r--r--usr/src/cmd/sgs/libconv/common/version.c14
-rw-r--r--usr/src/cmd/sgs/libld/common/files.c14
-rw-r--r--usr/src/cmd/sgs/libld/common/ldmain.c6
-rw-r--r--usr/src/cmd/sgs/libld/common/outfile.c17
-rw-r--r--usr/src/cmd/sgs/libld/common/sections.c22
-rw-r--r--usr/src/cmd/sgs/libld/common/support.c1
-rw-r--r--usr/src/cmd/sgs/libld/common/syms.c19
-rw-r--r--usr/src/cmd/sgs/liblddbg/common/bindings.c23
-rw-r--r--usr/src/cmd/sgs/liblddbg/common/cap.c4
-rw-r--r--usr/src/cmd/sgs/liblddbg/common/dynamic.c13
-rw-r--r--usr/src/cmd/sgs/liblddbg/common/elf.c19
-rw-r--r--usr/src/cmd/sgs/liblddbg/common/entry.c12
-rw-r--r--usr/src/cmd/sgs/liblddbg/common/files.c3
-rw-r--r--usr/src/cmd/sgs/liblddbg/common/liblddbg.msg5
-rw-r--r--usr/src/cmd/sgs/liblddbg/common/llib-llddbg40
-rw-r--r--usr/src/cmd/sgs/liblddbg/common/map.c12
-rw-r--r--usr/src/cmd/sgs/liblddbg/common/phdr.c9
-rw-r--r--usr/src/cmd/sgs/liblddbg/common/segments.c15
-rw-r--r--usr/src/cmd/sgs/liblddbg/common/shdr.c17
-rw-r--r--usr/src/cmd/sgs/liblddbg/common/syms.c52
-rw-r--r--usr/src/cmd/sgs/liblddbg/common/tls.c14
-rw-r--r--usr/src/cmd/sgs/packages/common/SUNWonld-README2
-rw-r--r--usr/src/cmd/sgs/rtld/mdbmod/common/rtld.c9
-rw-r--r--usr/src/cmd/sgs/tools/common/sgsmsg.c51
89 files changed, 8295 insertions, 6445 deletions
diff --git a/usr/src/cmd/sgs/dump/common/dump.c b/usr/src/cmd/sgs/dump/common/dump.c
index ca9332b45c..1e52465d1a 100644
--- a/usr/src/cmd/sgs/dump/common/dump.c
+++ b/usr/src/cmd/sgs/dump/common/dump.c
@@ -23,12 +23,10 @@
* Copyright (c) 1988 AT&T
* All Rights Reserved
*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/* Get definitions for the relocation types supported. */
#define ELF_TARGET_ALL
@@ -51,13 +49,6 @@
#define OPTSTR "agcd:fhn:oprstvCLT:V?" /* option string for getopt() */
-/*
- * DUMP_CONVFMT defines the libconv formatting options we want to use:
- * - Unknown items to be printed as integers using decimal formatting
- * - The "Dump Style" versions of strings.
- */
-#define DUMP_CONVFMT (CONV_FMT_DECIMAL|CONV_FMT_ALT_DUMP)
-
const char *UNKNOWN = "<unknown>";
static SCNTAB *p_symtab, *p_head_scns, *p_dynsym;
@@ -617,7 +608,9 @@ print_symtab(Elf *elf_file, SCNTAB *p_symtab, Elf_Data *sym_data,
if (specsec)
(void) printf("%s",
- conv_sym_shndx(shndx, &inv_buf));
+ conv_sym_shndx(p_ehdr.e_ident[EI_OSABI],
+ p_ehdr.e_machine, shndx,
+ CONV_FMT_DECIMAL, &inv_buf));
else
(void) printf("%d", EC_WORD(shndx));
(void) printf("\t");
@@ -676,7 +669,8 @@ print_shdr(Elf *elf_file, SCNTAB *s, int num_scns, int index)
Conv_inv_buf_t inv_buf;
/*LINTED: E_SEC_PRINTF_VAR_FMT*/
- (void) printf(conv_sec_type(p_ehdr.e_machine,
+ (void) printf(conv_sec_type(
+ p_ehdr.e_ident[EI_OSABI], p_ehdr.e_machine,
p->p_shdr.sh_type, DUMP_CONVFMT, &inv_buf));
(void) printf(" ");
@@ -1128,7 +1122,8 @@ dump_dynamic(Elf *elf_file, SCNTAB *p_scns, int num_scns, char *filename)
} conv_buf;
(void) printf("[%d]\t%-15.15s ", index++,
- conv_dyn_tag(p_dyn.d_tag, p_ehdr.e_machine,
+ conv_dyn_tag(p_dyn.d_tag,
+ p_ehdr.e_ident[EI_OSABI], p_ehdr.e_machine,
DUMP_CONVFMT, &conv_buf.inv));
/*
@@ -1372,7 +1367,8 @@ dump_elf_header(Elf *elf_file, char *filename, GElf_Ehdr * elf_head_p)
conv_ehdr_data(elf_head_p->e_ident[5], DUMP_CONVFMT,
&inv_buf));
(void) printf("%-*s", field,
- conv_ehdr_type(elf_head_p->e_type, DUMP_CONVFMT, &inv_buf));
+ conv_ehdr_type(elf_head_p->e_ident[EI_OSABI],
+ elf_head_p->e_type, DUMP_CONVFMT, &inv_buf));
(void) printf("%-12s",
conv_ehdr_mach(elf_head_p->e_machine, DUMP_CONVFMT,
&inv_buf));
diff --git a/usr/src/cmd/sgs/dump/common/dump.h b/usr/src/cmd/sgs/dump/common/dump.h
index 1d27d6db91..54cc52abc1 100644
--- a/usr/src/cmd/sgs/dump/common/dump.h
+++ b/usr/src/cmd/sgs/dump/common/dump.h
@@ -23,19 +23,24 @@
* All Rights Reserved
*
*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _DUMP_H
#define _DUMP_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/elf.h>
#include <sys/machelf.h>
#include <gelf.h>
+/*
+ * DUMP_CONVFMT defines the libconv formatting options we want to use:
+ * - Unknown items to be printed as integers using decimal formatting
+ * - The "Dump Style" versions of strings.
+ */
+#define DUMP_CONVFMT (CONV_FMT_DECIMAL|CONV_FMT_ALT_DUMP)
+
#define DATESIZE 60
typedef struct scntab {
diff --git a/usr/src/cmd/sgs/dump/common/fcns.c b/usr/src/cmd/sgs/dump/common/fcns.c
index 37329f4c72..6d3a933991 100644
--- a/usr/src/cmd/sgs/dump/common/fcns.c
+++ b/usr/src/cmd/sgs/dump/common/fcns.c
@@ -23,18 +23,17 @@
/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <libelf.h>
#include <limits.h>
+#include "conv.h"
#include "dump.h"
extern int p_flag;
@@ -52,7 +51,7 @@ ar_sym_read(Elf *elf, char *filename)
if ((arsym = elf_getarsym(elf, &ptr)) == NULL) {
(void) fprintf(stderr, "%s: %s: no archive symbol table\n",
- prog_name, filename);
+ prog_name, filename);
return;
}
@@ -109,66 +108,36 @@ dump_exec_header(Elf *elf_file, unsigned nseg, char *filename)
if (gelf_getphdr(elf_file, counter, &p_phdr) == 0) {
(void) fprintf(stderr,
- "%s: %s: premature EOF on program exec header\n",
- prog_name, filename);
+ "%s: %s: premature EOF on program exec header\n",
+ prog_name, filename);
return;
}
if (!v_flag) {
(void) printf(
"%-*d%-#*llx%-#*llx%-#*llx\n%-#*llx%-#*llx%-*u%-#*llx\n\n",
- field, EC_WORD(p_phdr.p_type),
- field, EC_OFF(p_phdr.p_offset),
- field, EC_ADDR(p_phdr.p_vaddr),
- field, EC_ADDR(p_phdr.p_paddr),
- field, EC_XWORD(p_phdr.p_filesz),
- field, EC_XWORD(p_phdr.p_memsz),
- field, EC_WORD(p_phdr.p_flags),
- field, EC_XWORD(p_phdr.p_align));
+ field, EC_WORD(p_phdr.p_type),
+ field, EC_OFF(p_phdr.p_offset),
+ field, EC_ADDR(p_phdr.p_vaddr),
+ field, EC_ADDR(p_phdr.p_paddr),
+ field, EC_XWORD(p_phdr.p_filesz),
+ field, EC_XWORD(p_phdr.p_memsz),
+ field, EC_WORD(p_phdr.p_flags),
+ field, EC_XWORD(p_phdr.p_align));
} else {
- switch (p_phdr.p_type) {
- case PT_NULL:
- (void) printf("%-*s", field, "NULL");
- break;
- case PT_LOAD:
- (void) printf("%-*s", field, "LOAD");
- break;
- case PT_DYNAMIC:
- (void) printf("%-*s", field, "DYN");
- break;
- case PT_INTERP:
- (void) printf("%-*s", field, "INTERP");
- break;
- case PT_NOTE:
- (void) printf("%-*s", field, "NOTE");
- break;
- case PT_SHLIB:
- (void) printf("%-*s", field, "SHLIB");
- break;
- case PT_PHDR:
- (void) printf("%-*s", field, "PHDR");
- break;
- case PT_TLS:
- (void) printf("%-*s", field, "TLS");
- break;
- case PT_SUNWBSS:
- (void) printf("%-*s", field, "SUNWBSS");
- break;
- case PT_SUNWSTACK:
- (void) printf("%-*s", field, "SUNWSTACK");
- break;
- default:
- (void) printf("%-*d", field,
- (int)p_phdr.p_type);
- break;
- }
+ Conv_inv_buf_t inv_buf;
+
+ (void) printf("%-*s", field,
+ conv_phdr_type(ehdr.e_ident[EI_OSABI],
+ ehdr.e_machine, p_phdr.p_type, DUMP_CONVFMT,
+ &inv_buf));
(void) printf(
- "%-#*llx%-#*llx%-#*llx\n%-#*llx%-#*llx",
- field, EC_OFF(p_phdr.p_offset),
- field, EC_ADDR(p_phdr.p_vaddr),
- field, EC_ADDR(p_phdr.p_paddr),
- field, EC_XWORD(p_phdr.p_filesz),
- field, EC_XWORD(p_phdr.p_memsz));
+ "%-#*llx%-#*llx%-#*llx\n%-#*llx%-#*llx",
+ field, EC_OFF(p_phdr.p_offset),
+ field, EC_ADDR(p_phdr.p_vaddr),
+ field, EC_ADDR(p_phdr.p_paddr),
+ field, EC_XWORD(p_phdr.p_filesz),
+ field, EC_XWORD(p_phdr.p_memsz));
switch (p_phdr.p_flags) {
case 0: (void) printf("%-*s", field, "---"); break;
@@ -198,7 +167,7 @@ dump_exec_header(Elf *elf_file, unsigned nseg, char *filename)
break;
}
(void) printf(
- "%-#*llx\n\n", field, EC_XWORD(p_phdr.p_align));
+ "%-#*llx\n\n", field, EC_XWORD(p_phdr.p_align));
}
}
}
diff --git a/usr/src/cmd/sgs/elfdump/common/_elfdump.h b/usr/src/cmd/sgs/elfdump/common/_elfdump.h
index 50c96c7042..b2ce8c8e3e 100644
--- a/usr/src/cmd/sgs/elfdump/common/_elfdump.h
+++ b/usr/src/cmd/sgs/elfdump/common/_elfdump.h
@@ -50,8 +50,8 @@ extern "C" {
* To simplify masking these categories, they are assigned bit ranges
* as follows:
* SHOW: Bottom 24-bits
- * CALC: Upper nibble of most significant byte
- * CTL: Lower nibble of most significant byte
+ * CALC: Upper 2 bits of most significant byte
+ * CTL: Lower 6 bits of most significant byte
*/
#define FLG_SHOW_DYNAMIC 0x00000001
#define FLG_SHOW_EHDR 0x00000002
@@ -75,13 +75,14 @@ extern "C" {
#define FLG_CTL_DEMANGLE 0x02000000
#define FLG_CTL_FAKESHDR 0x04000000
#define FLG_CTL_MATCH 0x08000000
+#define FLG_CTL_OSABI 0x10000000
-#define FLG_CALC_CHECKSUM 0x10000000
+#define FLG_CALC_CHECKSUM 0x40000000
/* Bitmasks that isolate the parts of a flag value */
#define FLG_MASK_SHOW 0x00ffffff
-#define FLG_MASK_CTL 0x0f000000
-#define FLG_MASK_CALC 0xf0000000
+#define FLG_MASK_CTL 0x3f000000
+#define FLG_MASK_CALC 0xc0000000
/*
* Mask that selects the show flags that do not require the ELF
@@ -234,8 +235,10 @@ extern int fake_shdr_cache64(const char *, int, Elf *, Elf64_Ehdr *,
extern void fake_shdr_cache_free32(Cache *, size_t);
extern void fake_shdr_cache_free64(Cache *, size_t);
-extern int regular32(const char *, int, Elf *, uint_t, const char *, int);
-extern int regular64(const char *, int, Elf *, uint_t, const char *, int);
+extern int regular32(const char *, int, Elf *, uint_t, const char *, int,
+ uchar_t);
+extern int regular64(const char *, int, Elf *, uint_t, const char *, int,
+ uchar_t);
#ifdef __cplusplus
}
diff --git a/usr/src/cmd/sgs/elfdump/common/elfdump.c b/usr/src/cmd/sgs/elfdump/common/elfdump.c
index ceec7159e6..454b256d2b 100644
--- a/usr/src/cmd/sgs/elfdump/common/elfdump.c
+++ b/usr/src/cmd/sgs/elfdump/common/elfdump.c
@@ -115,6 +115,7 @@ typedef struct {
const char *file; /* Name of file */
Ehdr *ehdr; /* ELF header for file */
Cache *cache; /* Cache of all section headers */
+ uchar_t osabi; /* OSABI to use */
Word shnum; /* # of sections in cache */
Cache *seccache; /* Cache of symbol table section hdr */
Word secndx; /* Index of symbol table section hdr */
@@ -370,7 +371,7 @@ symlookup(const char *name, Cache *cache, Word shnum, Sym **sym,
* Print section headers.
*/
static void
-sections(const char *file, Cache *cache, Word shnum, Ehdr *ehdr)
+sections(const char *file, Cache *cache, Word shnum, Ehdr *ehdr, uchar_t osabi)
{
size_t seccnt;
@@ -406,7 +407,7 @@ sections(const char *file, Cache *cache, Word shnum, Ehdr *ehdr)
dbg_print(0, MSG_ORIG(MSG_STR_EMPTY));
dbg_print(0, MSG_INTL(MSG_ELF_SHDR), EC_WORD(seccnt), secname);
- Elf_shdr(0, ehdr->e_machine, shdr);
+ Elf_shdr(0, osabi, ehdr->e_machine, shdr);
}
}
@@ -434,8 +435,8 @@ getphdr(Word phnum, Word *type_arr, Word type_cnt, const char *file, Elf *elf)
}
static void
-unwind(Cache *cache, Word shnum, Word phnum, Ehdr *ehdr, const char *file,
- Elf *elf, uint_t flags)
+unwind(Cache *cache, Word shnum, Word phnum, Ehdr *ehdr, uchar_t osabi,
+ const char *file, Elf *elf, uint_t flags)
{
#if defined(_ELF64)
#define MSG_UNW_BINSRTAB2 MSG_UNW_BINSRTAB2_64
@@ -486,23 +487,19 @@ unwind(Cache *cache, Word shnum, Word phnum, Ehdr *ehdr, const char *file,
uint_t vers, frame_ptr_enc, fde_cnt_enc, table_enc;
/*
- * Skip sections of the wrong type. On amd64, Solaris tags
- * these as SHT_AMD64_UNWIND, while gcc started out issuing
- * them as SHT_PROGBITS and switched over when the amd64 ABI
- * was finalized. On non-amd64, they're all SHT_PROGBITS.
+ * Skip sections of the wrong type.
+ *
+ * On Solaris, these are SHT_AMD64_UNWIND for amd64,
+ * and SHT_PROGBITS for other platforms. For Linux, and
+ * presumably other operating systems that use the GNU
+ * toolchain, SHT_PROGBITS is used on all platforms.
+ *
+ * Skip anything other than these two types. The name
+ * test below will thin out the SHT_PROGBITS that don't apply.
*/
- switch (shdr->sh_type) {
- case SHT_PROGBITS:
- if (ehdr->e_machine == EM_AMD64)
- continue;
- break;
- case SHT_AMD64_UNWIND:
- if (ehdr->e_machine != EM_AMD64)
- continue;
- break;
- default:
+ if ((shdr->sh_type != SHT_PROGBITS) &&
+ (shdr->sh_type != SHT_AMD64_UNWIND))
continue;
- }
/*
* Only sections with names starting with .eh_frame or
@@ -596,7 +593,8 @@ unwind(Cache *cache, Word shnum, Word phnum, Ehdr *ehdr, const char *file,
(void) fprintf(stderr,
MSG_INTL(MSG_WARN_MULTEHFRM), file,
EC_WORD(cnt), _cache->c_name,
- conv_ehdr_type(ehdr->e_type, 0, &inv_buf));
+ conv_ehdr_type(osabi, ehdr->e_type,
+ 0, &inv_buf));
}
dump_eh_frame(data, datasize, shdr->sh_addr,
ehdr->e_machine, ehdr->e_ident);
@@ -1290,13 +1288,15 @@ versions(Cache *cache, Word shnum, const char *file, uint_t flags,
*/
static int
init_symtbl_state(SYMTBL_STATE *state, Cache *cache, Word shnum, Word secndx,
- Ehdr *ehdr, VERSYM_STATE *versym, const char *file, uint_t flags)
+ Ehdr *ehdr, uchar_t osabi, VERSYM_STATE *versym, const char *file,
+ uint_t flags)
{
Shdr *shdr;
state->file = file;
state->ehdr = ehdr;
state->cache = cache;
+ state->osabi = osabi;
state->shnum = shnum;
state->seccache = &cache[secndx];
state->secndx = secndx;
@@ -1461,7 +1461,8 @@ output_symbol(SYMTBL_STATE *state, Word symndx, Word info, Word disp_symndx,
* The section names are not available, so all we can
* do is to display them in numeric form.
*/
- sec = conv_sym_shndx(sym->st_shndx, &inv_buf);
+ sec = conv_sym_shndx(state->osabi, state->ehdr->e_machine,
+ sym->st_shndx, CONV_FMT_DECIMAL, &inv_buf);
} else if ((sym->st_shndx < SHN_LORESERVE) &&
(sym->st_shndx < state->shnum)) {
shndx = sym->st_shndx;
@@ -1621,7 +1622,7 @@ output_symbol(SYMTBL_STATE *state, Word symndx, Word info, Word disp_symndx,
(void) snprintf(index, MAXNDXSIZE,
MSG_ORIG(MSG_FMT_INDEX), EC_XWORD(disp_symndx));
- Elf_syms_table_entry(0, ELF_DBG_ELFDUMP, index,
+ Elf_syms_table_entry(0, ELF_DBG_ELFDUMP, index, state->osabi,
state->ehdr->e_machine, sym, verndx, gnuver, sec, symname);
}
@@ -1629,8 +1630,8 @@ output_symbol(SYMTBL_STATE *state, Word symndx, Word info, Word disp_symndx,
* Search for and process any symbol tables.
*/
void
-symbols(Cache *cache, Word shnum, Ehdr *ehdr, VERSYM_STATE *versym,
- const char *file, uint_t flags)
+symbols(Cache *cache, Word shnum, Ehdr *ehdr, uchar_t osabi,
+ VERSYM_STATE *versym, const char *file, uint_t flags)
{
SYMTBL_STATE state;
Cache *_cache;
@@ -1645,13 +1646,14 @@ symbols(Cache *cache, Word shnum, Ehdr *ehdr, VERSYM_STATE *versym,
if ((shdr->sh_type != SHT_SYMTAB) &&
(shdr->sh_type != SHT_DYNSYM) &&
- (shdr->sh_type != SHT_SUNW_LDYNSYM))
+ ((shdr->sh_type != SHT_SUNW_LDYNSYM) ||
+ (osabi != ELFOSABI_SOLARIS)))
continue;
if (!match(MATCH_F_ALL, _cache->c_name, secndx, shdr->sh_type))
continue;
if (!init_symtbl_state(&state, cache, shnum, secndx, ehdr,
- versym, file, flags))
+ osabi, versym, file, flags))
continue;
/*
* Loop through the symbol tables entries.
@@ -1671,8 +1673,8 @@ symbols(Cache *cache, Word shnum, Ehdr *ehdr, VERSYM_STATE *versym,
* These sections are always associated with the .SUNW_ldynsym./.dynsym pair.
*/
static void
-sunw_sort(Cache *cache, Word shnum, Ehdr *ehdr, VERSYM_STATE *versym,
- const char *file, uint_t flags)
+sunw_sort(Cache *cache, Word shnum, Ehdr *ehdr, uchar_t osabi,
+ VERSYM_STATE *versym, const char *file, uint_t flags)
{
SYMTBL_STATE ldynsym_state, dynsym_state;
Cache *sortcache, *symcache;
@@ -1716,7 +1718,7 @@ sunw_sort(Cache *cache, Word shnum, Ehdr *ehdr, VERSYM_STATE *versym,
switch (symshdr->sh_type) {
case SHT_SUNW_LDYNSYM:
if (!init_symtbl_state(&ldynsym_state, cache, shnum,
- symsecndx, ehdr, versym, file, flags))
+ symsecndx, ehdr, osabi, versym, file, flags))
continue;
ldynsym_cnt = ldynsym_state.symn;
/*
@@ -1742,13 +1744,14 @@ sunw_sort(Cache *cache, Word shnum, Ehdr *ehdr, VERSYM_STATE *versym,
/* FALLTHROUGH */
case SHT_DYNSYM:
if (!init_symtbl_state(&dynsym_state, cache, shnum,
- symsecndx, ehdr, versym, file, flags))
+ symsecndx, ehdr, osabi, versym, file, flags))
continue;
break;
default:
(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADNDXSEC),
- file, sortcache->c_name, conv_sec_type(
- ehdr->e_machine, symshdr->sh_type, 0, &inv_buf));
+ file, sortcache->c_name,
+ conv_sec_type(osabi, ehdr->e_machine,
+ symshdr->sh_type, 0, &inv_buf));
continue;
}
@@ -1958,7 +1961,7 @@ typedef enum { DYN_TEST_ADDR, DYN_TEST_SIZE, DYN_TEST_ENTSIZE } dyn_test_t;
*/
static void
dyn_test(dyn_test_t test_type, Word sh_type, Cache *sec_cache, Dyn *dyn,
- Word dynsec_cnt, Ehdr *ehdr, const char *file)
+ Word dynsec_cnt, Ehdr *ehdr, uchar_t osabi, const char *file)
{
Conv_inv_buf_t buf1, buf2;
@@ -2007,12 +2010,13 @@ dyn_test(dyn_test_t test_type, Word sh_type, Cache *sec_cache, Dyn *dyn,
name = MSG_ORIG(MSG_ELF_FINI);
break;
default:
- name = conv_sec_type(ehdr->e_machine, sh_type,
- 0, &buf1);
+ name = conv_sec_type(osabi, ehdr->e_machine,
+ sh_type, 0, &buf1);
break;
}
(void) fprintf(stderr, MSG_INTL(MSG_ERR_DYNNOBCKSEC), file,
- name, conv_dyn_tag(dyn->d_tag, ehdr->e_machine, 0, &buf2));
+ name, conv_dyn_tag(dyn->d_tag, osabi, ehdr->e_machine,
+ 0, &buf2));
return;
}
@@ -2023,9 +2027,9 @@ dyn_test(dyn_test_t test_type, Word sh_type, Cache *sec_cache, Dyn *dyn,
if (dyn->d_un.d_val != sec_cache->c_shdr->sh_addr)
(void) fprintf(stderr,
MSG_INTL(MSG_ERR_DYNBADADDR), file,
- conv_dyn_tag(dyn->d_tag, ehdr->e_machine, 0, &buf1),
- EC_ADDR(dyn->d_un.d_val), sec_cache->c_ndx,
- sec_cache->c_name,
+ conv_dyn_tag(dyn->d_tag, osabi, ehdr->e_machine,
+ 0, &buf1), EC_ADDR(dyn->d_un.d_val),
+ sec_cache->c_ndx, sec_cache->c_name,
EC_ADDR(sec_cache->c_shdr->sh_addr));
break;
@@ -2034,8 +2038,8 @@ dyn_test(dyn_test_t test_type, Word sh_type, Cache *sec_cache, Dyn *dyn,
if (dyn->d_un.d_val != sec_cache->c_shdr->sh_size)
(void) fprintf(stderr,
MSG_INTL(MSG_ERR_DYNBADSIZE), file,
- conv_dyn_tag(dyn->d_tag, ehdr->e_machine, 0, &buf1),
- EC_XWORD(dyn->d_un.d_val),
+ conv_dyn_tag(dyn->d_tag, osabi, ehdr->e_machine,
+ 0, &buf1), EC_XWORD(dyn->d_un.d_val),
sec_cache->c_ndx, sec_cache->c_name,
EC_XWORD(sec_cache->c_shdr->sh_size));
break;
@@ -2045,8 +2049,8 @@ dyn_test(dyn_test_t test_type, Word sh_type, Cache *sec_cache, Dyn *dyn,
if (dyn->d_un.d_val != sec_cache->c_shdr->sh_entsize)
(void) fprintf(stderr,
MSG_INTL(MSG_ERR_DYNBADENTSIZE), file,
- conv_dyn_tag(dyn->d_tag, ehdr->e_machine, 0, &buf1),
- EC_XWORD(dyn->d_un.d_val),
+ conv_dyn_tag(dyn->d_tag, osabi, ehdr->e_machine,
+ 0, &buf1), EC_XWORD(dyn->d_un.d_val),
sec_cache->c_ndx, sec_cache->c_name,
EC_XWORD(sec_cache->c_shdr->sh_entsize));
break;
@@ -2073,7 +2077,7 @@ dyn_test(dyn_test_t test_type, Word sh_type, Cache *sec_cache, Dyn *dyn,
static void
dyn_symtest(Dyn *dyn, const char *symname, Cache *symtab_cache,
Cache *dynsym_cache, Cache *ldynsym_cache, Cache *cache,
- Word shnum, Ehdr *ehdr, const char *file)
+ Word shnum, Ehdr *ehdr, uchar_t osabi, const char *file)
{
Conv_inv_buf_t buf;
int i;
@@ -2097,8 +2101,8 @@ dyn_symtest(Dyn *dyn, const char *symname, Cache *symtab_cache,
symlookup(symname, cache, shnum, &sym, _cache, file) &&
(sym->st_value != dyn->d_un.d_val))
(void) fprintf(stderr, MSG_INTL(MSG_ERR_DYNSYMVAL),
- file, _cache->c_name,
- conv_dyn_tag(dyn->d_tag, ehdr->e_machine, 0, &buf),
+ file, _cache->c_name, conv_dyn_tag(dyn->d_tag,
+ osabi, ehdr->e_machine, 0, &buf),
symname, EC_ADDR(sym->st_value));
}
}
@@ -2108,7 +2112,7 @@ dyn_symtest(Dyn *dyn, const char *symname, Cache *symtab_cache,
* Search for and process a .dynamic section.
*/
static void
-dynamic(Cache *cache, Word shnum, Ehdr *ehdr, const char *file)
+dynamic(Cache *cache, Word shnum, Ehdr *ehdr, uchar_t osabi, const char *file)
{
struct {
Cache *symtab;
@@ -2136,6 +2140,7 @@ dynamic(Cache *cache, Word shnum, Ehdr *ehdr, const char *file)
Word dynsec_num;
int dynsec_cnt;
Word cnt;
+ int osabi_solaris = osabi == ELFOSABI_SOLARIS;
/*
* Make a pass over all the sections, gathering section information
@@ -2367,12 +2372,17 @@ dynamic(Cache *cache, Word shnum, Ehdr *ehdr, const char *file)
case DT_USED:
case DT_DEPAUDIT:
case DT_AUDIT:
- case DT_SUNW_AUXILIARY:
- case DT_SUNW_FILTER:
name = string(_cache, ndx, strsec,
file, dyn->d_un.d_ptr);
break;
+ case DT_SUNW_AUXILIARY:
+ case DT_SUNW_FILTER:
+ if (osabi_solaris)
+ name = string(_cache, ndx, strsec,
+ file, dyn->d_un.d_ptr);
+ break;
+
case DT_FLAGS:
name = conv_dyn_flag(dyn->d_un.d_val,
0, &c_buf.flag);
@@ -2394,8 +2404,10 @@ dynamic(Cache *cache, Word shnum, Ehdr *ehdr, const char *file)
break;
case DT_SUNW_LDMACH:
- name = conv_ehdr_mach((Half)dyn->d_un.d_val, 0,
- &c_buf.inv);
+ if (!osabi_solaris)
+ break;
+ name = conv_ehdr_mach((Half)dyn->d_un.d_val,
+ 0, &c_buf.inv);
break;
/*
@@ -2406,18 +2418,21 @@ dynamic(Cache *cache, Word shnum, Ehdr *ehdr, const char *file)
*/
#define TEST_ADDR(_sh_type, _sec_field) \
dyn_test(DYN_TEST_ADDR, _sh_type, \
- sec._sec_field, dyn, dynsec_cnt, ehdr, file)
+ sec._sec_field, dyn, dynsec_cnt, ehdr, \
+ osabi, file)
#define TEST_SIZE(_sh_type, _sec_field) \
dyn_test(DYN_TEST_SIZE, _sh_type, \
- sec._sec_field, dyn, dynsec_cnt, ehdr, file)
+ sec._sec_field, dyn, dynsec_cnt, ehdr, \
+ osabi, file)
#define TEST_ENTSIZE(_sh_type, _sec_field) \
dyn_test(DYN_TEST_ENTSIZE, _sh_type, \
- sec._sec_field, dyn, dynsec_cnt, ehdr, file)
+ sec._sec_field, dyn, dynsec_cnt, ehdr, \
+ osabi, file)
case DT_FINI:
dyn_symtest(dyn, MSG_ORIG(MSG_SYM_FINI),
sec.symtab, sec.dynsym, sec.sunw_ldynsym,
- cache, shnum, ehdr, file);
+ cache, shnum, ehdr, osabi, file);
TEST_ADDR(SHT_PROGBITS, fini);
break;
@@ -2436,7 +2451,7 @@ dynamic(Cache *cache, Word shnum, Ehdr *ehdr, const char *file)
case DT_INIT:
dyn_symtest(dyn, MSG_ORIG(MSG_SYM_INIT),
sec.symtab, sec.dynsym, sec.sunw_ldynsym,
- cache, shnum, ehdr, file);
+ cache, shnum, ehdr, osabi, file);
TEST_ADDR(SHT_PROGBITS, init);
break;
@@ -2527,7 +2542,7 @@ dynamic(Cache *cache, Word shnum, Ehdr *ehdr, const char *file)
* This entry is related to both the symsort and
* tlssort sections.
*/
- {
+ if (osabi_solaris) {
int test_tls =
(sec.sunw_tlssort != NULL);
int test_sym =
@@ -2544,19 +2559,27 @@ dynamic(Cache *cache, Word shnum, Ehdr *ehdr, const char *file)
case DT_SUNW_SYMSORT:
- TEST_ADDR(SHT_SUNW_symsort, sunw_symsort);
+ if (osabi_solaris)
+ TEST_ADDR(SHT_SUNW_symsort,
+ sunw_symsort);
break;
case DT_SUNW_SYMSORTSZ:
- TEST_SIZE(SHT_SUNW_symsort, sunw_symsort);
+ if (osabi_solaris)
+ TEST_SIZE(SHT_SUNW_symsort,
+ sunw_symsort);
break;
case DT_SUNW_TLSSORT:
- TEST_ADDR(SHT_SUNW_tlssort, sunw_tlssort);
+ if (osabi_solaris)
+ TEST_ADDR(SHT_SUNW_tlssort,
+ sunw_tlssort);
break;
case DT_SUNW_TLSSORTSZ:
- TEST_SIZE(SHT_SUNW_tlssort, sunw_tlssort);
+ if (osabi_solaris)
+ TEST_SIZE(SHT_SUNW_tlssort,
+ sunw_tlssort);
break;
case DT_VERDEF:
@@ -2577,7 +2600,8 @@ dynamic(Cache *cache, Word shnum, Ehdr *ehdr, const char *file)
if (name == NULL)
name = MSG_ORIG(MSG_STR_EMPTY);
- Elf_dyn_entry(0, dyn, ndx, name, ehdr->e_machine);
+ Elf_dyn_entry(0, dyn, ndx, name,
+ osabi, ehdr->e_machine);
}
}
}
@@ -2696,6 +2720,128 @@ move(Cache *cache, Word shnum, const char *file, uint_t flags)
}
/*
+ * parse_note_t is used to track the state used by parse_note_entry()
+ * between calls, and also to return the results of each call.
+ */
+typedef struct {
+ /* pns_ fields track progress through the data */
+ const char *pns_file; /* File name */
+ Cache *pns_cache; /* Note section cache entry */
+ size_t pns_size; /* # unprocessed data bytes */
+ Word *pns_data; /* # to next unused data byte */
+
+ /* pn_ fields return the results for a single call */
+ Word pn_namesz; /* Value of note namesz field */
+ Word pn_descsz; /* Value of note descsz field */
+ Word pn_type; /* Value of note type field */
+ const char *pn_name; /* if (namesz > 0) ptr to name bytes */
+ const char *pn_desc; /* if (descsx > 0) ptr to data bytes */
+} parse_note_t;
+
+/*
+ * Extract the various sub-parts of a note entry, and advance the
+ * data pointer past it.
+ *
+ * entry:
+ * The state pns_ fields contain current values for the Note section
+ *
+ * exit:
+ * On success, True (1) is returned, the state pns_ fields have been
+ * advanced to point at the start of the next entry, and the information
+ * for the recovered note entry is found in the state pn_ fields.
+ *
+ * On failure, False (0) is returned. The values contained in state
+ * are undefined.
+ */
+static int
+parse_note_entry(parse_note_t *state)
+{
+ size_t pad, noteoff;
+
+ noteoff = (Word)state->pns_cache->c_data->d_size - state->pns_size;
+ /*
+ * Make sure we can at least reference the 3 initial entries
+ * (4-byte words) of the note information block.
+ */
+ if (state->pns_size >= (sizeof (Word) * 3)) {
+ state->pns_size -= (sizeof (Word) * 3);
+ } else {
+ (void) fprintf(stderr, MSG_INTL(MSG_NOTE_BADDATASZ),
+ state->pns_file, state->pns_cache->c_name,
+ EC_WORD(noteoff));
+ return (0);
+ }
+
+ /*
+ * Make sure any specified name string can be referenced.
+ */
+ if ((state->pn_namesz = *state->pns_data++) != 0) {
+ if (state->pns_size >= state->pn_namesz) {
+ state->pns_size -= state->pn_namesz;
+ } else {
+ (void) fprintf(stderr, MSG_INTL(MSG_NOTE_BADNMSZ),
+ state->pns_file, state->pns_cache->c_name,
+ EC_WORD(noteoff), EC_WORD(state->pn_namesz));
+ return (0);
+ }
+ }
+
+ /*
+ * Make sure any specified descriptor can be referenced.
+ */
+ if ((state->pn_descsz = *state->pns_data++) != 0) {
+ /*
+ * If namesz isn't a 4-byte multiple, account for any
+ * padding that must exist before the descriptor.
+ */
+ if ((pad = (state->pn_namesz & (sizeof (Word) - 1))) != 0) {
+ pad = sizeof (Word) - pad;
+ state->pns_size -= pad;
+ }
+ if (state->pns_size >= state->pn_descsz) {
+ state->pns_size -= state->pn_descsz;
+ } else {
+ (void) fprintf(stderr, MSG_INTL(MSG_NOTE_BADDESZ),
+ state->pns_file, state->pns_cache->c_name,
+ EC_WORD(noteoff), EC_WORD(state->pn_namesz));
+ return (0);
+ }
+ }
+
+ state->pn_type = *state->pns_data++;
+
+ /* Name */
+ if (state->pn_namesz) {
+ state->pn_name = (char *)state->pns_data;
+ pad = (state->pn_namesz +
+ (sizeof (Word) - 1)) & ~(sizeof (Word) - 1);
+ /* LINTED */
+ state->pns_data = (Word *)(state->pn_name + pad);
+ }
+
+ /*
+ * If multiple information blocks exist within a .note section
+ * account for any padding that must exist before the next
+ * information block.
+ */
+ if ((pad = (state->pn_descsz & (sizeof (Word) - 1))) != 0) {
+ pad = sizeof (Word) - pad;
+ if (state->pns_size > pad)
+ state->pns_size -= pad;
+ }
+
+ /* Data */
+ if (state->pn_descsz) {
+ state->pn_desc = (const char *)state->pns_data;
+ /* LINTED */
+ state->pns_data = (Word *)(state->pn_desc +
+ state->pn_descsz + pad);
+ }
+
+ return (1);
+}
+
+/*
* Callback function for use with conv_str_to_c_literal() below.
*/
/*ARGSUSED2*/
@@ -2713,97 +2859,50 @@ c_literal_cb(const void *ptr, size_t size, void *uvalue)
void
note_entry(Cache *cache, Word *data, size_t size, Ehdr *ehdr, const char *file)
{
- size_t bsize = size;
int cnt = 0;
int is_corenote;
int do_swap;
Conv_inv_buf_t inv_buf;
+ parse_note_t pnstate;
- do_swap = _elf_sys_encoding() != ehdr->e_ident[EI_DATA];
+ pnstate.pns_file = file;
+ pnstate.pns_cache = cache;
+ pnstate.pns_size = size;
+ pnstate.pns_data = data;
+ do_swap = _elf_sys_encoding() != ehdr->e_ident[EI_DATA];
/*
* Print out a single `note' information block.
*/
- while (size > 0) {
- size_t namesz, descsz, type, pad, noteoff;
+ while (pnstate.pns_size > 0) {
- noteoff = bsize - size;
- /*
- * Make sure we can at least reference the 3 initial entries
- * (4-byte words) of the note information block.
- */
- if (size >= (sizeof (Word) * 3))
- size -= (sizeof (Word) * 3);
- else {
- (void) fprintf(stderr, MSG_INTL(MSG_NOTE_BADDATASZ),
- file, cache->c_name, EC_WORD(noteoff));
+ if (parse_note_entry(&pnstate) == 0)
return;
- }
-
- /*
- * Make sure any specified name string can be referenced.
- */
- if ((namesz = *data++) != 0) {
- if (size >= namesz)
- size -= namesz;
- else {
- (void) fprintf(stderr,
- MSG_INTL(MSG_NOTE_BADNMSZ), file,
- cache->c_name, EC_WORD(noteoff),
- EC_WORD(namesz));
- return;
- }
- }
-
- /*
- * Make sure any specified descriptor can be referenced.
- */
- if ((descsz = *data++) != 0) {
- /*
- * If namesz isn't a 4-byte multiple, account for any
- * padding that must exist before the descriptor.
- */
- if ((pad = (namesz & (sizeof (Word) - 1))) != 0) {
- pad = sizeof (Word) - pad;
- size -= pad;
- }
- if (size >= descsz)
- size -= descsz;
- else {
- (void) fprintf(stderr,
- MSG_INTL(MSG_NOTE_BADDESZ), file,
- cache->c_name, EC_WORD(noteoff),
- EC_WORD(namesz));
- return;
- }
- }
-
- type = *data++;
/*
* Is this a Solaris core note? Such notes all have
* the name "CORE".
*/
is_corenote = (ehdr->e_type == ET_CORE) &&
- (namesz == (MSG_STR_CORE_SIZE + 1)) &&
- (strncmp(MSG_ORIG(MSG_STR_CORE), (char *)data,
+ (pnstate.pn_namesz == (MSG_STR_CORE_SIZE + 1)) &&
+ (strncmp(MSG_ORIG(MSG_STR_CORE), pnstate.pn_name,
MSG_STR_CORE_SIZE + 1) == 0);
dbg_print(0, MSG_ORIG(MSG_STR_EMPTY));
dbg_print(0, MSG_INTL(MSG_FMT_NOTEENTNDX), EC_WORD(cnt));
cnt++;
- dbg_print(0, MSG_ORIG(MSG_NOTE_NAMESZ), EC_WORD(namesz));
- dbg_print(0, MSG_ORIG(MSG_NOTE_DESCSZ), EC_WORD(descsz));
+ dbg_print(0, MSG_ORIG(MSG_NOTE_NAMESZ),
+ EC_WORD(pnstate.pn_namesz));
+ dbg_print(0, MSG_ORIG(MSG_NOTE_DESCSZ),
+ EC_WORD(pnstate.pn_descsz));
if (is_corenote)
dbg_print(0, MSG_ORIG(MSG_NOTE_TYPE_STR),
- conv_cnote_type(type, 0, &inv_buf));
+ conv_cnote_type(pnstate.pn_type, 0, &inv_buf));
else
- dbg_print(0, MSG_ORIG(MSG_NOTE_TYPE), EC_WORD(type));
- if (namesz) {
- char *name = (char *)data;
-
-
+ dbg_print(0, MSG_ORIG(MSG_NOTE_TYPE),
+ EC_WORD(pnstate.pn_type));
+ if (pnstate.pn_namesz) {
dbg_print(0, MSG_ORIG(MSG_NOTE_NAME));
/*
* The name string can contain embedded 'null'
@@ -2818,28 +2917,13 @@ note_entry(Cache *cache, Word *data, size_t size, Ehdr *ehdr, const char *file)
*/
(void) fwrite(MSG_ORIG(MSG_STR_8SP),
MSG_STR_8SP_SIZE, 1, stdout);
- conv_str_to_c_literal(name, namesz, c_literal_cb, NULL);
- name = name + ((namesz + (sizeof (Word) - 1)) &
- ~(sizeof (Word) - 1));
- /* LINTED */
- data = (Word *)name;
+ conv_str_to_c_literal(pnstate.pn_name,
+ pnstate.pn_namesz, c_literal_cb, NULL);
dbg_print(0, MSG_ORIG(MSG_STR_EMPTY));
}
- /*
- * If multiple information blocks exist within a .note section
- * account for any padding that must exist before the next
- * information block.
- */
- if ((pad = (descsz & (sizeof (Word) - 1))) != 0) {
- pad = sizeof (Word) - pad;
- if (size > pad)
- size -= pad;
- }
-
- if (descsz) {
+ if (pnstate.pn_descsz) {
int hexdump = 1;
- const char *desc = (const char *)data;
/*
* If this is a core note, let the corenote()
@@ -2851,7 +2935,8 @@ note_entry(Cache *cache, Word *data, size_t size, Ehdr *ehdr, const char *file)
corenote_ret_t corenote_ret;
corenote_ret = corenote(ehdr->e_machine,
- do_swap, type, desc, descsz);
+ do_swap, pnstate.pn_type, pnstate.pn_desc,
+ pnstate.pn_descsz);
switch (corenote_ret) {
case CORENOTE_R_OK:
hexdump = 0;
@@ -2879,12 +2964,9 @@ note_entry(Cache *cache, Word *data, size_t size, Ehdr *ehdr, const char *file)
*/
if (hexdump) {
dbg_print(0, MSG_ORIG(MSG_NOTE_DESC));
- dump_hex_bytes(desc, descsz, 8, 4, 4);
+ dump_hex_bytes(pnstate.pn_desc,
+ pnstate.pn_descsz, 8, 4, 4);
}
- desc += descsz + pad;
-
- /* LINTED */
- data = (Word *)desc;
}
}
}
@@ -2941,6 +3023,72 @@ note(Cache *cache, Word shnum, Ehdr *ehdr, const char *file)
}
/*
+ * The Linux Standard Base defines a special note named .note.ABI-tag
+ * that is used to maintain Linux ABI information. Presence of this section
+ * is a strong indication that the object should be considered to be
+ * ELFOSABI_LINUX.
+ *
+ * This function returns True (1) if such a note is seen, and False (0)
+ * otherwise.
+ */
+static int
+has_linux_abi_note(Cache *cache, Word shnum, const char *file)
+{
+ Word cnt;
+
+ for (cnt = 1; cnt < shnum; cnt++) {
+ parse_note_t pnstate;
+ Cache *_cache = &cache[cnt];
+ Shdr *shdr = _cache->c_shdr;
+
+ /*
+ * Section must be SHT_NOTE, must have the name
+ * .note.ABI-tag, and must have data.
+ */
+ if ((shdr->sh_type != SHT_NOTE) ||
+ (strcmp(MSG_ORIG(MSG_STR_NOTEABITAG),
+ _cache->c_name) != 0) || (_cache->c_data == NULL))
+ continue;
+
+ pnstate.pns_file = file;
+ pnstate.pns_cache = _cache;
+ pnstate.pns_size = _cache->c_data->d_size;
+ pnstate.pns_data = (Word *)_cache->c_data->d_buf;
+
+ while (pnstate.pns_size > 0) {
+ Word *w;
+
+ if (parse_note_entry(&pnstate) == 0)
+ break;
+
+ /*
+ * The type must be 1, and the name must be "GNU".
+ * The descsz must be at least 16 bytes.
+ */
+ if ((pnstate.pn_type != 1) ||
+ (pnstate.pn_namesz != (MSG_STR_GNU_SIZE + 1)) ||
+ (strncmp(MSG_ORIG(MSG_STR_GNU), pnstate.pn_name,
+ MSG_STR_CORE_SIZE + 1) != 0) ||
+ (pnstate.pn_descsz < 16))
+ continue;
+
+ /*
+ * desc contains 4 32-bit fields. Field 0 must be 0,
+ * indicating Linux. The second, third, and fourth
+ * fields represent the earliest Linux kernel
+ * version compatible with this object.
+ */
+ /*LINTED*/
+ w = (Word *) pnstate.pn_desc;
+ if (*w == 0)
+ return (1);
+ }
+ }
+
+ return (0);
+}
+
+/*
* Determine an individual hash entry. This may be the initial hash entry,
* or an associated chain entry.
*/
@@ -3786,10 +3934,45 @@ shdr_cache(const char *file, Elf *elf, Ehdr *ehdr, size_t shstrndx,
+/*
+ * Generate a cache of section headers and related information
+ * for use by the rest of elfdump. If requested (or the file
+ * contains no section headers), we generate a fake set of
+ * headers from the information accessible from the program headers.
+ * Otherwise, we use the real section headers contained in the file.
+ */
+static int
+create_cache(const char *file, int fd, Elf *elf, Ehdr *ehdr, Cache **cache,
+ size_t shstrndx, size_t *shnum, uint_t *flags)
+{
+ /*
+ * If there are no section headers, then resort to synthesizing
+ * section headers from the program headers. This is normally
+ * only done by explicit request, but in this case there's no
+ * reason not to go ahead, since the alternative is simply to quit.
+ */
+ if ((*shnum <= 1) && ((*flags & FLG_CTL_FAKESHDR) == 0)) {
+ (void) fprintf(stderr, MSG_INTL(MSG_ERR_NOSHDR), file);
+ *flags |= FLG_CTL_FAKESHDR;
+ }
+
+ if (*flags & FLG_CTL_FAKESHDR) {
+ if (fake_shdr_cache(file, fd, elf, ehdr, cache, shnum) == 0)
+ return (0);
+ } else {
+ if (shdr_cache(file, elf, ehdr, shstrndx, *shnum,
+ cache, *flags) == 0)
+ return (0);
+ }
+
+ return (1);
+}
+
int
regular(const char *file, int fd, Elf *elf, uint_t flags,
- const char *wname, int wfd)
+ const char *wname, int wfd, uchar_t osabi)
{
+ enum { CACHE_NEEDED, CACHE_OK, CACHE_FAIL} cache_state = CACHE_NEEDED;
Elf_Scn *scn;
Ehdr *ehdr;
size_t ndx, shstrndx, shnum, phnum;
@@ -3864,6 +4047,73 @@ regular(const char *file, int fd, Elf *elf, uint_t flags,
if (ehdr->e_shoff & (addr_align - 1))
(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSHDRALIGN), file);
+
+ /*
+ * Determine the Operating System ABI (osabi) we will use to
+ * interpret the object.
+ */
+ if (flags & FLG_CTL_OSABI) {
+ /*
+ * If the user explicitly specifies '-O none', we need
+ * to display a completely generic view of the file.
+ * However, libconv is written to assume that ELFOSABI_NONE
+ * is equivalent to ELFOSABI_SOLARIS. To get the desired
+ * effect, we use an osabi that libconv has no knowledge of.
+ */
+ if (osabi == ELFOSABI_NONE)
+ osabi = ELFOSABI_UNKNOWN4;
+ } else {
+ /* Determine osabi from file */
+ osabi = ehdr->e_ident[EI_OSABI];
+ if (osabi == ELFOSABI_NONE) {
+ /*
+ * Chicken/Egg scenario:
+ *
+ * Ideally, we wait to create the section header cache
+ * until after the program headers are printed. If we
+ * only output program headers, we can skip building
+ * the cache entirely.
+ *
+ * Proper interpretation of program headers requires
+ * the osabi, which is supposed to be in the ELF header.
+ * However, many systems (Solaris and Linux included)
+ * have a history of setting the osabi to the generic
+ * SysV ABI (ELFOSABI_NONE). We assume ELFOSABI_SOLARIS
+ * in such cases, but would like to check the object
+ * to see if it has a Linux .note.ABI-tag section,
+ * which implies ELFOSABI_LINUX. This requires a
+ * section header cache.
+ *
+ * To break the cycle, we create section headers now
+ * if osabi is ELFOSABI_NONE, and later otherwise.
+ * If it succeeds, we use them, if not, we defer
+ * exiting until after the program headers are out.
+ */
+ if (create_cache(file, fd, elf, ehdr, &cache,
+ shstrndx, &shnum, &flags) == 0) {
+ cache_state = CACHE_FAIL;
+ } else {
+ cache_state = CACHE_OK;
+ if (has_linux_abi_note(cache, shnum, file)) {
+ Conv_inv_buf_t ibuf1, ibuf2;
+
+ (void) fprintf(stderr,
+ MSG_INTL(MSG_INFO_LINUXOSABI), file,
+ conv_ehdr_osabi(osabi, 0, &ibuf1),
+ conv_ehdr_osabi(ELFOSABI_LINUX,
+ 0, &ibuf2));
+ osabi = ELFOSABI_LINUX;
+ }
+ }
+ }
+ /*
+ * We treat ELFOSABI_NONE identically to ELFOSABI_SOLARIS.
+ * Mapping NONE to SOLARIS simplifies the required test.
+ */
+ if (osabi == ELFOSABI_NONE)
+ osabi = ELFOSABI_SOLARIS;
+ }
+
/*
* Print the program headers.
*/
@@ -3882,7 +4132,7 @@ regular(const char *file, int fd, Elf *elf, uint_t flags,
dbg_print(0, MSG_ORIG(MSG_STR_EMPTY));
dbg_print(0, MSG_INTL(MSG_ELF_PHDR), EC_WORD(ndx));
- Elf_phdr(0, ehdr->e_machine, phdr);
+ Elf_phdr(0, osabi, ehdr->e_machine, phdr);
}
}
@@ -3896,37 +4146,21 @@ regular(const char *file, int fd, Elf *elf, uint_t flags,
return (ret);
/*
- * If there are no section headers, then resort to synthesizing
- * section headers from the program headers. This is normally
- * only done by explicit request, but in this case there's no
- * reason not to go ahead, since the alternative is simply to quit.
- */
- if ((shnum <= 1) && ((flags & FLG_CTL_FAKESHDR) == 0)) {
- (void) fprintf(stderr, MSG_INTL(MSG_ERR_NOSHDR), file);
- flags |= FLG_CTL_FAKESHDR;
- }
-
- /*
- * Generate a cache of section headers and related information
- * for use by the rest of elfdump. If requested (or the file
- * contains no section headers), we generate a fake set of
- * headers from the information accessible from the program headers.
- * Otherwise, we use the real section headers contained in the file.
- */
-
- if (flags & FLG_CTL_FAKESHDR) {
- if (fake_shdr_cache(file, fd, elf, ehdr, &cache, &shnum) == 0)
- return (ret);
- } else {
- if (shdr_cache(file, elf, ehdr, shstrndx, shnum,
- &cache, flags) == 0)
- return (ret);
- }
-
- /*
* Everything from this point on requires section headers.
* If we have no section headers, there is no reason to continue.
+ *
+ * If we tried above to create the section header cache and failed,
+ * it is time to exit. Otherwise, create it if needed.
*/
+ switch (cache_state) {
+ case CACHE_NEEDED:
+ if (create_cache(file, fd, elf, ehdr, &cache, shstrndx,
+ &shnum, &flags) == 0)
+ return (ret);
+ break;
+ case CACHE_FAIL:
+ return (ret);
+ }
if (shnum <= 1)
goto done;
@@ -4063,18 +4297,19 @@ regular(const char *file, int fd, Elf *elf, uint_t flags,
if (flags & FLG_SHOW_SHDR)
- sections(file, cache, shnum, ehdr);
+ sections(file, cache, shnum, ehdr, osabi);
if (flags & FLG_SHOW_INTERP)
interp(file, cache, shnum, phnum, elf);
- versions(cache, shnum, file, flags, &versym);
+ if ((osabi == ELFOSABI_SOLARIS) || (osabi == ELFOSABI_LINUX))
+ versions(cache, shnum, file, flags, &versym);
if (flags & FLG_SHOW_SYMBOLS)
- symbols(cache, shnum, ehdr, &versym, file, flags);
+ symbols(cache, shnum, ehdr, osabi, &versym, file, flags);
- if (flags & FLG_SHOW_SORT)
- sunw_sort(cache, shnum, ehdr, &versym, file, flags);
+ if ((flags & FLG_SHOW_SORT) && (osabi == ELFOSABI_SOLARIS))
+ sunw_sort(cache, shnum, ehdr, osabi, &versym, file, flags);
if (flags & FLG_SHOW_HASH)
hash(cache, shnum, file, flags);
@@ -4092,7 +4327,7 @@ regular(const char *file, int fd, Elf *elf, uint_t flags,
reloc(cache, shnum, ehdr, file);
if (flags & FLG_SHOW_DYNAMIC)
- dynamic(cache, shnum, ehdr, file);
+ dynamic(cache, shnum, ehdr, osabi, file);
if (flags & FLG_SHOW_NOTE) {
Word note_cnt;
@@ -4126,17 +4361,18 @@ regular(const char *file, int fd, Elf *elf, uint_t flags,
}
}
- if (flags & FLG_SHOW_MOVE)
+ if ((flags & FLG_SHOW_MOVE) && (osabi == ELFOSABI_SOLARIS))
move(cache, shnum, file, flags);
if (flags & FLG_CALC_CHECKSUM)
checksum(elf);
- if (flags & FLG_SHOW_CAP)
+ if ((flags & FLG_SHOW_CAP) && (osabi == ELFOSABI_SOLARIS))
cap(file, cache, shnum, phnum, ehdr, elf);
- if (flags & FLG_SHOW_UNWIND)
- unwind(cache, shnum, phnum, ehdr, file, elf, flags);
+ if ((flags & FLG_SHOW_UNWIND) &&
+ ((osabi == ELFOSABI_SOLARIS) || (osabi == ELFOSABI_LINUX)))
+ unwind(cache, shnum, phnum, ehdr, osabi, file, elf, flags);
/* Release the memory used to cache section headers */
diff --git a/usr/src/cmd/sgs/elfdump/common/elfdump.msg b/usr/src/cmd/sgs/elfdump/common/elfdump.msg
index e531048806..7b67746553 100644
--- a/usr/src/cmd/sgs/elfdump/common/elfdump.msg
+++ b/usr/src/cmd/sgs/elfdump/common/elfdump.msg
@@ -33,7 +33,8 @@
# Usage Messages
@ MSG_USAGE_BRIEF "usage: %s [-cCdegGhHiklmnrSsuvy] [-I index] \
- [-N name] [-T type] [-p | -w outfile] file...\n"
+ [-N name] [-O osabi] [-T type] [-p | -w outfile] \
+ file...\n"
@ MSG_USAGE_DETAIL1 "\t[-c]\t\tdump section header information\n"
@ MSG_USAGE_DETAIL2 "\t[-C]\t\tdemangle C++ symbol names\n"
@ MSG_USAGE_DETAIL3 "\t[-d]\t\tdump the contents of the .dynamic section\n"
@@ -51,23 +52,24 @@
section\n"
@ MSG_USAGE_DETAIL14 "\t[-n]\t\tdump the contents of the .note section\n"
@ MSG_USAGE_DETAIL15 "\t[-N name]\tqualify an option with a `name'\n"
-@ MSG_USAGE_DETAIL16 "\t[-P]\t\tuse program headers to generate \
+@ MSG_USAGE_DETAIL16 "\t[-O osabi]\tuse given osabi to interpret object\n"
+@ MSG_USAGE_DETAIL17 "\t[-P]\t\tuse program headers to generate \
section headers\n"
-@ MSG_USAGE_DETAIL17 "\t[-p]\t\tdump the program headers\n"
-@ MSG_USAGE_DETAIL18 "\t[-r]\t\tdump the contents of the relocation \
+@ MSG_USAGE_DETAIL18 "\t[-p]\t\tdump the program headers\n"
+@ MSG_USAGE_DETAIL19 "\t[-r]\t\tdump the contents of the relocation \
sections\n"
-@ MSG_USAGE_DETAIL19 "\t[-S]\t\tdump the contents of the sort index \
+@ MSG_USAGE_DETAIL20 "\t[-S]\t\tdump the contents of the sort index \
sections\n"
-@ MSG_USAGE_DETAIL20 "\t[-s]\t\tdump the contents of the symbol table \
+@ MSG_USAGE_DETAIL21 "\t[-s]\t\tdump the contents of the symbol table \
sections\n"
-@ MSG_USAGE_DETAIL21 "\t[-T type]\tqualify an option with a section or \
+@ MSG_USAGE_DETAIL22 "\t[-T type]\tqualify an option with a section or \
program header type\n"
-@ MSG_USAGE_DETAIL22 "\t[-u]\t\tdump the contents of a frame unwind \
+@ MSG_USAGE_DETAIL23 "\t[-u]\t\tdump the contents of a frame unwind \
section\n"
-@ MSG_USAGE_DETAIL23 "\t[-v]\t\tdump the contents of the version sections\n"
-@ MSG_USAGE_DETAIL24 "\t[-w file]\twrite the contents of specified section \
+@ MSG_USAGE_DETAIL24 "\t[-v]\t\tdump the contents of the version sections\n"
+@ MSG_USAGE_DETAIL25 "\t[-w file]\twrite the contents of specified section \
to `file'\n"
-@ MSG_USAGE_DETAIL25 "\t[-y]\t\tdump the contents of the .SUNW_syminfo \
+@ MSG_USAGE_DETAIL26 "\t[-y]\t\tdump the contents of the .SUNW_syminfo \
section\n"
# Errors
@@ -168,6 +170,9 @@
@ MSG_WARN_MULTEHFRM "%s: section[%d: %s]: %s object has multiple \
.eh_frame sections\n"
+@ MSG_INFO_LINUXOSABI "%s: %s object has Linux .note.ABI-tag section. \
+ Assuming %s\n"
+
# Elf Output Messages
@ MSG_ELF_SHDR "Section Header[%d]: sh_name: %s"
@@ -225,6 +230,7 @@
@ MSG_ERR_WRITE "%s: write: %s\n"
@ MSG_ERR_BAD_T_SHT "%s: unrecognized section header type: %s\n"
@ MSG_ERR_BAD_T_PT "%s: unrecognized program header type: %s\n"
+@ MSG_ERR_BAD_T_OSABI "%s: unrecognized operating system ABI: %s\n"
@ MSG_ERR_AMBIG_MATCH "%s: ambiguous use of -I, -N, or -T. Remove \
-p option or section selection option(s)\n"
@@ -293,11 +299,13 @@
@ MSG_SYM_FINI "_fini"
@ MSG_SYM_GOT "_GLOBAL_OFFSET_TABLE_"
-@ MSG_STR_OPTIONS "CcdeGgHhiI:klmN:nPprSsT:uvw:y"
+@ MSG_STR_OPTIONS "CcdeGgHhiI:klmN:nO:PprSsT:uvw:y"
@ MSG_STR_8SP " "
@ MSG_STR_EMPTY ""
@ MSG_STR_CORE "CORE"
+@ MSG_STR_NOTEABITAG ".note.ABI-tag"
+@ MSG_STR_GNU "GNU"
@ MSG_STR_LOC "loc"
@ MSG_STR_INITLOC "initloc"
@@ -584,113 +592,3 @@
@ MSG_PHDRNAM_TLSSORT ".SUNW_tlssort(phdr)"
@ MSG_PHDRNAM_UNWIND ".eh_frame_hdr(phdr)"
@ MSG_PHDRNAM_VER ".SUNW_version(phdr)"
-
-
-# Names of sh_type SHT_* type constants
-
-@ MSG_SHT_NULL "SHT_NULL" # 0
-@ MSG_SHT_NULL_ALT1 "null"
-@ MSG_SHT_PROGBITS "SHT_PROGBITS" # 1
-@ MSG_SHT_PROGBITS_ALT1 "progbits"
-@ MSG_SHT_SYMTAB "SHT_SYMTAB" # 2
-@ MSG_SHT_SYMTAB_ALT1 "symtab"
-@ MSG_SHT_STRTAB "SHT_STRTAB" # 3
-@ MSG_SHT_STRTAB_ALT1 "strtab"
-@ MSG_SHT_RELA "SHT_RELA" # 4
-@ MSG_SHT_RELA_ALT1 "rela"
-@ MSG_SHT_HASH "SHT_HASH" # 5
-@ MSG_SHT_HASH_ALT1 "hash"
-@ MSG_SHT_DYNAMIC "SHT_DYNAMIC" # 6
-@ MSG_SHT_DYNAMIC_ALT1 "dynamic"
-@ MSG_SHT_NOTE "SHT_NOTE" # 7
-@ MSG_SHT_NOTE_ALT1 "note"
-@ MSG_SHT_NOBITS "SHT_NOBITS" # 8
-@ MSG_SHT_NOBITS_ALT1 "nobits"
-@ MSG_SHT_REL "SHT_REL" # 9
-@ MSG_SHT_REL_ALT1 "rel"
-@ MSG_SHT_SHLIB "SHT_SHLIB" # 10
-@ MSG_SHT_SHLIB_ALT1 "shlib"
-@ MSG_SHT_DYNSYM "SHT_DYNSYM" # 11
-@ MSG_SHT_DYNSYM_ALT1 "dynsym"
-@ MSG_SHT_INIT_ARRAY "SHT_INIT_ARRAY" # 14
-@ MSG_SHT_INIT_ARRAY_ALT1 "init_array"
-@ MSG_SHT_FINI_ARRAY "SHT_FINI_ARRAY" # 15
-@ MSG_SHT_FINI_ARRAY_ALT1 "fini_array"
-@ MSG_SHT_PREINIT_ARRAY "SHT_PREINIT_ARRAY" # 16
-@ MSG_SHT_PREINIT_ARRAY_ALT1 "preinit_ARRAY"
-@ MSG_SHT_GROUP "SHT_GROUP" # 17
-@ MSG_SHT_GROUP_ALT1 "group"
-@ MSG_SHT_SYMTAB_SHNDX "SHT_SYMTAB_SHNDX" # 18
-@ MSG_SHT_SYMTAB_SHNDX_ALT1 "symtab_shndx"
-@ MSG_SHT_SUNW_SYMSORT "SHT_SUNW_symsort" # 0x6ffffff1
-@ MSG_SHT_SUNW_SYMSORT_ALT1 "sunw_symsort"
-@ MSG_SHT_SUNW_TLSSORT "SHT_SUNW_tlssort" # 0x6ffffff2
-@ MSG_SHT_SUNW_TLSSORT_ALT1 "sunw_tlssort"
-@ MSG_SHT_SUNW_LDYNSYM "SHT_SUNW_LDYNSYM" # 0x6ffffff3
-@ MSG_SHT_SUNW_LDYNSYM_ALT1 "sunw_ldynsym"
-@ MSG_SHT_SUNW_DOF "SHT_SUNW_dof" # 0x6ffffff4
-@ MSG_SHT_SUNW_DOF_ALT1 "sunw_dof"
-@ MSG_SHT_SUNW_CAP "SHT_SUNW_cap" # 0x6ffffff5
-@ MSG_SHT_SUNW_CAP_ALT1 "sunw_cap"
-@ MSG_SHT_SUNW_SIGNATURE "SHT_SUNW_SIGNATURE" # 0x6ffffff6
-@ MSG_SHT_SUNW_SIGNATURE_ALT1 "sunw_signature"
-@ MSG_SHT_SUNW_ANNOTATE "SHT_SUNW_ANNOTATE" # 0x6ffffff7
-@ MSG_SHT_SUNW_ANNOTATE_ALT1 "sunw_annotate"
-@ MSG_SHT_SUNW_DEBUGSTR "SHT_SUNW_DEBUGSTR" # 0x6ffffff8
-@ MSG_SHT_SUNW_DEBUGSTR_ALT1 "sunw_debugstr"
-@ MSG_SHT_SUNW_DEBUG "SHT_SUNW_DEBUG" # 0x6ffffff9
-@ MSG_SHT_SUNW_DEBUG_ALT1 "sunw_debug"
-@ MSG_SHT_SUNW_MOVE "SHT_SUNW_move" # 0x6ffffffa
-@ MSG_SHT_SUNW_MOVE_ALT1 "sunw_move"
-@ MSG_SHT_SUNW_COMDAT "SHT_SUNW_COMDAT" # 0x6ffffffb
-@ MSG_SHT_SUNW_COMDAT_ALT1 "sunw_comdat"
-@ MSG_SHT_SUNW_SYMINFO "SHT_SUNW_syminfo" # 0x6ffffffc
-@ MSG_SHT_SUNW_SYMINFO_ALT1 "sunw_syminfo"
-@ MSG_SHT_SUNW_VERDEF "SHT_SUNW_verdef" # 0x6ffffffd
-@ MSG_SHT_SUNW_VERDEF_ALT1 "sunw_verdef"
-@ MSG_SHT_GNU_VERDEF "SHT_GNU_verdef" # 0x6ffffffd
-@ MSG_SHT_GNU_VERDEF_ALT1 "gnu_verdef"
-@ MSG_SHT_SUNW_VERNEED "SHT_SUNW_verneed" # 0x6ffffffe
-@ MSG_SHT_SUNW_VERNEED_ALT1 "sunw_verneed"
-@ MSG_SHT_GNU_VERNEED "SHT_GNU_verneed" # 0x6ffffffe
-@ MSG_SHT_GNU_VERNEED_ALT1 "gnu_verneed"
-@ MSG_SHT_SUNW_VERSYM "SHT_SUNW_versym" # 0x6fffffff
-@ MSG_SHT_SUNW_VERSYM_ALT1 "sunw_versym"
-@ MSG_SHT_GNU_VERSYM "SHT_GNU_versym" # 0x6fffffff
-@ MSG_SHT_GNU_VERSYM_ALT1 "gnu_versym"
-@ MSG_SHT_SPARC_GOTDATA "SHT_SPARC_GOTDATA" # 0x7000000
-@ MSG_SHT_SPARC_GOTDATA_ALT1 "sparc_gotdata"
-@ MSG_SHT_AMD64_UNWIND "SHT_AMD64_UNWIND" # 0x7000000
-@ MSG_SHT_AMD64_UNWIND_ALT1 "amd64_unwind"
-
-
-# Program header PT_ segment types
-
-@ MSG_PT_NULL "PT_NULL" # 0
-@ MSG_PT_NULL_ALT1 "null"
-@ MSG_PT_LOAD "PT_LOAD" # 1
-@ MSG_PT_LOAD_ALT1 "load"
-@ MSG_PT_DYNAMIC "PT_DYNAMIC" # 2
-@ MSG_PT_DYNAMIC_ALT1 "dynamic"
-@ MSG_PT_INTERP "PT_INTERP" # 3
-@ MSG_PT_INTERP_ALT1 "interp"
-@ MSG_PT_NOTE "PT_NOTE" # 4
-@ MSG_PT_NOTE_ALT1 "note"
-@ MSG_PT_SHLIB "PT_SHLIB" # 5
-@ MSG_PT_SHLIB_ALT1 "shlib"
-@ MSG_PT_PHDR "PT_PHDR" # 6
-@ MSG_PT_PHDR_ALT1 "phdr"
-@ MSG_PT_TLS "PT_TLS" # 7
-@ MSG_PT_TLS_ALT1 "tls"
-@ MSG_PT_SUNW_UNWIND "PT_SUNW_UNWIND" # 0x6464e550
-@ MSG_PT_SUNW_UNWIND_ALT1 "sunw_unwind"
-@ MSG_PT_SUNW_EH_FRAME "PT_SUNW_EH_FRAME" # 0x6474e550
-@ MSG_PT_SUNW_EH_FRAME_ALT1 "sunw_eh_frame"
-@ MSG_PT_SUNWBSS "PT_SUNWBSS" # 0x6ffffffa
-@ MSG_PT_SUNWBSS_ALT1 "sunwbss"
-@ MSG_PT_SUNWSTACK "PT_SUNWSTACK" # 0x6ffffffb
-@ MSG_PT_SUNWSTACK_ALT1 "sunwstack"
-@ MSG_PT_SUNWDTRACE "PT_SUNWDTRACE" # 0x6ffffffc
-@ MSG_PT_SUNWDTRACE_ALT1 "sunwdtrace"
-@ MSG_PT_SUNWCAP "PT_SUNWCAP" # 0x6ffffffd
-@ MSG_PT_SUNWCAP_ALT1 "sunwcap"
diff --git a/usr/src/cmd/sgs/elfdump/common/lintsup.c b/usr/src/cmd/sgs/elfdump/common/lintsup.c
index 0796a24b74..e50f8313e3 100644
--- a/usr/src/cmd/sgs/elfdump/common/lintsup.c
+++ b/usr/src/cmd/sgs/elfdump/common/lintsup.c
@@ -20,14 +20,12 @@
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* LINTLIBRARY */
/* PROTOLIB1 */
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* Supplemental Pseudo-code to get lint to consider these symbols used.
*/
@@ -46,15 +44,15 @@ foo()
#if defined(_ELF64)
int
regular32(const char *file, int fd, Elf *elf, uint_t flags,
- const char *wname, int wfd)
+ const char *wname, int wfd, uchar_t osabi)
{
- return (regular64(file, fd, elf, flags, wname, wfd));
+ return (regular64(file, fd, elf, flags, wname, wfd, osabi));
}
#else
int
regular64(const char *file, int fd, Elf *elf, uint_t flags,
- const char *wname, int wfd)
+ const char *wname, int wfd, uchar_t osabi)
{
- return (regular32(file, fd, elf, flags, wname, wfd));
+ return (regular32(file, fd, elf, flags, wname, wfd, osabi));
}
#endif
diff --git a/usr/src/cmd/sgs/elfdump/common/main.c b/usr/src/cmd/sgs/elfdump/common/main.c
index e58ddea7c2..76b6b02d5f 100644
--- a/usr/src/cmd/sgs/elfdump/common/main.c
+++ b/usr/src/cmd/sgs/elfdump/common/main.c
@@ -94,183 +94,6 @@ static struct {
-/* Map names to their integer value */
-typedef struct {
- const char *sym_name;
- uint32_t sym_value;
-} atoui_sym_t;
-
-/*
- * ELF section types.
- */
-static atoui_sym_t sym_sht[] = {
- { MSG_ORIG(MSG_SHT_NULL), SHT_NULL },
- { MSG_ORIG(MSG_SHT_NULL_ALT1), SHT_NULL },
-
- { MSG_ORIG(MSG_SHT_PROGBITS), SHT_PROGBITS },
- { MSG_ORIG(MSG_SHT_PROGBITS_ALT1), SHT_PROGBITS },
-
- { MSG_ORIG(MSG_SHT_SYMTAB), SHT_SYMTAB },
- { MSG_ORIG(MSG_SHT_SYMTAB_ALT1), SHT_SYMTAB },
-
- { MSG_ORIG(MSG_SHT_STRTAB), SHT_STRTAB },
- { MSG_ORIG(MSG_SHT_STRTAB_ALT1), SHT_STRTAB },
-
- { MSG_ORIG(MSG_SHT_RELA), SHT_RELA },
- { MSG_ORIG(MSG_SHT_RELA_ALT1), SHT_RELA },
-
- { MSG_ORIG(MSG_SHT_HASH), SHT_HASH },
- { MSG_ORIG(MSG_SHT_HASH_ALT1), SHT_HASH },
-
- { MSG_ORIG(MSG_SHT_DYNAMIC), SHT_DYNAMIC },
- { MSG_ORIG(MSG_SHT_DYNAMIC_ALT1), SHT_DYNAMIC },
-
- { MSG_ORIG(MSG_SHT_NOTE), SHT_NOTE },
- { MSG_ORIG(MSG_SHT_NOTE_ALT1), SHT_NOTE },
-
- { MSG_ORIG(MSG_SHT_NOBITS), SHT_NOBITS },
- { MSG_ORIG(MSG_SHT_NOBITS_ALT1), SHT_NOBITS },
-
- { MSG_ORIG(MSG_SHT_REL), SHT_REL },
- { MSG_ORIG(MSG_SHT_REL_ALT1), SHT_REL },
-
- { MSG_ORIG(MSG_SHT_SHLIB), SHT_SHLIB },
- { MSG_ORIG(MSG_SHT_SHLIB_ALT1), SHT_SHLIB },
-
- { MSG_ORIG(MSG_SHT_DYNSYM), SHT_DYNSYM },
- { MSG_ORIG(MSG_SHT_DYNSYM_ALT1), SHT_DYNSYM },
-
- { MSG_ORIG(MSG_SHT_INIT_ARRAY), SHT_INIT_ARRAY },
- { MSG_ORIG(MSG_SHT_INIT_ARRAY_ALT1), SHT_INIT_ARRAY },
-
- { MSG_ORIG(MSG_SHT_FINI_ARRAY), SHT_FINI_ARRAY },
- { MSG_ORIG(MSG_SHT_FINI_ARRAY_ALT1), SHT_FINI_ARRAY },
-
- { MSG_ORIG(MSG_SHT_PREINIT_ARRAY), SHT_PREINIT_ARRAY },
- { MSG_ORIG(MSG_SHT_PREINIT_ARRAY_ALT1), SHT_PREINIT_ARRAY },
-
- { MSG_ORIG(MSG_SHT_GROUP), SHT_GROUP },
- { MSG_ORIG(MSG_SHT_GROUP_ALT1), SHT_GROUP },
-
- { MSG_ORIG(MSG_SHT_SYMTAB_SHNDX), SHT_SYMTAB_SHNDX },
- { MSG_ORIG(MSG_SHT_SYMTAB_SHNDX_ALT1), SHT_SYMTAB_SHNDX },
-
- { MSG_ORIG(MSG_SHT_SUNW_SYMSORT), SHT_SUNW_symsort },
- { MSG_ORIG(MSG_SHT_SUNW_SYMSORT_ALT1), SHT_SUNW_symsort },
-
- { MSG_ORIG(MSG_SHT_SUNW_TLSSORT), SHT_SUNW_tlssort },
- { MSG_ORIG(MSG_SHT_SUNW_TLSSORT_ALT1), SHT_SUNW_tlssort },
-
- { MSG_ORIG(MSG_SHT_SUNW_LDYNSYM), SHT_SUNW_LDYNSYM },
- { MSG_ORIG(MSG_SHT_SUNW_LDYNSYM_ALT1), SHT_SUNW_LDYNSYM },
-
- { MSG_ORIG(MSG_SHT_SUNW_DOF), SHT_SUNW_dof },
- { MSG_ORIG(MSG_SHT_SUNW_DOF_ALT1), SHT_SUNW_dof },
-
- { MSG_ORIG(MSG_SHT_SUNW_CAP), SHT_SUNW_cap },
- { MSG_ORIG(MSG_SHT_SUNW_CAP_ALT1), SHT_SUNW_cap },
-
- { MSG_ORIG(MSG_SHT_SUNW_SIGNATURE), SHT_SUNW_SIGNATURE },
- { MSG_ORIG(MSG_SHT_SUNW_SIGNATURE_ALT1), SHT_SUNW_SIGNATURE },
-
- { MSG_ORIG(MSG_SHT_SUNW_ANNOTATE), SHT_SUNW_ANNOTATE },
- { MSG_ORIG(MSG_SHT_SUNW_ANNOTATE_ALT1), SHT_SUNW_ANNOTATE },
-
- { MSG_ORIG(MSG_SHT_SUNW_DEBUGSTR), SHT_SUNW_DEBUGSTR },
- { MSG_ORIG(MSG_SHT_SUNW_DEBUGSTR_ALT1), SHT_SUNW_DEBUGSTR },
-
- { MSG_ORIG(MSG_SHT_SUNW_DEBUG), SHT_SUNW_DEBUG },
- { MSG_ORIG(MSG_SHT_SUNW_DEBUG_ALT1), SHT_SUNW_DEBUG },
-
- { MSG_ORIG(MSG_SHT_SUNW_MOVE), SHT_SUNW_move },
- { MSG_ORIG(MSG_SHT_SUNW_MOVE_ALT1), SHT_SUNW_move },
-
- { MSG_ORIG(MSG_SHT_SUNW_COMDAT), SHT_SUNW_COMDAT },
- { MSG_ORIG(MSG_SHT_SUNW_COMDAT_ALT1), SHT_SUNW_COMDAT },
-
- { MSG_ORIG(MSG_SHT_SUNW_SYMINFO), SHT_SUNW_syminfo },
- { MSG_ORIG(MSG_SHT_SUNW_SYMINFO_ALT1), SHT_SUNW_syminfo },
-
- { MSG_ORIG(MSG_SHT_SUNW_VERDEF), SHT_SUNW_verdef },
- { MSG_ORIG(MSG_SHT_SUNW_VERDEF_ALT1), SHT_SUNW_verdef },
-
- { MSG_ORIG(MSG_SHT_GNU_VERDEF), SHT_GNU_verdef },
- { MSG_ORIG(MSG_SHT_GNU_VERDEF_ALT1), SHT_GNU_verdef },
-
- { MSG_ORIG(MSG_SHT_SUNW_VERNEED), SHT_SUNW_verneed },
- { MSG_ORIG(MSG_SHT_SUNW_VERNEED_ALT1), SHT_SUNW_verneed },
-
- { MSG_ORIG(MSG_SHT_GNU_VERNEED), SHT_GNU_verneed },
- { MSG_ORIG(MSG_SHT_GNU_VERNEED_ALT1), SHT_GNU_verneed },
-
- { MSG_ORIG(MSG_SHT_SUNW_VERSYM), SHT_SUNW_versym },
- { MSG_ORIG(MSG_SHT_SUNW_VERSYM_ALT1), SHT_SUNW_versym },
-
- { MSG_ORIG(MSG_SHT_GNU_VERSYM), SHT_GNU_versym },
- { MSG_ORIG(MSG_SHT_GNU_VERSYM_ALT1), SHT_GNU_versym },
-
- { MSG_ORIG(MSG_SHT_SPARC_GOTDATA), SHT_SPARC_GOTDATA },
- { MSG_ORIG(MSG_SHT_SPARC_GOTDATA_ALT1), SHT_SPARC_GOTDATA },
-
- { MSG_ORIG(MSG_SHT_AMD64_UNWIND), SHT_AMD64_UNWIND },
- { MSG_ORIG(MSG_SHT_AMD64_UNWIND_ALT1), SHT_AMD64_UNWIND },
-
- { NULL }
-};
-
-/*
- * Program header PT_* type values
- */
-static atoui_sym_t sym_pt[] = {
- { MSG_ORIG(MSG_PT_NULL), PT_NULL },
- { MSG_ORIG(MSG_PT_NULL_ALT1), PT_NULL },
-
- { MSG_ORIG(MSG_PT_LOAD), PT_LOAD },
- { MSG_ORIG(MSG_PT_LOAD_ALT1), PT_LOAD },
-
- { MSG_ORIG(MSG_PT_DYNAMIC), PT_DYNAMIC },
- { MSG_ORIG(MSG_PT_DYNAMIC_ALT1), PT_DYNAMIC },
-
- { MSG_ORIG(MSG_PT_INTERP), PT_INTERP },
- { MSG_ORIG(MSG_PT_INTERP_ALT1), PT_INTERP },
-
- { MSG_ORIG(MSG_PT_NOTE), PT_NOTE },
- { MSG_ORIG(MSG_PT_NOTE_ALT1), PT_NOTE },
-
- { MSG_ORIG(MSG_PT_SHLIB), PT_SHLIB },
- { MSG_ORIG(MSG_PT_SHLIB_ALT1), PT_SHLIB },
-
- { MSG_ORIG(MSG_PT_PHDR), PT_PHDR },
- { MSG_ORIG(MSG_PT_PHDR_ALT1), PT_PHDR },
-
- { MSG_ORIG(MSG_PT_TLS), PT_TLS },
- { MSG_ORIG(MSG_PT_TLS_ALT1), PT_TLS },
-
- { MSG_ORIG(MSG_PT_SUNW_UNWIND), PT_SUNW_UNWIND },
- { MSG_ORIG(MSG_PT_SUNW_UNWIND_ALT1), PT_SUNW_UNWIND },
-
- { MSG_ORIG(MSG_PT_SUNW_EH_FRAME), PT_SUNW_EH_FRAME },
- { MSG_ORIG(MSG_PT_SUNW_EH_FRAME_ALT1), PT_SUNW_EH_FRAME },
-
- { MSG_ORIG(MSG_PT_SUNWBSS), PT_SUNWBSS },
- { MSG_ORIG(MSG_PT_SUNWBSS_ALT1), PT_SUNWBSS },
-
- { MSG_ORIG(MSG_PT_SUNWSTACK), PT_SUNWSTACK },
- { MSG_ORIG(MSG_PT_SUNWSTACK_ALT1), PT_SUNWSTACK },
-
- { MSG_ORIG(MSG_PT_SUNWDTRACE), PT_SUNWDTRACE },
- { MSG_ORIG(MSG_PT_SUNWDTRACE_ALT1), PT_SUNWDTRACE },
-
- { MSG_ORIG(MSG_PT_SUNWCAP), PT_SUNWCAP },
- { MSG_ORIG(MSG_PT_SUNWCAP_ALT1), PT_SUNWCAP },
-
- { NULL }
-};
-
-
-
-
-
const char *
_elfdump_msg(Msg mid)
{
@@ -330,6 +153,7 @@ detail_usage()
(void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL23));
(void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL24));
(void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL25));
+ (void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL26));
}
/*
@@ -466,66 +290,62 @@ process_index_opt(const char *str, match_rec_t *rec)
}
/*
- * Process the symbolic name to value mappings passed to the
- * atoui() function.
- *
- * entry:
- * sym - NULL terminated array of name->value mappings.
- * value - Address of variable to receive corresponding value.
- *
- * exit:
- * If a mapping is found, *value is set to it, and True is returned.
- * Otherwise False is returned.
- */
-static int
-atoui_sym_process(const char *str, const atoui_sym_t *sym, uint32_t *value)
-{
- size_t cmp_len;
- const char *tail;
-
- while (isspace(*str))
- str++;
-
- tail = str + strlen(str);
- while ((tail > str) && isspace(*(tail - 1)))
- tail--;
-
- cmp_len = tail - str;
-
- for (; sym->sym_name != NULL; sym++) {
- if ((strlen(sym->sym_name) == cmp_len) &&
- (strncasecmp(sym->sym_name, str, cmp_len) == 0)) {
- *value = sym->sym_value;
- return (1);
- }
- }
-
- /* No symbolic mapping was found */
- return (0);
-}
-
-
-/*
- * Convert a string to a numeric value. Strings starting with '0'
+ * Convert a string containing a specific type of ELF constant, or an ASCII
+ * representation of a number, to an integer. Strings starting with '0'
* are taken to be octal, those staring with '0x' are hex, and all
* others are decimal.
*
* entry:
* str - String to be converted
- * sym - NULL, or NULL terminated array of name/value pairs.
+ * ctype - Constant type
* v - Address of variable to receive resulting value.
*
* exit:
* On success, returns True (1) and *v is set to the value.
* On failure, returns False (0) and *v is undefined.
*/
+typedef enum {
+ ATOUI_PT,
+ ATOUI_SHT,
+ ATOUI_OSABI
+} atoui_type_t;
+
static int
-atoui(const char *str, const atoui_sym_t *sym, uint32_t *v)
+atoui(const char *str, atoui_type_t type, uint32_t *v)
{
- char *endptr;
-
- if (sym && atoui_sym_process(str, sym, v))
- return (1);
+ conv_strtol_uvalue_t uvalue;
+ char *endptr;
+
+ if (conv_iter_strtol_init(str, &uvalue) != 0) {
+ switch (type) {
+ case ATOUI_PT:
+ if (conv_iter_phdr_type(CONV_OSABI_ALL, CONV_FMT_ALT_CF,
+ conv_iter_strtol, &uvalue) == CONV_ITER_DONE)
+ break;
+ (void) conv_iter_phdr_type(CONV_OSABI_ALL,
+ CONV_FMT_ALT_NF, conv_iter_strtol, &uvalue);
+ break;
+ case ATOUI_SHT:
+ if (conv_iter_sec_type(CONV_OSABI_ALL, CONV_MACH_ALL,
+ CONV_FMT_ALT_CF, conv_iter_strtol, &uvalue) ==
+ CONV_ITER_DONE)
+ break;
+ (void) conv_iter_sec_type(CONV_OSABI_ALL, CONV_MACH_ALL,
+ CONV_FMT_ALT_NF, conv_iter_strtol, &uvalue);
+ break;
+ case ATOUI_OSABI:
+ if (conv_iter_ehdr_osabi(CONV_FMT_ALT_CF,
+ conv_iter_strtol, &uvalue) == CONV_ITER_DONE)
+ break;
+ (void) conv_iter_ehdr_osabi(CONV_FMT_ALT_NF,
+ conv_iter_strtol, &uvalue);
+ break;
+ }
+ if (uvalue.csl_found) {
+ *v = uvalue.csl_value;
+ return (1);
+ }
+ }
*v = strtoull(str, &endptr, 0);
@@ -547,10 +367,10 @@ atoui(const char *str, const atoui_sym_t *sym, uint32_t *v)
static int
match_prepare(char *argv0, uint_t flags)
{
- atoui_sym_t *sym;
match_rec_t *list;
const char *str;
int minus_p = (flags & FLG_SHOW_PHDR) != 0;
+ atoui_type_t atoui_type;
/*
* Flag ambiguous attempt to use match option with both -p and
@@ -566,10 +386,10 @@ match_prepare(char *argv0, uint_t flags)
/* Set the match type, based on the presence of the -p option */
if (minus_p) {
match_state.item_type = MATCH_ITEM_PT;
- sym = sym_pt;
+ atoui_type = ATOUI_PT;
} else {
match_state.item_type = MATCH_ITEM_SHT;
- sym = sym_sht;
+ atoui_type = ATOUI_SHT;
}
/*
@@ -591,7 +411,7 @@ match_prepare(char *argv0, uint_t flags)
continue;
str = list->value.name;
- if (atoui(str, sym, &list->value.type) == 0) {
+ if (atoui(str, atoui_type, &list->value.type) == 0) {
const char *fmt = minus_p ?
MSG_INTL(MSG_ERR_BAD_T_PT) :
MSG_INTL(MSG_ERR_BAD_T_SHT);
@@ -726,21 +546,21 @@ add_match_record(char *argv0, match_rec_t *data)
static int
decide(const char *file, int fd, Elf *elf, uint_t flags,
- const char *wname, int wfd)
+ const char *wname, int wfd, uchar_t osabi)
{
int r;
if (gelf_getclass(elf) == ELFCLASS64)
- r = regular64(file, fd, elf, flags, wname, wfd);
+ r = regular64(file, fd, elf, flags, wname, wfd, osabi);
else
- r = regular32(file, fd, elf, flags, wname, wfd);
+ r = regular32(file, fd, elf, flags, wname, wfd, osabi);
return (r);
}
static int
archive(const char *file, int fd, Elf *elf, uint_t flags,
- const char *wname, int wfd)
+ const char *wname, int wfd, uchar_t osabi)
{
Elf_Cmd cmd = ELF_C_READ;
Elf_Arhdr *arhdr;
@@ -866,12 +686,12 @@ archive(const char *file, int fd, Elf *elf, uint_t flags,
switch (elf_kind(_elf)) {
case ELF_K_AR:
if (archive(name, fd, _elf, flags,
- wname, wfd) == 1)
+ wname, wfd, osabi) == 1)
return (1);
break;
case ELF_K_ELF:
if (decide(name, fd, _elf, flags,
- wname, wfd) == 1)
+ wname, wfd, osabi) == 1)
return (1);
break;
default:
@@ -897,6 +717,7 @@ main(int argc, char **argv, char **envp)
uint_t flags = 0;
match_rec_t match_data;
int ret;
+ uchar_t osabi;
/*
* If we're on a 64-bit kernel, try to exec a full 64-bit version of
@@ -969,6 +790,26 @@ main(int argc, char **argv, char **envp)
case 'n':
flags |= FLG_SHOW_NOTE;
break;
+ case 'O':
+ {
+ uint32_t val;
+
+ /*
+ * osabi is a uchar_t in the ELF header.
+ * Don't accept any value that exceeds
+ * that range.
+ */
+ if ((atoui(optarg, ATOUI_OSABI, &val) == 0) ||
+ (val > 255)) {
+ (void) fprintf(stderr,
+ MSG_INTL(MSG_ERR_BAD_T_OSABI),
+ basename(argv[0]), optarg);
+ return (1);
+ }
+ osabi = val;
+ }
+ flags |= FLG_CTL_OSABI;
+ break;
case 'P':
flags |= FLG_CTL_FAKESHDR;
break;
@@ -1111,10 +952,10 @@ main(int argc, char **argv, char **envp)
switch (elf_kind(elf)) {
case ELF_K_AR:
- ret = archive(file, fd, elf, flags, wname, wfd);
+ ret = archive(file, fd, elf, flags, wname, wfd, osabi);
break;
case ELF_K_ELF:
- ret = decide(file, fd, elf, flags, wname, wfd);
+ ret = decide(file, fd, elf, flags, wname, wfd, osabi);
break;
default:
(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADFILE), file);
diff --git a/usr/src/cmd/sgs/elfdump/common/struct_layout.h b/usr/src/cmd/sgs/elfdump/common/struct_layout.h
index 3f5db5ebf6..69934f9336 100644
--- a/usr/src/cmd/sgs/elfdump/common/struct_layout.h
+++ b/usr/src/cmd/sgs/elfdump/common/struct_layout.h
@@ -20,15 +20,13 @@
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _STRUCT_LAYOUT_H
#define _STRUCT_LAYOUT_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <conv.h>
#include <_machelf.h>
@@ -108,7 +106,7 @@ typedef union {
/*
* Buffer large enough to format any integral value in a field
*/
-typedef char sl_fmtbuf_t[CONV64_INV_BUFSIZE * 2];
+typedef char sl_fmtbuf_t[CONV_INV_BUFSIZE * 2];
/*
* Types of formatting done by fmt_num()
diff --git a/usr/src/cmd/sgs/elfedit/Makefile.com b/usr/src/cmd/sgs/elfedit/Makefile.com
index 91faa3d040..5321b97146 100644
--- a/usr/src/cmd/sgs/elfedit/Makefile.com
+++ b/usr/src/cmd/sgs/elfedit/Makefile.com
@@ -20,19 +20,15 @@
#
#
-# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
-#
PROG= elfedit
include $(SRC)/cmd/Makefile.cmd
include $(SRC)/cmd/sgs/Makefile.com
-ELFCAP = $(SRC)/common/elfcap
-
COMOBJ = elfedit.o sys.o util.o elfconst.o
COMOBJ32 = elfedit_machelf32.o util_machelf32.o
@@ -41,13 +37,13 @@ COMOBJ64 = elfedit_machelf64.o util_machelf64.o
BLTOBJ = msg.o
-OBJS= $(BLTOBJ) $(COMOBJ) $(COMOBJ32) $(COMOBJ64) elfcap.o
+OBJS= $(BLTOBJ) $(COMOBJ) $(COMOBJ32) $(COMOBJ64)
MAPFILE= ../common/mapfile-vers
CPPFLAGS= -I. -I../common -I../../include -I../../include/$(MACH) \
-I$(SRCBASE)/lib/libc/inc -I$(SRCBASE)/uts/$(ARCH)/sys \
- -I$(ELFCAP) $(CPPFLAGS.master)
+ $(CPPFLAGS.master)
LLDFLAGS = $(VAR_ELFEDIT_LLDFLAGS)
LLDFLAGS64 = $(VAR_ELFEDIT_LLDFLAGS64)
LDFLAGS += $(VERSREF) $(USE_PROTO) -M$(MAPFILE) $(LLDFLAGS)
@@ -70,7 +66,7 @@ SGSMSGFLAGS += -h $(BLTDEFS) -d $(BLTDATA) -m $(BLTMESG) -n elfedit_msg
SRCS = $(COMOBJ:%.o=../common/%.c) \
$(COMOBJ32:%32.o=../common/%.c) \
- $(BLTDATA) $(ELFCAP)/elfcap.c
+ $(BLTDATA)
LINTSRCS = $(SRCS) ../common/lintsup.c
CLEANFILES += $(LINTOUTS) $(BLTFILES)
diff --git a/usr/src/cmd/sgs/elfedit/Makefile.targ b/usr/src/cmd/sgs/elfedit/Makefile.targ
index d18d8b4097..e5efa499c8 100644
--- a/usr/src/cmd/sgs/elfedit/Makefile.targ
+++ b/usr/src/cmd/sgs/elfedit/Makefile.targ
@@ -20,11 +20,9 @@
#
#
-# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
-#
%.o: ../common/%.c
$(COMPILE.c) -o $@ $<
@@ -42,10 +40,6 @@
$(COMPILE.c) -o $@ $<
$(POST_PROCESS_O)
-elfcap.o: $(ELFCAP)/elfcap.c
- $(COMPILE.c) -o $@ $(ELFCAP)/elfcap.c
- $(POST_PROCESS_O)
-
$(PROG): $(OBJS) $(MAPFILE)
$(LINK.c) -o $@ $(OBJS) $(LDLIBS)
diff --git a/usr/src/cmd/sgs/elfedit/common/_elfedit.h b/usr/src/cmd/sgs/elfedit/common/_elfedit.h
index 7de673f9d2..57f7dc1c9e 100644
--- a/usr/src/cmd/sgs/elfedit/common/_elfedit.h
+++ b/usr/src/cmd/sgs/elfedit/common/_elfedit.h
@@ -20,15 +20,13 @@
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef __ELFEDIT_H
#define __ELFEDIT_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <setjmp.h>
#include <libtecla.h>
#include <elfedit.h>
@@ -183,6 +181,8 @@ typedef struct {
} input;
struct { /* ELF file state */
int elfclass; /* ELFCLASS of file being edited */
+ int elfconst_ehdr_change; /* ELF header has changed. */
+ /* Recheck elfconst strs */
/*
* Information for the ELF object being edited.
* The value of elfclass determines which of these
diff --git a/usr/src/cmd/sgs/elfedit/common/elfconst.c b/usr/src/cmd/sgs/elfedit/common/elfconst.c
index bf2edb792d..f449868531 100644
--- a/usr/src/cmd/sgs/elfedit/common/elfconst.c
+++ b/usr/src/cmd/sgs/elfedit/common/elfconst.c
@@ -26,21 +26,9 @@
#include <stdlib.h>
#include <stdio.h>
-#include <unistd.h>
-#include <libintl.h>
-#include <libelf.h>
-#include <sys/machelf.h>
-#include <link.h>
-#include <strings.h>
-#include <ctype.h>
-#include <elfedit.h>
#include <_elfedit.h>
-#include <sys/elf_SPARC.h>
-#include <sys/elf_amd64.h>
-#include <sys/auxv_386.h>
-#include <sys/auxv_SPARC.h>
+#include <conv.h>
#include <msg.h>
-#include <elfcap.h>
@@ -91,156 +79,7 @@ static elfedit_atoui_sym_t sym_bool[] = {
};
/*
- * ELF section indexes with support for the special index names.
- */
-static elfedit_atoui_sym_t sym_shn[] = {
- { MSG_ORIG(MSG_SHN_UNDEF), SHN_UNDEF },
- { MSG_ORIG(MSG_SHN_UNDEF_ALT1), SHN_UNDEF },
-
- { MSG_ORIG(MSG_SHN_SUNW_IGNORE), SHN_SUNW_IGNORE },
- { MSG_ORIG(MSG_SHN_SUNW_IGNORE_ALT1), SHN_SUNW_IGNORE },
-
- { MSG_ORIG(MSG_SHN_BEFORE), SHN_BEFORE },
- { MSG_ORIG(MSG_SHN_BEFORE_ALT1), SHN_BEFORE },
-
- { MSG_ORIG(MSG_SHN_AFTER), SHN_AFTER },
- { MSG_ORIG(MSG_SHN_AFTER_ALT1), SHN_AFTER },
-
- { MSG_ORIG(MSG_SHN_AMD64_LCOMMON), SHN_AMD64_LCOMMON },
- { MSG_ORIG(MSG_SHN_AMD64_LCOMMON_ALT1), SHN_AMD64_LCOMMON },
-
- { MSG_ORIG(MSG_SHN_ABS), SHN_ABS },
- { MSG_ORIG(MSG_SHN_ABS_ALT1), SHN_ABS },
-
- { MSG_ORIG(MSG_SHN_COMMON), SHN_COMMON },
- { MSG_ORIG(MSG_SHN_COMMON_ALT1), SHN_COMMON },
-
- { MSG_ORIG(MSG_SHN_XINDEX), SHN_XINDEX },
- { MSG_ORIG(MSG_SHN_XINDEX_ALT1), SHN_XINDEX },
-
- { NULL }
-};
-
-/*
- * ELF section types.
- */
-static elfedit_atoui_sym_t sym_sht[] = {
- { MSG_ORIG(MSG_SHT_NULL), SHT_NULL },
- { MSG_ORIG(MSG_SHT_NULL_ALT1), SHT_NULL },
-
- { MSG_ORIG(MSG_SHT_PROGBITS), SHT_PROGBITS },
- { MSG_ORIG(MSG_SHT_PROGBITS_ALT1), SHT_PROGBITS },
-
- { MSG_ORIG(MSG_SHT_SYMTAB), SHT_SYMTAB },
- { MSG_ORIG(MSG_SHT_SYMTAB_ALT1), SHT_SYMTAB },
-
- { MSG_ORIG(MSG_SHT_STRTAB), SHT_STRTAB },
- { MSG_ORIG(MSG_SHT_STRTAB_ALT1), SHT_STRTAB },
-
- { MSG_ORIG(MSG_SHT_RELA), SHT_RELA },
- { MSG_ORIG(MSG_SHT_RELA_ALT1), SHT_RELA },
-
- { MSG_ORIG(MSG_SHT_HASH), SHT_HASH },
- { MSG_ORIG(MSG_SHT_HASH_ALT1), SHT_HASH },
-
- { MSG_ORIG(MSG_SHT_DYNAMIC), SHT_DYNAMIC },
- { MSG_ORIG(MSG_SHT_DYNAMIC_ALT1), SHT_DYNAMIC },
-
- { MSG_ORIG(MSG_SHT_NOTE), SHT_NOTE },
- { MSG_ORIG(MSG_SHT_NOTE_ALT1), SHT_NOTE },
-
- { MSG_ORIG(MSG_SHT_NOBITS), SHT_NOBITS },
- { MSG_ORIG(MSG_SHT_NOBITS_ALT1), SHT_NOBITS },
-
- { MSG_ORIG(MSG_SHT_REL), SHT_REL },
- { MSG_ORIG(MSG_SHT_REL_ALT1), SHT_REL },
-
- { MSG_ORIG(MSG_SHT_SHLIB), SHT_SHLIB },
- { MSG_ORIG(MSG_SHT_SHLIB_ALT1), SHT_SHLIB },
-
- { MSG_ORIG(MSG_SHT_DYNSYM), SHT_DYNSYM },
- { MSG_ORIG(MSG_SHT_DYNSYM_ALT1), SHT_DYNSYM },
-
- { MSG_ORIG(MSG_SHT_INIT_ARRAY), SHT_INIT_ARRAY },
- { MSG_ORIG(MSG_SHT_INIT_ARRAY_ALT1), SHT_INIT_ARRAY },
-
- { MSG_ORIG(MSG_SHT_FINI_ARRAY), SHT_FINI_ARRAY },
- { MSG_ORIG(MSG_SHT_FINI_ARRAY_ALT1), SHT_FINI_ARRAY },
-
- { MSG_ORIG(MSG_SHT_PREINIT_ARRAY), SHT_PREINIT_ARRAY },
- { MSG_ORIG(MSG_SHT_PREINIT_ARRAY_ALT1), SHT_PREINIT_ARRAY },
-
- { MSG_ORIG(MSG_SHT_GROUP), SHT_GROUP },
- { MSG_ORIG(MSG_SHT_GROUP_ALT1), SHT_GROUP },
-
- { MSG_ORIG(MSG_SHT_SYMTAB_SHNDX), SHT_SYMTAB_SHNDX },
- { MSG_ORIG(MSG_SHT_SYMTAB_SHNDX_ALT1), SHT_SYMTAB_SHNDX },
-
- { MSG_ORIG(MSG_SHT_SUNW_SYMSORT), SHT_SUNW_symsort },
- { MSG_ORIG(MSG_SHT_SUNW_SYMSORT_ALT1), SHT_SUNW_symsort },
-
- { MSG_ORIG(MSG_SHT_SUNW_TLSSORT), SHT_SUNW_tlssort },
- { MSG_ORIG(MSG_SHT_SUNW_TLSSORT_ALT1), SHT_SUNW_tlssort },
-
- { MSG_ORIG(MSG_SHT_SUNW_LDYNSYM), SHT_SUNW_LDYNSYM },
- { MSG_ORIG(MSG_SHT_SUNW_LDYNSYM_ALT1), SHT_SUNW_LDYNSYM },
-
- { MSG_ORIG(MSG_SHT_SUNW_DOF), SHT_SUNW_dof },
- { MSG_ORIG(MSG_SHT_SUNW_DOF_ALT1), SHT_SUNW_dof },
-
- { MSG_ORIG(MSG_SHT_SUNW_CAP), SHT_SUNW_cap },
- { MSG_ORIG(MSG_SHT_SUNW_CAP_ALT1), SHT_SUNW_cap },
-
- { MSG_ORIG(MSG_SHT_SUNW_SIGNATURE), SHT_SUNW_SIGNATURE },
- { MSG_ORIG(MSG_SHT_SUNW_SIGNATURE_ALT1), SHT_SUNW_SIGNATURE },
-
- { MSG_ORIG(MSG_SHT_SUNW_ANNOTATE), SHT_SUNW_ANNOTATE },
- { MSG_ORIG(MSG_SHT_SUNW_ANNOTATE_ALT1), SHT_SUNW_ANNOTATE },
-
- { MSG_ORIG(MSG_SHT_SUNW_DEBUGSTR), SHT_SUNW_DEBUGSTR },
- { MSG_ORIG(MSG_SHT_SUNW_DEBUGSTR_ALT1), SHT_SUNW_DEBUGSTR },
-
- { MSG_ORIG(MSG_SHT_SUNW_DEBUG), SHT_SUNW_DEBUG },
- { MSG_ORIG(MSG_SHT_SUNW_DEBUG_ALT1), SHT_SUNW_DEBUG },
-
- { MSG_ORIG(MSG_SHT_SUNW_MOVE), SHT_SUNW_move },
- { MSG_ORIG(MSG_SHT_SUNW_MOVE_ALT1), SHT_SUNW_move },
-
- { MSG_ORIG(MSG_SHT_SUNW_COMDAT), SHT_SUNW_COMDAT },
- { MSG_ORIG(MSG_SHT_SUNW_COMDAT_ALT1), SHT_SUNW_COMDAT },
-
- { MSG_ORIG(MSG_SHT_SUNW_SYMINFO), SHT_SUNW_syminfo },
- { MSG_ORIG(MSG_SHT_SUNW_SYMINFO_ALT1), SHT_SUNW_syminfo },
-
- { MSG_ORIG(MSG_SHT_SUNW_VERDEF), SHT_SUNW_verdef },
- { MSG_ORIG(MSG_SHT_SUNW_VERDEF_ALT1), SHT_SUNW_verdef },
-
- { MSG_ORIG(MSG_SHT_GNU_VERDEF), SHT_GNU_verdef },
- { MSG_ORIG(MSG_SHT_GNU_VERDEF_ALT1), SHT_GNU_verdef },
-
- { MSG_ORIG(MSG_SHT_SUNW_VERNEED), SHT_SUNW_verneed },
- { MSG_ORIG(MSG_SHT_SUNW_VERNEED_ALT1), SHT_SUNW_verneed },
-
- { MSG_ORIG(MSG_SHT_GNU_VERNEED), SHT_GNU_verneed },
- { MSG_ORIG(MSG_SHT_GNU_VERNEED_ALT1), SHT_GNU_verneed },
-
- { MSG_ORIG(MSG_SHT_SUNW_VERSYM), SHT_SUNW_versym },
- { MSG_ORIG(MSG_SHT_SUNW_VERSYM_ALT1), SHT_SUNW_versym },
-
- { MSG_ORIG(MSG_SHT_GNU_VERSYM), SHT_GNU_versym },
- { MSG_ORIG(MSG_SHT_GNU_VERSYM_ALT1), SHT_GNU_versym },
-
- { MSG_ORIG(MSG_SHT_SPARC_GOTDATA), SHT_SPARC_GOTDATA },
- { MSG_ORIG(MSG_SHT_SPARC_GOTDATA_ALT1), SHT_SPARC_GOTDATA },
-
- { MSG_ORIG(MSG_SHT_AMD64_UNWIND), SHT_AMD64_UNWIND },
- { MSG_ORIG(MSG_SHT_AMD64_UNWIND_ALT1), SHT_AMD64_UNWIND },
-
- { NULL }
-};
-
-/*
- * ELF section types.
+ * ELF strings for SHT_STRTAB
*/
static elfedit_atoui_sym_t sym_sht_strtab[] = {
{ MSG_ORIG(MSG_SHT_STRTAB), SHT_STRTAB },
@@ -251,23 +90,7 @@ static elfedit_atoui_sym_t sym_sht_strtab[] = {
/*
- * ELF section types for symbol tables
- */
-static elfedit_atoui_sym_t sym_sht_allsymtab[] = {
- { MSG_ORIG(MSG_SHT_SYMTAB), SHT_SYMTAB },
- { MSG_ORIG(MSG_SHT_SYMTAB_ALT1), SHT_SYMTAB },
-
- { MSG_ORIG(MSG_SHT_DYNSYM), SHT_DYNSYM },
- { MSG_ORIG(MSG_SHT_DYNSYM_ALT1), SHT_DYNSYM },
-
- { MSG_ORIG(MSG_SHT_SUNW_LDYNSYM), SHT_SUNW_LDYNSYM },
- { MSG_ORIG(MSG_SHT_SUNW_LDYNSYM_ALT1), SHT_SUNW_LDYNSYM },
-
- { NULL }
-};
-
-/*
- * ELF section types for SHT_SYMTAB
+ * Strings for SHT_SYMTAB
*/
static elfedit_atoui_sym_t sym_sht_symtab[] = {
{ MSG_ORIG(MSG_SHT_SYMTAB), SHT_SYMTAB },
@@ -277,7 +100,7 @@ static elfedit_atoui_sym_t sym_sht_symtab[] = {
};
/*
- * ELF section types for SHT_SYMTAB
+ * Strings for SHT_DYNSYM
*/
static elfedit_atoui_sym_t sym_sht_dynsym[] = {
{ MSG_ORIG(MSG_SHT_DYNSYM), SHT_DYNSYM },
@@ -287,7 +110,7 @@ static elfedit_atoui_sym_t sym_sht_dynsym[] = {
};
/*
- * ELF section types for SHT_SUNW_LDYNSYM
+ * Strings for SHT_SUNW_LDYNSYM
*/
static elfedit_atoui_sym_t sym_sht_ldynsym[] = {
{ MSG_ORIG(MSG_SHT_SUNW_LDYNSYM), SHT_SUNW_LDYNSYM },
@@ -296,1178 +119,370 @@ static elfedit_atoui_sym_t sym_sht_ldynsym[] = {
{ NULL }
};
-/*
- * ELF dynamic tag DT_ values
- */
-static elfedit_atoui_sym_t sym_dt[] = {
- { MSG_ORIG(MSG_DT_NULL), DT_NULL },
- { MSG_ORIG(MSG_DT_NULL_ALT1), DT_NULL },
-
- { MSG_ORIG(MSG_DT_NEEDED), DT_NEEDED },
- { MSG_ORIG(MSG_DT_NEEDED_ALT1), DT_NEEDED },
-
- { MSG_ORIG(MSG_DT_PLTRELSZ), DT_PLTRELSZ },
- { MSG_ORIG(MSG_DT_PLTRELSZ_ALT1), DT_PLTRELSZ },
-
- { MSG_ORIG(MSG_DT_PLTGOT), DT_PLTGOT },
- { MSG_ORIG(MSG_DT_PLTGOT_ALT1), DT_PLTGOT },
-
- { MSG_ORIG(MSG_DT_HASH), DT_HASH },
- { MSG_ORIG(MSG_DT_HASH_ALT1), DT_HASH },
-
- { MSG_ORIG(MSG_DT_STRTAB), DT_STRTAB },
- { MSG_ORIG(MSG_DT_STRTAB_ALT1), DT_STRTAB },
-
- { MSG_ORIG(MSG_DT_SYMTAB), DT_SYMTAB },
- { MSG_ORIG(MSG_DT_SYMTAB_ALT1), DT_SYMTAB },
-
- { MSG_ORIG(MSG_DT_RELA), DT_RELA },
- { MSG_ORIG(MSG_DT_RELA_ALT1), DT_RELA },
-
- { MSG_ORIG(MSG_DT_RELASZ), DT_RELASZ },
- { MSG_ORIG(MSG_DT_RELASZ_ALT1), DT_RELASZ },
-
- { MSG_ORIG(MSG_DT_RELAENT), DT_RELAENT },
- { MSG_ORIG(MSG_DT_RELAENT_ALT1), DT_RELAENT },
-
- { MSG_ORIG(MSG_DT_STRSZ), DT_STRSZ },
- { MSG_ORIG(MSG_DT_STRSZ_ALT1), DT_STRSZ },
-
- { MSG_ORIG(MSG_DT_SYMENT), DT_SYMENT },
- { MSG_ORIG(MSG_DT_SYMENT_ALT1), DT_SYMENT },
-
- { MSG_ORIG(MSG_DT_INIT), DT_INIT },
- { MSG_ORIG(MSG_DT_INIT_ALT1), DT_INIT },
-
- { MSG_ORIG(MSG_DT_FINI), DT_FINI },
- { MSG_ORIG(MSG_DT_FINI_ALT1), DT_FINI },
-
- { MSG_ORIG(MSG_DT_SONAME), DT_SONAME },
- { MSG_ORIG(MSG_DT_SONAME_ALT1), DT_SONAME },
-
- { MSG_ORIG(MSG_DT_RPATH), DT_RPATH },
- { MSG_ORIG(MSG_DT_RPATH_ALT1), DT_RPATH },
-
- { MSG_ORIG(MSG_DT_SYMBOLIC), DT_SYMBOLIC },
- { MSG_ORIG(MSG_DT_SYMBOLIC_ALT1), DT_SYMBOLIC },
-
- { MSG_ORIG(MSG_DT_REL), DT_REL },
- { MSG_ORIG(MSG_DT_REL_ALT1), DT_REL },
-
- { MSG_ORIG(MSG_DT_RELSZ), DT_RELSZ },
- { MSG_ORIG(MSG_DT_RELSZ_ALT1), DT_RELSZ },
-
- { MSG_ORIG(MSG_DT_RELENT), DT_RELENT },
- { MSG_ORIG(MSG_DT_RELENT_ALT1), DT_RELENT },
-
- { MSG_ORIG(MSG_DT_PLTREL), DT_PLTREL },
- { MSG_ORIG(MSG_DT_PLTREL_ALT1), DT_PLTREL },
-
- { MSG_ORIG(MSG_DT_DEBUG), DT_DEBUG },
- { MSG_ORIG(MSG_DT_DEBUG_ALT1), DT_DEBUG },
-
- { MSG_ORIG(MSG_DT_TEXTREL), DT_TEXTREL },
- { MSG_ORIG(MSG_DT_TEXTREL_ALT1), DT_TEXTREL },
-
- { MSG_ORIG(MSG_DT_JMPREL), DT_JMPREL },
- { MSG_ORIG(MSG_DT_JMPREL_ALT1), DT_JMPREL },
-
- { MSG_ORIG(MSG_DT_BIND_NOW), DT_BIND_NOW },
- { MSG_ORIG(MSG_DT_BIND_NOW_ALT1), DT_BIND_NOW },
-
- { MSG_ORIG(MSG_DT_INIT_ARRAY), DT_INIT_ARRAY },
- { MSG_ORIG(MSG_DT_INIT_ARRAY_ALT1), DT_INIT_ARRAY },
-
- { MSG_ORIG(MSG_DT_FINI_ARRAY), DT_FINI_ARRAY },
- { MSG_ORIG(MSG_DT_FINI_ARRAY_ALT1), DT_FINI_ARRAY },
-
- { MSG_ORIG(MSG_DT_INIT_ARRAYSZ), DT_INIT_ARRAYSZ },
- { MSG_ORIG(MSG_DT_INIT_ARRAYSZ_ALT1), DT_INIT_ARRAYSZ },
-
- { MSG_ORIG(MSG_DT_FINI_ARRAYSZ), DT_FINI_ARRAYSZ },
- { MSG_ORIG(MSG_DT_FINI_ARRAYSZ_ALT1), DT_FINI_ARRAYSZ },
-
- { MSG_ORIG(MSG_DT_RUNPATH), DT_RUNPATH },
- { MSG_ORIG(MSG_DT_RUNPATH_ALT1), DT_RUNPATH },
-
- { MSG_ORIG(MSG_DT_FLAGS), DT_FLAGS },
- { MSG_ORIG(MSG_DT_FLAGS_ALT1), DT_FLAGS },
-
- { MSG_ORIG(MSG_DT_PREINIT_ARRAY), DT_PREINIT_ARRAY },
- { MSG_ORIG(MSG_DT_PREINIT_ARRAY_ALT1), DT_PREINIT_ARRAY },
-
- { MSG_ORIG(MSG_DT_PREINIT_ARRAYSZ), DT_PREINIT_ARRAYSZ },
- { MSG_ORIG(MSG_DT_PREINIT_ARRAYSZ_ALT1), DT_PREINIT_ARRAYSZ },
-
- { MSG_ORIG(MSG_DT_SUNW_AUXILIARY), DT_SUNW_AUXILIARY },
- { MSG_ORIG(MSG_DT_SUNW_AUXILIARY_ALT1), DT_SUNW_AUXILIARY },
-
- { MSG_ORIG(MSG_DT_SUNW_RTLDINF), DT_SUNW_RTLDINF },
- { MSG_ORIG(MSG_DT_SUNW_RTLDINF_ALT1), DT_SUNW_RTLDINF },
-
- { MSG_ORIG(MSG_DT_SUNW_FILTER), DT_SUNW_FILTER },
- { MSG_ORIG(MSG_DT_SUNW_FILTER_ALT1), DT_SUNW_FILTER },
-
- { MSG_ORIG(MSG_DT_SUNW_CAP), DT_SUNW_CAP },
- { MSG_ORIG(MSG_DT_SUNW_CAP_ALT1), DT_SUNW_CAP },
-
- { MSG_ORIG(MSG_DT_SUNW_SYMTAB), DT_SUNW_SYMTAB },
- { MSG_ORIG(MSG_DT_SUNW_SYMTAB_ALT1), DT_SUNW_SYMTAB },
-
- { MSG_ORIG(MSG_DT_SUNW_SYMSZ), DT_SUNW_SYMSZ },
- { MSG_ORIG(MSG_DT_SUNW_SYMSZ_ALT1), DT_SUNW_SYMSZ },
-
- { MSG_ORIG(MSG_DT_SUNW_SORTENT), DT_SUNW_SORTENT },
- { MSG_ORIG(MSG_DT_SUNW_SORTENT_ALT1), DT_SUNW_SORTENT },
-
- { MSG_ORIG(MSG_DT_SUNW_SYMSORT), DT_SUNW_SYMSORT },
- { MSG_ORIG(MSG_DT_SUNW_SYMSORT_ALT1), DT_SUNW_SYMSORT },
-
- { MSG_ORIG(MSG_DT_SUNW_SYMSORTSZ), DT_SUNW_SYMSORTSZ },
- { MSG_ORIG(MSG_DT_SUNW_SYMSORTSZ_ALT1), DT_SUNW_SYMSORTSZ },
-
- { MSG_ORIG(MSG_DT_SUNW_TLSSORT), DT_SUNW_TLSSORT },
- { MSG_ORIG(MSG_DT_SUNW_TLSSORT_ALT1), DT_SUNW_TLSSORT },
-
- { MSG_ORIG(MSG_DT_SUNW_TLSSORTSZ), DT_SUNW_TLSSORTSZ },
- { MSG_ORIG(MSG_DT_SUNW_TLSSORTSZ_ALT1), DT_SUNW_TLSSORTSZ },
-
- { MSG_ORIG(MSG_DT_SUNW_STRPAD), DT_SUNW_STRPAD },
- { MSG_ORIG(MSG_DT_SUNW_STRPAD_ALT1), DT_SUNW_STRPAD },
-
- { MSG_ORIG(MSG_DT_SUNW_LDMACH), DT_SUNW_LDMACH },
- { MSG_ORIG(MSG_DT_SUNW_LDMACH_ALT1), DT_SUNW_LDMACH },
-
- { MSG_ORIG(MSG_DT_SPARC_REGISTER), DT_SPARC_REGISTER },
- { MSG_ORIG(MSG_DT_SPARC_REGISTER_ALT1), DT_SPARC_REGISTER },
-
- { MSG_ORIG(MSG_DT_DEPRECATED_SPARC_REGISTER),
- DT_DEPRECATED_SPARC_REGISTER },
- { MSG_ORIG(MSG_DT_DEPRECATED_SPARC_REGISTER_ALT1),
- DT_DEPRECATED_SPARC_REGISTER },
-
- { MSG_ORIG(MSG_DT_CHECKSUM), DT_CHECKSUM },
- { MSG_ORIG(MSG_DT_CHECKSUM_ALT1), DT_CHECKSUM },
-
- { MSG_ORIG(MSG_DT_PLTPADSZ), DT_PLTPADSZ },
- { MSG_ORIG(MSG_DT_PLTPADSZ_ALT1), DT_PLTPADSZ },
-
- { MSG_ORIG(MSG_DT_MOVEENT), DT_MOVEENT },
- { MSG_ORIG(MSG_DT_MOVEENT_ALT1), DT_MOVEENT },
-
- { MSG_ORIG(MSG_DT_MOVESZ), DT_MOVESZ },
- { MSG_ORIG(MSG_DT_MOVESZ_ALT1), DT_MOVESZ },
-
- { MSG_ORIG(MSG_DT_FEATURE_1), DT_FEATURE_1 },
- { MSG_ORIG(MSG_DT_FEATURE_1_ALT1), DT_FEATURE_1 },
-
- { MSG_ORIG(MSG_DT_POSFLAG_1), DT_POSFLAG_1 },
- { MSG_ORIG(MSG_DT_POSFLAG_1_ALT1), DT_POSFLAG_1 },
-
- { MSG_ORIG(MSG_DT_SYMINSZ), DT_SYMINSZ },
- { MSG_ORIG(MSG_DT_SYMINSZ_ALT1), DT_SYMINSZ },
-
- { MSG_ORIG(MSG_DT_SYMINENT), DT_SYMINENT },
- { MSG_ORIG(MSG_DT_SYMINENT_ALT1), DT_SYMINENT },
-
- { MSG_ORIG(MSG_DT_CONFIG), DT_CONFIG },
- { MSG_ORIG(MSG_DT_CONFIG_ALT1), DT_CONFIG },
-
- { MSG_ORIG(MSG_DT_DEPAUDIT), DT_DEPAUDIT },
- { MSG_ORIG(MSG_DT_DEPAUDIT_ALT1), DT_DEPAUDIT },
-
- { MSG_ORIG(MSG_DT_AUDIT), DT_AUDIT },
- { MSG_ORIG(MSG_DT_AUDIT_ALT1), DT_AUDIT },
-
- { MSG_ORIG(MSG_DT_PLTPAD), DT_PLTPAD },
- { MSG_ORIG(MSG_DT_PLTPAD_ALT1), DT_PLTPAD },
-
- { MSG_ORIG(MSG_DT_MOVETAB), DT_MOVETAB },
- { MSG_ORIG(MSG_DT_MOVETAB_ALT1), DT_MOVETAB },
-
- { MSG_ORIG(MSG_DT_SYMINFO), DT_SYMINFO },
- { MSG_ORIG(MSG_DT_SYMINFO_ALT1), DT_SYMINFO },
-
- { MSG_ORIG(MSG_DT_VERSYM), DT_VERSYM },
- { MSG_ORIG(MSG_DT_VERSYM_ALT1), DT_VERSYM },
-
- { MSG_ORIG(MSG_DT_RELACOUNT), DT_RELACOUNT },
- { MSG_ORIG(MSG_DT_RELACOUNT_ALT1), DT_RELACOUNT },
-
- { MSG_ORIG(MSG_DT_RELCOUNT), DT_RELCOUNT },
- { MSG_ORIG(MSG_DT_RELCOUNT_ALT1), DT_RELCOUNT },
-
- { MSG_ORIG(MSG_DT_FLAGS_1), DT_FLAGS_1 },
- { MSG_ORIG(MSG_DT_FLAGS_1_ALT1), DT_FLAGS_1 },
-
- { MSG_ORIG(MSG_DT_VERDEF), DT_VERDEF },
- { MSG_ORIG(MSG_DT_VERDEF_ALT1), DT_VERDEF },
-
- { MSG_ORIG(MSG_DT_VERDEFNUM), DT_VERDEFNUM },
- { MSG_ORIG(MSG_DT_VERDEFNUM_ALT1), DT_VERDEFNUM },
-
- { MSG_ORIG(MSG_DT_VERNEED), DT_VERNEED },
- { MSG_ORIG(MSG_DT_VERNEED_ALT1), DT_VERNEED },
-
- { MSG_ORIG(MSG_DT_VERNEEDNUM), DT_VERNEEDNUM },
- { MSG_ORIG(MSG_DT_VERNEEDNUM_ALT1), DT_VERNEEDNUM },
-
- { MSG_ORIG(MSG_DT_AUXILIARY), DT_AUXILIARY },
- { MSG_ORIG(MSG_DT_AUXILIARY_ALT1), DT_AUXILIARY },
-
- { MSG_ORIG(MSG_DT_USED), DT_USED },
- { MSG_ORIG(MSG_DT_USED_ALT1), DT_USED },
-
- { MSG_ORIG(MSG_DT_FILTER), DT_FILTER },
- { MSG_ORIG(MSG_DT_FILTER_ALT1), DT_FILTER },
-
- { NULL }
-};
-
-
-/*
- * ELF DT_FLAGS DF_* values
- */
-static elfedit_atoui_sym_t sym_df[] = {
- { MSG_ORIG(MSG_DF_ORIGIN), DF_ORIGIN },
- { MSG_ORIG(MSG_DF_ORIGIN_ALT1), DF_ORIGIN },
-
- { MSG_ORIG(MSG_DF_SYMBOLIC), DF_SYMBOLIC },
- { MSG_ORIG(MSG_DF_SYMBOLIC_ALT1), DF_SYMBOLIC },
-
- { MSG_ORIG(MSG_DF_TEXTREL), DF_TEXTREL },
- { MSG_ORIG(MSG_DF_TEXTREL_ALT1), DF_TEXTREL },
-
- { MSG_ORIG(MSG_DF_BIND_NOW), DF_BIND_NOW },
- { MSG_ORIG(MSG_DF_BIND_NOW_ALT1), DF_BIND_NOW },
-
- { MSG_ORIG(MSG_DF_STATIC_TLS), DF_STATIC_TLS },
- { MSG_ORIG(MSG_DF_STATIC_TLS_ALT1), DF_STATIC_TLS },
-
- { NULL }
-};
-
-
-/*
- * ELF DT_POSFLAG_1 DF_P1_* values
- */
-static elfedit_atoui_sym_t sym_df_p1[] = {
- { MSG_ORIG(MSG_DF_P1_LAZYLOAD), DF_P1_LAZYLOAD },
- { MSG_ORIG(MSG_DF_P1_LAZYLOAD_ALT1), DF_P1_LAZYLOAD },
-
- { MSG_ORIG(MSG_DF_P1_GROUPPERM), DF_P1_GROUPPERM },
- { MSG_ORIG(MSG_DF_P1_GROUPPERM_ALT1), DF_P1_GROUPPERM },
-
- { NULL }
-};
-
-
-/*
- * ELF DT_FLAGS_1 DF_1_* values
- */
-static elfedit_atoui_sym_t sym_df_1[] = {
- { MSG_ORIG(MSG_DF_1_NOW), DF_1_NOW },
- { MSG_ORIG(MSG_DF_1_NOW_ALT1), DF_1_NOW },
-
- { MSG_ORIG(MSG_DF_1_GLOBAL), DF_1_GLOBAL },
- { MSG_ORIG(MSG_DF_1_GLOBAL_ALT1), DF_1_GLOBAL },
-
- { MSG_ORIG(MSG_DF_1_GROUP), DF_1_GROUP },
- { MSG_ORIG(MSG_DF_1_GROUP_ALT1), DF_1_GROUP },
-
- { MSG_ORIG(MSG_DF_1_NODELETE), DF_1_NODELETE },
- { MSG_ORIG(MSG_DF_1_NODELETE_ALT1), DF_1_NODELETE },
-
- { MSG_ORIG(MSG_DF_1_LOADFLTR), DF_1_LOADFLTR },
- { MSG_ORIG(MSG_DF_1_LOADFLTR_ALT1), DF_1_LOADFLTR },
-
- { MSG_ORIG(MSG_DF_1_INITFIRST), DF_1_INITFIRST },
- { MSG_ORIG(MSG_DF_1_INITFIRST_ALT1), DF_1_INITFIRST },
-
- { MSG_ORIG(MSG_DF_1_NOOPEN), DF_1_NOOPEN },
- { MSG_ORIG(MSG_DF_1_NOOPEN_ALT1), DF_1_NOOPEN },
-
- { MSG_ORIG(MSG_DF_1_ORIGIN), DF_1_ORIGIN },
- { MSG_ORIG(MSG_DF_1_ORIGIN_ALT1), DF_1_ORIGIN },
-
- { MSG_ORIG(MSG_DF_1_DIRECT), DF_1_DIRECT },
- { MSG_ORIG(MSG_DF_1_DIRECT_ALT1), DF_1_DIRECT },
-
- { MSG_ORIG(MSG_DF_1_TRANS), DF_1_TRANS },
- { MSG_ORIG(MSG_DF_1_TRANS_ALT1), DF_1_TRANS },
-
- { MSG_ORIG(MSG_DF_1_INTERPOSE), DF_1_INTERPOSE },
- { MSG_ORIG(MSG_DF_1_INTERPOSE_ALT1), DF_1_INTERPOSE },
-
- { MSG_ORIG(MSG_DF_1_NODEFLIB), DF_1_NODEFLIB },
- { MSG_ORIG(MSG_DF_1_NODEFLIB_ALT1), DF_1_NODEFLIB },
-
- { MSG_ORIG(MSG_DF_1_NODUMP), DF_1_NODUMP },
- { MSG_ORIG(MSG_DF_1_NODUMP_ALT1), DF_1_NODUMP },
-
- { MSG_ORIG(MSG_DF_1_CONFALT), DF_1_CONFALT },
- { MSG_ORIG(MSG_DF_1_CONFALT_ALT1), DF_1_CONFALT },
-
- { MSG_ORIG(MSG_DF_1_ENDFILTEE), DF_1_ENDFILTEE },
- { MSG_ORIG(MSG_DF_1_ENDFILTEE_ALT1), DF_1_ENDFILTEE },
-
- { MSG_ORIG(MSG_DF_1_DISPRELDNE), DF_1_DISPRELDNE },
- { MSG_ORIG(MSG_DF_1_DISPRELDNE_ALT1), DF_1_DISPRELDNE },
-
- { MSG_ORIG(MSG_DF_1_DISPRELPND), DF_1_DISPRELPND },
- { MSG_ORIG(MSG_DF_1_DISPRELPND_ALT1), DF_1_DISPRELPND },
-
- { MSG_ORIG(MSG_DF_1_NODIRECT), DF_1_NODIRECT },
- { MSG_ORIG(MSG_DF_1_NODIRECT_ALT1), DF_1_NODIRECT },
-
- { MSG_ORIG(MSG_DF_1_IGNMULDEF), DF_1_IGNMULDEF },
- { MSG_ORIG(MSG_DF_1_IGNMULDEF_ALT1), DF_1_IGNMULDEF },
-
- { MSG_ORIG(MSG_DF_1_NOKSYMS), DF_1_NOKSYMS },
- { MSG_ORIG(MSG_DF_1_NOKSYMS_ALT1), DF_1_NOKSYMS },
-
- { MSG_ORIG(MSG_DF_1_NOHDR), DF_1_NOHDR },
- { MSG_ORIG(MSG_DF_1_NOHDR_ALT1), DF_1_NOHDR },
-
- { MSG_ORIG(MSG_DF_1_EDITED), DF_1_EDITED },
- { MSG_ORIG(MSG_DF_1_EDITED_ALT1), DF_1_EDITED },
-
- { MSG_ORIG(MSG_DF_1_NORELOC), DF_1_NORELOC },
- { MSG_ORIG(MSG_DF_1_NORELOC_ALT1), DF_1_NORELOC },
-
- { MSG_ORIG(MSG_DF_1_SYMINTPOSE), DF_1_SYMINTPOSE },
- { MSG_ORIG(MSG_DF_1_SYMINTPOSE_ALT1), DF_1_SYMINTPOSE },
-
- { MSG_ORIG(MSG_DF_1_GLOBAUDIT), DF_1_GLOBAUDIT },
- { MSG_ORIG(MSG_DF_1_GLOBAUDIT_ALT1), DF_1_GLOBAUDIT },
-
- { NULL }
-};
/*
- * ELF DT_FEATURE_1 DTF_1_* values
+ * Types of items found in sym_table[]. All items other than STE_STATIC
+ * pulls strings from libconv, differing in the interface required by
+ * the libconv iteration function used.
*/
-static elfedit_atoui_sym_t sym_dtf_1[] = {
- { MSG_ORIG(MSG_DTF_1_PARINIT), DTF_1_PARINIT },
- { MSG_ORIG(MSG_DTF_1_PARINIT_ALT1), DTF_1_PARINIT },
-
- { MSG_ORIG(MSG_DTF_1_CONFEXP), DTF_1_CONFEXP },
- { MSG_ORIG(MSG_DTF_1_CONFEXP_ALT1), DTF_1_CONFEXP },
-
- { NULL }
-};
+typedef enum {
+ STE_STATIC = 0, /* Constants are statically defined */
+ STE_LC = 1, /* Libconv, pull once */
+ STE_LC_OS = 2, /* From libconv, osabi dependency */
+ STE_LC_MACH = 3, /* From libconv, mach dependency */
+ STE_LC_OS_MACH = 4 /* From libconv, osabi/mach dep. */
+} ste_type_t;
/*
- * ELF header EI_* indexes
+ * Interface of functions called to fill strings from libconv
*/
-static elfedit_atoui_sym_t sym_ei[] = {
- { MSG_ORIG(MSG_EI_MAG0), EI_MAG0 },
- { MSG_ORIG(MSG_EI_MAG0_ALT1), EI_MAG0 },
-
- { MSG_ORIG(MSG_EI_MAG1), EI_MAG1 },
- { MSG_ORIG(MSG_EI_MAG1_ALT1), EI_MAG1 },
-
- { MSG_ORIG(MSG_EI_MAG2), EI_MAG2 },
- { MSG_ORIG(MSG_EI_MAG2_ALT1), EI_MAG2 },
-
- { MSG_ORIG(MSG_EI_MAG3), EI_MAG3 },
- { MSG_ORIG(MSG_EI_MAG3_ALT1), EI_MAG3 },
-
- { MSG_ORIG(MSG_EI_CLASS), EI_CLASS },
- { MSG_ORIG(MSG_EI_CLASS_ALT1), EI_CLASS },
-
- { MSG_ORIG(MSG_EI_DATA), EI_DATA },
- { MSG_ORIG(MSG_EI_DATA_ALT1), EI_DATA },
-
- { MSG_ORIG(MSG_EI_VERSION), EI_VERSION },
- { MSG_ORIG(MSG_EI_VERSION_ALT1), EI_VERSION },
-
- { MSG_ORIG(MSG_EI_OSABI), EI_OSABI },
- { MSG_ORIG(MSG_EI_OSABI_ALT1), EI_OSABI },
-
- { MSG_ORIG(MSG_EI_ABIVERSION), EI_ABIVERSION },
- { MSG_ORIG(MSG_EI_ABIVERSION_ALT1), EI_ABIVERSION },
-
- { NULL }
-};
-
-/*
- * ELF header ET_* file type values
- */
-static elfedit_atoui_sym_t sym_et[] = {
- { MSG_ORIG(MSG_ET_NONE), ET_NONE },
- { MSG_ORIG(MSG_ET_NONE_ALT1), ET_NONE },
-
- { MSG_ORIG(MSG_ET_REL), ET_REL },
- { MSG_ORIG(MSG_ET_REL_ALT1), ET_REL },
-
- { MSG_ORIG(MSG_ET_EXEC), ET_EXEC },
- { MSG_ORIG(MSG_ET_EXEC_ALT1), ET_EXEC },
-
- { MSG_ORIG(MSG_ET_DYN), ET_DYN },
- { MSG_ORIG(MSG_ET_DYN_ALT1), ET_DYN },
-
- { MSG_ORIG(MSG_ET_CORE), ET_CORE },
- { MSG_ORIG(MSG_ET_CORE_ALT1), ET_CORE },
-
- { NULL }
-};
+typedef conv_iter_ret_t (* libconv_iter_func_simple_t)(
+ Conv_fmt_flags_t, conv_iter_cb_t, void *);
+typedef conv_iter_ret_t (* libconv_iter_func_os_t)(conv_iter_osabi_t,
+ Conv_fmt_flags_t, conv_iter_cb_t, void *);
+typedef conv_iter_ret_t (* libconv_iter_func_mach_t)(Half,
+ Conv_fmt_flags_t, conv_iter_cb_t, void *);
+typedef conv_iter_ret_t (* libconv_iter_func_os_mach_t)(conv_iter_osabi_t, Half,
+ Conv_fmt_flags_t, conv_iter_cb_t, void *);
+typedef union {
+ libconv_iter_func_simple_t simple;
+ libconv_iter_func_os_t osabi;
+ libconv_iter_func_mach_t mach;
+ libconv_iter_func_os_mach_t osabi_mach;
+} libconv_iter_func_t;
/*
- * ELFCLASS
+ * State for each type of constant
*/
-static elfedit_atoui_sym_t sym_elfclass[] = {
- { MSG_ORIG(MSG_ELFCLASSNONE), ELFCLASSNONE },
- { MSG_ORIG(MSG_ELFCLASSNONE_ALT1), ELFCLASSNONE },
+typedef struct {
+ ste_type_t ste_type; /* Type of entry */
+ elfedit_atoui_sym_t *ste_arr; /* NULL, or atoui array */
+ void *ste_alloc; /* Current memory allocation */
+ size_t ste_nelts; /* # items in ste_alloc */
+ libconv_iter_func_t ste_conv_func; /* libconv fill function */
+} sym_table_ent_t;
- { MSG_ORIG(MSG_ELFCLASS32), ELFCLASS32 },
- { MSG_ORIG(MSG_ELFCLASS32_ALT1), ELFCLASS32 },
-
- { MSG_ORIG(MSG_ELFCLASS64), ELFCLASS64 },
- { MSG_ORIG(MSG_ELFCLASS64_ALT1), ELFCLASS64 },
-
- { NULL }
-};
-
-/*
- * ELFDATA
- */
-static elfedit_atoui_sym_t sym_elfdata[] = {
- { MSG_ORIG(MSG_ELFDATANONE), ELFDATANONE },
- { MSG_ORIG(MSG_ELFDATANONE_ALT1), ELFDATANONE },
-
- { MSG_ORIG(MSG_ELFDATA2LSB), ELFDATA2LSB },
- { MSG_ORIG(MSG_ELFDATA2LSB_ALT1), ELFDATA2LSB },
-
- { MSG_ORIG(MSG_ELFDATA2MSB), ELFDATA2MSB },
- { MSG_ORIG(MSG_ELFDATA2MSB_ALT1), ELFDATA2MSB },
-
- { NULL }
-};
-
-/*
- * ELF header EF_* flags
- */
-static elfedit_atoui_sym_t sym_ef[] = {
- { MSG_ORIG(MSG_EF_SPARC_32PLUS), EF_SPARC_32PLUS },
- { MSG_ORIG(MSG_EF_SPARC_32PLUS_ALT1), EF_SPARC_32PLUS },
-
- { MSG_ORIG(MSG_EF_SPARC_SUN_US1), EF_SPARC_SUN_US1 },
- { MSG_ORIG(MSG_EF_SPARC_SUN_US1_ALT1), EF_SPARC_SUN_US1 },
-
- { MSG_ORIG(MSG_EF_SPARC_HAL_R1), EF_SPARC_HAL_R1 },
- { MSG_ORIG(MSG_EF_SPARC_HAL_R1_ALT1), EF_SPARC_HAL_R1 },
-
- { MSG_ORIG(MSG_EF_SPARC_SUN_US3), EF_SPARC_SUN_US3 },
- { MSG_ORIG(MSG_EF_SPARC_SUN_US3_ALT1), EF_SPARC_SUN_US3 },
-
- { MSG_ORIG(MSG_EF_SPARCV9_MM), EF_SPARCV9_MM },
- { MSG_ORIG(MSG_EF_SPARCV9_MM_ALT1), EF_SPARCV9_MM },
-
- { MSG_ORIG(MSG_EF_SPARCV9_TSO), EF_SPARCV9_TSO },
- { MSG_ORIG(MSG_EF_SPARCV9_TSO_ALT1), EF_SPARCV9_TSO },
-
- { MSG_ORIG(MSG_EF_SPARCV9_PSO), EF_SPARCV9_PSO },
- { MSG_ORIG(MSG_EF_SPARCV9_PSO_ALT1), EF_SPARCV9_PSO },
-
- { MSG_ORIG(MSG_EF_SPARCV9_RMO), EF_SPARCV9_RMO },
- { MSG_ORIG(MSG_EF_SPARCV9_RMO_ALT1), EF_SPARCV9_RMO },
-
- { NULL }
-};
-
-/*
- * ELF header EV_* versions
- */
-static elfedit_atoui_sym_t sym_ev[] = {
- { MSG_ORIG(MSG_EV_NONE), EV_NONE },
- { MSG_ORIG(MSG_EV_NONE_ALT1), EV_NONE },
-
- { MSG_ORIG(MSG_EV_CURRENT), EV_CURRENT },
- { MSG_ORIG(MSG_EV_CURRENT_ALT1), EV_CURRENT },
-
- { NULL }
-};
/*
- * ELF EM_* machine types
- */
-static elfedit_atoui_sym_t sym_em[] = {
- { MSG_ORIG(MSG_EM_NONE), EM_NONE },
- { MSG_ORIG(MSG_EM_NONE_ALT1), EM_NONE },
-
- { MSG_ORIG(MSG_EM_M32), EM_M32 },
- { MSG_ORIG(MSG_EM_M32_ALT1), EM_M32 },
- { MSG_ORIG(MSG_EM_M32_ALT2), EM_M32 },
-
- { MSG_ORIG(MSG_EM_SPARC), EM_SPARC },
- { MSG_ORIG(MSG_EM_SPARC_ALT1), EM_SPARC },
-
- { MSG_ORIG(MSG_EM_386), EM_386 },
- { MSG_ORIG(MSG_EM_386_ALT1), EM_386 },
- { MSG_ORIG(MSG_EM_386_ALT2), EM_386 },
-
- { MSG_ORIG(MSG_EM_68K), EM_68K },
- { MSG_ORIG(MSG_EM_68K_ALT1), EM_68K },
- { MSG_ORIG(MSG_EM_68K_ALT2), EM_68K },
-
- { MSG_ORIG(MSG_EM_88K), EM_88K },
- { MSG_ORIG(MSG_EM_88K_ALT1), EM_88K },
- { MSG_ORIG(MSG_EM_88K_ALT2), EM_88K },
-
- { MSG_ORIG(MSG_EM_486), EM_486 },
- { MSG_ORIG(MSG_EM_486_ALT1), EM_486 },
- { MSG_ORIG(MSG_EM_486_ALT2), EM_486 },
-
- { MSG_ORIG(MSG_EM_860), EM_860 },
- { MSG_ORIG(MSG_EM_860_ALT1), EM_860 },
- { MSG_ORIG(MSG_EM_860_ALT2), EM_860 },
-
- { MSG_ORIG(MSG_EM_MIPS), EM_MIPS },
- { MSG_ORIG(MSG_EM_MIPS_ALT1), EM_MIPS },
- { MSG_ORIG(MSG_EM_MIPS_ALT2), EM_MIPS },
-
- { MSG_ORIG(MSG_EM_S370), EM_S370 },
- { MSG_ORIG(MSG_EM_S370_ALT1), EM_S370 },
-
- { MSG_ORIG(MSG_EM_MIPS_RS3_LE), EM_MIPS_RS3_LE },
- { MSG_ORIG(MSG_EM_MIPS_RS3_LE_ALT1), EM_MIPS_RS3_LE },
- { MSG_ORIG(MSG_EM_MIPS_RS3_LE_ALT2), EM_MIPS_RS3_LE },
-
- { MSG_ORIG(MSG_EM_RS6000), EM_RS6000 },
- { MSG_ORIG(MSG_EM_RS6000_ALT1), EM_RS6000 },
-
- { MSG_ORIG(MSG_EM_PA_RISC), EM_PA_RISC },
- { MSG_ORIG(MSG_EM_PA_RISC_ALT1), EM_PA_RISC },
-
- { MSG_ORIG(MSG_EM_NCUBE), EM_nCUBE },
- { MSG_ORIG(MSG_EM_NCUBE_ALT1), EM_nCUBE },
-
- { MSG_ORIG(MSG_EM_VPP500), EM_VPP500 },
- { MSG_ORIG(MSG_EM_VPP500_ALT1), EM_VPP500 },
-
- { MSG_ORIG(MSG_EM_SPARC32PLUS), EM_SPARC32PLUS },
- { MSG_ORIG(MSG_EM_SPARC32PLUS_ALT1), EM_SPARC32PLUS },
-
- { MSG_ORIG(MSG_EM_960), EM_960 },
- { MSG_ORIG(MSG_EM_960_ALT1), EM_960 },
-
- { MSG_ORIG(MSG_EM_PPC), EM_PPC },
- { MSG_ORIG(MSG_EM_PPC_ALT1), EM_PPC },
- { MSG_ORIG(MSG_EM_PPC_ALT2), EM_PPC },
-
- { MSG_ORIG(MSG_EM_PPC64), EM_PPC64 },
- { MSG_ORIG(MSG_EM_PPC64_ALT1), EM_PPC64 },
- { MSG_ORIG(MSG_EM_PPC64_ALT2), EM_PPC64 },
-
- { MSG_ORIG(MSG_EM_S390), EM_S390 },
- { MSG_ORIG(MSG_EM_S390_ALT1), EM_S390 },
-
- { MSG_ORIG(MSG_EM_V800), EM_V800 },
- { MSG_ORIG(MSG_EM_V800_ALT1), EM_V800 },
-
- { MSG_ORIG(MSG_EM_FR20), EM_FR20 },
- { MSG_ORIG(MSG_EM_FR20_ALT1), EM_FR20 },
-
- { MSG_ORIG(MSG_EM_RH32), EM_RH32 },
- { MSG_ORIG(MSG_EM_RH32_ALT1), EM_RH32 },
-
- { MSG_ORIG(MSG_EM_RCE), EM_RCE },
- { MSG_ORIG(MSG_EM_RCE_ALT1), EM_RCE },
-
- { MSG_ORIG(MSG_EM_ARM), EM_ARM },
- { MSG_ORIG(MSG_EM_ARM_ALT1), EM_ARM },
-
- { MSG_ORIG(MSG_EM_ALPHA), EM_ALPHA },
- { MSG_ORIG(MSG_EM_ALPHA_ALT1), EM_ALPHA },
-
- { MSG_ORIG(MSG_EM_SH), EM_SH },
- { MSG_ORIG(MSG_EM_SH_ALT1), EM_SH },
-
- { MSG_ORIG(MSG_EM_SPARCV9), EM_SPARCV9 },
- { MSG_ORIG(MSG_EM_SPARCV9_ALT1), EM_SPARCV9 },
-
- { MSG_ORIG(MSG_EM_TRICORE), EM_TRICORE },
- { MSG_ORIG(MSG_EM_TRICORE_ALT1), EM_TRICORE },
-
- { MSG_ORIG(MSG_EM_ARC), EM_ARC },
- { MSG_ORIG(MSG_EM_ARC_ALT1), EM_ARC },
-
- { MSG_ORIG(MSG_EM_H8_300), EM_H8_300 },
- { MSG_ORIG(MSG_EM_H8_300_ALT1), EM_H8_300 },
-
- { MSG_ORIG(MSG_EM_H8_300H), EM_H8_300H },
- { MSG_ORIG(MSG_EM_H8_300H_ALT1), EM_H8_300H },
-
- { MSG_ORIG(MSG_EM_H8S), EM_H8S },
- { MSG_ORIG(MSG_EM_H8S_ALT1), EM_H8S },
-
- { MSG_ORIG(MSG_EM_H8_500), EM_H8_500 },
- { MSG_ORIG(MSG_EM_H8_500_ALT1), EM_H8_500 },
-
- { MSG_ORIG(MSG_EM_IA_64), EM_IA_64 },
- { MSG_ORIG(MSG_EM_IA_64_ALT1), EM_IA_64 },
-
- { MSG_ORIG(MSG_EM_MIPS_X), EM_MIPS_X },
- { MSG_ORIG(MSG_EM_MIPS_X_ALT1), EM_MIPS_X },
-
- { MSG_ORIG(MSG_EM_COLDFIRE), EM_COLDFIRE },
- { MSG_ORIG(MSG_EM_COLDFIRE_ALT1), EM_COLDFIRE },
-
- { MSG_ORIG(MSG_EM_68HC12), EM_68HC12 },
- { MSG_ORIG(MSG_EM_68HC12_ALT1), EM_68HC12 },
-
- { MSG_ORIG(MSG_EM_MMA), EM_MMA },
- { MSG_ORIG(MSG_EM_MMA_ALT1), EM_MMA },
-
- { MSG_ORIG(MSG_EM_PCP), EM_PCP },
- { MSG_ORIG(MSG_EM_PCP_ALT1), EM_PCP },
-
- { MSG_ORIG(MSG_EM_NCPU), EM_NCPU },
- { MSG_ORIG(MSG_EM_NCPU_ALT1), EM_NCPU },
-
- { MSG_ORIG(MSG_EM_NDR1), EM_NDR1 },
- { MSG_ORIG(MSG_EM_NDR1_ALT1), EM_NDR1 },
-
- { MSG_ORIG(MSG_EM_STARCORE), EM_STARCORE },
- { MSG_ORIG(MSG_EM_STARCORE_ALT1), EM_STARCORE },
-
- { MSG_ORIG(MSG_EM_ME16), EM_ME16 },
- { MSG_ORIG(MSG_EM_ME16_ALT1), EM_ME16 },
-
- { MSG_ORIG(MSG_EM_ST100), EM_ST100 },
- { MSG_ORIG(MSG_EM_ST100_ALT1), EM_ST100 },
-
- { MSG_ORIG(MSG_EM_TINYJ), EM_TINYJ },
- { MSG_ORIG(MSG_EM_TINYJ_ALT1), EM_TINYJ },
-
- { MSG_ORIG(MSG_EM_AMD64), EM_AMD64 },
- { MSG_ORIG(MSG_EM_AMD64_ALT1), EM_AMD64 },
-
- { MSG_ORIG(MSG_EM_PDSP), EM_PDSP },
- { MSG_ORIG(MSG_EM_PDSP_ALT1), EM_PDSP },
-
- { MSG_ORIG(MSG_EM_FX66), EM_FX66 },
- { MSG_ORIG(MSG_EM_FX66_ALT1), EM_FX66 },
-
- { MSG_ORIG(MSG_EM_ST9PLUS), EM_ST9PLUS },
- { MSG_ORIG(MSG_EM_ST9PLUS_ALT1), EM_ST9PLUS },
-
- { MSG_ORIG(MSG_EM_ST7), EM_ST7 },
- { MSG_ORIG(MSG_EM_ST7_ALT1), EM_ST7 },
-
- { MSG_ORIG(MSG_EM_68HC16), EM_68HC16 },
- { MSG_ORIG(MSG_EM_68HC16_ALT1), EM_68HC16 },
-
- { MSG_ORIG(MSG_EM_68HC11), EM_68HC11 },
- { MSG_ORIG(MSG_EM_68HC11_ALT1), EM_68HC11 },
-
- { MSG_ORIG(MSG_EM_68HC08), EM_68HC08 },
- { MSG_ORIG(MSG_EM_68HC08_ALT1), EM_68HC08 },
-
- { MSG_ORIG(MSG_EM_68HC05), EM_68HC05 },
- { MSG_ORIG(MSG_EM_68HC05_ALT1), EM_68HC05 },
-
- { MSG_ORIG(MSG_EM_SVX), EM_SVX },
- { MSG_ORIG(MSG_EM_SVX_ALT1), EM_SVX },
-
- { MSG_ORIG(MSG_EM_ST19), EM_ST19 },
- { MSG_ORIG(MSG_EM_ST19_ALT1), EM_ST19 },
-
- { MSG_ORIG(MSG_EM_VAX), EM_VAX },
- { MSG_ORIG(MSG_EM_VAX_ALT1), EM_VAX },
-
- { MSG_ORIG(MSG_EM_CRIS), EM_CRIS },
- { MSG_ORIG(MSG_EM_CRIS_ALT1), EM_CRIS },
-
- { MSG_ORIG(MSG_EM_JAVELIN), EM_JAVELIN },
- { MSG_ORIG(MSG_EM_JAVELIN_ALT1), EM_JAVELIN },
-
- { MSG_ORIG(MSG_EM_FIREPATH), EM_FIREPATH },
- { MSG_ORIG(MSG_EM_FIREPATH_ALT1), EM_FIREPATH },
-
- { MSG_ORIG(MSG_EM_ZSP), EM_ZSP },
- { MSG_ORIG(MSG_EM_ZSP_ALT1), EM_ZSP },
-
- { MSG_ORIG(MSG_EM_MMIX), EM_MMIX },
- { MSG_ORIG(MSG_EM_MMIX_ALT1), EM_MMIX },
-
- { MSG_ORIG(MSG_EM_HUANY), EM_HUANY },
- { MSG_ORIG(MSG_EM_HUANY_ALT1), EM_HUANY },
-
- { MSG_ORIG(MSG_EM_PRISM), EM_PRISM },
- { MSG_ORIG(MSG_EM_PRISM_ALT1), EM_PRISM },
-
- { MSG_ORIG(MSG_EM_AVR), EM_AVR },
- { MSG_ORIG(MSG_EM_AVR_ALT1), EM_AVR },
-
- { MSG_ORIG(MSG_EM_FR30), EM_FR30 },
- { MSG_ORIG(MSG_EM_FR30_ALT1), EM_FR30 },
-
- { MSG_ORIG(MSG_EM_D10V), EM_D10V },
- { MSG_ORIG(MSG_EM_D10V_ALT1), EM_D10V },
-
- { MSG_ORIG(MSG_EM_D30V), EM_D30V },
- { MSG_ORIG(MSG_EM_D30V_ALT1), EM_D30V },
-
- { MSG_ORIG(MSG_EM_V850), EM_V850 },
- { MSG_ORIG(MSG_EM_V850_ALT1), EM_V850 },
-
- { MSG_ORIG(MSG_EM_M32R), EM_M32R },
- { MSG_ORIG(MSG_EM_M32R_ALT1), EM_M32R },
-
- { MSG_ORIG(MSG_EM_MN10300), EM_MN10300 },
- { MSG_ORIG(MSG_EM_MN10300_ALT1), EM_MN10300 },
-
- { MSG_ORIG(MSG_EM_MN10200), EM_MN10200 },
- { MSG_ORIG(MSG_EM_MN10200_ALT1), EM_MN10200 },
-
- { MSG_ORIG(MSG_EM_PJ), EM_PJ },
- { MSG_ORIG(MSG_EM_PJ_ALT1), EM_PJ },
-
- { MSG_ORIG(MSG_EM_OPENRISC), EM_OPENRISC },
- { MSG_ORIG(MSG_EM_OPENRISC_ALT1), EM_OPENRISC },
-
- { MSG_ORIG(MSG_EM_ARC_A5), EM_ARC_A5 },
- { MSG_ORIG(MSG_EM_ARC_A5_ALT1), EM_ARC_A5 },
-
- { MSG_ORIG(MSG_EM_XTENSA), EM_XTENSA },
- { MSG_ORIG(MSG_EM_XTENSA_ALT1), EM_XTENSA },
-
- { NULL }
-};
-#if (EM_NUM != (EM_XTENSA + 1))
-#error "EM_NUM has grown"
+ * Array of state for each constant type, including the array of atoui
+ * pointers, for each constant type, indexed by elfedit_const_t value.
+ * The number and order of entries in this table must agree with the
+ * definition of elfedit_const_t in elfedit.h.
+ *
+ * note:
+ * - STE_STATIC items must supply a statically allocated buffer here.
+ * - The non-STE_STATIC items use libconv strings. These items are
+ * initialized by init_libconv_strings() at runtime, and are represented
+ * by a simple { 0 } here. The memory used for these arrays is dynamic,
+ * and can be released and rebuilt at runtime as necessary to keep up
+ * with changes in osabi or machine type.
+ */
+static sym_table_ent_t sym_table[ELFEDIT_CONST_NUM] = {
+ /* #: ELFEDIT_CONST_xxx */
+ { STE_STATIC, sym_outstyle }, /* 0: OUTSTYLE */
+ { STE_STATIC, sym_minus_o_outstyle }, /* 1: OUTSTYLE_MO */
+ { STE_STATIC, sym_bool }, /* 2: BOOL */
+ { STE_STATIC, sym_sht_strtab }, /* 3: SHT_STRTAB */
+ { STE_STATIC, sym_sht_symtab }, /* 4: SHT_SYMTAB */
+ { STE_STATIC, sym_sht_dynsym }, /* 5: SHT_DYNSYM */
+ { STE_STATIC, sym_sht_ldynsym }, /* 6: SHT_LDYNSYM */
+ { 0 }, /* 7: SHN */
+ { 0 }, /* 8: SHT */
+ { 0 }, /* 9: SHT_ALLSYMTAB */
+ { 0 }, /* 10: DT */
+ { 0 }, /* 11: DF */
+ { 0 }, /* 12: DF_P1 */
+ { 0 }, /* 13: DF_1 */
+ { 0 }, /* 14: DTF_1 */
+ { 0 }, /* 15: EI */
+ { 0 }, /* 16: ET */
+ { 0 }, /* 17: ELFCLASS */
+ { 0 }, /* 18: ELFDATA */
+ { 0 }, /* 19: EF */
+ { 0 }, /* 20: EV */
+ { 0 }, /* 21: EM */
+ { 0 }, /* 22: ELFOSABI */
+ { 0 }, /* 23: EAV osabi version */
+ { 0 }, /* 24: PT */
+ { 0 }, /* 25: PF */
+ { 0 }, /* 26: SHF */
+ { 0 }, /* 27: STB */
+ { 0 }, /* 28: STT */
+ { 0 }, /* 29: STV */
+ { 0 }, /* 30: SYMINFO_BT */
+ { 0 }, /* 31: SYMINFO_FLG */
+ { 0 }, /* 32: CA */
+ { 0 }, /* 33: AV */
+ { 0 }, /* 34: SF1_SUNW */
+};
+#if ELFEDIT_CONST_NUM != (ELFEDIT_CONST_SF1_SUNW)
+error "ELFEDIT_CONST_NUM has grown. Update sym_table[]"
#endif
-/*
- * ELF header ELFOSABI_* values (and common aliases)
- */
-static elfedit_atoui_sym_t sym_elfosabi[] = {
- { MSG_ORIG(MSG_ELFOSABI_NONE), ELFOSABI_NONE },
- { MSG_ORIG(MSG_ELFOSABI_NONE_ALT1), ELFOSABI_NONE },
-
- { MSG_ORIG(MSG_ELFOSABI_SYSV), ELFOSABI_SYSV },
- { MSG_ORIG(MSG_ELFOSABI_SYSV_ALT1), ELFOSABI_SYSV },
-
- { MSG_ORIG(MSG_ELFOSABI_HPUX), ELFOSABI_HPUX },
- { MSG_ORIG(MSG_ELFOSABI_HPUX_ALT1), ELFOSABI_HPUX },
-
- { MSG_ORIG(MSG_ELFOSABI_NETBSD), ELFOSABI_NETBSD },
- { MSG_ORIG(MSG_ELFOSABI_NETBSD_ALT1), ELFOSABI_NETBSD },
-
- { MSG_ORIG(MSG_ELFOSABI_LINUX), ELFOSABI_LINUX },
- { MSG_ORIG(MSG_ELFOSABI_LINUX_ALT1), ELFOSABI_LINUX },
-
- { MSG_ORIG(MSG_ELFOSABI_SOLARIS), ELFOSABI_SOLARIS },
- { MSG_ORIG(MSG_ELFOSABI_SOLARIS_ALT1), ELFOSABI_SOLARIS },
-
- { MSG_ORIG(MSG_ELFOSABI_AIX), ELFOSABI_AIX },
- { MSG_ORIG(MSG_ELFOSABI_AIX_ALT1), ELFOSABI_AIX },
-
- { MSG_ORIG(MSG_ELFOSABI_IRIX), ELFOSABI_IRIX },
- { MSG_ORIG(MSG_ELFOSABI_IRIX_ALT1), ELFOSABI_IRIX },
-
- { MSG_ORIG(MSG_ELFOSABI_FREEBSD), ELFOSABI_FREEBSD },
- { MSG_ORIG(MSG_ELFOSABI_FREEBSD_ALT1), ELFOSABI_FREEBSD },
-
- { MSG_ORIG(MSG_ELFOSABI_TRU64), ELFOSABI_TRU64 },
- { MSG_ORIG(MSG_ELFOSABI_TRU64_ALT1), ELFOSABI_TRU64 },
-
- { MSG_ORIG(MSG_ELFOSABI_MODESTO), ELFOSABI_MODESTO },
- { MSG_ORIG(MSG_ELFOSABI_MODESTO_ALT1), ELFOSABI_MODESTO },
-
- { MSG_ORIG(MSG_ELFOSABI_OPENBSD), ELFOSABI_OPENBSD },
- { MSG_ORIG(MSG_ELFOSABI_OPENBSD_ALT1), ELFOSABI_OPENBSD },
-
- { MSG_ORIG(MSG_ELFOSABI_OPENVMS), ELFOSABI_OPENVMS },
- { MSG_ORIG(MSG_ELFOSABI_OPENVMS_ALT1), ELFOSABI_OPENVMS },
-
- { MSG_ORIG(MSG_ELFOSABI_NSK), ELFOSABI_NSK },
- { MSG_ORIG(MSG_ELFOSABI_NSK_ALT1), ELFOSABI_NSK },
-
- { MSG_ORIG(MSG_ELFOSABI_AROS), ELFOSABI_AROS },
- { MSG_ORIG(MSG_ELFOSABI_AROS_ALT1), ELFOSABI_AROS },
-
- { MSG_ORIG(MSG_ELFOSABI_ARM), ELFOSABI_ARM },
- { MSG_ORIG(MSG_ELFOSABI_ARM_ALT1), ELFOSABI_ARM },
-
- { MSG_ORIG(MSG_ELFOSABI_STANDALONE), ELFOSABI_STANDALONE },
- { MSG_ORIG(MSG_ELFOSABI_STANDALONE_ALT1), ELFOSABI_STANDALONE },
-
- { NULL }
-};
-
-
-/*
- * Program header PT_* type values
- */
-static elfedit_atoui_sym_t sym_pt[] = {
- { MSG_ORIG(MSG_PT_NULL), PT_NULL },
- { MSG_ORIG(MSG_PT_NULL_ALT1), PT_NULL },
-
- { MSG_ORIG(MSG_PT_LOAD), PT_LOAD },
- { MSG_ORIG(MSG_PT_LOAD_ALT1), PT_LOAD },
-
- { MSG_ORIG(MSG_PT_DYNAMIC), PT_DYNAMIC },
- { MSG_ORIG(MSG_PT_DYNAMIC_ALT1), PT_DYNAMIC },
-
- { MSG_ORIG(MSG_PT_INTERP), PT_INTERP },
- { MSG_ORIG(MSG_PT_INTERP_ALT1), PT_INTERP },
-
- { MSG_ORIG(MSG_PT_NOTE), PT_NOTE },
- { MSG_ORIG(MSG_PT_NOTE_ALT1), PT_NOTE },
-
- { MSG_ORIG(MSG_PT_SHLIB), PT_SHLIB },
- { MSG_ORIG(MSG_PT_SHLIB_ALT1), PT_SHLIB },
-
- { MSG_ORIG(MSG_PT_PHDR), PT_PHDR },
- { MSG_ORIG(MSG_PT_PHDR_ALT1), PT_PHDR },
-
- { MSG_ORIG(MSG_PT_TLS), PT_TLS },
- { MSG_ORIG(MSG_PT_TLS_ALT1), PT_TLS },
-
- { MSG_ORIG(MSG_PT_SUNW_UNWIND), PT_SUNW_UNWIND },
- { MSG_ORIG(MSG_PT_SUNW_UNWIND_ALT1), PT_SUNW_UNWIND },
-
- { MSG_ORIG(MSG_PT_SUNW_EH_FRAME), PT_SUNW_EH_FRAME },
- { MSG_ORIG(MSG_PT_SUNW_EH_FRAME_ALT1), PT_SUNW_EH_FRAME },
-
- { MSG_ORIG(MSG_PT_SUNWBSS), PT_SUNWBSS },
- { MSG_ORIG(MSG_PT_SUNWBSS_ALT1), PT_SUNWBSS },
-
- { MSG_ORIG(MSG_PT_SUNWSTACK), PT_SUNWSTACK },
- { MSG_ORIG(MSG_PT_SUNWSTACK_ALT1), PT_SUNWSTACK },
-
- { MSG_ORIG(MSG_PT_SUNWDTRACE), PT_SUNWDTRACE },
- { MSG_ORIG(MSG_PT_SUNWDTRACE_ALT1), PT_SUNWDTRACE },
-
- { MSG_ORIG(MSG_PT_SUNWCAP), PT_SUNWCAP },
- { MSG_ORIG(MSG_PT_SUNWCAP_ALT1), PT_SUNWCAP },
-
- { NULL }
-};
-
-
-/*
- * Program header PF_* flag values
- */
-static elfedit_atoui_sym_t sym_pf[] = {
- { MSG_ORIG(MSG_PF_X), PF_X },
- { MSG_ORIG(MSG_PF_X_ALT1), PF_X },
-
- { MSG_ORIG(MSG_PF_W), PF_W },
- { MSG_ORIG(MSG_PF_W_ALT1), PF_W },
-
- { MSG_ORIG(MSG_PF_R), PF_R },
- { MSG_ORIG(MSG_PF_R_ALT1), PF_R },
-
- { NULL }
-};
-
-
-/*
- * Section header SHF_* flag values
- */
-static elfedit_atoui_sym_t sym_shf[] = {
- { MSG_ORIG(MSG_SHF_WRITE), SHF_WRITE },
- { MSG_ORIG(MSG_SHF_WRITE_ALT1), SHF_WRITE },
-
- { MSG_ORIG(MSG_SHF_ALLOC), SHF_ALLOC },
- { MSG_ORIG(MSG_SHF_ALLOC_ALT1), SHF_ALLOC },
-
- { MSG_ORIG(MSG_SHF_EXECINSTR), SHF_EXECINSTR },
- { MSG_ORIG(MSG_SHF_EXECINSTR_ALT1), SHF_EXECINSTR },
-
- { MSG_ORIG(MSG_SHF_MERGE), SHF_MERGE },
- { MSG_ORIG(MSG_SHF_MERGE_ALT1), SHF_MERGE },
-
- { MSG_ORIG(MSG_SHF_STRINGS), SHF_STRINGS },
- { MSG_ORIG(MSG_SHF_STRINGS_ALT1), SHF_STRINGS },
- { MSG_ORIG(MSG_SHF_INFO_LINK), SHF_INFO_LINK },
- { MSG_ORIG(MSG_SHF_INFO_LINK_ALT1), SHF_INFO_LINK },
-
- { MSG_ORIG(MSG_SHF_LINK_ORDER), SHF_LINK_ORDER },
- { MSG_ORIG(MSG_SHF_LINK_ORDER_ALT1), SHF_LINK_ORDER },
-
- { MSG_ORIG(MSG_SHF_OS_NONCONFORMING), SHF_OS_NONCONFORMING },
- { MSG_ORIG(MSG_SHF_OS_NONCONFORMING_ALT1), SHF_OS_NONCONFORMING },
-
- { MSG_ORIG(MSG_SHF_GROUP), SHF_GROUP },
- { MSG_ORIG(MSG_SHF_GROUP_ALT1), SHF_GROUP },
-
- { MSG_ORIG(MSG_SHF_TLS), SHF_TLS },
- { MSG_ORIG(MSG_SHF_TLS_ALT1), SHF_TLS },
-
- { MSG_ORIG(MSG_SHF_AMD64_LARGE), SHF_AMD64_LARGE },
- { MSG_ORIG(MSG_SHF_AMD64_LARGE_ALT1), SHF_AMD64_LARGE },
-
- { MSG_ORIG(MSG_SHF_ORDERED), SHF_ORDERED },
- { MSG_ORIG(MSG_SHF_ORDERED_ALT1), SHF_ORDERED },
-
- { MSG_ORIG(MSG_SHF_EXCLUDE), SHF_EXCLUDE },
- { MSG_ORIG(MSG_SHF_EXCLUDE_ALT1), SHF_EXCLUDE },
-
- { NULL }
-};
-
-/*
- * ELF symbol bindings (st_info ELF_ST_BIND)
- */
-static elfedit_atoui_sym_t sym_stb[] = {
- { MSG_ORIG(MSG_STB_LOCAL), STB_LOCAL },
- { MSG_ORIG(MSG_STB_LOCAL_ALT1), STB_LOCAL },
-
- { MSG_ORIG(MSG_STB_GLOBAL), STB_GLOBAL },
- { MSG_ORIG(MSG_STB_GLOBAL_ALT1), STB_GLOBAL },
-
- { MSG_ORIG(MSG_STB_WEAK), STB_WEAK },
- { MSG_ORIG(MSG_STB_WEAK_ALT1), STB_WEAK },
-
- { NULL }
-};
/*
- * ELF symbol types (st_info ELF_ST_TYPE)
+ * Used to count the number of descriptors that will be needed to hold
+ * strings from libconv.
*/
-static elfedit_atoui_sym_t sym_stt[] = {
- { MSG_ORIG(MSG_STT_NOTYPE), STT_NOTYPE },
- { MSG_ORIG(MSG_STT_NOTYPE_ALT1), STT_NOTYPE },
-
- { MSG_ORIG(MSG_STT_OBJECT), STT_OBJECT },
- { MSG_ORIG(MSG_STT_OBJECT_ALT1), STT_OBJECT },
-
- { MSG_ORIG(MSG_STT_FUNC), STT_FUNC },
- { MSG_ORIG(MSG_STT_FUNC_ALT1), STT_FUNC },
-
- { MSG_ORIG(MSG_STT_SECTION), STT_SECTION },
- { MSG_ORIG(MSG_STT_SECTION_ALT1), STT_SECTION },
-
- { MSG_ORIG(MSG_STT_FILE), STT_FILE },
- { MSG_ORIG(MSG_STT_FILE_ALT1), STT_FILE },
-
- { MSG_ORIG(MSG_STT_COMMON), STT_COMMON },
- { MSG_ORIG(MSG_STT_COMMON_ALT1), STT_COMMON },
-
- { MSG_ORIG(MSG_STT_TLS), STT_TLS },
- { MSG_ORIG(MSG_STT_TLS_ALT1), STT_TLS },
-
- { NULL }
-};
-
-/*
- * ELF symbol visibility (st_other ELF_ST_VISIBILITY)
- */
-static elfedit_atoui_sym_t sym_stv[] = {
- { MSG_ORIG(MSG_STV_DEFAULT), STV_DEFAULT },
- { MSG_ORIG(MSG_STV_DEFAULT_ALT1), STV_DEFAULT },
-
- { MSG_ORIG(MSG_STV_INTERNAL), STV_INTERNAL },
- { MSG_ORIG(MSG_STV_INTERNAL_ALT1), STV_INTERNAL },
-
- { MSG_ORIG(MSG_STV_HIDDEN), STV_HIDDEN },
- { MSG_ORIG(MSG_STV_HIDDEN_ALT1), STV_HIDDEN },
-
- { MSG_ORIG(MSG_STV_PROTECTED), STV_PROTECTED },
- { MSG_ORIG(MSG_STV_PROTECTED_ALT1), STV_PROTECTED },
-
- { MSG_ORIG(MSG_STV_EXPORTED), STV_EXPORTED },
- { MSG_ORIG(MSG_STV_EXPORTED_ALT1), STV_EXPORTED },
-
- { MSG_ORIG(MSG_STV_SINGLETON), STV_SINGLETON },
- { MSG_ORIG(MSG_STV_SINGLETON_ALT1), STV_SINGLETON },
-
- { MSG_ORIG(MSG_STV_ELIMINATE), STV_ELIMINATE },
- { MSG_ORIG(MSG_STV_ELIMINATE_ALT1), STV_ELIMINATE },
-
- { NULL }
-};
-
-/*
- * ELF syminfo SYMINFO_BT_ special boundto values
- */
-static elfedit_atoui_sym_t sym_syminfo_bt[] = {
- { MSG_ORIG(MSG_SYMINFO_BT_SELF), SYMINFO_BT_SELF },
- { MSG_ORIG(MSG_SYMINFO_BT_SELF_ALT1), SYMINFO_BT_SELF },
-
- { MSG_ORIG(MSG_SYMINFO_BT_PARENT), SYMINFO_BT_PARENT },
- { MSG_ORIG(MSG_SYMINFO_BT_PARENT_ALT1), SYMINFO_BT_PARENT },
-
- { MSG_ORIG(MSG_SYMINFO_BT_NONE), SYMINFO_BT_NONE },
- { MSG_ORIG(MSG_SYMINFO_BT_NONE_ALT1), SYMINFO_BT_NONE },
-
- { NULL }
-};
+/*ARGSUSED*/
+static conv_iter_ret_t
+libconv_count_cb(const char *str, Conv_elfvalue_t value, void *uvalue)
+{
+ size_t *cnt = (size_t *)uvalue;
+ (*cnt)++;
+ return (CONV_ITER_CONT);
+}
/*
- * ELF syminfo SYMINFO_FLG_ flags
+ * Used to fill in the descriptors with strings from libconv.
*/
-static elfedit_atoui_sym_t sym_syminfo_flg[] = {
- { MSG_ORIG(MSG_SYMINFO_FLG_DIRECT), SYMINFO_FLG_DIRECT },
- { MSG_ORIG(MSG_SYMINFO_FLG_DIRECT_ALT1), SYMINFO_FLG_DIRECT },
-
- { MSG_ORIG(MSG_SYMINFO_FLG_COPY), SYMINFO_FLG_COPY },
- { MSG_ORIG(MSG_SYMINFO_FLG_COPY_ALT1), SYMINFO_FLG_COPY },
-
- { MSG_ORIG(MSG_SYMINFO_FLG_LAZYLOAD), SYMINFO_FLG_LAZYLOAD },
- { MSG_ORIG(MSG_SYMINFO_FLG_LAZYLOAD_ALT1), SYMINFO_FLG_LAZYLOAD },
-
- { MSG_ORIG(MSG_SYMINFO_FLG_DIRECTBIND), SYMINFO_FLG_DIRECTBIND },
- { MSG_ORIG(MSG_SYMINFO_FLG_DIRECTBIND_ALT1), SYMINFO_FLG_DIRECTBIND },
+typedef struct {
+ size_t cur; /* Index of next descriptor */
+ size_t cnt; /* # of descriptors */
+ elfedit_atoui_sym_t *desc; /* descriptors */
+} libconv_fill_state_t;
- { MSG_ORIG(MSG_SYMINFO_FLG_NOEXTDIRECT), SYMINFO_FLG_NOEXTDIRECT },
- { MSG_ORIG(MSG_SYMINFO_FLG_NOEXTDIRECT_ALT1), SYMINFO_FLG_NOEXTDIRECT },
+static conv_iter_ret_t
+libconv_fill_cb(const char *str, Conv_elfvalue_t value, void *uvalue)
+{
+ libconv_fill_state_t *fill_state = (libconv_fill_state_t *)uvalue;
+ elfedit_atoui_sym_t *sym = &fill_state->desc[fill_state->cur++];
- { NULL }
-};
+ sym->sym_name = str;
+ sym->sym_value = value;
+ return (CONV_ITER_CONT);
+}
/*
- * ELF capabilities tag CA_ values
+ * Call the iteration function using the correct calling sequence for
+ * the libconv routine.
*/
-static elfedit_atoui_sym_t sym_ca[] = {
- { MSG_ORIG(MSG_CA_SUNW_NULL), CA_SUNW_NULL },
- { MSG_ORIG(MSG_CA_SUNW_NULL_ALT1), CA_SUNW_NULL },
-
- { MSG_ORIG(MSG_CA_SUNW_HW_1), CA_SUNW_HW_1 },
- { MSG_ORIG(MSG_CA_SUNW_HW_1_ALT1), CA_SUNW_HW_1 },
-
- { MSG_ORIG(MSG_CA_SUNW_SF_1), CA_SUNW_SF_1 },
- { MSG_ORIG(MSG_CA_SUNW_SF_1_ALT1), CA_SUNW_SF_1 },
-
- { NULL }
-};
+static void
+libconv_fill_iter(sym_table_ent_t *sym, conv_iter_osabi_t osabi, Half mach,
+ conv_iter_cb_t func, void *uvalue)
+{
+ switch (sym->ste_type) {
+ case STE_LC:
+ (void) (* sym->ste_conv_func.simple)(
+ CONV_FMT_ALT_CF, func, uvalue);
+ (void) (* sym->ste_conv_func.simple)(
+ CONV_FMT_ALT_NF, func, uvalue);
+ break;
+ case STE_LC_OS:
+ (void) (* sym->ste_conv_func.osabi)(osabi,
+ CONV_FMT_ALT_CF, func, uvalue);
+ (void) (* sym->ste_conv_func.osabi)(osabi,
+ CONV_FMT_ALT_NF, func, uvalue);
+ break;
-/*
- * AV_386 flags used for CA_SUNW_HW_1 capabilities
- *
- * The space for this is reserved at compile time, but the values are
- * filled in at runtime on demand from the usr/src/common/elfcap code.
- * Note that we need two slots for every capability, one for the full
- * string, and another for the informal lowercase version.
- */
-static elfedit_atoui_sym_t sym_av_386[(2 * ELFCAP_NUM_HW1_386) + 1];
+ case STE_LC_MACH:
+ (void) (* sym->ste_conv_func.mach)(mach,
+ CONV_FMT_ALT_CF, func, uvalue);
+ (void) (* sym->ste_conv_func.mach)(mach,
+ CONV_FMT_ALT_NF, func, uvalue);
+ break;
-/*
- * AV_SPARC flags used for CA_SUNW_HW_1 capabilities
- *
- * The space for this is reserved at compile time, but the values are
- * filled in at runtime on demand from the usr/src/common/elfcap code.
- * Note that we need two slots for every capability, one for the full
- * string, and another for the informal lowercase version.
- */
-static elfedit_atoui_sym_t sym_av_sparc[(2 * ELFCAP_NUM_HW1_SPARC) + 1];
+ case STE_LC_OS_MACH:
+ (void) (* sym->ste_conv_func.osabi_mach)(osabi, mach,
+ CONV_FMT_ALT_CF, func, uvalue);
+ (void) (* sym->ste_conv_func.osabi_mach)(osabi, mach,
+ CONV_FMT_ALT_NF, func, uvalue);
+ break;
+ }
+}
/*
- * SF1_SUNW flags used for CA_SUNW_SF_1 capabilities
- *
- * The space for this is reserved at compile time, but the values are
- * filled in at runtime on demand from the usr/src/common/elfcap code.
- * Note that we need two slots for every capability, one for the full
- * string, and another for the informal lowercase version.
+ * Allocate/Fill an atoui array for the specified constant.
*/
-static elfedit_atoui_sym_t sym_sf1_sunw[(2 * ELFCAP_NUM_SF1) + 1];
-
-
-
+static void
+libconv_fill(sym_table_ent_t *sym, conv_iter_osabi_t osabi, Half mach)
+{
+ libconv_fill_state_t fill_state;
+
+ /* How many descriptors will we need? */
+ fill_state.cnt = 1; /* Extra for NULL termination */
+ libconv_fill_iter(sym, osabi, mach, libconv_count_cb, &fill_state.cnt);
+
+ /*
+ * If there is an existing allocation, and it is not large enough,
+ * release it.
+ */
+ if ((sym->ste_alloc != NULL) && (fill_state.cnt > sym->ste_nelts)) {
+ free(sym->ste_alloc);
+ sym->ste_alloc = NULL;
+ sym->ste_nelts = 0;
+ }
+ /* Allocate memory if don't already have an allocation */
+ if (sym->ste_alloc == NULL) {
+ sym->ste_alloc = elfedit_malloc(MSG_INTL(MSG_ALLOC_ELFCONDESC),
+ fill_state.cnt * sizeof (*fill_state.desc));
+ sym->ste_nelts = fill_state.cnt;
+ }
+ /* Fill the array */
+ fill_state.desc = sym->ste_alloc;
+ fill_state.cur = 0;
+ libconv_fill_iter(sym, osabi, mach, libconv_fill_cb, &fill_state);
+ /* Add null termination */
+ fill_state.desc[fill_state.cur].sym_name = NULL;
+ fill_state.desc[fill_state.cur].sym_value = 0;
+ /* atoui array for this item is now available */
+ sym->ste_arr = fill_state.desc;
+}
/*
- * Array of pointers to atoui arrays for each constant type, indexed
- * by elfedit_const_t value. The number and order of entries in this
- * table must agree with the definition of elfedit_const_t in elfedit.h.
+ * Should be called on first call to elfedit_const_to_atoui(). Does the
+ * runtime initialization of sym_table.
*/
-static elfedit_atoui_sym_t *sym_table[] = {
- sym_outstyle, /* 0: ELFEDIT_CONST_OUTSTYLE */
- sym_minus_o_outstyle, /* 1: ELFEDIT_CONST_OUTSTYLE_MO */
- sym_bool, /* 2: ELFEDIT_CONST_BOOL */
- sym_shn, /* 3: ELFEDIT_CONST_SHN */
- sym_sht, /* 4: ELFEDIT_CONST_SHT */
- sym_sht_strtab, /* 5: ELFEDIT_CONST_SHT_STRTAB */
- sym_sht_allsymtab, /* 6: ELFEDIT_CONST_SHT_ALLSYMTAB */
- sym_sht_symtab, /* 7: ELFEDIT_CONST_SHT_SYMTAB */
- sym_sht_dynsym, /* 8: ELFEDIT_CONST_SHT_DYNSYM */
- sym_sht_ldynsym, /* 9: ELFEDIT_CONST_SHT_LDYNSYM */
- sym_dt, /* 10: ELFEDIT_CONST_DT: Dynamic tags */
- sym_df, /* 11: ELFEDIT_CONST_DF: DT_FLAGS */
- sym_df_p1, /* 12: ELFEDIT_CONST_DF_P1: DF_POSFLAG_1 */
- sym_df_1, /* 13: ELFEDIT_CONST_DF_1: DT_FLAGS_1 */
- sym_dtf_1, /* 14: ELFEDIT_CONST_DTF_1: DT_FEATURE_1 */
- sym_ei, /* 15: ELFEDIT_CONST_EI: Ehdr e_ident indexes */
- sym_et, /* 16: ELFEDIT_CONST_ET: Ehdr obj type */
- sym_elfclass, /* 17: ELFEDIT_CONST_ELFCLASS: Ehdr class */
- sym_elfdata, /* 18: ELFEDIT_CONST_ELFDATA: Ehdr endian */
- sym_ef, /* 19: ELFEDIT_CONST_EF: Ehdr flags */
- sym_ev, /* 20: ELFEDIT_CONST_EV: Ehdr version */
- sym_em, /* 21: ELFEDIT_CONST_EM: Ehdr machine */
- sym_elfosabi, /* 22: ELFEDIT_CONST_ELFOSABI: Ehdr ABI */
- sym_pt, /* 23: ELFEDIT_CONST_PT: Phdr type */
- sym_pf, /* 24: ELFEDIT_CONST_PF: Phdr flags */
- sym_shf, /* 25: ELFEDIT_CONST_SHF: Shdr flags */
- sym_stb, /* 26: ELFEDIT_CONST_STB: Sym binding */
- sym_stt, /* 27: ELFEDIT_CONST_STT: Sym type */
- sym_stv, /* 28: ELFEDIT_CONST_STV: Sym visibility */
- sym_syminfo_bt, /* 29: ELFEDIT_CONST_SYMINFO_BT:Syminfo bndto */
- sym_syminfo_flg, /* 30: ELFEDIT_CONST_SYMINFO_FLG:Syminfo flag */
- sym_ca, /* 31: ELFEDIT_CONST_CA: Capabilities tags */
- NULL, /* 32: ELFEDIT_CONST_AV_386: X86 HW caps */
- NULL, /* 33: ELFEDIT_CONST_AV_SPARC: sparc HW caps */
- NULL, /* 34: ELFEDIT_CONST_SF1_SUNW: software caps */
-};
-
-
-
-
-
+static void
+init_libconv_strings(conv_iter_osabi_t *osabi, Half *mach)
+{
+ /*
+ * It is critical that the ste_type and ste_conv_func values
+ * agree. Since the libconv iteration function signatures can
+ * change (gain or lose an osabi or mach argument), we want to
+ * ensure that the compiler will catch such changes.
+ *
+ * The compiler will catch an attempt to assign a function of
+ * the wrong type to ste_conv_func. Using these macros, we ensure
+ * that the ste_type and function assignment happen as a unit.
+ */
+#define LC(_ndx, _func) sym_table[_ndx].ste_type = STE_LC; \
+ sym_table[_ndx].ste_conv_func.simple = _func;
+#define LC_OS(_ndx, _func) sym_table[_ndx].ste_type = STE_LC_OS; \
+ sym_table[_ndx].ste_conv_func.osabi = _func;
+#define LC_MACH(_ndx, _func) sym_table[_ndx].ste_type = STE_LC_MACH; \
+ sym_table[_ndx].ste_conv_func.mach = _func;
+#define LC_OS_MACH(_ndx, _func) sym_table[_ndx].ste_type = STE_LC_OS_MACH; \
+ sym_table[_ndx].ste_conv_func.osabi_mach = _func;
+
+
+ if (!state.file.present) {
+ /*
+ * No input file: Supply the maximal set of strings for
+ * all osabi and mach values understood by libconv.
+ */
+ *osabi = CONV_OSABI_ALL;
+ *mach = CONV_MACH_ALL;
+ } else if (state.elf.elfclass == ELFCLASS32) {
+ *osabi = state.elf.obj_state.s32->os_ehdr->e_ident[EI_OSABI];
+ *mach = state.elf.obj_state.s32->os_ehdr->e_machine;
+ } else {
+ *osabi = state.elf.obj_state.s64->os_ehdr->e_ident[EI_OSABI];
+ *mach = state.elf.obj_state.s64->os_ehdr->e_machine;
+ }
+ /* Set up non- STE_STATIC libconv fill functions */
+ LC_OS_MACH(ELFEDIT_CONST_SHN, conv_iter_sym_shndx);
+ LC_OS_MACH(ELFEDIT_CONST_SHT, conv_iter_sec_type);
+ LC_OS(ELFEDIT_CONST_SHT_ALLSYMTAB, conv_iter_sec_symtab);
+ LC_OS_MACH(ELFEDIT_CONST_DT, conv_iter_dyn_tag);
+ LC(ELFEDIT_CONST_DF, conv_iter_dyn_flag);
+ LC(ELFEDIT_CONST_DF_P1, conv_iter_dyn_posflag1);
+ LC(ELFEDIT_CONST_DF_1, conv_iter_dyn_flag1);
+ LC(ELFEDIT_CONST_DTF_1, conv_iter_dyn_feature1);
+ LC(ELFEDIT_CONST_EI, conv_iter_ehdr_eident);
+ LC_OS(ELFEDIT_CONST_ET, conv_iter_ehdr_type);
+ LC(ELFEDIT_CONST_ELFCLASS, conv_iter_ehdr_class);
+ LC(ELFEDIT_CONST_ELFDATA, conv_iter_ehdr_data);
+ LC_MACH(ELFEDIT_CONST_EF, conv_iter_ehdr_flags);
+ LC(ELFEDIT_CONST_EV, conv_iter_ehdr_vers);
+ LC(ELFEDIT_CONST_EM, conv_iter_ehdr_mach);
+ LC(ELFEDIT_CONST_ELFOSABI, conv_iter_ehdr_osabi);
+ LC_OS(ELFEDIT_CONST_EAV, conv_iter_ehdr_abivers);
+ LC_OS(ELFEDIT_CONST_PT, conv_iter_phdr_type);
+ LC_OS(ELFEDIT_CONST_PF, conv_iter_phdr_flags);
+ LC_OS_MACH(ELFEDIT_CONST_SHF, conv_iter_sec_flags);
+ LC(ELFEDIT_CONST_STB, conv_iter_sym_info_bind);
+ LC_MACH(ELFEDIT_CONST_STT, conv_iter_sym_info_type);
+ LC(ELFEDIT_CONST_STV, conv_iter_sym_other_vis);
+ LC(ELFEDIT_CONST_SYMINFO_BT, conv_iter_syminfo_boundto);
+ LC(ELFEDIT_CONST_SYMINFO_FLG, conv_iter_syminfo_flags);
+ LC(ELFEDIT_CONST_CA, conv_iter_cap_tags);
+ LC_MACH(ELFEDIT_CONST_AV, conv_iter_cap_val_hw1);
+ LC(ELFEDIT_CONST_SF1_SUNW, conv_iter_cap_val_sf1);
+
+#undef LC
+#undef LC_OS
+#undef LC_MACH
+#undef LC_OS_MACH
+}
/*
- * Fill in the specified hardware/software capability array
- * with data from usr/src/common/elfcap.
- *
- * entry:
- * const_type - Index of constant item being filled
- * arr - elfedit_atoui_sym_t array to be filled
- * desc - Array of capability descriptors from elfcap
- * cnt - # of capability descriptors.
- *
- * exit:
- * arr is expected to have [(2 * cnt) + 1] elements, all zero filled.
- * For each descriptor, 2 array elements are filled in. The first one
- * has the full name, and the second has the lowecase informal version.
- * The final element of arr is left as NULL, to serve as termination.
+ * If the user has changed the osabi or machine type of the object,
+ * then we need to discard the strings we've loaded from libconv
+ * that are dependent on these values.
*/
static void
-fill_capability_array(elfedit_const_t const_type,
- elfedit_atoui_sym_t *arr, const elfcap_desc_t *desc, size_t cnt)
+invalidate_libconv_strings(conv_iter_osabi_t *osabi, Half *mach)
{
- sym_table[const_type] = arr;
+ uchar_t cur_osabi;
+ Half cur_mach;
+ sym_table_ent_t *sym;
+ int osabi_change, mach_change;
+ int i;
+
+
+ /* Reset the ELF header change notification */
+ state.elf.elfconst_ehdr_change = 0;
+
+ if (state.elf.elfclass == ELFCLASS32) {
+ cur_osabi = state.elf.obj_state.s32->os_ehdr->e_ident[EI_OSABI];
+ cur_mach = state.elf.obj_state.s32->os_ehdr->e_machine;
+ } else {
+ cur_osabi = state.elf.obj_state.s64->os_ehdr->e_ident[EI_OSABI];
+ cur_mach = state.elf.obj_state.s64->os_ehdr->e_machine;
+ }
- for (; cnt-- > 0; desc++) {
- /*
- * Ignore "placeholder" items. These represent
- * unallocated holes in the capability bits.
- */
- if (desc->c_val == 0)
+ /* What has changed? */
+ mach_change = *mach != cur_mach;
+ osabi_change = *osabi != cur_osabi;
+ if (!(mach_change || osabi_change))
+ return;
+
+ /*
+ * Set the ste_arr pointer to NULL for any items that
+ * depend on the things that have changed. Note that we
+ * do not release the allocated memory --- it may turn
+ * out to be large enough to hold the new strings, so we
+ * keep the allocation and leave that decision to the fill
+ * routine, which will run the next time those strings are
+ * needed.
+ */
+ for (i = 0, sym = sym_table;
+ i < (sizeof (sym_table) / sizeof (sym_table[0])); i++, sym++) {
+ if (sym->ste_arr == NULL)
continue;
- arr->sym_name = desc->c_full.s_str;
- arr->sym_value = desc->c_val;
- arr++;
-
- arr->sym_name = desc->c_lc.s_str;
- arr->sym_value = desc->c_val;
- arr++;
+ switch (sym->ste_type) {
+ case STE_LC_OS:
+ if (osabi_change)
+ sym->ste_arr = NULL;
+ break;
+
+ case STE_LC_MACH:
+ if (mach_change)
+ sym->ste_arr = NULL;
+ break;
+
+ case STE_LC_OS_MACH:
+ if (osabi_change || mach_change)
+ sym->ste_arr = NULL;
+ break;
+ }
}
+ *mach = cur_mach;
+ *osabi = cur_osabi;
}
@@ -1479,59 +494,40 @@ fill_capability_array(elfedit_const_t const_type,
elfedit_atoui_sym_t *
elfedit_const_to_atoui(elfedit_const_t const_type)
{
- if ((const_type < 0) ||
- (const_type >= (sizeof (sym_table) / sizeof (sym_table[0]))))
- elfedit_msg(ELFEDIT_MSG_ERR, MSG_INTL(MSG_ERR_BADCONST));
+ static int first = 1;
+ static conv_iter_osabi_t osabi;
+ static Half mach;
- /* Fill capability constant array on demand? */
- switch (const_type) {
- case ELFEDIT_CONST_AV_386:
- if (sym_table[ELFEDIT_CONST_AV_386] == NULL)
- fill_capability_array(ELFEDIT_CONST_AV_386,
- sym_av_386, elfcap_getdesc_hw1_386(),
- ELFCAP_NUM_HW1_386);
- break;
- case ELFEDIT_CONST_AV_SPARC:
- if (sym_table[ELFEDIT_CONST_AV_SPARC] == NULL)
- fill_capability_array(ELFEDIT_CONST_AV_SPARC,
- sym_av_sparc, elfcap_getdesc_hw1_sparc(),
- ELFCAP_NUM_HW1_SPARC);
- break;
- case ELFEDIT_CONST_SF1_SUNW:
- if (sym_table[ELFEDIT_CONST_SF1_SUNW] == NULL)
- fill_capability_array(ELFEDIT_CONST_SF1_SUNW,
- sym_sf1_sunw, elfcap_getdesc_sf1(), ELFCAP_NUM_SF1);
- break;
- }
+ sym_table_ent_t *sym;
- return (sym_table[const_type]);
-}
+ if (first) {
+ init_libconv_strings(&osabi, &mach);
+ first = 0;
+ }
+ if ((const_type < 0) ||
+ (const_type >= (sizeof (sym_table) / sizeof (sym_table[0]))))
+ elfedit_msg(ELFEDIT_MSG_ERR, MSG_INTL(MSG_ERR_BADCONST));
+ sym = &sym_table[const_type];
+ /*
+ * If the constant is not STE_STATIC, then we may need to fetch
+ * the strings from libconv.
+ */
+ if (sym->ste_type != STE_STATIC) {
+ /*
+ * If the ELF header has changed since the last
+ * time we were called, then we need to invalidate any
+ * strings previously pulled from libconv that have
+ * an osabi or machine dependency.
+ */
+ if (state.elf.elfconst_ehdr_change)
+ invalidate_libconv_strings(&osabi, &mach);
-/*
- * Return the elfedit_atoui_t array that corresponds to the
- * CA_SUNW_HW_1 hardware capabiliies field for a given
- * machine type.
- *
- * This routine will return NULL if there is no definition for the
- * machine specified.
- */
-elfedit_atoui_sym_t *
-elfedit_mach_sunw_hw1_to_atoui(int mach)
-{
- switch (mach) {
- case EM_386:
- case EM_486:
- case EM_AMD64:
- return (elfedit_const_to_atoui(ELFEDIT_CONST_AV_386));
-
- case EM_SPARC:
- case EM_SPARC32PLUS:
- case EM_SPARCV9:
- return (elfedit_const_to_atoui(ELFEDIT_CONST_AV_SPARC));
+ /* If we don't already have the strings, get them */
+ if (sym->ste_arr == NULL)
+ libconv_fill(sym, osabi, mach);
}
- /* A machine we don't know about */
- return (NULL);
+ return (sym->ste_arr);
}
diff --git a/usr/src/cmd/sgs/elfedit/common/elfedit.c b/usr/src/cmd/sgs/elfedit/common/elfedit.c
index 6c530781a1..3879d65446 100644
--- a/usr/src/cmd/sgs/elfedit/common/elfedit.c
+++ b/usr/src/cmd/sgs/elfedit/common/elfedit.c
@@ -20,10 +20,9 @@
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/types.h>
#include <sys/stat.h>
@@ -2196,6 +2195,14 @@ dispatch_user_cmds()
elfedit_pager_cleanup();
switch (cmd_ret) {
+ case ELFEDIT_CMDRET_MOD_OS_MACH:
+ /*
+ * Inform the elfconst module that the machine
+ * or osabi has has changed. It may be necessary
+ * to fetch new strings from libconv.
+ */
+ state.elf.elfconst_ehdr_change = 1;
+ /*FALLTHROUGH*/
case ELFEDIT_CMDRET_MOD:
/*
* Command modified the output ELF image,
diff --git a/usr/src/cmd/sgs/elfedit/common/elfedit.msg b/usr/src/cmd/sgs/elfedit/common/elfedit.msg
index 8833187662..d3b2821d90 100644
--- a/usr/src/cmd/sgs/elfedit/common/elfedit.msg
+++ b/usr/src/cmd/sgs/elfedit/common/elfedit.msg
@@ -67,6 +67,7 @@
@ MSG_ALLOC_PATHARR "search path array"
@ MSG_ALLOC_HELPITEM "help state"
@ MSG_ALLOC_SECMSGPRE "section message prefix string"
+@ MSG_ALLOC_ELFCONDESC "ELF constant string descriptors"
# Format strings
@@ -226,6 +227,7 @@
of valid of range for this section: 0-%d\n"
@ MSG_ERR_ARRMVOVERLAP "%s: Array source [%d-%d] and destination \
[%d-%d] regions overlap\n"
+@ MSG_ERR_BADOSABI "Operation not supported by current OS ABI: %s\n";
# Format strings for sys:help
@ MSG_HLPFMT_MOD "\nMODULE\n %s - %s\n"
@@ -599,781 +601,17 @@
@ MSG_ELF_UPDATE "elf_update"
-# Names of special section indexes
-
-@ MSG_SHN_UNDEF "SHN_UNDEF" # 0
-@ MSG_SHN_UNDEF_ALT1 "undef"
-@ MSG_SHN_SUNW_IGNORE "SHN_SUNW_IGNORE" # 0xff3f
-@ MSG_SHN_SUNW_IGNORE_ALT1 "sunw_ignore"
-@ MSG_SHN_BEFORE "SHN_BEFORE" # 0xff00
-@ MSG_SHN_BEFORE_ALT1 "before"
-@ MSG_SHN_AFTER "SHN_AFTER" # 0xff01
-@ MSG_SHN_AFTER_ALT1 "after"
-@ MSG_SHN_AMD64_LCOMMON "SHN_AMD64_LCOMMON" # 0xff02
-@ MSG_SHN_AMD64_LCOMMON_ALT1 "amd64_lcommon"
-@ MSG_SHN_ABS "SHN_ABS" # 0xfff1
-@ MSG_SHN_ABS_ALT1 "abs"
-@ MSG_SHN_COMMON "SHN_COMMON" # 0xfff2
-@ MSG_SHN_COMMON_ALT1 "common"
-@ MSG_SHN_XINDEX "SHN_XINDEX" # 0xffff
-@ MSG_SHN_XINDEX_ALT1 "xindex"
-
-
# Names of sh_type SHT_* type constants
-@ MSG_SHT_NULL "SHT_NULL" # 0
-@ MSG_SHT_NULL_ALT1 "null"
-@ MSG_SHT_PROGBITS "SHT_PROGBITS" # 1
-@ MSG_SHT_PROGBITS_ALT1 "progbits"
@ MSG_SHT_SYMTAB "SHT_SYMTAB" # 2
@ MSG_SHT_SYMTAB_ALT1 "symtab"
@ MSG_SHT_STRTAB "SHT_STRTAB" # 3
@ MSG_SHT_STRTAB_ALT1 "strtab"
-@ MSG_SHT_RELA "SHT_RELA" # 4
-@ MSG_SHT_RELA_ALT1 "rela"
-@ MSG_SHT_HASH "SHT_HASH" # 5
-@ MSG_SHT_HASH_ALT1 "hash"
-@ MSG_SHT_DYNAMIC "SHT_DYNAMIC" # 6
-@ MSG_SHT_DYNAMIC_ALT1 "dynamic"
-@ MSG_SHT_NOTE "SHT_NOTE" # 7
-@ MSG_SHT_NOTE_ALT1 "note"
-@ MSG_SHT_NOBITS "SHT_NOBITS" # 8
-@ MSG_SHT_NOBITS_ALT1 "nobits"
-@ MSG_SHT_REL "SHT_REL" # 9
-@ MSG_SHT_REL_ALT1 "rel"
-@ MSG_SHT_SHLIB "SHT_SHLIB" # 10
-@ MSG_SHT_SHLIB_ALT1 "shlib"
@ MSG_SHT_DYNSYM "SHT_DYNSYM" # 11
@ MSG_SHT_DYNSYM_ALT1 "dynsym"
-@ MSG_SHT_INIT_ARRAY "SHT_INIT_ARRAY" # 14
-@ MSG_SHT_INIT_ARRAY_ALT1 "init_array"
-@ MSG_SHT_FINI_ARRAY "SHT_FINI_ARRAY" # 15
-@ MSG_SHT_FINI_ARRAY_ALT1 "fini_array"
-@ MSG_SHT_PREINIT_ARRAY "SHT_PREINIT_ARRAY" # 16
-@ MSG_SHT_PREINIT_ARRAY_ALT1 "preinit_ARRAY"
-@ MSG_SHT_GROUP "SHT_GROUP" # 17
-@ MSG_SHT_GROUP_ALT1 "group"
-@ MSG_SHT_SYMTAB_SHNDX "SHT_SYMTAB_SHNDX" # 18
-@ MSG_SHT_SYMTAB_SHNDX_ALT1 "symtab_shndx"
-@ MSG_SHT_SUNW_SYMSORT "SHT_SUNW_symsort" # 0x6ffffff1
-@ MSG_SHT_SUNW_SYMSORT_ALT1 "sunw_symsort"
-@ MSG_SHT_SUNW_TLSSORT "SHT_SUNW_tlssort" # 0x6ffffff2
-@ MSG_SHT_SUNW_TLSSORT_ALT1 "sunw_tlssort"
@ MSG_SHT_SUNW_LDYNSYM "SHT_SUNW_LDYNSYM" # 0x6ffffff3
@ MSG_SHT_SUNW_LDYNSYM_ALT1 "sunw_ldynsym"
-@ MSG_SHT_SUNW_DOF "SHT_SUNW_dof" # 0x6ffffff4
-@ MSG_SHT_SUNW_DOF_ALT1 "sunw_dof"
-@ MSG_SHT_SUNW_CAP "SHT_SUNW_cap" # 0x6ffffff5
-@ MSG_SHT_SUNW_CAP_ALT1 "sunw_cap"
-@ MSG_SHT_SUNW_SIGNATURE "SHT_SUNW_SIGNATURE" # 0x6ffffff6
-@ MSG_SHT_SUNW_SIGNATURE_ALT1 "sunw_signature"
-@ MSG_SHT_SUNW_ANNOTATE "SHT_SUNW_ANNOTATE" # 0x6ffffff7
-@ MSG_SHT_SUNW_ANNOTATE_ALT1 "sunw_annotate"
-@ MSG_SHT_SUNW_DEBUGSTR "SHT_SUNW_DEBUGSTR" # 0x6ffffff8
-@ MSG_SHT_SUNW_DEBUGSTR_ALT1 "sunw_debugstr"
-@ MSG_SHT_SUNW_DEBUG "SHT_SUNW_DEBUG" # 0x6ffffff9
-@ MSG_SHT_SUNW_DEBUG_ALT1 "sunw_debug"
-@ MSG_SHT_SUNW_MOVE "SHT_SUNW_move" # 0x6ffffffa
-@ MSG_SHT_SUNW_MOVE_ALT1 "sunw_move"
-@ MSG_SHT_SUNW_COMDAT "SHT_SUNW_COMDAT" # 0x6ffffffb
-@ MSG_SHT_SUNW_COMDAT_ALT1 "sunw_comdat"
-@ MSG_SHT_SUNW_SYMINFO "SHT_SUNW_syminfo" # 0x6ffffffc
-@ MSG_SHT_SUNW_SYMINFO_ALT1 "sunw_syminfo"
-@ MSG_SHT_SUNW_VERDEF "SHT_SUNW_verdef" # 0x6ffffffd
-@ MSG_SHT_SUNW_VERDEF_ALT1 "sunw_verdef"
-@ MSG_SHT_GNU_VERDEF "SHT_GNU_verdef" # 0x6ffffffd
-@ MSG_SHT_GNU_VERDEF_ALT1 "gnu_verdef"
-@ MSG_SHT_SUNW_VERNEED "SHT_SUNW_verneed" # 0x6ffffffe
-@ MSG_SHT_SUNW_VERNEED_ALT1 "sunw_verneed"
-@ MSG_SHT_GNU_VERNEED "SHT_GNU_verneed" # 0x6ffffffe
-@ MSG_SHT_GNU_VERNEED_ALT1 "gnu_verneed"
-@ MSG_SHT_SUNW_VERSYM "SHT_SUNW_versym" # 0x6fffffff
-@ MSG_SHT_SUNW_VERSYM_ALT1 "sunw_versym"
-@ MSG_SHT_GNU_VERSYM "SHT_GNU_versym" # 0x6fffffff
-@ MSG_SHT_GNU_VERSYM_ALT1 "gnu_versym"
-@ MSG_SHT_SPARC_GOTDATA "SHT_SPARC_GOTDATA" # 0x7000000
-@ MSG_SHT_SPARC_GOTDATA_ALT1 "sparc_gotdata"
-@ MSG_SHT_AMD64_UNWIND "SHT_AMD64_UNWIND" # 0x7000000
-@ MSG_SHT_AMD64_UNWIND_ALT1 "amd64_unwind"
-
-
-# Names of dynamic section entry tags
-
-@ MSG_DT_NULL "DT_NULL" # 0
-@ MSG_DT_NULL_ALT1 "null"
-@ MSG_DT_NEEDED "DT_NEEDED" # 1
-@ MSG_DT_NEEDED_ALT1 "needed"
-@ MSG_DT_PLTRELSZ "DT_PLTRELSZ" # 2
-@ MSG_DT_PLTRELSZ_ALT1 "pltrelsz"
-@ MSG_DT_PLTGOT "DT_PLTGOT" # 3
-@ MSG_DT_PLTGOT_ALT1 "pltgot"
-@ MSG_DT_HASH "DT_HASH" # 4
-@ MSG_DT_HASH_ALT1 "hash"
-@ MSG_DT_STRTAB "DT_STRTAB" # 5
-@ MSG_DT_STRTAB_ALT1 "strtab"
-@ MSG_DT_SYMTAB "DT_SYMTAB" # 6
-@ MSG_DT_SYMTAB_ALT1 "symtab"
-@ MSG_DT_RELA "DT_RELA" # 7
-@ MSG_DT_RELA_ALT1 "rela"
-@ MSG_DT_RELASZ "DT_RELASZ" # 8
-@ MSG_DT_RELASZ_ALT1 "relasz"
-@ MSG_DT_RELAENT "DT_RELAENT" # 9
-@ MSG_DT_RELAENT_ALT1 "relaent"
-@ MSG_DT_STRSZ "DT_STRSZ" # 10
-@ MSG_DT_STRSZ_ALT1 "strsz"
-@ MSG_DT_SYMENT "DT_SYMENT" # 11
-@ MSG_DT_SYMENT_ALT1 "syment"
-@ MSG_DT_INIT "DT_INIT" # 12
-@ MSG_DT_INIT_ALT1 "init"
-@ MSG_DT_FINI "DT_FINI" # 13
-@ MSG_DT_FINI_ALT1 "fini"
-@ MSG_DT_SONAME "DT_SONAME" # 14
-@ MSG_DT_SONAME_ALT1 "soname"
-@ MSG_DT_RPATH "DT_RPATH" # 15
-@ MSG_DT_RPATH_ALT1 "rpath"
-@ MSG_DT_SYMBOLIC "DT_SYMBOLIC" # 16
-@ MSG_DT_SYMBOLIC_ALT1 "symbolic"
-@ MSG_DT_REL "DT_REL" # 17
-@ MSG_DT_REL_ALT1 "rel"
-@ MSG_DT_RELSZ "DT_RELSZ" # 18
-@ MSG_DT_RELSZ_ALT1 "relsz"
-@ MSG_DT_RELENT "DT_RELENT" # 19
-@ MSG_DT_RELENT_ALT1 "relent"
-@ MSG_DT_PLTREL "DT_PLTREL" # 20
-@ MSG_DT_PLTREL_ALT1 "pltrel"
-@ MSG_DT_DEBUG "DT_DEBUG" # 21
-@ MSG_DT_DEBUG_ALT1 "debug"
-@ MSG_DT_TEXTREL "DT_TEXTREL" # 22
-@ MSG_DT_TEXTREL_ALT1 "textrel"
-@ MSG_DT_JMPREL "DT_JMPREL" # 23
-@ MSG_DT_JMPREL_ALT1 "jmprel"
-@ MSG_DT_BIND_NOW "DT_BIND_NOW" # 24
-@ MSG_DT_BIND_NOW_ALT1 "bind_now"
-@ MSG_DT_INIT_ARRAY "DT_INIT_ARRAY" # 25
-@ MSG_DT_INIT_ARRAY_ALT1 "init_array"
-@ MSG_DT_FINI_ARRAY "DT_FINI_ARRAY" # 26
-@ MSG_DT_FINI_ARRAY_ALT1 "fini_array"
-@ MSG_DT_INIT_ARRAYSZ "DT_INIT_ARRAYSZ" # 27
-@ MSG_DT_INIT_ARRAYSZ_ALT1 "init_arraysz"
-@ MSG_DT_FINI_ARRAYSZ "DT_FINI_ARRAYSZ" # 28
-@ MSG_DT_FINI_ARRAYSZ_ALT1 "fini_arraysz"
-@ MSG_DT_RUNPATH "DT_RUNPATH" # 29
-@ MSG_DT_RUNPATH_ALT1 "runpath"
-@ MSG_DT_FLAGS "DT_FLAGS" # 30
-@ MSG_DT_FLAGS_ALT1 "flags"
-@ MSG_DT_PREINIT_ARRAY "DT_PREINIT_ARRAY" # 32
-@ MSG_DT_PREINIT_ARRAY_ALT1 "preinit_array"
-@ MSG_DT_PREINIT_ARRAYSZ "DT_PREINIT_ARRAYSZ" # 33
-@ MSG_DT_PREINIT_ARRAYSZ_ALT1 "preinit_arraysz"
-@ MSG_DT_SUNW_AUXILIARY "DT_SUNW_AUXILIARY" # 0x6000000d
-@ MSG_DT_SUNW_AUXILIARY_ALT1 "sunw_auxiliary"
-@ MSG_DT_SUNW_RTLDINF "DT_SUNW_RTLDINF" # 0x6000000e
-@ MSG_DT_SUNW_RTLDINF_ALT1 "sunw_rtldinf"
-@ MSG_DT_SUNW_FILTER "DT_SUNW_FILTER" # 0x6000000f
-@ MSG_DT_SUNW_FILTER_ALT1 "sunw_filter"
-@ MSG_DT_SUNW_CAP "DT_SUNW_CAP" # 0x60000010
-@ MSG_DT_SUNW_CAP_ALT1 "sunw_cap"
-@ MSG_DT_SUNW_SYMTAB "DT_SUNW_SYMTAB" # 0x60000011
-@ MSG_DT_SUNW_SYMTAB_ALT1 "sunw_symtab"
-@ MSG_DT_SUNW_SYMSZ "DT_SUNW_SYMSZ" # 0x60000012
-@ MSG_DT_SUNW_SYMSZ_ALT1 "sunw_symsz"
-@ MSG_DT_SUNW_SORTENT "DT_SUNW_SORTENT" # 0x60000013
-@ MSG_DT_SUNW_SORTENT_ALT1 "sunw_sortent"
-@ MSG_DT_SUNW_SYMSORT "DT_SUNW_SYMSORT" # 0x60000014
-@ MSG_DT_SUNW_SYMSORT_ALT1 "sunw_symsort"
-@ MSG_DT_SUNW_SYMSORTSZ "DT_SUNW_SYMSORTSZ" # 0x60000015
-@ MSG_DT_SUNW_SYMSORTSZ_ALT1 "sunw_symsortsz"
-@ MSG_DT_SUNW_TLSSORT "DT_SUNW_TLSSORT" # 0x60000016
-@ MSG_DT_SUNW_TLSSORT_ALT1 "sunw_tlssort"
-@ MSG_DT_SUNW_TLSSORTSZ "DT_SUNW_TLSSORTSZ" # 0x60000017
-@ MSG_DT_SUNW_TLSSORTSZ_ALT1 "sunw_tlssortsz"
-@ MSG_DT_SUNW_STRPAD "DT_SUNW_STRPAD" # 0x60000019
-@ MSG_DT_SUNW_STRPAD_ALT1 "sunw_strpad"
-@ MSG_DT_SUNW_LDMACH "DT_SUNW_ldmach" # 0x6000001b
-@ MSG_DT_SUNW_LDMACH_ALT1 "sunw_ldmach"
-@ MSG_DT_SPARC_REGISTER "DT_SPARC_REGISTER" # 0x70000001
-@ MSG_DT_SPARC_REGISTER_ALT1 "sparc_register"
-@ MSG_DT_DEPRECATED_SPARC_REGISTER "DT_DEPRECATED_SPARC_REGISTER" # 0x7000001
-@ MSG_DT_DEPRECATED_SPARC_REGISTER_ALT1 "deprecated_sparc_register"
-@ MSG_DT_CHECKSUM "DT_CHECKSUM" # 0x6ffffdf8
-@ MSG_DT_CHECKSUM_ALT1 "checksum"
-@ MSG_DT_PLTPADSZ "DT_PLTPADSZ" # 0x6ffffdf9
-@ MSG_DT_PLTPADSZ_ALT1 "pltpadsz"
-@ MSG_DT_MOVEENT "DT_MOVEENT" # 0x6ffffdfa
-@ MSG_DT_MOVEENT_ALT1 "moveent"
-@ MSG_DT_MOVESZ "DT_MOVESZ" # 0x6ffffdfb
-@ MSG_DT_MOVESZ_ALT1 "movesz"
-@ MSG_DT_FEATURE_1 "DT_FEATURE_1" # 0x6ffffdfc
-@ MSG_DT_FEATURE_1_ALT1 "feature_1"
-@ MSG_DT_POSFLAG_1 "DT_POSFLAG_1" # 0x6ffffdfd
-@ MSG_DT_POSFLAG_1_ALT1 "posflag_1"
-@ MSG_DT_SYMINSZ "DT_SYMINSZ" # 0x6ffffdfe
-@ MSG_DT_SYMINSZ_ALT1 "syminsz"
-@ MSG_DT_SYMINENT "DT_SYMINENT" # 0x6ffffdff
-@ MSG_DT_SYMINENT_ALT1 "syminent"
-@ MSG_DT_CONFIG "DT_CONFIG" # 0x6ffffefa
-@ MSG_DT_CONFIG_ALT1 "config"
-@ MSG_DT_DEPAUDIT "DT_DEPAUDIT" # 0x6ffffefb
-@ MSG_DT_DEPAUDIT_ALT1 "depaudit"
-@ MSG_DT_AUDIT "DT_AUDIT" # 0x6ffffefc
-@ MSG_DT_AUDIT_ALT1 "audit"
-@ MSG_DT_PLTPAD "DT_PLTPAD" # 0x6ffffefd
-@ MSG_DT_PLTPAD_ALT1 "pltpad"
-@ MSG_DT_MOVETAB "DT_MOVETAB" # 0x6ffffefe
-@ MSG_DT_MOVETAB_ALT1 "movetab"
-@ MSG_DT_SYMINFO "DT_SYMINFO" # 0x6ffffeff
-@ MSG_DT_SYMINFO_ALT1 "syminfo"
-@ MSG_DT_VERSYM "DT_VERSYM" # 0x6ffffff0
-@ MSG_DT_VERSYM_ALT1 "versym"
-@ MSG_DT_RELACOUNT "DT_RELACOUNT" # 0x6ffffff9
-@ MSG_DT_RELACOUNT_ALT1 "relacount"
-@ MSG_DT_RELCOUNT "DT_RELCOUNT" # 0x6ffffffa
-@ MSG_DT_RELCOUNT_ALT1 "relcount"
-@ MSG_DT_FLAGS_1 "DT_FLAGS_1" # 0x6ffffffb
-@ MSG_DT_FLAGS_1_ALT1 "flags_1"
-@ MSG_DT_VERDEF "DT_VERDEF" # 0x6ffffffc
-@ MSG_DT_VERDEF_ALT1 "verdef"
-@ MSG_DT_VERDEFNUM "DT_VERDEFNUM" # 0x6ffffffd
-@ MSG_DT_VERDEFNUM_ALT1 "verdefnum"
-@ MSG_DT_VERNEED "DT_VERNEED" # 0x6ffffffe
-@ MSG_DT_VERNEED_ALT1 "verneed"
-@ MSG_DT_VERNEEDNUM "DT_VERNEEDNUM" # 0x6fffffff
-@ MSG_DT_VERNEEDNUM_ALT1 "verneednum"
-@ MSG_DT_AUXILIARY "DT_AUXILIARY" # 0x7ffffffd
-@ MSG_DT_AUXILIARY_ALT1 "auxiliary"
-@ MSG_DT_USED "DT_USED" # 0x7ffffffe
-@ MSG_DT_USED_ALT1 "used"
-@ MSG_DT_FILTER "DT_FILTER" # 0x7fffffff
-@ MSG_DT_FILTER_ALT1 "filter"
-
-
-# DT_FLAGS .dynamic entry
-@ MSG_DF_ORIGIN "DF_ORIGIN" # 0x00000001
-@ MSG_DF_ORIGIN_ALT1 "origin"
-@ MSG_DF_SYMBOLIC "DF_SYMBOLIC" # 0x00000002
-@ MSG_DF_SYMBOLIC_ALT1 "symbolic"
-@ MSG_DF_TEXTREL "DF_TEXTREL" # 0x00000004
-@ MSG_DF_TEXTREL_ALT1 "textrel"
-@ MSG_DF_BIND_NOW "DF_BIND_NOW" # 0x00000008
-@ MSG_DF_BIND_NOW_ALT1 "bind_now"
-@ MSG_DF_STATIC_TLS "DF_STATIC_TLS" # 0x00000010
-@ MSG_DF_STATIC_TLS_ALT1 "static_tls"
-
-
-# DT_POSFLAG_1 .dynamic entry
-
-@ MSG_DF_P1_LAZYLOAD "DF_P1_LAZYLOAD" # 0x00000001
-@ MSG_DF_P1_LAZYLOAD_ALT1 "lazyload"
-@ MSG_DF_P1_GROUPPERM "DF_P1_GROUPPERM" # 0x00000002
-@ MSG_DF_P1_GROUPPERM_ALT1 "groupperm"
-
-
-# DT_FLAGS_1 .dynamic entry
-
-@ MSG_DF_1_NOW "DF_1_NOW" # 0x00000001
-@ MSG_DF_1_NOW_ALT1 "now"
-@ MSG_DF_1_GLOBAL "DF_1_GLOBAL" # 0x00000002
-@ MSG_DF_1_GLOBAL_ALT1 "global"
-@ MSG_DF_1_GROUP "DF_1_GROUP" # 0x00000004
-@ MSG_DF_1_GROUP_ALT1 "group"
-@ MSG_DF_1_NODELETE "DF_1_NODELETE" # 0x00000008
-@ MSG_DF_1_NODELETE_ALT1 "nodelete"
-@ MSG_DF_1_LOADFLTR "DF_1_LOADFLTR" # 0x00000010
-@ MSG_DF_1_LOADFLTR_ALT1 "loadfltr"
-@ MSG_DF_1_INITFIRST "DF_1_INITFIRST" # 0x00000020
-@ MSG_DF_1_INITFIRST_ALT1 "initfirst"
-@ MSG_DF_1_NOOPEN "DF_1_NOOPEN" # 0x00000040
-@ MSG_DF_1_NOOPEN_ALT1 "noopen"
-@ MSG_DF_1_ORIGIN "DF_1_ORIGIN" # 0x00000080
-@ MSG_DF_1_ORIGIN_ALT1 "origin"
-@ MSG_DF_1_DIRECT "DF_1_DIRECT" # 0x00000100
-@ MSG_DF_1_DIRECT_ALT1 "direct"
-@ MSG_DF_1_TRANS "DF_1_TRANS" # 0x00000200
-@ MSG_DF_1_TRANS_ALT1 "trans"
-@ MSG_DF_1_INTERPOSE "DF_1_INTERPOSE" # 0x00000400
-@ MSG_DF_1_INTERPOSE_ALT1 "interpose"
-@ MSG_DF_1_NODEFLIB "DF_1_NODEFLIB" # 0x00000800
-@ MSG_DF_1_NODEFLIB_ALT1 "nodeflib"
-@ MSG_DF_1_NODUMP "DF_1_NODUMP" # 0x00001000
-@ MSG_DF_1_NODUMP_ALT1 "nodump"
-@ MSG_DF_1_CONFALT "DF_1_CONFALT" # 0x00002000
-@ MSG_DF_1_CONFALT_ALT1 "confalt"
-@ MSG_DF_1_ENDFILTEE "DF_1_ENDFILTEE" # 0x00004000
-@ MSG_DF_1_ENDFILTEE_ALT1 "endfiltee"
-@ MSG_DF_1_DISPRELDNE "DF_1_DISPRELDNE" # 0x00008000
-@ MSG_DF_1_DISPRELDNE_ALT1 "dispreldne"
-@ MSG_DF_1_DISPRELPND "DF_1_DISPRELPND" # 0x00010000
-@ MSG_DF_1_DISPRELPND_ALT1 "disprelpnd"
-@ MSG_DF_1_NODIRECT "DF_1_NODIRECT" # 0x00020000
-@ MSG_DF_1_NODIRECT_ALT1 "nodirect"
-@ MSG_DF_1_IGNMULDEF "DF_1_IGNMULDEF" # 0x00040000
-@ MSG_DF_1_IGNMULDEF_ALT1 "ignmuldef"
-@ MSG_DF_1_NOKSYMS "DF_1_NOKSYMS" # 0x00080000
-@ MSG_DF_1_NOKSYMS_ALT1 "noksyms"
-@ MSG_DF_1_NOHDR "DF_1_NOHDR" # 0x00100000
-@ MSG_DF_1_NOHDR_ALT1 "nohdr"
-@ MSG_DF_1_EDITED "DF_1_EDITED" # 0x00200000
-@ MSG_DF_1_EDITED_ALT1 "edited"
-@ MSG_DF_1_NORELOC "DF_1_NORELOC" # 0x00400000
-@ MSG_DF_1_NORELOC_ALT1 "noreloc"
-@ MSG_DF_1_SYMINTPOSE "DF_1_SYMINTPOSE" # 0x00800000
-@ MSG_DF_1_SYMINTPOSE_ALT1 "symintpose"
-@ MSG_DF_1_GLOBAUDIT "DF_1_GLOBAUDIT" # 0x01000000
-@ MSG_DF_1_GLOBAUDIT_ALT1 "globaudit"
-
-
-# DT_FEATURE_1 .dynamic entry
-
-@ MSG_DTF_1_PARINIT "DTF_1_PARINIT" # 0x00000001
-@ MSG_DTF_1_PARINIT_ALT1 "parinit"
-@ MSG_DTF_1_CONFEXP "DTF_1_CONFEXP" # 0x00000002
-@ MSG_DTF_1_CONFEXP_ALT1 "confexp"
-
-
-# EI_* indexes into ELF header e_ident[] array
-
-@ MSG_EI_MAG0 "EI_MAG0" # 0
-@ MSG_EI_MAG0_ALT1 "mag0"
-@ MSG_EI_MAG1 "EI_MAG1" # 1
-@ MSG_EI_MAG1_ALT1 "mag1"
-@ MSG_EI_MAG2 "EI_MAG2" # 2
-@ MSG_EI_MAG2_ALT1 "mag2"
-@ MSG_EI_MAG3 "EI_MAG3" # 3
-@ MSG_EI_MAG3_ALT1 "mag3"
-@ MSG_EI_CLASS "EI_CLASS" # 4
-@ MSG_EI_CLASS_ALT1 "class"
-@ MSG_EI_DATA "EI_DATA" # 5
-@ MSG_EI_DATA_ALT1 "data"
-@ MSG_EI_VERSION "EI_VERSION" # 6
-@ MSG_EI_VERSION_ALT1 "version"
-@ MSG_EI_OSABI "EI_OSABI" # 7
-@ MSG_EI_OSABI_ALT1 "osabi"
-@ MSG_EI_ABIVERSION "EI_ABIVERSION" # 8
-@ MSG_EI_ABIVERSION_ALT1 "abiversion"
-
-
-# ET_* type constants
-
-@ MSG_ET_NONE "ET_NONE" # 0
-@ MSG_ET_NONE_ALT1 "none"
-@ MSG_ET_REL "ET_REL" # 1
-@ MSG_ET_REL_ALT1 "rel"
-@ MSG_ET_EXEC "ET_EXEC" # 2
-@ MSG_ET_EXEC_ALT1 "exec"
-@ MSG_ET_DYN "ET_DYN" # 3
-@ MSG_ET_DYN_ALT1 "dyn"
-@ MSG_ET_CORE "ET_CORE" # 4
-@ MSG_ET_CORE_ALT1 "core"
-
-
-# ELFCLASS* constants
-
-@ MSG_ELFCLASSNONE "ELFCLASSNONE" # 0
-@ MSG_ELFCLASSNONE_ALT1 "none"
-@ MSG_ELFCLASS32 "ELFCLASS32" # 1
-@ MSG_ELFCLASS32_ALT1 "32"
-@ MSG_ELFCLASS64 "ELFCLASS64" # 2
-@ MSG_ELFCLASS64_ALT1 "64"
-
-
-# ELFDATA* constants
-
-@ MSG_ELFDATANONE "ELFDATANONE" # 0
-@ MSG_ELFDATANONE_ALT1 "none"
-@ MSG_ELFDATA2LSB "ELFDATA2LSB" # 1
-@ MSG_ELFDATA2LSB_ALT1 "lsb"
-@ MSG_ELFDATA2MSB "ELFDATA2MSB" # 2
-@ MSG_ELFDATA2MSB_ALT1 "msb"
-
-
-# Elf header EF_* flags
-
-@ MSG_EF_SPARC_32PLUS "EF_SPARC_32PLUS" # 0x000100
-@ MSG_EF_SPARC_32PLUS_ALT1 "sparc_32plus"
-@ MSG_EF_SPARC_SUN_US1 "EF_SPARC_SUN_US1" # 0x000200
-@ MSG_EF_SPARC_SUN_US1_ALT1 "sparc_sun_us1"
-@ MSG_EF_SPARC_HAL_R1 "EF_SPARC_HAL_R1" # 0x000400
-@ MSG_EF_SPARC_HAL_R1_ALT1 "sparc_hal_r1"
-@ MSG_EF_SPARC_SUN_US3 "EF_SPARC_SUN_US3" # x000800
-@ MSG_EF_SPARC_SUN_US3_ALT1 "sparc_sun_us3"
-@ MSG_EF_SPARCV9_MM "EF_SPARCV9_MM" # 0x3
-@ MSG_EF_SPARCV9_MM_ALT1 "sparcv9_mm"
-@ MSG_EF_SPARCV9_TSO "EF_SPARCV9_TSO" # 0x0
-@ MSG_EF_SPARCV9_TSO_ALT1 "sparcv9_tso"
-@ MSG_EF_SPARCV9_PSO "EF_SPARCV9_PSO" # 0x1
-@ MSG_EF_SPARCV9_PSO_ALT1 "sparcv9_pso"
-@ MSG_EF_SPARCV9_RMO "EF_SPARCV9_RMO" # 0x2
-@ MSG_EF_SPARCV9_RMO_ALT1 "sparcv9_rmo"
-
-
-# Elf header EV_* versions
-
-@ MSG_EV_NONE "EV_NONE" # 0
-@ MSG_EV_NONE_ALT1 "none"
-@ MSG_EV_CURRENT "EV_CURRENT" # 1
-@ MSG_EV_CURRENT_ALT1 "current"
-
-
-# EM_* machine names. Note that there is more than one string for some
-# of these. The main name for each one is the same as it's constant
-# name in sys/elf.h, and start with the EM_ prefix. The alternative names
-# are the alternative names provided by libconv.
-
-@ MSG_EM_NONE "EM_NONE" # 0
-@ MSG_EM_NONE_ALT1 "none"
-@ MSG_EM_M32 "EM_M32" # 1
-@ MSG_EM_M32_ALT1 "m32"
-@ MSG_EM_M32_ALT2 "WE32100"
-@ MSG_EM_SPARC "EM_SPARC" # 2
-@ MSG_EM_SPARC_ALT1 "sparc"
-@ MSG_EM_386 "EM_386" # 3
-@ MSG_EM_386_ALT1 "386"
-@ MSG_EM_386_ALT2 "80386"
-@ MSG_EM_68K "EM_68K" # 4
-@ MSG_EM_68K_ALT1 "68k"
-@ MSG_EM_68K_ALT2 "68000"
-@ MSG_EM_88K "EM_88K" # 5
-@ MSG_EM_88K_ALT1 "88k"
-@ MSG_EM_88K_ALT2 "88000"
-@ MSG_EM_486 "EM_486" # 6
-@ MSG_EM_486_ALT1 "486"
-@ MSG_EM_486_ALT2 "80486"
-@ MSG_EM_860 "EM_860" # 7
-@ MSG_EM_860_ALT1 "860"
-@ MSG_EM_860_ALT2 "i860"
-@ MSG_EM_MIPS "EM_MIPS" # 8
-@ MSG_EM_MIPS_ALT1 "mips"
-@ MSG_EM_MIPS_ALT2 "rs3000_be"
-@ MSG_EM_S370 "EM_S370" # 9
-@ MSG_EM_S370_ALT1 "s370"
-@ MSG_EM_MIPS_RS3_LE "EM_MIPS_RS3_LE" # 10
-@ MSG_EM_MIPS_RS3_LE_ALT1 "mips_rs3_le"
-@ MSG_EM_MIPS_RS3_LE_ALT2 "RS3000_LE"
-@ MSG_EM_RS6000 "EM_RS6000" # 11
-@ MSG_EM_RS6000_ALT1 "rs6000"
-@ MSG_EM_PA_RISC "EM_PA_RISC" # 15
-@ MSG_EM_PA_RISC_ALT1 "pa_risc"
-@ MSG_EM_NCUBE "EM_nCUBE" # 16
-@ MSG_EM_NCUBE_ALT1 "ncube"
-@ MSG_EM_VPP500 "EM_VPP500" # 17
-@ MSG_EM_VPP500_ALT1 "vpp500"
-@ MSG_EM_SPARC32PLUS "EM_SPARC32PLUS" # 18
-@ MSG_EM_SPARC32PLUS_ALT1 "sparc32plus"
-@ MSG_EM_960 "EM_960" # 19
-@ MSG_EM_960_ALT1 "960"
-@ MSG_EM_PPC "EM_PPC" # 20
-@ MSG_EM_PPC_ALT1 "ppc"
-@ MSG_EM_PPC_ALT2 "PowerPC"
-@ MSG_EM_PPC64 "EM_PPC64" #21
-@ MSG_EM_PPC64_ALT1 "ppc64"
-@ MSG_EM_PPC64_ALT2 "PowerPC64"
-@ MSG_EM_S390 "EM_S390" #22
-@ MSG_EM_S390_ALT1 "s390"
-@ MSG_EM_V800 "EM_V800" #36
-@ MSG_EM_V800_ALT1 "v800"
-@ MSG_EM_FR20 "EM_FR20" #37
-@ MSG_EM_FR20_ALT1 "fr20"
-@ MSG_EM_RH32 "EM_RH32" #38
-@ MSG_EM_RH32_ALT1 "rh32"
-@ MSG_EM_RCE "EM_RCE" #39
-@ MSG_EM_RCE_ALT1 "rce"
-@ MSG_EM_ARM "EM_ARM" #40
-@ MSG_EM_ARM_ALT1 "arm"
-@ MSG_EM_ALPHA "EM_ALPHA" #41
-@ MSG_EM_ALPHA_ALT1 "alpha"
-@ MSG_EM_SH "EM_SH" #42
-@ MSG_EM_SH_ALT1 "sh"
-@ MSG_EM_SPARCV9 "EM_SPARCV9" #43
-@ MSG_EM_SPARCV9_ALT1 "sparcv9"
-@ MSG_EM_TRICORE "EM_TRICORE" #44
-@ MSG_EM_TRICORE_ALT1 "tricore"
-@ MSG_EM_ARC "EM_ARC" #45
-@ MSG_EM_ARC_ALT1 "arc"
-@ MSG_EM_H8_300 "EM_H8_300" #46
-@ MSG_EM_H8_300_ALT1 "h8_300"
-@ MSG_EM_H8_300H "EM_H8_300H" #47
-@ MSG_EM_H8_300H_ALT1 "h8_300h"
-@ MSG_EM_H8S "EM_H8S" #48
-@ MSG_EM_H8S_ALT1 "h8s"
-@ MSG_EM_H8_500 "EM_H8_500" #49
-@ MSG_EM_H8_500_ALT1 "h8_500"
-@ MSG_EM_IA_64 "EM_IA_64" #50
-@ MSG_EM_IA_64_ALT1 "ia_64"
-@ MSG_EM_MIPS_X "EM_MIPS_X" #51
-@ MSG_EM_MIPS_X_ALT1 "mips_x"
-@ MSG_EM_COLDFIRE "EM_COLDFIRE" #52
-@ MSG_EM_COLDFIRE_ALT1 "coldfire"
-@ MSG_EM_68HC12 "EM_68HC12" #53
-@ MSG_EM_68HC12_ALT1 "68hc12"
-@ MSG_EM_MMA "EM_MMA" #54
-@ MSG_EM_MMA_ALT1 "mma"
-@ MSG_EM_PCP "EM_PCP" #55
-@ MSG_EM_PCP_ALT1 "pcp"
-@ MSG_EM_NCPU "EM_NCPU" #56
-@ MSG_EM_NCPU_ALT1 "ncpu"
-@ MSG_EM_NDR1 "EM_NDR1" #57
-@ MSG_EM_NDR1_ALT1 "ndr1"
-@ MSG_EM_STARCORE "EM_STARCORE" #58
-@ MSG_EM_STARCORE_ALT1 "starcore"
-@ MSG_EM_ME16 "EM_ME16" #59
-@ MSG_EM_ME16_ALT1 "me16"
-@ MSG_EM_ST100 "EM_ST100" #60
-@ MSG_EM_ST100_ALT1 "st100"
-@ MSG_EM_TINYJ "EM_TINYJ" #61
-@ MSG_EM_TINYJ_ALT1 "tinyj"
-@ MSG_EM_AMD64 "EM_AMD64" #62
-@ MSG_EM_AMD64_ALT1 "amd64"
-@ MSG_EM_PDSP "EM_PDSP" #63
-@ MSG_EM_PDSP_ALT1 "pdsp"
-@ MSG_EM_FX66 "EM_FX66" #66
-@ MSG_EM_FX66_ALT1 "fx66"
-@ MSG_EM_ST9PLUS "EM_ST9PLUS" #67
-@ MSG_EM_ST9PLUS_ALT1 "st9plus"
-@ MSG_EM_ST7 "EM_ST7" #68
-@ MSG_EM_ST7_ALT1 "st7"
-@ MSG_EM_68HC16 "EM_68HC16" #69
-@ MSG_EM_68HC16_ALT1 "68hc16"
-@ MSG_EM_68HC11 "EM_68HC11" #70
-@ MSG_EM_68HC11_ALT1 "68hc11"
-@ MSG_EM_68HC08 "EM_68HC08" #71
-@ MSG_EM_68HC08_ALT1 "68hc08"
-@ MSG_EM_68HC05 "EM_68HC05" #72
-@ MSG_EM_68HC05_ALT1 "68hc05"
-@ MSG_EM_SVX "EM_SVX" #73
-@ MSG_EM_SVX_ALT1 "svx"
-@ MSG_EM_ST19 "EM_ST19" #74
-@ MSG_EM_ST19_ALT1 "st19"
-@ MSG_EM_VAX "EM_VAX" #75
-@ MSG_EM_VAX_ALT1 "vax"
-@ MSG_EM_CRIS "EM_CRIS" #76
-@ MSG_EM_CRIS_ALT1 "cris"
-@ MSG_EM_JAVELIN "EM_JAVELIN" #77
-@ MSG_EM_JAVELIN_ALT1 "javelin"
-@ MSG_EM_FIREPATH "EM_FIREPATH" #78
-@ MSG_EM_FIREPATH_ALT1 "firepath"
-@ MSG_EM_ZSP "EM_ZSP" #79
-@ MSG_EM_ZSP_ALT1 "zsp"
-@ MSG_EM_MMIX "EM_MMIX" #80
-@ MSG_EM_MMIX_ALT1 "mmix"
-@ MSG_EM_HUANY "EM_HUANY" #81
-@ MSG_EM_HUANY_ALT1 "huany"
-@ MSG_EM_PRISM "EM_PRISM" #82
-@ MSG_EM_PRISM_ALT1 "prism"
-@ MSG_EM_AVR "EM_AVR" #83
-@ MSG_EM_AVR_ALT1 "avr"
-@ MSG_EM_FR30 "EM_FR30" #84
-@ MSG_EM_FR30_ALT1 "fr30"
-@ MSG_EM_D10V "EM_D10V" #85
-@ MSG_EM_D10V_ALT1 "d10v"
-@ MSG_EM_D30V "EM_D30V" #86
-@ MSG_EM_D30V_ALT1 "d30v"
-@ MSG_EM_V850 "EM_V850" #87
-@ MSG_EM_V850_ALT1 "v850"
-@ MSG_EM_M32R "EM_M32R" #88
-@ MSG_EM_M32R_ALT1 "m32r"
-@ MSG_EM_MN10300 "EM_MN10300" #89
-@ MSG_EM_MN10300_ALT1 "mn10300"
-@ MSG_EM_MN10200 "EM_MN10200" #90
-@ MSG_EM_MN10200_ALT1 "mn10200"
-@ MSG_EM_PJ "EM_PJ" #91
-@ MSG_EM_PJ_ALT1 "pj"
-@ MSG_EM_OPENRISC "EM_OPENRISC" #92
-@ MSG_EM_OPENRISC_ALT1 "openrisc"
-@ MSG_EM_ARC_A5 "EM_ARC_A5" #93
-@ MSG_EM_ARC_A5_ALT1 "arc_a5"
-@ MSG_EM_XTENSA "EM_XTENSA" #94
-@ MSG_EM_XTENSA_ALT1 "xtensa"
-
-
-
-# ELFOSABI names
-
-@ MSG_ELFOSABI_NONE "ELFOSABI_NONE"
-@ MSG_ELFOSABI_NONE_ALT1 "none"
-@ MSG_ELFOSABI_SYSV "ELFOSABI_SYSV"
-@ MSG_ELFOSABI_SYSV_ALT1 "sysv"
-@ MSG_ELFOSABI_HPUX "ELFOSABI_HPUX"
-@ MSG_ELFOSABI_HPUX_ALT1 "hpux"
-@ MSG_ELFOSABI_NETBSD "ELFOSABI_NETBSD"
-@ MSG_ELFOSABI_NETBSD_ALT1 "netbsd"
-@ MSG_ELFOSABI_LINUX "ELFOSABI_LINUX"
-@ MSG_ELFOSABI_LINUX_ALT1 "linux"
-@ MSG_ELFOSABI_SOLARIS "ELFOSABI_SOLARIS"
-@ MSG_ELFOSABI_SOLARIS_ALT1 "solaris"
-@ MSG_ELFOSABI_AIX "ELFOSABI_AIX"
-@ MSG_ELFOSABI_AIX_ALT1 "aix"
-@ MSG_ELFOSABI_IRIX "ELFOSABI_IRIX"
-@ MSG_ELFOSABI_IRIX_ALT1 "irix"
-@ MSG_ELFOSABI_FREEBSD "ELFOSABI_FREEBSD"
-@ MSG_ELFOSABI_FREEBSD_ALT1 "freebsd"
-@ MSG_ELFOSABI_TRU64 "ELFOSABI_TRU64"
-@ MSG_ELFOSABI_TRU64_ALT1 "tru64"
-@ MSG_ELFOSABI_MODESTO "ELFOSABI_MODESTO"
-@ MSG_ELFOSABI_MODESTO_ALT1 "modesto"
-@ MSG_ELFOSABI_OPENBSD "ELFOSABI_OPENBSD"
-@ MSG_ELFOSABI_OPENBSD_ALT1 "openbsd"
-@ MSG_ELFOSABI_OPENVMS "ELFOSABI_OPENVMS"
-@ MSG_ELFOSABI_OPENVMS_ALT1 "openvms"
-@ MSG_ELFOSABI_NSK "ELFOSABI_NSK"
-@ MSG_ELFOSABI_NSK_ALT1 "nsk"
-@ MSG_ELFOSABI_AROS "ELFOSABI_AROS"
-@ MSG_ELFOSABI_AROS_ALT1 "aros"
-@ MSG_ELFOSABI_ARM "ELFOSABI_ARM"
-@ MSG_ELFOSABI_ARM_ALT1 "arm"
-@ MSG_ELFOSABI_STANDALONE "ELFOSABI_STANDALONE"
-@ MSG_ELFOSABI_STANDALONE_ALT1 "standalone"
-
-
-# Program header PT_ segment types
-
-@ MSG_PT_NULL "PT_NULL" # 0
-@ MSG_PT_NULL_ALT1 "null"
-@ MSG_PT_LOAD "PT_LOAD" # 1
-@ MSG_PT_LOAD_ALT1 "load"
-@ MSG_PT_DYNAMIC "PT_DYNAMIC" # 2
-@ MSG_PT_DYNAMIC_ALT1 "dynamic"
-@ MSG_PT_INTERP "PT_INTERP" # 3
-@ MSG_PT_INTERP_ALT1 "interp"
-@ MSG_PT_NOTE "PT_NOTE" # 4
-@ MSG_PT_NOTE_ALT1 "note"
-@ MSG_PT_SHLIB "PT_SHLIB" # 5
-@ MSG_PT_SHLIB_ALT1 "shlib"
-@ MSG_PT_PHDR "PT_PHDR" # 6
-@ MSG_PT_PHDR_ALT1 "phdr"
-@ MSG_PT_TLS "PT_TLS" # 7
-@ MSG_PT_TLS_ALT1 "tls"
-@ MSG_PT_SUNW_UNWIND "PT_SUNW_UNWIND" # 0x6464e550
-@ MSG_PT_SUNW_UNWIND_ALT1 "sunw_unwind"
-@ MSG_PT_SUNW_EH_FRAME "PT_SUNW_EH_FRAME" # 0x6474e550
-@ MSG_PT_SUNW_EH_FRAME_ALT1 "sunw_eh_frame"
-@ MSG_PT_SUNWBSS "PT_SUNWBSS" # 0x6ffffffa
-@ MSG_PT_SUNWBSS_ALT1 "sunwbss"
-@ MSG_PT_SUNWSTACK "PT_SUNWSTACK" # 0x6ffffffb
-@ MSG_PT_SUNWSTACK_ALT1 "sunwstack"
-@ MSG_PT_SUNWDTRACE "PT_SUNWDTRACE" # 0x6ffffffc
-@ MSG_PT_SUNWDTRACE_ALT1 "sunwdtrace"
-@ MSG_PT_SUNWCAP "PT_SUNWCAP" # 0x6ffffffd
-@ MSG_PT_SUNWCAP_ALT1 "sunwcap"
-
-
-# Program header PF_ segment flags
-
-@ MSG_PF_X "PF_X" # 0x1
-@ MSG_PF_X_ALT1 "x"
-@ MSG_PF_W "PF_W" # 0x2
-@ MSG_PF_W_ALT1 "w"
-@ MSG_PF_R "PF_R" # 0x4
-@ MSG_PF_R_ALT1 "r"
-
-
-# Section header SHF_* flags
-
-@ MSG_SHF_WRITE "SHF_WRITE" # 0x01
-@ MSG_SHF_WRITE_ALT1 "write"
-@ MSG_SHF_ALLOC "SHF_ALLOC" # 0x02
-@ MSG_SHF_ALLOC_ALT1 "alloc"
-@ MSG_SHF_EXECINSTR "SHF_EXECINSTR" # 0x04
-@ MSG_SHF_EXECINSTR_ALT1 "execinstr"
-@ MSG_SHF_MERGE "SHF_MERGE" # 0x10
-@ MSG_SHF_MERGE_ALT1 "merge"
-@ MSG_SHF_STRINGS "SHF_STRINGS" # 0x20
-@ MSG_SHF_STRINGS_ALT1 "strings"
-@ MSG_SHF_INFO_LINK "SHF_INFO_LINK" # 0x40
-@ MSG_SHF_INFO_LINK_ALT1 "info_link"
-@ MSG_SHF_LINK_ORDER "SHF_LINK_ORDER" # 0x80
-@ MSG_SHF_LINK_ORDER_ALT1 "link_order"
-@ MSG_SHF_OS_NONCONFORMING "SHF_OS_NONCONFORMING" # 0x100
-@ MSG_SHF_OS_NONCONFORMING_ALT1 "os_nonconforming"
-@ MSG_SHF_GROUP "SHF_GROUP" # 0x200
-@ MSG_SHF_GROUP_ALT1 "group"
-@ MSG_SHF_TLS "SHF_TLS" # 0x400
-@ MSG_SHF_TLS_ALT1 "tls"
-@ MSG_SHF_AMD64_LARGE "SHF_AMD64_LARGE" # 0x10000000
-@ MSG_SHF_AMD64_LARGE_ALT1 "amd64_large"
-@ MSG_SHF_ORDERED "SHF_ORDERED" # 0x40000000
-@ MSG_SHF_ORDERED_ALT1 "ordered"
-@ MSG_SHF_EXCLUDE "SHF_EXCLUDE" # 0x80000000
-@ MSG_SHF_EXCLUDE_ALT1 "exclude"
-
-
-# Names of st_info ELF_ST_BIND symbol binding constants
-
-@ MSG_STB_LOCAL "STB_LOCAL" # 0
-@ MSG_STB_LOCAL_ALT1 "local"
-@ MSG_STB_GLOBAL "STB_GLOBAL" # 1
-@ MSG_STB_GLOBAL_ALT1 "global"
-@ MSG_STB_WEAK "STB_WEAK" # 2
-@ MSG_STB_WEAK_ALT1 "weak"
-
-
-# Names of st_info ELF_ST_TYPE symbol type constants
-
-@ MSG_STT_NOTYPE "STT_NOTYPE" # 0
-@ MSG_STT_NOTYPE_ALT1 "notype"
-@ MSG_STT_OBJECT "STT_OBJECT" # 1
-@ MSG_STT_OBJECT_ALT1 "object"
-@ MSG_STT_FUNC "STT_FUNC" # 2
-@ MSG_STT_FUNC_ALT1 "func"
-@ MSG_STT_SECTION "STT_SECTION" # 3
-@ MSG_STT_SECTION_ALT1 "section"
-@ MSG_STT_FILE "STT_FILE" # 4
-@ MSG_STT_FILE_ALT1 "file"
-@ MSG_STT_COMMON "STT_COMMON" # 5
-@ MSG_STT_COMMON_ALT1 "common"
-@ MSG_STT_TLS "STT_TLS" # 6
-@ MSG_STT_TLS_ALT1 "tls"
-
-
-# Names of st_other ELF_ST_VISIBILITY symbol visibility constants
-
-@ MSG_STV_DEFAULT "STV_DEFAULT" # 0
-@ MSG_STV_DEFAULT_ALT1 "default"
-@ MSG_STV_INTERNAL "STV_INTERNAL" # 1
-@ MSG_STV_INTERNAL_ALT1 "internal"
-@ MSG_STV_HIDDEN "STV_HIDDEN" # 2
-@ MSG_STV_HIDDEN_ALT1 "hidden"
-@ MSG_STV_PROTECTED "STV_PROTECTED" # 3
-@ MSG_STV_PROTECTED_ALT1 "protected"
-@ MSG_STV_EXPORTED "STV_EXPORTED" # 4
-@ MSG_STV_EXPORTED_ALT1 "exported"
-@ MSG_STV_SINGLETON "STV_SINGLETON" # 5
-@ MSG_STV_SINGLETON_ALT1 "singleton"
-@ MSG_STV_ELIMINATE "STV_ELIMINATE" # 6
-@ MSG_STV_ELIMINATE_ALT1 "eliminate"
-
-
-# Names of si_boundto SYMINFO_BT_ symbol type constants
-
-@ MSG_SYMINFO_BT_SELF "SYMINFO_BT_SELF" # 0xffff
-@ MSG_SYMINFO_BT_SELF_ALT1 "self"
-@ MSG_SYMINFO_BT_PARENT "SYMINFO_BT_PARENT" # 0xfffe
-@ MSG_SYMINFO_BT_PARENT_ALT1 "parent"
-@ MSG_SYMINFO_BT_NONE "SYMINFO_BT_NONE" # 0xfffd
-@ MSG_SYMINFO_BT_NONE_ALT1 "none"
-
-
-# Names of si_flags SYMINFO_FLG_ symbol type constants
-
-@ MSG_SYMINFO_FLG_DIRECT "SYMINFO_FLG_DIRECT" # 0x01
-@ MSG_SYMINFO_FLG_DIRECT_ALT1 "direct"
-@ MSG_SYMINFO_FLG_COPY "SYMINFO_FLG_COPY" # 0x04
-@ MSG_SYMINFO_FLG_COPY_ALT1 "copy"
-@ MSG_SYMINFO_FLG_LAZYLOAD "SYMINFO_FLG_LAZYLOAD" # 0x08
-@ MSG_SYMINFO_FLG_LAZYLOAD_ALT1 "lazyload"
-@ MSG_SYMINFO_FLG_DIRECTBIND "SYMINFO_FLG_DIRECTBIND" # 0x10
-@ MSG_SYMINFO_FLG_DIRECTBIND_ALT1 "directbind"
-@ MSG_SYMINFO_FLG_NOEXTDIRECT "SYMINFO_FLG_NOEXTDIRECT" # 0x20
-@ MSG_SYMINFO_FLG_NOEXTDIRECT_ALT1 "noextdirect"
-
-
-# Names of capabilities section CA_ tag
-
-@ MSG_CA_SUNW_NULL "CA_SUNW_NULL" # 0
-@ MSG_CA_SUNW_NULL_ALT1 "null"
-@ MSG_CA_SUNW_HW_1 "CA_SUNW_HW_1" # 1
-@ MSG_CA_SUNW_HW_1_ALT1 "hw_1"
-@ MSG_CA_SUNW_SF_1 "CA_SUNW_SF_1" # 2
-@ MSG_CA_SUNW_SF_1_ALT1 "sf_1"
+
# ISA strings. These could be separated into separate message modules
# on a per-platform basis if their size became large, but this is probably
diff --git a/usr/src/cmd/sgs/elfedit/common/lintsup.c b/usr/src/cmd/sgs/elfedit/common/lintsup.c
index 23114850d2..353c8f6577 100644
--- a/usr/src/cmd/sgs/elfedit/common/lintsup.c
+++ b/usr/src/cmd/sgs/elfedit/common/lintsup.c
@@ -20,14 +20,12 @@
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* LINTLIBRARY */
/* PROTOLIB1 */
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* Supplemental Pseudo-code to get lint to consider these symbols used.
*/
@@ -104,7 +102,6 @@ foo()
(void) elfedit_modified_ehdr(NULL);
(void) elfedit_modified_phdr(NULL);
(void) elfedit_modified_shdr(NULL);
- (void) elfedit_mach_sunw_hw1_to_atoui(0);
(void) elfedit_name_to_shndx(NULL, NULL);
(void) elfedit_name_to_symndx(NULL, NULL, NULL, ELFEDIT_MSG_ERR, NULL);
(void) elfedit_outstyle();
diff --git a/usr/src/cmd/sgs/elfedit/common/mapfile-vers b/usr/src/cmd/sgs/elfedit/common/mapfile-vers
index 5b7236ea0f..f5f6c52c96 100644
--- a/usr/src/cmd/sgs/elfedit/common/mapfile-vers
+++ b/usr/src/cmd/sgs/elfedit/common/mapfile-vers
@@ -70,7 +70,6 @@
# ato[u]i routines
elfedit_const_to_atoui;
- elfedit_mach_sunw_hw1_to_atoui;
elfedit_atoi;
elfedit_atoui;
@@ -195,6 +194,9 @@
elfedit32_strtab_insert_test;
elfedit64_strtab_insert_test;
+ elfedit32_test_osabi;
+ elfedit64_test_osabi;
+
elfedit32_type_to_shndx;
elfedit64_type_to_shndx;
diff --git a/usr/src/cmd/sgs/elfedit/common/util_machelf.c b/usr/src/cmd/sgs/elfedit/common/util_machelf.c
index 2e6f20cd03..81aec5762e 100644
--- a/usr/src/cmd/sgs/elfedit/common/util_machelf.c
+++ b/usr/src/cmd/sgs/elfedit/common/util_machelf.c
@@ -20,10 +20,9 @@
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdlib.h>
#include <stdio.h>
@@ -164,7 +163,9 @@ elfedit_type_to_shndx(elfedit_obj_state_t *obj_state, Word shtype)
elfedit_msg(ELFEDIT_MSG_DEBUG,
MSG_INTL(MSG_DEBUG_SHNAM2NDX),
EC_WORD(sec->sec_shndx), sec->sec_name,
- conv_sec_type(obj_state->os_ehdr->e_machine,
+ conv_sec_type(
+ obj_state->os_ehdr->e_ident[EI_OSABI],
+ obj_state->os_ehdr->e_machine,
shtype, 0, &inv_buf));
return (ndx);
}
@@ -172,7 +173,8 @@ elfedit_type_to_shndx(elfedit_obj_state_t *obj_state, Word shtype)
/* If didn't return in loop above, the name doesn't match */
elfedit_msg(ELFEDIT_MSG_ERR, MSG_INTL(MSG_ERR_NOSECTYP),
- conv_sec_type(obj_state->os_ehdr->e_machine, shtype, 0, &inv_buf));
+ conv_sec_type(obj_state->os_ehdr->e_ident[EI_OSABI],
+ obj_state->os_ehdr->e_machine, shtype, 0, &inv_buf));
/*NOTREACHED*/
return (SHN_UNDEF);
}
@@ -262,34 +264,8 @@ elfedit_shndx_to_name(elfedit_obj_state_t *obj_state, Word shndx)
* without requiring the caller to supply a buffer (the size of
* which they don't know).
*/
- static char buf1[64], buf2[64];
- static char *buf;
-
- if ((obj_state->os_ehdr->e_machine == EM_AMD64) &&
- (shndx == SHN_AMD64_LCOMMON))
- return (MSG_ORIG(MSG_SHN_AMD64_LCOMMON));
-
- switch (shndx) {
- case SHN_UNDEF:
- return (MSG_ORIG(MSG_SHN_UNDEF));
- case SHN_SUNW_IGNORE:
- return (MSG_ORIG(MSG_SHN_SUNW_IGNORE));
- case SHN_BEFORE:
- return (MSG_ORIG(MSG_SHN_BEFORE));
- case SHN_AFTER:
- return (MSG_ORIG(MSG_SHN_AFTER));
- case SHN_AMD64_LCOMMON:
- if (obj_state->os_ehdr->e_machine == EM_AMD64)
- return (MSG_ORIG(MSG_SHN_AMD64_LCOMMON));
- break;
- case SHN_ABS:
- return (MSG_ORIG(MSG_SHN_ABS));
- case SHN_COMMON:
- return (MSG_ORIG(MSG_SHN_COMMON));
- case SHN_XINDEX:
- return (MSG_ORIG(MSG_SHN_XINDEX));
- }
-
+ static Conv_inv_buf_t buf1, buf2;
+ static Conv_inv_buf_t *buf;
/*
* If it is outside of the reserved area, and inside the
@@ -297,19 +273,18 @@ elfedit_shndx_to_name(elfedit_obj_state_t *obj_state, Word shndx)
* the section name.
*/
if ((shndx < obj_state->os_shnum) &&
- ((shndx < SHN_LORESERVE) || (shndx > SHN_HIRESERVE)))
+ ((shndx < SHN_LORESERVE) || (shndx > SHN_HIRESERVE)) &&
+ (shndx != SHN_UNDEF))
return (obj_state->os_secarr[shndx].sec_name);
- /* Switch buffers */
- buf = (buf == buf1) ? buf2 : buf1;
-
/*
- * If we haven't identified it by now, format the
- * number in a static buffer and return that.
+ * Anything else is handled by libconv. It will return standard
+ * names for known items, or format as a number otherwise.
*/
- (void) snprintf(buf, sizeof (buf1),
- MSG_ORIG(MSG_FMT_WORDVAL), shndx);
- return (buf);
+ buf = (buf == &buf1) ? &buf2 : &buf1; /* Switch buffers */
+ return (conv_sym_shndx(obj_state->os_ehdr->e_ident[EI_OSABI],
+ obj_state->os_ehdr->e_machine, shndx,
+ CONV_FMT_ALT_CF | CONV_FMT_DECIMAL, buf));
}
@@ -336,6 +311,44 @@ elfedit_sec_get(elfedit_obj_state_t *obj_state, Word shndx)
}
+
+/*
+ * Compare the a specified osabi with that of the current object.
+ *
+ * entry:
+ * obj_state - Object state for open object to query.
+ * issue_err - True if this routine should issue an error and
+ * not return to the caller if osabi is not native.
+ *
+ * exit:
+ * If current osabi is the one specified, True (1) is returned.
+ *
+ * Otherwise, if issue_err is True, an error is issued and this
+ * routine does not return to the caller. If issue_err is False,
+ * False (0) is returned.
+ *
+ * note:
+ * ELFOSABI_NONE is considered to be equivalent to ELFOSABI_SOLARIS.
+ */
+int
+elfedit_test_osabi(elfedit_obj_state_t *obj_state, uchar_t osabi,
+ int issue_err)
+{
+ uchar_t obj_osabi = obj_state->os_ehdr->e_ident[EI_OSABI];
+ Conv_inv_buf_t inv_buf;
+
+ if (obj_osabi == ELFOSABI_NONE)
+ obj_osabi = ELFOSABI_SOLARIS;
+
+ if (osabi == obj_osabi)
+ return (1);
+
+ if (issue_err)
+ elfedit_msg(ELFEDIT_MSG_ERR, MSG_INTL(MSG_ERR_BADOSABI),
+ conv_ehdr_osabi(osabi, 0, &inv_buf));
+ return (0);
+}
+
/*
* Locate the capabilities section for this object
*
@@ -357,6 +370,8 @@ elfedit_sec_getcap(elfedit_obj_state_t *obj_state, Cap **cap, Word *num)
Word cnt;
elfedit_section_t *cache;
+ (void) elfedit_test_osabi(obj_state, ELFOSABI_SOLARIS, 1);
+
for (cnt = 1; cnt < obj_state->os_shnum; cnt++) {
cache = &obj_state->os_secarr[cnt];
if (cache->sec_shdr->sh_type == SHT_SUNW_cap) {
@@ -462,6 +477,7 @@ elfedit_sec_getsyminfo(elfedit_obj_state_t *obj_state, Syminfo **syminfo,
* Check the given section to see if it is a known symbol table type.
*
* entry:
+ * obj_state - Object state for open object to query.
* sec - Section to check
* issue_err - True if this routine should issue an error and
* not return to the caller if sec is not a symbol table.
@@ -483,8 +499,8 @@ elfedit_sec_getsyminfo(elfedit_obj_state_t *obj_state, Syminfo **syminfo,
* - False (0) is returned
*/
int
-elfedit_sec_issymtab(elfedit_section_t *sec, int issue_err,
- elfedit_atoui_sym_t **atoui_list)
+elfedit_sec_issymtab(elfedit_obj_state_t *obj_state, elfedit_section_t *sec,
+ int issue_err, elfedit_atoui_sym_t **atoui_list)
{
elfedit_const_t const_type;
int ret = 1;
@@ -498,8 +514,15 @@ elfedit_sec_issymtab(elfedit_section_t *sec, int issue_err,
const_type = ELFEDIT_CONST_SHT_DYNSYM;
break;
case SHT_SUNW_LDYNSYM:
- const_type = ELFEDIT_CONST_SHT_LDYNSYM;
- break;
+ /*
+ * These sections are only known to be symbol tables
+ * if the osabi is Solaris.
+ */
+ if (elfedit_test_osabi(obj_state, ELFOSABI_SOLARIS, 0)) {
+ const_type = ELFEDIT_CONST_SHT_LDYNSYM;
+ break;
+ }
+ /*FALLTHROUGH*/
default:
if (issue_err)
elfedit_msg(ELFEDIT_MSG_ERR,
@@ -577,7 +600,7 @@ elfedit_sec_getsymtab(elfedit_obj_state_t *obj_state, int by_index,
elfedit_msg(ELFEDIT_MSG_ERR, MSG_INTL(MSG_ERR_NOSYMTAB));
/* Got it. Report to the user and return the necessary data */
- (void) elfedit_sec_issymtab(symsec, 1, NULL);
+ (void) elfedit_sec_issymtab(obj_state, symsec, 1, NULL);
type_name = elfedit_atoconst_value_to_str(ELFEDIT_CONST_SHT_ALLSYMTAB,
symsec->sec_shdr->sh_type, 1);
elfedit_msg(ELFEDIT_MSG_DEBUG, MSG_INTL(MSG_DEBUG_FNDSYMTAB),
@@ -625,7 +648,7 @@ elfedit_sec_getxshndx(elfedit_obj_state_t *obj_state,
Word ndx;
/* Sanity check: symsec must be a symbol table */
- (void) elfedit_sec_issymtab(symsec, 1, NULL);
+ (void) elfedit_sec_issymtab(obj_state, symsec, 1, NULL);
symtab = obj_state->os_symtab;
for (ndx = 0; ndx < obj_state->os_symtabnum; ndx++, symtab++)
@@ -688,7 +711,7 @@ elfedit_sec_getversym(elfedit_obj_state_t *obj_state,
Word ndx;
/* Sanity check: symsec must be a symbol table */
- (void) elfedit_sec_issymtab(symsec, 1, NULL);
+ (void) elfedit_sec_issymtab(obj_state, symsec, 1, NULL);
symtab = obj_state->os_symtab;
for (ndx = 0; ndx < obj_state->os_symtabnum; ndx++, symtab++)
@@ -825,6 +848,7 @@ elfedit_sec_findstr(elfedit_section_t *sec, Word tail_ign,
* it exists.
*
* entry:
+ * obj_state - Object state for open object to query.
* dynsec - Dynamic section descriptor
* dyn_strpad - Address of variable to receive the results.
* The caller is responsible for calling elfedit_dyn_elt_init()
@@ -838,11 +862,19 @@ elfedit_sec_findstr(elfedit_section_t *sec, Word tail_ign,
* Returns the final value of dyn_strpad->dn_seen.
*/
int
-elfedit_dynstr_getpad(elfedit_section_t *dynsec, elfedit_dyn_elt_t *dyn_strpad)
+elfedit_dynstr_getpad(elfedit_obj_state_t *obj_state, elfedit_section_t *dynsec,
+ elfedit_dyn_elt_t *dyn_strpad)
{
- Dyn *dyn = (Dyn *) dynsec->sec_data->d_buf;
Word numdyn = dynsec->sec_shdr->sh_size / dynsec->sec_shdr->sh_entsize;
- Word i;
+ Dyn *dyn = (Dyn *) dynsec->sec_data->d_buf;
+ Word i;
+
+ /*
+ * DT_SUNW_STRPAD is specific to the Solaris OSABI.
+ * If the object is tagged otherwise, don't even look.
+ */
+ if (!elfedit_test_osabi(obj_state, ELFOSABI_SOLARIS, 0))
+ return (dyn_strpad->dn_seen);
/* Go through dynamic section tags and find the STRPAD entry */
for (i = 0; i < numdyn; i++) {
@@ -995,7 +1027,7 @@ elfedit_strtab_insert_test(elfedit_obj_state_t *obj_state,
/* Determine the size of the STRPAD area, if any */
elfedit_dyn_elt_init(&dyn_strpad);
- if (elfedit_dynstr_getpad(dynsec, &dyn_strpad) != 0)
+ if (elfedit_dynstr_getpad(obj_state, dynsec, &dyn_strpad) != 0)
tail_ign = dyn_strpad.dn_dyn.d_un.d_val;
}
@@ -1077,7 +1109,7 @@ elfedit_strtab_insert(elfedit_obj_state_t *obj_state, elfedit_section_t *strsec,
if (is_dynstr) {
elfedit_dyn_elt_init(&dyn_strpad);
- (void) elfedit_dynstr_getpad(dynsec, &dyn_strpad);
+ (void) elfedit_dynstr_getpad(obj_state, dynsec, &dyn_strpad);
return (elfedit_dynstr_insert(dynsec, strsec,
&dyn_strpad, str));
}
diff --git a/usr/src/cmd/sgs/elfedit/modules/common/cap.c b/usr/src/cmd/sgs/elfedit/modules/common/cap.c
index dc3bd6efef..f409b68f2f 100644
--- a/usr/src/cmd/sgs/elfedit/modules/common/cap.c
+++ b/usr/src/cmd/sgs/elfedit/modules/common/cap.c
@@ -20,10 +20,9 @@
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
#include <ctype.h>
#include <elfedit.h>
@@ -291,7 +290,8 @@ print_cap(CAP_CMD_T cmd, int autoprint, ARGSTATE *argstate,
elfedit_msg(ELFEDIT_MSG_ERR, MSG_INTL(MSG_ERR_NOCAELT),
EC_WORD(argstate->cap.sec->sec_shndx),
- argstate->cap.sec->sec_name, conv_cap_tag(arg, &inv_buf));
+ argstate->cap.sec->sec_name,
+ conv_cap_tag(arg, 0, &inv_buf));
}
}
@@ -523,13 +523,13 @@ cmd_body(CAP_CMD_T cmd, elfedit_obj_state_t *obj_state,
elfedit_msg(ELFEDIT_MSG_DEBUG,
MSG_INTL(MSG_DEBUG_S_OK),
cap_ndx, cap_name, EC_WORD(ndx),
- conv_cap_tag(c_tag, &inv_buf1));
+ conv_cap_tag(c_tag, 0, &inv_buf1));
} else {
elfedit_msg(ELFEDIT_MSG_DEBUG,
MSG_INTL(MSG_DEBUG_S_CHG),
cap_ndx, cap_name, EC_WORD(ndx),
- conv_cap_tag(cap[ndx].c_tag, &inv_buf1),
- conv_cap_tag(c_tag, &inv_buf2));
+ conv_cap_tag(cap[ndx].c_tag, 0, &inv_buf1),
+ conv_cap_tag(c_tag, 0, &inv_buf2));
cap[ndx].c_tag = c_tag;
ret = ELFEDIT_CMDRET_MOD;
}
@@ -607,7 +607,7 @@ cmd_body(CAP_CMD_T cmd, elfedit_obj_state_t *obj_state,
Xword hw1;
hw1 = flag_bitop(&argstate, cap[ndx].c_un.c_val,
- elfedit_mach_sunw_hw1_to_atoui(mach));
+ elfedit_const_to_atoui(ELFEDIT_CONST_AV));
/* Set the value */
if (cap[ndx].c_un.c_val == hw1) {
@@ -732,28 +732,9 @@ static void
cpl_hw1(elfedit_obj_state_t *obj_state, void *cpldata, int argc,
const char *argv[], int num_opt)
{
- elfedit_atoui_sym_t *sym_const;
-
/* This routine allows multiple flags to be specified */
- /*
- * If there is no object, then supply all the hardware
- * capabilities we know of.
- */
- if (obj_state == NULL) {
- elfedit_cpl_atoconst(cpldata, ELFEDIT_CONST_AV_386);
- elfedit_cpl_atoconst(cpldata, ELFEDIT_CONST_AV_SPARC);
- return;
- }
-
- /*
- * Supply the hardware capabilities for the type of
- * machine the object is for, if we know any.
- */
- sym_const = elfedit_mach_sunw_hw1_to_atoui(
- obj_state->os_ehdr->e_machine);
- if (sym_const != NULL)
- elfedit_cpl_atoui(cpldata, sym_const);
+ elfedit_cpl_atoconst(cpldata, ELFEDIT_CONST_AV);
}
/*ARGSUSED*/
diff --git a/usr/src/cmd/sgs/elfedit/modules/common/dyn.c b/usr/src/cmd/sgs/elfedit/modules/common/dyn.c
index d8991b5108..a25947407f 100644
--- a/usr/src/cmd/sgs/elfedit/modules/common/dyn.c
+++ b/usr/src/cmd/sgs/elfedit/modules/common/dyn.c
@@ -20,7 +20,7 @@
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -37,9 +37,6 @@
* Dynamic section
*/
-
-
-
/*
* This module uses shared code for several of the commands.
* It is sometimes necessary to know which specific command
@@ -187,11 +184,12 @@ set_null_ndx(ARGSTATE *argstate)
* this routine does not return to the caller.
*/
static Word
-convert_dt_null(ARGSTATE *argstate, Word d_tag, Xword d_val)
+convert_dt_null(ARGSTATE *argstate, Xword d_tag, Xword d_val)
{
Conv_inv_buf_t inv_buf;
Word ndx;
Dyn *dyn;
+ Ehdr *ehdr;
/* If we lack an extra element, we can't continue */
if (argstate->dyn.num_null_ndx <= 1)
@@ -199,10 +197,11 @@ convert_dt_null(ARGSTATE *argstate, Word d_tag, Xword d_val)
EC_WORD(argstate->dyn.sec->sec_shndx),
argstate->dyn.sec->sec_name);
+ ehdr = argstate->obj_state->os_ehdr;
elfedit_msg(ELFEDIT_MSG_DEBUG, MSG_INTL(MSG_DEBUG_CONVNULL),
EC_WORD(argstate->dyn.sec->sec_shndx), argstate->dyn.sec->sec_name,
EC_WORD(argstate->dyn.null_ndx), conv_dyn_tag(d_tag,
- argstate->obj_state->os_ehdr->e_machine, 0, &inv_buf));
+ ehdr->e_ident[EI_OSABI], ehdr->e_machine, 0, &inv_buf));
ndx = argstate->dyn.null_ndx;
dyn = &argstate->dyn.data[ndx];
@@ -268,8 +267,6 @@ process_args(elfedit_obj_state_t *obj_state, int argc, const char *argv[],
set_null_ndx(argstate);
}
-
-
/*
* Print ELF header values, taking the calling command, and output style
* into account.
@@ -280,7 +277,7 @@ process_args(elfedit_obj_state_t *obj_state, int argc, const char *argv[],
* autoprint flag is set. If False, output is always produced.
* argstate - Argument state block
* print_type - Specifies which dynamic elements to display.
- * ndx = If print_type is PRINT_DYN_T_NDX, displays the index specified.
+ * arg - If print_type is PRINT_DYN_T_NDX, displays the index specified.
* Otherwise ignored.
*/
typedef enum {
@@ -303,10 +300,14 @@ print_dyn(DYN_CMD_T cmd, int autoprint, ARGSTATE *argstate,
int header_done = 0;
Xword last_d_val;
int one_shot;
+ int osabi_solaris;
if (autoprint && ((elfedit_flags() & ELFEDIT_F_AUTOPRINT) == 0))
return;
+ osabi_solaris =
+ elfedit_test_osabi(argstate->obj_state, ELFOSABI_SOLARIS, 0);
+
/*
* Pick an output style. dyn:dump is required to use the default
* style. The other commands use the current output style.
@@ -427,11 +428,15 @@ print_dyn(DYN_CMD_T cmd, int autoprint, ARGSTATE *argstate,
case DT_USED:
case DT_DEPAUDIT:
case DT_AUDIT:
- case DT_SUNW_AUXILIARY:
- case DT_SUNW_FILTER:
name = elfedit_offset_to_str(argstate->strsec,
dyn->d_un.d_val, ELFEDIT_MSG_DEBUG, 0);
break;
+ case DT_SUNW_AUXILIARY:
+ case DT_SUNW_FILTER:
+ if (osabi_solaris)
+ name = elfedit_offset_to_str(argstate->strsec,
+ dyn->d_un.d_val, ELFEDIT_MSG_DEBUG, 0);
+ break;
case DT_FLAGS:
name = conv_dyn_flag(dyn->d_un.d_val,
@@ -481,20 +486,24 @@ print_dyn(DYN_CMD_T cmd, int autoprint, ARGSTATE *argstate,
name = MSG_INTL(MSG_STR_DEPRECATED);
break;
case DT_SUNW_LDMACH:
- name = conv_ehdr_mach((Half)dyn->d_un.d_val, 0,
- &c_buf.inv);
+ if (osabi_solaris)
+ name = conv_ehdr_mach((Half)dyn->d_un.d_val, 0,
+ &c_buf.inv);
break;
}
if (outstyle == ELFEDIT_OUTSTYLE_DEFAULT) {
+ Ehdr *ehdr;
+
if (header_done == 0) {
header_done = 1;
Elf_dyn_title(0);
}
if (name == NULL)
name = MSG_ORIG(MSG_STR_EMPTY);
+ ehdr = argstate->obj_state->os_ehdr;
Elf_dyn_entry(0, dyn, ndx, name,
- argstate->obj_state->os_ehdr->e_machine);
+ ehdr->e_ident[EI_OSABI], ehdr->e_machine);
} else {
/*
* In simple or numeric mode under a print type
@@ -557,13 +566,14 @@ print_dyn(DYN_CMD_T cmd, int autoprint, ARGSTATE *argstate,
*/
if (!printed) {
if (print_type == PRINT_DYN_T_TAG) {
- Conv_inv_buf_t inv_buf;
+ Conv_inv_buf_t inv_buf;
+ Ehdr *ehdr = argstate->obj_state->os_ehdr;
elfedit_msg(ELFEDIT_MSG_ERR,
MSG_INTL(MSG_ERR_NODYNELT),
EC_WORD(argstate->dyn.sec->sec_shndx),
argstate->dyn.sec->sec_name, conv_dyn_tag(arg,
- argstate->obj_state->os_ehdr->e_machine,
+ ehdr->e_ident[EI_OSABI], ehdr->e_machine,
0, &inv_buf));
}
@@ -613,7 +623,8 @@ static Word
arg_to_index(ARGSTATE *argstate, const char *arg,
int print_request, PRINT_DYN_T *print_type)
{
- Word ndx, dt_value;
+ Word ndx;
+ Xword dt_value;
Dyn *dyn;
@@ -647,15 +658,17 @@ arg_to_index(ARGSTATE *argstate, const char *arg,
ndx = ((Word) elfedit_atoui_range(argstate->dyn_elt_str,
MSG_ORIG(MSG_STR_INDEX), 0, argstate->dyn.num - 1, NULL));
if (argstate->dyn.data[ndx].d_tag != dt_value) {
- Half mach = argstate->obj_state->os_ehdr->e_machine;
+ Ehdr *ehdr = argstate->obj_state->os_ehdr;
+ uchar_t osabi = ehdr->e_ident[EI_OSABI];
+ Half mach = ehdr->e_machine;
Conv_inv_buf_t is, want;
elfedit_msg(ELFEDIT_MSG_ERR, MSG_INTL(MSG_ERR_WRONGTAG),
EC_WORD(argstate->dyn.sec->sec_shndx),
argstate->dyn.sec->sec_name, ndx,
- conv_dyn_tag(dt_value, mach, 0, &want),
- conv_dyn_tag(argstate->dyn.data[ndx].d_tag, mach,
- 0, &is));
+ conv_dyn_tag(dt_value, osabi, mach, 0, &want),
+ conv_dyn_tag(argstate->dyn.data[ndx].d_tag,
+ osabi, mach, 0, &is));
}
return (ndx);
}
@@ -757,8 +770,8 @@ cmd_body_value(ARGSTATE *argstate, Word *ret_ndx)
Dyn *dyn = argstate->dyn.data;
Word numdyn = argstate->dyn.num;
int minus_add, minus_s, minus_dynndx;
- Word arg1, tmp_val;
- Xword arg2;
+ Word tmp_val;
+ Xword arg1, arg2;
int arg2_known = 1;
minus_add = ((argstate->optmask & DYN_OPT_F_ADD) != 0);
@@ -791,7 +804,8 @@ cmd_body_value(ARGSTATE *argstate, Word *ret_ndx)
/* Locate DT_SUNW_STRPAD element if present */
strpad_elt.dn_dyn.d_un.d_val = 0;
- (void) elfedit_dynstr_getpad(argstate->dyn.sec, &strpad_elt);
+ (void) elfedit_dynstr_getpad(argstate->obj_state,
+ argstate->dyn.sec, &strpad_elt);
/*
* Look up the string: If the user specified the -dynndx
@@ -972,7 +986,9 @@ cmd_body_runpath(ARGSTATE *argstate)
break;
case DT_SUNW_STRPAD:
- elfedit_dyn_elt_save(&strpad_elt, i, &dyn[i]);
+ if (elfedit_test_osabi(argstate->obj_state,
+ ELFOSABI_SOLARIS, 0))
+ elfedit_dyn_elt_save(&strpad_elt, i, &dyn[i]);
break;
}
}
@@ -1229,6 +1245,9 @@ cmd_body(DYN_CMD_T cmd, elfedit_obj_state_t *obj_state,
case DYN_CMD_T_SUNW_LDMACH:
if (argstate.argc > 1)
elfedit_command_usage();
+ /* DT_SUNW_LDMACH is an ELFOSABI_SOLARIS feature */
+ (void) elfedit_test_osabi(argstate.obj_state,
+ ELFOSABI_SOLARIS, 1);
print_only = (argstate.argc == 0);
ndx = arg_to_index(&argstate, elfedit_atoconst_value_to_str(
ELFEDIT_CONST_DT, DT_SUNW_LDMACH, 1),
@@ -1257,19 +1276,20 @@ cmd_body(DYN_CMD_T cmd, elfedit_obj_state_t *obj_state,
case DYN_CMD_T_TAG:
{
+ Ehdr *ehdr = argstate.obj_state->os_ehdr;
+ uchar_t osabi = ehdr->e_ident[EI_OSABI];
+ Half mach = ehdr->e_machine;
Conv_inv_buf_t inv_buf1, inv_buf2;
- Half mach = argstate.obj_state->os_ehdr->e_machine;
- Word d_tag = (Word) elfedit_atoconst(argstate.argv[1],
+ Xword d_tag = (Xword) elfedit_atoconst(argstate.argv[1],
ELFEDIT_CONST_DT);
if (dyn[ndx].d_tag == d_tag) {
elfedit_msg(ELFEDIT_MSG_DEBUG,
- MSG_INTL(MSG_DEBUG_S_OK),
- dyn_ndx,
- dyn_name, EC_WORD(ndx),
- conv_dyn_tag(d_tag, mach, 0, &inv_buf1));
+ MSG_INTL(MSG_DEBUG_S_OK), dyn_ndx, dyn_name,
+ EC_WORD(ndx), conv_dyn_tag(d_tag, osabi,
+ mach, 0, &inv_buf1));
} else {
- Word orig_d_tag = dyn[ndx].d_tag;
+ Xword orig_d_tag = dyn[ndx].d_tag;
ret = ELFEDIT_CMDRET_MOD;
dyn[ndx].d_tag = d_tag;
@@ -1287,9 +1307,8 @@ cmd_body(DYN_CMD_T cmd, elfedit_obj_state_t *obj_state,
elfedit_msg(ELFEDIT_MSG_DEBUG,
MSG_INTL(MSG_DEBUG_NULLTERM),
dyn_ndx, dyn_name,
- EC_WORD(ndx),
- conv_dyn_tag(d_tag, mach,
- 0, &inv_buf1));
+ EC_WORD(ndx), conv_dyn_tag(d_tag,
+ osabi, mach, 0, &inv_buf1));
/*
* Warning if
@@ -1305,25 +1324,26 @@ cmd_body(DYN_CMD_T cmd, elfedit_obj_state_t *obj_state,
MSG_INTL(MSG_DEBUG_NULCLIP),
dyn_ndx, dyn_name,
EC_WORD(ndx),
- conv_dyn_tag(d_tag, mach,
- 0, &inv_buf1));
+ conv_dyn_tag(d_tag, osabi,
+ mach, 0, &inv_buf1));
} else {
if ((ndx + 1) > argstate.dyn.null_ndx)
elfedit_msg(ELFEDIT_MSG_DEBUG,
MSG_INTL(MSG_DEBUG_NULHIDE),
dyn_ndx, dyn_name,
EC_WORD(ndx),
- conv_dyn_tag(d_tag, mach,
- 0, &inv_buf1));
+ conv_dyn_tag(d_tag, osabi,
+ mach, 0, &inv_buf1));
}
/* Debug message that we changed it */
elfedit_msg(ELFEDIT_MSG_DEBUG,
MSG_INTL(MSG_DEBUG_S_CHG),
dyn_ndx, dyn_name, EC_WORD(ndx),
- conv_dyn_tag(orig_d_tag, mach, 0,
+ conv_dyn_tag(orig_d_tag, osabi, mach, 0,
&inv_buf1),
- conv_dyn_tag(d_tag, mach, 0, &inv_buf2));
+ conv_dyn_tag(d_tag, osabi, mach, 0,
+ &inv_buf2));
}
}
break;
diff --git a/usr/src/cmd/sgs/elfedit/modules/common/ehdr.c b/usr/src/cmd/sgs/elfedit/modules/common/ehdr.c
index 36b6918089..fe377df0eb 100644
--- a/usr/src/cmd/sgs/elfedit/modules/common/ehdr.c
+++ b/usr/src/cmd/sgs/elfedit/modules/common/ehdr.c
@@ -20,10 +20,9 @@
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <ctype.h>
@@ -337,9 +336,10 @@ print_ehdr(EHDR_CMD_T cmd, int e_ident_ndx, int autoprint,
case EI_ABIVERSION:
ndx = elfedit_atoconst_value_to_str(
ELFEDIT_CONST_EI, EI_ABIVERSION, 1);
- value = value_buf;
- (void) snprintf(value_buf, sizeof (value_buf),
- MSG_ORIG(MSG_FMT_HEXNUM), ehdr->e_ident[i]);
+ value = conv_ehdr_abivers(
+ ehdr->e_ident[EI_OSABI],
+ ehdr->e_ident[EI_ABIVERSION],
+ CONV_FMT_DECIMAL, &inv_buf);
break;
default:
value = value_buf;
@@ -382,7 +382,7 @@ print_ehdr(EHDR_CMD_T cmd, int e_ident_ndx, int autoprint,
* print a simple hex value.
*/
if ((outstyle == ELFEDIT_OUTSTYLE_NUM) ||
- (i >= EI_ABIVERSION)) {
+ (i > EI_ABIVERSION)) {
elfedit_printf(
MSG_ORIG(MSG_FMT_HEXNUMNL),
ehdr->e_ident[i]);
@@ -422,6 +422,13 @@ print_ehdr(EHDR_CMD_T cmd, int e_ident_ndx, int autoprint,
ehdr->e_ident[EI_OSABI], 0,
&inv_buf));
continue;
+ case EI_ABIVERSION:
+ elfedit_printf(MSG_ORIG(MSG_FMT_STRNL),
+ conv_ehdr_abivers(
+ ehdr->e_ident[EI_OSABI],
+ ehdr->e_ident[EI_ABIVERSION],
+ CONV_FMT_DECIMAL, &inv_buf));
+ continue;
}
}
}
@@ -430,7 +437,8 @@ print_ehdr(EHDR_CMD_T cmd, int e_ident_ndx, int autoprint,
case EHDR_CMD_T_E_TYPE:
if (outstyle == ELFEDIT_OUTSTYLE_SIMPLE)
elfedit_printf(MSG_ORIG(MSG_FMT_STRNL),
- conv_ehdr_type(ehdr->e_type, 0, &inv_buf));
+ conv_ehdr_type(ehdr->e_ident[EI_OSABI],
+ ehdr->e_type, 0, &inv_buf));
else
elfedit_printf(MSG_ORIG(MSG_FMT_DECNUMNL),
ehdr->e_type);
@@ -601,8 +609,15 @@ print_ehdr(EHDR_CMD_T cmd, int e_ident_ndx, int autoprint,
return;
case EHDR_CMD_T_EI_ABIVERSION:
- elfedit_printf(MSG_ORIG(MSG_FMT_HEXNUMNL),
- EC_WORD(ehdr->e_ident[EI_ABIVERSION]));
+ c = ehdr->e_ident[EI_ABIVERSION];
+ if (outstyle == ELFEDIT_OUTSTYLE_SIMPLE) {
+ elfedit_printf(MSG_ORIG(MSG_FMT_STRNL),
+ conv_ehdr_abivers(ehdr->e_ident[EI_OSABI],
+ c, CONV_FMT_DECIMAL, &inv_buf));
+ } else {
+ elfedit_printf(MSG_ORIG(MSG_FMT_HEXNUMNL),
+ EC_WORD(c));
+ }
return;
}
}
@@ -757,12 +772,15 @@ cmd_body(EHDR_CMD_T cmd, elfedit_obj_state_t *obj_state,
if (ehdr->e_type == type) {
elfedit_msg(ELFEDIT_MSG_DEBUG,
MSG_INTL(MSG_DEBUG_E_S_OK), name,
- conv_ehdr_type(ehdr->e_type, 0, &inv_buf1));
+ conv_ehdr_type(ehdr->e_ident[EI_OSABI],
+ ehdr->e_type, 0, &inv_buf1));
} else {
elfedit_msg(ELFEDIT_MSG_DEBUG,
MSG_INTL(MSG_DEBUG_E_S_CHG), name,
- conv_ehdr_type(ehdr->e_type, 0, &inv_buf1),
- conv_ehdr_type(type, 0, &inv_buf2));
+ conv_ehdr_type(ehdr->e_ident[EI_OSABI],
+ ehdr->e_type, 0, &inv_buf1),
+ conv_ehdr_type(ehdr->e_ident[EI_OSABI],
+ type, 0, &inv_buf2));
ret = ELFEDIT_CMDRET_MOD;
ehdr->e_type = type;
}
@@ -787,8 +805,9 @@ cmd_body(EHDR_CMD_T cmd, elfedit_obj_state_t *obj_state,
conv_ehdr_mach(ehdr->e_machine, 0,
&inv_buf1),
conv_ehdr_mach(mach, 0, &inv_buf2));
- ret = ELFEDIT_CMDRET_MOD;
+ ret = ELFEDIT_CMDRET_MOD_OS_MACH;
ehdr->e_machine = mach;
+
}
}
break;
@@ -1285,7 +1304,7 @@ cmd_body(EHDR_CMD_T cmd, elfedit_obj_state_t *obj_state,
conv_ehdr_osabi(ehdr->e_ident[EI_OSABI],
0, &inv_buf1),
conv_ehdr_osabi(osabi, 0, &inv_buf2));
- ret = ELFEDIT_CMDRET_MOD;
+ ret = ELFEDIT_CMDRET_MOD_OS_MACH;
ehdr->e_ident[EI_OSABI] = osabi;
}
}
@@ -1294,20 +1313,25 @@ cmd_body(EHDR_CMD_T cmd, elfedit_obj_state_t *obj_state,
case EHDR_CMD_T_EI_ABIVERSION:
{
/* The argument gives the ABI version */
- int abiver = (int)elfedit_atoui_range(argstate.argv[0],
- MSG_ORIG(MSG_STR_VALUE), 0, 255, NULL);
+ int abiver = (int)elfedit_atoconst_range(
+ argstate.argv[0], MSG_ORIG(MSG_STR_VALUE), 0, 255,
+ ELFEDIT_CONST_EAV);
const char *name = elfedit_atoconst_value_to_str(
ELFEDIT_CONST_EI, EI_ABIVERSION, 1);
if (ehdr->e_ident[EI_ABIVERSION] == abiver) {
elfedit_msg(ELFEDIT_MSG_DEBUG,
- MSG_INTL(MSG_DEBUG_EI_S_X_OK), name,
- EC_WORD(abiver));
+ MSG_INTL(MSG_DEBUG_EI_S_S_OK), name,
+ conv_ehdr_abivers(ehdr->e_ident[EI_OSABI],
+ abiver, CONV_FMT_DECIMAL, &inv_buf1));
} else {
elfedit_msg(ELFEDIT_MSG_DEBUG,
- MSG_INTL(MSG_DEBUG_EI_S_X_CHG), name,
- EC_WORD(ehdr->e_ident[EI_ABIVERSION]),
- EC_WORD(abiver));
+ MSG_INTL(MSG_DEBUG_EI_S_S_CHG), name,
+ conv_ehdr_abivers(ehdr->e_ident[EI_OSABI],
+ ehdr->e_ident[EI_ABIVERSION],
+ CONV_FMT_DECIMAL, &inv_buf1),
+ conv_ehdr_abivers(ehdr->e_ident[EI_OSABI],
+ abiver, CONV_FMT_DECIMAL, &inv_buf2));
ret = ELFEDIT_CMDRET_MOD;
ehdr->e_ident[EI_ABIVERSION] = abiver;
}
@@ -1541,6 +1565,22 @@ cpl_ei_osabi(elfedit_obj_state_t *obj_state, void *cpldata, int argc,
elfedit_cpl_atoconst(cpldata, ELFEDIT_CONST_ELFOSABI);
}
+/*ARGSUSED*/
+static void
+cpl_ei_abiversion(elfedit_obj_state_t *obj_state, void *cpldata, int argc,
+ const char *argv[], int num_opt)
+{
+ /*
+ * This command doesn't accept options, so num_opt should be
+ * 0. This is a defensive measure, in case that should change.
+ */
+ argc -= num_opt;
+ argv += num_opt;
+
+ if (argc == 1)
+ elfedit_cpl_atoconst(cpldata, ELFEDIT_CONST_EAV);
+}
+
@@ -2200,7 +2240,7 @@ elfedit_init(elfedit_module_version_t version)
opt_std, arg_ei_osabi },
/* ehdr:ei_abiversion */
- { cmd_ei_abiversion, NULL, name_ei_abiversion,
+ { cmd_ei_abiversion, cpl_ei_abiversion, name_ei_abiversion,
/* MSG_INTL(MSG_DESC_EI_ABIVERSION) */
ELFEDIT_I18NHDL(MSG_DESC_EI_ABIVERSION),
/* MSG_INTL(MSG_HELP_EI_ABIVERSION) */
diff --git a/usr/src/cmd/sgs/elfedit/modules/common/ehdr.msg b/usr/src/cmd/sgs/elfedit/modules/common/ehdr.msg
index 0e9236443e..16ca8dcdf0 100644
--- a/usr/src/cmd/sgs/elfedit/modules/common/ehdr.msg
+++ b/usr/src/cmd/sgs/elfedit/modules/common/ehdr.msg
@@ -20,10 +20,9 @@
#
#
-# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
@ _START_
@@ -41,8 +40,6 @@
@ MSG_DEBUG_E_LLX_CHG "ehdr.%s: change from %#llx to %#llx\n"
@ MSG_DEBUG_EI_S_S_OK "ehdr.e_ident[%s]: value unchanged: %s\n";
@ MSG_DEBUG_EI_S_S_CHG "ehdr.e_ident[%s]: change from %s to %s\n"
-@ MSG_DEBUG_EI_S_X_OK "ehdr.e_ident[%s]: value unchanged: %#x\n";
-@ MSG_DEBUG_EI_S_X_CHG "ehdr.e_ident[%s]: change from %#x to %#x\n"
@ MSG_DEBUG_EI_D_X_OK "ehdr.e_ident[%d]: value unchanged: %#x\n"
@ MSG_DEBUG_EI_D_X_CHG "ehdr.e_ident[%d]: change from %#x to %#x\n"
@ MSG_DEBUG_SHDR0_D_OK "shdr[0].%s: value unchanged: %d\n"
diff --git a/usr/src/cmd/sgs/elfedit/modules/common/mapfile-vers b/usr/src/cmd/sgs/elfedit/modules/common/mapfile-vers
index dfa0f58ad0..23fbf0fb37 100644
--- a/usr/src/cmd/sgs/elfedit/modules/common/mapfile-vers
+++ b/usr/src/cmd/sgs/elfedit/modules/common/mapfile-vers
@@ -76,7 +76,6 @@ SUNWprivate_1.1 {
# ato[u]i routines
elfedit_const_to_atoui = PARENT;
- elfedit_mach_sunw_hw1_to_atoui = PARENT;
elfedit_atoi = PARENT;
elfedit_atoui = PARENT;
@@ -201,6 +200,9 @@ SUNWprivate_1.1 {
elfedit32_strtab_insert_test = PARENT;
elfedit64_strtab_insert_test = PARENT;
+ elfedit32_test_osabi = PARENT;
+ elfedit64_test_osabi = PARENT;
+
elfedit32_type_to_shndx = PARENT;
elfedit64_type_to_shndx = PARENT;
diff --git a/usr/src/cmd/sgs/elfedit/modules/common/phdr.c b/usr/src/cmd/sgs/elfedit/modules/common/phdr.c
index 55dc453166..e4129c9de1 100644
--- a/usr/src/cmd/sgs/elfedit/modules/common/phdr.c
+++ b/usr/src/cmd/sgs/elfedit/modules/common/phdr.c
@@ -20,10 +20,9 @@
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
#include <elfedit.h>
#include <strings.h>
@@ -224,6 +223,9 @@ process_args(elfedit_obj_state_t *obj_state, int argc, const char *argv[],
argstate->ndx_set = 1;
} else {
Conv_inv_buf_t inv_buf;
+ Ehdr *ehdr = obj_state->os_ehdr;
+ Half mach = ehdr->e_machine;
+ uchar_t osabi = ehdr->e_ident[EI_OSABI];
Word i;
Phdr *phdr;
@@ -236,17 +238,15 @@ process_args(elfedit_obj_state_t *obj_state, int argc, const char *argv[],
argstate->ndx_set = 1;
elfedit_msg(ELFEDIT_MSG_DEBUG,
MSG_INTL(MSG_DEBUG_PHDR),
- EC_WORD(i), conv_phdr_type(
- obj_state->os_ehdr->e_machine,
- phdr->p_type, 0, &inv_buf));
+ EC_WORD(i), conv_phdr_type(osabi,
+ mach, phdr->p_type, 0, &inv_buf));
break;
}
}
if (i == argstate->obj_state->os_phnum)
elfedit_msg(ELFEDIT_MSG_ERR,
MSG_INTL(MSG_ERR_NOPHDR), conv_phdr_type(
- obj_state->os_ehdr->e_machine,
- argstate->ndx, 0, &inv_buf));
+ osabi, mach, argstate->ndx, 0, &inv_buf));
}
}
@@ -340,26 +340,50 @@ locate_interp(elfedit_obj_state_t *obj_state, INTERP_STATE *interp)
* autoprint - If True, output is only produced if the elfedit
* autoprint flag is set. If False, output is always produced.
* cmd - PHDR_CMD_T_* value giving identify of caller
- * argstate - State block for section header array
- * ndx - Index of first program header to display
- * cnt - Number of program headers to display
+ * argstate - State block for section header array. The following
+ * fields are examined in order to determine the form
+ * of output: ndx_set, ndx, print_req.
*/
static void
print_phdr(PHDR_CMD_T cmd, int autoprint, ARGSTATE *argstate)
{
elfedit_outstyle_t outstyle;
- Word ndx, cnt;
+ Ehdr *ehdr = argstate->obj_state->os_ehdr;
+ uchar_t osabi = ehdr->e_ident[EI_OSABI];
+ Half mach = ehdr->e_machine;
+ Word ndx, cnt, by_type, type;
+ Phdr *phdr;
if (autoprint && ((elfedit_flags() & ELFEDIT_F_AUTOPRINT) == 0))
return;
+ /*
+ * Determine which indexes to display:
+ *
+ * - If the user specified an index, the display starts
+ * with that item. If it was a print_request, and the
+ * index was specified by type, then all items of the
+ * same type are shown. If not a print request, or the index
+ * was given numerically, then just the single item is shown.
+ *
+ * - If no index is specified, every program header is shown.
+ */
+ by_type = 0;
if (argstate->ndx_set) {
ndx = argstate->ndx;
- cnt = 1;
+ if (argstate->print_req &&
+ ((argstate->optmask & PHDR_OPT_F_PHNDX) == 0)) {
+ by_type = 1;
+ type = argstate->obj_state->os_phdr[ndx].p_type;
+ cnt = argstate->obj_state->os_phnum - ndx;
+ } else {
+ cnt = 1;
+ }
} else {
ndx = 0;
cnt = argstate->obj_state->os_phnum;
}
+ phdr = argstate->obj_state->os_phdr + ndx;
/*
* Pick an output style. phdr:dump is required to use the default
@@ -373,120 +397,105 @@ print_phdr(PHDR_CMD_T cmd, int autoprint, ARGSTATE *argstate)
* show all program header attributes. In this case, the
* command that called us doesn't matter.
*
- * Let PHDR_CMD_T_INTERP fall through: It isn't per-phdr like
+ * Exclude PHDR_CMD_T_INTERP from this: It isn't per-phdr like
* the other commands.
*/
if ((outstyle == ELFEDIT_OUTSTYLE_DEFAULT) &&
(cmd != PHDR_CMD_T_INTERP)) {
- Half mach = argstate->obj_state->os_ehdr->e_machine;
- Phdr *phdr = argstate->obj_state->os_phdr + ndx;
-
for (; cnt--; ndx++, phdr++) {
+ if (by_type && (type != phdr->p_type))
+ continue;
+
elfedit_printf(MSG_ORIG(MSG_STR_NL));
elfedit_printf(MSG_INTL(MSG_ELF_PHDR), EC_WORD(ndx));
- Elf_phdr(0, mach, phdr);
+ Elf_phdr(0, osabi, mach, phdr);
}
return;
}
- switch (cmd) {
- case PHDR_CMD_T_P_TYPE:
- for (; cnt--; ndx++) {
- Word p_type = argstate->obj_state->os_phdr[ndx].p_type;
- Conv_inv_buf_t inv_buf;
+ if (cmd == PHDR_CMD_T_INTERP) {
+ INTERP_STATE interp;
+
+ (void) locate_interp(argstate->obj_state, &interp);
+ switch (outstyle) {
+ case ELFEDIT_OUTSTYLE_DEFAULT:
+ elfedit_printf(MSG_INTL(MSG_FMT_ELF_INTERP),
+ interp.sec->sec_name, interp.str);
+ break;
+ case ELFEDIT_OUTSTYLE_SIMPLE:
+ elfedit_printf(MSG_ORIG(MSG_FMT_STRNL), interp.str);
+ break;
+ case ELFEDIT_OUTSTYLE_NUM:
+ elfedit_printf(MSG_ORIG(MSG_FMT_U_NL),
+ EC_WORD(interp.stroff));
+ break;
+ }
+ return;
+ }
+ /* Handle the remaining commands */
+ for (; cnt--; ndx++, phdr++) {
+ if (by_type && (type != phdr->p_type))
+ continue;
+
+ switch (cmd) {
+ case PHDR_CMD_T_P_TYPE:
if (outstyle == ELFEDIT_OUTSTYLE_SIMPLE) {
- Half mach =
- argstate->obj_state->os_ehdr->e_machine;
+ Conv_inv_buf_t inv_buf;
elfedit_printf(MSG_ORIG(MSG_FMT_STRNL),
- conv_phdr_type(mach, p_type, 0, &inv_buf));
+ conv_phdr_type(osabi,
+ argstate->obj_state->os_ehdr->e_machine,
+ phdr->p_type, 0, &inv_buf));
} else {
elfedit_printf(MSG_ORIG(MSG_FMT_X_NL),
- EC_WORD(p_type));
+ EC_WORD(phdr->p_type));
}
- }
- return;
+ break;
- case PHDR_CMD_T_P_OFFSET:
- for (; cnt--; ndx++)
+ case PHDR_CMD_T_P_OFFSET:
elfedit_printf(MSG_ORIG(MSG_FMT_LLX_NL),
- EC_OFF(argstate->obj_state->os_phdr[ndx].p_offset));
- return;
+ EC_OFF(phdr->p_offset));
+ break;
- case PHDR_CMD_T_P_VADDR:
- for (; cnt--; ndx++)
+ case PHDR_CMD_T_P_VADDR:
elfedit_printf(MSG_ORIG(MSG_FMT_LLX_NL),
- EC_ADDR(argstate->obj_state->os_phdr[ndx].p_vaddr));
- return;
+ EC_ADDR(phdr->p_vaddr));
+ break;
- case PHDR_CMD_T_P_PADDR:
- for (; cnt--; ndx++)
+ case PHDR_CMD_T_P_PADDR:
elfedit_printf(MSG_ORIG(MSG_FMT_LLX_NL),
- EC_ADDR(argstate->obj_state->os_phdr[ndx].p_paddr));
- return;
+ EC_ADDR(phdr->p_paddr));
+ break;
- case PHDR_CMD_T_P_FILESZ:
- for (; cnt--; ndx++)
+ case PHDR_CMD_T_P_FILESZ:
elfedit_printf(MSG_ORIG(MSG_FMT_LLX_NL),
- EC_XWORD(argstate->obj_state->
- os_phdr[ndx].p_filesz));
- return;
+ EC_XWORD(phdr->p_filesz));
+ break;
- case PHDR_CMD_T_P_MEMSZ:
- for (; cnt--; ndx++)
+ case PHDR_CMD_T_P_MEMSZ:
elfedit_printf(MSG_ORIG(MSG_FMT_LLX_NL),
- EC_XWORD(argstate->obj_state->
- os_phdr[ndx].p_memsz));
- return;
-
- case PHDR_CMD_T_P_FLAGS:
- for (; cnt--; ndx++) {
- Word p_flags =
- argstate->obj_state->os_phdr[ndx].p_flags;
+ EC_XWORD(phdr->p_memsz));
+ break;
+ case PHDR_CMD_T_P_FLAGS:
if (outstyle == ELFEDIT_OUTSTYLE_SIMPLE) {
Conv_phdr_flags_buf_t phdr_flags_buf;
elfedit_printf(MSG_ORIG(MSG_FMT_STRNL),
- conv_phdr_flags(p_flags, CONV_FMT_NOBKT,
- &phdr_flags_buf));
+ conv_phdr_flags(osabi, phdr->p_flags,
+ CONV_FMT_NOBKT, &phdr_flags_buf));
} else {
elfedit_printf(MSG_ORIG(MSG_FMT_X_NL),
- EC_WORD(p_flags));
+ EC_WORD(phdr->p_flags));
}
- }
- return;
+ break;
- case PHDR_CMD_T_P_ALIGN:
- for (; cnt--; ndx++)
+ case PHDR_CMD_T_P_ALIGN:
elfedit_printf(MSG_ORIG(MSG_FMT_LLX_NL),
- EC_XWORD(argstate->obj_state->
- os_phdr[ndx].p_align));
- return;
-
- case PHDR_CMD_T_INTERP:
- {
- INTERP_STATE interp;
-
- (void) locate_interp(argstate->obj_state, &interp);
- switch (outstyle) {
-
- case ELFEDIT_OUTSTYLE_DEFAULT:
- elfedit_printf(MSG_INTL(MSG_FMT_ELF_INTERP),
- interp.sec->sec_name, interp.str);
- break;
- case ELFEDIT_OUTSTYLE_SIMPLE:
- elfedit_printf(MSG_ORIG(MSG_FMT_STRNL),
- interp.str);
- break;
- case ELFEDIT_OUTSTYLE_NUM:
- elfedit_printf(MSG_ORIG(MSG_FMT_U_NL),
- EC_WORD(interp.stroff));
- break;
- }
+ EC_XWORD(phdr->p_align));
+ break;
}
- return;
}
}
@@ -678,7 +687,9 @@ cmd_body(PHDR_CMD_T cmd, elfedit_obj_state_t *obj_state,
case PHDR_CMD_T_P_TYPE:
{
- Half mach = obj_state->os_ehdr->e_machine;
+ Ehdr *ehdr = obj_state->os_ehdr;
+ uchar_t osabi = ehdr->e_ident[EI_OSABI];
+ Half mach = ehdr->e_machine;
Word p_type = elfedit_atoconst(argstate.argv[1],
ELFEDIT_CONST_PT);
Conv_inv_buf_t inv_buf1, inv_buf2;
@@ -687,15 +698,16 @@ cmd_body(PHDR_CMD_T cmd, elfedit_obj_state_t *obj_state,
elfedit_msg(ELFEDIT_MSG_DEBUG,
MSG_INTL(MSG_DEBUG_S_OK),
argstate.ndx, MSG_ORIG(MSG_CMD_P_TYPE),
- conv_phdr_type(mach, phdr->p_type,
+ conv_phdr_type(osabi, mach, phdr->p_type,
0, &inv_buf1));
} else {
elfedit_msg(ELFEDIT_MSG_DEBUG,
MSG_INTL(MSG_DEBUG_S_CHG),
argstate.ndx, MSG_ORIG(MSG_CMD_P_TYPE),
- conv_phdr_type(mach, phdr->p_type, 0,
- &inv_buf1),
- conv_phdr_type(mach, p_type, 0, &inv_buf2));
+ conv_phdr_type(osabi, mach,
+ phdr->p_type, 0, &inv_buf1),
+ conv_phdr_type(osabi, mach,
+ p_type, 0, &inv_buf2));
ret = ELFEDIT_CMDRET_MOD;
phdr->p_type = p_type;
}
@@ -808,6 +820,8 @@ cmd_body(PHDR_CMD_T cmd, elfedit_obj_state_t *obj_state,
case PHDR_CMD_T_P_FLAGS:
{
+ Ehdr *ehdr = obj_state->os_ehdr;
+ uchar_t osabi = ehdr->e_ident[EI_OSABI];
Conv_phdr_flags_buf_t buf1, buf2;
Word p_flags = 0;
int i;
@@ -833,13 +847,15 @@ cmd_body(PHDR_CMD_T cmd, elfedit_obj_state_t *obj_state,
elfedit_msg(ELFEDIT_MSG_DEBUG,
MSG_INTL(MSG_DEBUG_S_OK),
argstate.ndx, MSG_ORIG(MSG_CMD_P_FLAGS),
- conv_phdr_flags(phdr->p_flags, 0, &buf1));
+ conv_phdr_flags(osabi, phdr->p_flags,
+ 0, &buf1));
} else {
elfedit_msg(ELFEDIT_MSG_DEBUG,
MSG_INTL(MSG_DEBUG_S_CHG),
argstate.ndx, MSG_ORIG(MSG_CMD_P_FLAGS),
- conv_phdr_flags(phdr->p_flags, 0, &buf1),
- conv_phdr_flags(p_flags, 0, &buf2));
+ conv_phdr_flags(osabi, phdr->p_flags,
+ 0, &buf1),
+ conv_phdr_flags(osabi, p_flags, 0, &buf2));
ret = ELFEDIT_CMDRET_MOD;
phdr->p_flags = p_flags;
}
@@ -1249,7 +1265,7 @@ elfedit_init(elfedit_module_version_t version)
{ MSG_ORIG(MSG_STR_ELEMENT),
/* MSG_INTL(MSG_A1_ELEMENT) */
ELFEDIT_I18NHDL(MSG_A1_ELEMENT),
- ELFEDIT_CMDOA_F_OPT },
+ 0 },
{ MSG_ORIG(MSG_STR_COUNT),
/* MSG_INTL(MSG_A2_DELETE_COUNT) */
ELFEDIT_I18NHDL(MSG_A2_DELETE_COUNT),
diff --git a/usr/src/cmd/sgs/elfedit/modules/common/shdr.c b/usr/src/cmd/sgs/elfedit/modules/common/shdr.c
index 1c2abeee15..72881d02f9 100644
--- a/usr/src/cmd/sgs/elfedit/modules/common/shdr.c
+++ b/usr/src/cmd/sgs/elfedit/modules/common/shdr.c
@@ -20,10 +20,9 @@
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <unistd.h>
@@ -186,6 +185,17 @@ process_args(elfedit_obj_state_t *obj_state, int argc, const char *argv[],
/*
+ * Options for deciding which items print_shdr() displays.
+ */
+typedef enum {
+ PRINT_SHDR_ALL, /* Print all shdr[ndx:ndx+cnt-1] */
+ PRINT_SHDR_TYPE, /* Print all shdr[ndx:ndx+cnt-1] with type */
+ /* of shdr[ndx] */
+ PRINT_SHDR_NAME, /* Print all shdr[ndx:ndx+cnt-1] with name */
+ /* of shdr[ndx] */
+} PRINT_SHDR_T;
+
+/*
* Print section header values, taking the calling command, and output style
* into account.
*
@@ -196,12 +206,18 @@ process_args(elfedit_obj_state_t *obj_state, int argc, const char *argv[],
* argstate - State block for section header array
* ndx - Index of first section to display
* cnt - Number of sections to display
+ * print_type - Specifies which items are shown
*/
static void
print_shdr(SHDR_CMD_T cmd, int autoprint, ARGSTATE *argstate,
- Word ndx, Word cnt)
+ Word ndx, Word cnt, PRINT_SHDR_T print_type)
{
elfedit_outstyle_t outstyle;
+ Ehdr *ehdr = argstate->obj_state->os_ehdr;
+ uchar_t osabi = ehdr->e_ident[EI_OSABI];
+ Half mach = ehdr->e_machine;
+ elfedit_section_t *ref_sec = &argstate->obj_state->os_secarr[ndx];
+
if ((autoprint && ((elfedit_flags() & ELFEDIT_F_AUTOPRINT) == 0)) ||
(cnt == 0))
@@ -214,152 +230,112 @@ print_shdr(SHDR_CMD_T cmd, int autoprint, ARGSTATE *argstate,
outstyle = (cmd == SHDR_CMD_T_DUMP) ?
ELFEDIT_OUTSTYLE_DEFAULT : elfedit_outstyle();
- /*
- * If doing default output, use elfdump style where we
- * show all section header attributes. In this case, the
- * command that called us doesn't matter
- */
- if (outstyle == ELFEDIT_OUTSTYLE_DEFAULT) {
- Half mach = argstate->obj_state->os_ehdr->e_machine;
+ for (; cnt--; ndx++) {
+ elfedit_section_t *sec = &argstate->obj_state->os_secarr[ndx];
+ Shdr *shdr = sec->sec_shdr;
+
+ switch (print_type) {
+ case PRINT_SHDR_TYPE:
+ if (shdr->sh_type != ref_sec->sec_shdr->sh_type)
+ continue;
+ break;
- for (; cnt--; ndx++) {
- elfedit_section_t *sec =
- &argstate->obj_state->os_secarr[ndx];
+ case PRINT_SHDR_NAME:
+ if (strcmp(sec->sec_name, ref_sec->sec_name) != 0)
+ continue;
+ break;
+ }
+ /*
+ * If doing default output, use elfdump style where we
+ * show all section header attributes. In this case, the
+ * command that called us doesn't matter
+ */
+ if (outstyle == ELFEDIT_OUTSTYLE_DEFAULT) {
elfedit_printf(MSG_ORIG(MSG_STR_NL));
elfedit_printf(MSG_INTL(MSG_ELF_SHDR), ndx,
sec->sec_name);
- Elf_shdr(NULL, mach, sec->sec_shdr);
+ Elf_shdr(NULL, osabi, mach, sec->sec_shdr);
+ continue;
}
- return;
- }
-
-
- switch (cmd) {
- case SHDR_CMD_T_SH_ADDR:
- for (; cnt--; ndx++) {
- Shdr *shdr =
- argstate->obj_state->os_secarr[ndx].sec_shdr;
+ /* Non-default output is handled case by case */
+ switch (cmd) {
+ case SHDR_CMD_T_SH_ADDR:
elfedit_printf(MSG_ORIG(MSG_FMT_XWORDHEXNL),
EC_XWORD(shdr->sh_addr));
- }
- return;
-
- case SHDR_CMD_T_SH_ADDRALIGN:
- for (; cnt--; ndx++) {
- Shdr *shdr =
- argstate->obj_state->os_secarr[ndx].sec_shdr;
+ break;
+ case SHDR_CMD_T_SH_ADDRALIGN:
elfedit_printf(MSG_ORIG(MSG_FMT_XWORDHEXNL),
EC_XWORD(shdr->sh_addralign));
- }
- return;
-
- case SHDR_CMD_T_SH_ENTSIZE:
- for (; cnt--; ndx++) {
- Shdr *shdr =
- argstate->obj_state->os_secarr[ndx].sec_shdr;
+ break;
+ case SHDR_CMD_T_SH_ENTSIZE:
elfedit_printf(MSG_ORIG(MSG_FMT_XWORDHEXNL),
EC_XWORD(shdr->sh_entsize));
- }
- return;
+ break;
- case SHDR_CMD_T_SH_FLAGS:
- for (; cnt--; ndx++) {
- Shdr *shdr =
- argstate->obj_state->os_secarr[ndx].sec_shdr;
+ case SHDR_CMD_T_SH_FLAGS:
if (outstyle == ELFEDIT_OUTSTYLE_SIMPLE) {
Conv_sec_flags_buf_t sec_flags_buf;
elfedit_printf(MSG_ORIG(MSG_FMT_STRNL),
- conv_sec_flags(shdr->sh_flags,
+ conv_sec_flags(osabi, mach, shdr->sh_flags,
CONV_FMT_NOBKT, &sec_flags_buf));
} else {
elfedit_printf(MSG_ORIG(MSG_FMT_XWORDHEXNL),
EC_XWORD(shdr->sh_flags));
}
- }
- return;
-
- case SHDR_CMD_T_SH_INFO:
- for (; cnt--; ndx++) {
- Shdr *shdr =
- argstate->obj_state->os_secarr[ndx].sec_shdr;
+ break;
+ case SHDR_CMD_T_SH_INFO:
elfedit_printf(MSG_ORIG(MSG_FMT_WORDVALNL),
EC_WORD(shdr->sh_info));
- }
- return;
-
- case SHDR_CMD_T_SH_LINK:
- for (; cnt--; ndx++) {
- Shdr *shdr =
- argstate->obj_state->os_secarr[ndx].sec_shdr;
+ break;
+ case SHDR_CMD_T_SH_LINK:
elfedit_printf(MSG_ORIG(MSG_FMT_WORDVALNL),
EC_WORD(shdr->sh_link));
- }
- return;
-
- case SHDR_CMD_T_SH_NAME:
- /*
- * In simple output mode, we show the string. In numeric
- * mode, we show the string table offset.
- */
- for (; cnt--; ndx++) {
- elfedit_section_t *shdr_sec =
- &argstate->obj_state->os_secarr[ndx];
+ break;
+ case SHDR_CMD_T_SH_NAME:
+ /*
+ * In simple output mode, we show the string. In
+ * numeric mode, we show the string table offset.
+ */
if (outstyle == ELFEDIT_OUTSTYLE_SIMPLE) {
elfedit_printf(MSG_ORIG(MSG_FMT_STRNL),
- shdr_sec->sec_name);
+ sec->sec_name);
} else {
elfedit_printf(MSG_ORIG(MSG_FMT_WORDVALNL),
- EC_WORD(shdr_sec->sec_shdr->sh_name));
+ EC_WORD(shdr->sh_name));
}
- }
- return;
-
- case SHDR_CMD_T_SH_OFFSET:
- for (; cnt--; ndx++) {
- Shdr *shdr =
- argstate->obj_state->os_secarr[ndx].sec_shdr;
+ break;
+ case SHDR_CMD_T_SH_OFFSET:
elfedit_printf(MSG_ORIG(MSG_FMT_XWORDHEXNL),
EC_XWORD(shdr->sh_offset));
- }
- return;
-
- case SHDR_CMD_T_SH_SIZE:
- for (; cnt--; ndx++) {
- Shdr *shdr =
- argstate->obj_state->os_secarr[ndx].sec_shdr;
+ break;
+ case SHDR_CMD_T_SH_SIZE:
elfedit_printf(MSG_ORIG(MSG_FMT_XWORDHEXNL),
EC_XWORD(shdr->sh_size));
- }
- return;
+ break;
- case SHDR_CMD_T_SH_TYPE:
- for (; cnt--; ndx++) {
- Shdr *shdr =
- argstate->obj_state->os_secarr[ndx].sec_shdr;
- Conv_inv_buf_t inv_buf;
+ case SHDR_CMD_T_SH_TYPE:
if (outstyle == ELFEDIT_OUTSTYLE_SIMPLE) {
- Half mach =
- argstate->obj_state->os_ehdr->e_machine;
+ Conv_inv_buf_t inv_buf;
elfedit_printf(MSG_ORIG(MSG_FMT_STRNL),
- conv_sec_type(mach, shdr->sh_type, 0,
+ conv_sec_type(osabi, mach, shdr->sh_type, 0,
&inv_buf));
} else {
elfedit_printf(MSG_ORIG(MSG_FMT_WORDHEXNL),
EC_WORD(shdr->sh_type));
}
+ break;
}
- return;
}
}
@@ -379,17 +355,22 @@ static elfedit_cmdret_t
cmd_body(SHDR_CMD_T cmd, elfedit_obj_state_t *obj_state,
int argc, const char *argv[])
{
+ Ehdr *ehdr = obj_state->os_ehdr;
+ uchar_t osabi = ehdr->e_ident[EI_OSABI];
+ Half mach = ehdr->e_machine;
ARGSTATE argstate;
Word ndx;
elfedit_section_t *shdr_sec;
Shdr *shdr;
elfedit_cmdret_t ret = ELFEDIT_CMDRET_NONE;
+ PRINT_SHDR_T print_type;
process_args(obj_state, argc, argv, cmd, &argstate);
/* If there are no arguments, dump the whole table and return */
if (argstate.argc == 0) {
- print_shdr(cmd, 0, &argstate, 0, obj_state->os_shnum);
+ print_shdr(cmd, 0, &argstate, 0, obj_state->os_shnum,
+ PRINT_SHDR_ALL);
return (ELFEDIT_CMDRET_NONE);
}
@@ -398,25 +379,33 @@ cmd_body(SHDR_CMD_T cmd, elfedit_obj_state_t *obj_state,
* name (default), section index, or section type, depending on
* the options used.
*/
- if (argstate.optmask & SHDR_OPT_F_SHNDX)
+ if (argstate.optmask & SHDR_OPT_F_SHNDX) {
ndx = elfedit_atoshndx(argstate.argv[0], obj_state->os_shnum);
- else if (argstate.optmask & SHDR_OPT_F_SHTYP)
+ print_type = PRINT_SHDR_ALL;
+ } else if (argstate.optmask & SHDR_OPT_F_SHTYP) {
ndx = elfedit_type_to_shndx(obj_state,
elfedit_atoconst(argstate.argv[0], ELFEDIT_CONST_SHT));
- else
+ print_type = PRINT_SHDR_TYPE;
+ } else {
ndx = elfedit_name_to_shndx(obj_state, argstate.argv[0]);
+ print_type = PRINT_SHDR_NAME;
+ }
/* If there is a single argument, display that item and return */
if (argstate.argc == 1) {
- print_shdr(cmd, 0, &argstate, ndx, 1);
+ Word cnt;
+
+ cnt = (print_type == PRINT_SHDR_ALL) ?
+ 1 : obj_state->os_shnum - ndx;
+ print_shdr(cmd, 0, &argstate, ndx, cnt, print_type);
return (ELFEDIT_CMDRET_NONE);
}
/*
* Section [0] is supposed to be all zero unless extended sections
* are in force. Rather than setting extended values directly,
- * it is expected to be handled by the ELF header module. So, a
- * direct change here is probably not what was intended.
+ * it is expected to be handled by libelf. So, a direct change here
+ * is probably not what was intended.
*/
if (ndx == 0)
elfedit_msg(ELFEDIT_MSG_DEBUG, MSG_INTL(MSG_DEBUG_CHGSHDR0));
@@ -533,14 +522,17 @@ cmd_body(SHDR_CMD_T cmd, elfedit_obj_state_t *obj_state,
MSG_INTL(MSG_DEBUG_S_OK),
ndx, shdr_sec->sec_name,
MSG_ORIG(MSG_CMD_SH_FLAGS),
- conv_sec_flags(shdr->sh_flags, 0, &buf1));
+ conv_sec_flags(osabi, mach,
+ shdr->sh_flags, 0, &buf1));
} else {
elfedit_msg(ELFEDIT_MSG_DEBUG,
MSG_INTL(MSG_DEBUG_S_CHG),
ndx, shdr_sec->sec_name,
MSG_ORIG(MSG_CMD_SH_FLAGS),
- conv_sec_flags(shdr->sh_flags, 0, &buf1),
- conv_sec_flags(sh_flags, 0, &buf2));
+ conv_sec_flags(osabi, mach,
+ shdr->sh_flags, 0, &buf1),
+ conv_sec_flags(osabi, mach,
+ sh_flags, 0, &buf2));
ret = ELFEDIT_CMDRET_MOD;
shdr->sh_flags = sh_flags;
}
@@ -704,7 +696,6 @@ cmd_body(SHDR_CMD_T cmd, elfedit_obj_state_t *obj_state,
case SHDR_CMD_T_SH_TYPE:
{
- Half mach = obj_state->os_ehdr->e_machine;
Word sh_type = elfedit_atoconst(argstate.argv[1],
ELFEDIT_CONST_SHT);
Conv_inv_buf_t inv_buf1, inv_buf2;
@@ -714,16 +705,17 @@ cmd_body(SHDR_CMD_T cmd, elfedit_obj_state_t *obj_state,
MSG_INTL(MSG_DEBUG_S_OK),
ndx, shdr_sec->sec_name,
MSG_ORIG(MSG_CMD_SH_TYPE),
- conv_sec_type(mach, shdr->sh_type,
+ conv_sec_type(osabi, mach, shdr->sh_type,
0, &inv_buf1));
} else {
elfedit_msg(ELFEDIT_MSG_DEBUG,
MSG_INTL(MSG_DEBUG_S_CHG),
ndx, shdr_sec->sec_name,
MSG_ORIG(MSG_CMD_SH_TYPE),
- conv_sec_type(mach, shdr->sh_type, 0,
- &inv_buf1),
- conv_sec_type(mach, sh_type, 0, &inv_buf2));
+ conv_sec_type(osabi, mach, shdr->sh_type,
+ 0, &inv_buf1),
+ conv_sec_type(osabi, mach, sh_type,
+ 0, &inv_buf2));
ret = ELFEDIT_CMDRET_MOD;
shdr->sh_type = sh_type;
}
@@ -738,7 +730,7 @@ cmd_body(SHDR_CMD_T cmd, elfedit_obj_state_t *obj_state,
elfedit_modified_shdr(shdr_sec);
/* Do autoprint */
- print_shdr(cmd, 1, &argstate, ndx, 1);
+ print_shdr(cmd, 1, &argstate, ndx, 1, PRINT_SHDR_ALL);
return (ret);
}
diff --git a/usr/src/cmd/sgs/elfedit/modules/common/str.c b/usr/src/cmd/sgs/elfedit/modules/common/str.c
index 2caef18805..968bf5d214 100644
--- a/usr/src/cmd/sgs/elfedit/modules/common/str.c
+++ b/usr/src/cmd/sgs/elfedit/modules/common/str.c
@@ -20,10 +20,9 @@
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <ctype.h>
@@ -364,7 +363,7 @@ process_args(elfedit_obj_state_t *obj_state, int argc, const char *argv[],
dynsec->sec_shdr->sh_link)) {
argstate->dyn.sec = elfedit_sec_getdyn(obj_state,
&argstate->dyn.data, &argstate->dyn.n);
- (void) elfedit_dynstr_getpad(dynsec,
+ (void) elfedit_dynstr_getpad(obj_state, dynsec,
&argstate->dyn.strpad);
/*
diff --git a/usr/src/cmd/sgs/elfedit/modules/common/sym.c b/usr/src/cmd/sgs/elfedit/modules/common/sym.c
index 9f6b6ed5a0..40e3a30e2e 100644
--- a/usr/src/cmd/sgs/elfedit/modules/common/sym.c
+++ b/usr/src/cmd/sgs/elfedit/modules/common/sym.c
@@ -20,10 +20,9 @@
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
#define ELF_TARGET_AMD64 /* SHN_AMD64_LCOMMON */
@@ -250,6 +249,7 @@ dump_symtab(ARGSTATE *argstate, SYMSTATE *symstate, Word ndx, Word cnt)
elfedit_section_t *strsec;
Sym *sym;
elfedit_obj_state_t *obj_state = argstate->obj_state;
+ uchar_t osabi = obj_state->os_ehdr->e_ident[EI_OSABI];
Half mach = obj_state->os_ehdr->e_machine;
const char *symname;
Versym versym;
@@ -281,7 +281,7 @@ dump_symtab(ARGSTATE *argstate, SYMSTATE *symstate, Word ndx, Word cnt)
if ((shndx == SHN_XINDEX) && (symstate->xshndx.sec != NULL))
shndx = symstate->xshndx.data[ndx];
shndx_name = elfedit_shndx_to_name(obj_state, shndx);
- Elf_syms_table_entry(NULL, ELF_DBG_ELFDUMP, index, mach,
+ Elf_syms_table_entry(NULL, ELF_DBG_ELFDUMP, index, osabi, mach,
sym, versym, 0, shndx_name, symname);
}
}
@@ -449,7 +449,7 @@ print_symstate(SYM_CMD_T cmd, ARGSTATE *argstate, SYMSTATE *symstate,
if (outstyle == ELFEDIT_OUTSTYLE_SIMPLE) {
elfedit_printf(MSG_ORIG(MSG_FMT_STRNL),
conv_sym_info_bind(value,
- CONV_FMT_ALT_FULLNAME, &inv_buf));
+ CONV_FMT_ALT_CF, &inv_buf));
} else {
elfedit_printf(
MSG_ORIG(MSG_FMT_WORDVALNL),
@@ -532,7 +532,7 @@ print_symstate(SYM_CMD_T cmd, ARGSTATE *argstate, SYMSTATE *symstate,
if (outstyle == ELFEDIT_OUTSTYLE_SIMPLE) {
elfedit_printf(MSG_ORIG(MSG_FMT_STRNL),
conv_sym_info_type(mach, value,
- CONV_FMT_ALT_FULLNAME, &inv_buf));
+ CONV_FMT_ALT_CF, &inv_buf));
} else {
elfedit_printf(
MSG_ORIG(MSG_FMT_WORDVALNL),
@@ -561,7 +561,7 @@ print_symstate(SYM_CMD_T cmd, ARGSTATE *argstate, SYMSTATE *symstate,
if (outstyle == ELFEDIT_OUTSTYLE_SIMPLE) {
elfedit_printf(MSG_ORIG(MSG_FMT_STRNL),
conv_sym_other_vis(value,
- CONV_FMT_ALT_FULLNAME, &inv_buf));
+ CONV_FMT_ALT_CF, &inv_buf));
} else {
elfedit_printf(
MSG_ORIG(MSG_FMT_WORDVALNL),
@@ -702,7 +702,7 @@ cmd_body_set_st_bind(ARGSTATE *argstate, SYMSTATE *symstate)
elfedit_msg(ELFEDIT_MSG_DEBUG, MSG_INTL(MSG_DEBUG_S_OK),
symstate->sym.sec->sec_shndx, symstate->sym.sec->sec_name,
EC_WORD(symstate->ndx), MSG_ORIG(MSG_CMD_ST_BIND),
- conv_sym_info_bind(bind, CONV_FMT_ALT_FULLNAME, &inv_buf1));
+ conv_sym_info_bind(bind, CONV_FMT_ALT_CF, &inv_buf1));
} else {
/*
* The sh_info field of the symbol table section header
@@ -726,9 +726,9 @@ cmd_body_set_st_bind(ARGSTATE *argstate, SYMSTATE *symstate)
elfedit_msg(ELFEDIT_MSG_DEBUG, MSG_INTL(MSG_DEBUG_S_CHG),
symstate->sym.sec->sec_shndx, symstate->sym.sec->sec_name,
EC_WORD(symstate->ndx), MSG_ORIG(MSG_CMD_ST_BIND),
- conv_sym_info_bind(old_bind, CONV_FMT_ALT_FULLNAME,
+ conv_sym_info_bind(old_bind, CONV_FMT_ALT_CF,
&inv_buf1),
- conv_sym_info_bind(bind, CONV_FMT_ALT_FULLNAME, &inv_buf2));
+ conv_sym_info_bind(bind, CONV_FMT_ALT_CF, &inv_buf2));
ret = ELFEDIT_CMDRET_MOD;
sym->st_info = ELF_ST_INFO(bind, type);
}
@@ -956,15 +956,15 @@ cmd_body_set_st_type(ARGSTATE *argstate, SYMSTATE *symstate)
elfedit_msg(ELFEDIT_MSG_DEBUG, MSG_INTL(MSG_DEBUG_S_OK),
symstate->sym.sec->sec_shndx, symstate->sym.sec->sec_name,
EC_WORD(symstate->ndx), MSG_ORIG(MSG_CMD_ST_TYPE),
- conv_sym_info_type(mach, type, CONV_FMT_ALT_FULLNAME,
+ conv_sym_info_type(mach, type, CONV_FMT_ALT_CF,
&inv_buf1));
} else {
elfedit_msg(ELFEDIT_MSG_DEBUG, MSG_INTL(MSG_DEBUG_S_CHG),
symstate->sym.sec->sec_shndx, symstate->sym.sec->sec_name,
EC_WORD(symstate->ndx), MSG_ORIG(MSG_CMD_ST_TYPE),
- conv_sym_info_type(mach, old_type, CONV_FMT_ALT_FULLNAME,
+ conv_sym_info_type(mach, old_type, CONV_FMT_ALT_CF,
&inv_buf1),
- conv_sym_info_type(mach, type, CONV_FMT_ALT_FULLNAME,
+ conv_sym_info_type(mach, type, CONV_FMT_ALT_CF,
&inv_buf2));
ret = ELFEDIT_CMDRET_MOD;
sym->st_info = ELF_ST_INFO(bind, type);
@@ -995,15 +995,15 @@ cmd_body_set_st_visibility(ARGSTATE *argstate, SYMSTATE *symstate)
elfedit_msg(ELFEDIT_MSG_DEBUG, MSG_INTL(MSG_DEBUG_S_OK),
symstate->sym.sec->sec_shndx, symstate->sym.sec->sec_name,
EC_WORD(symstate->ndx), MSG_ORIG(MSG_CMD_ST_VISIBILITY),
- conv_sym_other_vis(old_vis, CONV_FMT_ALT_FULLNAME,
+ conv_sym_other_vis(old_vis, CONV_FMT_ALT_CF,
&inv_buf1));
} else {
elfedit_msg(ELFEDIT_MSG_DEBUG, MSG_INTL(MSG_DEBUG_S_CHG),
symstate->sym.sec->sec_shndx, symstate->sym.sec->sec_name,
EC_WORD(symstate->ndx), MSG_ORIG(MSG_CMD_ST_VISIBILITY),
- conv_sym_other_vis(old_vis, CONV_FMT_ALT_FULLNAME,
+ conv_sym_other_vis(old_vis, CONV_FMT_ALT_CF,
&inv_buf1),
- conv_sym_other_vis(vis, CONV_FMT_ALT_FULLNAME, &inv_buf2));
+ conv_sym_other_vis(vis, CONV_FMT_ALT_CF, &inv_buf2));
ret = ELFEDIT_CMDRET_MOD;
st_other = (st_other & ~MSK_SYM_VISIBILITY) |
ELF_ST_VISIBILITY(vis);
@@ -1110,12 +1110,11 @@ process_args(elfedit_obj_state_t *obj_state, int argc, const char *argv[],
elfedit_msg(ELFEDIT_MSG_ERR, MSG_INTL(MSG_ERR_NEEDEXPSYMTAB));
/*
- * If a section was explicitly specified, it needs
- * be a symbol table.
+ * If a section was explicitly specified, it must be a symbol table.
*/
if (explicit)
- (void) elfedit_sec_issymtab(&obj_state->os_secarr[index],
- 1, NULL);
+ (void) elfedit_sec_issymtab(obj_state,
+ &obj_state->os_secarr[index], 1, NULL);
/* If there may be an arbitrary amount of output, use a pager */
if (argc == 0)
@@ -1141,9 +1140,21 @@ process_args(elfedit_obj_state_t *obj_state, int argc, const char *argv[],
symstate = argstate->symstate;
for (tblndx = 0; tblndx < obj_state->os_symtabnum;
tblndx++, symtab++) {
- /* If explicit table specified, only that table is considered */
- if (explicit && (symtab->symt_shndx != index))
+ /*
+ * If an explicit table is specified, only that table is
+ * considered.
+ *
+ * If no explicit table is specified, verify that table
+ * is considered to be a symbol table by the current osabi,
+ * and quietly skip it if not.
+ */
+ if (explicit) {
+ if (symtab->symt_shndx != index)
+ continue;
+ } else if (elfedit_sec_issymtab(obj_state,
+ &obj_state->os_secarr[symtab->symt_shndx], 0, NULL) == 0) {
continue;
+ }
symstate->sym.sec = elfedit_sec_getsymtab(obj_state, 1,
symtab->symt_shndx, NULL, &symstate->sym.data,
@@ -1503,7 +1514,8 @@ cpl_sh_opt(elfedit_obj_state_t *obj_state, void *cpldata, int argc,
{
elfedit_atoui_sym_t *cpl_list;
- (void) elfedit_sec_issymtab(sec, 1, &cpl_list);
+ (void) elfedit_sec_issymtab(obj_state,
+ sec, 1, &cpl_list);
elfedit_cpl_atoui(cpldata, cpl_list);
}
break;
diff --git a/usr/src/cmd/sgs/elfedit/modules/common/syminfo.c b/usr/src/cmd/sgs/elfedit/modules/common/syminfo.c
index 7ec1b23335..c06f3be6cb 100644
--- a/usr/src/cmd/sgs/elfedit/modules/common/syminfo.c
+++ b/usr/src/cmd/sgs/elfedit/modules/common/syminfo.c
@@ -20,10 +20,9 @@
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <unistd.h>
@@ -492,7 +491,9 @@ needed_to_boundto(ARGSTATE *argstate, const char *arg)
break;
case DT_SUNW_STRPAD:
- elfedit_dyn_elt_save(&strpad_elt, ndx, dyn);
+ if (elfedit_test_osabi(argstate->obj_state,
+ ELFOSABI_SOLARIS, 0))
+ elfedit_dyn_elt_save(&strpad_elt, ndx, dyn);
break;
}
}
@@ -537,7 +538,9 @@ needed_to_boundto(ARGSTATE *argstate, const char *arg)
ndx = null_elt.dn_ndx;
elfedit_msg(ELFEDIT_MSG_DEBUG, MSG_INTL(MSG_DEBUG_CONVNULL),
EC_WORD(dynsec->sec_shndx), dynsec->sec_name, EC_WORD(ndx),
- conv_dyn_tag(DT_NEEDED, argstate->obj_state->os_ehdr->e_machine,
+ conv_dyn_tag(DT_NEEDED,
+ argstate->obj_state->os_ehdr->e_ident[EI_OSABI],
+ argstate->obj_state->os_ehdr->e_machine,
0, &inv_buf));
dyn = argstate->dynamic.data + ndx;
dyn->d_tag = DT_NEEDED;
diff --git a/usr/src/cmd/sgs/include/conv.h b/usr/src/cmd/sgs/include/conv.h
index 1facea96d1..f0d27cd587 100644
--- a/usr/src/cmd/sgs/include/conv.h
+++ b/usr/src/cmd/sgs/include/conv.h
@@ -39,6 +39,7 @@
#include <dlfcn.h>
#include <libld.h>
#include <sgs.h>
+#include <sgsmsg.h>
#ifdef __cplusplus
extern "C" {
@@ -91,47 +92,31 @@ extern "C" {
* The buffer size reflects the maximum number of digits needed to
* display an integer as text, plus a trailing null, and with room for
* a leading "0x" if hexidecimal display is selected.
+ *
+ * The 32-bit version of this requires 12 characters, and the 64-bit version
+ * needs 22. By using the larger value for both, we can have a single
+ * definition, which is necessary for code that is ELFCLASS independent. A
+ * nice side benefit is that it lets us dispense with a large number of 32/64
+ * buffer size definitions that build off CONV_INV_BUFSIZE, and the macros
+ * that would then be needed.
*/
-#define CONV32_INV_BUFSIZE 12
-typedef union {
- char buf[CONV32_INV_BUFSIZE];
-} Conv32_inv_buf_t;
-
-#define CONV64_INV_BUFSIZE 22
+#define CONV_INV_BUFSIZE 22
typedef union {
- char buf[CONV64_INV_BUFSIZE];
-} Conv64_inv_buf_t;
-
-
+ char buf[CONV_INV_BUFSIZE];
+} Conv_inv_buf_t;
/* conv_ehdr_flags() */
-#define CONV_EHDR_FLAGS_BASE_BUFSIZE 69
-#define CONV32_EHDR_FLAGS_BUFSIZE \
- (CONV_EHDR_FLAGS_BASE_BUFSIZE + CONV32_INV_BUFSIZE)
+#define CONV_EHDR_FLAGS_BUFSIZE 91
typedef union {
- Conv32_inv_buf_t inv_buf;
- char buf[CONV32_EHDR_FLAGS_BUFSIZE];
-} Conv32_ehdr_flags_buf_t;
-
-#define CONV64_EHDR_FLAGS_BUFSIZE \
- (CONV_EHDR_FLAGS_BASE_BUFSIZE + CONV64_INV_BUFSIZE)
-typedef union {
- Conv64_inv_buf_t inv_buf;
- char buf[CONV64_EHDR_FLAGS_BUFSIZE];
-} Conv64_ehdr_flags_buf_t;
-
+ Conv_inv_buf_t inv_buf;
+ char buf[CONV_EHDR_FLAGS_BUFSIZE];
+} Conv_ehdr_flags_buf_t;
/* conv_reject_desc() */
typedef union {
- Conv32_inv_buf_t inv_buf;
- Conv32_ehdr_flags_buf_t flags_buf;
-} Conv32_reject_desc_buf_t;
-
-typedef union {
- Conv64_inv_buf_t inv_buf;
- Conv64_ehdr_flags_buf_t flags_buf;
-} Conv64_reject_desc_buf_t;
-
+ Conv_inv_buf_t inv_buf;
+ Conv_ehdr_flags_buf_t flags_buf;
+} Conv_reject_desc_buf_t;
/*
* conv_cap_val_hw1()
@@ -140,17 +125,10 @@ typedef union {
* that exist. See common/elfcap.
*/
#define CONV_CAP_VAL_HW1_BUFSIZE 195
-
-typedef union {
- Conv32_inv_buf_t inv_buf;
- char buf[CONV_CAP_VAL_HW1_BUFSIZE];
-} Conv32_cap_val_hw1_buf_t;
-
typedef union {
- Conv64_inv_buf_t inv_buf;
- char buf[CONV_CAP_VAL_HW1_BUFSIZE];
-} Conv64_cap_val_hw1_buf_t;
-
+ Conv_inv_buf_t inv_buf;
+ char buf[CONV_CAP_VAL_HW1_BUFSIZE];
+} Conv_cap_val_hw1_buf_t;
/*
* conv_cap_val_sf1()
@@ -159,528 +137,214 @@ typedef union {
* that exist. See common/elfcap.
*/
#define CONV_CAP_VAL_SF1_BUFSIZE 45
-
-typedef union {
- Conv32_inv_buf_t inv_buf;
- char buf[CONV_CAP_VAL_SF1_BUFSIZE];
-} Conv32_cap_val_sf1_buf_t;
-
typedef union {
- Conv64_inv_buf_t inv_buf;
- char buf[CONV_CAP_VAL_SF1_BUFSIZE];
-} Conv64_cap_val_sf1_buf_t;
-
-
+ Conv_inv_buf_t inv_buf;
+ char buf[CONV_CAP_VAL_SF1_BUFSIZE];
+} Conv_cap_val_sf1_buf_t;
/* conv_cap_val_buf() */
typedef union {
- Conv32_inv_buf_t inv_buf;
- Conv32_cap_val_hw1_buf_t cap_val_hw1_buf;
- Conv32_cap_val_sf1_buf_t cap_val_sf1_buf;
-} Conv32_cap_val_buf_t;
-
-typedef union {
- Conv64_inv_buf_t inv_buf;
- Conv64_cap_val_hw1_buf_t cap_val_hw1_buf;
- Conv64_cap_val_sf1_buf_t cap_val_sf1_buf;
-} Conv64_cap_val_buf_t;
-
+ Conv_inv_buf_t inv_buf;
+ Conv_cap_val_hw1_buf_t cap_val_hw1_buf;
+ Conv_cap_val_sf1_buf_t cap_val_sf1_buf;
+} Conv_cap_val_buf_t;
/* conv_config_feat() */
-#define CONV_CONFIG_FEAT_BUFSIZE 194
-
-typedef union {
- Conv32_inv_buf_t inv_buf;
- char buf[CONV_CONFIG_FEAT_BUFSIZE];
-} Conv32_config_feat_buf_t;
-
+#define CONV_CONFIG_FEAT_BUFSIZE 204
typedef union {
- Conv64_inv_buf_t inv_buf;
- char buf[CONV_CONFIG_FEAT_BUFSIZE];
-} Conv64_config_feat_buf_t;
-
+ Conv_inv_buf_t inv_buf;
+ char buf[CONV_CONFIG_FEAT_BUFSIZE];
+} Conv_config_feat_buf_t;
/* conv_config_obj() */
-#define CONV_CONFIG_OBJ_BUFSIZE 154
-
-typedef union {
- Conv32_inv_buf_t inv_buf;
- char buf[CONV_CONFIG_OBJ_BUFSIZE];
-} Conv32_config_obj_buf_t;
-
+#define CONV_CONFIG_OBJ_BUFSIZE 164
typedef union {
- Conv64_inv_buf_t inv_buf;
- char buf[CONV_CONFIG_OBJ_BUFSIZE];
-} Conv64_config_obj_buf_t;
-
+ Conv_inv_buf_t inv_buf;
+ char buf[CONV_CONFIG_OBJ_BUFSIZE];
+} Conv_config_obj_buf_t;
/* conv_dl_mode() */
-#define CONV_DL_MODE_BUFSIZE 122
-
+#define CONV_DL_MODE_BUFSIZE 132
typedef union {
- Conv32_inv_buf_t inv_buf;
- char buf[CONV_DL_MODE_BUFSIZE];
-} Conv32_dl_mode_buf_t;
-
-typedef union {
- Conv64_inv_buf_t inv_buf;
- char buf[CONV_DL_MODE_BUFSIZE];
-} Conv64_dl_mode_buf_t;
-
+ Conv_inv_buf_t inv_buf;
+ char buf[CONV_DL_MODE_BUFSIZE];
+} Conv_dl_mode_buf_t;
/* conv_dl_flag() */
-#define CONV_DL_FLAG_BUFSIZE 175
-
+#define CONV_DL_FLAG_BUFSIZE 185
typedef union {
- Conv32_inv_buf_t inv_buf;
- char buf[CONV_DL_FLAG_BUFSIZE];
-} Conv32_dl_flag_buf_t;
-
-typedef union {
- Conv64_inv_buf_t inv_buf;
- char buf[CONV_DL_FLAG_BUFSIZE];
-} Conv64_dl_flag_buf_t;
-
+ Conv_inv_buf_t inv_buf;
+ char buf[CONV_DL_FLAG_BUFSIZE];
+} Conv_dl_flag_buf_t;
/* conv_grphdl_flags() */
-#define CONV_GRPHDL_FLAGS_BUFSIZE 82
-
+#define CONV_GRPHDL_FLAGS_BUFSIZE 92
typedef union {
- Conv32_inv_buf_t inv_buf;
- char buf[CONV_GRPHDL_FLAGS_BUFSIZE];
-} Conv32_grphdl_flags_buf_t;
-
-typedef union {
- Conv64_inv_buf_t inv_buf;
- char buf[CONV_GRPHDL_FLAGS_BUFSIZE];
-} Conv64_grphdl_flags_buf_t;
-
+ Conv_inv_buf_t inv_buf;
+ char buf[CONV_GRPHDL_FLAGS_BUFSIZE];
+} Conv_grphdl_flags_buf_t;
/* conv_grpdesc_flags() */
-#define CONV_GRPDESC_FLAGS_BUFSIZE 92
-
-typedef union {
- Conv32_inv_buf_t inv_buf;
- char buf[CONV_GRPDESC_FLAGS_BUFSIZE];
-} Conv32_grpdesc_flags_buf_t;
-
+#define CONV_GRPDESC_FLAGS_BUFSIZE 102
typedef union {
- Conv64_inv_buf_t inv_buf;
- char buf[CONV_GRPDESC_FLAGS_BUFSIZE];
-} Conv64_grpdesc_flags_buf_t;
-
+ Conv_inv_buf_t inv_buf;
+ char buf[CONV_GRPDESC_FLAGS_BUFSIZE];
+} Conv_grpdesc_flags_buf_t;
/* conv_seg_flags() */
-#define CONV_SEG_FLAGS_BUFSIZE 186
-
-typedef union {
- Conv32_inv_buf_t inv_buf;
- char buf[CONV_SEG_FLAGS_BUFSIZE];
-} Conv32_seg_flags_buf_t;
-
+#define CONV_SEG_FLAGS_BUFSIZE 196
typedef union {
- Conv64_inv_buf_t inv_buf;
- char buf[CONV_SEG_FLAGS_BUFSIZE];
-} Conv64_seg_flags_buf_t;
-
+ Conv_inv_buf_t inv_buf;
+ char buf[CONV_SEG_FLAGS_BUFSIZE];
+} Conv_seg_flags_buf_t;
/* conv_dyn_posflag1() */
-#define CONV_DYN_POSFLAG1_BASE_BUFSIZE 23
-#define CONV32_DYN_POSFLAG1_BUFSIZE \
- (CONV_DYN_POSFLAG1_BASE_BUFSIZE + CONV32_INV_BUFSIZE)
-typedef union {
- Conv32_inv_buf_t inv_buf;
- char buf[CONV32_DYN_POSFLAG1_BUFSIZE];
-} Conv32_dyn_posflag1_buf_t;
-
-#define CONV64_DYN_POSFLAG1_BUFSIZE \
- (CONV_DYN_POSFLAG1_BASE_BUFSIZE + CONV64_INV_BUFSIZE)
+#define CONV_DYN_POSFLAG1_BUFSIZE 57
typedef union {
- Conv64_inv_buf_t inv_buf;
- char buf[CONV64_DYN_POSFLAG1_BUFSIZE];
-} Conv64_dyn_posflag1_buf_t;
-
+ Conv_inv_buf_t inv_buf;
+ char buf[CONV_DYN_POSFLAG1_BUFSIZE];
+} Conv_dyn_posflag1_buf_t;
/* conv_dyn_flag() */
-#define CONV_DYN_FLAG_BASE_BUFSIZE 48
-#define CONV32_DYN_FLAG_BUFSIZE \
- (CONV_DYN_FLAG_BASE_BUFSIZE + CONV32_INV_BUFSIZE)
+#define CONV_DYN_FLAG_BUFSIZE 85
typedef union {
- Conv32_inv_buf_t inv_buf;
- char buf[CONV32_DYN_FLAG_BUFSIZE];
-} Conv32_dyn_flag_buf_t;
-
-#define CONV64_DYN_FLAG_BUFSIZE \
- (CONV_DYN_FLAG_BASE_BUFSIZE + CONV64_INV_BUFSIZE)
-typedef union {
- Conv64_inv_buf_t inv_buf;
- char buf[CONV64_DYN_FLAG_BUFSIZE];
-} Conv64_dyn_flag_buf_t;
-
+ Conv_inv_buf_t inv_buf;
+ char buf[CONV_DYN_FLAG_BUFSIZE];
+} Conv_dyn_flag_buf_t;
/* conv_dyn_flag1() */
-#define CONV_DYN_FLAG1_BASE_BUFSIZE 265
-#define CONV32_DYN_FLAG1_BUFSIZE \
- (CONV_DYN_FLAG1_BASE_BUFSIZE + CONV32_INV_BUFSIZE)
-typedef union {
- Conv32_inv_buf_t inv_buf;
- char buf[CONV32_DYN_FLAG1_BUFSIZE];
-} Conv32_dyn_flag1_buf_t;
-
-#define CONV64_DYN_FLAG1_BUFSIZE \
- (CONV_DYN_FLAG1_BASE_BUFSIZE + CONV64_INV_BUFSIZE)
+#define CONV_DYN_FLAG1_BUFSIZE 361
typedef union {
- Conv64_inv_buf_t inv_buf;
- char buf[CONV64_DYN_FLAG1_BUFSIZE];
-} Conv64_dyn_flag1_buf_t;
-
+ Conv_inv_buf_t inv_buf;
+ char buf[CONV_DYN_FLAG1_BUFSIZE];
+} Conv_dyn_flag1_buf_t;
/* conv_dyn_feature1() */
-#define CONV_DYN_FEATURE1_BASE_BUFSIZE 20
-#define CONV32_DYN_FEATURE1_BUFSIZE \
- (CONV_DYN_FEATURE1_BASE_BUFSIZE + CONV32_INV_BUFSIZE)
-typedef union {
- Conv32_inv_buf_t inv_buf;
- char buf[CONV32_DYN_FEATURE1_BUFSIZE];
-} Conv32_dyn_feature1_buf_t;
-
-#define CONV64_DYN_FEATURE1_BUFSIZE \
- (CONV_DYN_FEATURE1_BASE_BUFSIZE + CONV64_INV_BUFSIZE)
+#define CONV_DYN_FEATURE1_BUFSIZE 54
typedef union {
- Conv64_inv_buf_t inv_buf;
- char buf[CONV64_DYN_FEATURE1_BUFSIZE];
-} Conv64_dyn_feature1_buf_t;
-
+ Conv_inv_buf_t inv_buf;
+ char buf[CONV_DYN_FEATURE1_BUFSIZE];
+} Conv_dyn_feature1_buf_t;
/* conv_bnd_type() */
-#define CONV_BND_TYPE_BASE_BUFSIZE 29
-#define CONV32_BND_TYPE_BUFSIZE \
- (CONV_BND_TYPE_BASE_BUFSIZE + CONV32_INV_BUFSIZE)
+#define CONV_BND_TYPE_BUFSIZE 51
typedef union {
- Conv32_inv_buf_t inv_buf;
- char buf[CONV32_BND_TYPE_BUFSIZE];
-} Conv32_bnd_type_buf_t;
-
-#define CONV64_BND_TYPE_BUFSIZE \
- (CONV_BND_TYPE_BASE_BUFSIZE + CONV64_INV_BUFSIZE)
-typedef union {
- Conv64_inv_buf_t inv_buf;
- char buf[CONV64_BND_TYPE_BUFSIZE];
-} Conv64_bnd_type_buf_t;
-
+ Conv_inv_buf_t inv_buf;
+ char buf[CONV_BND_TYPE_BUFSIZE];
+} Conv_bnd_type_buf_t;
/* conv_bnd_obj() */
-#define CONV_BND_OBJ_BASE_BUFSIZE 38
-#define CONV32_BND_OBJ_BUFSIZE \
- (CONV_BND_OBJ_BASE_BUFSIZE + CONV32_INV_BUFSIZE)
-typedef union {
- Conv32_inv_buf_t inv_buf;
- char buf[CONV32_BND_OBJ_BUFSIZE];
-} Conv32_bnd_obj_buf_t;
-
-#define CONV64_BND_OBJ_BUFSIZE \
- (CONV_BND_OBJ_BASE_BUFSIZE + CONV64_INV_BUFSIZE)
+#define CONV_BND_OBJ_BUFSIZE 60
typedef union {
- Conv64_inv_buf_t inv_buf;
- char buf[CONV64_BND_OBJ_BUFSIZE];
-} Conv64_bnd_obj_buf_t;
-
+ Conv_inv_buf_t inv_buf;
+ char buf[CONV_BND_OBJ_BUFSIZE];
+} Conv_bnd_obj_buf_t;
/* conv_phdr_flags() */
-#define CONV_PHDR_FLAGS_BASE_BUFSIZE 35
-#define CONV32_PHDR_FLAGS_BUFSIZE \
- (CONV_PHDR_FLAGS_BASE_BUFSIZE + CONV32_INV_BUFSIZE)
-typedef union {
- Conv32_inv_buf_t inv_buf;
- char buf[CONV32_PHDR_FLAGS_BUFSIZE];
-} Conv32_phdr_flags_buf_t;
-
-#define CONV64_PHDR_FLAGS_BUFSIZE \
- (CONV_PHDR_FLAGS_BASE_BUFSIZE + CONV64_INV_BUFSIZE)
+#define CONV_PHDR_FLAGS_BUFSIZE 57
typedef union {
- Conv64_inv_buf_t inv_buf;
- char buf[CONV64_PHDR_FLAGS_BUFSIZE];
-} Conv64_phdr_flags_buf_t;
-
+ Conv_inv_buf_t inv_buf;
+ char buf[CONV_PHDR_FLAGS_BUFSIZE];
+} Conv_phdr_flags_buf_t;
/* conv_sec_flags() */
-#define CONV_SEC_FLAGS_BASE_BUFSIZE 168
-#define CONV32_SEC_FLAGS_BUFSIZE \
- (CONV_SEC_FLAGS_BASE_BUFSIZE + CONV32_INV_BUFSIZE)
-typedef union {
- Conv32_inv_buf_t inv_buf;
- char buf[CONV32_SEC_FLAGS_BUFSIZE];
-} Conv32_sec_flags_buf_t;
-
-#define CONV64_SEC_FLAGS_BUFSIZE \
- (CONV_SEC_FLAGS_BASE_BUFSIZE + CONV64_INV_BUFSIZE)
+#define CONV_SEC_FLAGS_BUFSIZE 190
typedef union {
- Conv64_inv_buf_t inv_buf;
- char buf[CONV64_SEC_FLAGS_BUFSIZE];
-} Conv64_sec_flags_buf_t;
-
+ Conv_inv_buf_t inv_buf;
+ char buf[CONV_SEC_FLAGS_BUFSIZE];
+} Conv_sec_flags_buf_t;
/* conv_dwarf_ehe() */
-#define CONV_DWARF_EHE_BUFSIZE 33
-typedef union {
- Conv32_inv_buf_t inv_buf;
- char buf[CONV_DWARF_EHE_BUFSIZE];
-} Conv32_dwarf_ehe_buf_t;
+#define CONV_DWARF_EHE_BUFSIZE 43
typedef union {
- Conv64_inv_buf_t inv_buf;
- char buf[CONV_DWARF_EHE_BUFSIZE];
-} Conv64_dwarf_ehe_buf_t;
-
+ Conv_inv_buf_t inv_buf;
+ char buf[CONV_DWARF_EHE_BUFSIZE];
+} Conv_dwarf_ehe_buf_t;
/* conv_syminfo_flags() */
-#define CONV_SYMINFO_FLAGS_BASE_BUFSIZE 36
-#define CONV32_SYMINFO_FLAGS_BUFSIZE \
- (CONV_SYMINFO_FLAGS_BASE_BUFSIZE + CONV32_INV_BUFSIZE)
-typedef union {
- Conv32_inv_buf_t inv_buf;
- char buf[CONV32_SYMINFO_FLAGS_BUFSIZE];
-} Conv32_syminfo_flags_buf_t;
-
-#define CONV64_SYMINFO_FLAGS_BUFSIZE \
- (CONV_SYMINFO_FLAGS_BASE_BUFSIZE + CONV64_INV_BUFSIZE)
+#define CONV_SYMINFO_FLAGS_BUFSIZE 193
typedef union {
- Conv64_inv_buf_t inv_buf;
- char buf[CONV64_SYMINFO_FLAGS_BUFSIZE];
-} Conv64_syminfo_flags_buf_t;
-
+ Conv_inv_buf_t inv_buf;
+ char buf[CONV_SYMINFO_FLAGS_BUFSIZE];
+} Conv_syminfo_flags_buf_t;
/* conv_cnote_pr_flags() */
-#define CONV_CNOTE_PR_FLAGS_BUFSIZE 244
+#define CONV_CNOTE_PR_FLAGS_BUFSIZE 254
typedef union {
- Conv32_inv_buf_t inv_buf;
- char buf[CONV_CNOTE_PR_FLAGS_BUFSIZE];
-} Conv32_cnote_pr_flags_buf_t;
-typedef union {
- Conv64_inv_buf_t inv_buf;
- char buf[CONV_CNOTE_PR_FLAGS_BUFSIZE];
-} Conv64_cnote_pr_flags_buf_t;
-
+ Conv_inv_buf_t inv_buf;
+ char buf[CONV_CNOTE_PR_FLAGS_BUFSIZE];
+} Conv_cnote_pr_flags_buf_t;
/* conv_cnote_old_pr_flags() */
-#define CONV_CNOTE_OLD_PR_FLAGS_BUFSIZE 164
-typedef union {
- Conv32_inv_buf_t inv_buf;
- char buf[CONV_CNOTE_OLD_PR_FLAGS_BUFSIZE];
-} Conv32_cnote_old_pr_flags_buf_t;
+#define CONV_CNOTE_OLD_PR_FLAGS_BUFSIZE 174
typedef union {
- Conv64_inv_buf_t inv_buf;
- char buf[CONV_CNOTE_OLD_PR_FLAGS_BUFSIZE];
-} Conv64_cnote_old_pr_flags_buf_t;
-
+ Conv_inv_buf_t inv_buf;
+ char buf[CONV_CNOTE_OLD_PR_FLAGS_BUFSIZE];
+} Conv_cnote_old_pr_flags_buf_t;
/* conv_cnote_proc_flag() */
-#define CONV_CNOTE_PROC_FLAG_BUFSIZE 29
-typedef union {
- Conv32_inv_buf_t inv_buf;
- char buf[CONV_CNOTE_PROC_FLAG_BUFSIZE];
-} Conv32_cnote_proc_flag_buf_t;
+#define CONV_CNOTE_PROC_FLAG_BUFSIZE 39
typedef union {
- Conv64_inv_buf_t inv_buf;
- char buf[CONV_CNOTE_PROC_FLAG_BUFSIZE];
-} Conv64_cnote_proc_flag_buf_t;
+ Conv_inv_buf_t inv_buf;
+ char buf[CONV_CNOTE_PROC_FLAG_BUFSIZE];
+} Conv_cnote_proc_flag_buf_t;
/* conv_cnote_sigset() */
-#define CONV_CNOTE_SIGSET_BUFSIZE 629
+#define CONV_CNOTE_SIGSET_BUFSIZE 639
typedef union {
- Conv32_inv_buf_t inv_buf;
- char buf[CONV_CNOTE_SIGSET_BUFSIZE];
-} Conv32_cnote_sigset_buf_t;
-typedef union {
- Conv64_inv_buf_t inv_buf;
- char buf[CONV_CNOTE_SIGSET_BUFSIZE];
-} Conv64_cnote_sigset_buf_t;
-
+ Conv_inv_buf_t inv_buf;
+ char buf[CONV_CNOTE_SIGSET_BUFSIZE];
+} Conv_cnote_sigset_buf_t;
/* conv_cnote_fltset() */
-#define CONV_CNOTE_FLTSET_BUFSIZE 501
+#define CONV_CNOTE_FLTSET_BUFSIZE 511
typedef union {
- Conv32_inv_buf_t inv_buf;
- char buf[CONV_CNOTE_FLTSET_BUFSIZE];
-} Conv32_cnote_fltset_buf_t;
-typedef union {
- Conv64_inv_buf_t inv_buf;
- char buf[CONV_CNOTE_FLTSET_BUFSIZE];
-} Conv64_cnote_fltset_buf_t;
-
+ Conv_inv_buf_t inv_buf;
+ char buf[CONV_CNOTE_FLTSET_BUFSIZE];
+} Conv_cnote_fltset_buf_t;
/* conv_cnote_sysset() */
-#define CONV_CNOTE_SYSSET_BUFSIZE 3212
+#define CONV_CNOTE_SYSSET_BUFSIZE 3222
typedef union {
- Conv32_inv_buf_t inv_buf;
- char buf[CONV_CNOTE_SYSSET_BUFSIZE];
-} Conv32_cnote_sysset_buf_t;
-typedef union {
- Conv64_inv_buf_t inv_buf;
- char buf[CONV_CNOTE_SYSSET_BUFSIZE];
-} Conv64_cnote_sysset_buf_t;
-
+ Conv_inv_buf_t inv_buf;
+ char buf[CONV_CNOTE_SYSSET_BUFSIZE];
+} Conv_cnote_sysset_buf_t;
/* conv_cnote_sa_flags() */
-#define CONV_CNOTE_SA_FLAGS_BUFSIZE 99
-typedef union {
- Conv32_inv_buf_t inv_buf;
- char buf[CONV_CNOTE_SA_FLAGS_BUFSIZE];
-} Conv32_cnote_sa_flags_buf_t;
+#define CONV_CNOTE_SA_FLAGS_BUFSIZE 109
typedef union {
- Conv64_inv_buf_t inv_buf;
- char buf[CONV_CNOTE_SA_FLAGS_BUFSIZE];
-} Conv64_cnote_sa_flags_buf_t;
-
+ Conv_inv_buf_t inv_buf;
+ char buf[CONV_CNOTE_SA_FLAGS_BUFSIZE];
+} Conv_cnote_sa_flags_buf_t;
/* conv_cnote_ss_flags() */
-#define CONV_CNOTE_SS_FLAGS_BUFSIZE 38
-typedef union {
- Conv32_inv_buf_t inv_buf;
- char buf[CONV_CNOTE_SS_FLAGS_BUFSIZE];
-} Conv32_cnote_ss_flags_buf_t;
+#define CONV_CNOTE_SS_FLAGS_BUFSIZE 48
typedef union {
- Conv64_inv_buf_t inv_buf;
- char buf[CONV_CNOTE_SS_FLAGS_BUFSIZE];
-} Conv64_cnote_ss_flags_buf_t;
-
+ Conv_inv_buf_t inv_buf;
+ char buf[CONV_CNOTE_SS_FLAGS_BUFSIZE];
+} Conv_cnote_ss_flags_buf_t;
/* conv_cnote_cc_content() */
-#define CONV_CNOTE_CC_CONTENT_BUFSIZE 87
-typedef union {
- Conv32_inv_buf_t inv_buf;
- char buf[CONV_CNOTE_CC_CONTENT_BUFSIZE];
-} Conv32_cnote_cc_content_buf_t;
+#define CONV_CNOTE_CC_CONTENT_BUFSIZE 97
typedef union {
- Conv64_inv_buf_t inv_buf;
- char buf[CONV_CNOTE_CC_CONTENT_BUFSIZE];
-} Conv64_cnote_cc_content_buf_t;
-
+ Conv_inv_buf_t inv_buf;
+ char buf[CONV_CNOTE_CC_CONTENT_BUFSIZE];
+} Conv_cnote_cc_content_buf_t;
/* conv_cnote_auxv_af() */
-#define CONV_CNOTE_AUXV_AF_BUFSIZE 63
-typedef union {
- Conv32_inv_buf_t inv_buf;
- char buf[CONV_CNOTE_AUXV_AF_BUFSIZE];
-} Conv32_cnote_auxv_af_buf_t;
+#define CONV_CNOTE_AUXV_AF_BUFSIZE 73
typedef union {
- Conv64_inv_buf_t inv_buf;
- char buf[CONV_CNOTE_AUXV_AF_BUFSIZE];
-} Conv64_cnote_auxv_af_buf_t;
-
+ Conv_inv_buf_t inv_buf;
+ char buf[CONV_CNOTE_AUXV_AF_BUFSIZE];
+} Conv_cnote_auxv_af_buf_t;
/* conv_ver_flags() */
-#define CONV_VER_FLAGS_BUFSIZE 31
-typedef union {
- Conv32_inv_buf_t inv_buf;
- char buf[CONV_VER_FLAGS_BUFSIZE];
-} Conv32_ver_flags_buf_t;
+#define CONV_VER_FLAGS_BUFSIZE 41
typedef union {
- Conv64_inv_buf_t inv_buf;
- char buf[CONV_VER_FLAGS_BUFSIZE];
-} Conv64_ver_flags_buf_t;
-
-
-
-/*
- * Generic names for class specific buffer types above
- */
-#if defined(_ELF64)
-#define CONV_INV_BUFSIZE CONV64_INV_BUFSIZE
-#define CONV_EHDR_FLAGS_BUFSIZE CONV64_EHDR_FLAGS_BUFSIZE
-#define CONV_DYN_POSFLAG1_BUFSIZE CONV64_DYN_POSFLAG1_BUFSIZE
-#define CONV_DYN_FLAG_BUFSIZE CONV64_DYN_FLAG_BUFSIZE
-#define CONV_DYN_FLAG1_BUFSIZE CONV64_DYN_FLAG1_BUFSIZE
-#define CONV_DYN_FEATURE1_BUFSIZE CONV64_DYN_FEATURE1_BUFSIZE
-#define CONV_BND_TYPE_BUFSIZE CONV64_BND_TYPE_BUFSIZE
-#define CONV_BND_OBJ_BUFSIZE CONV64_BND_OBJ_BUFSIZE
-#define CONV_PHDR_FLAGS_BUFSIZE CONV64_PHDR_FLAGS_BUFSIZE
-#define CONV_SEC_FLAGS_BUFSIZE CONV64_SEC_FLAGS_BUFSIZE
-#define CONV_SYMINFO_FLAGS_BUFSIZE CONV64_SYMINFO_FLAGS_BUFSIZE
-
-#define Conv_inv_buf_t Conv64_inv_buf_t
-#define Conv_ehdr_flags_buf_t Conv64_ehdr_flags_buf_t
-#define Conv_reject_desc_buf_t Conv64_reject_desc_buf_t
-#define Conv_cap_val_hw1_buf_t Conv64_cap_val_hw1_buf_t
-#define Conv_cap_val_sf1_buf_t Conv64_cap_val_sf1_buf_t
-#define Conv_cap_val_buf_t Conv64_cap_val_buf_t
-#define Conv_config_feat_buf_t Conv64_config_feat_buf_t
-#define Conv_config_obj_buf_t Conv64_config_obj_buf_t
-#define Conv_dl_mode_buf_t Conv64_dl_mode_buf_t
-#define Conv_dl_flag_buf_t Conv64_dl_flag_buf_t
-#define Conv_grphdl_flags_buf_t Conv64_grphdl_flags_buf_t
-#define Conv_grpdesc_flags_buf_t Conv64_grpdesc_flags_buf_t
-#define Conv_seg_flags_buf_t Conv64_seg_flags_buf_t
-#define Conv_dyn_posflag1_buf_t Conv64_dyn_posflag1_buf_t
-#define Conv_dyn_flag_buf_t Conv64_dyn_flag_buf_t
-#define Conv_dyn_flag1_buf_t Conv64_dyn_flag1_buf_t
-#define Conv_dyn_feature1_buf_t Conv64_dyn_feature1_buf_t
-#define Conv_bnd_type_buf_t Conv64_bnd_type_buf_t
-#define Conv_bnd_obj_buf_t Conv64_bnd_obj_buf_t
-#define Conv_phdr_flags_buf_t Conv64_phdr_flags_buf_t
-#define Conv_sec_flags_buf_t Conv64_sec_flags_buf_t
-#define Conv_dwarf_ehe_buf_t Conv64_dwarf_ehe_buf_t
-#define Conv_syminfo_flags_buf_t Conv64_syminfo_flags_buf_t
-#define Conv_cnote_pr_flags_buf_t Conv64_cnote_pr_flags_buf_t
-#define Conv_cnote_old_pr_flags_buf_t Conv64_cnote_old_pr_flags_buf_t
-#define Conv_cnote_proc_flag_buf_t Conv64_cnote_proc_flag_buf_t
-#define Conv_cnote_sigset_buf_t Conv64_cnote_sigset_buf_t
-#define Conv_cnote_fltset_buf_t Conv64_cnote_fltset_buf_t
-#define Conv_cnote_sysset_buf_t Conv64_cnote_sysset_buf_t
-#define Conv_cnote_sa_flags_buf_t Conv64_cnote_sa_flags_buf_t
-#define Conv_cnote_ss_flags_buf_t Conv64_cnote_ss_flags_buf_t
-#define Conv_cnote_cc_content_buf_t Conv64_cnote_cc_content_buf_t
-#define Conv_cnote_auxv_af_buf_t Conv64_cnote_auxv_af_buf_t
-#define Conv_ver_flags_buf_t Conv64_ver_flags_buf_t
-#else
-#define CONV_INV_BUFSIZE CONV32_INV_BUFSIZE
-#define CONV_EHDR_FLAGS_BUFSIZE CONV32_EHDR_FLAGS_BUFSIZE
-#define CONV_DYN_POSFLAG1_BUFSIZE CONV32_DYN_POSFLAG1_BUFSIZE
-#define CONV_DYN_FLAG_BUFSIZE CONV32_DYN_FLAG_BUFSIZE
-#define CONV_DYN_FLAG1_BUFSIZE CONV32_DYN_FLAG1_BUFSIZE
-#define CONV_DYN_FEATURE1_BUFSIZE CONV32_DYN_FEATURE1_BUFSIZE
-#define CONV_BND_TYPE_BUFSIZE CONV32_BND_TYPE_BUFSIZE
-#define CONV_BND_OBJ_BUFSIZE CONV32_BND_OBJ_BUFSIZE
-#define CONV_PHDR_FLAGS_BUFSIZE CONV32_PHDR_FLAGS_BUFSIZE
-#define CONV_SEC_FLAGS_BUFSIZE CONV32_SEC_FLAGS_BUFSIZE
-#define CONV_SYMINFO_FLAGS_BUFSIZE CONV32_SYMINFO_FLAGS_BUFSIZE
-
-#define Conv_inv_buf_t Conv32_inv_buf_t
-#define Conv_ehdr_flags_buf_t Conv32_ehdr_flags_buf_t
-#define Conv_reject_desc_buf_t Conv32_reject_desc_buf_t
-#define Conv_cap_val_hw1_buf_t Conv32_cap_val_hw1_buf_t
-#define Conv_cap_val_sf1_buf_t Conv32_cap_val_sf1_buf_t
-#define Conv_cap_val_buf_t Conv32_cap_val_buf_t
-#define Conv_config_feat_buf_t Conv32_config_feat_buf_t
-#define Conv_config_obj_buf_t Conv32_config_obj_buf_t
-#define Conv_dl_mode_buf_t Conv32_dl_mode_buf_t
-#define Conv_dl_flag_buf_t Conv32_dl_flag_buf_t
-#define Conv_grphdl_flags_buf_t Conv32_grphdl_flags_buf_t
-#define Conv_grpdesc_flags_buf_t Conv32_grpdesc_flags_buf_t
-#define Conv_seg_flags_buf_t Conv32_seg_flags_buf_t
-#define Conv_dyn_posflag1_buf_t Conv32_dyn_posflag1_buf_t
-#define Conv_dyn_flag_buf_t Conv32_dyn_flag_buf_t
-#define Conv_dyn_flag1_buf_t Conv32_dyn_flag1_buf_t
-#define Conv_dyn_feature1_buf_t Conv32_dyn_feature1_buf_t
-#define Conv_bnd_type_buf_t Conv32_bnd_type_buf_t
-#define Conv_bnd_obj_buf_t Conv32_bnd_obj_buf_t
-#define Conv_phdr_flags_buf_t Conv32_phdr_flags_buf_t
-#define Conv_sec_flags_buf_t Conv32_sec_flags_buf_t
-#define Conv_dwarf_ehe_buf_t Conv32_dwarf_ehe_buf_t
-#define Conv_syminfo_flags_buf_t Conv32_syminfo_flags_buf_t
-#define Conv_cnote_pr_flags_buf_t Conv32_cnote_pr_flags_buf_t
-#define Conv_cnote_old_pr_flags_buf_t Conv32_cnote_old_pr_flags_buf_t
-#define Conv_cnote_proc_flag_buf_t Conv32_cnote_proc_flag_buf_t
-#define Conv_cnote_sigset_buf_t Conv32_cnote_sigset_buf_t
-#define Conv_cnote_fltset_buf_t Conv32_cnote_fltset_buf_t
-#define Conv_cnote_sysset_buf_t Conv32_cnote_sysset_buf_t
-#define Conv_cnote_sa_flags_buf_t Conv32_cnote_sa_flags_buf_t
-#define Conv_cnote_ss_flags_buf_t Conv32_cnote_ss_flags_buf_t
-#define Conv_cnote_cc_content_buf_t Conv32_cnote_cc_content_buf_t
-#define Conv_cnote_auxv_af_buf_t Conv32_cnote_auxv_af_buf_t
-#define Conv_ver_flags_buf_t Conv32_ver_flags_buf_t
-#endif
-
+ Conv_inv_buf_t inv_buf;
+ char buf[CONV_VER_FLAGS_BUFSIZE];
+} Conv_ver_flags_buf_t;
@@ -693,25 +357,63 @@ typedef union {
* (2) The low order bits specified by CONV_MASK_FMT_ALT
* and retrieved by CONV_TYPE_FMT_ALT are integer
* values that specify that an alternate set of
- * strings should be used. This is necessary because
- * different utilities evolved to use different strings,
- * and there are backward compatability guarantees in
- * place that prevent changing them.
+ * strings should be used.
*
- * These values are designed such that a caller can always supply a
- * simple 0 in order to receive "default" behavior.
+ * The fmt_flags value is designed such that a caller can always
+ * supply a 0 in order to receive default behavior.
*/
typedef int Conv_fmt_flags_t;
/*
- * The bottom 8 bits of Conv_fmt_flags_t are used to encode
- * alternative strings.
+ * Type used to represent ELF constants within libconv. This relies on
+ * the fact that there are no ELF constants that need more than 32-bits,
+ * nor are there any signed values.
+ */
+typedef uint32_t Conv_elfvalue_t;
+
+/*
+ * Most conversion routines are able to provide strings in one of
+ * several alternative styles. The bottom 8 bits of Conv_fmt_flags_t
+ * are used to specify which strings should be used for a given call
+ * to a conversion routine:
+ *
+ * DEFAULT
+ * The default string style used by a given conversion routine is
+ * an independent choice made by that routine. Different routines
+ * make different choices, based largely on historical usage and
+ * the perceived common case. It may be an alias for one of the
+ * specific styles listed below, or it may be unique.
+ *
+ * DUMP
+ * Style of strings used by dump(1).
+ *
+ * FILE
+ * Style of strings used by file(1).
+ *
+ * CRLE
+ * Style of strings used by crle(1).
*
- * If a given conversion routine does not support alternative strings
- * for a given CONV_FMT_ALT type, it silently ignores the request and
- * supplies the default set. This means that a utility like dump(1) is
- * free to specify its special type in every conversion routine call,
- * without regard to whether it has any special meaning for that particular
+ * CF
+ * Canonical Form: The string is exactly the same as the name
+ * of the #define macro that defines it in the public header files.
+ * (e.g. STB_LOCAL, not LOCL, LOCAL, LOC, or any other variation).
+ *
+ * CFNP
+ * No Prefix Canonical Form: The same strings supplied by CF,
+ * but without their standard prefix. (e.g. LOCAL, instead of STT_LOCAL).
+ *
+ * NF
+ * Natural Form: The form of the strings that might typically be entered
+ * via a keyboard by an interactive user. These are usually the strings
+ * from CFNP, converted to lowercase, although in some cases they may
+ * take some other "natural" form. In command completion applications,
+ * lowercase strings appear less formal, and are easier on the eye.
+ *
+ * Every routine is required to have a default style. The others are optional,
+ * and may not be provided if not needed. If a given conversion routine does
+ * not support alternative strings for a given CONV_FMT_ALT type, it silently
+ * ignores the request and supplies the default set. This means that a utility
+ * like dump(1) is free to specify a style like DUMP to every conversion
* routine. It will receive its special strings if there are any, and
* the defaults otherwise.
*/
@@ -719,11 +421,12 @@ typedef int Conv_fmt_flags_t;
#define CONV_TYPE_FMT_ALT(fmt_flags) (fmt_flags & CONV_MASK_FMT_ALT)
#define CONV_FMT_ALT_DEFAULT 0 /* "Standard" strings */
-#define CONV_FMT_ALT_DUMP 1 /* Style of strings used by dump(1) */
-#define CONV_FMT_ALT_FILE 2 /* Style of strings used by file(1) */
-#define CONV_FMT_ALT_CRLE 3 /* Style of strings used by crle(1) */
-#define CONV_FMT_ALT_FULLNAME 4 /* Strings should be full #define */
- /* (e.g. STB_LOCAL, not LOCL) */
+#define CONV_FMT_ALT_DUMP 1 /* dump(1) */
+#define CONV_FMT_ALT_FILE 2 /* file(1) */
+#define CONV_FMT_ALT_CRLE 3 /* crle(1) */
+#define CONV_FMT_ALT_CF 4 /* Canonical Form */
+#define CONV_FMT_ALT_CFNP 5 /* No Prefix Canonical Form */
+#define CONV_FMT_ALT_NF 6 /* Natural Form */
/*
* Flags that alter standard formatting for conversion routines.
@@ -737,15 +440,210 @@ typedef int Conv_fmt_flags_t;
#define CONV_FMT_NOBKT 0x0400 /* conv_expn_field() should omit */
/* prefix and suffix strings */
-
/*
- * The expansion of bit-field data items is driven from a value descriptor and
- * the conv_expn_field() routine.
+ * A Val_desc structure is used to associate an ELF constant and
+ * the message code (Msg) for the string that corresponds to it.
+ *
+ * Val_desc2 adds v_osabi and v_mach fields to Val_desc, which allows
+ * for non-generic mappings that apply only to a specific OSABI/machine.
+ * Setting v_osabi to 0 (ELFOSABI_NONE) specifies that any OSABI matches.
+ * Similarly, setting v_mach to 0 (EM_MACH) matches any machine. Hence,
+ * setting v_osabi and v_mach to 0 in a Val_desc2 results in a generic item,
+ * and is equivalent to simply using a Val_desc.
+ *
+ * These structs are used in two different contexts:
+ *
+ * 1) To expand bit-field data items, using conv_expn_field() to
+ * process a NULL terminated array of Val_desc, or conv_expn_field2()
+ * to process a null terminated array of Val_desc2.
+ *
+ * 2) To represent sparse ranges of non-bitfield values, referenced via
+ * conv_ds_vd_t or conv_ds_vd2_t descriptors, as described below.
*/
typedef struct {
- Xword v_val; /* expansion value */
- const char *v_msg; /* associated message string */
+ Conv_elfvalue_t v_val; /* expansion value */
+ Msg v_msg; /* associated message string code */
} Val_desc;
+typedef struct {
+ Conv_elfvalue_t v_val; /* expansion value */
+ uchar_t v_osabi; /* OSABI to which entry applies */
+ Half v_mach; /* Machine to which entry applies */
+ Msg v_msg; /* associated message string code */
+} Val_desc2;
+
+/*
+ * The conv_ds_XXX_t structs are used to pull together the information used
+ * to map non-bitfield values to strings. They are a variant family, sharing
+ * the same initial fields, with a generic "header" definition that can be
+ * used to read those common fields and determine which subcase is being
+ * seen. We do this instead of using a single struct containing a type code
+ * and a union in order to allow for static compile-time initialization.
+ *
+ * conv_ds_t is the base type, containing the initial fields common to all
+ * the variants. Variables of type conv_ds_t are never instantiated. This
+ * type exists only to provide a common pointer type that can reference
+ * any of the variants safely. In C++, it would be a virtual base class.
+ * The fields common to all the variants are:
+ *
+ * ds_type: Identifies the variant
+ * ds_baseval/ds_topval: The lower and upper bound of the range
+ * of values represented by this conv_ds_XXX_t descriptor.
+ *
+ * There are three different variants:
+ * conv_ds_msg_t (ds_type == CONV_DS_MSGARR)
+ * This structure references an array of message codes corresponding
+ * to consecutive ELF values. The first item in the array is the Msg
+ * code for the value given by ds_baseval. Consecutive strings follow
+ * in consecutive order. The final item corresponds to the value given
+ * by ds_topval. Zero (0) Msg values can be used to represent missing
+ * values. Entries with a 0 are quietly ignored.
+ *
+ * conv_ds_vd_t (ds_type == CONV_DS_VD)
+ * This structure employs a NULL terminated array of Val_desc structs.
+ * Each Val_desc supplies a mapping from a value in the range
+ * (ds_baseval <= value <= ds_topval). The values described need not
+ * be consecutive, and can be sparse. ds_baseval does not need to
+ * correspond to the first item, and ds_topval need not correspond to
+ * the final item.
+ *
+ * conv_ds_vd2_t (ds_type == CONV_DS_VD2)
+ * This structure employs a NULL terminated array of Val_desc2 structs,
+ * rather than Val_desc, adding the ability to specify OSABI and machine
+ * as part of the value/string mapping. It is otherwise the same thing
+ * as CONV_DS_VD.
+ */
+typedef enum {
+ CONV_DS_MSGARR = 0, /* Array of Msg */
+ CONV_DS_VD = 1, /* Null terminated array of Val_desc */
+ CONV_DS_VD2 = 2, /* Null terminated array of Val_desc2 */
+} conv_ds_type_t;
+
+#define CONV_DS_COMMON_FIELDS \
+ conv_ds_type_t ds_type; /* Type of data structure used */ \
+ uint32_t ds_baseval; /* Value of first item */ \
+ uint32_t ds_topval /* Value of last item */
+
+typedef struct { /* Virtual base type --- do not instantiate */
+ CONV_DS_COMMON_FIELDS;
+} conv_ds_t;
+typedef struct {
+ CONV_DS_COMMON_FIELDS;
+ const Msg *ds_msg;
+} conv_ds_msg_t;
+typedef struct {
+ CONV_DS_COMMON_FIELDS;
+ const Val_desc *ds_vd;
+} conv_ds_vd_t;
+typedef struct {
+ CONV_DS_COMMON_FIELDS;
+ const Val_desc2 *ds_vd2;
+} conv_ds_vd2_t;
+
+/*
+ * The initialization of conv_ds_msg_t can be completely derived from
+ * its base value and the array of Msg codes. CONV_DS_MSG_INIT() is used
+ * to do that.
+ */
+#define CONV_DS_MSG_INIT(_baseval, _arr) \
+ CONV_DS_MSGARR, _baseval, \
+ _baseval + (sizeof (_arr) / sizeof (_arr[0])) - 1, _arr
+
+/*
+ * Null terminated arrays of pointers to conv_ds_XXX_t structs are processed
+ * by conv_map_ds() to convert ELF constants to their symbolic names, and by
+ * conv_iter_ds() to iterate over all the available value/name combinations.
+ *
+ * These pointers are formed by casting the address of the specific
+ * variant types (described above) to generic base type pointer.
+ * CONV_DS_ADDR() is a convenience macro to take the address of
+ * one of these variants and turn it into a generic pointer.
+ */
+#define CONV_DS_ADDR(_item) ((conv_ds_t *)&(_item))
+
+/*
+ * Type used by libconv to represent osabi values passed to iteration
+ * functions. The type in the ELF header is uchar_t. However, every possible
+ * value 0-255 has a valid meaning, leaving us no extra value to assign
+ * to mean "ALL". Using Half for osabi leaves us the top byte to use for
+ * out of bound values.
+ *
+ * Non-iteration functions, and any code that does not need to use
+ * CONV_OSABI_ALL, should use uchar_t for osabi.
+ */
+typedef Half conv_iter_osabi_t;
+
+/*
+ * Many of the iteration functions accept an osabi or mach argument,
+ * used to specify the type of object being processed. The following
+ * values can be used to specify a wildcard that matches any item. Their
+ * values are carefully chosen to ensure that they cannot be interpreted
+ * as an otherwise valid osabi or machine.
+ */
+#define CONV_OSABI_ALL 1024 /* Larger than can be represented by uchar_t */
+#define CONV_MACH_ALL EM_NUM /* Never a valid machine type */
+
+/*
+ * We compare Val_Desc2 descriptors with a specified osabi and machine
+ * to determine whether to use it or not. This macro encapsulates that logic.
+ *
+ * We consider an osabi to match when any of the following things hold:
+ *
+ * - The descriptor osabi is ELFOSABI_NONE.
+ * - The supplied osabi and the descriptor osabi match
+ * - The supplied osabi is ELFOSABI_NONE, and the descriptor osabi is
+ * ELFOSABI_SOLARIS. Many operating systems, Solaris included,
+ * produce or have produced ELFOSABI_NONE native objects, if only
+ * because OSABI ranges are not an original ELF feature. We
+ * give our own objects the home field advantage.
+ * - Iteration Only: An osabi value of CONV_OSABI_ALL is specified.
+ *
+ * We consider a machine to match when any of the following things hold:
+ *
+ * - The descriptor mach is EM_NONE.
+ * - The supplied mach and the descriptor mach match
+ * - Iteration Only: A mach value of CONV_MACH_ALL is specified.
+ *
+ * The special extra _ALL case for iteration is handled by defining a separate
+ * macro with the extra CONV_xxx_ALL tests.
+ */
+#define CONV_VD2_SKIP_OSABI(_osabi, _vdp) \
+ ((_vdp->v_osabi != ELFOSABI_NONE) && (_vdp->v_osabi != osabi) && \
+ ((_osabi != ELFOSABI_NONE) || (_vdp->v_osabi != ELFOSABI_SOLARIS)))
+
+#define CONV_VD2_SKIP_MACH(_mach, _vdp) \
+ ((_vdp->v_mach != EM_NONE) && (_vdp->v_mach != _mach))
+
+#define CONV_VD2_SKIP(_osabi, _mach, _vdp) \
+ (CONV_VD2_SKIP_OSABI(_osabi, _vdp) || CONV_VD2_SKIP_MACH(_mach, _vdp))
+
+#define CONV_ITER_VD2_SKIP(_osabi, _mach, _vdp) \
+ ((CONV_VD2_SKIP_OSABI(_osabi, _vdp) && (_osabi != CONV_OSABI_ALL)) || \
+ (CONV_VD2_SKIP_MACH(_mach, _vdp) && (_mach != CONV_MACH_ALL)))
+
+
+/*
+ * Possible return values from iteration functions.
+ */
+typedef enum {
+ CONV_ITER_DONE, /* Stop: No more iterations are desired */
+ CONV_ITER_CONT /* Continue with following iterations */
+} conv_iter_ret_t;
+
+/*
+ * Prototype for caller supplied callback function to iteration functions.
+ */
+typedef conv_iter_ret_t (* conv_iter_cb_t)(const char *str,
+ Conv_elfvalue_t value, void *uvalue);
+
+/*
+ * User value block employed by conv_iter_strtol()
+ */
+typedef struct {
+ const char *csl_str; /* String to search for */
+ size_t csl_strlen; /* # chars in csl_str to examine */
+ int csl_found; /* Init to 0, set to 1 if item found */
+ Conv_elfvalue_t csl_value; /* If csl_found, resulting value */
+} conv_strtol_uvalue_t;
/*
* conv_expn_field() is willing to supply default strings for the
@@ -765,11 +663,6 @@ typedef struct {
typedef struct {
char *buf; /* Buffer to receive generated string */
size_t bufsize; /* sizeof(buf) */
- const Val_desc *vdp; /* Array of value descriptors, giving the */
- /* possible bit values, and their */
- /* corresponding strings. Note that the */
- /* final element must contain only NULL */
- /* values. This terminates the list. */
const char **lead_str; /* NULL, or array of pointers to strings to */
/* be output at the head of the list. */
/* Last entry must be NULL. */
@@ -785,7 +678,6 @@ typedef struct {
/* If NULL, " ]" is used. */
} CONV_EXPN_FIELD_ARG;
-
/*
* Callback function for conv_str_to_c_literal(). A user supplied function
* of this type is called by conv_str_to_c_literal() in order to dispatch
@@ -800,9 +692,38 @@ typedef void Conv_str_to_c_literal_func_t(const void *ptr,
size_t size, void *uvalue);
/*
- * Define all generic interfaces.
+ * Generic miscellaneous interfaces
*/
extern uchar_t conv_check_native(char **, char **);
+extern const char *conv_lddstub(int);
+extern int conv_sys_eclass();
+
+/*
+ * Generic core formatting and iteration functionality
+ */
+extern conv_iter_ret_t _conv_iter_ds(conv_iter_osabi_t, Half,
+ const conv_ds_t **, conv_iter_cb_t, void *,
+ const char *);
+extern conv_iter_ret_t _conv_iter_ds_msg(const conv_ds_msg_t *,
+ conv_iter_cb_t, void *, const char *);
+extern conv_iter_ret_t _conv_iter_vd(const Val_desc *, conv_iter_cb_t,
+ void *, const char *);
+extern conv_iter_ret_t _conv_iter_vd2(conv_iter_osabi_t, Half,
+ const Val_desc2 *, conv_iter_cb_t, void *,
+ const char *);
+extern int conv_iter_strtol_init(const char *,
+ conv_strtol_uvalue_t *);
+extern conv_iter_ret_t conv_iter_strtol(const char *, Conv_elfvalue_t, void *);
+extern const char *_conv_map_ds(uchar_t, Half, Conv_elfvalue_t,
+ const conv_ds_t **, Conv_fmt_flags_t,
+ Conv_inv_buf_t *, const char *);
+
+
+/*
+ * Generic formatting interfaces.
+ */
+extern const char *conv_bnd_obj(uint_t, Conv_bnd_obj_buf_t *);
+extern const char *conv_bnd_type(uint_t, Conv_bnd_type_buf_t *);
extern const char *conv_config_feat(int, Conv_config_feat_buf_t *);
extern const char *conv_config_obj(ushort_t, Conv_config_obj_buf_t *);
extern const char *conv_config_upm(const char *, const char *,
@@ -865,16 +786,60 @@ extern const char *conv_dwarf_cfa(uchar_t, Conv_fmt_flags_t,
extern const char *conv_dwarf_ehe(uint_t, Conv_dwarf_ehe_buf_t *);
extern const char *conv_dwarf_regname(Half, Word, Conv_fmt_flags_t,
int *, Conv_inv_buf_t *);
+extern const char *conv_ehdr_abivers(uchar_t, Word, Conv_fmt_flags_t,
+ Conv_inv_buf_t *);
+extern const char *conv_ehdr_class(uchar_t, Conv_fmt_flags_t,
+ Conv_inv_buf_t *);
+extern const char *conv_ehdr_data(uchar_t, Conv_fmt_flags_t,
+ Conv_inv_buf_t *);
+extern const char *conv_ehdr_flags(Half, Word, Conv_fmt_flags_t,
+ Conv_ehdr_flags_buf_t *);
+extern const char *conv_ehdr_mach(Half, Conv_fmt_flags_t,
+ Conv_inv_buf_t *);
+extern const char *conv_ehdr_osabi(uchar_t, Conv_fmt_flags_t,
+ Conv_inv_buf_t *);
+extern const char *conv_ehdr_type(uchar_t, Half, Conv_fmt_flags_t,
+ Conv_inv_buf_t *);
+extern const char *conv_ehdr_vers(Word, Conv_fmt_flags_t,
+ Conv_inv_buf_t *);
extern const char *conv_elfdata_type(Elf_Type, Conv_inv_buf_t *);
extern const char *conv_grphdl_flags(uint_t, Conv_grphdl_flags_buf_t *);
extern const char *conv_grpdesc_flags(uint_t, Conv_grpdesc_flags_buf_t *);
extern Isa_desc *conv_isalist(void);
-extern const char *conv_lddstub(int);
+extern const char *conv_phdr_flags(uchar_t, Word, Conv_fmt_flags_t,
+ Conv_phdr_flags_buf_t *);
+extern const char *conv_phdr_type(uchar_t, Half, Word, Conv_fmt_flags_t,
+ Conv_inv_buf_t *);
+extern const char *conv_reject_desc(Rej_desc *, Conv_reject_desc_buf_t *,
+ Half mach);
+extern const char *conv_reloc_type(Half, Word, Conv_fmt_flags_t,
+ Conv_inv_buf_t *);
+extern const char *conv_reloc_type_static(Half, Word, Conv_fmt_flags_t);
+extern const char *conv_reloc_386_type(Word, Conv_fmt_flags_t,
+ Conv_inv_buf_t *);
+extern const char *conv_reloc_amd64_type(Word, Conv_fmt_flags_t,
+ Conv_inv_buf_t *);
+extern const char *conv_reloc_SPARC_type(Word, Conv_fmt_flags_t,
+ Conv_inv_buf_t *);
+extern const char *conv_sec_type(uchar_t, Half, Word, Conv_fmt_flags_t,
+ Conv_inv_buf_t *);
extern const char *conv_seg_flags(Half, Conv_seg_flags_buf_t *);
-extern int conv_sys_eclass();
extern void conv_str_to_c_literal(const char *buf, size_t n,
Conv_str_to_c_literal_func_t *cb_func,
void *uvalue);
+extern const char *conv_sym_info_bind(uchar_t, Conv_fmt_flags_t,
+ Conv_inv_buf_t *);
+extern const char *conv_sym_info_type(Half, uchar_t, Conv_fmt_flags_t,
+ Conv_inv_buf_t *);
+extern const char *conv_sym_shndx(uchar_t, Half, Half, Conv_fmt_flags_t,
+ Conv_inv_buf_t *);
+extern const char *conv_sym_other(uchar_t, Conv_inv_buf_t *);
+extern const char *conv_sym_other_vis(uchar_t, Conv_fmt_flags_t,
+ Conv_inv_buf_t *);
+extern const char *conv_syminfo_boundto(Half, Conv_fmt_flags_t,
+ Conv_inv_buf_t *);
+extern const char *conv_syminfo_flags(Half, Conv_fmt_flags_t,
+ Conv_syminfo_flags_buf_t *);
extern Uts_desc *conv_uts(void);
extern const char *conv_ver_flags(Half, Conv_fmt_flags_t,
Conv_ver_flags_buf_t *);
@@ -882,11 +847,75 @@ extern const char *conv_ver_index(Versym, int, Conv_inv_buf_t *);
/*
+ * Generic iteration interfaces.
+ */
+extern conv_iter_ret_t conv_iter_cap_tags(Conv_fmt_flags_t, conv_iter_cb_t,
+ void *);
+extern conv_iter_ret_t conv_iter_cap_val_hw1(Half, Conv_fmt_flags_t,
+ conv_iter_cb_t, void *);
+extern conv_iter_ret_t conv_iter_cap_val_sf1(Conv_fmt_flags_t, conv_iter_cb_t,
+ void *);
+
+extern conv_iter_ret_t conv_iter_dyn_feature1(Conv_fmt_flags_t, conv_iter_cb_t,
+ void *);
+extern conv_iter_ret_t conv_iter_dyn_flag(Conv_fmt_flags_t, conv_iter_cb_t,
+ void *);
+extern conv_iter_ret_t conv_iter_dyn_flag1(Conv_fmt_flags_t, conv_iter_cb_t,
+ void *);
+extern conv_iter_ret_t conv_iter_dyn_posflag1(Conv_fmt_flags_t, conv_iter_cb_t,
+ void *);
+extern conv_iter_ret_t conv_iter_dyn_tag(conv_iter_osabi_t, Half,
+ Conv_fmt_flags_t, conv_iter_cb_t, void *);
+
+extern conv_iter_ret_t conv_iter_ehdr_abivers(conv_iter_osabi_t,
+ Conv_fmt_flags_t, conv_iter_cb_t, void *);
+extern conv_iter_ret_t conv_iter_ehdr_class(Conv_fmt_flags_t, conv_iter_cb_t,
+ void *);
+extern conv_iter_ret_t conv_iter_ehdr_data(Conv_fmt_flags_t, conv_iter_cb_t,
+ void *);
+extern conv_iter_ret_t conv_iter_ehdr_eident(Conv_fmt_flags_t, conv_iter_cb_t,
+ void *);
+extern conv_iter_ret_t conv_iter_ehdr_flags(Half, Conv_fmt_flags_t,
+ conv_iter_cb_t, void *);
+extern conv_iter_ret_t conv_iter_ehdr_mach(Conv_fmt_flags_t, conv_iter_cb_t,
+ void *);
+extern conv_iter_ret_t conv_iter_ehdr_osabi(Conv_fmt_flags_t, conv_iter_cb_t,
+ void *);
+extern conv_iter_ret_t conv_iter_ehdr_type(conv_iter_osabi_t, Conv_fmt_flags_t,
+ conv_iter_cb_t, void *);
+extern conv_iter_ret_t conv_iter_ehdr_vers(Conv_fmt_flags_t, conv_iter_cb_t,
+ void *);
+
+extern conv_iter_ret_t conv_iter_phdr_flags(conv_iter_osabi_t,
+ Conv_fmt_flags_t, conv_iter_cb_t, void *);
+extern conv_iter_ret_t conv_iter_phdr_type(conv_iter_osabi_t, Conv_fmt_flags_t,
+ conv_iter_cb_t, void *);
+
+extern conv_iter_ret_t conv_iter_sec_flags(conv_iter_osabi_t, Half,
+ Conv_fmt_flags_t, conv_iter_cb_t, void *);
+extern conv_iter_ret_t conv_iter_sec_symtab(conv_iter_osabi_t,
+ Conv_fmt_flags_t, conv_iter_cb_t, void *);
+extern conv_iter_ret_t conv_iter_sec_type(conv_iter_osabi_t, Half,
+ Conv_fmt_flags_t, conv_iter_cb_t, void *);
+
+extern conv_iter_ret_t conv_iter_sym_info_bind(Conv_fmt_flags_t,
+ conv_iter_cb_t, void *);
+extern conv_iter_ret_t conv_iter_sym_other_vis(Conv_fmt_flags_t,
+ conv_iter_cb_t, void *);
+extern conv_iter_ret_t conv_iter_sym_shndx(conv_iter_osabi_t, Half,
+ Conv_fmt_flags_t, conv_iter_cb_t, void *);
+extern conv_iter_ret_t conv_iter_sym_info_type(Half, Conv_fmt_flags_t,
+ conv_iter_cb_t, void *);
+
+extern conv_iter_ret_t conv_iter_syminfo_boundto(Conv_fmt_flags_t,
+ conv_iter_cb_t, void *);
+extern conv_iter_ret_t conv_iter_syminfo_flags(Conv_fmt_flags_t,
+ conv_iter_cb_t, void *);
+
+/*
* Define all class specific routines.
*/
#if defined(_ELF64)
-#define conv_bnd_obj conv64_bnd_obj
-#define conv_bnd_type conv64_bnd_type
#define conv_cap_tag conv64_cap_tag
#define conv_cap_val conv64_cap_val
#define conv_cap_val_hw1 conv64_cap_val_hw1
@@ -896,37 +925,14 @@ extern const char *conv_ver_index(Versym, int, Conv_inv_buf_t *);
#define conv_dyn_flag conv64_dyn_flag
#define conv_dyn_posflag1 conv64_dyn_posflag1
#define conv_dyn_tag conv64_dyn_tag
-#define conv_ehdr_class conv64_ehdr_class
-#define conv_ehdr_data conv64_ehdr_data
-#define conv_ehdr_flags conv64_ehdr_flags
-#define conv_ehdr_mach conv64_ehdr_mach
-#define conv_ehdr_osabi conv64_ehdr_osabi
-#define conv_ehdr_type conv64_ehdr_type
-#define conv_ehdr_vers conv64_ehdr_vers
-#define conv_expn_field conv64_expn_field
+#define _conv_expn_field _conv64_expn_field
+#define _conv_expn_field2 _conv64_expn_field2
#define conv_invalid_val conv64_invalid_val
-#define conv_phdr_flags conv64_phdr_flags
-#define conv_phdr_type conv64_phdr_type
-#define conv_reject_desc conv64_reject_desc
-#define conv_reloc_type conv64_reloc_type
-#define conv_reloc_type_static conv64_reloc_type_static
-#define conv_reloc_386_type conv64_reloc_386_type
-#define conv_reloc_amd64_type conv64_reloc_amd64_type
-#define conv_reloc_SPARC_type conv64_reloc_SPARC_type
#define conv_sec_flags conv64_sec_flags
#define conv_sec_linkinfo conv64_sec_linkinfo
-#define conv_sec_type conv64_sec_type
-#define conv_sym_info_bind conv64_sym_info_bind
-#define conv_sym_info_type conv64_sym_info_type
-#define conv_sym_shndx conv64_sym_shndx
-#define conv_sym_other conv64_sym_other
-#define conv_sym_other_vis conv64_sym_other_vis
#define conv_sym_value conv64_sym_value
#define conv_sym_SPARC_value conv64_sym_SPARC_value
-#define conv_syminfo_flags conv64_syminfo_flags
#else
-#define conv_bnd_obj conv32_bnd_obj
-#define conv_bnd_type conv32_bnd_type
#define conv_cap_tag conv32_cap_tag
#define conv_cap_val conv32_cap_val
#define conv_cap_val_hw1 conv32_cap_val_hw1
@@ -936,39 +942,31 @@ extern const char *conv_ver_index(Versym, int, Conv_inv_buf_t *);
#define conv_dyn_flag conv32_dyn_flag
#define conv_dyn_posflag1 conv32_dyn_posflag1
#define conv_dyn_tag conv32_dyn_tag
-#define conv_ehdr_class conv32_ehdr_class
-#define conv_ehdr_data conv32_ehdr_data
-#define conv_ehdr_flags conv32_ehdr_flags
-#define conv_ehdr_mach conv32_ehdr_mach
-#define conv_ehdr_osabi conv32_ehdr_osabi
-#define conv_ehdr_type conv32_ehdr_type
-#define conv_ehdr_vers conv32_ehdr_vers
-#define conv_expn_field conv32_expn_field
+#define _conv_expn_field _conv32_expn_field
+#define _conv_expn_field2 _conv32_expn_field2
#define conv_invalid_val conv32_invalid_val
-#define conv_phdr_flags conv32_phdr_flags
-#define conv_phdr_type conv32_phdr_type
-#define conv_reject_desc conv32_reject_desc
-#define conv_reloc_type conv32_reloc_type
-#define conv_reloc_type_static conv32_reloc_type_static
-#define conv_reloc_386_type conv32_reloc_386_type
-#define conv_reloc_amd64_type conv32_reloc_amd64_type
-#define conv_reloc_SPARC_type conv32_reloc_SPARC_type
#define conv_sec_flags conv32_sec_flags
#define conv_sec_linkinfo conv32_sec_linkinfo
-#define conv_sec_type conv32_sec_type
-#define conv_sym_info_bind conv32_sym_info_bind
-#define conv_sym_info_type conv32_sym_info_type
-#define conv_sym_shndx conv32_sym_shndx
-#define conv_sym_other conv32_sym_other
-#define conv_sym_other_vis conv32_sym_other_vis
#define conv_sym_value conv32_sym_value
#define conv_sym_SPARC_value conv32_sym_SPARC_value
-#define conv_syminfo_flags conv32_syminfo_flags
#endif
-extern const char *conv_bnd_obj(uint_t, Conv_bnd_obj_buf_t *);
-extern const char *conv_bnd_type(uint_t, Conv_bnd_type_buf_t *);
-extern const char *conv_cap_tag(Xword, Conv_inv_buf_t *);
+/*
+ * ELFCLASS-specific core formatting functionality
+ */
+extern int _conv_expn_field(CONV_EXPN_FIELD_ARG *,
+ const Val_desc *, Conv_fmt_flags_t, const char *);
+extern int _conv_expn_field2(CONV_EXPN_FIELD_ARG *, uchar_t,
+ Half, const Val_desc2 *, Conv_fmt_flags_t,
+ const char *);
+extern const char *conv_invalid_val(Conv_inv_buf_t *, Xword,
+ Conv_fmt_flags_t);
+
+/*
+ * ELFCLASS-specific formatting interfaces.
+ */
+extern const char *conv_cap_tag(Xword, Conv_fmt_flags_t,
+ Conv_inv_buf_t *);
extern const char *conv_cap_val(Xword, Xword, Half, Conv_cap_val_buf_t *);
extern const char *conv_cap_val_hw1(Xword, Half, Conv_fmt_flags_t,
Conv_cap_val_hw1_buf_t *);
@@ -980,61 +978,44 @@ extern const char *conv_dyn_flag(Xword, Conv_fmt_flags_t,
Conv_dyn_flag_buf_t *);
extern const char *conv_dyn_posflag1(Xword, Conv_fmt_flags_t,
Conv_dyn_posflag1_buf_t *);
-extern const char *conv_dyn_tag(Xword, Half, Conv_fmt_flags_t,
+extern const char *conv_dyn_tag(Xword, uchar_t, Half, Conv_fmt_flags_t,
Conv_inv_buf_t *);
extern const char *conv_dyn_feature1(Xword, Conv_fmt_flags_t,
Conv_dyn_feature1_buf_t *);
-extern const char *conv_ehdr_class(uchar_t, Conv_fmt_flags_t,
- Conv_inv_buf_t *);
-extern const char *conv_ehdr_data(uchar_t, Conv_fmt_flags_t,
- Conv_inv_buf_t *);
-extern const char *conv_ehdr_flags(Half, Word, Conv_fmt_flags_t,
- Conv_ehdr_flags_buf_t *);
-extern const char *conv_ehdr_mach(Half, Conv_fmt_flags_t,
- Conv_inv_buf_t *);
-extern const char *conv_ehdr_osabi(uchar_t, Conv_fmt_flags_t,
- Conv_inv_buf_t *);
-extern const char *conv_ehdr_type(Half, Conv_fmt_flags_t,
- Conv_inv_buf_t *);
-extern const char *conv_ehdr_vers(Word, Conv_fmt_flags_t,
- Conv_inv_buf_t *);
-extern int conv_expn_field(CONV_EXPN_FIELD_ARG *,
- Conv_fmt_flags_t);
-extern const char *conv_invalid_val(Conv_inv_buf_t *, Xword,
- Conv_fmt_flags_t);
-extern const char *conv_phdr_flags(Word, Conv_fmt_flags_t fmt_flags,
- Conv_phdr_flags_buf_t *);
-extern const char *conv_phdr_type(Half, Word, Conv_fmt_flags_t,
- Conv_inv_buf_t *);
-extern const char *conv_reject_desc(Rej_desc *, Conv_reject_desc_buf_t *,
- Half mach);
-extern const char *conv_reloc_type(Half, Word, Conv_fmt_flags_t,
- Conv_inv_buf_t *);
-extern const char *conv_reloc_type_static(Half, Word, Conv_fmt_flags_t);
-extern const char *conv_reloc_386_type(Word, Conv_fmt_flags_t,
- Conv_inv_buf_t *);
-extern const char *conv_reloc_amd64_type(Word, Conv_fmt_flags_t,
- Conv_inv_buf_t *);
-extern const char *conv_reloc_SPARC_type(Word, Conv_fmt_flags_t,
- Conv_inv_buf_t *);
-extern const char *conv_sec_flags(Xword, Conv_fmt_flags_t,
- Conv_sec_flags_buf_t *);
+extern const char *conv_sec_flags(uchar_t osabi, Half mach, Xword,
+ Conv_fmt_flags_t, Conv_sec_flags_buf_t *);
extern const char *conv_sec_linkinfo(Word, Xword, Conv_inv_buf_t *);
-extern const char *conv_sec_type(Half, Word, Conv_fmt_flags_t,
- Conv_inv_buf_t *);
-extern const char *conv_sym_info_bind(uchar_t, Conv_fmt_flags_t,
- Conv_inv_buf_t *);
-extern const char *conv_sym_info_type(Half, uchar_t, Conv_fmt_flags_t,
- Conv_inv_buf_t *);
-extern const char *conv_sym_shndx(Half, Conv_inv_buf_t *);
-extern const char *conv_sym_other(uchar_t, Conv_inv_buf_t *);
-extern const char *conv_sym_other_vis(uchar_t, Conv_fmt_flags_t,
- Conv_inv_buf_t *);
extern const char *conv_sym_value(Half, uchar_t, Addr, Conv_inv_buf_t *);
extern const char *conv_sym_SPARC_value(Addr, Conv_fmt_flags_t,
Conv_inv_buf_t *);
-extern const char *conv_syminfo_flags(Xword, Conv_fmt_flags_t,
- Conv_syminfo_flags_buf_t *);
+
+/*
+ * Define macros for _conv_XXX() routines that accept local_sgs_msg as the
+ * final argument. The macros hide that argument from the caller's view and
+ * supply the SGS message array for the file from which the macro is used
+ * in its place. This trick is used to allow these functions to access the
+ * message strings from any source file they are called from.
+ */
+#define conv_expn_field(_arg, _vdp, _fmt_flags) \
+ _conv_expn_field(_arg, _vdp, _fmt_flags, MSG_SGS_LOCAL_ARRAY)
+
+#define conv_expn_field2(_arg, _osabi, _mach, _vdp, _fmt_flags) \
+ _conv_expn_field2(_arg, _osabi, _mach, _vdp, _fmt_flags, \
+ MSG_SGS_LOCAL_ARRAY)
+
+#define conv_iter_ds(_osabi, _mach, _dsp, _func, _uvalue) \
+ _conv_iter_ds(_osabi, _mach, _dsp, _func, _uvalue, MSG_SGS_LOCAL_ARRAY)
+
+#define conv_iter_vd(_vdp, _func, _uvalue) \
+ _conv_iter_vd(_vdp, _func, _uvalue, MSG_SGS_LOCAL_ARRAY)
+
+#define conv_iter_vd2(_osabi, _mach, _vdp, _func, _uvalue) \
+ _conv_iter_vd2(_osabi, _mach, _vdp, _func, _uvalue, MSG_SGS_LOCAL_ARRAY)
+
+#define conv_map_ds(_osabi, _mach, _value, _dsp, _fmt_flags, _inv_buf) \
+ _conv_map_ds(_osabi, _mach, _value, _dsp, _fmt_flags, _inv_buf, \
+ MSG_SGS_LOCAL_ARRAY)
+
#ifdef __cplusplus
}
diff --git a/usr/src/cmd/sgs/include/debug.h b/usr/src/cmd/sgs/include/debug.h
index a8da817236..570f3f76d4 100644
--- a/usr/src/cmd/sgs/include/debug.h
+++ b/usr/src/cmd/sgs/include/debug.h
@@ -665,8 +665,8 @@ extern void Dbg_cap_val_hw1(Lm_list *, Xword, Half);
extern const char *
Dbg_demangle_name(const char *);
-extern void Dbg_ent_entry(Lm_list *, Half, Ent_desc *);
-extern void Dbg_ent_print(Lm_list *, Half, Alist *, Boolean);
+extern void Dbg_ent_entry(Lm_list *, uchar_t, Half, Ent_desc *);
+extern void Dbg_ent_print(Lm_list *, uchar_t, Half, Alist *, Boolean);
extern void Dbg_file_analyze(Rt_map *);
extern void Dbg_file_aout(Lm_list *, const char *, Addr, size_t,
@@ -790,14 +790,14 @@ extern void Dbg_sec_redirected(Lm_list *, const char *, const char *);
extern void Dbg_sec_strtab(Lm_list *, Os_desc *, Str_tbl *);
extern void Dbg_sec_unsup_strmerge(Lm_list *, Is_desc *);
-extern void Dbg_seg_desc_entry(Lm_list *, Half, int, Sg_desc *);
+extern void Dbg_seg_desc_entry(Lm_list *, uchar_t, Half, int, Sg_desc *);
extern void Dbg_seg_entry(Ofl_desc *, int, Sg_desc *);
-extern void Dbg_seg_list(Lm_list *, Half, APlist *);
+extern void Dbg_seg_list(Lm_list *, uchar_t, Half, APlist *);
extern void Dbg_seg_os(Ofl_desc *, Os_desc *, int);
extern void Dbg_seg_title(Lm_list *);
-extern void Dbg_shdr_modified(Lm_list *, const char *, Half, Shdr *, Shdr *,
- const char *);
+extern void Dbg_shdr_modified(Lm_list *, const char *, uchar_t, Half,
+ Shdr *, Shdr *, const char *);
extern void Dbg_statistics_ar(Ofl_desc *);
extern void Dbg_statistics_ld(Ofl_desc *);
@@ -984,7 +984,8 @@ extern void Elf_cap_title(Lm_list *);
extern const char \
*Elf_demangle_name(const char *);
-extern void Elf_dyn_entry(Lm_list *, Dyn *, int, const char *, Half);
+extern void Elf_dyn_entry(Lm_list *, Dyn *, int, const char *,
+ uchar_t, Half);
extern void Elf_dyn_null_entry(Lm_list *, Dyn *, int, int);
extern void Elf_dyn_title(Lm_list *);
@@ -994,7 +995,7 @@ extern void Elf_got_entry(Lm_list *, Sword, Addr, Xword, Half,
uchar_t, uchar_t, Word, void *, const char *);
extern void Elf_got_title(Lm_list *);
-extern void Elf_phdr(Lm_list *, Half, Phdr *);
+extern void Elf_phdr(Lm_list *, uchar_t, Half, Phdr *);
extern void Elf_reloc_apply_val(Lm_list *, int, Xword, Xword);
extern void Elf_reloc_apply_reg(Lm_list *, int, Half, Xword, Xword);
@@ -1005,10 +1006,10 @@ extern void Elf_reloc_entry_2(Lm_list *, int, const char *, Word,
const char *);
extern void Elf_reloc_title(Lm_list *, int, Word);
-extern void Elf_shdr(Lm_list *, Half, Shdr *);
+extern void Elf_shdr(Lm_list *, uchar_t, Half, Shdr *);
-extern void Elf_syms_table_entry(Lm_list *, int, const char *, Half, Sym *,
- Versym, int, const char *, const char *);
+extern void Elf_syms_table_entry(Lm_list *, int, const char *, uchar_t,
+ Half, Sym *, Versym, int, const char *, const char *);
extern void Elf_syms_table_title(Lm_list *, int);
extern void Elf_ver_def_title(Lm_list *);
diff --git a/usr/src/cmd/sgs/include/elfedit.h b/usr/src/cmd/sgs/include/elfedit.h
index 2e91e30007..5332e3aa63 100644
--- a/usr/src/cmd/sgs/include/elfedit.h
+++ b/usr/src/cmd/sgs/include/elfedit.h
@@ -20,15 +20,13 @@
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _ELFEDIT_H
#define _ELFEDIT_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
@@ -305,7 +303,9 @@ typedef uintptr_t elfedit_i18nhdl_t;
typedef enum {
ELFEDIT_CMDRET_NONE = 0, /* Nothing to report */
ELFEDIT_CMDRET_MOD = 1, /* Command modified output ELF file */
- ELFEDIT_CMDRET_FLUSH = 2 /* Output file flushed: elf_update() */
+ ELFEDIT_CMDRET_MOD_OS_MACH = 2, /* As per _MOD, include ELF header */
+ /* osabi or machine change */
+ ELFEDIT_CMDRET_FLUSH = 3 /* Output file flushed: elf_update() */
} elfedit_cmdret_t;
/*
@@ -705,14 +705,14 @@ typedef enum {
ELFEDIT_CONST_OUTSTYLE = 0, /* elfedit output styles */
ELFEDIT_CONST_OUTSTYLE_MO = 1, /* ostyles with -o prefix */
ELFEDIT_CONST_BOOL = 2, /* boolean names */
- ELFEDIT_CONST_SHN = 3, /* ELF SHN_ section indexes */
- ELFEDIT_CONST_SHT = 4, /* ELF SHT_ section types */
- ELFEDIT_CONST_SHT_STRTAB = 5, /* ELF SHT_STRTAB */
- ELFEDIT_CONST_SHT_ALLSYMTAB = 6, /* ELF SHT_ symbol table */
+ ELFEDIT_CONST_SHT_STRTAB = 3, /* ELF SHT_STRTAB */
+ ELFEDIT_CONST_SHT_SYMTAB = 4, /* ELF SHT_SYMTAB */
+ ELFEDIT_CONST_SHT_DYNSYM = 5, /* ELF SHT_DYNSYM */
+ ELFEDIT_CONST_SHT_LDYNSYM = 6, /* ELF SHT_SUNW_LDYNSYM */
+ ELFEDIT_CONST_SHN = 7, /* ELF SHN_ section indexes */
+ ELFEDIT_CONST_SHT = 8, /* ELF SHT_ section types */
+ ELFEDIT_CONST_SHT_ALLSYMTAB = 9, /* ELF SHT_ symbol table */
/* section types */
- ELFEDIT_CONST_SHT_SYMTAB = 7, /* ELF SHT_SYMTAB */
- ELFEDIT_CONST_SHT_DYNSYM = 8, /* ELF SHT_DYNSYM */
- ELFEDIT_CONST_SHT_LDYNSYM = 9, /* ELF SHT_SUNW_LDYNSYM */
ELFEDIT_CONST_DT = 10, /* Dynamic tags: DT_ */
ELFEDIT_CONST_DF = 11, /* DT_FLAGS bits */
ELFEDIT_CONST_DF_P1 = 12, /* DF_POSFLAG_1 bits */
@@ -726,18 +726,20 @@ typedef enum {
ELFEDIT_CONST_EV = 20, /* Ehdr version */
ELFEDIT_CONST_EM = 21, /* Ehdr machine */
ELFEDIT_CONST_ELFOSABI = 22, /* Ehdr ABI */
- ELFEDIT_CONST_PT = 23, /* Phdr type */
- ELFEDIT_CONST_PF = 24, /* Phdr flags */
- ELFEDIT_CONST_SHF = 25, /* Shdr flags */
- ELFEDIT_CONST_STB = 26, /* Sym binding */
- ELFEDIT_CONST_STT = 27, /* Sym type */
- ELFEDIT_CONST_STV = 28, /* Sym visibility */
- ELFEDIT_CONST_SYMINFO_BT = 29, /* Syminfo boundto */
- ELFEDIT_CONST_SYMINFO_FLG = 30, /* Syminfo flags */
- ELFEDIT_CONST_CA = 31, /* Capabilities tags: CA_ */
- ELFEDIT_CONST_AV_386 = 32, /* X86 hardware caps */
- ELFEDIT_CONST_AV_SPARC = 33, /* sparc hardware caps */
+ ELFEDIT_CONST_EAV = 23, /* Ehdr ABI version */
+ ELFEDIT_CONST_PT = 24, /* Phdr type */
+ ELFEDIT_CONST_PF = 25, /* Phdr flags */
+ ELFEDIT_CONST_SHF = 26, /* Shdr flags */
+ ELFEDIT_CONST_STB = 27, /* Sym binding */
+ ELFEDIT_CONST_STT = 28, /* Sym type */
+ ELFEDIT_CONST_STV = 29, /* Sym visibility */
+ ELFEDIT_CONST_SYMINFO_BT = 30, /* Syminfo boundto */
+ ELFEDIT_CONST_SYMINFO_FLG = 31, /* Syminfo flags */
+ ELFEDIT_CONST_CA = 32, /* Capabilities tags */
+ ELFEDIT_CONST_AV = 33, /* hardware capabilities */
ELFEDIT_CONST_SF1_SUNW = 34, /* software capabilities */
+
+ ELFEDIT_CONST_NUM = 35, /* # of constant types */
} elfedit_const_t;
/*
@@ -747,13 +749,6 @@ typedef enum {
extern elfedit_atoui_sym_t *elfedit_const_to_atoui(elfedit_const_t const_type);
/*
- * Return the elfedit_atoui_t array that corresponds to the
- * CA_SUNW_HW_1 hardware capabiliies field for a given
- * machine type.
- */
-extern elfedit_atoui_sym_t *elfedit_mach_sunw_hw1_to_atoui(int mach);
-
-/*
* ato[u]i and const routines, used to turn strings into numeric values,
* with support for mapping symbol names to numbers, and range checking.
*/
@@ -882,10 +877,10 @@ const char *elfedit32_dyn_offset_to_str(elfedit32_section_t *strsec,
const char *elfedit64_dyn_offset_to_str(elfedit64_section_t *strsec,
elfedit64_dyn_elt_t *dynelt);
-extern int elfedit32_dynstr_getpad(elfedit32_section_t *dynsec,
- elfedit32_dyn_elt_t *dyn_strpad);
-extern int elfedit64_dynstr_getpad(elfedit64_section_t *dynsec,
- elfedit64_dyn_elt_t *dyn_strpad);
+extern int elfedit32_dynstr_getpad(elfedit32_obj_state_t *obj_state,
+ elfedit32_section_t *dynsec, elfedit32_dyn_elt_t *dyn_strpad);
+extern int elfedit64_dynstr_getpad(elfedit64_obj_state_t *obj_state,
+ elfedit64_section_t *dynsec, elfedit64_dyn_elt_t *dyn_strpad);
extern Elf32_Word elfedit32_dynstr_insert(elfedit32_section_t *dynsec,
elfedit32_section_t *strsec, elfedit32_dyn_elt_t *dyn_strpad,
@@ -911,11 +906,6 @@ extern Elf32_Word elfedit32_name_to_shndx(elfedit32_obj_state_t *obj_state,
extern Elf64_Word elfedit64_name_to_shndx(elfedit64_obj_state_t *obj_state,
const char *shnam);
-extern Elf32_Word elfedit32_type_to_shndx(elfedit32_obj_state_t *obj_state,
- Elf32_Word shtype);
-extern Elf64_Word elfedit64_type_to_shndx(elfedit64_obj_state_t *obj_state,
- Elf64_Word shtype);
-
extern int elfedit32_name_to_symndx(elfedit32_section_t *symsec,
elfedit32_section_t *strsec, const char *name, elfedit_msg_t msg_type,
Elf32_Word *ret_symndx);
@@ -981,10 +971,10 @@ extern elfedit64_section_t *elfedit64_sec_getxshndx(
elfedit64_obj_state_t *obj_state, elfedit64_section_t *symsec,
Elf64_Word **xshndx, Elf64_Word *num);
-extern int elfedit32_sec_issymtab(elfedit32_section_t *sec, int issue_err,
- elfedit_atoui_sym_t **atoui_list);
-extern int elfedit64_sec_issymtab(elfedit64_section_t *sec, int issue_err,
- elfedit_atoui_sym_t **atoui_list);
+extern int elfedit32_sec_issymtab(elfedit32_obj_state_t *obj_state,
+ elfedit32_section_t *sec, int issue_err, elfedit_atoui_sym_t **atoui_list);
+extern int elfedit64_sec_issymtab(elfedit64_obj_state_t *obj_state,
+ elfedit64_section_t *sec, int issue_err, elfedit_atoui_sym_t **atoui_list);
extern const char *elfedit32_sec_msgprefix(elfedit32_section_t *sec);
extern const char *elfedit64_sec_msgprefix(elfedit64_section_t *sec);
@@ -1004,6 +994,11 @@ extern void elfedit32_strtab_insert_test(elfedit32_obj_state_t *obj_state,
extern void elfedit64_strtab_insert_test(elfedit64_obj_state_t *obj_state,
elfedit64_section_t *strsec, elfedit64_section_t *dynsec, const char *str);
+extern int elfedit32_test_osabi(elfedit32_obj_state_t *obj_state, uchar_t osabi,
+ int issue_err);
+extern int elfedit64_test_osabi(elfedit64_obj_state_t *obj_state, uchar_t osabi,
+ int issue_err);
+
extern Elf32_Word elfedit32_type_to_shndx(elfedit32_obj_state_t *obj_state,
Elf32_Word shtype);
extern Elf64_Word elfedit64_type_to_shndx(elfedit64_obj_state_t *obj_state,
@@ -1042,6 +1037,7 @@ extern Elf64_Word elfedit64_type_to_shndx(elfedit64_obj_state_t *obj_state,
#define elfedit_sec_msgprefix elfedit64_sec_msgprefix
#define elfedit_strtab_insert elfedit64_strtab_insert
#define elfedit_strtab_insert_test elfedit64_strtab_insert_test
+#define elfedit_test_osabi elfedit64_test_osabi
#define elfedit_type_to_shndx elfedit64_type_to_shndx
#else
#define elfedit_dyn_elt_init elfedit32_dyn_elt_init
@@ -1070,6 +1066,7 @@ extern Elf64_Word elfedit64_type_to_shndx(elfedit64_obj_state_t *obj_state,
#define elfedit_sec_msgprefix elfedit32_sec_msgprefix
#define elfedit_strtab_insert elfedit32_strtab_insert
#define elfedit_strtab_insert_test elfedit32_strtab_insert_test
+#define elfedit_test_osabi elfedit32_test_osabi
#define elfedit_type_to_shndx elfedit32_type_to_shndx
#endif
diff --git a/usr/src/cmd/sgs/include/libld.h b/usr/src/cmd/sgs/include/libld.h
index 2a20196114..ed34982d5f 100644
--- a/usr/src/cmd/sgs/include/libld.h
+++ b/usr/src/cmd/sgs/include/libld.h
@@ -352,6 +352,7 @@ struct ofl_desc {
/* unspecified global symbols */
#define FLG_OF_REDLSYM 0x004000000000 /* reduce local symbols */
#define FLG_OF_SECORDER 0x008000000000 /* section ordering is required */
+#define FLG_OF_OSABI 0x010000000000 /* Tag object as ELFOSABI_SOLARIS */
/*
* In the flags1 arena, establish any options that are applicable to archive
diff --git a/usr/src/cmd/sgs/include/sgsmsg.h b/usr/src/cmd/sgs/include/sgsmsg.h
new file mode 100644
index 0000000000..014e3b5a9b
--- /dev/null
+++ b/usr/src/cmd/sgs/include/sgsmsg.h
@@ -0,0 +1,56 @@
+/*
+ * 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
+ * or http://www.opensolaris.org/os/licensing.
+ * 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.
+ */
+
+#ifndef _SGSMSG_DOT_H
+#define _SGSMSG_DOT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef __lint
+
+/*
+ * In normal operation, sgsmsg generates an ELF-format string table
+ * for strings, and Msg is an integer offset into that table.
+ */
+typedef int Msg;
+
+#else /* __lint */
+
+/*
+ * When __lint is defined, Msg is a char *. This allows lint to
+ * check our format strings against its arguments.
+ */
+typedef char *Msg;
+
+#endif /* __lint */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SGSMSG_DOT_H */
diff --git a/usr/src/cmd/sgs/libconv/Makefile.com b/usr/src/cmd/sgs/libconv/Makefile.com
index bf4c15418d..ebd8e8ce8e 100644
--- a/usr/src/cmd/sgs/libconv/Makefile.com
+++ b/usr/src/cmd/sgs/libconv/Makefile.com
@@ -26,43 +26,50 @@
LIBRARY = libconv.a
-COMOBJS32 = cap32.o dynamic32.o \
- elf32.o globals32.o \
- phdr32.o \
- relocate_i38632.o relocate_amd6432.o \
- relocate_sparc32.o sections32.o \
- symbols32.o symbols_sparc32.o \
- syminfo32.o
-
-COMOBJS64 = cap64.o dynamic64.o \
- elf64.o globals64.o \
- phdr64.o \
- relocate_i38664.o relocate_amd6464.o \
- relocate_sparc64.o sections64.o \
- symbols64.o symbols_sparc64.o \
- syminfo64.o
+COMOBJS32 = cap_machelf32.o dynamic_machelf32.o \
+ globals_machelf32.o sections_machelf32.o \
+ symbols_machelf32.o symbols_sparc_machelf32.o
-COMOBJS= arch.o c_literal.o \
- config.o corenote.o \
- data.o deftag.o \
- demangle.o dl.o \
- dwarf.o dwarf_ehe.o \
- group.o lddstub.o \
- segments.o version.o
-
-COMOBJS_NOMSG = tokens.o
+COMOBJS64 = cap_machelf64.o dynamic_machelf64.o \
+ globals_machelf64.o sections_machelf64.o \
+ symbols_machelf64.o symbols_sparc_machelf64.o
-COMOBJS_NOMSG32 = \
- relocate32.o
-COMOBJS_NOMSG64 = \
- relocate64.o
+COMOBJS= arch.o c_literal.o \
+ cap.o config.o \
+ corenote.o data.o \
+ deftag.o demangle.o \
+ dl.o dwarf.o \
+ dwarf_ehe.o dynamic.o \
+ elf.o globals.o \
+ group.o lddstub.o \
+ phdr.o relocate.o \
+ relocate_i386.o relocate_amd64.o \
+ relocate_sparc.o sections.o \
+ segments.o symbols.o \
+ syminfo.o tokens.o \
+ version.o
ELFCAP_OBJS= elfcap.o
ASOBJS= vernote.o
-OBJECTS = $(COMOBJS) $(COMOBJS32) $(COMOBJS64) $(COMOBJS_NOMSG) \
- $(COMOBJS_NOMSG32) $(COMOBJS_NOMSG64) $(ELFCAP_OBJS) $(ASOBJS)
+BLTOBJS= arch_msg.o c_literal_msg.o \
+ cap_msg.o config_msg.o \
+ corenote_msg.o data_msg.o \
+ deftag_msg.o demangle_msg.o \
+ dl_msg.o dwarf_msg.o \
+ dwarf_ehe_msg.o dynamic_msg.o \
+ elf_msg.o globals_msg.o \
+ group_msg.o lddstub_msg.o \
+ phdr_msg.o relocate_amd64_msg.o \
+ relocate_i386_msg.o relocate_sparc_msg.o \
+ sections_msg.o segments_msg.o \
+ symbols_msg.o symbols_sparc_msg.o \
+ syminfo_msg.o version_msg.o
+
+
+OBJECTS = $(COMOBJS) $(COMOBJS32) $(COMOBJS64) $(ELFCAP_OBJS) \
+ $(ASOBJS) $(BLTOBJS)
ELFCAP= $(SRC)/common/elfcap
@@ -91,8 +98,7 @@ ARFLAGS= cr
AS_CPPFLAGS= -P -D_ASM $(CPPFLAGS)
-BLTDATA= $(COMOBJS:%.o=%_msg.h) \
- $(COMOBJS32:%.o=%_msg.h) $(COMOBJS64:%.o=%_msg.h)
+BLTDATA= $(BLTOBJS:%.o=%.c) $(BLTOBJS:%.o=%.h) report_bufsize.h
SRCS= ../common/llib-lconv
LINTSRCS= $(COMOBJS:%.o=../common/%.c) \
@@ -110,9 +116,7 @@ LINTSRCS64 = $(COMOBJS64:%64.o=../common/%.c)
VERNOTE_DEBUG= -d
$(INTERNAL_RELEASE_BUILD)VERNOTE_DEBUG=
-SGSMSGTARG= $(COMOBJS:%.o=../common/%.msg) \
- $(COMOBJS32:%32.o=../common/%.msg) \
- $(COMOBJS64:%64.o=../common/%.msg)
+SGSMSGTARG= $(BLTOBJS:%_msg.o=../common/%.msg)
LINTFLAGS += -u
LINTFLAGS64 += -u
diff --git a/usr/src/cmd/sgs/libconv/Makefile.targ b/usr/src/cmd/sgs/libconv/Makefile.targ
index 6ba9f5fd1d..147325302a 100644
--- a/usr/src/cmd/sgs/libconv/Makefile.targ
+++ b/usr/src/cmd/sgs/libconv/Makefile.targ
@@ -20,11 +20,9 @@
#
#
-# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
-#
pics/%.o: ../common/%.c
$(COMPILE.c) -o $@ $<
@@ -58,10 +56,11 @@ pics/elfcap.o: $(ELFCAP)/elfcap.c
report_bufsize.h: ../Makefile.targ
perl ../../tools/libconv_mk_report_bufsize.pl 8000
-../common/%.c: %_msg.h
+../common/%.c ../common/%_machelf.c: %_msg.h
-%_msg.h: $(SGSMSG) ../common/%.msg report_bufsize.h
- $(SGSMSG) $(SGSMSGFLAGS) -l -h $@ -d $@ $<
+%_msg.h %_msg.c: $(SGSMSG) ../common/%.msg report_bufsize.h
+ $(SGSMSG) $(SGSMSGFLAGS) -h $*_msg.h -d $*_msg.c \
+ -n sgs_msg_libconv_$* $<
$(SGSMSG): FRC
@ cd $(SGSTOOLS)/$(MACH); pwd; $(MAKE) catalog
diff --git a/usr/src/cmd/sgs/libconv/common/_conv.h b/usr/src/cmd/sgs/libconv/common/_conv.h
index b73aadf28a..6ccb06068d 100644
--- a/usr/src/cmd/sgs/libconv/common/_conv.h
+++ b/usr/src/cmd/sgs/libconv/common/_conv.h
@@ -20,15 +20,13 @@
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef __CONV_DOT_H
#define __CONV_DOT_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* Local include file for conversion library.
*/
@@ -59,52 +57,40 @@ extern "C" {
#endif
-
/*
- * Map an integer into a descriptive string.
- *
- * entry:
- * buf - A buffer into which this routine can format
- * a result string, if necessary.
- * bufsize - sizeof(buf)
- * val - The value for which a string is desired.
- * flags - CONV_FMT_* values to be passed to conv_invalid_val() if
- * necessary. The caller is reponsible for having examined
- * the CONV_FMT_ALT_* part of flags and passing the proper
- * msg array.
- * num_msg - # of Msg entries in msg.
- * msg - Array of num_msg Msg items corresponding to the possible
- * strings corresponding to val.
+ * There are routines in libconv that are built once for each ELFCLASS
+ * because they are formatting Xword values. However, all ELF constants
+ * lie in 32-bit ranges, due to the need be usable for ELFCLASS32. Hence,
+ * the value of the ELFCLASS64 support here is purely to detect unexpected
+ * garbage values above the 32-bit range.
*
- * exit:
- * If val lies in the range [0-(num_msg-1)], then the string
- * corresponding to it is returned. If val is outside the range,
- * conv_invalid_val() is called to format an ASCII representation
- * of it into string, and that is returned.
- *
- * note:
- * Ideally, this would be a function defined in globals.c.
- * However, it uses the MSG_ORIG macro, which uses an array
- * that is local to each module. Hence, this is a static function,
- * defined by this macro. Once defined by a module, the routine
- * is called normally.
+ * The CONV_XWORD_64TEST() macro tests the upper half of an ELFCLASS64 Xword,
+ * and formats the value in hex if non-zero bits are seen. For ELFCLASS32,
+ * it is a no-op.
*/
-#define DEFINE_conv_map2str \
-static \
-const char * \
-conv_map2str(Conv_inv_buf_t *inv_buf, int val, Conv_fmt_flags_t flags, \
- int num_msg, const Msg *msg) \
-{ \
- if ((val >= 0) && (val < num_msg)) \
- return (MSG_ORIG(msg[val])); \
-\
- /* If we get here, it's an unknown value */ \
- return (conv_invalid_val(inv_buf, val, flags)); \
-}
+#ifdef _ELF64
+#define CONV_XWORD_64TEST(_value, _fmt_flags, _inv_buf) \
+ if (_value & 0xffffffff00000000) \
+ return (conv_invalid_val(_inv_buf, _value, _fmt_flags))
+#else
+#define CONV_XWORD_64TEST(_value, _fmt_flags, _inv_buf)
+#endif
+
/* # of elements in an array */
#define ARRAY_NELTS(arr) (sizeof (arr) / sizeof (*arr))
+/*
+ * Functions intended for use inter-file, within libconv only
+ */
+extern const conv_ds_t **conv_cap_tag_strings(Conv_fmt_flags_t);
+extern const Val_desc *conv_dyn_feature1_strings(Conv_fmt_flags_t);
+extern const Val_desc *conv_dyn_flag_strings(Conv_fmt_flags_t);
+extern const Val_desc *conv_dyn_flag1_strings(Conv_fmt_flags_t);
+extern const Val_desc *conv_dyn_posflag1_strings(Conv_fmt_flags_t);
+extern const conv_ds_t **conv_dyn_tag_strings(conv_iter_osabi_t, Half,
+ Conv_fmt_flags_t);
+extern const Val_desc2 *conv_sec_flags_strings(Conv_fmt_flags_t);
#ifdef __cplusplus
diff --git a/usr/src/cmd/sgs/libconv/common/cap.c b/usr/src/cmd/sgs/libconv/common/cap.c
index d411d7e157..242b34f54b 100644
--- a/usr/src/cmd/sgs/libconv/common/cap.c
+++ b/usr/src/cmd/sgs/libconv/common/cap.c
@@ -20,104 +20,121 @@
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
/*
* String conversion routine for hardware capabilities types.
*/
#include <strings.h>
#include <stdio.h>
-#include <_machelf.h>
#include <elfcap.h>
#include "cap_msg.h"
#include "_conv.h"
-static int
-conv_cap_1(Xword val, char *str, size_t len, Half mach,
- Conv_fmt_flags_t fmt_flags, elfcap_to_str_func_t *fptr)
+const conv_ds_t **
+conv_cap_tag_strings(Conv_fmt_flags_t fmt_flags)
{
- size_t _len;
- int do_bkt = (fmt_flags & CONV_FMT_NOBKT) == 0;
-
- /*
- * Note that for the purposes of this routine, I consider
- * CONV_FMT_NOBKT to mean no brackets, or anything that
- * is placed outside of them. We also drop the hex version
- * of the flags that are put in front of the opening bracket.
- */
- if (do_bkt) {
- _len = sprintf(str, MSG_ORIG(MSG_GBL_OSQBRKT), EC_XWORD(val));
-
- len -= _len;
- str += _len;
- }
+ static const Msg tags_cf[] = {
+ MSG_CA_SUNW_NULL_CF, MSG_CA_SUNW_HW_1_CF,
+ MSG_CA_SUNW_SF_1_CF
+ };
+ static const Msg tags_nf[] = {
+ MSG_CA_SUNW_NULL_NF, MSG_CA_SUNW_HW_1_NF,
+ MSG_CA_SUNW_SF_1_NF
+ };
+ static const conv_ds_msg_t ds_tags_cf = {
+ CONV_DS_MSG_INIT(ELFCLASSNONE, tags_cf) };
+ static const conv_ds_msg_t ds_tags_nf = {
+ CONV_DS_MSG_INIT(ELFCLASSNONE, tags_nf) };
- if ((*fptr)(ELFCAP_STYLE_UC, val, str, len, ELFCAP_FMT_SNGSPACE,
- mach) != 0)
- return (0);
+ static const conv_ds_t *ds_cf[] = { CONV_DS_ADDR(ds_tags_cf), NULL };
+ static const conv_ds_t *ds_nf[] = { CONV_DS_ADDR(ds_tags_nf), NULL };
- if (do_bkt) {
- _len = strlen(str);
- if ((len - _len) >= MSG_GBL_CSQBRKT_SIZE) {
- str += _len;
- (void) strcpy(str, MSG_ORIG(MSG_GBL_CSQBRKT));
- }
- }
- return (1);
+
+ return ((CONV_TYPE_FMT_ALT(fmt_flags) == CONV_FMT_ALT_NF) ?
+ ds_nf : ds_cf);
}
-const char *
-conv_cap_val_hw1(Xword val, Half mach, Conv_fmt_flags_t fmt_flags,
- Conv_cap_val_hw1_buf_t *cap_val_hw1_buf)
+conv_iter_ret_t
+conv_iter_cap_tags(Conv_fmt_flags_t fmt_flags, conv_iter_cb_t func,
+ void *uvalue)
{
- if (val == 0)
- return (MSG_ORIG(MSG_GBL_ZERO));
-
- if (conv_cap_1(val, cap_val_hw1_buf->buf, sizeof (cap_val_hw1_buf->buf),
- mach, fmt_flags, elfcap_hw1_to_str) == 0)
- return (conv_invalid_val(&cap_val_hw1_buf->inv_buf, val, 0));
- return ((const char *)cap_val_hw1_buf->buf);
+ return (conv_iter_ds(ELFOSABI_NONE, EM_NONE,
+ conv_cap_tag_strings(fmt_flags), func, uvalue));
}
-const char *
-conv_cap_val_sf1(Xword val, Half mach, Conv_fmt_flags_t fmt_flags,
- Conv_cap_val_sf1_buf_t *cap_val_sf1_buf)
+/*
+ * Given an array of elfcap_desc_t, and a count, call the specified
+ * iteration for each value in the array.
+ */
+static conv_iter_ret_t
+conv_iter_elfcap(const elfcap_desc_t *cdp, uint_t cnum,
+ Conv_fmt_flags_t fmt_flags, conv_iter_cb_t func, void *uvalue)
{
- if (val == 0)
- return (MSG_ORIG(MSG_GBL_ZERO));
+ const char *str;
+
+ fmt_flags = CONV_TYPE_FMT_ALT(fmt_flags);
+
+ for (; cnum-- > 0; cdp++) {
+ /*
+ * Skip "reserved" bits. These are unassigned bits in the
+ * middle of the assigned range.
+ */
+ if (cdp->c_val == 0)
+ continue;
- if (conv_cap_1(val, cap_val_sf1_buf->buf, sizeof (cap_val_sf1_buf->buf),
- mach, fmt_flags, elfcap_sf1_to_str) == 0)
- return (conv_invalid_val(&cap_val_sf1_buf->inv_buf, val, 0));
- return ((const char *)cap_val_sf1_buf->buf);
+ switch (fmt_flags) {
+ default:
+ str = cdp->c_full.s_str;
+ break;
+ case CONV_FMT_ALT_CFNP:
+ str = cdp->c_uc.s_str;
+ break;
+ case CONV_FMT_ALT_NF:
+ str = cdp->c_lc.s_str;
+ break;
+ }
+
+ if ((* func)(str, cdp->c_val, uvalue) == CONV_ITER_DONE)
+ return (CONV_ITER_DONE);
+ }
+
+ return (CONV_ITER_CONT);
}
-const char *
-conv_cap_tag(Xword tag, Conv_inv_buf_t *inv_buf)
+/*
+ * Iterate the strings for CA_SUNW_HW1
+ */
+conv_iter_ret_t
+conv_iter_cap_val_hw1(Half mach, Conv_fmt_flags_t fmt_flags,
+ conv_iter_cb_t func, void *uvalue)
{
- static const Msg tags[] = {
- MSG_CA_SUNW_NULL, MSG_CA_SUNW_HW_1,
- MSG_CA_SUNW_SF_1
- };
+ if ((mach == EM_386) || (mach == EM_486) ||
+ (mach == EM_AMD64) || (mach == CONV_MACH_ALL))
+ if (conv_iter_elfcap(elfcap_getdesc_hw1_386(),
+ ELFCAP_NUM_HW1_386, fmt_flags, func, uvalue) ==
+ CONV_ITER_DONE)
+ return (CONV_ITER_DONE);
+
+ if ((mach == EM_SPARC) || (mach == EM_SPARC32PLUS) ||
+ (mach == EM_SPARCV9) || (mach == CONV_MACH_ALL))
+ if (conv_iter_elfcap(elfcap_getdesc_hw1_sparc(),
+ ELFCAP_NUM_HW1_SPARC, fmt_flags, func, uvalue) ==
+ CONV_ITER_DONE)
+ return (CONV_ITER_DONE);
- if (tag <= CA_SUNW_SF_1)
- return (MSG_ORIG(tags[tag]));
- else
- return (conv_invalid_val(inv_buf, tag, 0));
+ return (CONV_ITER_CONT);
}
-const char *
-conv_cap_val(Xword tag, Xword val, Half mach, Conv_cap_val_buf_t *cap_val_buf)
+/*
+ * Iterate the strings for CA_SUNW_SF1
+ */
+conv_iter_ret_t
+conv_iter_cap_val_sf1(Conv_fmt_flags_t fmt_flags, conv_iter_cb_t func,
+ void *uvalue)
{
- if (tag == CA_SUNW_HW_1)
- return (conv_cap_val_hw1(val, mach, 0,
- &cap_val_buf->cap_val_hw1_buf));
- else if (tag == CA_SUNW_SF_1)
- return (conv_cap_val_sf1(val, mach, 0,
- &cap_val_buf->cap_val_sf1_buf));
- else
- return (conv_invalid_val(&cap_val_buf->inv_buf, val, 0));
+ return (conv_iter_elfcap(elfcap_getdesc_sf1(), ELFCAP_NUM_SF1,
+ fmt_flags, func, uvalue));
}
diff --git a/usr/src/cmd/sgs/libconv/common/cap.msg b/usr/src/cmd/sgs/libconv/common/cap.msg
index 1952f6f23a..286b59e003 100644
--- a/usr/src/cmd/sgs/libconv/common/cap.msg
+++ b/usr/src/cmd/sgs/libconv/common/cap.msg
@@ -1,13 +1,12 @@
#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
+# 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
# or http://www.opensolaris.org/os/licensing.
@@ -22,13 +21,15 @@
#
# CDDL HEADER END
#
-# ident "%Z%%M% %I% %E% SMI"
#
# Message file for cmd/sgs/libconv/common/cap.c
-@ MSG_CA_SUNW_NULL "CA_SUNW_NULL"
-@ MSG_CA_SUNW_HW_1 "CA_SUNW_HW_1"
-@ MSG_CA_SUNW_SF_1 "CA_SUNW_SF_1"
+@ MSG_CA_SUNW_NULL_CF "CA_SUNW_NULL" # 0
+@ MSG_CA_SUNW_NULL_NF "null"
+@ MSG_CA_SUNW_HW_1_CF "CA_SUNW_HW_1" # 1
+@ MSG_CA_SUNW_HW_1_NF "hw_1"
+@ MSG_CA_SUNW_SF_1_CF "CA_SUNW_SF_1" # 2
+@ MSG_CA_SUNW_SF_1_NF "sf_1"
@ MSG_GBL_ZERO "0"
@ MSG_GBL_OSQBRKT "0x%llx [ "
diff --git a/usr/src/cmd/sgs/libconv/common/cap_machelf.c b/usr/src/cmd/sgs/libconv/common/cap_machelf.c
new file mode 100644
index 0000000000..a993317118
--- /dev/null
+++ b/usr/src/cmd/sgs/libconv/common/cap_machelf.c
@@ -0,0 +1,128 @@
+/*
+ * 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
+ * or http://www.opensolaris.org/os/licensing.
+ * 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.
+ */
+
+/*
+ * String conversion routine for hardware capabilities types.
+ */
+#include <strings.h>
+#include <stdio.h>
+#include <_machelf.h>
+#include <elfcap.h>
+#include "cap_msg.h"
+#include "_conv.h"
+
+static int
+conv_cap_1(Xword val, char *str, size_t len, Half mach,
+ Conv_fmt_flags_t fmt_flags, elfcap_to_str_func_t *fptr)
+{
+ size_t _len;
+ int do_bkt = (fmt_flags & CONV_FMT_NOBKT) == 0;
+
+ /*
+ * Note that for the purposes of this routine, I consider
+ * CONV_FMT_NOBKT to mean no brackets, or anything that
+ * is placed outside of them. We also drop the hex version
+ * of the flags that are put in front of the opening bracket.
+ */
+ if (do_bkt) {
+ _len = sprintf(str, MSG_ORIG(MSG_GBL_OSQBRKT), EC_XWORD(val));
+
+ len -= _len;
+ str += _len;
+ }
+
+ if ((*fptr)(ELFCAP_STYLE_UC, val, str, len, ELFCAP_FMT_SNGSPACE,
+ mach) != 0)
+ return (0);
+
+ if (do_bkt) {
+ _len = strlen(str);
+ if ((len - _len) >= MSG_GBL_CSQBRKT_SIZE) {
+ str += _len;
+ (void) strcpy(str, MSG_ORIG(MSG_GBL_CSQBRKT));
+ }
+ }
+ return (1);
+}
+
+const char *
+conv_cap_val_hw1(Xword val, Half mach, Conv_fmt_flags_t fmt_flags,
+ Conv_cap_val_hw1_buf_t *cap_val_hw1_buf)
+{
+ if (val == 0)
+ return (MSG_ORIG(MSG_GBL_ZERO));
+
+ if (conv_cap_1(val, cap_val_hw1_buf->buf, sizeof (cap_val_hw1_buf->buf),
+ mach, fmt_flags, elfcap_hw1_to_str) == 0)
+ return (conv_invalid_val(&cap_val_hw1_buf->inv_buf, val, 0));
+ return ((const char *)cap_val_hw1_buf->buf);
+}
+
+const char *
+conv_cap_val_sf1(Xword val, Half mach, Conv_fmt_flags_t fmt_flags,
+ Conv_cap_val_sf1_buf_t *cap_val_sf1_buf)
+{
+ if (val == 0)
+ return (MSG_ORIG(MSG_GBL_ZERO));
+
+ if (conv_cap_1(val, cap_val_sf1_buf->buf, sizeof (cap_val_sf1_buf->buf),
+ mach, fmt_flags, elfcap_sf1_to_str) == 0)
+ return (conv_invalid_val(&cap_val_sf1_buf->inv_buf, val, 0));
+ return ((const char *)cap_val_sf1_buf->buf);
+}
+
+const char *
+conv_cap_tag(Xword tag, Conv_fmt_flags_t fmt_flags, Conv_inv_buf_t *inv_buf)
+{
+#ifdef _ELF64
+ /*
+ * Valid tags all fit in 32-bits, so a value larger than that
+ * is garbage. conv_map_ds() sees 32-bit values, so test for garbage
+ * here before passing it on.
+ *
+ * Since there are no valid tags with a value > 32-bits, there
+ * is no reason to expend effort decoding the low order bits.
+ */
+ if (tag & 0xffffffff00000000)
+ return (conv_invalid_val(inv_buf, tag, fmt_flags));
+#endif
+
+ return (conv_map_ds(ELFOSABI_NONE, EM_NONE, tag,
+ conv_cap_tag_strings(fmt_flags), fmt_flags, inv_buf));
+}
+
+const char *
+conv_cap_val(Xword tag, Xword val, Half mach, Conv_cap_val_buf_t *cap_val_buf)
+{
+ if (tag == CA_SUNW_HW_1)
+ return (conv_cap_val_hw1(val, mach, 0,
+ &cap_val_buf->cap_val_hw1_buf));
+ else if (tag == CA_SUNW_SF_1)
+ return (conv_cap_val_sf1(val, mach, 0,
+ &cap_val_buf->cap_val_sf1_buf));
+ else
+ return (conv_invalid_val(&cap_val_buf->inv_buf, val, 0));
+}
diff --git a/usr/src/cmd/sgs/libconv/common/config.c b/usr/src/cmd/sgs/libconv/common/config.c
index a3b47beaeb..a8f4d7a8cd 100644
--- a/usr/src/cmd/sgs/libconv/common/config.c
+++ b/usr/src/cmd/sgs/libconv/common/config.c
@@ -20,10 +20,9 @@
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdlib.h>
#include <sys/types.h>
@@ -65,24 +64,24 @@
const char *
conv_config_feat(int features, Conv_config_feat_buf_t *config_feat_buf)
{
- static Val_desc vda[] = {
- { CONF_EDLIBPATH, MSG_ORIG(MSG_CONF_EDLIBPATH) },
- { CONF_ESLIBPATH, MSG_ORIG(MSG_CONF_ESLIBPATH) },
- { CONF_ADLIBPATH, MSG_ORIG(MSG_CONF_ADLIBPATH) },
- { CONF_ASLIBPATH, MSG_ORIG(MSG_CONF_ASLIBPATH) },
- { CONF_DIRCFG, MSG_ORIG(MSG_CONF_DIRCFG) },
- { CONF_OBJALT, MSG_ORIG(MSG_CONF_OBJALT) },
- { CONF_MEMRESV, MSG_ORIG(MSG_CONF_MEMRESV) },
- { CONF_ENVS, MSG_ORIG(MSG_CONF_ENVS) },
- { CONF_FLTR, MSG_ORIG(MSG_CONF_FLTR) },
+ static const Val_desc vda[] = {
+ { CONF_EDLIBPATH, MSG_CONF_EDLIBPATH },
+ { CONF_ESLIBPATH, MSG_CONF_ESLIBPATH },
+ { CONF_ADLIBPATH, MSG_CONF_ADLIBPATH },
+ { CONF_ASLIBPATH, MSG_CONF_ASLIBPATH },
+ { CONF_DIRCFG, MSG_CONF_DIRCFG },
+ { CONF_OBJALT, MSG_CONF_OBJALT },
+ { CONF_MEMRESV, MSG_CONF_MEMRESV },
+ { CONF_ENVS, MSG_CONF_ENVS },
+ { CONF_FLTR, MSG_CONF_FLTR },
{ 0, 0 }
};
static CONV_EXPN_FIELD_ARG conv_arg = {
- NULL, sizeof (config_feat_buf->buf), vda };
+ NULL, sizeof (config_feat_buf->buf) };
conv_arg.buf = config_feat_buf->buf;
conv_arg.oflags = conv_arg.rflags = features;
- (void) conv_expn_field(&conv_arg, 0);
+ (void) conv_expn_field(&conv_arg, vda, 0);
return ((const char *)config_feat_buf->buf);
}
@@ -125,25 +124,25 @@ conv_config_feat(int features, Conv_config_feat_buf_t *config_feat_buf)
const char *
conv_config_obj(ushort_t flags, Conv_config_obj_buf_t *config_obj_buf)
{
- static Val_desc vda[] = {
- { RTC_OBJ_DIRENT, MSG_ORIG(MSG_CONF_DIRENT) },
- { RTC_OBJ_ALLENTS, MSG_ORIG(MSG_CONF_ALLENTS) },
- { RTC_OBJ_NOEXIST, MSG_ORIG(MSG_CONF_NOEXIST) },
- { RTC_OBJ_EXEC, MSG_ORIG(MSG_CONF_EXEC) },
- { RTC_OBJ_ALTER, MSG_ORIG(MSG_CONF_ALTER) },
- { RTC_OBJ_DUMP, MSG_ORIG(MSG_CONF_DUMP) },
- { RTC_OBJ_NOALTER, MSG_ORIG(MSG_CONF_NOALTER) },
- { RTC_OBJ_REALPTH, MSG_ORIG(MSG_CONF_REALPATH) },
- { RTC_OBJ_GROUP, MSG_ORIG(MSG_CONF_GROUP) },
- { RTC_OBJ_APP, MSG_ORIG(MSG_CONF_APP) },
- { RTC_OBJ_CMDLINE, MSG_ORIG(MSG_CONF_CMDLINE) },
- { RTC_OBJ_FILTER, MSG_ORIG(MSG_CONF_FILTER) },
- { RTC_OBJ_FILTEE, MSG_ORIG(MSG_CONF_FILTEE) },
+ static const Val_desc vda[] = {
+ { RTC_OBJ_DIRENT, MSG_CONF_DIRENT },
+ { RTC_OBJ_ALLENTS, MSG_CONF_ALLENTS },
+ { RTC_OBJ_NOEXIST, MSG_CONF_NOEXIST },
+ { RTC_OBJ_EXEC, MSG_CONF_EXEC },
+ { RTC_OBJ_ALTER, MSG_CONF_ALTER },
+ { RTC_OBJ_DUMP, MSG_CONF_DUMP },
+ { RTC_OBJ_NOALTER, MSG_CONF_NOALTER },
+ { RTC_OBJ_REALPTH, MSG_CONF_REALPATH },
+ { RTC_OBJ_GROUP, MSG_CONF_GROUP },
+ { RTC_OBJ_APP, MSG_CONF_APP },
+ { RTC_OBJ_CMDLINE, MSG_CONF_CMDLINE },
+ { RTC_OBJ_FILTER, MSG_CONF_FILTER },
+ { RTC_OBJ_FILTEE, MSG_CONF_FILTEE },
{ 0, 0 }
};
static const char *leading_str_arr[2];
static CONV_EXPN_FIELD_ARG conv_arg = {
- NULL, sizeof (config_obj_buf->buf), vda, leading_str_arr };
+ NULL, sizeof (config_obj_buf->buf), leading_str_arr };
const char **lstr = leading_str_arr;
@@ -164,7 +163,7 @@ conv_config_obj(ushort_t flags, Conv_config_obj_buf_t *config_obj_buf)
*lstr = NULL;
conv_arg.oflags = conv_arg.rflags &= ~RTC_OBJ_OPTINAL;
- (void) conv_expn_field(&conv_arg, 0);
+ (void) conv_expn_field(&conv_arg, vda, 0);
return ((const char *)config_obj_buf->buf);
}
diff --git a/usr/src/cmd/sgs/libconv/common/corenote.c b/usr/src/cmd/sgs/libconv/common/corenote.c
index 87c8955d48..fe896e665b 100644
--- a/usr/src/cmd/sgs/libconv/common/corenote.c
+++ b/usr/src/cmd/sgs/libconv/common/corenote.c
@@ -20,12 +20,10 @@
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* String conversion routines the system structs found in
* Solaris core file note sections. These items are not
@@ -39,21 +37,17 @@
#include <_conv.h>
#include <corenote_msg.h>
-/* Instantiate a local copy of conv_map2str() from _conv.h */
-DEFINE_conv_map2str
-
const char *
conv_cnote_type(Word type, Conv_fmt_flags_t fmt_flags,
Conv_inv_buf_t *inv_buf)
{
static const Msg types[] = {
- NULL,
MSG_NT_PRSTATUS, MSG_NT_PRFPREG,
MSG_NT_PRPSINFO, MSG_NT_PRXREG,
MSG_NT_PLATFORM, MSG_NT_AUXV,
MSG_NT_GWINDOWS, MSG_NT_ASRS,
MSG_NT_LDT, MSG_NT_PSTATUS,
- NULL, NULL,
+ 0, 0,
MSG_NT_PSINFO, MSG_NT_PRCRED,
MSG_NT_UTSNAME, MSG_NT_LWPSTATUS,
MSG_NT_LWPSINFO, MSG_NT_PRPRIV,
@@ -63,12 +57,13 @@ conv_cnote_type(Word type, Conv_fmt_flags_t fmt_flags,
#if NT_NUM != NT_ZONENAME
#error "NT_NUM has grown. Update core note types[]"
#endif
+ static const conv_ds_msg_t ds_types = {
+ CONV_DS_MSG_INIT(NT_PRSTATUS, types) };
+ static const conv_ds_t *ds[] = { CONV_DS_ADDR(ds_types), NULL };
- if ((type < 1) || (type > NT_NUM) || (type == 11) || (type == 12))
- return (conv_invalid_val(inv_buf, type, fmt_flags));
- return (conv_map2str(inv_buf, type, fmt_flags,
- ARRAY_NELTS(types), types));
+ return (conv_map_ds(ELFOSABI_NONE, EM_NONE, type, ds, fmt_flags,
+ inv_buf));
}
@@ -90,6 +85,9 @@ conv_cnote_auxv_type(Word type, Conv_fmt_flags_t fmt_flags,
MSG_AUXV_AT_ICACHEBSIZE, MSG_AUXV_AT_UCACHEBSIZE,
MSG_AUXV_AT_IGNOREPPC
};
+ static const conv_ds_msg_t ds_types_0_22 = {
+ CONV_DS_MSG_INIT(0, types_0_22) };
+
static const Msg types_2000_2011[] = {
MSG_AUXV_AT_SUN_UID, MSG_AUXV_AT_SUN_RUID,
MSG_AUXV_AT_SUN_GID, MSG_AUXV_AT_SUN_RGID,
@@ -98,6 +96,9 @@ conv_cnote_auxv_type(Word type, Conv_fmt_flags_t fmt_flags,
MSG_AUXV_AT_SUN_PLATFORM, MSG_AUXV_AT_SUN_HWCAP,
MSG_AUXV_AT_SUN_IFLUSH, MSG_AUXV_AT_SUN_CPU
};
+ static const conv_ds_msg_t ds_types_2000_2011 = {
+ CONV_DS_MSG_INIT(2000, types_2000_2011) };
+
static const Msg types_2014_2022[] = {
MSG_AUXV_AT_SUN_EXECNAME, MSG_AUXV_AT_SUN_MMU,
MSG_AUXV_AT_SUN_LDDATA, MSG_AUXV_AT_SUN_AUXFLAGS,
@@ -105,20 +106,15 @@ conv_cnote_auxv_type(Word type, Conv_fmt_flags_t fmt_flags,
MSG_AUXV_AT_SUN_BRAND_AUX1, MSG_AUXV_AT_SUN_BRAND_AUX2,
MSG_AUXV_AT_SUN_BRAND_AUX3
};
+ static const conv_ds_msg_t ds_types_2014_2022 = {
+ CONV_DS_MSG_INIT(2014, types_2014_2022) };
- if (type <= 22)
- return (conv_map2str(inv_buf, type, fmt_flags,
- ARRAY_NELTS(types_0_22), types_0_22));
-
- if ((type >= AT_SUN_UID) && (type <= AT_SUN_CPU))
- return (conv_map2str(inv_buf, type - AT_SUN_UID, fmt_flags,
- ARRAY_NELTS(types_2000_2011), types_2000_2011));
-
- if ((type >= AT_SUN_EXECNAME) && (type <= AT_SUN_BRAND_AUX3))
- return (conv_map2str(inv_buf, type - AT_SUN_EXECNAME, fmt_flags,
- ARRAY_NELTS(types_2014_2022), types_2014_2022));
+ static const conv_ds_t *ds[] = {
+ CONV_DS_ADDR(ds_types_0_22), CONV_DS_ADDR(ds_types_2000_2011),
+ CONV_DS_ADDR(ds_types_2014_2022), NULL };
- return (conv_invalid_val(inv_buf, type, fmt_flags));
+ return (conv_map_ds(ELFOSABI_NONE, EM_NONE, type, ds, fmt_flags,
+ inv_buf));
}
@@ -148,12 +144,13 @@ conv_cnote_signal(Word sig, Conv_fmt_flags_t fmt_flags,
MSG_SIGLOST, MSG_SIGXRES,
MSG_SIGJVM1, MSG_SIGJVM2,
};
+ static const conv_ds_msg_t ds_sigarr = {
+ CONV_DS_MSG_INIT(SIGHUP, sigarr) };
- if ((sig == 0) || (sig > SIGJVM2))
- return (conv_invalid_val(inv_buf, sig, fmt_flags));
+ static const conv_ds_t *ds[] = { CONV_DS_ADDR(ds_sigarr), NULL };
- return (conv_map2str(inv_buf, sig - 1, fmt_flags,
- ARRAY_NELTS(sigarr), sigarr));
+ return (conv_map_ds(ELFOSABI_NONE, EM_NONE, sig, ds, fmt_flags,
+ inv_buf));
}
@@ -171,12 +168,13 @@ conv_cnote_fault(Word flt, Conv_fmt_flags_t fmt_flags,
MSG_FLTCPCOVF
};
+ static const conv_ds_msg_t ds_fltarr = {
+ CONV_DS_MSG_INIT(FLTILL, fltarr) };
- if ((flt == 0) || (flt > FLTCPCOVF))
- return (conv_invalid_val(inv_buf, flt, fmt_flags));
+ static const conv_ds_t *ds[] = { CONV_DS_ADDR(ds_fltarr), NULL };
- return (conv_map2str(inv_buf, flt - 1, fmt_flags,
- ARRAY_NELTS(fltarr), fltarr));
+ return (conv_map_ds(ELFOSABI_NONE, EM_NONE, flt, ds, fmt_flags,
+ inv_buf));
}
@@ -314,6 +312,10 @@ conv_cnote_syscall(Word sysnum, Conv_fmt_flags_t fmt_flags,
MSG_SYS_CLADM, MSG_SYS_UUCOPY,
MSG_SYS_UMOUNT2
};
+ static const conv_ds_msg_t ds_sysnumarr = {
+ CONV_DS_MSG_INIT(1, sysnumarr) };
+
+ static const conv_ds_t *ds[] = { CONV_DS_ADDR(ds_sysnumarr), NULL };
int use_num = 0;
@@ -344,8 +346,8 @@ conv_cnote_syscall(Word sysnum, Conv_fmt_flags_t fmt_flags,
if (use_num)
return (conv_invalid_val(inv_buf, sysnum, fmt_flags));
- return (conv_map2str(inv_buf, sysnum - 1, fmt_flags,
- ARRAY_NELTS(sysnumarr), sysnumarr));
+ return (conv_map_ds(ELFOSABI_NONE, EM_NONE, sysnum, ds, fmt_flags,
+ inv_buf));
}
@@ -392,6 +394,9 @@ conv_cnote_errno(int errno_val, Conv_fmt_flags_t fmt_flags,
MSG_ERRNO_EPROTO, MSG_ERRNO_ELOCKUNMAPPED,
MSG_ERRNO_ENOTACTIVE, MSG_ERRNO_EMULTIHOP
};
+ static const conv_ds_msg_t ds_errarr_1_74 = {
+ CONV_DS_MSG_INIT(1, errarr_1_74) };
+
static const Msg errarr_77_99[23] = {
MSG_ERRNO_EBADMSG, MSG_ERRNO_ENAMETOOLONG,
MSG_ERRNO_EOVERFLOW, MSG_ERRNO_ENOTUNIQ,
@@ -406,6 +411,9 @@ conv_cnote_errno(int errno_val, Conv_fmt_flags_t fmt_flags,
MSG_ERRNO_EMSGSIZE, MSG_ERRNO_EPROTOTYPE,
MSG_ERRNO_ENOPROTOOPT
};
+ static const conv_ds_msg_t ds_errarr_77_99 = {
+ CONV_DS_MSG_INIT(77, errarr_77_99) };
+
static const Msg errarr_120_134[15] = {
MSG_ERRNO_EPROTONOSUPPORT, MSG_ERRNO_ESOCKTNOSUPPORT,
MSG_ERRNO_EOPNOTSUPP, MSG_ERRNO_EPFNOSUPPORT,
@@ -416,6 +424,9 @@ conv_cnote_errno(int errno_val, Conv_fmt_flags_t fmt_flags,
MSG_ERRNO_ENOBUFS, MSG_ERRNO_EISCONN,
MSG_ERRNO_ENOTCONN
};
+ static const conv_ds_msg_t ds_errarr_120_134 = {
+ CONV_DS_MSG_INIT(120, errarr_120_134) };
+
static const Msg errarr_143_151[9] = {
MSG_ERRNO_ESHUTDOWN, MSG_ERRNO_ETOOMANYREFS,
MSG_ERRNO_ETIMEDOUT, MSG_ERRNO_ECONNREFUSED,
@@ -423,28 +434,16 @@ conv_cnote_errno(int errno_val, Conv_fmt_flags_t fmt_flags,
MSG_ERRNO_EALREADY, MSG_ERRNO_EINPROGRESS,
MSG_ERRNO_ESTALE
};
+ static const conv_ds_msg_t ds_errarr_143_151 = {
+ CONV_DS_MSG_INIT(143, errarr_143_151) };
- if ((errno_val >= 1) && (errno_val <= 74)) {
- return (conv_map2str(inv_buf, errno_val - 1, fmt_flags,
- ARRAY_NELTS(errarr_1_74), errarr_1_74));
- }
-
- if ((errno_val >= 77) && (errno_val <= 99)) {
- return (conv_map2str(inv_buf, errno_val - 77, fmt_flags,
- ARRAY_NELTS(errarr_77_99), errarr_77_99));
- }
-
- if ((errno_val >= 120) && (errno_val <= 134)) {
- return (conv_map2str(inv_buf, errno_val - 120, fmt_flags,
- ARRAY_NELTS(errarr_120_134), errarr_120_134));
- }
+ static const conv_ds_t *ds[] = { CONV_DS_ADDR(ds_errarr_1_74),
+ CONV_DS_ADDR(ds_errarr_77_99), CONV_DS_ADDR(ds_errarr_120_134),
+ CONV_DS_ADDR(ds_errarr_143_151), NULL };
- if ((errno_val >= 143) && (errno_val <= 151)) {
- return (conv_map2str(inv_buf, errno_val - 143, fmt_flags,
- ARRAY_NELTS(errarr_143_151), errarr_143_151));
- }
- return (conv_invalid_val(inv_buf, errno_val, fmt_flags));
+ return (conv_map_ds(ELFOSABI_NONE, EM_NONE, errno_val, ds, fmt_flags,
+ inv_buf));
}
@@ -457,12 +456,12 @@ conv_cnote_pr_dmodel(Word dmodel, Conv_fmt_flags_t fmt_flags,
MSG_PR_MODEL_ILP32,
MSG_PR_MODEL_LP64
};
+ static const conv_ds_msg_t ds_models = {
+ CONV_DS_MSG_INIT(PR_MODEL_UNKNOWN, models) };
+ static const conv_ds_t *ds[] = { CONV_DS_ADDR(ds_models), NULL };
- if (dmodel > PR_MODEL_LP64)
- return (conv_invalid_val(inv_buf, dmodel, fmt_flags));
-
- return (conv_map2str(inv_buf, dmodel, fmt_flags,
- ARRAY_NELTS(models), models));
+ return (conv_map_ds(ELFOSABI_NONE, EM_NONE, dmodel, ds, fmt_flags,
+ inv_buf));
}
@@ -480,12 +479,12 @@ conv_cnote_pr_why(short why, Conv_fmt_flags_t fmt_flags,
MSG_PR_WHY_SUSPENDED,
MSG_PR_WHY_CHECKPOINT
};
+ static const conv_ds_msg_t ds_why_arr = {
+ CONV_DS_MSG_INIT(1, why_arr) };
+ static const conv_ds_t *ds[] = { CONV_DS_ADDR(ds_why_arr), NULL };
- if ((why == 0) || (why > PR_CHECKPOINT))
- return (conv_invalid_val(inv_buf, why, fmt_flags));
-
- return (conv_map2str(inv_buf, why - 1, fmt_flags,
- ARRAY_NELTS(why_arr), why_arr));
+ return (conv_map_ds(ELFOSABI_NONE, EM_NONE, why, ds, fmt_flags,
+ inv_buf));
}
@@ -538,16 +537,25 @@ conv_cnote_pr_regname(Half mach, int regno, Conv_fmt_flags_t fmt_flags,
MSG_REG_SPARC_I4, MSG_REG_SPARC_I5,
MSG_REG_SPARC_I6, MSG_REG_SPARC_I7
};
+ static const conv_ds_msg_t ds_sparc_gen_reg = {
+ CONV_DS_MSG_INIT(0, sparc_gen_reg) };
+
static const Msg sparc_32_37_reg[6] = {
MSG_REG_SPARC_PSR, MSG_REG_SPARC_PC,
MSG_REG_SPARC_nPC, MSG_REG_SPARC_Y,
MSG_REG_SPARC_WIM, MSG_REG_SPARC_TBR
};
+ static const conv_ds_msg_t ds_sparc_32_37_reg = {
+ CONV_DS_MSG_INIT(32, sparc_32_37_reg) };
+
static const Msg sparcv9_32_37_reg[6] = {
MSG_REG_SPARC_CCR, MSG_REG_SPARC_PC,
MSG_REG_SPARC_nPC, MSG_REG_SPARC_Y,
MSG_REG_SPARC_ASI, MSG_REG_SPARC_FPRS
};
+ static const conv_ds_msg_t ds_sparcv9_32_37_reg = {
+ CONV_DS_MSG_INIT(32, sparcv9_32_37_reg) };
+
static const Msg amd64_reg[28] = {
MSG_REG_AMD64_R15, MSG_REG_AMD64_R14,
MSG_REG_AMD64_R13, MSG_REG_AMD64_R12,
@@ -564,9 +572,12 @@ conv_cnote_pr_regname(Half mach, int regno, Conv_fmt_flags_t fmt_flags,
MSG_REG_AMD64_ES, MSG_REG_AMD64_DS,
MSG_REG_AMD64_FSBASE, MSG_REG_AMD64_GSBASE
};
+ static const conv_ds_msg_t ds_amd64_reg = {
+ CONV_DS_MSG_INIT(0, amd64_reg) };
+
static const Msg i86_reg[19] = {
- MSG_REG_I86_GS, MSG_REG_I86_FS,
- MSG_REG_I86_ES, MSG_REG_I86_DS,
+ MSG_REG_I86_GS, MSG_REG_I86_FS,
+ MSG_REG_I86_ES, MSG_REG_I86_DS,
MSG_REG_I86_EDI, MSG_REG_I86_ESI,
MSG_REG_I86_EBP, MSG_REG_I86_ESP,
MSG_REG_I86_EBX, MSG_REG_I86_EDX,
@@ -576,41 +587,51 @@ conv_cnote_pr_regname(Half mach, int regno, Conv_fmt_flags_t fmt_flags,
MSG_REG_I86_EFL, MSG_REG_I86_UESP,
MSG_REG_I86_SS
};
+ static const conv_ds_msg_t ds_i86_reg = {
+ CONV_DS_MSG_INIT(0, i86_reg) };
+
+
+ static const conv_ds_t *ds_sparc[] = {
+ CONV_DS_ADDR(ds_sparc_gen_reg),
+ CONV_DS_ADDR(ds_sparc_32_37_reg),
+ NULL
+ };
+ static const conv_ds_t *ds_sparcv9[] = {
+ CONV_DS_ADDR(ds_sparc_gen_reg),
+ CONV_DS_ADDR(ds_sparcv9_32_37_reg),
+ NULL
+ };
+ static const conv_ds_t *ds_amd64[] = {
+ CONV_DS_ADDR(ds_amd64_reg), NULL };
+ static const conv_ds_t *ds_i86[] = {
+ CONV_DS_ADDR(ds_i86_reg), NULL };
+
+ const conv_ds_t **ds;
switch (mach) {
case EM_386:
- if (regno < (sizeof (i86_reg) / sizeof (i86_reg[0])))
- return (conv_map2str(inv_buf, regno, fmt_flags,
- ARRAY_NELTS(i86_reg), i86_reg));
+ ds = ds_i86;
break;
case EM_AMD64:
- if (regno < (sizeof (amd64_reg) / sizeof (amd64_reg[0])))
- return (conv_map2str(inv_buf, regno, fmt_flags,
- ARRAY_NELTS(amd64_reg), amd64_reg));
+ ds = ds_amd64;
break;
case EM_SPARC:
case EM_SPARC32PLUS:
- if (regno <= 31)
- return (conv_map2str(inv_buf, regno, fmt_flags,
- ARRAY_NELTS(sparc_gen_reg), sparc_gen_reg));
- if (regno <= 37)
- return (conv_map2str(inv_buf, regno - 32, fmt_flags,
- ARRAY_NELTS(sparc_32_37_reg), sparc_32_37_reg));
+ ds = ds_sparc;
break;
+
case EM_SPARCV9:
- if (regno <= 31)
- return (conv_map2str(inv_buf, regno, fmt_flags,
- ARRAY_NELTS(sparc_gen_reg), sparc_gen_reg));
- if (regno <= 37)
- return (conv_map2str(inv_buf, regno - 32, fmt_flags,
- ARRAY_NELTS(sparcv9_32_37_reg), sparcv9_32_37_reg));
+ ds = ds_sparcv9;
break;
+
+ default:
+ return (conv_invalid_val(inv_buf, regno, fmt_flags));
}
- /* If not recognized, format as a number */
- return (conv_invalid_val(inv_buf, regno, fmt_flags));
+ return (conv_map_ds(ELFOSABI_NONE, mach, regno, ds, fmt_flags,
+ inv_buf));
}
const char *
@@ -623,12 +644,12 @@ conv_cnote_pr_stype(Word stype, Conv_fmt_flags_t fmt_flags,
MSG_SOBJ_SEMA, MSG_SOBJ_USER,
MSG_SOBJ_USER_PI, MSG_SOBJ_SHUTTLE
};
+ static const conv_ds_msg_t ds_types = { CONV_DS_MSG_INIT(0, types) };
+ static const conv_ds_t *ds[] = { CONV_DS_ADDR(ds_types), NULL };
- if (stype < ARRAY_NELTS(types))
- return (conv_map2str(inv_buf, stype, fmt_flags,
- ARRAY_NELTS(types), types));
- return (conv_invalid_val(inv_buf, stype, fmt_flags));
+ return (conv_map_ds(ELFOSABI_NONE, EM_NONE, stype, ds, fmt_flags,
+ inv_buf));
}
@@ -644,7 +665,7 @@ conv_cnote_priv(int priv, Conv_fmt_flags_t fmt_flags,
* built around the Word type, which is unsigned. Rather than
* modify libconv for this one case, we simply handle
* these constants differently that the usual approach,
- * and stay away from conv_invalid_val() and conv_map2str().
+ * and stay away from conv_invalid_val() and conv_map_ds().
*/
switch (priv) {
case PRIV_ALL:
@@ -678,7 +699,7 @@ conv_cnote_psetid(int id, Conv_fmt_flags_t fmt_flags,
* built around the Word type, which is unsigned. Rather than
* modify libconv for this one case, we simply handle
* these constants differently that the usual approach,
- * and stay away from conv_invalid_val() and conv_map2str().
+ * and stay away from conv_invalid_val() and conv_map_ds().
*/
switch (id) {
case PS_NONE:
@@ -713,7 +734,6 @@ const char *
conv_cnote_si_code(Half mach, int sig, int si_code,
Conv_fmt_flags_t fmt_flags, Conv_inv_buf_t *inv_buf)
{
-#define NELTS(_arr) (sizeof (_arr) / sizeof (_arr[0]))
/* Values of si_code for user generated signals */
static const Msg user_arr[6] = {
@@ -721,6 +741,11 @@ conv_cnote_si_code(Half mach, int sig, int si_code,
MSG_SI_QUEUE, MSG_SI_TIMER,
MSG_SI_ASYNCIO, MSG_SI_MESGQ
};
+ static const conv_ds_msg_t ds_msg_user_arr = {
+ CONV_DS_MSG_INIT(0, user_arr) };
+ static const conv_ds_t *ds_user_arr[] = {
+ CONV_DS_ADDR(ds_msg_user_arr), NULL };
+
/*
* Architecture dependent system generated signals. All
@@ -731,16 +756,30 @@ conv_cnote_si_code(Half mach, int sig, int si_code,
MSG_SI_TRAP_RWATCH, MSG_SI_TRAP_WWATCH,
MSG_SI_TRAP_XWATCH, MSG_SI_TRAP_DTRACE
};
+ static const conv_ds_msg_t ds_msg_trap_arr = {
+ CONV_DS_MSG_INIT(1, trap_arr) };
+ static const conv_ds_t *ds_trap_arr[] = {
+ CONV_DS_ADDR(ds_msg_trap_arr), NULL };
+
static const Msg cld_arr[6] = {
MSG_SI_CLD_EXITED, MSG_SI_CLD_KILLED,
MSG_SI_CLD_DUMPED, MSG_SI_CLD_TRAPPED,
MSG_SI_CLD_STOPPED, MSG_SI_CLD_CONTINUED
};
+ static const conv_ds_msg_t ds_msg_cld_arr = {
+ CONV_DS_MSG_INIT(1, cld_arr) };
+ static const conv_ds_t *ds_cld_arr[] = {
+ CONV_DS_ADDR(ds_msg_cld_arr), NULL };
+
static const Msg poll_arr[6] = {
MSG_SI_POLL_IN, MSG_SI_POLL_OUT,
MSG_SI_POLL_MSG, MSG_SI_POLL_ERR,
MSG_SI_POLL_PRI, MSG_SI_POLL_HUP
};
+ static const conv_ds_msg_t ds_msg_poll_arr = {
+ CONV_DS_MSG_INIT(1, poll_arr) };
+ static const conv_ds_t *ds_poll_arr[] = {
+ CONV_DS_ADDR(ds_msg_poll_arr), NULL };
/*
* Architecture dependent system generated signals.
@@ -758,14 +797,28 @@ conv_cnote_si_code(Half mach, int sig, int si_code,
MSG_SI_ILL_PRVOPC, MSG_SI_ILL_PRVREG,
MSG_SI_ILL_COPROC, MSG_SI_ILL_BADSTK
};
+ static const conv_ds_msg_t ds_msg_ill_arr = {
+ CONV_DS_MSG_INIT(1, ill_arr) };
+ static const conv_ds_t *ds_ill_arr[] = {
+ CONV_DS_ADDR(ds_msg_ill_arr), NULL };
/* EMT */
static const Msg emt_arr_sparc[2] = {
MSG_SI_EMT_TAGOVF, MSG_SI_EMT_CPCOVF
};
+ static const conv_ds_msg_t ds_msg_emt_arr_sparc = {
+ CONV_DS_MSG_INIT(1, emt_arr_sparc) };
+ static const conv_ds_t *ds_emt_arr_sparc[] = {
+ CONV_DS_ADDR(ds_msg_emt_arr_sparc), NULL };
+
static const Msg emt_arr_x86[1] = {
MSG_SI_EMT_CPCOVF
};
+ static const conv_ds_msg_t ds_msg_emt_arr_x86 = {
+ CONV_DS_MSG_INIT(1, emt_arr_x86) };
+ static const conv_ds_t *ds_emt_arr_x86[] = {
+ CONV_DS_ADDR(ds_msg_emt_arr_x86), NULL };
+
/* FPE */
static const Msg fpe_arr_sparc[8] = {
@@ -774,6 +827,11 @@ conv_cnote_si_code(Half mach, int sig, int si_code,
MSG_SI_FPE_FLTUND, MSG_SI_FPE_FLTRES,
MSG_SI_FPE_FLTINV, MSG_SI_FPE_FLTSUB
};
+ static const conv_ds_msg_t ds_msg_fpe_arr_sparc = {
+ CONV_DS_MSG_INIT(1, fpe_arr_sparc) };
+ static const conv_ds_t *ds_fpe_arr_sparc[] = {
+ CONV_DS_ADDR(ds_msg_fpe_arr_sparc), NULL };
+
static const Msg fpe_arr_x86[9] = {
MSG_SI_FPE_INTDIV, MSG_SI_FPE_INTOVF,
MSG_SI_FPE_FLTDIV, MSG_SI_FPE_FLTOVF,
@@ -781,17 +839,29 @@ conv_cnote_si_code(Half mach, int sig, int si_code,
MSG_SI_FPE_FLTINV, MSG_SI_FPE_FLTSUB,
MSG_SI_FPE_FLTDEN
};
+ static const conv_ds_msg_t ds_msg_fpe_arr_x86 = {
+ CONV_DS_MSG_INIT(1, fpe_arr_x86) };
+ static const conv_ds_t *ds_fpe_arr_x86[] = {
+ CONV_DS_ADDR(ds_msg_fpe_arr_x86), NULL };
/* SEGV */
static const Msg segv_arr[2] = {
MSG_SI_SEGV_MAPERR, MSG_SI_SEGV_ACCERR
};
+ static const conv_ds_msg_t ds_msg_segv_arr = {
+ CONV_DS_MSG_INIT(1, segv_arr) };
+ static const conv_ds_t *ds_segv_arr[] = {
+ CONV_DS_ADDR(ds_msg_segv_arr), NULL };
/* BUS */
static const Msg bus_arr[3] = {
MSG_SI_BUS_ADRALN, MSG_SI_BUS_ADRERR,
MSG_SI_BUS_OBJERR
};
+ static const conv_ds_msg_t ds_msg_bus_arr = {
+ CONV_DS_MSG_INIT(1, bus_arr) };
+ static const conv_ds_t *ds_bus_arr[] = {
+ CONV_DS_ADDR(ds_msg_bus_arr), NULL };
enum { ARCH_NONE, ARCH_X86, ARCH_SPARC } arch;
@@ -816,7 +886,7 @@ conv_cnote_si_code(Half mach, int sig, int si_code,
if ((si_code == 0) && (sig == 0))
return (MSG_ORIG(MSG_GBL_ZERO));
- if (ndx >= NELTS(user_arr)) {
+ if (ndx >= ARRAY_NELTS(user_arr)) {
const char *fmt;
fmt = (fmt_flags & CONV_FMT_DECIMAL) ?
@@ -827,8 +897,8 @@ conv_cnote_si_code(Half mach, int sig, int si_code,
sizeof (inv_buf->buf), fmt, si_code);
return (inv_buf->buf);
}
- return (conv_map2str(inv_buf, ndx, fmt_flags,
- ARRAY_NELTS(user_arr), user_arr));
+ return (conv_map_ds(ELFOSABI_NONE, EM_NONE, ndx,
+ ds_user_arr, fmt_flags, inv_buf));
}
}
@@ -857,81 +927,55 @@ conv_cnote_si_code(Half mach, int sig, int si_code,
switch (sig) {
case SIGTRAP:
- if (si_code <= NELTS(trap_arr))
- return (conv_map2str(inv_buf, si_code - 1, fmt_flags,
- ARRAY_NELTS(trap_arr), trap_arr));
- break;
+ return (conv_map_ds(ELFOSABI_NONE, EM_NONE, si_code,
+ ds_trap_arr, fmt_flags, inv_buf));
case SIGCLD:
- if (si_code <= NELTS(cld_arr))
- return (conv_map2str(inv_buf, si_code - 1, fmt_flags,
- ARRAY_NELTS(cld_arr), cld_arr));
- break;
+ return (conv_map_ds(ELFOSABI_NONE, EM_NONE, si_code,
+ ds_cld_arr, fmt_flags, inv_buf));
case SIGPOLL:
- if (si_code <= NELTS(poll_arr))
- return (conv_map2str(inv_buf, si_code - 1, fmt_flags,
- ARRAY_NELTS(poll_arr), poll_arr));
- break;
+ return (conv_map_ds(ELFOSABI_NONE, EM_NONE, si_code,
+ ds_poll_arr, fmt_flags, inv_buf));
case SIGILL:
- if (si_code <= NELTS(ill_arr))
- return (conv_map2str(inv_buf, si_code - 1, fmt_flags,
- ARRAY_NELTS(ill_arr), ill_arr));
- break;
+ return (conv_map_ds(ELFOSABI_NONE, EM_NONE, si_code,
+ ds_ill_arr, fmt_flags, inv_buf));
case SIGEMT:
switch (arch) {
case ARCH_SPARC:
- if (si_code <= NELTS(emt_arr_sparc))
- return (conv_map2str(inv_buf, si_code - 1,
- fmt_flags, ARRAY_NELTS(emt_arr_sparc),
- emt_arr_sparc));
- break;
+ return (conv_map_ds(ELFOSABI_NONE, EM_NONE, si_code,
+ ds_emt_arr_sparc, fmt_flags, inv_buf));
case ARCH_X86:
- if (si_code <= NELTS(emt_arr_x86))
- return (conv_map2str(inv_buf, si_code - 1,
- fmt_flags, ARRAY_NELTS(emt_arr_x86),
- emt_arr_x86));
- break;
+ return (conv_map_ds(ELFOSABI_NONE, EM_NONE, si_code,
+ ds_emt_arr_x86, fmt_flags, inv_buf));
}
break;
case SIGFPE:
switch (arch) {
case ARCH_SPARC:
- if (si_code <= NELTS(fpe_arr_sparc))
- return (conv_map2str(inv_buf, si_code - 1,
- fmt_flags, ARRAY_NELTS(fpe_arr_sparc),
- fpe_arr_sparc));
- break;
+ return (conv_map_ds(ELFOSABI_NONE, EM_NONE, si_code,
+ ds_fpe_arr_sparc, fmt_flags, inv_buf));
case ARCH_X86:
- if (si_code <= NELTS(fpe_arr_x86))
- return (conv_map2str(inv_buf, si_code - 1,
- fmt_flags, ARRAY_NELTS(fpe_arr_x86),
- fpe_arr_x86));
- break;
+ return (conv_map_ds(ELFOSABI_NONE, EM_NONE, si_code,
+ ds_fpe_arr_x86, fmt_flags, inv_buf));
}
break;
case SIGSEGV:
- if (si_code <= NELTS(segv_arr))
- return (conv_map2str(inv_buf, si_code - 1, fmt_flags,
- ARRAY_NELTS(segv_arr), segv_arr));
- break;
+ return (conv_map_ds(ELFOSABI_NONE, EM_NONE, si_code,
+ ds_segv_arr, fmt_flags, inv_buf));
case SIGBUS:
- if (si_code <= NELTS(bus_arr))
- return (conv_map2str(inv_buf, si_code - 1, fmt_flags,
- ARRAY_NELTS(bus_arr), bus_arr));
- break;
-
+ return (conv_map_ds(ELFOSABI_NONE, EM_NONE, si_code,
+ ds_bus_arr, fmt_flags, inv_buf));
}
/* If not recognized, format as a number */
return (conv_invalid_val(inv_buf, si_code, fmt_flags));
-#undef NELTS
}
@@ -961,21 +1005,21 @@ const char *
conv_cnote_auxv_af(Word flags, Conv_fmt_flags_t fmt_flags,
Conv_cnote_auxv_af_buf_t *cnote_auxv_af_buf)
{
- static Val_desc vda[] = {
- { AF_SUN_SETUGID, MSG_ORIG(MSG_AUXV_AF_SUN_SETUGID) },
- { AF_SUN_HWCAPVERIFY, MSG_ORIG(MSG_AUXV_AF_SUN_HWCAPVERIFY) },
- { AF_SUN_NOPLM, MSG_ORIG(MSG_AUXV_AF_SUN_NOPLM) },
+ static const Val_desc vda[] = {
+ { AF_SUN_SETUGID, MSG_AUXV_AF_SUN_SETUGID },
+ { AF_SUN_HWCAPVERIFY, MSG_AUXV_AF_SUN_HWCAPVERIFY },
+ { AF_SUN_NOPLM, MSG_AUXV_AF_SUN_NOPLM },
{ 0, 0 }
};
static CONV_EXPN_FIELD_ARG conv_arg = {
- NULL, sizeof (cnote_auxv_af_buf->buf), vda };
+ NULL, sizeof (cnote_auxv_af_buf->buf) };
if (flags == 0)
return (MSG_ORIG(MSG_GBL_ZERO));
conv_arg.buf = cnote_auxv_af_buf->buf;
conv_arg.oflags = conv_arg.rflags = flags;
- (void) conv_expn_field(&conv_arg, fmt_flags);
+ (void) conv_expn_field(&conv_arg, vda, fmt_flags);
return ((const char *)cnote_auxv_af_buf->buf);
}
@@ -1031,31 +1075,31 @@ conv_cnote_cc_content(Lword flags, Conv_fmt_flags_t fmt_flags,
* that can only occur via core file corruption, which presumably
* would be evident in other ways.
*/
- static Val_desc vda[] = {
- { (Word) CC_CONTENT_STACK, MSG_ORIG(MSG_CC_CONTENT_STACK) },
- { (Word) CC_CONTENT_HEAP, MSG_ORIG(MSG_CC_CONTENT_HEAP) },
- { (Word) CC_CONTENT_SHFILE, MSG_ORIG(MSG_CC_CONTENT_SHFILE) },
- { (Word) CC_CONTENT_SHANON, MSG_ORIG(MSG_CC_CONTENT_SHANON) },
- { (Word) CC_CONTENT_TEXT, MSG_ORIG(MSG_CC_CONTENT_TEXT) },
- { (Word) CC_CONTENT_DATA, MSG_ORIG(MSG_CC_CONTENT_DATA) },
- { (Word) CC_CONTENT_RODATA, MSG_ORIG(MSG_CC_CONTENT_RODATA) },
- { (Word) CC_CONTENT_ANON, MSG_ORIG(MSG_CC_CONTENT_ANON) },
- { (Word) CC_CONTENT_SHM, MSG_ORIG(MSG_CC_CONTENT_SHM) },
- { (Word) CC_CONTENT_ISM, MSG_ORIG(MSG_CC_CONTENT_ISM) },
- { (Word) CC_CONTENT_DISM, MSG_ORIG(MSG_CC_CONTENT_DISM) },
- { (Word) CC_CONTENT_CTF, MSG_ORIG(MSG_CC_CONTENT_CTF) },
- { (Word) CC_CONTENT_SYMTAB, MSG_ORIG(MSG_CC_CONTENT_SYMTAB) },
+ static const Val_desc vda[] = {
+ { (Word) CC_CONTENT_STACK, MSG_CC_CONTENT_STACK },
+ { (Word) CC_CONTENT_HEAP, MSG_CC_CONTENT_HEAP },
+ { (Word) CC_CONTENT_SHFILE, MSG_CC_CONTENT_SHFILE },
+ { (Word) CC_CONTENT_SHANON, MSG_CC_CONTENT_SHANON },
+ { (Word) CC_CONTENT_TEXT, MSG_CC_CONTENT_TEXT },
+ { (Word) CC_CONTENT_DATA, MSG_CC_CONTENT_DATA },
+ { (Word) CC_CONTENT_RODATA, MSG_CC_CONTENT_RODATA },
+ { (Word) CC_CONTENT_ANON, MSG_CC_CONTENT_ANON },
+ { (Word) CC_CONTENT_SHM, MSG_CC_CONTENT_SHM },
+ { (Word) CC_CONTENT_ISM, MSG_CC_CONTENT_ISM },
+ { (Word) CC_CONTENT_DISM, MSG_CC_CONTENT_DISM },
+ { (Word) CC_CONTENT_CTF, MSG_CC_CONTENT_CTF },
+ { (Word) CC_CONTENT_SYMTAB, MSG_CC_CONTENT_SYMTAB },
{ 0, 0 }
};
static CONV_EXPN_FIELD_ARG conv_arg = {
- NULL, sizeof (cnote_cc_content_buf->buf), vda };
+ NULL, sizeof (cnote_cc_content_buf->buf) };
if (flags == 0)
return (MSG_ORIG(MSG_GBL_ZERO));
conv_arg.buf = cnote_cc_content_buf->buf;
conv_arg.oflags = conv_arg.rflags = flags;
- (void) conv_expn_field(&conv_arg, fmt_flags);
+ (void) conv_expn_field(&conv_arg, vda, fmt_flags);
return ((const char *)cnote_cc_content_buf->buf);
}
@@ -1108,42 +1152,42 @@ const char *
conv_cnote_pr_flags(int flags, Conv_fmt_flags_t fmt_flags,
Conv_cnote_pr_flags_buf_t *cnote_pr_flags_buf)
{
- static Val_desc vda[] = {
- { PR_STOPPED, MSG_ORIG(MSG_PR_FLAGS_STOPPED) },
- { PR_ISTOP, MSG_ORIG(MSG_PR_FLAGS_ISTOP) },
- { PR_DSTOP, MSG_ORIG(MSG_PR_FLAGS_DSTOP) },
- { PR_STEP, MSG_ORIG(MSG_PR_FLAGS_STEP) },
- { PR_ASLEEP, MSG_ORIG(MSG_PR_FLAGS_ASLEEP) },
- { PR_PCINVAL, MSG_ORIG(MSG_PR_FLAGS_PCINVAL) },
- { PR_ASLWP, MSG_ORIG(MSG_PR_FLAGS_ASLWP) },
- { PR_AGENT, MSG_ORIG(MSG_PR_FLAGS_AGENT) },
- { PR_DETACH, MSG_ORIG(MSG_PR_FLAGS_DETACH) },
- { PR_DAEMON, MSG_ORIG(MSG_PR_FLAGS_DAEMON) },
- { PR_IDLE, MSG_ORIG(MSG_PR_FLAGS_IDLE) },
- { PR_ISSYS, MSG_ORIG(MSG_PR_FLAGS_ISSYS) },
- { PR_VFORKP, MSG_ORIG(MSG_PR_FLAGS_VFORKP) },
- { PR_ORPHAN, MSG_ORIG(MSG_PR_FLAGS_ORPHAN) },
- { PR_NOSIGCHLD, MSG_ORIG(MSG_PR_FLAGS_NOSIGCHLD) },
- { PR_WAITPID, MSG_ORIG(MSG_PR_FLAGS_WAITPID) },
- { PR_FORK, MSG_ORIG(MSG_PR_FLAGS_FORK) },
- { PR_RLC, MSG_ORIG(MSG_PR_FLAGS_RLC) },
- { PR_KLC, MSG_ORIG(MSG_PR_FLAGS_KLC) },
- { PR_ASYNC, MSG_ORIG(MSG_PR_FLAGS_ASYNC) },
- { PR_MSACCT, MSG_ORIG(MSG_PR_FLAGS_MSACCT) },
- { PR_BPTADJ, MSG_ORIG(MSG_PR_FLAGS_BPTADJ) },
- { PR_PTRACE, MSG_ORIG(MSG_PR_FLAGS_PTRACE) },
- { PR_MSFORK, MSG_ORIG(MSG_PR_FLAGS_MSFORK) },
+ static const Val_desc vda[] = {
+ { PR_STOPPED, MSG_PR_FLAGS_STOPPED },
+ { PR_ISTOP, MSG_PR_FLAGS_ISTOP },
+ { PR_DSTOP, MSG_PR_FLAGS_DSTOP },
+ { PR_STEP, MSG_PR_FLAGS_STEP },
+ { PR_ASLEEP, MSG_PR_FLAGS_ASLEEP },
+ { PR_PCINVAL, MSG_PR_FLAGS_PCINVAL },
+ { PR_ASLWP, MSG_PR_FLAGS_ASLWP },
+ { PR_AGENT, MSG_PR_FLAGS_AGENT },
+ { PR_DETACH, MSG_PR_FLAGS_DETACH },
+ { PR_DAEMON, MSG_PR_FLAGS_DAEMON },
+ { PR_IDLE, MSG_PR_FLAGS_IDLE },
+ { PR_ISSYS, MSG_PR_FLAGS_ISSYS },
+ { PR_VFORKP, MSG_PR_FLAGS_VFORKP },
+ { PR_ORPHAN, MSG_PR_FLAGS_ORPHAN },
+ { PR_NOSIGCHLD, MSG_PR_FLAGS_NOSIGCHLD },
+ { PR_WAITPID, MSG_PR_FLAGS_WAITPID },
+ { PR_FORK, MSG_PR_FLAGS_FORK },
+ { PR_RLC, MSG_PR_FLAGS_RLC },
+ { PR_KLC, MSG_PR_FLAGS_KLC },
+ { PR_ASYNC, MSG_PR_FLAGS_ASYNC },
+ { PR_MSACCT, MSG_PR_FLAGS_MSACCT },
+ { PR_BPTADJ, MSG_PR_FLAGS_BPTADJ },
+ { PR_PTRACE, MSG_PR_FLAGS_PTRACE },
+ { PR_MSFORK, MSG_PR_FLAGS_MSFORK },
{ 0, 0 }
};
static CONV_EXPN_FIELD_ARG conv_arg = {
- NULL, sizeof (cnote_pr_flags_buf->buf), vda };
+ NULL, sizeof (cnote_pr_flags_buf->buf) };
if (flags == 0)
return (MSG_ORIG(MSG_GBL_ZERO));
conv_arg.buf = cnote_pr_flags_buf->buf;
conv_arg.oflags = conv_arg.rflags = flags;
- (void) conv_expn_field(&conv_arg, fmt_flags);
+ (void) conv_expn_field(&conv_arg, vda, fmt_flags);
return ((const char *)cnote_pr_flags_buf->buf);
}
@@ -1194,34 +1238,34 @@ conv_cnote_old_pr_flags(int flags, Conv_fmt_flags_t fmt_flags,
* values. To avoid confusion, we don't include <sys/old_procfs.h>,
* and specify the values directly.
*/
- static Val_desc vda[] = {
- { 0x0001, MSG_ORIG(MSG_PR_FLAGS_STOPPED) },
- { 0x0002, MSG_ORIG(MSG_PR_FLAGS_ISTOP) },
- { 0x0004, MSG_ORIG(MSG_PR_FLAGS_DSTOP) },
- { 0x0008, MSG_ORIG(MSG_PR_FLAGS_ASLEEP) },
- { 0x0010, MSG_ORIG(MSG_PR_FLAGS_FORK) },
- { 0x0020, MSG_ORIG(MSG_PR_FLAGS_RLC) },
- { 0x0040, MSG_ORIG(MSG_PR_FLAGS_PTRACE) },
- { 0x0080, MSG_ORIG(MSG_PR_FLAGS_PCINVAL) },
- { 0x0100, MSG_ORIG(MSG_PR_FLAGS_ISSYS) },
- { 0x0200, MSG_ORIG(MSG_PR_FLAGS_STEP) },
- { 0x0400, MSG_ORIG(MSG_PR_FLAGS_KLC) },
- { 0x0800, MSG_ORIG(MSG_PR_FLAGS_ASYNC) },
- { 0x1000, MSG_ORIG(MSG_PR_FLAGS_PCOMPAT) },
- { 0x2000, MSG_ORIG(MSG_PR_FLAGS_MSACCT) },
- { 0x4000, MSG_ORIG(MSG_PR_FLAGS_BPTADJ) },
- { 0x8000, MSG_ORIG(MSG_PR_FLAGS_ASLWP) },
+ static const Val_desc vda[] = {
+ { 0x0001, MSG_PR_FLAGS_STOPPED },
+ { 0x0002, MSG_PR_FLAGS_ISTOP },
+ { 0x0004, MSG_PR_FLAGS_DSTOP },
+ { 0x0008, MSG_PR_FLAGS_ASLEEP },
+ { 0x0010, MSG_PR_FLAGS_FORK },
+ { 0x0020, MSG_PR_FLAGS_RLC },
+ { 0x0040, MSG_PR_FLAGS_PTRACE },
+ { 0x0080, MSG_PR_FLAGS_PCINVAL },
+ { 0x0100, MSG_PR_FLAGS_ISSYS },
+ { 0x0200, MSG_PR_FLAGS_STEP },
+ { 0x0400, MSG_PR_FLAGS_KLC },
+ { 0x0800, MSG_PR_FLAGS_ASYNC },
+ { 0x1000, MSG_PR_FLAGS_PCOMPAT },
+ { 0x2000, MSG_PR_FLAGS_MSACCT },
+ { 0x4000, MSG_PR_FLAGS_BPTADJ },
+ { 0x8000, MSG_PR_FLAGS_ASLWP },
{ 0, 0 }
};
static CONV_EXPN_FIELD_ARG conv_arg = {
- NULL, sizeof (cnote_old_pr_flags_buf->buf), vda };
+ NULL, sizeof (cnote_old_pr_flags_buf->buf) };
if (flags == 0)
return (MSG_ORIG(MSG_GBL_ZERO));
conv_arg.buf = cnote_old_pr_flags_buf->buf;
conv_arg.oflags = conv_arg.rflags = flags;
- (void) conv_expn_field(&conv_arg, fmt_flags);
+ (void) conv_expn_field(&conv_arg, vda, fmt_flags);
return ((const char *)cnote_old_pr_flags_buf->buf);
}
@@ -1267,20 +1311,20 @@ conv_cnote_proc_flag(int flags, Conv_fmt_flags_t fmt_flags,
* SMSACCT and SSYS are stable public values, we simply use
* their numeric value.
*/
- static Val_desc vda[] = {
- { 0x00000001, MSG_ORIG(MSG_PROC_FLAG_SSYS) },
- { 0x02000000, MSG_ORIG(MSG_PROC_FLAG_SMSACCT) },
+ static const Val_desc vda[] = {
+ { 0x00000001, MSG_PROC_FLAG_SSYS },
+ { 0x02000000, MSG_PROC_FLAG_SMSACCT },
{ 0, 0 }
};
static CONV_EXPN_FIELD_ARG conv_arg = {
- NULL, sizeof (cnote_proc_flag_buf->buf), vda };
+ NULL, sizeof (cnote_proc_flag_buf->buf) };
if (flags == 0)
return (MSG_ORIG(MSG_GBL_ZERO));
conv_arg.buf = cnote_proc_flag_buf->buf;
conv_arg.oflags = conv_arg.rflags = flags;
- (void) conv_expn_field(&conv_arg, fmt_flags);
+ (void) conv_expn_field(&conv_arg, vda, fmt_flags);
return ((const char *)cnote_proc_flag_buf->buf);
}
@@ -1316,25 +1360,25 @@ const char *
conv_cnote_sa_flags(int flags, Conv_fmt_flags_t fmt_flags,
Conv_cnote_sa_flags_buf_t *cnote_sa_flags_buf)
{
- static Val_desc vda[] = {
- { SA_ONSTACK, MSG_ORIG(MSG_SA_ONSTACK) },
- { SA_RESETHAND, MSG_ORIG(MSG_SA_RESETHAND) },
- { SA_RESTART, MSG_ORIG(MSG_SA_RESTART) },
- { SA_SIGINFO, MSG_ORIG(MSG_SA_SIGINFO) },
- { SA_NODEFER, MSG_ORIG(MSG_SA_NODEFER) },
- { SA_NOCLDWAIT, MSG_ORIG(MSG_SA_NOCLDWAIT) },
- { SA_NOCLDSTOP, MSG_ORIG(MSG_SA_NOCLDSTOP) },
+ static const Val_desc vda[] = {
+ { SA_ONSTACK, MSG_SA_ONSTACK },
+ { SA_RESETHAND, MSG_SA_RESETHAND },
+ { SA_RESTART, MSG_SA_RESTART },
+ { SA_SIGINFO, MSG_SA_SIGINFO },
+ { SA_NODEFER, MSG_SA_NODEFER },
+ { SA_NOCLDWAIT, MSG_SA_NOCLDWAIT },
+ { SA_NOCLDSTOP, MSG_SA_NOCLDSTOP },
{ 0, 0 }
};
static CONV_EXPN_FIELD_ARG conv_arg = {
- NULL, sizeof (cnote_sa_flags_buf->buf), vda };
+ NULL, sizeof (cnote_sa_flags_buf->buf) };
if (flags == 0)
return (MSG_ORIG(MSG_GBL_ZERO));
conv_arg.buf = cnote_sa_flags_buf->buf;
conv_arg.oflags = conv_arg.rflags = flags;
- (void) conv_expn_field(&conv_arg, fmt_flags);
+ (void) conv_expn_field(&conv_arg, vda, fmt_flags);
return ((const char *)cnote_sa_flags_buf->buf);
}
@@ -1365,20 +1409,20 @@ const char *
conv_cnote_ss_flags(int flags, Conv_fmt_flags_t fmt_flags,
Conv_cnote_ss_flags_buf_t *cnote_ss_flags_buf)
{
- static Val_desc vda[] = {
- { SS_ONSTACK, MSG_ORIG(MSG_SS_ONSTACK) },
- { SS_DISABLE, MSG_ORIG(MSG_SS_DISABLE) },
+ static const Val_desc vda[] = {
+ { SS_ONSTACK, MSG_SS_ONSTACK },
+ { SS_DISABLE, MSG_SS_DISABLE },
{ 0, 0 }
};
static CONV_EXPN_FIELD_ARG conv_arg = {
- NULL, sizeof (cnote_ss_flags_buf->buf), vda };
+ NULL, sizeof (cnote_ss_flags_buf->buf) };
if (flags == 0)
return (MSG_ORIG(MSG_GBL_ZERO));
conv_arg.buf = cnote_ss_flags_buf->buf;
conv_arg.oflags = conv_arg.rflags = flags;
- (void) conv_expn_field(&conv_arg, fmt_flags);
+ (void) conv_expn_field(&conv_arg, vda, fmt_flags);
return ((const char *)cnote_ss_flags_buf->buf);
}
@@ -1396,7 +1440,7 @@ conv_cnote_ss_flags(int flags, Conv_fmt_flags_t fmt_flags,
*/
typedef struct {
- Val_desc *vdp; /* NULL, or bitmask description */
+ const Val_desc *vdp; /* NULL, or bitmask description */
uint32_t unused_bits; /* Mask of undefined bits */
} conv_bitmaskset_desc_t;
@@ -1413,7 +1457,7 @@ typedef struct {
*/
static const char *
conv_bitmaskset(uint32_t *maskarr, int n_mask,
- conv_bitmaskset_desc_t *bitmask_descarr, Conv_fmt_flags_t fmt_flags,
+ const conv_bitmaskset_desc_t *bitmask_descarr, Conv_fmt_flags_t fmt_flags,
char *conv_buf, size_t conv_buf_size)
{
CONV_EXPN_FIELD_ARG conv_arg;
@@ -1465,7 +1509,6 @@ conv_bitmaskset(uint32_t *maskarr, int n_mask,
if (mask != 0) {
- conv_arg.vdp = bitmask_descarr[i].vdp;
conv_arg.oflags = conv_arg.rflags = mask;
if (need_sep) {
*conv_arg.buf++ = ' ';
@@ -1473,7 +1516,7 @@ conv_bitmaskset(uint32_t *maskarr, int n_mask,
}
need_sep = 1;
(void) conv_expn_field(&conv_arg,
- fmt_flags | CONV_FMT_NOBKT);
+ bitmask_descarr[i].vdp, fmt_flags | CONV_FMT_NOBKT);
n = strlen(conv_arg.buf);
conv_arg.bufsize -= n;
conv_arg.buf += n;
@@ -1599,53 +1642,53 @@ conv_cnote_sigset(uint32_t *maskarr, int n_mask,
{
#define N_MASK 4
- static Val_desc vda0[] = {
- { 0x00000001, MSG_ORIG(MSG_SIGHUP_ALT) },
- { 0x00000002, MSG_ORIG(MSG_SIGINT_ALT) },
- { 0x00000004, MSG_ORIG(MSG_SIGQUIT_ALT) },
- { 0x00000008, MSG_ORIG(MSG_SIGILL_ALT) },
- { 0x00000010, MSG_ORIG(MSG_SIGTRAP_ALT) },
- { 0x00000020, MSG_ORIG(MSG_SIGABRT_ALT) },
- { 0x00000040, MSG_ORIG(MSG_SIGEMT_ALT) },
- { 0x00000080, MSG_ORIG(MSG_SIGFPE_ALT) },
- { 0x00000100, MSG_ORIG(MSG_SIGKILL_ALT) },
- { 0x00000200, MSG_ORIG(MSG_SIGBUS_ALT) },
- { 0x00000400, MSG_ORIG(MSG_SIGSEGV_ALT) },
- { 0x00000800, MSG_ORIG(MSG_SIGSYS_ALT) },
- { 0x00001000, MSG_ORIG(MSG_SIGPIPE_ALT) },
- { 0x00002000, MSG_ORIG(MSG_SIGALRM_ALT) },
- { 0x00004000, MSG_ORIG(MSG_SIGTERM_ALT) },
- { 0x00008000, MSG_ORIG(MSG_SIGUSR1_ALT) },
- { 0x00010000, MSG_ORIG(MSG_SIGUSR2_ALT) },
- { 0x00020000, MSG_ORIG(MSG_SIGCHLD_ALT) },
- { 0x00040000, MSG_ORIG(MSG_SIGPWR_ALT) },
- { 0x00080000, MSG_ORIG(MSG_SIGWINCH_ALT) },
- { 0x00100000, MSG_ORIG(MSG_SIGURG_ALT) },
- { 0x00200000, MSG_ORIG(MSG_SIGPOLL_ALT) },
- { 0x00400000, MSG_ORIG(MSG_SIGSTOP_ALT) },
- { 0x00800000, MSG_ORIG(MSG_SIGTSTP_ALT) },
- { 0x01000000, MSG_ORIG(MSG_SIGCONT_ALT) },
- { 0x02000000, MSG_ORIG(MSG_SIGTTIN_ALT) },
- { 0x04000000, MSG_ORIG(MSG_SIGTTOU_ALT) },
- { 0x08000000, MSG_ORIG(MSG_SIGVTALRM_ALT) },
- { 0x10000000, MSG_ORIG(MSG_SIGPROF_ALT) },
- { 0x20000000, MSG_ORIG(MSG_SIGXCPU_ALT) },
- { 0x40000000, MSG_ORIG(MSG_SIGXFSZ_ALT) },
- { 0x80000000, MSG_ORIG(MSG_SIGWAITING_ALT) },
+ static const Val_desc vda0[] = {
+ { 0x00000001, MSG_SIGHUP_ALT },
+ { 0x00000002, MSG_SIGINT_ALT },
+ { 0x00000004, MSG_SIGQUIT_ALT },
+ { 0x00000008, MSG_SIGILL_ALT },
+ { 0x00000010, MSG_SIGTRAP_ALT },
+ { 0x00000020, MSG_SIGABRT_ALT },
+ { 0x00000040, MSG_SIGEMT_ALT },
+ { 0x00000080, MSG_SIGFPE_ALT },
+ { 0x00000100, MSG_SIGKILL_ALT },
+ { 0x00000200, MSG_SIGBUS_ALT },
+ { 0x00000400, MSG_SIGSEGV_ALT },
+ { 0x00000800, MSG_SIGSYS_ALT },
+ { 0x00001000, MSG_SIGPIPE_ALT },
+ { 0x00002000, MSG_SIGALRM_ALT },
+ { 0x00004000, MSG_SIGTERM_ALT },
+ { 0x00008000, MSG_SIGUSR1_ALT },
+ { 0x00010000, MSG_SIGUSR2_ALT },
+ { 0x00020000, MSG_SIGCHLD_ALT },
+ { 0x00040000, MSG_SIGPWR_ALT },
+ { 0x00080000, MSG_SIGWINCH_ALT },
+ { 0x00100000, MSG_SIGURG_ALT },
+ { 0x00200000, MSG_SIGPOLL_ALT },
+ { 0x00400000, MSG_SIGSTOP_ALT },
+ { 0x00800000, MSG_SIGTSTP_ALT },
+ { 0x01000000, MSG_SIGCONT_ALT },
+ { 0x02000000, MSG_SIGTTIN_ALT },
+ { 0x04000000, MSG_SIGTTOU_ALT },
+ { 0x08000000, MSG_SIGVTALRM_ALT },
+ { 0x10000000, MSG_SIGPROF_ALT },
+ { 0x20000000, MSG_SIGXCPU_ALT },
+ { 0x40000000, MSG_SIGXFSZ_ALT },
+ { 0x80000000, MSG_SIGWAITING_ALT },
{ 0, 0 }
};
- static Val_desc vda1[] = {
- { 0x00000001, MSG_ORIG(MSG_SIGLWP_ALT) },
- { 0x00000002, MSG_ORIG(MSG_SIGFREEZE_ALT) },
- { 0x00000004, MSG_ORIG(MSG_SIGTHAW_ALT) },
- { 0x00000008, MSG_ORIG(MSG_SIGCANCEL_ALT) },
- { 0x00000010, MSG_ORIG(MSG_SIGLOST_ALT) },
- { 0x00000020, MSG_ORIG(MSG_SIGXRES_ALT) },
- { 0x00000040, MSG_ORIG(MSG_SIGJVM1_ALT) },
- { 0x00000080, MSG_ORIG(MSG_SIGJVM2_ALT) },
+ static const Val_desc vda1[] = {
+ { 0x00000001, MSG_SIGLWP_ALT },
+ { 0x00000002, MSG_SIGFREEZE_ALT },
+ { 0x00000004, MSG_SIGTHAW_ALT },
+ { 0x00000008, MSG_SIGCANCEL_ALT },
+ { 0x00000010, MSG_SIGLOST_ALT },
+ { 0x00000020, MSG_SIGXRES_ALT },
+ { 0x00000040, MSG_SIGJVM1_ALT },
+ { 0x00000080, MSG_SIGJVM2_ALT },
{ 0, 0 }
};
- static conv_bitmaskset_desc_t bitmask_desc[N_MASK] = {
+ static const conv_bitmaskset_desc_t bitmask_desc[N_MASK] = {
{ vda0, 0 },
{ vda1, 0xffffff00 },
{ NULL, 0xffffffff },
@@ -1725,23 +1768,23 @@ conv_cnote_fltset(uint32_t *maskarr, int n_mask,
{
#define N_MASK 4
- static Val_desc vda0[] = {
- { 0x00000001, MSG_ORIG(MSG_FLTILL_ALT) },
- { 0x00000002, MSG_ORIG(MSG_FLTPRIV_ALT) },
- { 0x00000004, MSG_ORIG(MSG_FLTBPT_ALT) },
- { 0x00000008, MSG_ORIG(MSG_FLTTRACE_ALT) },
- { 0x00000010, MSG_ORIG(MSG_FLTACCESS_ALT) },
- { 0x00000020, MSG_ORIG(MSG_FLTBOUNDS_ALT) },
- { 0x00000040, MSG_ORIG(MSG_FLTIOVF_ALT) },
- { 0x00000080, MSG_ORIG(MSG_FLTIZDIV_ALT) },
- { 0x00000100, MSG_ORIG(MSG_FLTFPE_ALT) },
- { 0x00000200, MSG_ORIG(MSG_FLTSTACK_ALT) },
- { 0x00000400, MSG_ORIG(MSG_FLTPAGE_ALT) },
- { 0x00000800, MSG_ORIG(MSG_FLTWATCH_ALT) },
- { 0x00001000, MSG_ORIG(MSG_FLTCPCOVF_ALT) },
+ static const Val_desc vda0[] = {
+ { 0x00000001, MSG_FLTILL_ALT },
+ { 0x00000002, MSG_FLTPRIV_ALT },
+ { 0x00000004, MSG_FLTBPT_ALT },
+ { 0x00000008, MSG_FLTTRACE_ALT },
+ { 0x00000010, MSG_FLTACCESS_ALT },
+ { 0x00000020, MSG_FLTBOUNDS_ALT },
+ { 0x00000040, MSG_FLTIOVF_ALT },
+ { 0x00000080, MSG_FLTIZDIV_ALT },
+ { 0x00000100, MSG_FLTFPE_ALT },
+ { 0x00000200, MSG_FLTSTACK_ALT },
+ { 0x00000400, MSG_FLTPAGE_ALT },
+ { 0x00000800, MSG_FLTWATCH_ALT },
+ { 0x00001000, MSG_FLTCPCOVF_ALT },
{ 0, 0 }
};
- static conv_bitmaskset_desc_t bitmask_desc[N_MASK] = {
+ static const conv_bitmaskset_desc_t bitmask_desc[N_MASK] = {
{ vda0, 0xffffe000 },
{ NULL, 0xffffffff },
{ NULL, 0xffffffff },
@@ -2081,287 +2124,287 @@ conv_cnote_sysset(uint32_t *maskarr, int n_mask,
{
#define N_MASK 16
- static Val_desc vda0[] = { /* System Calls [1 - 32] */
- { 0x00000001, MSG_ORIG(MSG_SYS_EXIT_ALT) },
- { 0x00000002, MSG_ORIG(MSG_SYS_FORKALL_ALT) },
- { 0x00000004, MSG_ORIG(MSG_SYS_READ_ALT) },
- { 0x00000008, MSG_ORIG(MSG_SYS_WRITE_ALT) },
- { 0x00000010, MSG_ORIG(MSG_SYS_OPEN_ALT) },
- { 0x00000020, MSG_ORIG(MSG_SYS_CLOSE_ALT) },
- { 0x00000040, MSG_ORIG(MSG_SYS_WAIT_ALT) },
- { 0x00000080, MSG_ORIG(MSG_SYS_CREAT_ALT) },
- { 0x00000100, MSG_ORIG(MSG_SYS_LINK_ALT) },
- { 0x00000200, MSG_ORIG(MSG_SYS_UNLINK_ALT) },
- { 0x00000400, MSG_ORIG(MSG_SYS_EXEC_ALT) },
- { 0x00000800, MSG_ORIG(MSG_SYS_CHDIR_ALT) },
- { 0x00001000, MSG_ORIG(MSG_SYS_TIME_ALT) },
- { 0x00002000, MSG_ORIG(MSG_SYS_MKNOD_ALT) },
- { 0x00004000, MSG_ORIG(MSG_SYS_CHMOD_ALT) },
- { 0x00008000, MSG_ORIG(MSG_SYS_CHOWN_ALT) },
- { 0x00010000, MSG_ORIG(MSG_SYS_BRK_ALT) },
- { 0x00020000, MSG_ORIG(MSG_SYS_STAT_ALT) },
- { 0x00040000, MSG_ORIG(MSG_SYS_LSEEK_ALT) },
- { 0x00080000, MSG_ORIG(MSG_SYS_GETPID_ALT) },
- { 0x00100000, MSG_ORIG(MSG_SYS_MOUNT_ALT) },
- { 0x00200000, MSG_ORIG(MSG_SYS_UMOUNT_ALT) },
- { 0x00400000, MSG_ORIG(MSG_SYS_SETUID_ALT) },
- { 0x00800000, MSG_ORIG(MSG_SYS_GETUID_ALT) },
- { 0x01000000, MSG_ORIG(MSG_SYS_STIME_ALT) },
- { 0x02000000, MSG_ORIG(MSG_SYS_PCSAMPLE_ALT) },
- { 0x04000000, MSG_ORIG(MSG_SYS_ALARM_ALT) },
- { 0x08000000, MSG_ORIG(MSG_SYS_FSTAT_ALT) },
- { 0x10000000, MSG_ORIG(MSG_SYS_PAUSE_ALT) },
- { 0x20000000, MSG_ORIG(MSG_SYS_UTIME_ALT) },
- { 0x40000000, MSG_ORIG(MSG_SYS_STTY_ALT) },
- { 0x80000000, MSG_ORIG(MSG_SYS_GTTY_ALT) },
+ static const Val_desc vda0[] = { /* System Calls [1 - 32] */
+ { 0x00000001, MSG_SYS_EXIT_ALT },
+ { 0x00000002, MSG_SYS_FORKALL_ALT },
+ { 0x00000004, MSG_SYS_READ_ALT },
+ { 0x00000008, MSG_SYS_WRITE_ALT },
+ { 0x00000010, MSG_SYS_OPEN_ALT },
+ { 0x00000020, MSG_SYS_CLOSE_ALT },
+ { 0x00000040, MSG_SYS_WAIT_ALT },
+ { 0x00000080, MSG_SYS_CREAT_ALT },
+ { 0x00000100, MSG_SYS_LINK_ALT },
+ { 0x00000200, MSG_SYS_UNLINK_ALT },
+ { 0x00000400, MSG_SYS_EXEC_ALT },
+ { 0x00000800, MSG_SYS_CHDIR_ALT },
+ { 0x00001000, MSG_SYS_TIME_ALT },
+ { 0x00002000, MSG_SYS_MKNOD_ALT },
+ { 0x00004000, MSG_SYS_CHMOD_ALT },
+ { 0x00008000, MSG_SYS_CHOWN_ALT },
+ { 0x00010000, MSG_SYS_BRK_ALT },
+ { 0x00020000, MSG_SYS_STAT_ALT },
+ { 0x00040000, MSG_SYS_LSEEK_ALT },
+ { 0x00080000, MSG_SYS_GETPID_ALT },
+ { 0x00100000, MSG_SYS_MOUNT_ALT },
+ { 0x00200000, MSG_SYS_UMOUNT_ALT },
+ { 0x00400000, MSG_SYS_SETUID_ALT },
+ { 0x00800000, MSG_SYS_GETUID_ALT },
+ { 0x01000000, MSG_SYS_STIME_ALT },
+ { 0x02000000, MSG_SYS_PCSAMPLE_ALT },
+ { 0x04000000, MSG_SYS_ALARM_ALT },
+ { 0x08000000, MSG_SYS_FSTAT_ALT },
+ { 0x10000000, MSG_SYS_PAUSE_ALT },
+ { 0x20000000, MSG_SYS_UTIME_ALT },
+ { 0x40000000, MSG_SYS_STTY_ALT },
+ { 0x80000000, MSG_SYS_GTTY_ALT },
{ 0, 0 }
};
- static Val_desc vda1[] = { /* System Calls [33 - 64] */
- { 0x00000001, MSG_ORIG(MSG_SYS_ACCESS_ALT) },
- { 0x00000002, MSG_ORIG(MSG_SYS_NICE_ALT) },
- { 0x00000004, MSG_ORIG(MSG_SYS_STATFS_ALT) },
- { 0x00000008, MSG_ORIG(MSG_SYS_SYNC_ALT) },
- { 0x00000010, MSG_ORIG(MSG_SYS_KILL_ALT) },
- { 0x00000020, MSG_ORIG(MSG_SYS_FSTATFS_ALT) },
- { 0x00000040, MSG_ORIG(MSG_SYS_PGRPSYS_ALT) },
- { 0x00000080, MSG_ORIG(MSG_SYS_UUCOPYSTR_ALT) },
- { 0x00000100, MSG_ORIG(MSG_SYS_DUP_ALT) },
- { 0x00000200, MSG_ORIG(MSG_SYS_PIPE_ALT) },
- { 0x00000400, MSG_ORIG(MSG_SYS_TIMES_ALT) },
- { 0x00000800, MSG_ORIG(MSG_SYS_PROFIL_ALT) },
- { 0x00001000, MSG_ORIG(MSG_SYS_PLOCK_ALT) },
- { 0x00002000, MSG_ORIG(MSG_SYS_SETGID_ALT) },
- { 0x00004000, MSG_ORIG(MSG_SYS_GETGID_ALT) },
- { 0x00008000, MSG_ORIG(MSG_SYS_SIGNAL_ALT) },
- { 0x00010000, MSG_ORIG(MSG_SYS_MSGSYS_ALT) },
- { 0x00020000, MSG_ORIG(MSG_SYS_SYSI86_ALT) },
- { 0x00040000, MSG_ORIG(MSG_SYS_ACCT_ALT) },
- { 0x00080000, MSG_ORIG(MSG_SYS_SHMSYS_ALT) },
- { 0x00100000, MSG_ORIG(MSG_SYS_SEMSYS_ALT) },
- { 0x00200000, MSG_ORIG(MSG_SYS_IOCTL_ALT) },
- { 0x00400000, MSG_ORIG(MSG_SYS_UADMIN_ALT) },
- { 0x00800000, MSG_ORIG(MSG_SYS_56) },
- { 0x01000000, MSG_ORIG(MSG_SYS_UTSSYS_ALT) },
- { 0x0200000, MSG_ORIG(MSG_SYS_FDSYNC_ALT) },
- { 0x04000000, MSG_ORIG(MSG_SYS_EXECVE_ALT) },
- { 0x08000000, MSG_ORIG(MSG_SYS_UMASK_ALT) },
- { 0x10000000, MSG_ORIG(MSG_SYS_CHROOT_ALT) },
- { 0x20000000, MSG_ORIG(MSG_SYS_FCNTL_ALT) },
- { 0x40000000, MSG_ORIG(MSG_SYS_ULIMIT_ALT) },
- { 0x80000000, MSG_ORIG(MSG_SYS_64) },
+ static const Val_desc vda1[] = { /* System Calls [33 - 64] */
+ { 0x00000001, MSG_SYS_ACCESS_ALT },
+ { 0x00000002, MSG_SYS_NICE_ALT },
+ { 0x00000004, MSG_SYS_STATFS_ALT },
+ { 0x00000008, MSG_SYS_SYNC_ALT },
+ { 0x00000010, MSG_SYS_KILL_ALT },
+ { 0x00000020, MSG_SYS_FSTATFS_ALT },
+ { 0x00000040, MSG_SYS_PGRPSYS_ALT },
+ { 0x00000080, MSG_SYS_UUCOPYSTR_ALT },
+ { 0x00000100, MSG_SYS_DUP_ALT },
+ { 0x00000200, MSG_SYS_PIPE_ALT },
+ { 0x00000400, MSG_SYS_TIMES_ALT },
+ { 0x00000800, MSG_SYS_PROFIL_ALT },
+ { 0x00001000, MSG_SYS_PLOCK_ALT },
+ { 0x00002000, MSG_SYS_SETGID_ALT },
+ { 0x00004000, MSG_SYS_GETGID_ALT },
+ { 0x00008000, MSG_SYS_SIGNAL_ALT },
+ { 0x00010000, MSG_SYS_MSGSYS_ALT },
+ { 0x00020000, MSG_SYS_SYSI86_ALT },
+ { 0x00040000, MSG_SYS_ACCT_ALT },
+ { 0x00080000, MSG_SYS_SHMSYS_ALT },
+ { 0x00100000, MSG_SYS_SEMSYS_ALT },
+ { 0x00200000, MSG_SYS_IOCTL_ALT },
+ { 0x00400000, MSG_SYS_UADMIN_ALT },
+ { 0x00800000, MSG_SYS_56 },
+ { 0x01000000, MSG_SYS_UTSSYS_ALT },
+ { 0x0200000, MSG_SYS_FDSYNC_ALT },
+ { 0x04000000, MSG_SYS_EXECVE_ALT },
+ { 0x08000000, MSG_SYS_UMASK_ALT },
+ { 0x10000000, MSG_SYS_CHROOT_ALT },
+ { 0x20000000, MSG_SYS_FCNTL_ALT },
+ { 0x40000000, MSG_SYS_ULIMIT_ALT },
+ { 0x80000000, MSG_SYS_64 },
{ 0, 0 }
};
- static Val_desc vda2[] = { /* System Calls [65 - 96] */
- { 0x00000001, MSG_ORIG(MSG_SYS_65) },
- { 0x00000002, MSG_ORIG(MSG_SYS_66) },
- { 0x00000004, MSG_ORIG(MSG_SYS_67) },
- { 0x00000008, MSG_ORIG(MSG_SYS_68) },
- { 0x00000010, MSG_ORIG(MSG_SYS_69) },
- { 0x00000020, MSG_ORIG(MSG_SYS_TASKSYS_ALT) },
- { 0x00000040, MSG_ORIG(MSG_SYS_ACCTCTL_ALT) },
- { 0x00000080, MSG_ORIG(MSG_SYS_EXACCTSYS_ALT) },
- { 0x00000100, MSG_ORIG(MSG_SYS_GETPAGESIZES_ALT) },
- { 0x00000200, MSG_ORIG(MSG_SYS_RCTLSYS_ALT) },
- { 0x00000400, MSG_ORIG(MSG_SYS_SIDSYS_ALT) },
- { 0x00000800, MSG_ORIG(MSG_SYS_FSAT_ALT) },
- { 0x00001000, MSG_ORIG(MSG_SYS_LWP_PARK_ALT) },
- { 0x00002000, MSG_ORIG(MSG_SYS_SENDFILEV_ALT) },
- { 0x00004000, MSG_ORIG(MSG_SYS_RMDIR_ALT) },
- { 0x00008000, MSG_ORIG(MSG_SYS_MKDIR_ALT) },
- { 0x00010000, MSG_ORIG(MSG_SYS_GETDENTS_ALT) },
- { 0x00020000, MSG_ORIG(MSG_SYS_PRIVSYS_ALT) },
- { 0x00040000, MSG_ORIG(MSG_SYS_UCREDSYS_ALT) },
- { 0x00080000, MSG_ORIG(MSG_SYS_SYSFS_ALT) },
- { 0x00100000, MSG_ORIG(MSG_SYS_GETMSG_ALT) },
- { 0x00200000, MSG_ORIG(MSG_SYS_PUTMSG_ALT) },
- { 0x00400000, MSG_ORIG(MSG_SYS_POLL_ALT) },
- { 0x00800000, MSG_ORIG(MSG_SYS_LSTAT_ALT) },
- { 0x01000000, MSG_ORIG(MSG_SYS_SYMLINK_ALT) },
- { 0x02000000, MSG_ORIG(MSG_SYS_READLINK_ALT) },
- { 0x04000000, MSG_ORIG(MSG_SYS_SETGROUPS_ALT) },
- { 0x08000000, MSG_ORIG(MSG_SYS_GETGROUPS_ALT) },
- { 0x10000000, MSG_ORIG(MSG_SYS_FCHMOD_ALT) },
- { 0x20000000, MSG_ORIG(MSG_SYS_FCHOWN_ALT) },
- { 0x40000000, MSG_ORIG(MSG_SYS_SIGPROCMASK_ALT) },
- { 0x80000000, MSG_ORIG(MSG_SYS_SIGSUSPEND_ALT) },
+ static const Val_desc vda2[] = { /* System Calls [65 - 96] */
+ { 0x00000001, MSG_SYS_65 },
+ { 0x00000002, MSG_SYS_66 },
+ { 0x00000004, MSG_SYS_67 },
+ { 0x00000008, MSG_SYS_68 },
+ { 0x00000010, MSG_SYS_69 },
+ { 0x00000020, MSG_SYS_TASKSYS_ALT },
+ { 0x00000040, MSG_SYS_ACCTCTL_ALT },
+ { 0x00000080, MSG_SYS_EXACCTSYS_ALT },
+ { 0x00000100, MSG_SYS_GETPAGESIZES_ALT },
+ { 0x00000200, MSG_SYS_RCTLSYS_ALT },
+ { 0x00000400, MSG_SYS_SIDSYS_ALT },
+ { 0x00000800, MSG_SYS_FSAT_ALT },
+ { 0x00001000, MSG_SYS_LWP_PARK_ALT },
+ { 0x00002000, MSG_SYS_SENDFILEV_ALT },
+ { 0x00004000, MSG_SYS_RMDIR_ALT },
+ { 0x00008000, MSG_SYS_MKDIR_ALT },
+ { 0x00010000, MSG_SYS_GETDENTS_ALT },
+ { 0x00020000, MSG_SYS_PRIVSYS_ALT },
+ { 0x00040000, MSG_SYS_UCREDSYS_ALT },
+ { 0x00080000, MSG_SYS_SYSFS_ALT },
+ { 0x00100000, MSG_SYS_GETMSG_ALT },
+ { 0x00200000, MSG_SYS_PUTMSG_ALT },
+ { 0x00400000, MSG_SYS_POLL_ALT },
+ { 0x00800000, MSG_SYS_LSTAT_ALT },
+ { 0x01000000, MSG_SYS_SYMLINK_ALT },
+ { 0x02000000, MSG_SYS_READLINK_ALT },
+ { 0x04000000, MSG_SYS_SETGROUPS_ALT },
+ { 0x08000000, MSG_SYS_GETGROUPS_ALT },
+ { 0x10000000, MSG_SYS_FCHMOD_ALT },
+ { 0x20000000, MSG_SYS_FCHOWN_ALT },
+ { 0x40000000, MSG_SYS_SIGPROCMASK_ALT },
+ { 0x80000000, MSG_SYS_SIGSUSPEND_ALT },
{ 0, 0 }
};
- static Val_desc vda3[] = { /* System Calls [97 - 128] */
- { 0x00000001, MSG_ORIG(MSG_SYS_SIGALTSTACK_ALT) },
- { 0x00000002, MSG_ORIG(MSG_SYS_SIGACTION_ALT) },
- { 0x00000004, MSG_ORIG(MSG_SYS_SIGPENDING_ALT) },
- { 0x00000008, MSG_ORIG(MSG_SYS_CONTEXT_ALT) },
- { 0x00000010, MSG_ORIG(MSG_SYS_EVSYS_ALT) },
- { 0x00000020, MSG_ORIG(MSG_SYS_EVTRAPRET_ALT) },
- { 0x00000040, MSG_ORIG(MSG_SYS_STATVFS_ALT) },
- { 0x00000080, MSG_ORIG(MSG_SYS_FSTATVFS_ALT) },
- { 0x00000100, MSG_ORIG(MSG_SYS_GETLOADAVG_ALT) },
- { 0x00000200, MSG_ORIG(MSG_SYS_NFSSYS_ALT) },
- { 0x00000400, MSG_ORIG(MSG_SYS_WAITID_ALT) },
- { 0x00000800, MSG_ORIG(MSG_SYS_SIGSENDSYS_ALT) },
- { 0x00001000, MSG_ORIG(MSG_SYS_HRTSYS_ALT) },
- { 0x00002000, MSG_ORIG(MSG_SYS_110) },
- { 0x00004000, MSG_ORIG(MSG_SYS_SIGRESEND_ALT) },
- { 0x00008000, MSG_ORIG(MSG_SYS_PRIOCNTLSYS_ALT) },
- { 0x00010000, MSG_ORIG(MSG_SYS_PATHCONF_ALT) },
- { 0x00020000, MSG_ORIG(MSG_SYS_MINCORE_ALT) },
- { 0x00040000, MSG_ORIG(MSG_SYS_MMAP_ALT) },
- { 0x00080000, MSG_ORIG(MSG_SYS_MPROTECT_ALT) },
- { 0x00100000, MSG_ORIG(MSG_SYS_MUNMAP_ALT) },
- { 0x00200000, MSG_ORIG(MSG_SYS_FPATHCONF_ALT) },
- { 0x00400000, MSG_ORIG(MSG_SYS_VFORK_ALT) },
- { 0x00800000, MSG_ORIG(MSG_SYS_FCHDIR_ALT) },
- { 0x01000000, MSG_ORIG(MSG_SYS_READV_ALT) },
- { 0x02000000, MSG_ORIG(MSG_SYS_WRITEV_ALT) },
- { 0x04000000, MSG_ORIG(MSG_SYS_XSTAT_ALT) },
- { 0x08000000, MSG_ORIG(MSG_SYS_LXSTAT_ALT) },
- { 0x10000000, MSG_ORIG(MSG_SYS_FXSTAT_ALT) },
- { 0x20000000, MSG_ORIG(MSG_SYS_XMKNOD_ALT) },
- { 0x40000000, MSG_ORIG(MSG_SYS_127) },
- { 0x80000000, MSG_ORIG(MSG_SYS_SETRLIMIT_ALT) },
+ static const Val_desc vda3[] = { /* System Calls [97 - 128] */
+ { 0x00000001, MSG_SYS_SIGALTSTACK_ALT },
+ { 0x00000002, MSG_SYS_SIGACTION_ALT },
+ { 0x00000004, MSG_SYS_SIGPENDING_ALT },
+ { 0x00000008, MSG_SYS_CONTEXT_ALT },
+ { 0x00000010, MSG_SYS_EVSYS_ALT },
+ { 0x00000020, MSG_SYS_EVTRAPRET_ALT },
+ { 0x00000040, MSG_SYS_STATVFS_ALT },
+ { 0x00000080, MSG_SYS_FSTATVFS_ALT },
+ { 0x00000100, MSG_SYS_GETLOADAVG_ALT },
+ { 0x00000200, MSG_SYS_NFSSYS_ALT },
+ { 0x00000400, MSG_SYS_WAITID_ALT },
+ { 0x00000800, MSG_SYS_SIGSENDSYS_ALT },
+ { 0x00001000, MSG_SYS_HRTSYS_ALT },
+ { 0x00002000, MSG_SYS_110 },
+ { 0x00004000, MSG_SYS_SIGRESEND_ALT },
+ { 0x00008000, MSG_SYS_PRIOCNTLSYS_ALT },
+ { 0x00010000, MSG_SYS_PATHCONF_ALT },
+ { 0x00020000, MSG_SYS_MINCORE_ALT },
+ { 0x00040000, MSG_SYS_MMAP_ALT },
+ { 0x00080000, MSG_SYS_MPROTECT_ALT },
+ { 0x00100000, MSG_SYS_MUNMAP_ALT },
+ { 0x00200000, MSG_SYS_FPATHCONF_ALT },
+ { 0x00400000, MSG_SYS_VFORK_ALT },
+ { 0x00800000, MSG_SYS_FCHDIR_ALT },
+ { 0x01000000, MSG_SYS_READV_ALT },
+ { 0x02000000, MSG_SYS_WRITEV_ALT },
+ { 0x04000000, MSG_SYS_XSTAT_ALT },
+ { 0x08000000, MSG_SYS_LXSTAT_ALT },
+ { 0x10000000, MSG_SYS_FXSTAT_ALT },
+ { 0x20000000, MSG_SYS_XMKNOD_ALT },
+ { 0x40000000, MSG_SYS_127 },
+ { 0x80000000, MSG_SYS_SETRLIMIT_ALT },
{ 0, 0 }
};
- static Val_desc vda4[] = { /* System Calls [129 - 160] */
- { 0x00000001, MSG_ORIG(MSG_SYS_GETRLIMIT_ALT) },
- { 0x00000002, MSG_ORIG(MSG_SYS_LCHOWN_ALT) },
- { 0x00000004, MSG_ORIG(MSG_SYS_MEMCNTL_ALT) },
- { 0x00000008, MSG_ORIG(MSG_SYS_GETPMSG_ALT) },
- { 0x00000010, MSG_ORIG(MSG_SYS_PUTPMSG_ALT) },
- { 0x00000020, MSG_ORIG(MSG_SYS_RENAME_ALT) },
- { 0x00000040, MSG_ORIG(MSG_SYS_UNAME_ALT) },
- { 0x00000080, MSG_ORIG(MSG_SYS_SETEGID_ALT) },
- { 0x00000100, MSG_ORIG(MSG_SYS_SYSCONFIG_ALT) },
- { 0x00000200, MSG_ORIG(MSG_SYS_ADJTIME_ALT) },
- { 0x00000400, MSG_ORIG(MSG_SYS_SYSTEMINFO_ALT) },
- { 0x00000800, MSG_ORIG(MSG_SYS_SHAREFS_ALT) },
- { 0x00001000, MSG_ORIG(MSG_SYS_SETEUID_ALT) },
- { 0x00002000, MSG_ORIG(MSG_SYS_FORKSYS_ALT) },
- { 0x00004000, MSG_ORIG(MSG_SYS_FORK1_ALT) },
- { 0x00008000, MSG_ORIG(MSG_SYS_SIGTIMEDWAIT_ALT) },
- { 0x00010000, MSG_ORIG(MSG_SYS_LWP_INFO_ALT) },
- { 0x00020000, MSG_ORIG(MSG_SYS_YIELD_ALT) },
- { 0x00040000, MSG_ORIG(MSG_SYS_LWP_SEMA_WAIT_ALT) },
- { 0x00080000, MSG_ORIG(MSG_SYS_LWP_SEMA_POST_ALT) },
- { 0x00100000, MSG_ORIG(MSG_SYS_LWP_SEMA_TRYWAIT_ALT) },
- { 0x00200000, MSG_ORIG(MSG_SYS_LWP_DETACH_ALT) },
- { 0x00400000, MSG_ORIG(MSG_SYS_CORECTL_ALT) },
- { 0x00800000, MSG_ORIG(MSG_SYS_MODCTL_ALT) },
- { 0x01000000, MSG_ORIG(MSG_SYS_FCHROOT_ALT) },
- { 0x02000000, MSG_ORIG(MSG_SYS_UTIMES_ALT) },
- { 0x04000000, MSG_ORIG(MSG_SYS_VHANGUP_ALT) },
- { 0x08000000, MSG_ORIG(MSG_SYS_GETTIMEOFDAY_ALT) },
- { 0x10000000, MSG_ORIG(MSG_SYS_GETITIMER_ALT) },
- { 0x20000000, MSG_ORIG(MSG_SYS_SETITIMER_ALT) },
- { 0x40000000, MSG_ORIG(MSG_SYS_LWP_CREATE_ALT) },
- { 0x80000000, MSG_ORIG(MSG_SYS_LWP_EXIT_ALT) },
+ static const Val_desc vda4[] = { /* System Calls [129 - 160] */
+ { 0x00000001, MSG_SYS_GETRLIMIT_ALT },
+ { 0x00000002, MSG_SYS_LCHOWN_ALT },
+ { 0x00000004, MSG_SYS_MEMCNTL_ALT },
+ { 0x00000008, MSG_SYS_GETPMSG_ALT },
+ { 0x00000010, MSG_SYS_PUTPMSG_ALT },
+ { 0x00000020, MSG_SYS_RENAME_ALT },
+ { 0x00000040, MSG_SYS_UNAME_ALT },
+ { 0x00000080, MSG_SYS_SETEGID_ALT },
+ { 0x00000100, MSG_SYS_SYSCONFIG_ALT },
+ { 0x00000200, MSG_SYS_ADJTIME_ALT },
+ { 0x00000400, MSG_SYS_SYSTEMINFO_ALT },
+ { 0x00000800, MSG_SYS_SHAREFS_ALT },
+ { 0x00001000, MSG_SYS_SETEUID_ALT },
+ { 0x00002000, MSG_SYS_FORKSYS_ALT },
+ { 0x00004000, MSG_SYS_FORK1_ALT },
+ { 0x00008000, MSG_SYS_SIGTIMEDWAIT_ALT },
+ { 0x00010000, MSG_SYS_LWP_INFO_ALT },
+ { 0x00020000, MSG_SYS_YIELD_ALT },
+ { 0x00040000, MSG_SYS_LWP_SEMA_WAIT_ALT },
+ { 0x00080000, MSG_SYS_LWP_SEMA_POST_ALT },
+ { 0x00100000, MSG_SYS_LWP_SEMA_TRYWAIT_ALT },
+ { 0x00200000, MSG_SYS_LWP_DETACH_ALT },
+ { 0x00400000, MSG_SYS_CORECTL_ALT },
+ { 0x00800000, MSG_SYS_MODCTL_ALT },
+ { 0x01000000, MSG_SYS_FCHROOT_ALT },
+ { 0x02000000, MSG_SYS_UTIMES_ALT },
+ { 0x04000000, MSG_SYS_VHANGUP_ALT },
+ { 0x08000000, MSG_SYS_GETTIMEOFDAY_ALT },
+ { 0x10000000, MSG_SYS_GETITIMER_ALT },
+ { 0x20000000, MSG_SYS_SETITIMER_ALT },
+ { 0x40000000, MSG_SYS_LWP_CREATE_ALT },
+ { 0x80000000, MSG_SYS_LWP_EXIT_ALT },
{ 0, 0 }
};
- static Val_desc vda5[] = { /* System Calls [161 - 192] */
- { 0x00000001, MSG_ORIG(MSG_SYS_LWP_SUSPEND_ALT) },
- { 0x00000002, MSG_ORIG(MSG_SYS_LWP_CONTINUE_ALT) },
- { 0x00000004, MSG_ORIG(MSG_SYS_LWP_KILL_ALT) },
- { 0x00000008, MSG_ORIG(MSG_SYS_LWP_SELF_ALT) },
- { 0x00000010, MSG_ORIG(MSG_SYS_LWP_SIGMASK_ALT) },
- { 0x00000020, MSG_ORIG(MSG_SYS_LWP_PRIVATE_ALT) },
- { 0x00000040, MSG_ORIG(MSG_SYS_LWP_WAIT_ALT) },
- { 0x00000080, MSG_ORIG(MSG_SYS_LWP_MUTEX_WAKEUP_ALT) },
- { 0x00000100, MSG_ORIG(MSG_SYS_LWP_MUTEX_LOCK_ALT) },
- { 0x00000200, MSG_ORIG(MSG_SYS_LWP_COND_WAIT_ALT) },
- { 0x00000400, MSG_ORIG(MSG_SYS_LWP_COND_SIGNAL_ALT) },
- { 0x00000800, MSG_ORIG(MSG_SYS_LWP_COND_BROADCAST_ALT) },
- { 0x00001000, MSG_ORIG(MSG_SYS_PREAD_ALT) },
- { 0x00002000, MSG_ORIG(MSG_SYS_PWRITE_ALT) },
- { 0x00004000, MSG_ORIG(MSG_SYS_LLSEEK_ALT) },
- { 0x00008000, MSG_ORIG(MSG_SYS_INST_SYNC_ALT) },
- { 0x00010000, MSG_ORIG(MSG_SYS_BRAND_ALT) },
- { 0x00020000, MSG_ORIG(MSG_SYS_KAIO_ALT) },
- { 0x00040000, MSG_ORIG(MSG_SYS_CPC_ALT) },
- { 0x00080000, MSG_ORIG(MSG_SYS_LGRPSYS_ALT) },
- { 0x00100000, MSG_ORIG(MSG_SYS_RUSAGESYS_ALT) },
- { 0x00200000, MSG_ORIG(MSG_SYS_PORT_ALT) },
- { 0x00400000, MSG_ORIG(MSG_SYS_POLLSYS_ALT) },
- { 0x00800000, MSG_ORIG(MSG_SYS_LABELSYS_ALT) },
- { 0x01000000, MSG_ORIG(MSG_SYS_ACL_ALT) },
- { 0x02000000, MSG_ORIG(MSG_SYS_AUDITSYS_ALT) },
- { 0x04000000, MSG_ORIG(MSG_SYS_PROCESSOR_BIND_ALT) },
- { 0x08000000, MSG_ORIG(MSG_SYS_PROCESSOR_INFO_ALT) },
- { 0x10000000, MSG_ORIG(MSG_SYS_P_ONLINE_ALT) },
- { 0x20000000, MSG_ORIG(MSG_SYS_SIGQUEUE_ALT) },
- { 0x40000000, MSG_ORIG(MSG_SYS_CLOCK_GETTIME_ALT) },
- { 0x80000000, MSG_ORIG(MSG_SYS_CLOCK_SETTIME_ALT) },
+ static const Val_desc vda5[] = { /* System Calls [161 - 192] */
+ { 0x00000001, MSG_SYS_LWP_SUSPEND_ALT },
+ { 0x00000002, MSG_SYS_LWP_CONTINUE_ALT },
+ { 0x00000004, MSG_SYS_LWP_KILL_ALT },
+ { 0x00000008, MSG_SYS_LWP_SELF_ALT },
+ { 0x00000010, MSG_SYS_LWP_SIGMASK_ALT },
+ { 0x00000020, MSG_SYS_LWP_PRIVATE_ALT },
+ { 0x00000040, MSG_SYS_LWP_WAIT_ALT },
+ { 0x00000080, MSG_SYS_LWP_MUTEX_WAKEUP_ALT },
+ { 0x00000100, MSG_SYS_LWP_MUTEX_LOCK_ALT },
+ { 0x00000200, MSG_SYS_LWP_COND_WAIT_ALT },
+ { 0x00000400, MSG_SYS_LWP_COND_SIGNAL_ALT },
+ { 0x00000800, MSG_SYS_LWP_COND_BROADCAST_ALT },
+ { 0x00001000, MSG_SYS_PREAD_ALT },
+ { 0x00002000, MSG_SYS_PWRITE_ALT },
+ { 0x00004000, MSG_SYS_LLSEEK_ALT },
+ { 0x00008000, MSG_SYS_INST_SYNC_ALT },
+ { 0x00010000, MSG_SYS_BRAND_ALT },
+ { 0x00020000, MSG_SYS_KAIO_ALT },
+ { 0x00040000, MSG_SYS_CPC_ALT },
+ { 0x00080000, MSG_SYS_LGRPSYS_ALT },
+ { 0x00100000, MSG_SYS_RUSAGESYS_ALT },
+ { 0x00200000, MSG_SYS_PORT_ALT },
+ { 0x00400000, MSG_SYS_POLLSYS_ALT },
+ { 0x00800000, MSG_SYS_LABELSYS_ALT },
+ { 0x01000000, MSG_SYS_ACL_ALT },
+ { 0x02000000, MSG_SYS_AUDITSYS_ALT },
+ { 0x04000000, MSG_SYS_PROCESSOR_BIND_ALT },
+ { 0x08000000, MSG_SYS_PROCESSOR_INFO_ALT },
+ { 0x10000000, MSG_SYS_P_ONLINE_ALT },
+ { 0x20000000, MSG_SYS_SIGQUEUE_ALT },
+ { 0x40000000, MSG_SYS_CLOCK_GETTIME_ALT },
+ { 0x80000000, MSG_SYS_CLOCK_SETTIME_ALT },
{ 0, 0 }
};
- static Val_desc vda6[] = { /* System Calls [193 - 224] */
- { 0x00000001, MSG_ORIG(MSG_SYS_CLOCK_GETRES_ALT) },
- { 0x00000002, MSG_ORIG(MSG_SYS_TIMER_CREATE_ALT) },
- { 0x00000004, MSG_ORIG(MSG_SYS_TIMER_DELETE_ALT) },
- { 0x00000008, MSG_ORIG(MSG_SYS_TIMER_SETTIME_ALT) },
- { 0x00000010, MSG_ORIG(MSG_SYS_TIMER_GETTIME_ALT) },
- { 0x00000020, MSG_ORIG(MSG_SYS_TIMER_GETOVERRUN_ALT) },
- { 0x00000040, MSG_ORIG(MSG_SYS_NANOSLEEP_ALT) },
- { 0x00000080, MSG_ORIG(MSG_SYS_FACL_ALT) },
- { 0x00000100, MSG_ORIG(MSG_SYS_DOOR_ALT) },
- { 0x00000200, MSG_ORIG(MSG_SYS_SETREUID_ALT) },
- { 0x00000400, MSG_ORIG(MSG_SYS_SETREGID_ALT) },
- { 0x00000800, MSG_ORIG(MSG_SYS_INSTALL_UTRAP_ALT) },
- { 0x00001000, MSG_ORIG(MSG_SYS_SIGNOTIFY_ALT) },
- { 0x00002000, MSG_ORIG(MSG_SYS_SCHEDCTL_ALT) },
- { 0x00004000, MSG_ORIG(MSG_SYS_PSET_ALT) },
- { 0x00008000, MSG_ORIG(MSG_SYS_SPARC_UTRAP_INSTALL_ALT) },
- { 0x00010000, MSG_ORIG(MSG_SYS_RESOLVEPATH_ALT) },
- { 0x00020000, MSG_ORIG(MSG_SYS_LWP_MUTEX_TIMEDLOCK_ALT) },
- { 0x00040000, MSG_ORIG(MSG_SYS_LWP_SEMA_TIMEDWAIT_ALT) },
- { 0x00080000, MSG_ORIG(MSG_SYS_LWP_RWLOCK_SYS_ALT) },
- { 0x00100000, MSG_ORIG(MSG_SYS_GETDENTS64_ALT) },
- { 0x00200000, MSG_ORIG(MSG_SYS_MMAP64_ALT) },
- { 0x00400000, MSG_ORIG(MSG_SYS_STAT64_ALT) },
- { 0x00800000, MSG_ORIG(MSG_SYS_LSTAT64_ALT) },
- { 0x01000000, MSG_ORIG(MSG_SYS_FSTAT64_ALT) },
- { 0x02000000, MSG_ORIG(MSG_SYS_STATVFS64_ALT) },
- { 0x04000000, MSG_ORIG(MSG_SYS_FSTATVFS64_ALT) },
- { 0x08000000, MSG_ORIG(MSG_SYS_SETRLIMIT64_ALT) },
- { 0x10000000, MSG_ORIG(MSG_SYS_GETRLIMIT64_ALT) },
- { 0x20000000, MSG_ORIG(MSG_SYS_PREAD64_ALT) },
- { 0x40000000, MSG_ORIG(MSG_SYS_PWRITE64_ALT) },
- { 0x80000000, MSG_ORIG(MSG_SYS_CREAT64_ALT) },
+ static const Val_desc vda6[] = { /* System Calls [193 - 224] */
+ { 0x00000001, MSG_SYS_CLOCK_GETRES_ALT },
+ { 0x00000002, MSG_SYS_TIMER_CREATE_ALT },
+ { 0x00000004, MSG_SYS_TIMER_DELETE_ALT },
+ { 0x00000008, MSG_SYS_TIMER_SETTIME_ALT },
+ { 0x00000010, MSG_SYS_TIMER_GETTIME_ALT },
+ { 0x00000020, MSG_SYS_TIMER_GETOVERRUN_ALT },
+ { 0x00000040, MSG_SYS_NANOSLEEP_ALT },
+ { 0x00000080, MSG_SYS_FACL_ALT },
+ { 0x00000100, MSG_SYS_DOOR_ALT },
+ { 0x00000200, MSG_SYS_SETREUID_ALT },
+ { 0x00000400, MSG_SYS_SETREGID_ALT },
+ { 0x00000800, MSG_SYS_INSTALL_UTRAP_ALT },
+ { 0x00001000, MSG_SYS_SIGNOTIFY_ALT },
+ { 0x00002000, MSG_SYS_SCHEDCTL_ALT },
+ { 0x00004000, MSG_SYS_PSET_ALT },
+ { 0x00008000, MSG_SYS_SPARC_UTRAP_INSTALL_ALT },
+ { 0x00010000, MSG_SYS_RESOLVEPATH_ALT },
+ { 0x00020000, MSG_SYS_LWP_MUTEX_TIMEDLOCK_ALT },
+ { 0x00040000, MSG_SYS_LWP_SEMA_TIMEDWAIT_ALT },
+ { 0x00080000, MSG_SYS_LWP_RWLOCK_SYS_ALT },
+ { 0x00100000, MSG_SYS_GETDENTS64_ALT },
+ { 0x00200000, MSG_SYS_MMAP64_ALT },
+ { 0x00400000, MSG_SYS_STAT64_ALT },
+ { 0x00800000, MSG_SYS_LSTAT64_ALT },
+ { 0x01000000, MSG_SYS_FSTAT64_ALT },
+ { 0x02000000, MSG_SYS_STATVFS64_ALT },
+ { 0x04000000, MSG_SYS_FSTATVFS64_ALT },
+ { 0x08000000, MSG_SYS_SETRLIMIT64_ALT },
+ { 0x10000000, MSG_SYS_GETRLIMIT64_ALT },
+ { 0x20000000, MSG_SYS_PREAD64_ALT },
+ { 0x40000000, MSG_SYS_PWRITE64_ALT },
+ { 0x80000000, MSG_SYS_CREAT64_ALT },
{ 0, 0 }
};
- static Val_desc vda7[] = { /* System Calls [225 - 256] */
- { 0x00000001, MSG_ORIG(MSG_SYS_OPEN64_ALT) },
- { 0x00000002, MSG_ORIG(MSG_SYS_RPCSYS_ALT) },
- { 0x00000004, MSG_ORIG(MSG_SYS_ZONE_ALT) },
- { 0x00000008, MSG_ORIG(MSG_SYS_AUTOFSSYS_ALT) },
- { 0x00000010, MSG_ORIG(MSG_SYS_GETCWD_ALT) },
- { 0x00000020, MSG_ORIG(MSG_SYS_SO_SOCKET_ALT) },
- { 0x00000040, MSG_ORIG(MSG_SYS_SO_SOCKETPAIR_ALT) },
- { 0x00000080, MSG_ORIG(MSG_SYS_BIND_ALT) },
- { 0x00000100, MSG_ORIG(MSG_SYS_LISTEN_ALT) },
- { 0x00000200, MSG_ORIG(MSG_SYS_ACCEPT_ALT) },
- { 0x00000400, MSG_ORIG(MSG_SYS_CONNECT_ALT) },
- { 0x00000800, MSG_ORIG(MSG_SYS_SHUTDOWN_ALT) },
- { 0x00001000, MSG_ORIG(MSG_SYS_RECV_ALT) },
- { 0x00002000, MSG_ORIG(MSG_SYS_RECVFROM_ALT) },
- { 0x00004000, MSG_ORIG(MSG_SYS_RECVMSG_ALT) },
- { 0x00008000, MSG_ORIG(MSG_SYS_SEND_ALT) },
- { 0x00010000, MSG_ORIG(MSG_SYS_SENDMSG_ALT) },
- { 0x00020000, MSG_ORIG(MSG_SYS_SENDTO_ALT) },
- { 0x00040000, MSG_ORIG(MSG_SYS_GETPEERNAME_ALT) },
- { 0x00080000, MSG_ORIG(MSG_SYS_GETSOCKNAME_ALT) },
- { 0x00100000, MSG_ORIG(MSG_SYS_GETSOCKOPT_ALT) },
- { 0x00200000, MSG_ORIG(MSG_SYS_SETSOCKOPT_ALT) },
- { 0x00400000, MSG_ORIG(MSG_SYS_SOCKCONFIG_ALT) },
- { 0x00800000, MSG_ORIG(MSG_SYS_NTP_GETTIME_ALT) },
- { 0x01000000, MSG_ORIG(MSG_SYS_NTP_ADJTIME_ALT) },
- { 0x02000000, MSG_ORIG(MSG_SYS_LWP_MUTEX_UNLOCK_ALT) },
- { 0x04000000, MSG_ORIG(MSG_SYS_LWP_MUTEX_TRYLOCK_ALT) },
- { 0x08000000, MSG_ORIG(MSG_SYS_LWP_MUTEX_REGISTER_ALT) },
- { 0x10000000, MSG_ORIG(MSG_SYS_CLADM_ALT) },
- { 0x20000000, MSG_ORIG(MSG_SYS_UUCOPY_ALT) },
- { 0x40000000, MSG_ORIG(MSG_SYS_UMOUNT2_ALT) },
+ static const Val_desc vda7[] = { /* System Calls [225 - 256] */
+ { 0x00000001, MSG_SYS_OPEN64_ALT },
+ { 0x00000002, MSG_SYS_RPCSYS_ALT },
+ { 0x00000004, MSG_SYS_ZONE_ALT },
+ { 0x00000008, MSG_SYS_AUTOFSSYS_ALT },
+ { 0x00000010, MSG_SYS_GETCWD_ALT },
+ { 0x00000020, MSG_SYS_SO_SOCKET_ALT },
+ { 0x00000040, MSG_SYS_SO_SOCKETPAIR_ALT },
+ { 0x00000080, MSG_SYS_BIND_ALT },
+ { 0x00000100, MSG_SYS_LISTEN_ALT },
+ { 0x00000200, MSG_SYS_ACCEPT_ALT },
+ { 0x00000400, MSG_SYS_CONNECT_ALT },
+ { 0x00000800, MSG_SYS_SHUTDOWN_ALT },
+ { 0x00001000, MSG_SYS_RECV_ALT },
+ { 0x00002000, MSG_SYS_RECVFROM_ALT },
+ { 0x00004000, MSG_SYS_RECVMSG_ALT },
+ { 0x00008000, MSG_SYS_SEND_ALT },
+ { 0x00010000, MSG_SYS_SENDMSG_ALT },
+ { 0x00020000, MSG_SYS_SENDTO_ALT },
+ { 0x00040000, MSG_SYS_GETPEERNAME_ALT },
+ { 0x00080000, MSG_SYS_GETSOCKNAME_ALT },
+ { 0x00100000, MSG_SYS_GETSOCKOPT_ALT },
+ { 0x00200000, MSG_SYS_SETSOCKOPT_ALT },
+ { 0x00400000, MSG_SYS_SOCKCONFIG_ALT },
+ { 0x00800000, MSG_SYS_NTP_GETTIME_ALT },
+ { 0x01000000, MSG_SYS_NTP_ADJTIME_ALT },
+ { 0x02000000, MSG_SYS_LWP_MUTEX_UNLOCK_ALT },
+ { 0x04000000, MSG_SYS_LWP_MUTEX_TRYLOCK_ALT },
+ { 0x08000000, MSG_SYS_LWP_MUTEX_REGISTER_ALT },
+ { 0x10000000, MSG_SYS_CLADM_ALT },
+ { 0x20000000, MSG_SYS_UUCOPY_ALT },
+ { 0x40000000, MSG_SYS_UMOUNT2_ALT },
/* 256 (unused) */
{ 0, 0 }
};
- static conv_bitmaskset_desc_t bitmask_desc[N_MASK] = {
+ static const conv_bitmaskset_desc_t bitmask_desc[N_MASK] = {
{ vda0, 0x00000000 },
{ vda1, 0x00000000 },
{ vda2, 0x00000000 },
diff --git a/usr/src/cmd/sgs/libconv/common/dl.c b/usr/src/cmd/sgs/libconv/common/dl.c
index 7067ea4772..b72d4f8bf7 100644
--- a/usr/src/cmd/sgs/libconv/common/dl.c
+++ b/usr/src/cmd/sgs/libconv/common/dl.c
@@ -20,7 +20,7 @@
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -62,19 +62,19 @@
const char *
conv_dl_mode(int mode, int fabricate, Conv_dl_mode_buf_t *dl_mode_buf)
{
- static Val_desc vda[] = {
- { RTLD_NOLOAD, MSG_ORIG(MSG_RTLD_NOLOAD) },
- { RTLD_PARENT, MSG_ORIG(MSG_RTLD_PARENT) },
- { RTLD_GROUP, MSG_ORIG(MSG_RTLD_GROUP) },
- { RTLD_WORLD, MSG_ORIG(MSG_RTLD_WORLD) },
- { RTLD_NODELETE, MSG_ORIG(MSG_RTLD_NODELETE) },
- { RTLD_FIRST, MSG_ORIG(MSG_RTLD_FIRST) },
- { RTLD_CONFGEN, MSG_ORIG(MSG_RTLD_CONFGEN) },
+ static const Val_desc vda[] = {
+ { RTLD_NOLOAD, MSG_RTLD_NOLOAD },
+ { RTLD_PARENT, MSG_RTLD_PARENT },
+ { RTLD_GROUP, MSG_RTLD_GROUP },
+ { RTLD_WORLD, MSG_RTLD_WORLD },
+ { RTLD_NODELETE, MSG_RTLD_NODELETE },
+ { RTLD_FIRST, MSG_RTLD_FIRST },
+ { RTLD_CONFGEN, MSG_RTLD_CONFGEN },
{ 0, 0 }
};
static const char *leading_str_arr[3];
static CONV_EXPN_FIELD_ARG conv_arg = {
- NULL, sizeof (dl_mode_buf->buf), vda, leading_str_arr };
+ NULL, sizeof (dl_mode_buf->buf), leading_str_arr };
const char **lstr = leading_str_arr;
@@ -96,7 +96,7 @@ conv_dl_mode(int mode, int fabricate, Conv_dl_mode_buf_t *dl_mode_buf)
conv_arg.oflags = mode;
conv_arg.rflags = mode & ~(RTLD_LAZY | RTLD_NOW | RTLD_GLOBAL);
- (void) conv_expn_field(&conv_arg, 0);
+ (void) conv_expn_field(&conv_arg, vda, 0);
return ((const char *)dl_mode_buf->buf);
}
@@ -145,22 +145,22 @@ const char *
conv_dl_flag(int flags, Conv_fmt_flags_t fmt_flags,
Conv_dl_flag_buf_t *dl_flag_buf)
{
- static Val_desc vda[] = {
- { RTLD_REL_RELATIVE, MSG_ORIG(MSG_RTLD_REL_RELATIVE) },
- { RTLD_REL_EXEC, MSG_ORIG(MSG_RTLD_REL_EXEC) },
- { RTLD_REL_DEPENDS, MSG_ORIG(MSG_RTLD_REL_DEPENDS) },
- { RTLD_REL_PRELOAD, MSG_ORIG(MSG_RTLD_REL_PRELOAD) },
- { RTLD_REL_SELF, MSG_ORIG(MSG_RTLD_REL_SELF) },
- { RTLD_REL_WEAK, MSG_ORIG(MSG_RTLD_REL_WEAK) },
- { RTLD_MEMORY, MSG_ORIG(MSG_RTLD_MEMORY) },
- { RTLD_STRIP, MSG_ORIG(MSG_RTLD_STRIP) },
- { RTLD_NOHEAP, MSG_ORIG(MSG_RTLD_NOHEAP) },
- { RTLD_CONFSET, MSG_ORIG(MSG_RTLD_CONFSET) },
+ static const Val_desc vda[] = {
+ { RTLD_REL_RELATIVE, MSG_RTLD_REL_RELATIVE },
+ { RTLD_REL_EXEC, MSG_RTLD_REL_EXEC },
+ { RTLD_REL_DEPENDS, MSG_RTLD_REL_DEPENDS },
+ { RTLD_REL_PRELOAD, MSG_RTLD_REL_PRELOAD },
+ { RTLD_REL_SELF, MSG_RTLD_REL_SELF },
+ { RTLD_REL_WEAK, MSG_RTLD_REL_WEAK },
+ { RTLD_MEMORY, MSG_RTLD_MEMORY },
+ { RTLD_STRIP, MSG_RTLD_STRIP },
+ { RTLD_NOHEAP, MSG_RTLD_NOHEAP },
+ { RTLD_CONFSET, MSG_RTLD_CONFSET },
{ 0, 0 }
};
static const char *leading_str_arr[2];
static CONV_EXPN_FIELD_ARG conv_arg = {
- NULL, sizeof (dl_flag_buf->buf), vda, leading_str_arr };
+ NULL, sizeof (dl_flag_buf->buf), leading_str_arr };
const char **lstr = leading_str_arr;
@@ -182,7 +182,7 @@ conv_dl_flag(int flags, Conv_fmt_flags_t fmt_flags,
*lstr = NULL;
conv_arg.oflags = conv_arg.rflags = flags;
- (void) conv_expn_field(&conv_arg, fmt_flags);
+ (void) conv_expn_field(&conv_arg, vda, fmt_flags);
return ((const char *)dl_flag_buf->buf);
}
diff --git a/usr/src/cmd/sgs/libconv/common/dwarf.c b/usr/src/cmd/sgs/libconv/common/dwarf.c
index c32eb9e322..b6e55a64c7 100644
--- a/usr/src/cmd/sgs/libconv/common/dwarf.c
+++ b/usr/src/cmd/sgs/libconv/common/dwarf.c
@@ -34,10 +34,6 @@
* allows other tools to use dwarf_ehe without also pulling this in.
*/
-/* Instantiate a local copy of conv_map2str() from _conv.h */
-DEFINE_conv_map2str
-
-
/*
* Translate DW_CFA_ codes, used to identify Call Frame Instructions.
*/
@@ -58,10 +54,20 @@ conv_dwarf_cfa(uchar_t op, Conv_fmt_flags_t fmt_flags, Conv_inv_buf_t *inv_buf)
MSG_DW_CFA_VAL_OFFSET, MSG_DW_CFA_VAL_OFFSET_SF,
MSG_DW_CFA_VAL_EXPRESSION
};
- static const Msg gnu[] = {
+ static const Msg cfa_mips[] = { MSG_DW_CFA_MIPS_ADV_LOC8 };
+ static const Msg cfa_gnu[] = {
MSG_DW_CFA_GNU_WINDOW_SAVE, MSG_DW_CFA_GNU_ARGS_SIZE,
MSG_DW_CFA_GNU_NEGATIVE_OFF_X
};
+ static const conv_ds_msg_t ds_msg_cfa = {
+ CONV_DS_MSG_INIT(0, cfa) };
+ static const conv_ds_msg_t ds_msg_cfa_mips = {
+ CONV_DS_MSG_INIT(0x1d, cfa_mips) };
+ static const conv_ds_msg_t ds_msg_cfa_gnu = {
+ CONV_DS_MSG_INIT(0x2d, cfa_gnu) };
+ static const conv_ds_t *ds_cfa[] = { CONV_DS_ADDR(ds_msg_cfa),
+ CONV_DS_ADDR(ds_msg_cfa_mips), CONV_DS_ADDR(ds_msg_cfa_gnu), NULL };
+
/*
* DWARF CFA opcodes are bytes. The top 2 bits are a primary
@@ -76,14 +82,8 @@ conv_dwarf_cfa(uchar_t op, Conv_fmt_flags_t fmt_flags, Conv_inv_buf_t *inv_buf)
return (MSG_ORIG(MSG_DW_CFA_RESTORE));
}
- if (op == 0x1d)
- return (MSG_ORIG(MSG_DW_CFA_MIPS_ADV_LOC8));
-
- if ((op >= 0x2d) && (op <= 0x2f))
- return (conv_map2str(inv_buf, (op - 0x2d),
- fmt_flags, ARRAY_NELTS(gnu), gnu));
-
- return (conv_map2str(inv_buf, op, fmt_flags, ARRAY_NELTS(cfa), cfa));
+ return (conv_map_ds(ELFOSABI_NONE, EM_NONE, op, ds_cfa,
+ fmt_flags, inv_buf));
}
/*
@@ -142,6 +142,10 @@ conv_dwarf_regname(Half mach, Word regno, Conv_fmt_flags_t fmt_flags,
MSG_REG_PERMXCSR, MSG_REG_PERFCW,
MSG_REG_PERFSW
};
+ static const conv_ds_msg_t ds_msg_reg_amd64 = {
+ CONV_DS_MSG_INIT(0, reg_amd64) };
+ static const conv_ds_t *ds_reg_amd64[] = {
+ CONV_DS_ADDR(ds_msg_reg_amd64), NULL };
static const Msg reg_i386[8] = {
MSG_REG_EAX, MSG_REG_ECX,
@@ -149,6 +153,10 @@ conv_dwarf_regname(Half mach, Word regno, Conv_fmt_flags_t fmt_flags,
MSG_REG_UESP, MSG_REG_EBP,
MSG_REG_ESI, MSG_REG_EDI
};
+ static const conv_ds_msg_t ds_msg_reg_i386 = {
+ CONV_DS_MSG_INIT(0, reg_i386) };
+ static const conv_ds_t *ds_reg_i386[] = {
+ CONV_DS_ADDR(ds_msg_reg_i386), NULL };
static const Msg reg_sparc[64] = {
MSG_REG_G0, MSG_REG_G1,
@@ -184,6 +192,10 @@ conv_dwarf_regname(Half mach, Word regno, Conv_fmt_flags_t fmt_flags,
MSG_REG_F28, MSG_REG_F29,
MSG_REG_F30, MSG_REG_F31
};
+ static const conv_ds_msg_t ds_msg_reg_sparc = {
+ CONV_DS_MSG_INIT(0, reg_sparc) };
+ static const conv_ds_t *ds_reg_sparc[] = {
+ CONV_DS_ADDR(ds_msg_reg_sparc), NULL };
switch (mach) {
case EM_AMD64:
@@ -197,23 +209,23 @@ conv_dwarf_regname(Half mach, Word regno, Conv_fmt_flags_t fmt_flags,
(regno != 56) && (regno != 57) &&
(regno != 60) && (regno != 61) &&
(regno < ARRAY_NELTS(reg_amd64));
- return (conv_map2str(inv_buf, regno,
- fmt_flags, ARRAY_NELTS(reg_amd64), reg_amd64));
+ return (conv_map_ds(ELFOSABI_NONE, EM_NONE, regno,
+ ds_reg_amd64, fmt_flags, inv_buf));
case EM_386:
case EM_486:
if (good_name)
*good_name = (regno < ARRAY_NELTS(reg_i386));
- return (conv_map2str(inv_buf, regno,
- fmt_flags, ARRAY_NELTS(reg_i386), reg_i386));
+ return (conv_map_ds(ELFOSABI_NONE, EM_NONE, regno,
+ ds_reg_i386, fmt_flags, inv_buf));
case EM_SPARC:
case EM_SPARC32PLUS:
case EM_SPARCV9:
if (good_name)
*good_name = (regno < ARRAY_NELTS(reg_sparc));
- return (conv_map2str(inv_buf, regno,
- fmt_flags, ARRAY_NELTS(reg_sparc), reg_sparc));
+ return (conv_map_ds(ELFOSABI_NONE, EM_NONE, regno,
+ ds_reg_sparc, fmt_flags, inv_buf));
}
if (good_name)
diff --git a/usr/src/cmd/sgs/libconv/common/dynamic.c b/usr/src/cmd/sgs/libconv/common/dynamic.c
index c63d3e6a07..4150b02f0c 100644
--- a/usr/src/cmd/sgs/libconv/common/dynamic.c
+++ b/usr/src/cmd/sgs/libconv/common/dynamic.c
@@ -20,10 +20,9 @@
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
/*
* String conversion routine for .dynamic tag entries.
@@ -37,422 +36,843 @@
-/* Instantiate a local copy of conv_map2str() from _conv.h */
-DEFINE_conv_map2str
-
-
-
+const Val_desc *
+conv_dyn_posflag1_strings(Conv_fmt_flags_t fmt_flags)
+{
#define POSSZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
- MSG_DFP_LAZYLOAD_ALT_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- MSG_DFP_GROUPPERM_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- CONV_INV_BUFSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
+ MSG_DF_P1_LAZYLOAD_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_DF_P1_GROUPPERM_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ CONV_INV_BUFSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
-/*
- * Ensure that Conv_dyn_posflag1_buf_t is large enough:
- *
- * POSSZ is the real minimum size of the buffer required by conv_dyn_posflag1().
- * However, Conv_dyn_posflag1_buf_t uses CONV_DYN_POSFLAG1_BUFSIZE to set the
- * buffer size. We do things this way because the definition of POSSZ uses
- * information that is not available in the environment of other programs
- * that include the conv.h header file.
- */
+ /*
+ * Ensure that Conv_dyn_posflag1_buf_t is large enough:
+ *
+ * POSSZ is the real minimum size of the buffer required by
+ * conv_dyn_posflag1(). However, Conv_dyn_posflag1_buf_t uses
+ * CONV_DYN_POSFLAG1_BUFSIZE to set the buffer size. We do things
+ * this way because the definition of POSSZ uses
+ * information that is not available in the environment of other
+ * programs that include the conv.h header file.
+ */
#if (CONV_DYN_POSFLAG1_BUFSIZE != POSSZ) && !defined(__lint)
#define REPORT_BUFSIZE POSSZ
#include "report_bufsize.h"
#error "CONV_DYN_POSFLAG1_BUFSIZE does not match POSSZ"
#endif
-const char *
-conv_dyn_posflag1(Xword flags, Conv_fmt_flags_t fmt_flags,
- Conv_dyn_posflag1_buf_t *dyn_posflag1_buf)
-{
- static Val_desc vda[] = {
- { DF_P1_LAZYLOAD, MSG_ORIG(MSG_DFP_LAZYLOAD) },
- { DF_P1_GROUPPERM, MSG_ORIG(MSG_DFP_GROUPPERM) },
+ static const Val_desc vda_def[] = {
+ { DF_P1_LAZYLOAD, MSG_DF_P1_LAZYLOAD_DEF },
+ { DF_P1_GROUPPERM, MSG_DF_P1_GROUPPERM_CFNP },
{ 0, 0 }
};
- static CONV_EXPN_FIELD_ARG conv_arg = {
- NULL, sizeof (dyn_posflag1_buf->buf), vda };
- static Val_desc vda_alt[] = {
- { DF_P1_LAZYLOAD, MSG_ORIG(MSG_DFP_LAZYLOAD_ALT) },
- { DF_P1_GROUPPERM, MSG_ORIG(MSG_DFP_GROUPPERM) },
+ static const Val_desc vda_cf[] = {
+ { DF_P1_LAZYLOAD, MSG_DF_P1_LAZYLOAD_CF },
+ { DF_P1_GROUPPERM, MSG_DF_P1_GROUPPERM_CF },
+ { 0, 0 }
+ };
+ static const Val_desc vda_cfnp[] = {
+ { DF_P1_LAZYLOAD, MSG_DF_P1_LAZYLOAD_CFNP },
+ { DF_P1_GROUPPERM, MSG_DF_P1_GROUPPERM_CFNP },
+ { 0, 0 }
+ };
+ static const Val_desc vda_nf[] = {
+ { DF_P1_LAZYLOAD, MSG_DF_P1_LAZYLOAD_NF },
+ { DF_P1_GROUPPERM, MSG_DF_P1_GROUPPERM_NF },
{ 0, 0 }
};
- static CONV_EXPN_FIELD_ARG conv_arg_alt = {
- NULL, sizeof (dyn_posflag1_buf->buf), vda_alt, NULL, 0, 0,
- MSG_ORIG(MSG_STR_EMPTY), NULL, MSG_ORIG(MSG_STR_EMPTY) };
-
- CONV_EXPN_FIELD_ARG *arg;
- if (flags == 0)
- return (MSG_ORIG(MSG_GBL_ZERO));
+ switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
+ case CONV_FMT_ALT_DUMP:
+ case CONV_FMT_ALT_CFNP:
+ return (vda_cfnp);
+ case CONV_FMT_ALT_CF:
+ return (vda_cf);
+ case CONV_FMT_ALT_NF:
+ return (vda_nf);
+ }
- arg = (CONV_TYPE_FMT_ALT(fmt_flags) == CONV_FMT_ALT_DUMP) ?
- &conv_arg_alt : &conv_arg;
- arg->buf = dyn_posflag1_buf->buf;
- arg->oflags = arg->rflags = flags;
- (void) conv_expn_field(arg, fmt_flags);
+ return (vda_def);
+}
- return ((const char *)dyn_posflag1_buf);
+conv_iter_ret_t
+conv_iter_dyn_posflag1(Conv_fmt_flags_t fmt_flags, conv_iter_cb_t func,
+ void *uvalue)
+{
+ return (conv_iter_vd(conv_dyn_posflag1_strings(fmt_flags),
+ func, uvalue));
}
+const Val_desc *
+conv_dyn_flag_strings(Conv_fmt_flags_t fmt_flags)
+{
#define FLAGSZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
- MSG_DF_ORIGIN_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- MSG_DF_SYMBOLIC_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- MSG_DF_TEXTREL_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- MSG_DF_BIND_NOW_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- MSG_DF_STATIC_TLS_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- CONV_INV_BUFSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
+ MSG_DF_ORIGIN_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_DF_SYMBOLIC_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_DF_TEXTREL_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_DF_BIND_NOW_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_DF_STATIC_TLS_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ CONV_INV_BUFSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
-/*
- * Ensure that Conv_dyn_flag_buf_t is large enough:
- *
- * FLAGSZ is the real minimum size of the buffer required by conv_dyn_flag().
- * However, Conv_dyn_flag_buf_t uses CONV_DYN_FLAG_BUFSIZE to set the
- * buffer size. We do things this way because the definition of FLAGSZ uses
- * information that is not available in the environment of other programs
- * that include the conv.h header file.
- */
+ /*
+ * Ensure that Conv_dyn_flag_buf_t is large enough:
+ *
+ * FLAGSZ is the real minimum size of the buffer required by
+ * conv_dyn_flag(). However, Conv_dyn_flag_buf_t uses
+ * CONV_DYN_FLAG_BUFSIZE to set the buffer size. We do things this
+ * way because the definition of FLAGSZ uses information that is not
+ * available in the environment of other programs that include the
+ * conv.h header file.
+ */
#if (CONV_DYN_FLAG_BUFSIZE != FLAGSZ) && !defined(__lint)
#define REPORT_BUFSIZE FLAGSZ
#include "report_bufsize.h"
#error "CONV_DYN_FLAG_BUFSIZE does not match FLAGSZ"
#endif
-const char *
-conv_dyn_flag(Xword flags, Conv_fmt_flags_t fmt_flags,
- Conv_dyn_flag_buf_t *dyn_flag_buf)
-{
- static Val_desc vda[] = {
- { DF_ORIGIN, MSG_ORIG(MSG_DF_ORIGIN) },
- { DF_SYMBOLIC, MSG_ORIG(MSG_DF_SYMBOLIC) },
- { DF_TEXTREL, MSG_ORIG(MSG_DF_TEXTREL) },
- { DF_BIND_NOW, MSG_ORIG(MSG_DF_BIND_NOW) },
- { DF_STATIC_TLS, MSG_ORIG(MSG_DF_STATIC_TLS) },
- { 0, 0 }
- };
- static CONV_EXPN_FIELD_ARG conv_arg = {
- NULL, sizeof (dyn_flag_buf->buf), vda };
- if (flags == 0)
- return (MSG_ORIG(MSG_GBL_ZERO));
+ static const Val_desc vda_cf[] = {
+ { DF_ORIGIN, MSG_DF_ORIGIN_CF },
+ { DF_SYMBOLIC, MSG_DF_SYMBOLIC_CF },
+ { DF_TEXTREL, MSG_DF_TEXTREL_CF },
+ { DF_BIND_NOW, MSG_DF_BIND_NOW_CF },
+ { DF_STATIC_TLS, MSG_DF_STATIC_TLS_CF },
+ { 0 }
+ };
+ static const Val_desc vda_cfnp[] = {
+ { DF_ORIGIN, MSG_DF_ORIGIN_CFNP },
+ { DF_SYMBOLIC, MSG_DF_SYMBOLIC_CFNP },
+ { DF_TEXTREL, MSG_DF_TEXTREL_CFNP },
+ { DF_BIND_NOW, MSG_DF_BIND_NOW_CFNP },
+ { DF_STATIC_TLS, MSG_DF_STATIC_TLS_CFNP },
+ { 0 }
+ };
+ static const Val_desc vda_nf[] = {
+ { DF_ORIGIN, MSG_DF_ORIGIN_NF },
+ { DF_SYMBOLIC, MSG_DF_SYMBOLIC_NF },
+ { DF_TEXTREL, MSG_DF_TEXTREL_NF },
+ { DF_BIND_NOW, MSG_DF_BIND_NOW_NF },
+ { DF_STATIC_TLS, MSG_DF_STATIC_TLS_NF },
+ { 0 }
+ };
- conv_arg.buf = dyn_flag_buf->buf;
- conv_arg.oflags = conv_arg.rflags = flags;
- if (CONV_TYPE_FMT_ALT(fmt_flags) == CONV_FMT_ALT_DUMP) {
- conv_arg.prefix = conv_arg.suffix = MSG_ORIG(MSG_STR_EMPTY);
- } else {
- conv_arg.prefix = conv_arg.suffix = NULL;
+ switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
+ case CONV_FMT_ALT_CF:
+ return (vda_cf);
+ case CONV_FMT_ALT_NF:
+ return (vda_nf);
}
- (void) conv_expn_field(&conv_arg, fmt_flags);
- return ((const char *)dyn_flag_buf->buf);
+ return (vda_cfnp);
}
+conv_iter_ret_t
+conv_iter_dyn_flag(Conv_fmt_flags_t fmt_flags, conv_iter_cb_t func,
+ void *uvalue)
+{
+ return (conv_iter_vd(conv_dyn_flag_strings(fmt_flags), func, uvalue));
+}
+
+const Val_desc *
+conv_dyn_flag1_strings(Conv_fmt_flags_t fmt_flags)
+{
#define FLAG1SZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
- MSG_DF1_NOW_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- MSG_DF1_GLOBAL_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- MSG_DF1_GROUP_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- MSG_DF1_NODELETE_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- MSG_DF1_LOADFLTR_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- MSG_DF1_INITFIRST_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- MSG_DF1_NOOPEN_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- MSG_DF1_ORIGIN_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- MSG_DF1_DIRECT_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- MSG_DF1_TRANS_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- MSG_DF1_INTERPOSE_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- MSG_DF1_NODEFLIB_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- MSG_DF1_NODUMP_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- MSG_DF1_CONFALT_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- MSG_DF1_ENDFILTEE_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- MSG_DF1_DISPRELPND_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- MSG_DF1_DISPRELDNE_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- MSG_DF1_NODIRECT_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- MSG_DF1_IGNMULDEF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- MSG_DF1_NOKSYMS_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- MSG_DF1_NOHDR_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- MSG_DF1_NORELOC_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- MSG_DF1_SYMINTPOSE_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- MSG_DF1_GLOBAUDIT_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- MSG_DF1_SINGLETON_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- CONV_INV_BUFSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
+ MSG_DF_1_NOW_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_DF_1_GLOBAL_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_DF_1_GROUP_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_DF_1_NODELETE_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_DF_1_LOADFLTR_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_DF_1_INITFIRST_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_DF_1_NOOPEN_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_DF_1_ORIGIN_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_DF_1_DIRECT_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_DF_1_TRANS_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_DF_1_INTERPOSE_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_DF_1_NODEFLIB_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_DF_1_NODUMP_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_DF_1_CONFALT_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_DF_1_ENDFILTEE_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_DF_1_DISPRELPND_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_DF_1_DISPRELDNE_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_DF_1_NODIRECT_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_DF_1_IGNMULDEF_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_DF_1_NOKSYMS_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_DF_1_NOHDR_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_DF_1_NORELOC_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_DF_1_SYMINTPOSE_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_DF_1_GLOBAUDIT_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_DF_1_SINGLETON_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ CONV_INV_BUFSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
-/*
- * Ensure that Conv_dyn_flag1_buf_t is large enough:
- *
- * FLAG1SZ is the real minimum size of the buffer required by conv_dyn_flag1().
- * However, Conv_dyn_flag1_buf_t uses CONV_DYN_FLAG1_BUFSIZE to set the
- * buffer size. We do things this way because the definition of FLAG1SZ uses
- * information that is not available in the environment of other programs
- * that include the conv.h header file.
- */
+ /*
+ * Ensure that Conv_dyn_flag1_buf_t is large enough:
+ *
+ * FLAG1SZ is the real minimum size of the buffer required by
+ * conv_dyn_flag1(). However, Conv_dyn_flag1_buf_t uses
+ * CONV_DYN_FLAG1_BUFSIZE to set the buffer size. We do things this
+ * way because the definition of FLAG1SZ uses information that is not
+ * available in the environment of other programs that include the
+ * conv.h header file.
+ */
#if (CONV_DYN_FLAG1_BUFSIZE != FLAG1SZ) && !defined(__lint)
#define REPORT_BUFSIZE FLAG1SZ
#include "report_bufsize.h"
#error "CONV_DYN_FLAG1_BUFSIZE does not match FLAG1SZ"
#endif
-const char *
-conv_dyn_flag1(Xword flags, Conv_fmt_flags_t fmt_flags,
- Conv_dyn_flag1_buf_t *dyn_flag1_buf)
-{
- static Val_desc vda[] = {
- { DF_1_NOW, MSG_ORIG(MSG_DF1_NOW) },
- { DF_1_GLOBAL, MSG_ORIG(MSG_DF1_GLOBAL) },
- { DF_1_GROUP, MSG_ORIG(MSG_DF1_GROUP) },
- { DF_1_NODELETE, MSG_ORIG(MSG_DF1_NODELETE) },
- { DF_1_LOADFLTR, MSG_ORIG(MSG_DF1_LOADFLTR) },
- { DF_1_INITFIRST, MSG_ORIG(MSG_DF1_INITFIRST) },
- { DF_1_NOOPEN, MSG_ORIG(MSG_DF1_NOOPEN) },
- { DF_1_ORIGIN, MSG_ORIG(MSG_DF1_ORIGIN) },
- { DF_1_DIRECT, MSG_ORIG(MSG_DF1_DIRECT) },
- { DF_1_TRANS, MSG_ORIG(MSG_DF1_TRANS) },
- { DF_1_INTERPOSE, MSG_ORIG(MSG_DF1_INTERPOSE) },
- { DF_1_NODEFLIB, MSG_ORIG(MSG_DF1_NODEFLIB) },
- { DF_1_NODUMP, MSG_ORIG(MSG_DF1_NODUMP) },
- { DF_1_CONFALT, MSG_ORIG(MSG_DF1_CONFALT) },
- { DF_1_ENDFILTEE, MSG_ORIG(MSG_DF1_ENDFILTEE) },
- { DF_1_DISPRELDNE, MSG_ORIG(MSG_DF1_DISPRELDNE) },
- { DF_1_DISPRELPND, MSG_ORIG(MSG_DF1_DISPRELPND) },
- { DF_1_NODIRECT, MSG_ORIG(MSG_DF1_NODIRECT) },
- { DF_1_IGNMULDEF, MSG_ORIG(MSG_DF1_IGNMULDEF) },
- { DF_1_NOKSYMS, MSG_ORIG(MSG_DF1_NOKSYMS) },
- { DF_1_NOHDR, MSG_ORIG(MSG_DF1_NOHDR) },
- { DF_1_EDITED, MSG_ORIG(MSG_DF1_EDITED) },
- { DF_1_NORELOC, MSG_ORIG(MSG_DF1_NORELOC) },
- { DF_1_SYMINTPOSE, MSG_ORIG(MSG_DF1_SYMINTPOSE) },
- { DF_1_GLOBAUDIT, MSG_ORIG(MSG_DF1_GLOBAUDIT) },
- { DF_1_SINGLETON, MSG_ORIG(MSG_DF1_SINGLETON) },
+ static const Val_desc vda_def[] = {
+ { DF_1_NOW, MSG_DF_1_NOW_CFNP },
+ { DF_1_GLOBAL, MSG_DF_1_GLOBAL_CFNP },
+ { DF_1_GROUP, MSG_DF_1_GROUP_CFNP },
+ { DF_1_NODELETE, MSG_DF_1_NODELETE_CFNP },
+ { DF_1_LOADFLTR, MSG_DF_1_LOADFLTR_CFNP },
+ { DF_1_INITFIRST, MSG_DF_1_INITFIRST_CFNP },
+ { DF_1_NOOPEN, MSG_DF_1_NOOPEN_CFNP },
+ { DF_1_ORIGIN, MSG_DF_1_ORIGIN_CFNP },
+ { DF_1_DIRECT, MSG_DF_1_DIRECT_CFNP },
+ { DF_1_TRANS, MSG_DF_1_TRANS_CFNP },
+ { DF_1_INTERPOSE, MSG_DF_1_INTERPOSE_DEF },
+ { DF_1_NODEFLIB, MSG_DF_1_NODEFLIB_CFNP },
+ { DF_1_NODUMP, MSG_DF_1_NODUMP_CFNP },
+ { DF_1_CONFALT, MSG_DF_1_CONFALT_CFNP },
+ { DF_1_ENDFILTEE, MSG_DF_1_ENDFILTEE_CFNP },
+ { DF_1_DISPRELDNE, MSG_DF_1_DISPRELDNE_DEF },
+ { DF_1_DISPRELPND, MSG_DF_1_DISPRELPND_DEF },
+ { DF_1_NODIRECT, MSG_DF_1_NODIRECT_CFNP },
+ { DF_1_IGNMULDEF, MSG_DF_1_IGNMULDEF_DEF },
+ { DF_1_NOKSYMS, MSG_DF_1_NOKSYMS_CFNP },
+ { DF_1_NOHDR, MSG_DF_1_NOHDR_CFNP },
+ { DF_1_EDITED, MSG_DF_1_EDITED_CFNP },
+ { DF_1_NORELOC, MSG_DF_1_NORELOC_CFNP },
+ { DF_1_SYMINTPOSE, MSG_DF_1_SYMINTPOSE_DEF },
+ { DF_1_GLOBAUDIT, MSG_DF_1_GLOBAUDIT_DEF },
+ { DF_1_SINGLETON, MSG_DF_1_SINGLETON_DEF },
+ { 0, 0 }
+ };
+ static const Val_desc vda_cf[] = {
+ { DF_1_NOW, MSG_DF_1_NOW_CF },
+ { DF_1_GLOBAL, MSG_DF_1_GLOBAL_CF },
+ { DF_1_GROUP, MSG_DF_1_GROUP_CF },
+ { DF_1_NODELETE, MSG_DF_1_NODELETE_CF },
+ { DF_1_LOADFLTR, MSG_DF_1_LOADFLTR_CF },
+ { DF_1_INITFIRST, MSG_DF_1_INITFIRST_CF },
+ { DF_1_NOOPEN, MSG_DF_1_NOOPEN_CF },
+ { DF_1_ORIGIN, MSG_DF_1_ORIGIN_CF },
+ { DF_1_DIRECT, MSG_DF_1_DIRECT_CF },
+ { DF_1_TRANS, MSG_DF_1_TRANS_CF },
+ { DF_1_INTERPOSE, MSG_DF_1_INTERPOSE_CF },
+ { DF_1_NODEFLIB, MSG_DF_1_NODEFLIB_CF },
+ { DF_1_NODUMP, MSG_DF_1_NODUMP_CF },
+ { DF_1_CONFALT, MSG_DF_1_CONFALT_CF },
+ { DF_1_ENDFILTEE, MSG_DF_1_ENDFILTEE_CF },
+ { DF_1_DISPRELDNE, MSG_DF_1_DISPRELDNE_CF },
+ { DF_1_DISPRELPND, MSG_DF_1_DISPRELPND_CF },
+ { DF_1_NODIRECT, MSG_DF_1_NODIRECT_CF },
+ { DF_1_IGNMULDEF, MSG_DF_1_IGNMULDEF_CF },
+ { DF_1_NOKSYMS, MSG_DF_1_NOKSYMS_CF },
+ { DF_1_NOHDR, MSG_DF_1_NOHDR_CF },
+ { DF_1_EDITED, MSG_DF_1_EDITED_CF },
+ { DF_1_NORELOC, MSG_DF_1_NORELOC_CF },
+ { DF_1_SYMINTPOSE, MSG_DF_1_SYMINTPOSE_CF },
+ { DF_1_GLOBAUDIT, MSG_DF_1_GLOBAUDIT_CF },
+ { DF_1_SINGLETON, MSG_DF_1_SINGLETON_CF },
+ { 0, 0 }
+ };
+ static const Val_desc vda_cfnp[] = {
+ { DF_1_NOW, MSG_DF_1_NOW_CFNP },
+ { DF_1_GLOBAL, MSG_DF_1_GLOBAL_CFNP },
+ { DF_1_GROUP, MSG_DF_1_GROUP_CFNP },
+ { DF_1_NODELETE, MSG_DF_1_NODELETE_CFNP },
+ { DF_1_LOADFLTR, MSG_DF_1_LOADFLTR_CFNP },
+ { DF_1_INITFIRST, MSG_DF_1_INITFIRST_CFNP },
+ { DF_1_NOOPEN, MSG_DF_1_NOOPEN_CFNP },
+ { DF_1_ORIGIN, MSG_DF_1_ORIGIN_CFNP },
+ { DF_1_DIRECT, MSG_DF_1_DIRECT_CFNP },
+ { DF_1_TRANS, MSG_DF_1_TRANS_CFNP },
+ { DF_1_INTERPOSE, MSG_DF_1_INTERPOSE_CFNP },
+ { DF_1_NODEFLIB, MSG_DF_1_NODEFLIB_CFNP },
+ { DF_1_NODUMP, MSG_DF_1_NODUMP_CFNP },
+ { DF_1_CONFALT, MSG_DF_1_CONFALT_CFNP },
+ { DF_1_ENDFILTEE, MSG_DF_1_ENDFILTEE_CFNP },
+ { DF_1_DISPRELDNE, MSG_DF_1_DISPRELDNE_CFNP },
+ { DF_1_DISPRELPND, MSG_DF_1_DISPRELPND_CFNP },
+ { DF_1_NODIRECT, MSG_DF_1_NODIRECT_CFNP },
+ { DF_1_IGNMULDEF, MSG_DF_1_IGNMULDEF_CFNP },
+ { DF_1_NOKSYMS, MSG_DF_1_NOKSYMS_CFNP },
+ { DF_1_NOHDR, MSG_DF_1_NOHDR_CFNP },
+ { DF_1_EDITED, MSG_DF_1_EDITED_CFNP },
+ { DF_1_NORELOC, MSG_DF_1_NORELOC_CFNP },
+ { DF_1_SYMINTPOSE, MSG_DF_1_SYMINTPOSE_CFNP },
+ { DF_1_GLOBAUDIT, MSG_DF_1_GLOBAUDIT_CFNP },
+ { DF_1_SINGLETON, MSG_DF_1_SINGLETON_CFNP },
+ { 0, 0 }
+ };
+ static const Val_desc vda_nf[] = {
+ { DF_1_NOW, MSG_DF_1_NOW_NF },
+ { DF_1_GLOBAL, MSG_DF_1_GLOBAL_NF },
+ { DF_1_GROUP, MSG_DF_1_GROUP_NF },
+ { DF_1_NODELETE, MSG_DF_1_NODELETE_NF },
+ { DF_1_LOADFLTR, MSG_DF_1_LOADFLTR_NF },
+ { DF_1_INITFIRST, MSG_DF_1_INITFIRST_NF },
+ { DF_1_NOOPEN, MSG_DF_1_NOOPEN_NF },
+ { DF_1_ORIGIN, MSG_DF_1_ORIGIN_NF },
+ { DF_1_DIRECT, MSG_DF_1_DIRECT_NF },
+ { DF_1_TRANS, MSG_DF_1_TRANS_NF },
+ { DF_1_INTERPOSE, MSG_DF_1_INTERPOSE_NF },
+ { DF_1_NODEFLIB, MSG_DF_1_NODEFLIB_NF },
+ { DF_1_NODUMP, MSG_DF_1_NODUMP_NF },
+ { DF_1_CONFALT, MSG_DF_1_CONFALT_NF },
+ { DF_1_ENDFILTEE, MSG_DF_1_ENDFILTEE_NF },
+ { DF_1_DISPRELDNE, MSG_DF_1_DISPRELDNE_NF },
+ { DF_1_DISPRELPND, MSG_DF_1_DISPRELPND_NF },
+ { DF_1_NODIRECT, MSG_DF_1_NODIRECT_NF },
+ { DF_1_IGNMULDEF, MSG_DF_1_IGNMULDEF_NF },
+ { DF_1_NOKSYMS, MSG_DF_1_NOKSYMS_NF },
+ { DF_1_NOHDR, MSG_DF_1_NOHDR_NF },
+ { DF_1_EDITED, MSG_DF_1_EDITED_NF },
+ { DF_1_NORELOC, MSG_DF_1_NORELOC_NF },
+ { DF_1_SYMINTPOSE, MSG_DF_1_SYMINTPOSE_NF },
+ { DF_1_GLOBAUDIT, MSG_DF_1_GLOBAUDIT_NF },
+ { DF_1_SINGLETON, MSG_DF_1_SINGLETON_NF },
{ 0, 0 }
};
- static CONV_EXPN_FIELD_ARG conv_arg = {
- NULL, sizeof (dyn_flag1_buf->buf), vda };
- if (flags == 0)
- return (MSG_ORIG(MSG_GBL_ZERO));
+ switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
+ case CONV_FMT_ALT_CF:
+ return (vda_cf);
+ case CONV_FMT_ALT_CFNP:
+ return (vda_cfnp);
+ case CONV_FMT_ALT_NF:
+ return (vda_nf);
+ }
- conv_arg.oflags = conv_arg.rflags = flags;
- conv_arg.buf = dyn_flag1_buf->buf;
- (void) conv_expn_field(&conv_arg, fmt_flags);
+ return (vda_def);
+}
- return ((const char *)dyn_flag1_buf->buf);
+conv_iter_ret_t
+conv_iter_dyn_flag1(Conv_fmt_flags_t fmt_flags, conv_iter_cb_t func,
+ void *uvalue)
+{
+ return (conv_iter_vd(conv_dyn_flag1_strings(fmt_flags), func, uvalue));
}
+const Val_desc *
+conv_dyn_feature1_strings(Conv_fmt_flags_t fmt_flags)
+{
#define FEATSZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
- MSG_DTF_PARINIT_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- MSG_DTF_CONFEXP_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- CONV_INV_BUFSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
+ MSG_DTF_1_PARINIT_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_DTF_1_CONFEXP_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ CONV_INV_BUFSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
-/*
- * Ensure that Conv_dyn_feature1_buf_t is large enough:
- *
- * FEATSZ is the real min size of the buffer required by conv_dyn_feature1().
- * However, Conv_dyn_feature1_buf_t uses CONV_DYN_FEATURE1_BUFSIZE to set the
- * buffer size. We do things this way because the definition of FEATSZ uses
- * information that is not available in the environment of other programs
- * that include the conv.h header file.
- */
+ /*
+ * Ensure that Conv_dyn_feature1_buf_t is large enough:
+ *
+ * FEATSZ is the real min size of the buffer required by
+ * conv_dyn_feature1(). However, Conv_dyn_feature1_buf_t uses
+ * CONV_DYN_FEATURE1_BUFSIZE to set the buffer size. We do things
+ * this way because the definition of FEATSZ uses information that
+ * is not available in the environment of other programs that include
+ * the conv.h header file.
+ */
#if (CONV_DYN_FEATURE1_BUFSIZE != FEATSZ) && !defined(__lint)
#define REPORT_BUFSIZE FEATSZ
#include "report_bufsize.h"
#error "CONV_DYN_FEATURE1_BUFSIZE does not match FEATSZ"
#endif
-const char *
-conv_dyn_feature1(Xword flags, Conv_fmt_flags_t fmt_flags,
- Conv_dyn_feature1_buf_t *dyn_feature1_buf)
-{
- static Val_desc vda[] = {
- { DTF_1_PARINIT, MSG_ORIG(MSG_DTF_PARINIT) },
- { DTF_1_CONFEXP, MSG_ORIG(MSG_DTF_CONFEXP) },
+ static const Val_desc vda_cf[] = {
+ { DTF_1_PARINIT, MSG_DTF_1_PARINIT_CF },
+ { DTF_1_CONFEXP, MSG_DTF_1_CONFEXP_CF },
+ { 0, 0 }
+ };
+ static const Val_desc vda_cfnp[] = {
+ { DTF_1_PARINIT, MSG_DTF_1_PARINIT_CFNP },
+ { DTF_1_CONFEXP, MSG_DTF_1_CONFEXP_CFNP },
+ { 0, 0 }
+ };
+ static const Val_desc vda_nf[] = {
+ { DTF_1_PARINIT, MSG_DTF_1_PARINIT_NF },
+ { DTF_1_CONFEXP, MSG_DTF_1_CONFEXP_NF },
{ 0, 0 }
};
- static CONV_EXPN_FIELD_ARG conv_arg = {
- NULL, sizeof (dyn_feature1_buf->buf), vda };
-
- if (flags == 0)
- return (MSG_ORIG(MSG_GBL_ZERO));
- conv_arg.buf = dyn_feature1_buf->buf;
- conv_arg.oflags = conv_arg.rflags = flags;
- if (CONV_TYPE_FMT_ALT(fmt_flags) == CONV_FMT_ALT_DUMP) {
- conv_arg.prefix = conv_arg.suffix = MSG_ORIG(MSG_STR_EMPTY);
- } else {
- conv_arg.prefix = conv_arg.suffix = NULL;
+ switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
+ case CONV_FMT_ALT_CF:
+ return (vda_cf);
+ case CONV_FMT_ALT_NF:
+ return (vda_nf);
}
- (void) conv_expn_field(&conv_arg, fmt_flags);
- return ((const char *)dyn_feature1_buf->buf);
+ return (vda_cfnp);
}
-const char *
-conv_dyn_tag(Xword tag, Half mach, Conv_fmt_flags_t fmt_flags,
- Conv_inv_buf_t *inv_buf)
+conv_iter_ret_t
+conv_iter_dyn_feature1(Conv_fmt_flags_t fmt_flags, conv_iter_cb_t func,
+ void *uvalue)
{
- /*
- * Dynamic tag values are sparse, cover a wide range, and have
- * holes. To handle this efficiently, we fall through a series
- * of tests below, in increasing tag order, returning at the first
- * match.
- *
- * If we fall all the way to the end, the tag is unknown,
- * and its numeric value is printed.
- */
+ return (conv_iter_vd(conv_dyn_feature1_strings(fmt_flags),
+ func, uvalue));
+}
+const conv_ds_t **
+conv_dyn_tag_strings(conv_iter_osabi_t osabi, Half mach,
+ Conv_fmt_flags_t fmt_flags)
+{
/*
- * Most of the tag values are clustered in contiguous ranges.
- * Each contiguous range of defined values is handled with
- * an array that contains the message index corresponding to
- * each value in that range. The DYN_RANGE macro checks the
- * tag value against range of values starting at _start_tag.
- * If there is a match, the index of the appropriate name is
- * pulled from _array and returned to the caller.
+ * Maximum # of items that can be in the returned array. Size this
+ * by counting the maximum depth in the switch statement that fills
+ * retarr at the end of this function.
*/
-#define DYN_RANGE(_start_tag, _array) \
- if ((tag >= _start_tag) && (tag < (_start_tag + ARRAY_NELTS(_array)))) \
- return (MSG_ORIG(_array[tag - _start_tag]));
-
+#define MAX_RET 12
/*
* Generic dynamic tags:
- * - Note hole between DT_FLAGS and DT_PREINIT_ARRAY
- * - The first range has alternative names for dump,
- * requiring a second array.
+ * - Note hole between DT_FLAGS and DT_PREINIT_ARRAY (tag 32).
+ * We use a 0, which is the signal for "not defined".
+ * - This range has alternative names for dump, requiring an
+ * additional array.
*/
- static const Msg tags_null[] = {
- MSG_DYN_NULL, MSG_DYN_NEEDED,
- MSG_DYN_PLTRELSZ, MSG_DYN_PLTGOT,
- MSG_DYN_HASH, MSG_DYN_STRTAB,
- MSG_DYN_SYMTAB, MSG_DYN_RELA,
- MSG_DYN_RELASZ, MSG_DYN_RELAENT,
- MSG_DYN_STRSZ, MSG_DYN_SYMENT,
- MSG_DYN_INIT, MSG_DYN_FINI,
- MSG_DYN_SONAME, MSG_DYN_RPATH,
- MSG_DYN_SYMBOLIC, MSG_DYN_REL,
- MSG_DYN_RELSZ, MSG_DYN_RELENT,
- MSG_DYN_PLTREL, MSG_DYN_DEBUG,
- MSG_DYN_TEXTREL, MSG_DYN_JMPREL,
- MSG_DYN_BIND_NOW, MSG_DYN_INIT_ARRAY,
- MSG_DYN_FINI_ARRAY, MSG_DYN_INIT_ARRAYSZ,
- MSG_DYN_FINI_ARRAYSZ, MSG_DYN_RUNPATH,
- MSG_DYN_FLAGS
- };
- static const Msg tags_null_alt[] = {
- MSG_DYN_NULL, MSG_DYN_NEEDED,
- MSG_DYN_PLTRELSZ_ALT, MSG_DYN_PLTGOT,
- MSG_DYN_HASH, MSG_DYN_STRTAB,
- MSG_DYN_SYMTAB, MSG_DYN_RELA,
- MSG_DYN_RELASZ, MSG_DYN_RELAENT,
- MSG_DYN_STRSZ, MSG_DYN_SYMENT,
- MSG_DYN_INIT, MSG_DYN_FINI,
- MSG_DYN_SONAME, MSG_DYN_RPATH,
- MSG_DYN_SYMBOLIC_ALT, MSG_DYN_REL,
- MSG_DYN_RELSZ, MSG_DYN_RELENT,
- MSG_DYN_PLTREL, MSG_DYN_DEBUG,
- MSG_DYN_TEXTREL, MSG_DYN_JMPREL,
- MSG_DYN_BIND_NOW, MSG_DYN_INIT_ARRAY,
- MSG_DYN_FINI_ARRAY, MSG_DYN_INIT_ARRAYSZ,
- MSG_DYN_FINI_ARRAYSZ, MSG_DYN_RUNPATH,
- MSG_DYN_FLAGS
- };
- static const Msg tags_preinit_array[] = {
- MSG_DYN_PREINIT_ARRAY, MSG_DYN_PREINIT_ARRAYSZ
+ static const Msg tags_null_cf[] = {
+ MSG_DT_NULL_CF, MSG_DT_NEEDED_CF,
+ MSG_DT_PLTRELSZ_CF, MSG_DT_PLTGOT_CF,
+ MSG_DT_HASH_CF, MSG_DT_STRTAB_CF,
+ MSG_DT_SYMTAB_CF, MSG_DT_RELA_CF,
+ MSG_DT_RELASZ_CF, MSG_DT_RELAENT_CF,
+ MSG_DT_STRSZ_CF, MSG_DT_SYMENT_CF,
+ MSG_DT_INIT_CF, MSG_DT_FINI_CF,
+ MSG_DT_SONAME_CF, MSG_DT_RPATH_CF,
+ MSG_DT_SYMBOLIC_CF, MSG_DT_REL_CF,
+ MSG_DT_RELSZ_CF, MSG_DT_RELENT_CF,
+ MSG_DT_PLTREL_CF, MSG_DT_DEBUG_CF,
+ MSG_DT_TEXTREL_CF, MSG_DT_JMPREL_CF,
+ MSG_DT_BIND_NOW_CF, MSG_DT_INIT_ARRAY_CF,
+ MSG_DT_FINI_ARRAY_CF, MSG_DT_INIT_ARRAYSZ_CF,
+ MSG_DT_FINI_ARRAYSZ_CF, MSG_DT_RUNPATH_CF,
+ MSG_DT_FLAGS_CF, 0,
+ MSG_DT_PREINIT_ARRAY_CF, MSG_DT_PREINIT_ARRAYSZ_CF
+ };
+ static const Msg tags_null_cfnp[] = {
+ MSG_DT_NULL_CFNP, MSG_DT_NEEDED_CFNP,
+ MSG_DT_PLTRELSZ_CFNP, MSG_DT_PLTGOT_CFNP,
+ MSG_DT_HASH_CFNP, MSG_DT_STRTAB_CFNP,
+ MSG_DT_SYMTAB_CFNP, MSG_DT_RELA_CFNP,
+ MSG_DT_RELASZ_CFNP, MSG_DT_RELAENT_CFNP,
+ MSG_DT_STRSZ_CFNP, MSG_DT_SYMENT_CFNP,
+ MSG_DT_INIT_CFNP, MSG_DT_FINI_CFNP,
+ MSG_DT_SONAME_CFNP, MSG_DT_RPATH_CFNP,
+ MSG_DT_SYMBOLIC_CFNP, MSG_DT_REL_CFNP,
+ MSG_DT_RELSZ_CFNP, MSG_DT_RELENT_CFNP,
+ MSG_DT_PLTREL_CFNP, MSG_DT_DEBUG_CFNP,
+ MSG_DT_TEXTREL_CFNP, MSG_DT_JMPREL_CFNP,
+ MSG_DT_BIND_NOW_CFNP, MSG_DT_INIT_ARRAY_CFNP,
+ MSG_DT_FINI_ARRAY_CFNP, MSG_DT_INIT_ARRAYSZ_CFNP,
+ MSG_DT_FINI_ARRAYSZ_CFNP, MSG_DT_RUNPATH_CFNP,
+ MSG_DT_FLAGS_CFNP, 0,
+ MSG_DT_PREINIT_ARRAY_CFNP, MSG_DT_PREINIT_ARRAYSZ_CFNP
+ };
+ static const Msg tags_null_nf[] = {
+ MSG_DT_NULL_NF, MSG_DT_NEEDED_NF,
+ MSG_DT_PLTRELSZ_NF, MSG_DT_PLTGOT_NF,
+ MSG_DT_HASH_NF, MSG_DT_STRTAB_NF,
+ MSG_DT_SYMTAB_NF, MSG_DT_RELA_NF,
+ MSG_DT_RELASZ_NF, MSG_DT_RELAENT_NF,
+ MSG_DT_STRSZ_NF, MSG_DT_SYMENT_NF,
+ MSG_DT_INIT_NF, MSG_DT_FINI_NF,
+ MSG_DT_SONAME_NF, MSG_DT_RPATH_NF,
+ MSG_DT_SYMBOLIC_NF, MSG_DT_REL_NF,
+ MSG_DT_RELSZ_NF, MSG_DT_RELENT_NF,
+ MSG_DT_PLTREL_NF, MSG_DT_DEBUG_NF,
+ MSG_DT_TEXTREL_NF, MSG_DT_JMPREL_NF,
+ MSG_DT_BIND_NOW_NF, MSG_DT_INIT_ARRAY_NF,
+ MSG_DT_FINI_ARRAY_NF, MSG_DT_INIT_ARRAYSZ_NF,
+ MSG_DT_FINI_ARRAYSZ_NF, MSG_DT_RUNPATH_NF,
+ MSG_DT_FLAGS_NF, 0,
+ MSG_DT_PREINIT_ARRAY_NF, MSG_DT_PREINIT_ARRAYSZ_NF
+ };
+ static const Msg tags_null_dmp[] = {
+ MSG_DT_NULL_CFNP, MSG_DT_NEEDED_CFNP,
+ MSG_DT_PLTRELSZ_DMP, MSG_DT_PLTGOT_CFNP,
+ MSG_DT_HASH_CFNP, MSG_DT_STRTAB_CFNP,
+ MSG_DT_SYMTAB_CFNP, MSG_DT_RELA_CFNP,
+ MSG_DT_RELASZ_CFNP, MSG_DT_RELAENT_CFNP,
+ MSG_DT_STRSZ_CFNP, MSG_DT_SYMENT_CFNP,
+ MSG_DT_INIT_CFNP, MSG_DT_FINI_CFNP,
+ MSG_DT_SONAME_CFNP, MSG_DT_RPATH_CFNP,
+ MSG_DT_SYMBOLIC_DMP, MSG_DT_REL_CFNP,
+ MSG_DT_RELSZ_CFNP, MSG_DT_RELENT_CFNP,
+ MSG_DT_PLTREL_CFNP, MSG_DT_DEBUG_CFNP,
+ MSG_DT_TEXTREL_CFNP, MSG_DT_JMPREL_CFNP,
+ MSG_DT_BIND_NOW_CFNP, MSG_DT_INIT_ARRAY_CFNP,
+ MSG_DT_FINI_ARRAY_CFNP, MSG_DT_INIT_ARRAYSZ_CFNP,
+ MSG_DT_FINI_ARRAYSZ_CFNP, MSG_DT_RUNPATH_CFNP,
+ MSG_DT_FLAGS_CFNP, 0,
+ MSG_DT_PREINIT_ARRAY_CFNP, MSG_DT_PREINIT_ARRAYSZ_CFNP
};
+ static const conv_ds_msg_t ds_null_cf = {
+ CONV_DS_MSG_INIT(DT_NULL, tags_null_cf) };
+ static const conv_ds_msg_t ds_null_cfnp = {
+ CONV_DS_MSG_INIT(DT_NULL, tags_null_cfnp) };
+ static const conv_ds_msg_t ds_null_nf = {
+ CONV_DS_MSG_INIT(DT_NULL, tags_null_nf) };
+ static const conv_ds_msg_t ds_null_dmp = {
+ CONV_DS_MSG_INIT(DT_NULL, tags_null_dmp) };
+
+ /*
+ * DT_SPARC_REGISTER was originally assigned 0x7000001. It is processor
+ * specific, and should have been in the range DT_LOPROC-DT_HIPROC
+ * instead of here. When the error was fixed,
+ * DT_DEPRECATED_SPARC_REGISTER was created to maintain backward
+ * compatability.
+ */
+ static const Msg tags_sdreg_cf[] = {
+ MSG_DT_DEP_SPARC_REG_CF };
+ static const Msg tags_sdreg_cfnp[] = {
+ MSG_DT_DEP_SPARC_REG_CFNP };
+ static const Msg tags_sdreg_nf[] = {
+ MSG_DT_DEP_SPARC_REG_NF };
+
+ static const conv_ds_msg_t ds_sdreg_cf = {
+ CONV_DS_MSG_INIT(DT_DEPRECATED_SPARC_REGISTER, tags_sdreg_cf) };
+ static const conv_ds_msg_t ds_sdreg_cfnp = {
+ CONV_DS_MSG_INIT(DT_DEPRECATED_SPARC_REGISTER, tags_sdreg_cfnp) };
+ static const conv_ds_msg_t ds_sdreg_nf = {
+ CONV_DS_MSG_INIT(DT_DEPRECATED_SPARC_REGISTER, tags_sdreg_nf) };
+
/*
- * SUNW: DT_LOOS -> DT_HIOS range. Note hole between DT_SUNW_TLSSORTSZ,
+ * SUNW: DT_LOOS -> DT_HIOS range. Note holes between DT_SUNW_TLSSORTSZ,
* DT_SUNW_STRPAD, and DT_SUNW_LDMACH. We handle the outliers
* separately below as single values.
*/
- static const Msg tags_sunw_auxiliary[] = {
- MSG_DYN_SUNW_AUXILIARY, MSG_DYN_SUNW_RTLDINF,
- MSG_DYN_SUNW_FILTER, MSG_DYN_SUNW_CAP,
- MSG_DYN_SUNW_SYMTAB, MSG_DYN_SUNW_SYMSZ,
- MSG_DYN_SUNW_SORTENT, MSG_DYN_SUNW_SYMSORT,
- MSG_DYN_SUNW_SYMSORTSZ, MSG_DYN_SUNW_TLSSORT,
- MSG_DYN_SUNW_TLSSORTSZ
+ static const Msg tags_sunw_auxiliary_cf[] = {
+ MSG_DT_SUNW_AUXILIARY_CF, MSG_DT_SUNW_RTLDINF_CF,
+ MSG_DT_SUNW_FILTER_CF, MSG_DT_SUNW_CAP_CF,
+ MSG_DT_SUNW_SYMTAB_CF, MSG_DT_SUNW_SYMSZ_CF,
+ MSG_DT_SUNW_SORTENT_CF, MSG_DT_SUNW_SYMSORT_CF,
+ MSG_DT_SUNW_SYMSORTSZ_CF, MSG_DT_SUNW_TLSSORT_CF,
+ MSG_DT_SUNW_TLSSORTSZ_CF, 0,
+ MSG_DT_SUNW_STRPAD_CF, 0,
+ MSG_DT_SUNW_LDMACH_CF
+ };
+ static const Msg tags_sunw_auxiliary_cfnp[] = {
+ MSG_DT_SUNW_AUXILIARY_CFNP, MSG_DT_SUNW_RTLDINF_CFNP,
+ MSG_DT_SUNW_FILTER_CFNP, MSG_DT_SUNW_CAP_CFNP,
+ MSG_DT_SUNW_SYMTAB_CFNP, MSG_DT_SUNW_SYMSZ_CFNP,
+ MSG_DT_SUNW_SORTENT_CFNP, MSG_DT_SUNW_SYMSORT_CFNP,
+ MSG_DT_SUNW_SYMSORTSZ_CFNP, MSG_DT_SUNW_TLSSORT_CFNP,
+ MSG_DT_SUNW_TLSSORTSZ_CFNP, 0,
+ MSG_DT_SUNW_STRPAD_CFNP, 0,
+ MSG_DT_SUNW_LDMACH_CFNP
+ };
+ static const Msg tags_sunw_auxiliary_nf[] = {
+ MSG_DT_SUNW_AUXILIARY_NF, MSG_DT_SUNW_RTLDINF_NF,
+ MSG_DT_SUNW_FILTER_NF, MSG_DT_SUNW_CAP_NF,
+ MSG_DT_SUNW_SYMTAB_NF, MSG_DT_SUNW_SYMSZ_NF,
+ MSG_DT_SUNW_SORTENT_NF, MSG_DT_SUNW_SYMSORT_NF,
+ MSG_DT_SUNW_SYMSORTSZ_NF, MSG_DT_SUNW_TLSSORT_NF,
+ MSG_DT_SUNW_TLSSORTSZ_NF, 0,
+ MSG_DT_SUNW_STRPAD_NF, 0,
+ MSG_DT_SUNW_LDMACH_NF
+ };
+ static const conv_ds_msg_t ds_sunw_auxiliary_cf = {
+ CONV_DS_MSG_INIT(DT_SUNW_AUXILIARY, tags_sunw_auxiliary_cf) };
+ static const conv_ds_msg_t ds_sunw_auxiliary_cfnp = {
+ CONV_DS_MSG_INIT(DT_SUNW_AUXILIARY, tags_sunw_auxiliary_cfnp) };
+ static const conv_ds_msg_t ds_sunw_auxiliary_nf = {
+ CONV_DS_MSG_INIT(DT_SUNW_AUXILIARY, tags_sunw_auxiliary_nf) };
+
+ /*
+ * GNU: (In DT_VALRNGLO section) DT_GNU_PRELINKED - DT_GNU_LIBLISTSZ
+ */
+ static const Msg tags_gnu_prelinked_cf[] = {
+ MSG_DT_GNU_PRELINKED_CF, MSG_DT_GNU_CONFLICTSZ_CF,
+ MSG_DT_GNU_LIBLISTSZ_CF
+ };
+ static const Msg tags_gnu_prelinked_cfnp[] = {
+ MSG_DT_GNU_PRELINKED_CFNP, MSG_DT_GNU_CONFLICTSZ_CFNP,
+ MSG_DT_GNU_LIBLISTSZ_CFNP
+ };
+ static const Msg tags_gnu_prelinked_nf[] = {
+ MSG_DT_GNU_PRELINKED_NF, MSG_DT_GNU_CONFLICTSZ_NF,
+ MSG_DT_GNU_LIBLISTSZ_NF
};
+ static const conv_ds_msg_t ds_gnu_prelinked_cf = {
+ CONV_DS_MSG_INIT(DT_GNU_PRELINKED, tags_gnu_prelinked_cf) };
+ static const conv_ds_msg_t ds_gnu_prelinked_cfnp = {
+ CONV_DS_MSG_INIT(DT_GNU_PRELINKED, tags_gnu_prelinked_cfnp) };
+ static const conv_ds_msg_t ds_gnu_prelinked_nf = {
+ CONV_DS_MSG_INIT(DT_GNU_PRELINKED, tags_gnu_prelinked_nf) };
/*
* SUNW: DT_VALRNGLO - DT_VALRNGHI range.
*/
- static const Msg tags_checksum[] = {
- MSG_DYN_CHECKSUM, MSG_DYN_PLTPADSZ,
- MSG_DYN_MOVEENT, MSG_DYN_MOVESZ,
- MSG_DYN_FEATURE_1, MSG_DYN_POSFLAG_1,
- MSG_DYN_SYMINSZ, MSG_DYN_SYMINENT
+ static const Msg tags_checksum_cf[] = {
+ MSG_DT_CHECKSUM_CF, MSG_DT_PLTPADSZ_CF,
+ MSG_DT_MOVEENT_CF, MSG_DT_MOVESZ_CF,
+ MSG_DT_FEATURE_1_CF, MSG_DT_POSFLAG_1_CF,
+ MSG_DT_SYMINSZ_CF, MSG_DT_SYMINENT_CF
};
+ static const Msg tags_checksum_cfnp[] = {
+ MSG_DT_CHECKSUM_CFNP, MSG_DT_PLTPADSZ_CFNP,
+ MSG_DT_MOVEENT_CFNP, MSG_DT_MOVESZ_CFNP,
+ MSG_DT_FEATURE_1_CFNP, MSG_DT_POSFLAG_1_CFNP,
+ MSG_DT_SYMINSZ_CFNP, MSG_DT_SYMINENT_CFNP
+ };
+ static const Msg tags_checksum_nf[] = {
+ MSG_DT_CHECKSUM_NF, MSG_DT_PLTPADSZ_NF,
+ MSG_DT_MOVEENT_NF, MSG_DT_MOVESZ_NF,
+ MSG_DT_FEATURE_1_NF, MSG_DT_POSFLAG_1_NF,
+ MSG_DT_SYMINSZ_NF, MSG_DT_SYMINENT_NF
+ };
+ static const conv_ds_msg_t ds_checksum_cf = {
+ CONV_DS_MSG_INIT(DT_CHECKSUM, tags_checksum_cf) };
+ static const conv_ds_msg_t ds_checksum_cfnp = {
+ CONV_DS_MSG_INIT(DT_CHECKSUM, tags_checksum_cfnp) };
+ static const conv_ds_msg_t ds_checksum_nf = {
+ CONV_DS_MSG_INIT(DT_CHECKSUM, tags_checksum_nf) };
+
+ /*
+ * GNU: (In DT_ADDRRNGLO section) DT_GNU_HASH - DT_GNU_LIBLIST
+ */
+ static const Msg tags_gnu_hash_cf[] = {
+ MSG_DT_GNU_HASH_CF, MSG_DT_TLSDESC_PLT_CF,
+ MSG_DT_TLSDESC_GOT_CF, MSG_DT_GNU_CONFLICT_CF,
+ MSG_DT_GNU_LIBLIST_CF
+ };
+ static const Msg tags_gnu_hash_cfnp[] = {
+ MSG_DT_GNU_HASH_CFNP, MSG_DT_TLSDESC_PLT_CFNP,
+ MSG_DT_TLSDESC_GOT_CFNP, MSG_DT_GNU_CONFLICT_CFNP,
+ MSG_DT_GNU_LIBLIST_CFNP
+ };
+ static const Msg tags_gnu_hash_nf[] = {
+ MSG_DT_GNU_HASH_NF, MSG_DT_TLSDESC_PLT_NF,
+ MSG_DT_TLSDESC_GOT_NF, MSG_DT_GNU_CONFLICT_NF,
+ MSG_DT_GNU_LIBLIST_NF
+ };
+ static const conv_ds_msg_t ds_gnu_hash_cf = {
+ CONV_DS_MSG_INIT(DT_GNU_HASH, tags_gnu_hash_cf) };
+ static const conv_ds_msg_t ds_gnu_hash_cfnp = {
+ CONV_DS_MSG_INIT(DT_GNU_HASH, tags_gnu_hash_cfnp) };
+ static const conv_ds_msg_t ds_gnu_hash_nf = {
+ CONV_DS_MSG_INIT(DT_GNU_HASH, tags_gnu_hash_nf) };
/*
* SUNW: DT_ADDRRNGLO - DT_ADDRRNGHI range.
*/
- static const Msg tags_config[] = {
- MSG_DYN_CONFIG, MSG_DYN_DEPAUDIT,
- MSG_DYN_AUDIT, MSG_DYN_PLTPAD,
- MSG_DYN_MOVETAB, MSG_DYN_SYMINFO
+ static const Msg tags_config_cf[] = {
+ MSG_DT_CONFIG_CF, MSG_DT_DEPAUDIT_CF,
+ MSG_DT_AUDIT_CF, MSG_DT_PLTPAD_CF,
+ MSG_DT_MOVETAB_CF, MSG_DT_SYMINFO_CF
+ };
+ static const Msg tags_config_cfnp[] = {
+ MSG_DT_CONFIG_CFNP, MSG_DT_DEPAUDIT_CFNP,
+ MSG_DT_AUDIT_CFNP, MSG_DT_PLTPAD_CFNP,
+ MSG_DT_MOVETAB_CFNP, MSG_DT_SYMINFO_CFNP
};
+ static const Msg tags_config_nf[] = {
+ MSG_DT_CONFIG_NF, MSG_DT_DEPAUDIT_NF,
+ MSG_DT_AUDIT_NF, MSG_DT_PLTPAD_NF,
+ MSG_DT_MOVETAB_NF, MSG_DT_SYMINFO_NF
+ };
+ static const conv_ds_msg_t ds_config_cf = {
+ CONV_DS_MSG_INIT(DT_CONFIG, tags_config_cf) };
+ static const conv_ds_msg_t ds_config_cfnp = {
+ CONV_DS_MSG_INIT(DT_CONFIG, tags_config_cfnp) };
+ static const conv_ds_msg_t ds_config_nf = {
+ CONV_DS_MSG_INIT(DT_CONFIG, tags_config_nf) };
/*
* SUNW: generic range. Note hole between DT_VERSYM and DT_RELACOUNT.
- * We handle DT_VERSYM as a single value below.
*/
- static const Msg tags_relacount[] = {
- MSG_DYN_RELACOUNT, MSG_DYN_RELCOUNT,
- MSG_DYN_FLAGS_1, MSG_DYN_VERDEF,
- MSG_DYN_VERDEFNUM, MSG_DYN_VERNEED,
- MSG_DYN_VERNEEDNUM
+ static const Msg tags_versym_cf[] = { MSG_DT_VERSYM_CF };
+ static const Msg tags_versym_cfnp[] = { MSG_DT_VERSYM_CFNP };
+ static const Msg tags_versym_nf[] = { MSG_DT_VERSYM_NF };
+ static const conv_ds_msg_t ds_versym_cf = {
+ CONV_DS_MSG_INIT(DT_VERSYM, tags_versym_cf) };
+ static const conv_ds_msg_t ds_versym_cfnp = {
+ CONV_DS_MSG_INIT(DT_VERSYM, tags_versym_cfnp) };
+ static const conv_ds_msg_t ds_versym_nf = {
+ CONV_DS_MSG_INIT(DT_VERSYM, tags_versym_nf) };
+
+ static const Msg tags_relacount_cf[] = {
+ MSG_DT_RELACOUNT_CF, MSG_DT_RELCOUNT_CF,
+ MSG_DT_FLAGS_1_CF, MSG_DT_VERDEF_CF,
+ MSG_DT_VERDEFNUM_CF, MSG_DT_VERNEED_CF,
+ MSG_DT_VERNEEDNUM_CF
+ };
+ static const Msg tags_relacount_cfnp[] = {
+ MSG_DT_RELACOUNT_CFNP, MSG_DT_RELCOUNT_CFNP,
+ MSG_DT_FLAGS_1_CFNP, MSG_DT_VERDEF_CFNP,
+ MSG_DT_VERDEFNUM_CFNP, MSG_DT_VERNEED_CFNP,
+ MSG_DT_VERNEEDNUM_CFNP
+ };
+ static const Msg tags_relacount_nf[] = {
+ MSG_DT_RELACOUNT_NF, MSG_DT_RELCOUNT_NF,
+ MSG_DT_FLAGS_1_NF, MSG_DT_VERDEF_NF,
+ MSG_DT_VERDEFNUM_NF, MSG_DT_VERNEED_NF,
+ MSG_DT_VERNEEDNUM_NF
};
+ static const conv_ds_msg_t ds_relacount_cf = {
+ CONV_DS_MSG_INIT(DT_RELACOUNT, tags_relacount_cf) };
+ static const conv_ds_msg_t ds_relacount_cfnp = {
+ CONV_DS_MSG_INIT(DT_RELACOUNT, tags_relacount_cfnp) };
+ static const conv_ds_msg_t ds_relacount_nf = {
+ CONV_DS_MSG_INIT(DT_RELACOUNT, tags_relacount_nf) };
/*
- * DT_LOPROC - DT_HIPROC range.
+ * DT_LOPROC - DT_HIPROC range: solaris/sparc-only
*/
- static const Msg tags_auxiliary[] = {
- MSG_DYN_AUXILIARY, MSG_DYN_USED,
- MSG_DYN_FILTER
+ static const Msg tags_sparc_reg_cf[] = { MSG_DT_SPARC_REGISTER_CF };
+ static const Msg tags_sparc_reg_cfnp[] = { MSG_DT_SPARC_REGISTER_CFNP };
+ static const Msg tags_sparc_reg_nf[] = { MSG_DT_SPARC_REGISTER_NF };
+ static const Msg tags_sparc_reg_dmp[] = { MSG_DT_SPARC_REGISTER_DMP };
+ static const conv_ds_msg_t ds_sparc_reg_cf = {
+ CONV_DS_MSG_INIT(DT_SPARC_REGISTER, tags_sparc_reg_cf) };
+ static const conv_ds_msg_t ds_sparc_reg_cfnp = {
+ CONV_DS_MSG_INIT(DT_SPARC_REGISTER, tags_sparc_reg_cfnp) };
+ static const conv_ds_msg_t ds_sparc_reg_nf = {
+ CONV_DS_MSG_INIT(DT_SPARC_REGISTER, tags_sparc_reg_nf) };
+ static const conv_ds_msg_t ds_sparc_reg_dmp = {
+ CONV_DS_MSG_INIT(DT_SPARC_REGISTER, tags_sparc_reg_dmp) };
+
+ /*
+ * DT_LOPROC - DT_HIPROC range: Solaris osabi, all hardware
+ */
+ static const Msg tags_auxiliary_cf[] = {
+ MSG_DT_AUXILIARY_CF, MSG_DT_USED_CF,
+ MSG_DT_FILTER_CF
+ };
+ static const Msg tags_auxiliary_cfnp[] = {
+ MSG_DT_AUXILIARY_CFNP, MSG_DT_USED_CFNP,
+ MSG_DT_FILTER_CFNP
};
+ static const Msg tags_auxiliary_nf[] = {
+ MSG_DT_AUXILIARY_NF, MSG_DT_USED_NF,
+ MSG_DT_FILTER_NF
+ };
+ static const conv_ds_msg_t ds_auxiliary_cf = {
+ CONV_DS_MSG_INIT(DT_AUXILIARY, tags_auxiliary_cf) };
+ static const conv_ds_msg_t ds_auxiliary_cfnp = {
+ CONV_DS_MSG_INIT(DT_AUXILIARY, tags_auxiliary_cfnp) };
+ static const conv_ds_msg_t ds_auxiliary_nf = {
+ CONV_DS_MSG_INIT(DT_AUXILIARY, tags_auxiliary_nf) };
+ static const conv_ds_t *retarr[MAX_RET];
+ int ndx = 0;
+ int fmt_osabi = CONV_TYPE_FMT_ALT(fmt_flags);
+ int mach_sparc, osabi_solaris, osabi_linux;
- if (tag <= DT_FLAGS) {
- /* use 'dump' style? */
- if (CONV_TYPE_FMT_ALT(fmt_flags) == CONV_FMT_ALT_DUMP)
- return (conv_map2str(inv_buf, tag, fmt_flags,
- ARRAY_NELTS(tags_null_alt), tags_null_alt));
- /* Standard style */
- return (conv_map2str(inv_buf, tag, fmt_flags,
- ARRAY_NELTS(tags_null), tags_null));
- }
- DYN_RANGE(DT_PREINIT_ARRAY, tags_preinit_array);
- DYN_RANGE(DT_SUNW_AUXILIARY, tags_sunw_auxiliary);
- if (tag == DT_SUNW_STRPAD)
- return (MSG_ORIG(MSG_DYN_SUNW_STRPAD));
- if (tag == DT_SUNW_LDMACH)
- return (MSG_ORIG(MSG_DYN_SUNW_LDMACH));
- DYN_RANGE(DT_CHECKSUM, tags_checksum);
- DYN_RANGE(DT_CONFIG, tags_config);
- if (tag == DT_VERSYM)
- return (MSG_ORIG(MSG_DYN_VERSYM));
- DYN_RANGE(DT_RELACOUNT, tags_relacount);
- DYN_RANGE(DT_AUXILIARY, tags_auxiliary);
+
+
+ osabi_solaris = (osabi == ELFOSABI_NONE) ||
+ (osabi == ELFOSABI_SOLARIS) || (osabi == CONV_OSABI_ALL);
+ osabi_linux = (osabi == ELFOSABI_LINUX) || (osabi == CONV_OSABI_ALL);
+ mach_sparc = (mach == EM_SPARC) || (mach == EM_SPARCV9) ||
+ (mach == EM_SPARC32PLUS) || (mach == CONV_MACH_ALL);
/*
- * SUNW: machine specific range.
+ * Fill in retarr with the descriptors for the messages that
+ * apply to the current osabi. Note that we order these items such
+ * that the more common are placed at the beginning, and the less
+ * likely at the end. This should speed the common case.
+ *
+ * Note that the CFNP and DMP styles are very similar, so they
+ * are combined in 'default', and fmt_osabi is consulted when there
+ * are differences.
*/
- if (((mach == EM_SPARC) || (mach == EM_SPARCV9) ||
- (mach == EM_SPARC32PLUS)) && (tag == DT_SPARC_REGISTER))
- /* this is so x86 can display a sparc binary */
- return (MSG_ORIG(MSG_DYN_REGISTER));
-
- if (tag == DT_DEPRECATED_SPARC_REGISTER)
- return (MSG_ORIG(MSG_DYN_REGISTER));
+ switch (fmt_osabi) {
+ case CONV_FMT_ALT_CF:
+ retarr[ndx++] = CONV_DS_ADDR(ds_null_cf);
+ if (osabi_solaris)
+ retarr[ndx++] = CONV_DS_ADDR(ds_sunw_auxiliary_cf);
+ retarr[ndx++] = CONV_DS_ADDR(ds_checksum_cf);
+ retarr[ndx++] = CONV_DS_ADDR(ds_config_cf);
+ retarr[ndx++] = CONV_DS_ADDR(ds_versym_cf);
+ retarr[ndx++] = CONV_DS_ADDR(ds_relacount_cf);
+ if (osabi_solaris) {
+ retarr[ndx++] = CONV_DS_ADDR(ds_auxiliary_cf);
+ if (mach_sparc) {
+ retarr[ndx++] = CONV_DS_ADDR(ds_sparc_reg_cf);
+ retarr[ndx++] = CONV_DS_ADDR(ds_sdreg_cf);
+ }
+ }
+ if (osabi_linux) {
+ retarr[ndx++] = CONV_DS_ADDR(ds_gnu_prelinked_cf);
+ retarr[ndx++] = CONV_DS_ADDR(ds_gnu_hash_cf);
+ }
+ break;
+
+ case CONV_FMT_ALT_NF:
+ retarr[ndx++] = CONV_DS_ADDR(ds_null_nf);
+ if (osabi_solaris)
+ retarr[ndx++] = CONV_DS_ADDR(ds_sunw_auxiliary_nf);
+ retarr[ndx++] = CONV_DS_ADDR(ds_checksum_nf);
+ retarr[ndx++] = CONV_DS_ADDR(ds_config_nf);
+ retarr[ndx++] = CONV_DS_ADDR(ds_versym_nf);
+ retarr[ndx++] = CONV_DS_ADDR(ds_relacount_nf);
+ if (osabi_solaris) {
+ retarr[ndx++] = CONV_DS_ADDR(ds_auxiliary_nf);
+ if (mach_sparc) {
+ retarr[ndx++] = CONV_DS_ADDR(ds_sparc_reg_nf);
+ retarr[ndx++] = CONV_DS_ADDR(ds_sdreg_nf);
+ }
+ }
+ if (osabi_linux) {
+ retarr[ndx++] = CONV_DS_ADDR(ds_gnu_prelinked_nf);
+ retarr[ndx++] = CONV_DS_ADDR(ds_gnu_hash_nf);
+ }
+ break;
+ default:
+ /*
+ * The default style for the generic range is CFNP,
+ * while dump has a couple of different strings.
+ */
+
+ retarr[ndx++] = (fmt_osabi == CONV_FMT_ALT_DUMP) ?
+ CONV_DS_ADDR(ds_null_dmp) : CONV_DS_ADDR(ds_null_cfnp);
+ if (osabi_solaris)
+ retarr[ndx++] = CONV_DS_ADDR(ds_sunw_auxiliary_cfnp);
+ retarr[ndx++] = CONV_DS_ADDR(ds_checksum_cfnp);
+ retarr[ndx++] = CONV_DS_ADDR(ds_config_cfnp);
+ retarr[ndx++] = CONV_DS_ADDR(ds_versym_cfnp);
+ retarr[ndx++] = CONV_DS_ADDR(ds_relacount_cfnp);
+ if (osabi_solaris) {
+ retarr[ndx++] = CONV_DS_ADDR(ds_auxiliary_cfnp);
+ if (mach_sparc) {
+ /*
+ * The default style for DT_SPARC_REGISTER
+ * is the dump style, which omits the 'SPARC_'.
+ * CFNP keeps the prefix.
+ */
+ retarr[ndx++] =
+ (fmt_osabi == CONV_FMT_ALT_CFNP) ?
+ CONV_DS_ADDR(ds_sparc_reg_cfnp) :
+ CONV_DS_ADDR(ds_sparc_reg_dmp);
+ retarr[ndx++] = CONV_DS_ADDR(ds_sdreg_cfnp);
+ }
+ }
+ if (osabi_linux) {
+ retarr[ndx++] = CONV_DS_ADDR(ds_gnu_prelinked_cfnp);
+ retarr[ndx++] = CONV_DS_ADDR(ds_gnu_hash_cfnp);
+ }
+ break;
+ }
- /* Unknown item */
- return (conv_invalid_val(inv_buf, tag, fmt_flags));
+ retarr[ndx++] = NULL;
+ assert(ndx <= MAX_RET);
+ return (retarr);
+}
-#undef DYN_RANGE
+conv_iter_ret_t
+conv_iter_dyn_tag(conv_iter_osabi_t osabi, Half mach,
+ Conv_fmt_flags_t fmt_flags, conv_iter_cb_t func, void *uvalue)
+{
+ return (conv_iter_ds(osabi, mach,
+ conv_dyn_tag_strings(osabi, mach, fmt_flags), func, uvalue));
}
-#define BINDTSZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
+
+#define BINDTSZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
MSG_BND_NEEDED_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
MSG_BND_REFER_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
MSG_BND_FILTER_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
@@ -476,21 +896,21 @@ conv_dyn_tag(Xword tag, Half mach, Conv_fmt_flags_t fmt_flags,
const char *
conv_bnd_type(uint_t flags, Conv_bnd_type_buf_t *bnd_type_buf)
{
- static Val_desc vda[] = {
- { BND_NEEDED, MSG_ORIG(MSG_BND_NEEDED) },
- { BND_REFER, MSG_ORIG(MSG_BND_REFER) },
- { BND_FILTER, MSG_ORIG(MSG_BND_FILTER) },
+ static const Val_desc vda[] = {
+ { BND_NEEDED, MSG_BND_NEEDED },
+ { BND_REFER, MSG_BND_REFER },
+ { BND_FILTER, MSG_BND_FILTER },
{ 0, 0 }
};
static CONV_EXPN_FIELD_ARG conv_arg = {
- NULL, sizeof (bnd_type_buf->buf), vda };
+ NULL, sizeof (bnd_type_buf->buf) };
if (flags == 0)
return (MSG_ORIG(MSG_STR_EMPTY));
conv_arg.buf = bnd_type_buf->buf;
conv_arg.oflags = conv_arg.rflags = flags;
- (void) conv_expn_field(&conv_arg, 0);
+ (void) conv_expn_field(&conv_arg, vda, 0);
return ((const char *)bnd_type_buf->buf);
}
@@ -524,15 +944,15 @@ conv_bnd_type(uint_t flags, Conv_bnd_type_buf_t *bnd_type_buf)
const char *
conv_bnd_obj(uint_t flags, Conv_bnd_obj_buf_t *bnd_obj_buf)
{
- static Val_desc vda[] = {
- { LML_FLG_OBJADDED, MSG_ORIG(MSG_BND_ADDED) },
- { LML_FLG_OBJREEVAL, MSG_ORIG(MSG_BND_REEVAL) },
- { LML_FLG_OBJDELETED, MSG_ORIG(MSG_BND_DELETED) },
- { LML_FLG_ATEXIT, MSG_ORIG(MSG_BND_ATEXIT) },
+ static const Val_desc vda[] = {
+ { LML_FLG_OBJADDED, MSG_BND_ADDED },
+ { LML_FLG_OBJREEVAL, MSG_BND_REEVAL },
+ { LML_FLG_OBJDELETED, MSG_BND_DELETED },
+ { LML_FLG_ATEXIT, MSG_BND_ATEXIT },
{ 0, 0 }
};
static CONV_EXPN_FIELD_ARG conv_arg = {
- NULL, sizeof (bnd_obj_buf->buf), vda };
+ NULL, sizeof (bnd_obj_buf->buf) };
if ((flags & (LML_FLG_OBJADDED | LML_FLG_OBJREEVAL |
LML_FLG_OBJDELETED | LML_FLG_ATEXIT)) == 0)
@@ -545,7 +965,7 @@ conv_bnd_obj(uint_t flags, Conv_bnd_obj_buf_t *bnd_obj_buf)
*/
conv_arg.buf = bnd_obj_buf->buf;
conv_arg.oflags = flags;
- (void) conv_expn_field(&conv_arg, 0);
+ (void) conv_expn_field(&conv_arg, vda, 0);
return ((const char *)bnd_obj_buf->buf);
}
diff --git a/usr/src/cmd/sgs/libconv/common/dynamic.msg b/usr/src/cmd/sgs/libconv/common/dynamic.msg
index 5354b944af..ef4d5aa023 100644
--- a/usr/src/cmd/sgs/libconv/common/dynamic.msg
+++ b/usr/src/cmd/sgs/libconv/common/dynamic.msg
@@ -20,133 +20,384 @@
#
#
-# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
-
-@ MSG_DYN_NULL "NULL"
-@ MSG_DYN_NEEDED "NEEDED"
-@ MSG_DYN_PLTRELSZ "PLTRELSZ"
-@ MSG_DYN_PLTRELSZ_ALT "PLTSZ"
-@ MSG_DYN_PLTGOT "PLTGOT"
-@ MSG_DYN_HASH "HASH"
-@ MSG_DYN_STRTAB "STRTAB"
-@ MSG_DYN_SYMTAB "SYMTAB"
-@ MSG_DYN_RELA "RELA"
-@ MSG_DYN_RELASZ "RELASZ"
-@ MSG_DYN_RELAENT "RELAENT"
-@ MSG_DYN_STRSZ "STRSZ"
-@ MSG_DYN_SYMENT "SYMENT"
-@ MSG_DYN_INIT "INIT"
-@ MSG_DYN_FINI "FINI"
-@ MSG_DYN_SONAME "SONAME"
-@ MSG_DYN_RPATH "RPATH"
-@ MSG_DYN_SYMBOLIC "SYMBOLIC"
-@ MSG_DYN_SYMBOLIC_ALT "SYMB"
-@ MSG_DYN_REL "REL"
-@ MSG_DYN_RELSZ "RELSZ"
-@ MSG_DYN_RELENT "RELENT"
-@ MSG_DYN_PLTPAD "PLTPAD"
-@ MSG_DYN_PLTPADSZ "PLTPADSZ"
-@ MSG_DYN_PLTREL "PLTREL"
-@ MSG_DYN_DEBUG "DEBUG"
-@ MSG_DYN_TEXTREL "TEXTREL"
-@ MSG_DYN_JMPREL "JMPREL"
-@ MSG_DYN_BIND_NOW "BIND_NOW"
-@ MSG_DYN_INIT_ARRAY "INIT_ARRAY"
-@ MSG_DYN_FINI_ARRAY "FINI_ARRAY"
-@ MSG_DYN_INIT_ARRAYSZ "INIT_ARRAYSZ"
-@ MSG_DYN_FINI_ARRAYSZ "FINI_ARRAYSZ"
-@ MSG_DYN_RUNPATH "RUNPATH"
-@ MSG_DYN_FLAGS "FLAGS"
-@ MSG_DYN_PREINIT_ARRAY "PREINIT_ARRAY"
-@ MSG_DYN_PREINIT_ARRAYSZ "PREINIT_ARRAYSZ"
-
-@ MSG_DYN_RELACOUNT "RELACOUNT"
-@ MSG_DYN_RELCOUNT "RELCOUNT"
-@ MSG_DYN_FLAGS_1 "FLAGS_1"
-@ MSG_DYN_USED "USED"
-@ MSG_DYN_FILTER "FILTER"
-@ MSG_DYN_AUXILIARY "AUXILIARY"
-@ MSG_DYN_CACHE "CACHE"
-@ MSG_DYN_VERSYM "VERSYM"
-@ MSG_DYN_VERDEF "VERDEF"
-@ MSG_DYN_VERDEFNUM "VERDEFNUM"
-@ MSG_DYN_VERNEED "VERNEED"
-@ MSG_DYN_VERNEEDNUM "VERNEEDNUM"
-@ MSG_DYN_SYMINFO "SYMINFO"
-@ MSG_DYN_SYMINSZ "SYMINSZ"
-@ MSG_DYN_SYMINENT "SYMINENT"
-@ MSG_DYN_POSFLAG_1 "POSFLAG_1"
-@ MSG_DYN_FEATURE_1 "FEATURE_1"
-@ MSG_DYN_MOVESZ "MOVESZ"
-@ MSG_DYN_MOVEENT "MOVEENT"
-@ MSG_DYN_MOVETAB "MOVETAB"
-@ MSG_DYN_REGISTER "REGISTER"
-@ MSG_DYN_CHECKSUM "CHECKSUM"
-@ MSG_DYN_PLTRESERVE "PLT_RESERVE"
-@ MSG_DYN_DEPAUDIT "DEPAUDIT"
-@ MSG_DYN_AUDIT "AUDIT"
-@ MSG_DYN_CONFIG "CONFIG"
-@ MSG_DYN_SUNW_AUXILIARY "SUNW_AUXILIARY"
-@ MSG_DYN_SUNW_RTLDINF "SUNW_RTLDINF"
-@ MSG_DYN_SUNW_FILTER "SUNW_FILTER"
-@ MSG_DYN_SUNW_CAP "SUNW_CAP"
-@ MSG_DYN_SUNW_SYMTAB "SUNW_SYMTAB"
-@ MSG_DYN_SUNW_SYMSZ "SUNW_SYMSZ"
-@ MSG_DYN_SUNW_SORTENT "SUNW_SORTENT"
-@ MSG_DYN_SUNW_SYMSORT "SUNW_SYMSORT"
-@ MSG_DYN_SUNW_SYMSORTSZ "SUNW_SYMSORTSZ"
-@ MSG_DYN_SUNW_TLSSORT "SUNW_TLSSORT"
-@ MSG_DYN_SUNW_TLSSORTSZ "SUNW_TLSSORTSZ"
-@ MSG_DYN_SUNW_STRPAD "SUNW_STRPAD"
-@ MSG_DYN_SUNW_LDMACH "SUNW_LDMACH"
-
-@ MSG_DF_ORIGIN "ORIGIN"
-@ MSG_DF_SYMBOLIC "SYMBOLIC"
-@ MSG_DF_TEXTREL "TEXTREL"
-@ MSG_DF_BIND_NOW "BIND_NOW"
-@ MSG_DF_STATIC_TLS "STATIC_TLS"
-
-@ MSG_DF1_NOW "NOW"
-@ MSG_DF1_GLOBAL "GLOBAL"
-@ MSG_DF1_GROUP "GROUP"
-@ MSG_DF1_NODELETE "NODELETE"
-@ MSG_DF1_LOADFLTR "LOADFLTR"
-@ MSG_DF1_INITFIRST "INITFIRST"
-@ MSG_DF1_INTERPOSE "OBJECT-INTERPOSE"
-@ MSG_DF1_NOOPEN "NOOPEN"
-@ MSG_DF1_ORIGIN "ORIGIN"
-@ MSG_DF1_DIRECT "DIRECT"
-@ MSG_DF1_TRANS "TRANS"
-@ MSG_DF1_NODEFLIB "NODEFLIB"
-@ MSG_DF1_NODUMP "NODUMP"
-@ MSG_DF1_CONFALT "CONFALT"
-@ MSG_DF1_ENDFILTEE "ENDFILTEE"
-@ MSG_DF1_DISPRELPND "DISPLACE-RELOCS-PEND"
-@ MSG_DF1_DISPRELDNE "DISPLACE-RELOCS-DONE"
-@ MSG_DF1_NODIRECT "NODIRECT"
-@ MSG_DF1_IGNMULDEF "IGNORE-MULDEFS"
-@ MSG_DF1_NOKSYMS "NOKSYMS"
-@ MSG_DF1_NOHDR "NOHDR"
-@ MSG_DF1_EDITED "EDITED"
-@ MSG_DF1_NORELOC "NORELOC"
-@ MSG_DF1_SYMINTPOSE "SYMBOL-INTERPOSE"
-@ MSG_DF1_GLOBAUDIT "GLOBAL-AUDITING"
-@ MSG_DF1_SINGLETON "SINGLETON-EXISTS"
-
-@ MSG_DFP_LAZYLOAD "LAZY"
-@ MSG_DFP_LAZYLOAD_ALT "LAZYLOAD"
-@ MSG_DFP_GROUPPERM "GROUPPERM"
-
-@ MSG_DTF_PARINIT "PARINIT"
-@ MSG_DTF_CONFEXP "CONFEXP"
+
+@ MSG_DT_NULL_CF "DT_NULL" # 0
+@ MSG_DT_NULL_CFNP "NULL"
+@ MSG_DT_NULL_NF "null"
+@ MSG_DT_NEEDED_CF "DT_NEEDED" # 1
+@ MSG_DT_NEEDED_CFNP "NEEDED"
+@ MSG_DT_NEEDED_NF "needed"
+@ MSG_DT_PLTRELSZ_CF "DT_PLTRELSZ" # 2
+@ MSG_DT_PLTRELSZ_CFNP "PLTRELSZ"
+@ MSG_DT_PLTRELSZ_NF "pltrelsz"
+@ MSG_DT_PLTRELSZ_DMP "PLTSZ"
+@ MSG_DT_PLTGOT_CF "DT_PLTGOT" # 3
+@ MSG_DT_PLTGOT_CFNP "PLTGOT"
+@ MSG_DT_PLTGOT_NF "pltgot"
+@ MSG_DT_HASH_CF "DT_HASH" # 4
+@ MSG_DT_HASH_CFNP "HASH"
+@ MSG_DT_HASH_NF "hash"
+@ MSG_DT_STRTAB_CF "DT_STRTAB" # 5
+@ MSG_DT_STRTAB_CFNP "STRTAB"
+@ MSG_DT_STRTAB_NF "strtab"
+@ MSG_DT_SYMTAB_CF "DT_SYMTAB" # 6
+@ MSG_DT_SYMTAB_CFNP "SYMTAB"
+@ MSG_DT_SYMTAB_NF "symtab"
+@ MSG_DT_RELA_CF "DT_RELA" # 7
+@ MSG_DT_RELA_CFNP "RELA"
+@ MSG_DT_RELA_NF "rela"
+@ MSG_DT_RELASZ_CF "DT_RELASZ" # 8
+@ MSG_DT_RELASZ_CFNP "RELASZ"
+@ MSG_DT_RELASZ_NF "relasz"
+@ MSG_DT_RELAENT_CF "DT_RELAENT" # 9
+@ MSG_DT_RELAENT_CFNP "RELAENT"
+@ MSG_DT_RELAENT_NF "relaent"
+@ MSG_DT_STRSZ_CF "DT_STRSZ" # 10
+@ MSG_DT_STRSZ_CFNP "STRSZ"
+@ MSG_DT_STRSZ_NF "strsz"
+@ MSG_DT_SYMENT_CF "DT_SYMENT" # 11
+@ MSG_DT_SYMENT_CFNP "SYMENT"
+@ MSG_DT_SYMENT_NF "syment"
+@ MSG_DT_INIT_CF "DT_INIT" # 12
+@ MSG_DT_INIT_CFNP "INIT"
+@ MSG_DT_INIT_NF "init"
+@ MSG_DT_FINI_CF "DT_FINI" # 13
+@ MSG_DT_FINI_CFNP "FINI"
+@ MSG_DT_FINI_NF "fini"
+@ MSG_DT_SONAME_CF "DT_SONAME" # 14
+@ MSG_DT_SONAME_CFNP "SONAME"
+@ MSG_DT_SONAME_NF "soname"
+@ MSG_DT_RPATH_CF "DT_RPATH" # 15
+@ MSG_DT_RPATH_CFNP "RPATH"
+@ MSG_DT_RPATH_NF "rpath"
+@ MSG_DT_SYMBOLIC_CF "DT_SYMBOLIC" # 16
+@ MSG_DT_SYMBOLIC_CFNP "SYMBOLIC"
+@ MSG_DT_SYMBOLIC_NF "symbolic"
+@ MSG_DT_SYMBOLIC_DMP "SYMB"
+@ MSG_DT_REL_CF "DT_REL" # 17
+@ MSG_DT_REL_CFNP "REL"
+@ MSG_DT_REL_NF "rel"
+@ MSG_DT_RELSZ_CF "DT_RELSZ" # 18
+@ MSG_DT_RELSZ_CFNP "RELSZ"
+@ MSG_DT_RELSZ_NF "relsz"
+@ MSG_DT_RELENT_CF "DT_RELENT" # 19
+@ MSG_DT_RELENT_CFNP "RELENT"
+@ MSG_DT_RELENT_NF "relent"
+@ MSG_DT_PLTREL_CF "DT_PLTREL" # 20
+@ MSG_DT_PLTREL_CFNP "PLTREL"
+@ MSG_DT_PLTREL_NF "pltrel"
+@ MSG_DT_DEBUG_CF "DT_DEBUG" # 21
+@ MSG_DT_DEBUG_CFNP "DEBUG"
+@ MSG_DT_DEBUG_NF "debug"
+@ MSG_DT_TEXTREL_CF "DT_TEXTREL" # 22
+@ MSG_DT_TEXTREL_CFNP "TEXTREL"
+@ MSG_DT_TEXTREL_NF "textrel"
+@ MSG_DT_JMPREL_CF "DT_JMPREL" # 23
+@ MSG_DT_JMPREL_CFNP "JMPREL"
+@ MSG_DT_JMPREL_NF "jmprel"
+@ MSG_DT_BIND_NOW_CF "DT_BIND_NOW" # 24
+@ MSG_DT_BIND_NOW_CFNP "BIND_NOW"
+@ MSG_DT_BIND_NOW_NF "bind_now"
+@ MSG_DT_INIT_ARRAY_CF "DT_INIT_ARRAY" # 25
+@ MSG_DT_INIT_ARRAY_CFNP "INIT_ARRAY"
+@ MSG_DT_INIT_ARRAY_NF "init_array"
+@ MSG_DT_FINI_ARRAY_CF "DT_FINI_ARRAY" # 26
+@ MSG_DT_FINI_ARRAY_CFNP "FINI_ARRAY"
+@ MSG_DT_FINI_ARRAY_NF "fini_array"
+@ MSG_DT_INIT_ARRAYSZ_CF "DT_INIT_ARRAYSZ" # 27
+@ MSG_DT_INIT_ARRAYSZ_CFNP "INIT_ARRAYSZ"
+@ MSG_DT_INIT_ARRAYSZ_NF "init_arraysz"
+@ MSG_DT_FINI_ARRAYSZ_CF "DT_FINI_ARRAYSZ" # 28
+@ MSG_DT_FINI_ARRAYSZ_CFNP "FINI_ARRAYSZ"
+@ MSG_DT_FINI_ARRAYSZ_NF "fini_arraysz"
+@ MSG_DT_RUNPATH_CF "DT_RUNPATH" # 29
+@ MSG_DT_RUNPATH_CFNP "RUNPATH"
+@ MSG_DT_RUNPATH_NF "runpath"
+@ MSG_DT_FLAGS_CF "DT_FLAGS" # 30
+@ MSG_DT_FLAGS_CFNP "FLAGS"
+@ MSG_DT_FLAGS_NF "flags"
+@ MSG_DT_PREINIT_ARRAY_CF "DT_PREINIT_ARRAY" # 32
+@ MSG_DT_PREINIT_ARRAY_CFNP "PREINIT_ARRAY"
+@ MSG_DT_PREINIT_ARRAY_NF "preinit_array"
+@ MSG_DT_PREINIT_ARRAYSZ_CF "DT_PREINIT_ARRAYSZ" # 33
+@ MSG_DT_PREINIT_ARRAYSZ_CFNP "PREINIT_ARRAYSZ"
+@ MSG_DT_PREINIT_ARRAYSZ_NF "preinit_arraysz"
+@ MSG_DT_DEP_SPARC_REG_CF "DT_DEPRECATED_SPARC_REGISTER" # 0x07000001
+@ MSG_DT_DEP_SPARC_REG_CFNP "DEPRECATED_SPARC_REGISTER"
+@ MSG_DT_DEP_SPARC_REG_NF "deprecated_sparc_register"
+@ MSG_DT_SUNW_AUXILIARY_CF "DT_SUNW_AUXILIARY" # 0x6000000d
+@ MSG_DT_SUNW_AUXILIARY_CFNP "SUNW_AUXILIARY"
+@ MSG_DT_SUNW_AUXILIARY_NF "sunw_auxiliary"
+@ MSG_DT_SUNW_RTLDINF_CF "DT_SUNW_RTLDINF" # 0x6000000e
+@ MSG_DT_SUNW_RTLDINF_CFNP "SUNW_RTLDINF"
+@ MSG_DT_SUNW_RTLDINF_NF "sunw_rtldinf"
+@ MSG_DT_SUNW_FILTER_CF "DT_SUNW_FILTER" # 0x6000000f
+@ MSG_DT_SUNW_FILTER_CFNP "SUNW_FILTER"
+@ MSG_DT_SUNW_FILTER_NF "sunw_filter"
+@ MSG_DT_SUNW_CAP_CF "DT_SUNW_CAP" # 0x60000010
+@ MSG_DT_SUNW_CAP_CFNP "SUNW_CAP"
+@ MSG_DT_SUNW_CAP_NF "sunw_cap"
+@ MSG_DT_SUNW_SYMTAB_CF "DT_SUNW_SYMTAB" # 0x60000011
+@ MSG_DT_SUNW_SYMTAB_CFNP "SUNW_SYMTAB"
+@ MSG_DT_SUNW_SYMTAB_NF "sunw_symtab"
+@ MSG_DT_SUNW_SYMSZ_CF "DT_SUNW_SYMSZ" # 0x60000012
+@ MSG_DT_SUNW_SYMSZ_CFNP "SUNW_SYMSZ"
+@ MSG_DT_SUNW_SYMSZ_NF "sunw_symsz"
+@ MSG_DT_SUNW_SORTENT_CF "DT_SUNW_SORTENT" # 0x60000013
+@ MSG_DT_SUNW_SORTENT_CFNP "SUNW_SORTENT"
+@ MSG_DT_SUNW_SORTENT_NF "sunw_sortent"
+@ MSG_DT_SUNW_SYMSORT_CF "DT_SUNW_SYMSORT" # 0x60000014
+@ MSG_DT_SUNW_SYMSORT_CFNP "SUNW_SYMSORT"
+@ MSG_DT_SUNW_SYMSORT_NF "sunw_symsort"
+@ MSG_DT_SUNW_SYMSORTSZ_CF "DT_SUNW_SYMSORTSZ" # 0x60000015
+@ MSG_DT_SUNW_SYMSORTSZ_CFNP "SUNW_SYMSORTSZ"
+@ MSG_DT_SUNW_SYMSORTSZ_NF "sunw_symsortsz"
+@ MSG_DT_SUNW_TLSSORT_CF "DT_SUNW_TLSSORT" # 0x60000016
+@ MSG_DT_SUNW_TLSSORT_CFNP "SUNW_TLSSORT"
+@ MSG_DT_SUNW_TLSSORT_NF "sunw_tlssort"
+@ MSG_DT_SUNW_TLSSORTSZ_CF "DT_SUNW_TLSSORTSZ" # 0x60000017
+@ MSG_DT_SUNW_TLSSORTSZ_CFNP "SUNW_TLSSORTSZ"
+@ MSG_DT_SUNW_TLSSORTSZ_NF "sunw_tlssortsz"
+@ MSG_DT_SUNW_STRPAD_CF "DT_SUNW_STRPAD" # 0x60000019
+@ MSG_DT_SUNW_STRPAD_CFNP "SUNW_STRPAD"
+@ MSG_DT_SUNW_STRPAD_NF "sunw_strpad"
+@ MSG_DT_SUNW_LDMACH_CF "DT_SUNW_LDMACH" # 0x6000001b
+@ MSG_DT_SUNW_LDMACH_CFNP "SUNW_LDMACH"
+@ MSG_DT_SUNW_LDMACH_NF "sunw_ldmach"
+@ MSG_DT_GNU_PRELINKED_CF "DT_GNU_PRELINKED" # 0x6ffffdf5
+@ MSG_DT_GNU_PRELINKED_CFNP "GNU_PRELINKED"
+@ MSG_DT_GNU_PRELINKED_NF "gnu_prelinked"
+@ MSG_DT_GNU_CONFLICTSZ_CF "DT_GNU_CONFLICTSZ" # 0x6ffffdf6
+@ MSG_DT_GNU_CONFLICTSZ_CFNP "GNU_CONFLICTSZ"
+@ MSG_DT_GNU_CONFLICTSZ_NF "gnu_conflictsz"
+@ MSG_DT_GNU_LIBLISTSZ_CF "DT_GNU_LIBLISTSZ" # 0x6ffffdf7
+@ MSG_DT_GNU_LIBLISTSZ_CFNP "GNU_LIBLISTSZ"
+@ MSG_DT_GNU_LIBLISTSZ_NF "gnu_liblistsz"
+@ MSG_DT_CHECKSUM_CF "DT_CHECKSUM" # 0x6ffffdf8
+@ MSG_DT_CHECKSUM_CFNP "CHECKSUM"
+@ MSG_DT_CHECKSUM_NF "checksum"
+@ MSG_DT_PLTPADSZ_CF "DT_PLTPADSZ" # 0x6ffffdf9
+@ MSG_DT_PLTPADSZ_CFNP "PLTPADSZ"
+@ MSG_DT_PLTPADSZ_NF "pltpadsz"
+@ MSG_DT_MOVEENT_CF "DT_MOVEENT" # 0x6ffffdfa
+@ MSG_DT_MOVEENT_CFNP "MOVEENT"
+@ MSG_DT_MOVEENT_NF "moveent"
+@ MSG_DT_MOVESZ_CF "DT_MOVESZ" # 0x6ffffdfb
+@ MSG_DT_MOVESZ_CFNP "MOVESZ"
+@ MSG_DT_MOVESZ_NF "movesz"
+@ MSG_DT_FEATURE_1_CF "DT_FEATURE_1" # 0x6ffffdfc
+@ MSG_DT_FEATURE_1_CFNP "FEATURE_1"
+@ MSG_DT_FEATURE_1_NF "feature_1"
+@ MSG_DT_POSFLAG_1_CF "DT_POSFLAG_1" # 0x6ffffdfd
+@ MSG_DT_POSFLAG_1_CFNP "POSFLAG_1"
+@ MSG_DT_POSFLAG_1_NF "posflag_1"
+@ MSG_DT_SYMINSZ_CF "DT_SYMINSZ" # 0x6ffffdfe
+@ MSG_DT_SYMINSZ_CFNP "SYMINSZ"
+@ MSG_DT_SYMINSZ_NF "syminsz"
+@ MSG_DT_SYMINENT_CF "DT_SYMINENT" # 0x6ffffdff
+@ MSG_DT_SYMINENT_CFNP "SYMINENT"
+@ MSG_DT_SYMINENT_NF "syminent"
+@ MSG_DT_GNU_HASH_CF "DT_GNU_HASH" # 0x6ffffef5
+@ MSG_DT_GNU_HASH_CFNP "GNU_HASH"
+@ MSG_DT_GNU_HASH_NF "gnu_hash"
+@ MSG_DT_TLSDESC_PLT_CF "DT_TLSDESC_PLT" # 0x6ffffef6
+@ MSG_DT_TLSDESC_PLT_CFNP "TLSDESC_PLT"
+@ MSG_DT_TLSDESC_PLT_NF "tlsdesc_plt"
+@ MSG_DT_TLSDESC_GOT_CF "DT_TLSDESC_GOT" # 0x6ffffef7
+@ MSG_DT_TLSDESC_GOT_CFNP "TLSDESC_GOT"
+@ MSG_DT_TLSDESC_GOT_NF "tlsdesc_got"
+@ MSG_DT_GNU_CONFLICT_CF "DT_GNU_CONFLICT" # 0x6ffffef8
+@ MSG_DT_GNU_CONFLICT_CFNP "GNU_CONFLICT"
+@ MSG_DT_GNU_CONFLICT_NF "gnu_conflict"
+@ MSG_DT_GNU_LIBLIST_CF "DT_GNU_LIBLIST" # 0x6ffffef9
+@ MSG_DT_GNU_LIBLIST_CFNP "GNU_LIBLIST"
+@ MSG_DT_GNU_LIBLIST_NF "gnu_liblist"
+@ MSG_DT_CONFIG_CF "DT_CONFIG" # 0x6ffffefa
+@ MSG_DT_CONFIG_CFNP "CONFIG"
+@ MSG_DT_CONFIG_NF "config"
+@ MSG_DT_DEPAUDIT_CF "DT_DEPAUDIT" # 0x6ffffefb
+@ MSG_DT_DEPAUDIT_CFNP "DEPAUDIT"
+@ MSG_DT_DEPAUDIT_NF "depaudit"
+@ MSG_DT_AUDIT_CF "DT_AUDIT" # 0x6ffffefc
+@ MSG_DT_AUDIT_CFNP "AUDIT"
+@ MSG_DT_AUDIT_NF "audit"
+@ MSG_DT_PLTPAD_CF "DT_PLTPAD" # 0x6ffffefd
+@ MSG_DT_PLTPAD_CFNP "PLTPAD"
+@ MSG_DT_PLTPAD_NF "pltpad"
+@ MSG_DT_MOVETAB_CF "DT_MOVETAB" # 0x6ffffefe
+@ MSG_DT_MOVETAB_CFNP "MOVETAB"
+@ MSG_DT_MOVETAB_NF "movetab"
+@ MSG_DT_SYMINFO_CF "DT_SYMINFO" # 0x6ffffeff
+@ MSG_DT_SYMINFO_CFNP "SYMINFO"
+@ MSG_DT_SYMINFO_NF "syminfo"
+@ MSG_DT_VERSYM_CF "DT_VERSYM" # 0x6ffffff0
+@ MSG_DT_VERSYM_CFNP "VERSYM"
+@ MSG_DT_VERSYM_NF "versym"
+@ MSG_DT_RELACOUNT_CF "DT_RELACOUNT" # 0x6ffffff9
+@ MSG_DT_RELACOUNT_CFNP "RELACOUNT"
+@ MSG_DT_RELACOUNT_NF "relacount"
+@ MSG_DT_RELCOUNT_CF "DT_RELCOUNT" # 0x6ffffffa
+@ MSG_DT_RELCOUNT_CFNP "RELCOUNT"
+@ MSG_DT_RELCOUNT_NF "relcount"
+@ MSG_DT_FLAGS_1_CF "DT_FLAGS_1" # 0x6ffffffb
+@ MSG_DT_FLAGS_1_CFNP "FLAGS_1"
+@ MSG_DT_FLAGS_1_NF "flags_1"
+@ MSG_DT_VERDEF_CF "DT_VERDEF" # 0x6ffffffc
+@ MSG_DT_VERDEF_CFNP "VERDEF"
+@ MSG_DT_VERDEF_NF "verdef"
+@ MSG_DT_VERDEFNUM_CF "DT_VERDEFNUM" # 0x6ffffffd
+@ MSG_DT_VERDEFNUM_CFNP "VERDEFNUM"
+@ MSG_DT_VERDEFNUM_NF "verdefnum"
+@ MSG_DT_VERNEED_CF "DT_VERNEED" # 0x6ffffffe
+@ MSG_DT_VERNEED_CFNP "VERNEED"
+@ MSG_DT_VERNEED_NF "verneed"
+@ MSG_DT_VERNEEDNUM_CF "DT_VERNEEDNUM" # 0x6fffffff
+@ MSG_DT_VERNEEDNUM_CFNP "VERNEEDNUM"
+@ MSG_DT_VERNEEDNUM_NF "verneednum"
+@ MSG_DT_SPARC_REGISTER_CF "DT_SPARC_REGISTER" # 0x70000001
+@ MSG_DT_SPARC_REGISTER_CFNP "SPARC_REGISTER"
+@ MSG_DT_SPARC_REGISTER_NF "sparc_register"
+@ MSG_DT_SPARC_REGISTER_DMP "REGISTER"
+@ MSG_DT_AUXILIARY_CF "DT_AUXILIARY" # 0x7ffffffd
+@ MSG_DT_AUXILIARY_CFNP "AUXILIARY"
+@ MSG_DT_AUXILIARY_NF "auxiliary"
+@ MSG_DT_USED_CF "DT_USED" # 0x7ffffffe
+@ MSG_DT_USED_CFNP "USED"
+@ MSG_DT_USED_NF "used"
+@ MSG_DT_FILTER_CF "DT_FILTER" # 0x7fffffff
+@ MSG_DT_FILTER_CFNP "FILTER"
+@ MSG_DT_FILTER_NF "filter"
+
+
+@ MSG_DF_ORIGIN_CF "DF_ORIGIN" # 0x00000001
+@ MSG_DF_ORIGIN_CFNP "ORIGIN"
+@ MSG_DF_ORIGIN_NF "origin"
+@ MSG_DF_SYMBOLIC_CF "DF_SYMBOLIC" # 0x00000002
+@ MSG_DF_SYMBOLIC_CFNP "SYMBOLIC"
+@ MSG_DF_SYMBOLIC_NF "symbolic"
+@ MSG_DF_TEXTREL_CF "DF_TEXTREL" # 0x00000004
+@ MSG_DF_TEXTREL_CFNP "TEXTREL"
+@ MSG_DF_TEXTREL_NF "textrel"
+@ MSG_DF_BIND_NOW_CF "DF_BIND_NOW" # 0x00000008
+@ MSG_DF_BIND_NOW_CFNP "BIND_NOW"
+@ MSG_DF_BIND_NOW_NF "bind_now"
+@ MSG_DF_STATIC_TLS_CF "DF_STATIC_TLS" # 0x00000010
+@ MSG_DF_STATIC_TLS_CFNP "STATIC_TLS"
+@ MSG_DF_STATIC_TLS_NF "static_tls"
+
+
+@ MSG_DF_1_NOW_CF "DF_1_NOW" # 0x00000001
+@ MSG_DF_1_NOW_CFNP "NOW"
+@ MSG_DF_1_NOW_NF "now"
+@ MSG_DF_1_GLOBAL_CF "DF_1_GLOBAL" # 0x00000002
+@ MSG_DF_1_GLOBAL_CFNP "GLOBAL"
+@ MSG_DF_1_GLOBAL_NF "global"
+@ MSG_DF_1_GROUP_CF "DF_1_GROUP" # 0x00000004
+@ MSG_DF_1_GROUP_CFNP "GROUP"
+@ MSG_DF_1_GROUP_NF "group"
+@ MSG_DF_1_NODELETE_CF "DF_1_NODELETE" # 0x00000008
+@ MSG_DF_1_NODELETE_CFNP "NODELETE"
+@ MSG_DF_1_NODELETE_NF "nodelete"
+@ MSG_DF_1_LOADFLTR_CF "DF_1_LOADFLTR" # 0x00000010
+@ MSG_DF_1_LOADFLTR_CFNP "LOADFLTR"
+@ MSG_DF_1_LOADFLTR_NF "loadfltr"
+@ MSG_DF_1_INITFIRST_CF "DF_1_INITFIRST" # 0x00000020
+@ MSG_DF_1_INITFIRST_CFNP "INITFIRST"
+@ MSG_DF_1_INITFIRST_NF "initfirst"
+@ MSG_DF_1_NOOPEN_CF "DF_1_NOOPEN" # 0x00000040
+@ MSG_DF_1_NOOPEN_CFNP "NOOPEN"
+@ MSG_DF_1_NOOPEN_NF "noopen"
+@ MSG_DF_1_ORIGIN_CF "DF_1_ORIGIN" # 0x00000080
+@ MSG_DF_1_ORIGIN_CFNP "ORIGIN"
+@ MSG_DF_1_ORIGIN_NF "origin"
+@ MSG_DF_1_DIRECT_CF "DF_1_DIRECT" # 0x00000100
+@ MSG_DF_1_DIRECT_CFNP "DIRECT"
+@ MSG_DF_1_DIRECT_NF "direct"
+@ MSG_DF_1_TRANS_CF "DF_1_TRANS" # 0x00000200
+@ MSG_DF_1_TRANS_CFNP "TRANS"
+@ MSG_DF_1_TRANS_NF "trans"
+@ MSG_DF_1_INTERPOSE_CF "DF_1_INTERPOSE" # 0x00000400
+@ MSG_DF_1_INTERPOSE_CFNP "INTERPOSE"
+@ MSG_DF_1_INTERPOSE_NF "interpose"
+@ MSG_DF_1_INTERPOSE_DEF "OBJECT-INTERPOSE"
+@ MSG_DF_1_NODEFLIB_CF "DF_1_NODEFLIB" # 0x00000800
+@ MSG_DF_1_NODEFLIB_CFNP "NODEFLIB"
+@ MSG_DF_1_NODEFLIB_NF "nodeflib"
+@ MSG_DF_1_NODUMP_CF "DF_1_NODUMP" # 0x00001000
+@ MSG_DF_1_NODUMP_CFNP "NODUMP"
+@ MSG_DF_1_NODUMP_NF "nodump"
+@ MSG_DF_1_CONFALT_CF "DF_1_CONFALT" # 0x00002000
+@ MSG_DF_1_CONFALT_CFNP "CONFALT"
+@ MSG_DF_1_CONFALT_NF "confalt"
+@ MSG_DF_1_ENDFILTEE_CF "DF_1_ENDFILTEE" # 0x00004000
+@ MSG_DF_1_ENDFILTEE_CFNP "ENDFILTEE"
+@ MSG_DF_1_ENDFILTEE_NF "endfiltee"
+@ MSG_DF_1_DISPRELDNE_CF "DF_1_DISPRELDNE" # 0x00008000
+@ MSG_DF_1_DISPRELDNE_CFNP "DISPRELDNE"
+@ MSG_DF_1_DISPRELDNE_NF "dispreldne"
+@ MSG_DF_1_DISPRELDNE_DEF "DISPLACE-RELOCS-DONE"
+@ MSG_DF_1_DISPRELPND_CF "DF_1_DISPRELPND" # 0x00010000
+@ MSG_DF_1_DISPRELPND_CFNP "DISPRELPND"
+@ MSG_DF_1_DISPRELPND_NF "disprelpnd"
+@ MSG_DF_1_DISPRELPND_DEF "DISPLACE-RELOCS-PEND"
+@ MSG_DF_1_NODIRECT_CF "DF_1_NODIRECT" # 0x00020000
+@ MSG_DF_1_NODIRECT_CFNP "NODIRECT"
+@ MSG_DF_1_NODIRECT_NF "nodirect"
+@ MSG_DF_1_IGNMULDEF_CF "DF_1_IGNMULDEF" # 0x00040000
+@ MSG_DF_1_IGNMULDEF_CFNP "IGNMULDEF"
+@ MSG_DF_1_IGNMULDEF_NF "ignmuldef"
+@ MSG_DF_1_IGNMULDEF_DEF "IGNORE-MULDEFS"
+@ MSG_DF_1_NOKSYMS_CF "DF_1_NOKSYMS" # 0x00080000
+@ MSG_DF_1_NOKSYMS_CFNP "NOKSYMS"
+@ MSG_DF_1_NOKSYMS_NF "noksyms"
+@ MSG_DF_1_NOHDR_CF "DF_1_NOHDR" # 0x00100000
+@ MSG_DF_1_NOHDR_CFNP "NOHDR"
+@ MSG_DF_1_NOHDR_NF "nohdr"
+@ MSG_DF_1_EDITED_CF "DF_1_EDITED" # 0x00200000
+@ MSG_DF_1_EDITED_CFNP "EDITED"
+@ MSG_DF_1_EDITED_NF "edited"
+@ MSG_DF_1_NORELOC_CF "DF_1_NORELOC" # 0x00400000
+@ MSG_DF_1_NORELOC_CFNP "NORELOC"
+@ MSG_DF_1_NORELOC_NF "noreloc"
+@ MSG_DF_1_SYMINTPOSE_CF "DF_1_SYMINTPOSE" # 0x00800000
+@ MSG_DF_1_SYMINTPOSE_CFNP "SYMINTPOSE"
+@ MSG_DF_1_SYMINTPOSE_NF "symintpose"
+@ MSG_DF_1_SYMINTPOSE_DEF "SYMBOL-INTERPOSE"
+@ MSG_DF_1_GLOBAUDIT_CF "DF_1_GLOBAUDIT" # 0x01000000
+@ MSG_DF_1_GLOBAUDIT_CFNP "GLOBAUDIT"
+@ MSG_DF_1_GLOBAUDIT_NF "globaudit"
+@ MSG_DF_1_GLOBAUDIT_DEF "GLOBAL-AUDITING"
+@ MSG_DF_1_SINGLETON_CF "DF_1_SINGLETON" # 0x02000000
+@ MSG_DF_1_SINGLETON_CFNP "SINGLETON"
+@ MSG_DF_1_SINGLETON_NF "singleton"
+@ MSG_DF_1_SINGLETON_DEF "SINGLETON-EXISTS"
+
+
+@ MSG_DF_P1_LAZYLOAD_CF "DF_P1_LAZYLOAD" # 0x00000001
+@ MSG_DF_P1_LAZYLOAD_CFNP "LAZYLOAD"
+@ MSG_DF_P1_LAZYLOAD_NF "lazyload"
+@ MSG_DF_P1_LAZYLOAD_DEF "LAZY"
+@ MSG_DF_P1_GROUPPERM_CF "DF_P1_GROUPPERM" # 0x00000002
+@ MSG_DF_P1_GROUPPERM_CFNP "GROUPPERM"
+@ MSG_DF_P1_GROUPPERM_NF "groupperm"
+
+
+@ MSG_DTF_1_PARINIT_CF "DTF_1_PARINIT" # 0x00000001
+@ MSG_DTF_1_PARINIT_CFNP "PARINIT"
+@ MSG_DTF_1_PARINIT_NF "parinit"
+@ MSG_DTF_1_CONFEXP_CF "DTF_1_CONFEXP" # 0x00000002
+@ MSG_DTF_1_CONFEXP_CFNP "CONFEXP"
+@ MSG_DTF_1_CONFEXP_NF "confexp"
+
@ MSG_BND_NEEDED "NEEDED"
@ MSG_BND_REFER "REFERENCED"
@ MSG_BND_FILTER "FILTER"
+
@ MSG_BND_ADDED "OBJECTS-ADDED"
@ MSG_BND_REEVAL "OBJECTS-REEVALUATED"
@ MSG_BND_DELETED "OBJECTS-DELETED"
diff --git a/usr/src/cmd/sgs/libconv/common/dynamic_machelf.c b/usr/src/cmd/sgs/libconv/common/dynamic_machelf.c
new file mode 100644
index 0000000000..beee0d797c
--- /dev/null
+++ b/usr/src/cmd/sgs/libconv/common/dynamic_machelf.c
@@ -0,0 +1,139 @@
+/*
+ * 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
+ * or http://www.opensolaris.org/os/licensing.
+ * 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.
+ */
+
+/*
+ * String conversion routine for .dynamic tag entries.
+ */
+#include <stdio.h>
+#include <string.h>
+#include <sys/elf_SPARC.h>
+#include "rtld.h"
+#include "_conv.h"
+#include "dynamic_msg.h"
+
+
+
+const char *
+conv_dyn_posflag1(Xword flags, Conv_fmt_flags_t fmt_flags,
+ Conv_dyn_posflag1_buf_t *dyn_posflag1_buf)
+{
+ static CONV_EXPN_FIELD_ARG conv_arg = {
+ NULL, sizeof (dyn_posflag1_buf->buf) };
+ static CONV_EXPN_FIELD_ARG conv_arg_alt = {
+ NULL, sizeof (dyn_posflag1_buf->buf), NULL, 0, 0,
+ MSG_ORIG(MSG_STR_EMPTY), NULL, MSG_ORIG(MSG_STR_EMPTY) };
+
+ CONV_EXPN_FIELD_ARG *arg;
+
+ if (flags == 0)
+ return (MSG_ORIG(MSG_GBL_ZERO));
+ CONV_XWORD_64TEST(flags, fmt_flags, &dyn_posflag1_buf->inv_buf);
+
+ arg = (CONV_TYPE_FMT_ALT(fmt_flags) == CONV_FMT_ALT_DUMP) ?
+ &conv_arg_alt : &conv_arg;
+ arg->buf = dyn_posflag1_buf->buf;
+ arg->oflags = arg->rflags = flags;
+ (void) conv_expn_field(arg, conv_dyn_posflag1_strings(fmt_flags),
+ fmt_flags);
+
+ return ((const char *)dyn_posflag1_buf);
+}
+
+const char *
+conv_dyn_flag(Xword flags, Conv_fmt_flags_t fmt_flags,
+ Conv_dyn_flag_buf_t *dyn_flag_buf)
+{
+ static CONV_EXPN_FIELD_ARG conv_arg = {
+ NULL, sizeof (dyn_flag_buf->buf) };
+
+ if (flags == 0)
+ return (MSG_ORIG(MSG_GBL_ZERO));
+ CONV_XWORD_64TEST(flags, fmt_flags, &dyn_flag_buf->inv_buf);
+
+ conv_arg.buf = dyn_flag_buf->buf;
+ conv_arg.oflags = conv_arg.rflags = flags;
+ if (CONV_TYPE_FMT_ALT(fmt_flags) == CONV_FMT_ALT_DUMP) {
+ conv_arg.prefix = conv_arg.suffix = MSG_ORIG(MSG_STR_EMPTY);
+ } else {
+ conv_arg.prefix = conv_arg.suffix = NULL;
+ }
+ (void) conv_expn_field(&conv_arg, conv_dyn_flag_strings(fmt_flags),
+ fmt_flags);
+
+ return ((const char *)dyn_flag_buf->buf);
+}
+
+const char *
+conv_dyn_flag1(Xword flags, Conv_fmt_flags_t fmt_flags,
+ Conv_dyn_flag1_buf_t *dyn_flag1_buf)
+{
+ static CONV_EXPN_FIELD_ARG conv_arg = {
+ NULL, sizeof (dyn_flag1_buf->buf) };
+
+ if (flags == 0)
+ return (MSG_ORIG(MSG_GBL_ZERO));
+ CONV_XWORD_64TEST(flags, fmt_flags, &dyn_flag1_buf->inv_buf);
+
+ conv_arg.oflags = conv_arg.rflags = flags;
+ conv_arg.buf = dyn_flag1_buf->buf;
+ (void) conv_expn_field(&conv_arg, conv_dyn_flag1_strings(fmt_flags),
+ fmt_flags);
+
+ return ((const char *)dyn_flag1_buf->buf);
+}
+
+const char *
+conv_dyn_feature1(Xword flags, Conv_fmt_flags_t fmt_flags,
+ Conv_dyn_feature1_buf_t *dyn_feature1_buf)
+{
+ static CONV_EXPN_FIELD_ARG conv_arg = {
+ NULL, sizeof (dyn_feature1_buf->buf) };
+
+ if (flags == 0)
+ return (MSG_ORIG(MSG_GBL_ZERO));
+ CONV_XWORD_64TEST(flags, fmt_flags, &dyn_feature1_buf->inv_buf);
+
+ conv_arg.buf = dyn_feature1_buf->buf;
+ conv_arg.oflags = conv_arg.rflags = flags;
+ if (CONV_TYPE_FMT_ALT(fmt_flags) == CONV_FMT_ALT_DUMP) {
+ conv_arg.prefix = conv_arg.suffix = MSG_ORIG(MSG_STR_EMPTY);
+ } else {
+ conv_arg.prefix = conv_arg.suffix = NULL;
+ }
+ (void) conv_expn_field(&conv_arg,
+ conv_dyn_feature1_strings(fmt_flags), fmt_flags);
+
+ return ((const char *)dyn_feature1_buf->buf);
+}
+
+const char *
+conv_dyn_tag(Xword tag, uchar_t osabi, Half mach, Conv_fmt_flags_t fmt_flags,
+ Conv_inv_buf_t *inv_buf)
+{
+ CONV_XWORD_64TEST(tag, fmt_flags, inv_buf);
+ return (conv_map_ds(osabi, mach, tag,
+ conv_dyn_tag_strings(osabi, mach, fmt_flags), fmt_flags, inv_buf));
+}
diff --git a/usr/src/cmd/sgs/libconv/common/elf.c b/usr/src/cmd/sgs/libconv/common/elf.c
index 9439f40c1c..d7aba4ae0d 100644
--- a/usr/src/cmd/sgs/libconv/common/elf.c
+++ b/usr/src/cmd/sgs/libconv/common/elf.c
@@ -20,7 +20,7 @@
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -35,236 +35,631 @@
-/* Instantiate a local copy of conv_map2str() from _conv.h */
-DEFINE_conv_map2str
+static const conv_ds_t **
+ehdr_class_strings(Conv_fmt_flags_t fmt_flags)
+{
+ static const Msg class_cf[] = {
+ MSG_ELFCLASSNONE_CF, MSG_ELFCLASS32_CF, MSG_ELFCLASS64_CF
+ };
+ static const Msg class_nf[] = {
+ MSG_ELFCLASSNONE_NF, MSG_ELFCLASS32_NF, MSG_ELFCLASS64_NF
+ };
+ static const Msg class_dump[] = {
+ MSG_ELFCLASSNONE_DMP, MSG_ELFCLASS32_DMP, MSG_ELFCLASS64_DMP
+ };
+
+ static const conv_ds_msg_t ds_classes_cf = {
+ CONV_DS_MSG_INIT(ELFCLASSNONE, class_cf) };
+ static const conv_ds_msg_t ds_classes_nf = {
+ CONV_DS_MSG_INIT(ELFCLASSNONE, class_nf) };
+ static const conv_ds_msg_t ds_classes_dump = {
+ CONV_DS_MSG_INIT(ELFCLASSNONE, class_dump) };
+
+ static const conv_ds_t *ds_cf[] = { CONV_DS_ADDR(ds_classes_cf), NULL };
+ static const conv_ds_t *ds_nf[] = { CONV_DS_ADDR(ds_classes_nf), NULL };
+ static const conv_ds_t *ds_dump[] = {
+ CONV_DS_ADDR(ds_classes_dump), NULL };
+ switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
+ case CONV_FMT_ALT_DUMP:
+ case CONV_FMT_ALT_FILE:
+ return (ds_dump);
+ case CONV_FMT_ALT_NF:
+ return (ds_nf);
+ }
+ return (ds_cf);
+}
const char *
conv_ehdr_class(uchar_t class, Conv_fmt_flags_t fmt_flags,
Conv_inv_buf_t *inv_buf)
{
- static const Msg classes[] = {
- MSG_ELFCLASSNONE, MSG_ELFCLASS32, MSG_ELFCLASS64
+ return (conv_map_ds(ELFOSABI_NONE, EM_NONE, class,
+ ehdr_class_strings(fmt_flags), fmt_flags, inv_buf));
+}
+
+conv_iter_ret_t
+conv_iter_ehdr_class(Conv_fmt_flags_t fmt_flags, conv_iter_cb_t func,
+ void *uvalue)
+{
+ return (conv_iter_ds(ELFOSABI_NONE, EM_NONE,
+ ehdr_class_strings(fmt_flags), func, uvalue));
+}
+
+static const conv_ds_t **
+ehdr_data_strings(Conv_fmt_flags_t fmt_flags)
+{
+ static const Msg data_cf[] = {
+ MSG_ELFDATANONE_CF, MSG_ELFDATA2LSB_CF, MSG_ELFDATA2MSB_CF
+ };
+ static const Msg data_nf[] = {
+ MSG_ELFDATANONE_NF, MSG_ELFDATA2LSB_NF, MSG_ELFDATA2MSB_NF
};
- static const Msg classes_alt[] = {
- MSG_ELFCLASSNONE_ALT, MSG_ELFCLASS32_ALT, MSG_ELFCLASS64_ALT
+ static const Msg data_dump[] = {
+ MSG_ELFDATANONE_DMP, MSG_ELFDATA2LSB_DMP, MSG_ELFDATA2MSB_DMP
};
+ static const Msg data_file[] = {
+ MSG_ELFDATANONE_DMP, MSG_ELFDATA2LSB_FIL, MSG_ELFDATA2MSB_FIL
+ };
+
+
+ static const conv_ds_msg_t ds_data_cf = {
+ CONV_DS_MSG_INIT(ELFCLASSNONE, data_cf) };
+ static const conv_ds_msg_t ds_data_nf = {
+ CONV_DS_MSG_INIT(ELFCLASSNONE, data_nf) };
+ static const conv_ds_msg_t ds_data_dump = {
+ CONV_DS_MSG_INIT(ELFCLASSNONE, data_dump) };
+ static const conv_ds_msg_t ds_data_file = {
+ CONV_DS_MSG_INIT(ELFCLASSNONE, data_file) };
+
+ static const conv_ds_t *ds_cf[] = { CONV_DS_ADDR(ds_data_cf), NULL };
+ static const conv_ds_t *ds_nf[] = { CONV_DS_ADDR(ds_data_nf), NULL };
+ static const conv_ds_t *ds_dump[] = { CONV_DS_ADDR(ds_data_dump),
+ NULL };
+ static const conv_ds_t *ds_file[] = { CONV_DS_ADDR(ds_data_file),
+ NULL };
- /* Use alternative strings? */
switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
case CONV_FMT_ALT_DUMP:
+ return (ds_dump);
case CONV_FMT_ALT_FILE:
- return (conv_map2str(inv_buf, class, fmt_flags,
- ARRAY_NELTS(classes_alt), classes_alt));
+ return (ds_file);
+ case CONV_FMT_ALT_NF:
+ return (ds_nf);
}
- /* Use default strings */
- return (conv_map2str(inv_buf, class, fmt_flags,
- ARRAY_NELTS(classes), classes));
+ return (ds_cf);
}
const char *
conv_ehdr_data(uchar_t data, Conv_fmt_flags_t fmt_flags,
Conv_inv_buf_t *inv_buf)
{
- static const Msg datas[] = {
- MSG_ELFDATANONE, MSG_ELFDATA2LSB, MSG_ELFDATA2MSB
+ return (conv_map_ds(ELFOSABI_NONE, EM_NONE, data,
+ ehdr_data_strings(fmt_flags), fmt_flags, inv_buf));
+}
+
+conv_iter_ret_t
+conv_iter_ehdr_data(Conv_fmt_flags_t fmt_flags, conv_iter_cb_t func,
+ void *uvalue)
+{
+ return (conv_iter_ds(ELFOSABI_NONE, EM_NONE,
+ ehdr_data_strings(fmt_flags), func, uvalue));
+}
+
+static const conv_ds_t **
+ehdr_mach_strings(Conv_fmt_flags_t fmt_flags)
+{
+
+ static const Msg mach_0_11_cf[] = {
+ MSG_EM_NONE_CF, MSG_EM_M32_CF,
+ MSG_EM_SPARC_CF, MSG_EM_386_CF,
+ MSG_EM_68K_CF, MSG_EM_88K_CF,
+ MSG_EM_486_CF, MSG_EM_860_CF,
+ MSG_EM_MIPS_CF, MSG_EM_S370_CF,
+ MSG_EM_MIPS_RS3_LE_CF, MSG_EM_RS6000_CF
+ };
+ static const Msg mach_0_11_nf[] = {
+ MSG_EM_NONE_NF, MSG_EM_M32_NF,
+ MSG_EM_SPARC_NF, MSG_EM_386_NF,
+ MSG_EM_68K_NF, MSG_EM_88K_NF,
+ MSG_EM_486_NF, MSG_EM_860_NF,
+ MSG_EM_MIPS_NF, MSG_EM_S370_NF,
+ MSG_EM_MIPS_RS3_LE_NF, MSG_EM_RS6000_NF
+ };
+ static const Msg mach_0_11_dmp[] = {
+ MSG_EM_NONE_DMP, MSG_EM_M32_DMP,
+ MSG_EM_SPARC_DMP, MSG_EM_386_DMP,
+ MSG_EM_68K_DMP, MSG_EM_88K_DMP,
+ MSG_EM_486_DMP, MSG_EM_860_DMP,
+ MSG_EM_MIPS_DMP, MSG_EM_S370_CF,
+ MSG_EM_MIPS_RS3_LE_DMP, MSG_EM_RS6000_DMP
+ };
+ static const conv_ds_msg_t ds_mach_0_11_cf = {
+ CONV_DS_MSG_INIT(EM_NONE, mach_0_11_cf) };
+ static const conv_ds_msg_t ds_mach_0_11_nf = {
+ CONV_DS_MSG_INIT(EM_NONE, mach_0_11_nf) };
+ static const conv_ds_msg_t ds_mach_0_11_dmp = {
+ CONV_DS_MSG_INIT(EM_NONE, mach_0_11_dmp) };
+
+
+ static const Msg mach_15_22_cf[] = {
+ MSG_EM_PA_RISC_CF, MSG_EM_NCUBE_CF,
+ MSG_EM_VPP500_CF, MSG_EM_SPARC32PLUS_CF,
+ MSG_EM_960_CF, MSG_EM_PPC_CF,
+ MSG_EM_PPC64_CF, MSG_EM_S390_CF
+ };
+ static const Msg mach_15_22_nf[] = {
+ MSG_EM_PA_RISC_NF, MSG_EM_NCUBE_NF,
+ MSG_EM_VPP500_NF, MSG_EM_SPARC32PLUS_NF,
+ MSG_EM_960_NF, MSG_EM_PPC_NF,
+ MSG_EM_PPC64_NF, MSG_EM_S390_NF
+ };
+ static const Msg mach_15_22_dmp[] = {
+ MSG_EM_PA_RISC_DMP, MSG_EM_NCUBE_DMP,
+ MSG_EM_VPP500_DMP, MSG_EM_SPARC32PLUS_DMP,
+ MSG_EM_960_CF, MSG_EM_PPC_DMP,
+ MSG_EM_PPC64_DMP, MSG_EM_S390_CF
+ };
+ static const conv_ds_msg_t ds_mach_15_22_cf = {
+ CONV_DS_MSG_INIT(EM_PA_RISC, mach_15_22_cf) };
+ static const conv_ds_msg_t ds_mach_15_22_nf = {
+ CONV_DS_MSG_INIT(EM_PA_RISC, mach_15_22_nf) };
+ static const conv_ds_msg_t ds_mach_15_22_dmp = {
+ CONV_DS_MSG_INIT(EM_PA_RISC, mach_15_22_dmp) };
+
+
+ static const Msg mach_36_63_cf[] = {
+ MSG_EM_V800_CF, MSG_EM_FR20_CF,
+ MSG_EM_RH32_CF, MSG_EM_RCE_CF,
+ MSG_EM_ARM_CF, MSG_EM_ALPHA_CF,
+ MSG_EM_SH_CF, MSG_EM_SPARCV9_CF,
+ MSG_EM_TRICORE_CF, MSG_EM_ARC_CF,
+ MSG_EM_H8_300_CF, MSG_EM_H8_300H_CF,
+ MSG_EM_H8S_CF, MSG_EM_H8_500_CF,
+ MSG_EM_IA_64_CF, MSG_EM_MIPS_X_CF,
+ MSG_EM_COLDFIRE_CF, MSG_EM_68HC12_CF,
+ MSG_EM_MMA_CF, MSG_EM_PCP_CF,
+ MSG_EM_NCPU_CF, MSG_EM_NDR1_CF,
+ MSG_EM_STARCORE_CF, MSG_EM_ME16_CF,
+ MSG_EM_ST100_CF, MSG_EM_TINYJ_CF,
+ MSG_EM_AMD64_CF, MSG_EM_PDSP_CF
+ };
+ static const Msg mach_36_63_nf[] = {
+ MSG_EM_V800_NF, MSG_EM_FR20_NF,
+ MSG_EM_RH32_NF, MSG_EM_RCE_NF,
+ MSG_EM_ARM_NF, MSG_EM_ALPHA_NF,
+ MSG_EM_SH_NF, MSG_EM_SPARCV9_NF,
+ MSG_EM_TRICORE_NF, MSG_EM_ARC_NF,
+ MSG_EM_H8_300_NF, MSG_EM_H8_300H_NF,
+ MSG_EM_H8S_NF, MSG_EM_H8_500_NF,
+ MSG_EM_IA_64_NF, MSG_EM_MIPS_X_NF,
+ MSG_EM_COLDFIRE_NF, MSG_EM_68HC12_NF,
+ MSG_EM_MMA_NF, MSG_EM_PCP_NF,
+ MSG_EM_NCPU_NF, MSG_EM_NDR1_NF,
+ MSG_EM_STARCORE_NF, MSG_EM_ME16_NF,
+ MSG_EM_ST100_NF, MSG_EM_TINYJ_NF,
+ MSG_EM_AMD64_NF, MSG_EM_PDSP_NF
};
- static const Msg datas_dump[] = {
- MSG_ELFDATANONE_ALT, MSG_ELFDATA2LSB_ALT1, MSG_ELFDATA2MSB_ALT1
+ static const Msg mach_36_63_dmp[] = {
+ MSG_EM_V800_CF, MSG_EM_FR20_CF,
+ MSG_EM_RH32_CF, MSG_EM_RCE_CF,
+ MSG_EM_ARM_DMP, MSG_EM_ALPHA_DMP,
+ MSG_EM_SH_CF, MSG_EM_SPARCV9_DMP,
+ MSG_EM_TRICORE_CF, MSG_EM_ARC_CF,
+ MSG_EM_H8_300_CF, MSG_EM_H8_300H_CF,
+ MSG_EM_H8S_CF, MSG_EM_H8_500_CF,
+ MSG_EM_IA_64_DMP, MSG_EM_MIPS_X_CF,
+ MSG_EM_COLDFIRE_CF, MSG_EM_68HC12_CF,
+ MSG_EM_MMA_CF, MSG_EM_PCP_CF,
+ MSG_EM_NCPU_CF, MSG_EM_NDR1_CF,
+ MSG_EM_STARCORE_CF, MSG_EM_ME16_CF,
+ MSG_EM_ST100_CF, MSG_EM_TINYJ_CF,
+ MSG_EM_AMD64_DMP, MSG_EM_PDSP_CF
};
- static const Msg datas_file[] = {
- MSG_ELFDATANONE_ALT, MSG_ELFDATA2LSB_ALT2, MSG_ELFDATA2MSB_ALT2
+ static const conv_ds_msg_t ds_mach_36_63_cf = {
+ CONV_DS_MSG_INIT(EM_V800, mach_36_63_cf) };
+ static const conv_ds_msg_t ds_mach_36_63_nf = {
+ CONV_DS_MSG_INIT(EM_V800, mach_36_63_nf) };
+ static const conv_ds_msg_t ds_mach_36_63_dmp = {
+ CONV_DS_MSG_INIT(EM_V800, mach_36_63_dmp) };
+
+
+ static const Msg mach_66_94_cf[] = {
+ MSG_EM_FX66_CF, MSG_EM_ST9PLUS_CF,
+ MSG_EM_ST7_CF, MSG_EM_68HC16_CF,
+ MSG_EM_68HC11_CF, MSG_EM_68HC08_CF,
+ MSG_EM_68HC05_CF, MSG_EM_SVX_CF,
+ MSG_EM_ST19_CF, MSG_EM_VAX_CF,
+ MSG_EM_CRIS_CF, MSG_EM_JAVELIN_CF,
+ MSG_EM_FIREPATH_CF, MSG_EM_ZSP_CF,
+ MSG_EM_MMIX_CF, MSG_EM_HUANY_CF,
+ MSG_EM_PRISM_CF, MSG_EM_AVR_CF,
+ MSG_EM_FR30_CF, MSG_EM_D10V_CF,
+ MSG_EM_D30V_CF, MSG_EM_V850_CF,
+ MSG_EM_M32R_CF, MSG_EM_MN10300_CF,
+ MSG_EM_MN10200_CF, MSG_EM_PJ_CF,
+ MSG_EM_OPENRISC_CF, MSG_EM_ARC_A5_CF,
+ MSG_EM_XTENSA_CF
};
+ static const Msg mach_66_94_nf[] = {
+ MSG_EM_FX66_NF, MSG_EM_ST9PLUS_NF,
+ MSG_EM_ST7_NF, MSG_EM_68HC16_NF,
+ MSG_EM_68HC11_NF, MSG_EM_68HC08_NF,
+ MSG_EM_68HC05_NF, MSG_EM_SVX_NF,
+ MSG_EM_ST19_NF, MSG_EM_VAX_NF,
+ MSG_EM_CRIS_NF, MSG_EM_JAVELIN_NF,
+ MSG_EM_FIREPATH_NF, MSG_EM_ZSP_NF,
+ MSG_EM_MMIX_NF, MSG_EM_HUANY_NF,
+ MSG_EM_PRISM_NF, MSG_EM_AVR_NF,
+ MSG_EM_FR30_NF, MSG_EM_D10V_NF,
+ MSG_EM_D30V_NF, MSG_EM_V850_NF,
+ MSG_EM_M32R_NF, MSG_EM_MN10300_NF,
+ MSG_EM_MN10200_NF, MSG_EM_PJ_NF,
+ MSG_EM_OPENRISC_NF, MSG_EM_ARC_A5_NF,
+ MSG_EM_XTENSA_NF
+ };
+ static const Msg mach_66_94_dmp[] = {
+ MSG_EM_FX66_CF, MSG_EM_ST9PLUS_CF,
+ MSG_EM_ST7_CF, MSG_EM_68HC16_CF,
+ MSG_EM_68HC11_CF, MSG_EM_68HC08_CF,
+ MSG_EM_68HC05_CF, MSG_EM_SVX_CF,
+ MSG_EM_ST19_CF, MSG_EM_VAX_DMP,
+ MSG_EM_CRIS_CF, MSG_EM_JAVELIN_CF,
+ MSG_EM_FIREPATH_CF, MSG_EM_ZSP_CF,
+ MSG_EM_MMIX_CF, MSG_EM_HUANY_CF,
+ MSG_EM_PRISM_CF, MSG_EM_AVR_CF,
+ MSG_EM_FR30_CF, MSG_EM_D10V_CF,
+ MSG_EM_D30V_CF, MSG_EM_V850_CF,
+ MSG_EM_M32R_CF, MSG_EM_MN10300_CF,
+ MSG_EM_MN10200_CF, MSG_EM_PJ_CF,
+ MSG_EM_OPENRISC_CF, MSG_EM_ARC_A5_CF,
+ MSG_EM_XTENSA_CF
+ };
+#if (EM_NUM != (EM_XTENSA + 1))
+#error "EM_NUM has grown"
+#endif
+ static const conv_ds_msg_t ds_mach_66_94_cf = {
+ CONV_DS_MSG_INIT(EM_FX66, mach_66_94_cf) };
+ static const conv_ds_msg_t ds_mach_66_94_nf = {
+ CONV_DS_MSG_INIT(EM_FX66, mach_66_94_nf) };
+ static const conv_ds_msg_t ds_mach_66_94_dmp = {
+ CONV_DS_MSG_INIT(EM_FX66, mach_66_94_dmp) };
+
+
+ /* Build NULL terminated return arrays for each string style */
+ static const const conv_ds_t *ds_cf[] = {
+ CONV_DS_ADDR(ds_mach_0_11_cf), CONV_DS_ADDR(ds_mach_15_22_cf),
+ CONV_DS_ADDR(ds_mach_36_63_cf), CONV_DS_ADDR(ds_mach_66_94_cf),
+ NULL
+ };
+ static const const conv_ds_t *ds_nf[] = {
+ CONV_DS_ADDR(ds_mach_0_11_nf), CONV_DS_ADDR(ds_mach_15_22_nf),
+ CONV_DS_ADDR(ds_mach_36_63_nf), CONV_DS_ADDR(ds_mach_66_94_nf),
+ NULL
+ };
+ static const const conv_ds_t *ds_dmp[] = {
+ CONV_DS_ADDR(ds_mach_0_11_dmp), CONV_DS_ADDR(ds_mach_15_22_dmp),
+ CONV_DS_ADDR(ds_mach_36_63_dmp),
+ CONV_DS_ADDR(ds_mach_66_94_dmp), NULL
+ };
+
- /* Use alternative strings? */
+ /* Select the strings to use */
switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
case CONV_FMT_ALT_DUMP:
- return (conv_map2str(inv_buf, data, fmt_flags,
- ARRAY_NELTS(datas_dump), datas_dump));
case CONV_FMT_ALT_FILE:
- return (conv_map2str(inv_buf, data, fmt_flags,
- ARRAY_NELTS(datas_file), datas_file));
+ return (ds_dmp);
+ case CONV_FMT_ALT_NF:
+ return (ds_nf);
}
- /* Use default strings */
- return (conv_map2str(inv_buf, data, fmt_flags,
- ARRAY_NELTS(datas), datas));
+ return (ds_cf);
}
-static const Msg machines[EM_NUM] = {
- MSG_EM_NONE, MSG_EM_M32, MSG_EM_SPARC,
- MSG_EM_386, MSG_EM_68K, MSG_EM_88K,
- MSG_EM_486, MSG_EM_860, MSG_EM_MIPS,
- MSG_EM_S370, MSG_EM_MIPS_RS3_LE, MSG_EM_RS6000,
- MSG_EM_UNKNOWN12, MSG_EM_UNKNOWN13, MSG_EM_UNKNOWN14,
- MSG_EM_PA_RISC, MSG_EM_nCUBE, MSG_EM_VPP500,
- MSG_EM_SPARC32PLUS, MSG_EM_960, MSG_EM_PPC,
- MSG_EM_PPC64, MSG_EM_S390, MSG_EM_UNKNOWN23,
- MSG_EM_UNKNOWN24, MSG_EM_UNKNOWN25, MSG_EM_UNKNOWN26,
- MSG_EM_UNKNOWN27, MSG_EM_UNKNOWN28, MSG_EM_UNKNOWN29,
- MSG_EM_UNKNOWN30, MSG_EM_UNKNOWN31, MSG_EM_UNKNOWN32,
- MSG_EM_UNKNOWN33, MSG_EM_UNKNOWN34, MSG_EM_UNKNOWN35,
- MSG_EM_V800, MSG_EM_FR20, MSG_EM_RH32,
- MSG_EM_RCE, MSG_EM_ARM, MSG_EM_ALPHA,
- MSG_EM_SH, MSG_EM_SPARCV9, MSG_EM_TRICORE,
- MSG_EM_ARC, MSG_EM_H8_300, MSG_EM_H8_300H,
- MSG_EM_H8S, MSG_EM_H8_500, MSG_EM_IA_64,
- MSG_EM_MIPS_X, MSG_EM_COLDFIRE, MSG_EM_68HC12,
- MSG_EM_MMA, MSG_EM_PCP, MSG_EM_NCPU,
- MSG_EM_NDR1, MSG_EM_STARCORE, MSG_EM_ME16,
- MSG_EM_ST100, MSG_EM_TINYJ, MSG_EM_AMD64,
- MSG_EM_PDSP, MSG_EM_UNKNOWN64, MSG_EM_UNKNOWN65,
- MSG_EM_FX66, MSG_EM_ST9PLUS, MSG_EM_ST7,
- MSG_EM_68HC16, MSG_EM_68HC11, MSG_EM_68HC08,
- MSG_EM_68HC05, MSG_EM_SVX, MSG_EM_ST19,
- MSG_EM_VAX, MSG_EM_CRIS, MSG_EM_JAVELIN,
- MSG_EM_FIREPATH, MSG_EM_ZSP, MSG_EM_MMIX,
- MSG_EM_HUANY, MSG_EM_PRISM, MSG_EM_AVR,
- MSG_EM_FR30, MSG_EM_D10V, MSG_EM_D30V,
- MSG_EM_V850, MSG_EM_M32R, MSG_EM_MN10300,
- MSG_EM_MN10200, MSG_EM_PJ, MSG_EM_OPENRISC,
- MSG_EM_ARC_A5, MSG_EM_XTENSA
-};
-static const Msg machines_alt[EM_NUM] = {
- MSG_EM_NONE_ALT, MSG_EM_M32_ALT, MSG_EM_SPARC_ALT,
- MSG_EM_386_ALT, MSG_EM_68K_ALT, MSG_EM_88K_ALT,
- MSG_EM_486_ALT, MSG_EM_860_ALT, MSG_EM_MIPS_ALT,
- MSG_EM_S370, MSG_EM_MIPS_RS3_LE_ALT, MSG_EM_RS6000_ALT,
- MSG_EM_UNKNOWN12, MSG_EM_UNKNOWN13, MSG_EM_UNKNOWN14,
- MSG_EM_PA_RISC_ALT, MSG_EM_nCUBE_ALT, MSG_EM_VPP500_ALT,
- MSG_EM_SPARC32PLUS_ALT, MSG_EM_960, MSG_EM_PPC_ALT,
- MSG_EM_PPC64_ALT, MSG_EM_S390, MSG_EM_UNKNOWN23,
- MSG_EM_UNKNOWN24, MSG_EM_UNKNOWN25, MSG_EM_UNKNOWN26,
- MSG_EM_UNKNOWN27, MSG_EM_UNKNOWN28, MSG_EM_UNKNOWN29,
- MSG_EM_UNKNOWN30, MSG_EM_UNKNOWN31, MSG_EM_UNKNOWN32,
- MSG_EM_UNKNOWN33, MSG_EM_UNKNOWN34, MSG_EM_UNKNOWN35,
- MSG_EM_V800, MSG_EM_FR20, MSG_EM_RH32,
- MSG_EM_RCE, MSG_EM_ARM_ALT, MSG_EM_ALPHA_ALT,
- MSG_EM_SH, MSG_EM_SPARCV9_ALT, MSG_EM_TRICORE,
- MSG_EM_ARC, MSG_EM_H8_300, MSG_EM_H8_300H,
- MSG_EM_H8S, MSG_EM_H8_500, MSG_EM_IA_64_ALT,
- MSG_EM_MIPS_X, MSG_EM_COLDFIRE, MSG_EM_68HC12,
- MSG_EM_MMA, MSG_EM_PCP, MSG_EM_NCPU,
- MSG_EM_NDR1, MSG_EM_STARCORE, MSG_EM_ME16,
- MSG_EM_ST100, MSG_EM_TINYJ, MSG_EM_AMD64_ALT,
- MSG_EM_PDSP, MSG_EM_UNKNOWN64, MSG_EM_UNKNOWN65,
- MSG_EM_FX66, MSG_EM_ST9PLUS, MSG_EM_ST7,
- MSG_EM_68HC16, MSG_EM_68HC11, MSG_EM_68HC08,
- MSG_EM_68HC05, MSG_EM_SVX, MSG_EM_ST19,
- MSG_EM_VAX_ALT, MSG_EM_CRIS, MSG_EM_JAVELIN,
- MSG_EM_FIREPATH, MSG_EM_ZSP, MSG_EM_MMIX,
- MSG_EM_HUANY, MSG_EM_PRISM, MSG_EM_AVR,
- MSG_EM_FR30, MSG_EM_D10V, MSG_EM_D30V,
- MSG_EM_V850, MSG_EM_M32R, MSG_EM_MN10300,
- MSG_EM_MN10200, MSG_EM_PJ, MSG_EM_OPENRISC,
- MSG_EM_ARC_A5, MSG_EM_XTENSA
-};
-#if (EM_NUM != (EM_XTENSA + 1))
-#error "EM_NUM has grown"
-#endif
-
const char *
conv_ehdr_mach(Half machine, Conv_fmt_flags_t fmt_flags,
Conv_inv_buf_t *inv_buf)
{
- /* Use alternative strings? */
- switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
- case CONV_FMT_ALT_DUMP:
- case CONV_FMT_ALT_FILE:
- return (conv_map2str(inv_buf, machine, fmt_flags,
- ARRAY_NELTS(machines_alt), machines_alt));
- }
+ return (conv_map_ds(ELFOSABI_NONE, EM_NONE, machine,
+ ehdr_mach_strings(fmt_flags), fmt_flags, inv_buf));
+}
+
+conv_iter_ret_t
+conv_iter_ehdr_mach(Conv_fmt_flags_t fmt_flags, conv_iter_cb_t func,
+ void *uvalue)
+{
+ static const Val_desc extra_dmp_nf[] = {
+ { EM_M32, MSG_EM_M32_DMP},
+ { EM_386, MSG_EM_386_DMP },
+ { EM_68K, MSG_EM_68K_DMP },
+ { EM_88K, MSG_EM_88K_DMP },
+ { EM_486, MSG_EM_486_DMP },
+ { EM_860, MSG_EM_860_DMP },
+ { EM_MIPS, MSG_EM_MIPS_DMP },
+ { EM_MIPS_RS3_LE, MSG_EM_MIPS_RS3_LE_DMP },
+ { EM_PPC, MSG_EM_PPC_DMP },
+ { EM_PPC64, MSG_EM_PPC64_DMP },
+
+ { 0 }
+ };
+
+ if (conv_iter_ds(ELFOSABI_NONE, EM_NONE,
+ ehdr_mach_strings(fmt_flags), func, uvalue) == CONV_ITER_DONE)
+ return (CONV_ITER_DONE);
+
+ /*
+ * For the NF style, we also supply a few of the traditional
+ * dump versions for iteration, but not for display.
+ */
+ if (CONV_TYPE_FMT_ALT(fmt_flags) == CONV_FMT_ALT_NF)
+ return (conv_iter_vd(extra_dmp_nf, func, uvalue));
- /* Use default strings */
- return (conv_map2str(inv_buf, machine, fmt_flags,
- ARRAY_NELTS(machines), machines));
+ return (CONV_ITER_CONT);
}
-const char *
-conv_ehdr_type(Half etype, Conv_fmt_flags_t fmt_flags, Conv_inv_buf_t *inv_buf)
+
+static const conv_ds_t **
+ehdr_eident_strings(Conv_fmt_flags_t fmt_flags)
{
- static const Msg etypes[] = {
- MSG_ET_NONE, MSG_ET_REL, MSG_ET_EXEC,
- MSG_ET_DYN, MSG_ET_CORE
- };
- static const Msg etypes_alt[] = {
- MSG_ET_NONE_ALT, MSG_ET_REL_ALT, MSG_ET_EXEC_ALT,
- MSG_ET_DYN_ALT, MSG_ET_CORE_ALT
- };
-
- if (etype == ET_SUNWPSEUDO) {
- switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
- case CONV_FMT_ALT_DUMP:
- case CONV_FMT_ALT_FILE:
- return (MSG_ORIG(MSG_ET_SUNWPSEUDO_ALT));
- default:
- return (MSG_ORIG(MSG_ET_SUNWPSEUDO));
- }
- }
+ static const Msg eident_cf[] = {
+ MSG_EI_MAG0_CF, MSG_EI_MAG1_CF,
+ MSG_EI_MAG2_CF, MSG_EI_MAG3_CF,
+ MSG_EI_CLASS_CF, MSG_EI_DATA_CF,
+ MSG_EI_VERSION_CF, MSG_EI_OSABI_CF,
+ MSG_EI_ABIVERSION_CF
+ };
+ static const Msg eident_nf[] = {
+ MSG_EI_MAG0_NF, MSG_EI_MAG1_NF,
+ MSG_EI_MAG2_NF, MSG_EI_MAG3_NF,
+ MSG_EI_CLASS_NF, MSG_EI_DATA_NF,
+ MSG_EI_VERSION_NF, MSG_EI_OSABI_NF,
+ MSG_EI_ABIVERSION_NF
+ };
+#if EI_PAD != (EI_ABIVERSION + 1)
+error "EI_PAD has grown. Update etypes[]"
+#endif
+ static const conv_ds_msg_t ds_eident_cf = {
+ CONV_DS_MSG_INIT(EI_MAG0, eident_cf) };
+ static const conv_ds_msg_t ds_eident_nf = {
+ CONV_DS_MSG_INIT(EI_MAG0, eident_nf) };
+
+ /* Build NULL terminated return arrays for each string style */
+ static const const conv_ds_t *ds_cf[] = {
+ CONV_DS_ADDR(ds_eident_cf), NULL };
+ static const conv_ds_t *ds_nf[] = {
+ CONV_DS_ADDR(ds_eident_nf), NULL };
+
+ /* Select the strings to use */
+ return ((CONV_TYPE_FMT_ALT(fmt_flags) == CONV_FMT_ALT_CF) ?
+ ds_cf : ds_nf);
+}
- /* Use alternative strings? */
+conv_iter_ret_t
+conv_iter_ehdr_eident(Conv_fmt_flags_t fmt_flags, conv_iter_cb_t func,
+ void *uvalue)
+{
+ return (conv_iter_ds(ELFOSABI_NONE, EM_NONE,
+ ehdr_eident_strings(fmt_flags), func, uvalue));
+}
+
+static const conv_ds_t **
+ehdr_type_strings(Conv_fmt_flags_t fmt_flags)
+{
+#define SOL ELFOSABI_SOLARIS, EM_NONE
+
+ static const Msg type_cf[] = {
+ MSG_ET_NONE_CF, MSG_ET_REL_CF, MSG_ET_EXEC_CF,
+ MSG_ET_DYN_CF, MSG_ET_CORE_CF
+ };
+ static const Msg type_nf[] = {
+ MSG_ET_NONE_NF, MSG_ET_REL_NF, MSG_ET_EXEC_NF,
+ MSG_ET_DYN_NF, MSG_ET_CORE_NF
+ };
+ static const Msg type_dmp[] = {
+ MSG_ET_NONE_DMP, MSG_ET_REL_DMP, MSG_ET_EXEC_DMP,
+ MSG_ET_DYN_DMP, MSG_ET_CORE_DMP
+ };
+#if ET_NUM != (ET_CORE + 1)
+error "ET_NUM has grown. Update types[]"
+#endif
+ static const conv_ds_msg_t ds_type_cf = {
+ CONV_DS_MSG_INIT(ET_NONE, type_cf) };
+ static const conv_ds_msg_t ds_type_nf = {
+ CONV_DS_MSG_INIT(ET_NONE, type_nf) };
+ static const conv_ds_msg_t ds_type_dmp = {
+ CONV_DS_MSG_INIT(ET_NONE, type_dmp) };
+
+ static const Val_desc2 type_osabi_cf[] = {
+ { ET_SUNWPSEUDO, SOL, MSG_ET_SUNWPSEUDO_CF },
+ { 0 }
+ };
+ static const Val_desc2 type_osabi_nf[] = {
+ { ET_SUNWPSEUDO, SOL, MSG_ET_SUNWPSEUDO_NF },
+ { 0 }
+ };
+ static const Val_desc2 type_osabi_dmp[] = {
+ { ET_SUNWPSEUDO, SOL, MSG_ET_SUNWPSEUDO_DMP },
+ { 0 }
+ };
+#if ET_LOSUNW != ET_SUNWPSEUDO
+error "ET_LOSUNW has grown. Update type_osabi[]"
+#endif
+ static const conv_ds_vd2_t ds_type_osabi_cf = {
+ CONV_DS_VD2, ET_LOOS, ET_HIOS, type_osabi_cf };
+ static const conv_ds_vd2_t ds_type_osabi_nf = {
+ CONV_DS_VD2, ET_LOOS, ET_HIOS, type_osabi_nf };
+ static const conv_ds_vd2_t ds_type_osabi_dmp = {
+ CONV_DS_VD2, ET_LOOS, ET_HIOS, type_osabi_dmp };
+
+
+ /* Build NULL terminated return arrays for each string style */
+ static const const conv_ds_t *ds_cf[] = {
+ CONV_DS_ADDR(ds_type_cf), CONV_DS_ADDR(ds_type_osabi_cf),
+ NULL };
+ static const conv_ds_t *ds_nf[] = {
+ CONV_DS_ADDR(ds_type_nf), CONV_DS_ADDR(ds_type_osabi_nf),
+ NULL };
+ static const conv_ds_t *ds_dmp[] = {
+ CONV_DS_ADDR(ds_type_dmp), CONV_DS_ADDR(ds_type_osabi_dmp),
+ NULL };
+
+ /* Select the strings to use */
switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
case CONV_FMT_ALT_DUMP:
- case CONV_FMT_ALT_FILE:
- return (conv_map2str(inv_buf, etype, fmt_flags,
- ARRAY_NELTS(etypes_alt), etypes_alt));
+ return (ds_dmp);
+ case CONV_FMT_ALT_NF:
+ return (ds_nf);
}
- /* Use default strings */
- return (conv_map2str(inv_buf, etype, fmt_flags,
- ARRAY_NELTS(etypes), etypes));
+ return (ds_cf);
+#undef SOL
}
const char *
-conv_ehdr_vers(Word version, Conv_fmt_flags_t fmt_flags,
+conv_ehdr_type(uchar_t osabi, Half etype, Conv_fmt_flags_t fmt_flags,
Conv_inv_buf_t *inv_buf)
{
- static const Msg versions[] = {
- MSG_EV_NONE, MSG_EV_CURRENT
+ return (conv_map_ds(osabi, EM_NONE, etype,
+ ehdr_type_strings(fmt_flags), fmt_flags, inv_buf));
+}
+
+conv_iter_ret_t
+conv_iter_ehdr_type(conv_iter_osabi_t osabi, Conv_fmt_flags_t fmt_flags,
+ conv_iter_cb_t func, void *uvalue)
+{
+ return (conv_iter_ds(osabi, EM_NONE,
+ ehdr_type_strings(fmt_flags), func, uvalue));
+}
+
+static const conv_ds_t **
+ehdr_vers_strings(Conv_fmt_flags_t fmt_flags)
+{
+ static const Msg versions_cf[] = {
+ MSG_EV_NONE_CF, MSG_EV_CURRENT_CF
};
- static const Msg versions_alt[] = {
- MSG_EV_NONE_ALT, MSG_EV_CURRENT_ALT
+ static const Msg versions_nf[] = {
+ MSG_EV_NONE_NF, MSG_EV_CURRENT_NF
};
-
- /* Use alternative strings? */
+ static const Msg versions_dmp[] = {
+ MSG_EV_NONE_DMP, MSG_EV_CURRENT_DMP
+ };
+#if EV_NUM != 2
+error "EV_NUM has grown. Update versions[]"
+#endif
+ static const conv_ds_msg_t ds_versions_cf = {
+ CONV_DS_MSG_INIT(EV_NONE, versions_cf) };
+ static const conv_ds_msg_t ds_versions_nf = {
+ CONV_DS_MSG_INIT(EV_NONE, versions_nf) };
+ static const conv_ds_msg_t ds_versions_dmp = {
+ CONV_DS_MSG_INIT(EV_NONE, versions_dmp) };
+
+ /* Build NULL terminated return arrays for each string style */
+ static const const conv_ds_t *ds_cf[] = {
+ CONV_DS_ADDR(ds_versions_cf), NULL };
+ static const conv_ds_t *ds_nf[] = {
+ CONV_DS_ADDR(ds_versions_nf), NULL };
+ static const conv_ds_t *ds_dmp[] = {
+ CONV_DS_ADDR(ds_versions_dmp), NULL };
+
+ /* Select the strings to use */
switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
case CONV_FMT_ALT_DUMP:
- case CONV_FMT_ALT_FILE:
- return (conv_map2str(inv_buf, version, fmt_flags,
- ARRAY_NELTS(versions_alt), versions_alt));
+ return (ds_dmp);
+ case CONV_FMT_ALT_NF:
+ return (ds_nf);
}
- /* Use default strings */
- return (conv_map2str(inv_buf, version, fmt_flags,
- ARRAY_NELTS(versions), versions));
+ return (ds_cf);
}
+const char *
+conv_ehdr_vers(Word version, Conv_fmt_flags_t fmt_flags,
+ Conv_inv_buf_t *inv_buf)
+{
+ return (conv_map_ds(ELFOSABI_NONE, EM_NONE, version,
+ ehdr_vers_strings(fmt_flags), fmt_flags, inv_buf));
+}
+
+conv_iter_ret_t
+conv_iter_ehdr_vers(Conv_fmt_flags_t fmt_flags, conv_iter_cb_t func,
+ void *uvalue)
+{
+ return (conv_iter_ds(ELFOSABI_NONE, EM_NONE,
+ ehdr_vers_strings(fmt_flags), func, uvalue));
+}
+
+static void
+conv_ehdr_sparc_flags_strings(Conv_fmt_flags_t fmt_flags,
+ const conv_ds_msg_t **mm_msg, const Val_desc **flag_desc)
+{
#define EFLAGSZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
- MSG_EF_SPARCV9_TSO_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- MSG_EF_SPARC_SUN_US1_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- MSG_EF_SPARC_HAL_R1_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- MSG_EF_SPARC_SUN_US3_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- CONV_INV_BUFSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
+ MSG_EF_SPARCV9_TSO_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_EF_SPARC_SUN_US1_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_EF_SPARC_HAL_R1_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_EF_SPARC_SUN_US3_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ CONV_INV_BUFSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
-/*
- * Ensure that Conv_ehdr_flags_buf_t is large enough:
- *
- * EFLAGSZ is the real minimum size of the buffer required by conv_ehdr_flags().
- * However, Conv_ehdr_flags_buf_t uses CONV_EHDR_FLAG_BUFSIZE to set the
- * buffer size. We do things this way because the definition of EFLAGSZ uses
- * information that is not available in the environment of other programs
- * that include the conv.h header file.
- */
+ /*
+ * Ensure that Conv_ehdr_flags_buf_t is large enough:
+ *
+ * EFLAGSZ is the real minimum size of the buffer required by
+ * conv_ehdr_flags(). However, Conv_ehdr_flags_buf_t uses
+ * CONV_EHDR_FLAG_BUFSIZE to set the buffer size. We do things
+ * this way because the definition of EFLAGSZ uses information
+ * that is not available in the environment of other programs
+ * that include the conv.h header file.
+ */
#if (CONV_EHDR_FLAGS_BUFSIZE != EFLAGSZ) && !defined(__lint)
#define REPORT_BUFSIZE EFLAGSZ
#include "report_bufsize.h"
#error "CONV_EHDR_FLAGS_BUFSIZE does not match EFLAGSZ"
#endif
+ static const Msg mm_flags_cf[] = {
+ MSG_EF_SPARCV9_TSO_CF, MSG_EF_SPARCV9_PSO_CF,
+ MSG_EF_SPARCV9_RMO_CF
+ };
+ static const Msg mm_flags_nf[] = {
+ MSG_EF_SPARCV9_TSO_NF, MSG_EF_SPARCV9_PSO_NF,
+ MSG_EF_SPARCV9_RMO_NF
+ };
+ static const conv_ds_msg_t ds_mm_flags_cf = {
+ CONV_DS_MSG_INIT(EF_SPARCV9_TSO, mm_flags_cf) };
+ static const conv_ds_msg_t ds_mm_flags_nf = {
+ CONV_DS_MSG_INIT(EF_SPARCV9_TSO, mm_flags_nf) };
+
+
+ static const Val_desc vda_cf[] = {
+ { EF_SPARC_32PLUS, MSG_EF_SPARC_32PLUS_CF },
+ { EF_SPARC_SUN_US1, MSG_EF_SPARC_SUN_US1_CF },
+ { EF_SPARC_HAL_R1, MSG_EF_SPARC_HAL_R1_CF },
+ { EF_SPARC_SUN_US3, MSG_EF_SPARC_SUN_US3_CF },
+ { 0 }
+ };
+ static const Val_desc vda_nf[] = {
+ { EF_SPARC_32PLUS, MSG_EF_SPARC_32PLUS_NF },
+ { EF_SPARC_SUN_US1, MSG_EF_SPARC_SUN_US1_NF },
+ { EF_SPARC_HAL_R1, MSG_EF_SPARC_HAL_R1_NF },
+ { EF_SPARC_SUN_US3, MSG_EF_SPARC_SUN_US3_NF },
+ { 0 }
+ };
+
+ switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
+ default:
+ *mm_msg = &ds_mm_flags_cf;
+ *flag_desc = vda_cf;
+ break;
+ case CONV_FMT_ALT_NF:
+ *mm_msg = &ds_mm_flags_nf;
+ *flag_desc = vda_nf;
+ break;
+ }
+}
+
/*
* Make a string representation of the e_flags field.
*/
@@ -272,48 +667,164 @@ const char *
conv_ehdr_flags(Half mach, Word flags, Conv_fmt_flags_t fmt_flags,
Conv_ehdr_flags_buf_t *flags_buf)
{
- static Val_desc vda[] = {
- { EF_SPARC_32PLUS, MSG_ORIG(MSG_EF_SPARC_32PLUS) },
- { EF_SPARC_SUN_US1, MSG_ORIG(MSG_EF_SPARC_SUN_US1) },
- { EF_SPARC_HAL_R1, MSG_ORIG(MSG_EF_SPARC_HAL_R1) },
- { EF_SPARC_SUN_US3, MSG_ORIG(MSG_EF_SPARC_SUN_US3) },
- { 0, 0 }
- };
- static const Msg mm_flags[] = {
- MSG_EF_SPARCV9_TSO, MSG_EF_SPARCV9_PSO,
- MSG_EF_SPARCV9_RMO
- };
static const char *leading_str_arr[2];
static CONV_EXPN_FIELD_ARG conv_arg = {
- NULL, sizeof (flags_buf->buf), vda, leading_str_arr };
-
- const char **lstr = leading_str_arr;
+ NULL, sizeof (flags_buf->buf), leading_str_arr };
- conv_arg.buf = flags_buf->buf;
+ const char **lstr;
+ const conv_ds_msg_t *mm_msg;
+ const Val_desc *vdp;
+ Word mm;
/*
* Non-SPARC architectures presently provide no known flags.
*/
- if ((mach == EM_SPARCV9) || (((mach == EM_SPARC) ||
- (mach == EM_SPARC32PLUS)) && flags)) {
- /*
- * Valid vendor extension bits for SPARCV9. These must be
- * updated along with elf_SPARC.h.
- */
-
- conv_arg.oflags = conv_arg.rflags = flags;
- if ((mach == EM_SPARCV9) && (flags <= EF_SPARCV9_RMO)) {
- *lstr++ = MSG_ORIG(mm_flags[flags & EF_SPARCV9_MM]);
- conv_arg.rflags &= ~EF_SPARCV9_MM;
+ if ((mach != EM_SPARCV9) && (((mach != EM_SPARC) &&
+ (mach != EM_SPARC32PLUS)) || (flags == 0)))
+ return (conv_invalid_val(&flags_buf->inv_buf, flags,
+ CONV_FMT_DECIMAL));
+
+ conv_arg.buf = flags_buf->buf;
+ conv_ehdr_sparc_flags_strings(fmt_flags, &mm_msg, &vdp);
+ conv_arg.oflags = conv_arg.rflags = flags;
+
+ mm = flags & EF_SPARCV9_MM;
+ lstr = leading_str_arr;
+ if ((mach == EM_SPARCV9) && (mm <= mm_msg->ds_topval)) {
+ *lstr++ = MSG_ORIG(mm_msg->ds_msg[mm]);
+ conv_arg.rflags &= ~EF_SPARCV9_MM;
+ }
+ *lstr = NULL;
+
+ (void) conv_expn_field(&conv_arg, vdp, fmt_flags);
+
+ return (conv_arg.buf);
+}
+
+conv_iter_ret_t
+conv_iter_ehdr_flags(Half mach, Conv_fmt_flags_t fmt_flags, conv_iter_cb_t func,
+ void *uvalue)
+{
+
+ if ((mach == EM_SPARCV9) || (mach == EM_SPARC) ||
+ (mach == EM_SPARC32PLUS) || (mach == CONV_MACH_ALL)) {
+ const conv_ds_msg_t *ds_msg_mm;
+ const Val_desc *vdp;
+
+ conv_ehdr_sparc_flags_strings(fmt_flags, &ds_msg_mm, &vdp);
+
+ if (mach == EM_SPARCV9) {
+ const conv_ds_t *ds[2];
+
+ ds[0] = CONV_DS_ADDR(ds_msg_mm);
+ ds[1] = NULL;
+
+ if (conv_iter_ds(ELFOSABI_NONE, mach, ds,
+ func, uvalue) == CONV_ITER_DONE)
+ return (CONV_ITER_DONE);
}
- *lstr = NULL;
- (void) conv_expn_field(&conv_arg, fmt_flags);
+ return (conv_iter_vd(vdp, func, uvalue));
+ }
+
+ return (CONV_ITER_CONT);
+}
+
+static const conv_ds_t **
+ehdr_osabi_strings(Conv_fmt_flags_t fmt_flags)
+{
- return (conv_arg.buf);
+ static const Msg osabi_0_3_cf[] = {
+ MSG_OSABI_NONE_CF, MSG_OSABI_HPUX_CF,
+ MSG_OSABI_NETBSD_CF, MSG_OSABI_LINUX_CF
+ };
+ static const Msg osabi_0_3_nf[] = {
+ MSG_OSABI_NONE_NF, MSG_OSABI_HPUX_NF,
+ MSG_OSABI_NETBSD_NF, MSG_OSABI_LINUX_NF
+ };
+ static const Msg osabi_0_3_dmp[] = {
+ MSG_OSABI_NONE_DMP, MSG_OSABI_HPUX_DMP,
+ MSG_OSABI_NETBSD_DMP, MSG_OSABI_LINUX_DMP
+ };
+ static const conv_ds_msg_t ds_osabi_0_3_cf = {
+ CONV_DS_MSG_INIT(ELFOSABI_NONE, osabi_0_3_cf) };
+ static const conv_ds_msg_t ds_osabi_0_3_nf = {
+ CONV_DS_MSG_INIT(ELFOSABI_NONE, osabi_0_3_nf) };
+ static const conv_ds_msg_t ds_osabi_0_3_dmp = {
+ CONV_DS_MSG_INIT(ELFOSABI_NONE, osabi_0_3_dmp) };
+
+
+ static const Msg osabi_6_15_cf[] = {
+ MSG_OSABI_SOLARIS_CF, MSG_OSABI_AIX_CF,
+ MSG_OSABI_IRIX_CF, MSG_OSABI_FREEBSD_CF,
+ MSG_OSABI_TRU64_CF, MSG_OSABI_MODESTO_CF,
+ MSG_OSABI_OPENBSD_CF, MSG_OSABI_OPENVMS_CF,
+ MSG_OSABI_NSK_CF, MSG_OSABI_AROS_CF
+ };
+ static const Msg osabi_6_15_nf[] = {
+ MSG_OSABI_SOLARIS_NF, MSG_OSABI_AIX_NF,
+ MSG_OSABI_IRIX_NF, MSG_OSABI_FREEBSD_NF,
+ MSG_OSABI_TRU64_NF, MSG_OSABI_MODESTO_NF,
+ MSG_OSABI_OPENBSD_NF, MSG_OSABI_OPENVMS_NF,
+ MSG_OSABI_NSK_NF, MSG_OSABI_AROS_NF
+ };
+ static const Msg osabi_6_15_dmp[] = {
+ MSG_OSABI_SOLARIS_DMP, MSG_OSABI_AIX_DMP,
+ MSG_OSABI_IRIX_DMP, MSG_OSABI_FREEBSD_DMP,
+ MSG_OSABI_TRU64_DMP, MSG_OSABI_MODESTO_DMP,
+ MSG_OSABI_OPENBSD_DMP, MSG_OSABI_OPENVMS_DMP,
+ MSG_OSABI_NSK_DMP, MSG_OSABI_AROS_DMP
+ };
+ static const conv_ds_msg_t ds_osabi_6_15_cf = {
+ CONV_DS_MSG_INIT(ELFOSABI_SOLARIS, osabi_6_15_cf) };
+ static const conv_ds_msg_t ds_osabi_6_15_nf = {
+ CONV_DS_MSG_INIT(ELFOSABI_SOLARIS, osabi_6_15_nf) };
+ static const conv_ds_msg_t ds_osabi_6_15_dmp = {
+ CONV_DS_MSG_INIT(ELFOSABI_SOLARIS, osabi_6_15_dmp) };
+
+
+ static const Val_desc osabi_misc_cf[] = {
+ { ELFOSABI_ARM, MSG_OSABI_ARM_CF },
+ { ELFOSABI_STANDALONE, MSG_OSABI_STANDALONE_CF },
+ { 0 }
+ };
+ static const Val_desc osabi_misc_nf[] = {
+ { ELFOSABI_ARM, MSG_OSABI_ARM_NF },
+ { ELFOSABI_STANDALONE, MSG_OSABI_STANDALONE_NF },
+ { 0 }
+ };
+ static const Val_desc osabi_misc_dmp[] = {
+ { ELFOSABI_ARM, MSG_OSABI_ARM_DMP },
+ { ELFOSABI_STANDALONE, MSG_OSABI_STANDALONE_DMP },
+ { 0 }
+ };
+ static const conv_ds_vd_t ds_osabi_misc_cf = {
+ CONV_DS_VD, ELFOSABI_ARM, ELFOSABI_STANDALONE, osabi_misc_cf };
+ static const conv_ds_vd_t ds_osabi_misc_nf = {
+ CONV_DS_VD, ELFOSABI_ARM, ELFOSABI_STANDALONE, osabi_misc_nf };
+ static const conv_ds_vd_t ds_osabi_misc_dmp = {
+ CONV_DS_VD, ELFOSABI_ARM, ELFOSABI_STANDALONE, osabi_misc_dmp };
+
+ /* Build NULL terminated return arrays for each string style */
+ static const const conv_ds_t *ds_cf[] = {
+ CONV_DS_ADDR(ds_osabi_0_3_cf), CONV_DS_ADDR(ds_osabi_6_15_cf),
+ CONV_DS_ADDR(ds_osabi_misc_cf), NULL };
+ static const const conv_ds_t *ds_nf[] = {
+ CONV_DS_ADDR(ds_osabi_0_3_nf), CONV_DS_ADDR(ds_osabi_6_15_nf),
+ CONV_DS_ADDR(ds_osabi_misc_nf), NULL };
+ static const const conv_ds_t *ds_dmp[] = {
+ CONV_DS_ADDR(ds_osabi_0_3_dmp), CONV_DS_ADDR(ds_osabi_6_15_dmp),
+ CONV_DS_ADDR(ds_osabi_misc_dmp), NULL };
+
+ /* Select the strings to use */
+ switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
+ case CONV_FMT_ALT_DUMP:
+ return (ds_dmp);
+ case CONV_FMT_ALT_NF:
+ return (ds_nf);
}
- return (conv_invalid_val(&flags_buf->inv_buf, flags, CONV_FMT_DECIMAL));
+ return (ds_cf);
}
/*
@@ -323,72 +834,94 @@ const char *
conv_ehdr_osabi(uchar_t osabi, Conv_fmt_flags_t fmt_flags,
Conv_inv_buf_t *inv_buf)
{
- static const Msg osabi_arr[] = {
- MSG_OSABI_NONE, MSG_OSABI_HPUX,
- MSG_OSABI_NETBSD, MSG_OSABI_LINUX,
- MSG_OSABI_UNKNOWN4, MSG_OSABI_UNKNOWN5,
- MSG_OSABI_SOLARIS, MSG_OSABI_AIX,
- MSG_OSABI_IRIX, MSG_OSABI_FREEBSD,
- MSG_OSABI_TRU64, MSG_OSABI_MODESTO,
- MSG_OSABI_OPENBSD, MSG_OSABI_OPENVMS,
- MSG_OSABI_NSK, MSG_OSABI_AROS
- };
- static const Msg osabi_arr_alt[] = {
- MSG_OSABI_NONE_ALT, MSG_OSABI_HPUX_ALT,
- MSG_OSABI_NETBSD_ALT, MSG_OSABI_LINUX_ALT,
- MSG_OSABI_UNKNOWN4, MSG_OSABI_UNKNOWN5,
- MSG_OSABI_SOLARIS_ALT, MSG_OSABI_AIX_ALT,
- MSG_OSABI_IRIX_ALT, MSG_OSABI_FREEBSD_ALT,
- MSG_OSABI_TRU64_ALT, MSG_OSABI_MODESTO_ALT,
- MSG_OSABI_OPENBSD_ALT, MSG_OSABI_OPENVMS_ALT,
- MSG_OSABI_NSK_ALT, MSG_OSABI_AROS_ALT
- };
-
- const char *str;
-
- switch (osabi) {
- case ELFOSABI_ARM:
- switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
- case CONV_FMT_ALT_DUMP:
- case CONV_FMT_ALT_FILE:
- str = MSG_ORIG(MSG_OSABI_ARM_ALT);
- break;
- default:
- str = MSG_ORIG(MSG_OSABI_ARM);
- }
- break;
+ return (conv_map_ds(ELFOSABI_NONE, EM_NONE, osabi,
+ ehdr_osabi_strings(fmt_flags), fmt_flags, inv_buf));
+}
- case ELFOSABI_STANDALONE:
- switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
- case CONV_FMT_ALT_DUMP:
- case CONV_FMT_ALT_FILE:
- str = MSG_ORIG(MSG_OSABI_STANDALONE_ALT);
- break;
- default:
- str = MSG_ORIG(MSG_OSABI_STANDALONE);
- }
- break;
+conv_iter_ret_t
+conv_iter_ehdr_osabi(Conv_fmt_flags_t fmt_flags, conv_iter_cb_t func,
+ void *uvalue)
+{
+ if (conv_iter_ds(ELFOSABI_NONE, EM_NONE, ehdr_osabi_strings(fmt_flags),
+ func, uvalue) == CONV_ITER_DONE)
+ return (CONV_ITER_DONE);
- default:
- switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
- case CONV_FMT_ALT_DUMP:
- case CONV_FMT_ALT_FILE:
- str = conv_map2str(inv_buf, osabi, fmt_flags,
- ARRAY_NELTS(osabi_arr_alt), osabi_arr_alt);
- break;
- default:
- str = conv_map2str(inv_buf, osabi, fmt_flags,
- ARRAY_NELTS(osabi_arr), osabi_arr);
- }
- break;
+ /*
+ * ELFOSABI_NONE might have been better named ELFOSABI_SYSV. For the
+ * CF and NF sytles, we supply that name for 0 in addition to NONE.
+ */
+ switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
+ case CONV_FMT_ALT_CF:
+ return ((* func)(MSG_ORIG(MSG_OSABI_SYSV_CF),
+ ELFOSABI_NONE, uvalue));
+ case CONV_FMT_ALT_NF:
+ return ((* func)(MSG_ORIG(MSG_OSABI_SYSV_NF),
+ ELFOSABI_NONE, uvalue));
}
- return (str);
+ return (CONV_ITER_CONT);
+}
+
+static const conv_ds_t **
+ehdr_abivers_strings(conv_iter_osabi_t osabi, Conv_fmt_flags_t fmt_flags)
+{
+ static const Msg abiversions_cf[] = {
+ MSG_EAV_SUNW_NONE_CF, MSG_EAV_SUNW_CURRENT_CF
+ };
+ static const Msg abiversions_nf[] = {
+ MSG_EAV_SUNW_NONE_NF, MSG_EAV_SUNW_CURRENT_NF
+ };
+#if EAV_SUNW_NUM != 2
+error "EAV_SUNW_NUM has grown. Update abiversions[]"
+#endif
+ static const conv_ds_msg_t ds_abiversions_cf = {
+ CONV_DS_MSG_INIT(EV_NONE, abiversions_cf) };
+ static const conv_ds_msg_t ds_abiversions_nf = {
+ CONV_DS_MSG_INIT(EV_NONE, abiversions_nf) };
+
+ /* Build NULL terminated return arrays for each string style */
+ static const const conv_ds_t *ds_cf[] = {
+ CONV_DS_ADDR(ds_abiversions_cf), NULL };
+ static const conv_ds_t *ds_nf[] = {
+ CONV_DS_ADDR(ds_abiversions_nf), NULL };
+
+ /* For non-Solaris OSABI, we don't have symbolic names */
+ static const conv_ds_t *ds_none[] = { NULL };
+
+
+ /*
+ * Select the strings to use. This is a rare case where
+ * we don't treat ELFOSABI_NONE and ELFOSABI_SOLARIS
+ * as the same thing. We should never create a Solaris
+ * object tagged as ELFOSABI_NONE for which the abiversion
+ * is non-zero.
+ */
+ if ((osabi == ELFOSABI_SOLARIS) || (osabi == CONV_OSABI_ALL))
+ return ((CONV_TYPE_FMT_ALT(fmt_flags) == CONV_FMT_ALT_NF) ?
+ ds_nf : ds_cf);
+
+ return (ds_none);
+}
+
+const char *
+conv_ehdr_abivers(uchar_t osabi, Word version, Conv_fmt_flags_t fmt_flags,
+ Conv_inv_buf_t *inv_buf)
+{
+ return (conv_map_ds(osabi, EM_NONE, version,
+ ehdr_abivers_strings(osabi, fmt_flags), fmt_flags, inv_buf));
+}
+
+conv_iter_ret_t
+conv_iter_ehdr_abivers(conv_iter_osabi_t osabi, Conv_fmt_flags_t fmt_flags,
+ conv_iter_cb_t func, void *uvalue)
+{
+ return (conv_iter_ds(osabi, EM_NONE,
+ ehdr_abivers_strings(osabi, fmt_flags), func, uvalue));
}
/*
* A generic means of returning additional information for a rejected file in
- * terms of a string.
+ * terms of a string. ELFOSABI_SOLARIS is assummed.
*/
const char *
conv_reject_desc(Rej_desc * rej, Conv_reject_desc_buf_t *reject_desc_buf,
@@ -408,7 +941,7 @@ conv_reject_desc(Rej_desc * rej, Conv_reject_desc_buf_t *reject_desc_buf,
return (conv_ehdr_data((uchar_t)info, 0,
&reject_desc_buf->inv_buf));
case SGS_REJ_TYPE:
- return (conv_ehdr_type((Half)info, 0,
+ return (conv_ehdr_type(ELFOSABI_SOLARIS, (Half)info, 0,
&reject_desc_buf->inv_buf));
case SGS_REJ_BADFLAG:
case SGS_REJ_MISFLAG:
diff --git a/usr/src/cmd/sgs/libconv/common/elf.msg b/usr/src/cmd/sgs/libconv/common/elf.msg
index 37c9e879f8..24325f05cd 100644
--- a/usr/src/cmd/sgs/libconv/common/elf.msg
+++ b/usr/src/cmd/sgs/libconv/common/elf.msg
@@ -20,208 +20,328 @@
#
#
-# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
-#
-@ MSG_ELFCLASSNONE "ELFCLASSNONE"
-@ MSG_ELFCLASSNONE_ALT "None"
-@ MSG_ELFCLASS32 "ELFCLASS32"
-@ MSG_ELFCLASS32_ALT "32-bit"
-@ MSG_ELFCLASS64 "ELFCLASS64"
-@ MSG_ELFCLASS64_ALT "64-bit"
+@ MSG_ELFCLASSNONE_CF "ELFCLASSNONE" # 0
+@ MSG_ELFCLASSNONE_DMP "None"
+@ MSG_ELFCLASSNONE_NF "none"
+@ MSG_ELFCLASS32_CF "ELFCLASS32" # 1
+@ MSG_ELFCLASS32_DMP "32-bit"
+@ MSG_ELFCLASS32_NF "32"
+@ MSG_ELFCLASS64_CF "ELFCLASS64" # 2
+@ MSG_ELFCLASS64_DMP "64-bit"
+@ MSG_ELFCLASS64_NF "64"
+
+@ MSG_ELFDATANONE_CF "ELFDATANONE" # 0
+@ MSG_ELFDATANONE_DMP "None"
+@ MSG_ELFDATANONE_NF "none"
+@ MSG_ELFDATA2LSB_CF "ELFDATA2LSB" # 1
+@ MSG_ELFDATA2LSB_DMP "2LSB"
+@ MSG_ELFDATA2LSB_FIL "LSB"
+@ MSG_ELFDATA2LSB_NF "lsb"
+@ MSG_ELFDATA2MSB_CF "ELFDATA2MSB" # 2
+@ MSG_ELFDATA2MSB_DMP "2MSB"
+@ MSG_ELFDATA2MSB_FIL "MSB"
+@ MSG_ELFDATA2MSB_NF "msb"
+
+@ MSG_EM_NONE_CF "EM_NONE" # 0
+@ MSG_EM_NONE_NF "none"
+@ MSG_EM_NONE_DMP "No mach"
+@ MSG_EM_M32_CF "EM_M32" # 1
+@ MSG_EM_M32_NF "m32"
+@ MSG_EM_M32_DMP "WE32100"
+@ MSG_EM_SPARC_CF "EM_SPARC" # 2
+@ MSG_EM_SPARC_NF "sparc"
+@ MSG_EM_SPARC_DMP "SPARC"
+@ MSG_EM_386_CF "EM_386" # 3
+@ MSG_EM_386_NF "386"
+@ MSG_EM_386_DMP "80386"
+@ MSG_EM_68K_CF "EM_68K" # 4
+@ MSG_EM_68K_DMP "68000"
+@ MSG_EM_68K_NF "68k"
+@ MSG_EM_88K_CF "EM_88K" # 5
+@ MSG_EM_88K_NF "88k"
+@ MSG_EM_88K_DMP "88000"
+@ MSG_EM_486_CF "EM_486" # 6
+@ MSG_EM_486_NF "486"
+@ MSG_EM_486_DMP "80486"
+@ MSG_EM_860_CF "EM_860" # 7
+@ MSG_EM_860_NF "860"
+@ MSG_EM_860_DMP "i860"
+@ MSG_EM_MIPS_CF "EM_MIPS" # 8
+@ MSG_EM_MIPS_NF "mips"
+@ MSG_EM_MIPS_DMP "RS3000_BE"
+@ MSG_EM_S370_CF "EM_S370" # 9
+@ MSG_EM_S370_NF "s370"
+@ MSG_EM_MIPS_RS3_LE_CF "EM_MIPS_RS3_LE" # 10
+@ MSG_EM_MIPS_RS3_LE_NF "mips_rs3_le"
+@ MSG_EM_MIPS_RS3_LE_DMP "RS3000_LE"
+@ MSG_EM_RS6000_CF "EM_RS6000" # 11
+@ MSG_EM_RS6000_NF "rs6000"
+@ MSG_EM_RS6000_DMP "RS6000"
+@ MSG_EM_PA_RISC_CF "EM_PA_RISC" # 15
+@ MSG_EM_PA_RISC_NF "pa_risc"
+@ MSG_EM_PA_RISC_DMP "PA_RISC"
+@ MSG_EM_NCUBE_CF "EM_nCUBE" # 16
+@ MSG_EM_NCUBE_NF "ncube"
+@ MSG_EM_NCUBE_DMP "nCUBE"
+@ MSG_EM_VPP500_CF "EM_VPP500" # 17
+@ MSG_EM_VPP500_NF "vpp500"
+@ MSG_EM_VPP500_DMP "VPP500"
+@ MSG_EM_SPARC32PLUS_CF "EM_SPARC32PLUS" # 18
+@ MSG_EM_SPARC32PLUS_NF "sparc32plus"
+@ MSG_EM_SPARC32PLUS_DMP "SPARC32PLUS"
+@ MSG_EM_960_CF "EM_960" # 19
+@ MSG_EM_960_NF "960"
+@ MSG_EM_PPC_CF "EM_PPC" # 20
+@ MSG_EM_PPC_NF "ppc"
+@ MSG_EM_PPC_DMP "PowerPC"
+@ MSG_EM_PPC64_CF "EM_PPC64" # 21
+@ MSG_EM_PPC64_NF "ppc64"
+@ MSG_EM_PPC64_DMP "PowerPC64"
+@ MSG_EM_S390_CF "EM_S390" # 22
+@ MSG_EM_S390_NF "s390"
+@ MSG_EM_V800_CF "EM_V800" # 36
+@ MSG_EM_V800_NF "v800"
+@ MSG_EM_FR20_CF "EM_FR20" # 37
+@ MSG_EM_FR20_NF "fr20"
+@ MSG_EM_RH32_CF "EM_RH32" # 38
+@ MSG_EM_RH32_NF "rh32"
+@ MSG_EM_RCE_CF "EM_RCE" # 39
+@ MSG_EM_RCE_NF "rce"
+@ MSG_EM_ARM_CF "EM_ARM" # 40
+@ MSG_EM_ARM_NF "arm"
+@ MSG_EM_ARM_DMP "ARM"
+@ MSG_EM_ALPHA_CF "EM_ALPHA" # 41
+@ MSG_EM_ALPHA_NF "alpha"
+@ MSG_EM_ALPHA_DMP "Alpha"
+@ MSG_EM_SH_CF "EM_SH" # 42
+@ MSG_EM_SH_NF "sh"
+@ MSG_EM_SPARCV9_CF "EM_SPARCV9" # 43
+@ MSG_EM_SPARCV9_NF "sparcv9"
+@ MSG_EM_SPARCV9_DMP "SPARCV9"
+@ MSG_EM_TRICORE_CF "EM_TRICORE" # 44
+@ MSG_EM_TRICORE_NF "tricore"
+@ MSG_EM_ARC_CF "EM_ARC" # 45
+@ MSG_EM_ARC_NF "arc"
+@ MSG_EM_H8_300_CF "EM_H8_300" # 46
+@ MSG_EM_H8_300_NF "h8_300"
+@ MSG_EM_H8_300H_CF "EM_H8_300H" # 47
+@ MSG_EM_H8_300H_NF "h8_300h"
+@ MSG_EM_H8S_CF "EM_H8S" # 48
+@ MSG_EM_H8S_NF "h8s"
+@ MSG_EM_H8_500_CF "EM_H8_500" # 49
+@ MSG_EM_H8_500_NF "h8_500"
+@ MSG_EM_IA_64_CF "EM_IA_64" # 50
+@ MSG_EM_IA_64_NF "ia_64"
+@ MSG_EM_IA_64_DMP "IA_64"
+@ MSG_EM_MIPS_X_CF "EM_MIPS_X" # 51
+@ MSG_EM_MIPS_X_NF "mips_x"
+@ MSG_EM_COLDFIRE_CF "EM_COLDFIRE" # 52
+@ MSG_EM_COLDFIRE_NF "coldfire"
+@ MSG_EM_68HC12_CF "EM_68HC12" # 53
+@ MSG_EM_68HC12_NF "68hc12"
+@ MSG_EM_MMA_CF "EM_MMA" # 54
+@ MSG_EM_MMA_NF "mma"
+@ MSG_EM_PCP_CF "EM_PCP" # 55
+@ MSG_EM_PCP_NF "pcp"
+@ MSG_EM_NCPU_CF "EM_NCPU" # 56
+@ MSG_EM_NCPU_NF "ncpu"
+@ MSG_EM_NDR1_CF "EM_NDR1" # 57
+@ MSG_EM_NDR1_NF "ndr1"
+@ MSG_EM_STARCORE_CF "EM_STARCORE" # 58
+@ MSG_EM_STARCORE_NF "starcore"
+@ MSG_EM_ME16_CF "EM_ME16" # 59
+@ MSG_EM_ME16_NF "me16"
+@ MSG_EM_ST100_CF "EM_ST100" # 60
+@ MSG_EM_ST100_NF "st100"
+@ MSG_EM_TINYJ_CF "EM_TINYJ" # 61
+@ MSG_EM_TINYJ_NF "tinyj"
+@ MSG_EM_AMD64_CF "EM_AMD64" # 62
+@ MSG_EM_AMD64_NF "amd64"
+@ MSG_EM_AMD64_DMP "AMD64"
+@ MSG_EM_PDSP_CF "EM_PDSP" # 63
+@ MSG_EM_PDSP_NF "pdsp"
+@ MSG_EM_FX66_CF "EM_FX66" # 66
+@ MSG_EM_FX66_NF "fx66"
+@ MSG_EM_ST9PLUS_CF "EM_ST9PLUS" # 67
+@ MSG_EM_ST9PLUS_NF "st9plus"
+@ MSG_EM_ST7_CF "EM_ST7" # 68
+@ MSG_EM_ST7_NF "st7"
+@ MSG_EM_68HC16_CF "EM_68HC16" # 69
+@ MSG_EM_68HC16_NF "68hc16"
+@ MSG_EM_68HC11_CF "EM_68HC11" # 70
+@ MSG_EM_68HC11_NF "68hc11"
+@ MSG_EM_68HC08_CF "EM_68HC08" # 71
+@ MSG_EM_68HC08_NF "68hc08"
+@ MSG_EM_68HC05_CF "EM_68HC05" # 72
+@ MSG_EM_68HC05_NF "68hc05"
+@ MSG_EM_SVX_CF "EM_SVX" # 73
+@ MSG_EM_SVX_NF "svx"
+@ MSG_EM_ST19_CF "EM_ST19" # 74
+@ MSG_EM_ST19_NF "st19"
+@ MSG_EM_VAX_CF "EM_VAX" # 75
+@ MSG_EM_VAX_NF "vax"
+@ MSG_EM_VAX_DMP "VAX"
+@ MSG_EM_CRIS_CF "EM_CRIS" # 76
+@ MSG_EM_CRIS_NF "cris"
+@ MSG_EM_JAVELIN_CF "EM_JAVELIN" # 77
+@ MSG_EM_JAVELIN_NF "javelin"
+@ MSG_EM_FIREPATH_CF "EM_FIREPATH" # 78
+@ MSG_EM_FIREPATH_NF "firepath"
+@ MSG_EM_ZSP_CF "EM_ZSP" # 79
+@ MSG_EM_ZSP_NF "zsp"
+@ MSG_EM_MMIX_CF "EM_MMIX" # 80
+@ MSG_EM_MMIX_NF "mmix"
+@ MSG_EM_HUANY_CF "EM_HUANY" # 81
+@ MSG_EM_HUANY_NF "huany"
+@ MSG_EM_PRISM_CF "EM_PRISM" # 82
+@ MSG_EM_PRISM_NF "prism"
+@ MSG_EM_AVR_CF "EM_AVR" # 83
+@ MSG_EM_AVR_NF "avr"
+@ MSG_EM_FR30_CF "EM_FR30" # 84
+@ MSG_EM_FR30_NF "fr30"
+@ MSG_EM_D10V_CF "EM_D10V" # 85
+@ MSG_EM_D10V_NF "d10v"
+@ MSG_EM_D30V_CF "EM_D30V" # 86
+@ MSG_EM_D30V_NF "d30v"
+@ MSG_EM_V850_CF "EM_V850" # 87
+@ MSG_EM_V850_NF "v850"
+@ MSG_EM_M32R_CF "EM_M32R" # 88
+@ MSG_EM_M32R_NF "m32r"
+@ MSG_EM_MN10300_CF "EM_MN10300" # 89
+@ MSG_EM_MN10300_NF "mn10300"
+@ MSG_EM_MN10200_CF "EM_MN10200" # 90
+@ MSG_EM_MN10200_NF "mn10200"
+@ MSG_EM_PJ_CF "EM_PJ" # 91
+@ MSG_EM_PJ_NF "pj"
+@ MSG_EM_OPENRISC_CF "EM_OPENRISC" # 92
+@ MSG_EM_OPENRISC_NF "openrisc"
+@ MSG_EM_ARC_A5_CF "EM_ARC_A5" # 93
+@ MSG_EM_ARC_A5_NF "arc_a5"
+@ MSG_EM_XTENSA_CF "EM_XTENSA" # 94
+@ MSG_EM_XTENSA_NF "xtensa"
+
-@ MSG_ELFDATANONE "ELFDATANONE"
-@ MSG_ELFDATANONE_ALT "None"
-@ MSG_ELFDATA2LSB "ELFDATA2LSB"
-@ MSG_ELFDATA2LSB_ALT1 "2LSB"
-@ MSG_ELFDATA2LSB_ALT2 "LSB"
-@ MSG_ELFDATA2MSB "ELFDATA2MSB"
-@ MSG_ELFDATA2MSB_ALT1 "2MSB"
-@ MSG_ELFDATA2MSB_ALT2 "MSB"
+@ MSG_EI_MAG0_CF "EI_MAG0" # 0
+@ MSG_EI_MAG0_NF "mag0"
+@ MSG_EI_MAG1_CF "EI_MAG1" # 1
+@ MSG_EI_MAG1_NF "mag1"
+@ MSG_EI_MAG2_CF "EI_MAG2" # 2
+@ MSG_EI_MAG2_NF "mag2"
+@ MSG_EI_MAG3_CF "EI_MAG3" # 3
+@ MSG_EI_MAG3_NF "mag3"
+@ MSG_EI_CLASS_CF "EI_CLASS" # 4
+@ MSG_EI_CLASS_NF "class"
+@ MSG_EI_DATA_CF "EI_DATA" # 5
+@ MSG_EI_DATA_NF "data"
+@ MSG_EI_VERSION_CF "EI_VERSION" # 6
+@ MSG_EI_VERSION_NF "version"
+@ MSG_EI_OSABI_CF "EI_OSABI" # 7
+@ MSG_EI_OSABI_NF "osabi"
+@ MSG_EI_ABIVERSION_CF "EI_ABIVERSION" # 8
+@ MSG_EI_ABIVERSION_NF "abiversion"
-@ MSG_EM_NONE "EM_NONE" # 0
-@ MSG_EM_NONE_ALT "No mach"
-@ MSG_EM_M32 "EM_M32" # 1
-@ MSG_EM_M32_ALT "WE32100"
-@ MSG_EM_SPARC "EM_SPARC" # 2
-@ MSG_EM_SPARC_ALT "SPARC"
-@ MSG_EM_386 "EM_386" # 3
-@ MSG_EM_386_ALT "80386"
-@ MSG_EM_68K "EM_68K" # 4
-@ MSG_EM_68K_ALT "68000"
-@ MSG_EM_88K "EM_88K" # 5
-@ MSG_EM_88K_ALT "88000"
-@ MSG_EM_486 "EM_486" # 6
-@ MSG_EM_486_ALT "80486"
-@ MSG_EM_860 "EM_860" # 7
-@ MSG_EM_860_ALT "i860"
-@ MSG_EM_MIPS "EM_MIPS" # 8
-@ MSG_EM_MIPS_ALT "RS3000_BE"
-@ MSG_EM_S370 "EM_S370" # 9
-@ MSG_EM_MIPS_RS3_LE "EM_MIPS_RS3_LE" # 10
-@ MSG_EM_MIPS_RS3_LE_ALT "RS3000_LE"
-@ MSG_EM_RS6000 "EM_RS6000" # 11
-@ MSG_EM_RS6000_ALT "RS6000" # 11
-@ MSG_EM_UNKNOWN12 "EM_UNKNOWN12" # 12
-@ MSG_EM_UNKNOWN13 "EM_UNKNOWN13" # 13
-@ MSG_EM_UNKNOWN14 "EM_UNKNOWN14" # 14
-@ MSG_EM_PA_RISC "EM_PA_RISC" # 15
-@ MSG_EM_PA_RISC_ALT "PA_RISC"
-@ MSG_EM_nCUBE "EM_nCUBE" # 16
-@ MSG_EM_nCUBE_ALT "nCUBE"
-@ MSG_EM_VPP500 "EM_VPP500" # 17
-@ MSG_EM_VPP500_ALT "VPP500"
-@ MSG_EM_SPARC32PLUS "EM_SPARC32PLUS" # 18
-@ MSG_EM_SPARC32PLUS_ALT "SPARC32PLUS"
-@ MSG_EM_960 "EM_960" # 19
-@ MSG_EM_PPC "EM_PPC" # 20
-@ MSG_EM_PPC_ALT "PowerPC"
-@ MSG_EM_PPC64 "EM_PPC64" #21
-@ MSG_EM_PPC64_ALT "PowerPC64"
-@ MSG_EM_S390 "EM_S390" #22
-@ MSG_EM_UNKNOWN23 "EM_UNKNOWN23" #23
-@ MSG_EM_UNKNOWN24 "EM_UNKNOWN24" #24
-@ MSG_EM_UNKNOWN25 "EM_UNKNOWN25" #25
-@ MSG_EM_UNKNOWN26 "EM_UNKNOWN26" #26
-@ MSG_EM_UNKNOWN27 "EM_UNKNOWN27" #27
-@ MSG_EM_UNKNOWN28 "EM_UNKNOWN28" #28
-@ MSG_EM_UNKNOWN29 "EM_UNKNOWN29" #29
-@ MSG_EM_UNKNOWN30 "EM_UNKNOWN30" #30
-@ MSG_EM_UNKNOWN31 "EM_UNKNOWN31" #31
-@ MSG_EM_UNKNOWN32 "EM_UNKNOWN32" #32
-@ MSG_EM_UNKNOWN33 "EM_UNKNOWN33" #33
-@ MSG_EM_UNKNOWN34 "EM_UNKNOWN34" #34
-@ MSG_EM_UNKNOWN35 "EM_UNKNOWN35" #35
-@ MSG_EM_V800 "EM_V800" #36
-@ MSG_EM_FR20 "EM_FR20" #37
-@ MSG_EM_RH32 "EM_RH32" #38
-@ MSG_EM_RCE "EM_RCE" #39
-@ MSG_EM_ARM "EM_ARM" #40
-@ MSG_EM_ARM_ALT "ARM"
-@ MSG_EM_ALPHA "EM_ALPHA" #41
-@ MSG_EM_ALPHA_ALT "Alpha"
-@ MSG_EM_SH "EM_SH" #42
-@ MSG_EM_SPARCV9 "EM_SPARCV9" #43
-@ MSG_EM_SPARCV9_ALT "SPARCV9"
-@ MSG_EM_TRICORE "EM_TRICORE" #44
-@ MSG_EM_ARC "EM_ARC" #45
-@ MSG_EM_H8_300 "EM_H8_300" #46
-@ MSG_EM_H8_300H "EM_H8_300H" #47
-@ MSG_EM_H8S "EM_H8S" #48
-@ MSG_EM_H8_500 "EM_H8_500" #49
-@ MSG_EM_IA_64 "EM_IA_64" #50
-@ MSG_EM_IA_64_ALT "IA_64"
-@ MSG_EM_MIPS_X "EM_MIPS_X" #51
-@ MSG_EM_COLDFIRE "EM_COLDFIRE" #52
-@ MSG_EM_68HC12 "EM_68HC12" #53
-@ MSG_EM_MMA "EM_MMA" #54
-@ MSG_EM_PCP "EM_PCP" #55
-@ MSG_EM_NCPU "EM_NCPU" #56
-@ MSG_EM_NDR1 "EM_NDR1" #57
-@ MSG_EM_STARCORE "EM_STARCORE" #58
-@ MSG_EM_ME16 "EM_ME16" #59
-@ MSG_EM_ST100 "EM_ST100" #60
-@ MSG_EM_TINYJ "EM_TINYJ" #61
-@ MSG_EM_AMD64 "EM_AMD64" #62
-@ MSG_EM_AMD64_ALT "AMD64"
-@ MSG_EM_PDSP "EM_PDSP" #63
-@ MSG_EM_UNKNOWN64 "EM_UNKNOWN64" #64
-@ MSG_EM_UNKNOWN65 "EM_UNKNOWN65" #65
-@ MSG_EM_FX66 "EM_FX66" #66
-@ MSG_EM_ST9PLUS "EM_ST9PLUS" #67
-@ MSG_EM_ST7 "EM_ST7" #68
-@ MSG_EM_68HC16 "EM_68HC16" #69
-@ MSG_EM_68HC11 "EM_68HC11" #70
-@ MSG_EM_68HC08 "EM_68HC08" #71
-@ MSG_EM_68HC05 "EM_68HC05" #72
-@ MSG_EM_SVX "EM_SVX" #73
-@ MSG_EM_ST19 "EM_ST19" #74
-@ MSG_EM_VAX "EM_VAX" #75
-@ MSG_EM_VAX_ALT "VAX"
-@ MSG_EM_CRIS "EM_CRIS" #76
-@ MSG_EM_JAVELIN "EM_JAVELIN" #77
-@ MSG_EM_FIREPATH "EM_FIREPATH" #78
-@ MSG_EM_ZSP "EM_ZSP" #79
-@ MSG_EM_MMIX "EM_MMIX" #80
-@ MSG_EM_HUANY "EM_HUANY" #81
-@ MSG_EM_PRISM "EM_PRISM" #82
-@ MSG_EM_AVR "EM_AVR" #83
-@ MSG_EM_FR30 "EM_FR30" #84
-@ MSG_EM_D10V "EM_D10V" #85
-@ MSG_EM_D30V "EM_D30V" #86
-@ MSG_EM_V850 "EM_V850" #87
-@ MSG_EM_M32R "EM_M32R" #88
-@ MSG_EM_MN10300 "EM_MN10300" #89
-@ MSG_EM_MN10200 "EM_MN10200" #90
-@ MSG_EM_PJ "EM_PJ" #91
-@ MSG_EM_OPENRISC "EM_OPENRISC" #92
-@ MSG_EM_ARC_A5 "EM_ARC_A5" #93
-@ MSG_EM_XTENSA "EM_XTENSA" #94
+@ MSG_ET_NONE_CF "ET_NONE" # 1
+@ MSG_ET_NONE_NF "none"
+@ MSG_ET_NONE_DMP "None"
+@ MSG_ET_REL_CF "ET_REL" # 2
+@ MSG_ET_REL_NF "rel"
+@ MSG_ET_REL_DMP "Reloc"
+@ MSG_ET_EXEC_CF "ET_EXEC" # 3
+@ MSG_ET_EXEC_NF "exec"
+@ MSG_ET_EXEC_DMP "Exec"
+@ MSG_ET_DYN_CF "ET_DYN" # 4
+@ MSG_ET_DYN_NF "dyn"
+@ MSG_ET_DYN_DMP "Dyn"
+@ MSG_ET_CORE_CF "ET_CORE" # 5
+@ MSG_ET_CORE_NF "core"
+@ MSG_ET_CORE_DMP "Core"
+@ MSG_ET_SUNWPSEUDO_CF "ET_SUNWPSEUDO" # 0xfeff
+@ MSG_ET_SUNWPSEUDO_NF "sunwpseudo"
+@ MSG_ET_SUNWPSEUDO_DMP "SUNWPseudo"
+@ MSG_EV_NONE_CF "EV_NONE" # 0
+@ MSG_EV_NONE_NF "none"
+@ MSG_EV_NONE_DMP "Invalid"
+@ MSG_EV_CURRENT_CF "EV_CURRENT" # 1
+@ MSG_EV_CURRENT_NF "current"
+@ MSG_EV_CURRENT_DMP "Current"
-@ MSG_ET_NONE "ET_NONE"
-@ MSG_ET_NONE_ALT "None"
-@ MSG_ET_REL "ET_REL"
-@ MSG_ET_REL_ALT "Reloc"
-@ MSG_ET_EXEC "ET_EXEC"
-@ MSG_ET_EXEC_ALT "Exec"
-@ MSG_ET_DYN "ET_DYN"
-@ MSG_ET_DYN_ALT "Dyn"
-@ MSG_ET_CORE "ET_CORE"
-@ MSG_ET_CORE_ALT "Core"
-@ MSG_ET_SUNWPSEUDO "ET_SUNWPSEUDO"
-@ MSG_ET_SUNWPSEUDO_ALT "SUNWPseudo"
+# Elf header EF_* flags
-@ MSG_EV_NONE "EV_NONE"
-@ MSG_EV_NONE_ALT "Invalid"
-@ MSG_EV_CURRENT "EV_CURRENT"
-@ MSG_EV_CURRENT_ALT "Current"
+@ MSG_EF_SPARC_32PLUS_CF "EF_SPARC_32PLUS" # 0x000100
+@ MSG_EF_SPARC_32PLUS_NF "sparc_32plus"
+@ MSG_EF_SPARC_SUN_US1_CF "EF_SPARC_SUN_US1" # 0x000200
+@ MSG_EF_SPARC_SUN_US1_NF "sparc_sun_us1"
+@ MSG_EF_SPARC_HAL_R1_CF "EF_SPARC_HAL_R1" # 0x000400
+@ MSG_EF_SPARC_HAL_R1_NF "sparc_hal_r1"
+@ MSG_EF_SPARC_SUN_US3_CF "EF_SPARC_SUN_US3" # x000800
+@ MSG_EF_SPARC_SUN_US3_NF "sparc_sun_us3"
+@ MSG_EF_SPARCV9_TSO_CF "EF_SPARCV9_TSO" # 0x0
+@ MSG_EF_SPARCV9_TSO_NF "sparcv9_tso"
+@ MSG_EF_SPARCV9_PSO_CF "EF_SPARCV9_PSO" # 0x1
+@ MSG_EF_SPARCV9_PSO_NF "sparcv9_pso"
+@ MSG_EF_SPARCV9_RMO_CF "EF_SPARCV9_RMO" # 0x2
+@ MSG_EF_SPARCV9_RMO_NF "sparcv9_rmo"
-@ MSG_EF_SPARC_32PLUS "EF_SPARC_32PLUS"
-@ MSG_EF_SPARC_SUN_US1 "EF_SPARC_SUN_US1"
-@ MSG_EF_SPARC_SUN_US3 "EF_SPARC_SUN_US3"
-@ MSG_EF_SPARC_HAL_R1 "EF_SPARC_HAL_R1"
-@ MSG_EF_SPARCV9_TSO "EF_SPARCV9_TSO"
-@ MSG_EF_SPARCV9_PSO "EF_SPARCV9_PSO"
-@ MSG_EF_SPARCV9_RMO "EF_SPARCV9_RMO"
+@ MSG_OSABI_NONE_CF "ELFOSABI_NONE" #0
+@ MSG_OSABI_NONE_NF "none"
+@ MSG_OSABI_NONE_DMP "Generic SYSV"
+@ MSG_OSABI_SYSV_CF "ELFOSABI_SYSV"
+@ MSG_OSABI_SYSV_NF "sysv"
+@ MSG_OSABI_HPUX_CF "ELFOSABI_HPUX" #1
+@ MSG_OSABI_HPUX_NF "hpux"
+@ MSG_OSABI_HPUX_DMP "HP-UX"
+@ MSG_OSABI_NETBSD_CF "ELFOSABI_NETBSD" #2
+@ MSG_OSABI_NETBSD_NF "netbsd"
+@ MSG_OSABI_NETBSD_DMP "NetBSD"
+@ MSG_OSABI_LINUX_CF "ELFOSABI_LINUX" #3
+@ MSG_OSABI_LINUX_NF "linux"
+@ MSG_OSABI_LINUX_DMP "Linux"
+@ MSG_OSABI_SOLARIS_CF "ELFOSABI_SOLARIS" #6
+@ MSG_OSABI_SOLARIS_NF "solaris"
+@ MSG_OSABI_SOLARIS_DMP "Solaris"
+@ MSG_OSABI_AIX_CF "ELFOSABI_AIX" #7
+@ MSG_OSABI_AIX_NF "aix"
+@ MSG_OSABI_AIX_DMP "AIX"
+@ MSG_OSABI_IRIX_CF "ELFOSABI_IRIX" #8
+@ MSG_OSABI_IRIX_NF "irix"
+@ MSG_OSABI_IRIX_DMP "IRIX"
+@ MSG_OSABI_FREEBSD_CF "ELFOSABI_FREEBSD" #9
+@ MSG_OSABI_FREEBSD_NF "freebsd"
+@ MSG_OSABI_FREEBSD_DMP "FreeBSD"
+@ MSG_OSABI_TRU64_CF "ELFOSABI_TRU64" #10
+@ MSG_OSABI_TRU64_NF "tru64"
+@ MSG_OSABI_TRU64_DMP "Tru64"
+@ MSG_OSABI_MODESTO_CF "ELFOSABI_MODESTO" #11
+@ MSG_OSABI_MODESTO_NF "modesto"
+@ MSG_OSABI_MODESTO_DMP "Modesto"
+@ MSG_OSABI_OPENBSD_CF "ELFOSABI_OPENBSD" #12
+@ MSG_OSABI_OPENBSD_NF "openbsd"
+@ MSG_OSABI_OPENBSD_DMP "OpenBSD"
+@ MSG_OSABI_OPENVMS_CF "ELFOSABI_OPENVMS" #13
+@ MSG_OSABI_OPENVMS_NF "openvms"
+@ MSG_OSABI_OPENVMS_DMP "OpenVMS"
+@ MSG_OSABI_NSK_CF "ELFOSABI_NSK" #14
+@ MSG_OSABI_NSK_NF "nsk"
+@ MSG_OSABI_NSK_DMP "NSK"
+@ MSG_OSABI_AROS_CF "ELFOSABI_AROS" #15
+@ MSG_OSABI_AROS_NF "aros"
+@ MSG_OSABI_AROS_DMP "Amiga Research OS"
+@ MSG_OSABI_ARM_CF "ELFOSABI_ARM" #97
+@ MSG_OSABI_ARM_NF "arm"
+@ MSG_OSABI_ARM_DMP "ARM"
+@ MSG_OSABI_STANDALONE_CF "ELFOSABI_STANDALONE" #255
+@ MSG_OSABI_STANDALONE_NF "standalone"
+@ MSG_OSABI_STANDALONE_DMP "Standalone"
-@ MSG_OSABI_NONE "ELFOSABI_NONE" #0
-@ MSG_OSABI_NONE_ALT "Generic SYSV"
-@ MSG_OSABI_HPUX "ELFOSABI_HPUX" #1
-@ MSG_OSABI_HPUX_ALT "HP-UX"
-@ MSG_OSABI_NETBSD "ELFOSABI_NETBSD" #2
-@ MSG_OSABI_NETBSD_ALT "NetBSD"
-@ MSG_OSABI_LINUX "ELFOSABI_LINUX" #3
-@ MSG_OSABI_LINUX_ALT "Linux"
-@ MSG_OSABI_UNKNOWN4 "ELFOSABI_UNKNOWN4" #4
-@ MSG_OSABI_UNKNOWN5 "ELFOSABI_UNKNOWN5" #5
-@ MSG_OSABI_SOLARIS "ELFOSABI_SOLARIS" #6
-@ MSG_OSABI_SOLARIS_ALT "Solaris"
-@ MSG_OSABI_AIX "ELFOSABI_AIX" #7
-@ MSG_OSABI_AIX_ALT "AIX"
-@ MSG_OSABI_IRIX "ELFOSABI_IRIX" #8
-@ MSG_OSABI_IRIX_ALT "IRIX"
-@ MSG_OSABI_FREEBSD "ELFOSABI_FREEBSD" #9
-@ MSG_OSABI_FREEBSD_ALT "FreeBSD"
-@ MSG_OSABI_TRU64 "ELFOSABI_TRU64" #10
-@ MSG_OSABI_TRU64_ALT "Tru64"
-@ MSG_OSABI_MODESTO "ELFOSABI_MODESTO" #11
-@ MSG_OSABI_MODESTO_ALT "Modesto"
-@ MSG_OSABI_OPENBSD "ELFOSABI_OPENBSD" #12
-@ MSG_OSABI_OPENBSD_ALT "OpenBSD"
-@ MSG_OSABI_OPENVMS "ELFOSABI_OPENVMS" #13
-@ MSG_OSABI_OPENVMS_ALT "OpenVMS"
-@ MSG_OSABI_NSK "ELFOSABI_NSK" #14
-@ MSG_OSABI_NSK_ALT "NSK"
-@ MSG_OSABI_AROS "ELFOSABI_AROS" #15
-@ MSG_OSABI_AROS_ALT "Amiga Research OS"
-@ MSG_OSABI_ARM "ELFOSABI_ARM" #97
-@ MSG_OSABI_ARM_ALT "ARM"
-@ MSG_OSABI_STANDALONE "ELFOSABI_STANDALONE" #255
-@ MSG_OSABI_STANDALONE_ALT "Standalone"
+@ MSG_EAV_SUNW_NONE_CF "EAV_SUNW_NONE" # 0
+@ MSG_EAV_SUNW_NONE_NF "none"
+@ MSG_EAV_SUNW_CURRENT_CF "EAV_SUNW_CURRENT" # 1
+@ MSG_EAV_SUNW_CURRENT_NF "current"
@ MSG_GBL_ZERO "0"
diff --git a/usr/src/cmd/sgs/libconv/common/globals.c b/usr/src/cmd/sgs/libconv/common/globals.c
index c3465a3dcf..12f6e7db5e 100644
--- a/usr/src/cmd/sgs/libconv/common/globals.c
+++ b/usr/src/cmd/sgs/libconv/common/globals.c
@@ -20,202 +20,341 @@
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <strings.h>
+#include <ctype.h>
#include <_machelf.h>
#include "_conv.h"
#include "globals_msg.h"
/*
- * Given an integer value, generate an ASCII representation of it.
+ * Map an integer into a descriptive string.
*
* entry:
- * inv_buf - Buffer into which the resulting string is generated.
- * value - Value to be formatted.
- * fmt_flags - CONV_FMT_* values, used to specify formatting details.
+ * inv_buf - A buffer into which this routine can format
+ * a result string, if necessary.
+ * val - The value for which a string is desired.
+ * flags - CONV_FMT_* values to be passed to conv_invalid_val() if
+ * necessary. The caller is reponsible for having examined
+ * the CONV_FMT_ALT_* part of flags and passing the proper
+ * msg array.
+ * num_msg - # of Msg entries in msg.
+ * msg - Array of num_msg Msg items corresponding to the possible
+ * strings corresponding to val.
+ * local_sgs_msg - Message string table from module from which
+ * this function is called.
*
* exit:
- * The formatted string is placed into inv_buf. The pointer
- * to the string is returned.
+ * If val lies in the range [0-(num_msg-1)], then the string
+ * corresponding to it is returned. If val is outside the range,
+ * conv_invalid_val() is called to format an ASCII representation
+ * of it into inv_buf, and that is returned.
+ */
+/*ARGSUSED5*/
+static const char *
+map_msg2str(Conv_inv_buf_t *inv_buf, Conv_elfvalue_t val,
+ Conv_fmt_flags_t flags, size_t num_msg, const Msg *msg,
+ const char *local_sgs_msg)
+{
+ if ((val < num_msg) && (msg[val] != 0))
+ return (MSG_ORIG_STRTAB(msg[val], local_sgs_msg));
+
+ /* If we get here, it's an unknown value */
+ return (conv_invalid_val(inv_buf, val, flags));
+}
+
+/*
+ * Map an integer into a descriptive string from a NULL terminated
+ * array of Val_desc or Val_desc2 descriptors.
+ *
+ * entry:
+ * inv_buf - A buffer into which this routine can format
+ * a result string, if necessary.
+ * osabi,mach (_conv_vd22str only) - The osab/mach under which
+ * val is to be interpreted. Items with a non-0 osabi or machine
+ * that do not match are quietly ignored.
+ * val - The value for which a string is desired.
+ * flags - CONV_FMT_* values to be passed to conv_invalid_val() if
+ * necessary. The caller is reponsible for having examined
+ * the CONV_FMT_ALT_* part of flags and passing the proper
+ * descriptor array.
+ * vdp - Pointer to NULL terminated array of Val_desc descriptors.
+ * local_sgs_msg - Message string table from module from which
+ * this function is called.
+ *
+ * exit:
+ * If val is found in the vdp array, and in the osabi version of
+ * this function if the osabi matches, then the string corresponding
+ * val is returned. If a string for val is not found, conv_invalid_val()
+ * is called to format an ASCII representation of it into inv_buf, and
+ * that is returned.
+ */
+/*ARGSUSED4*/
+static const char *
+map_vd2str(Conv_inv_buf_t *inv_buf, Conv_elfvalue_t val,
+ Conv_fmt_flags_t flags, const Val_desc *vdp, const char *local_sgs_msg)
+{
+ for (; vdp->v_msg; vdp++) {
+ if (val == vdp->v_val)
+ return (MSG_ORIG_STRTAB(vdp->v_msg, local_sgs_msg));
+ }
+
+ /* If we get here, it's an unknown value */
+ return (conv_invalid_val(inv_buf, val, flags));
+}
+
+/*ARGSUSED6*/
+static const char *
+map_vd22str(Conv_inv_buf_t *inv_buf, uchar_t osabi, Half mach,
+ Conv_elfvalue_t val, Conv_fmt_flags_t flags, const Val_desc2 *vdp,
+ const char *local_sgs_msg)
+{
+ for (; vdp->v_msg; vdp++) {
+ if (CONV_VD2_SKIP(osabi, mach, vdp))
+ continue;
+
+ if (val == vdp->v_val)
+ return (MSG_ORIG_STRTAB(vdp->v_msg, local_sgs_msg));
+ }
+
+ /* If we get here, it's an unknown value */
+ return (conv_invalid_val(inv_buf, val, flags));
+}
+
+/*
+ * Process an array of conv_ds_XXX_t structures and call the appropriate
+ * map functions for the format of the strings given.
*/
const char *
-conv_invalid_val(Conv_inv_buf_t *inv_buf, Xword value,
- Conv_fmt_flags_t fmt_flags)
+_conv_map_ds(uchar_t osabi, Half mach, Conv_elfvalue_t value,
+ const conv_ds_t **dsp, Conv_fmt_flags_t fmt_flags, Conv_inv_buf_t *inv_buf,
+ const char *local_sgs_msg)
{
- const char *fmt;
-
- if (fmt_flags & CONV_FMT_DECIMAL) {
- if (fmt_flags & CONV_FMT_SPACE)
- fmt = MSG_ORIG(MSG_GBL_FMT_DECS);
- else
- fmt = MSG_ORIG(MSG_GBL_FMT_DEC);
- } else {
- if (fmt_flags & CONV_FMT_SPACE)
- fmt = MSG_ORIG(MSG_GBL_FMT_HEXS);
- else
- fmt = MSG_ORIG(MSG_GBL_FMT_HEX);
+ const conv_ds_t *ds;
+
+ for (ds = *dsp; ds != NULL; ds = *(++dsp)) {
+ if ((value < ds->ds_baseval) || (value > ds->ds_topval))
+ continue;
+
+ switch (ds->ds_type) {
+ case CONV_DS_MSGARR:
+ return (map_msg2str(inv_buf, value - ds->ds_baseval,
+ fmt_flags, ds->ds_topval - ds->ds_baseval + 1,
+ /*LINTED*/
+ ((conv_ds_msg_t *)ds)->ds_msg,
+ local_sgs_msg));
+
+ case CONV_DS_VD:
+ return (map_vd2str(inv_buf, value, fmt_flags,
+ /*LINTED*/
+ ((conv_ds_vd_t *)ds)->ds_vd,
+ local_sgs_msg));
+
+ case CONV_DS_VD2:
+ return (map_vd22str(inv_buf, osabi, mach, value,
+ fmt_flags,
+ /*LINTED*/
+ ((conv_ds_vd2_t *)ds)->ds_vd2,
+ local_sgs_msg));
+ }
}
- (void) snprintf(inv_buf->buf, sizeof (inv_buf->buf), fmt, value);
- return ((const char *)inv_buf->buf);
+
+ return (conv_invalid_val(inv_buf, value, fmt_flags));
}
+/*
+ * Iterate over every message string in a given array of Msg codes,
+ * calling a user supplied callback for each one.
+ *
+ * entry:
+ * basevalue - Value corresponding to the first Msg in the array.
+ * local_sgs_msg - Pointer to the __sgs_msg array for the
+ * libconv module making the call.
+ * num_msg - # of items in array referenced by msg
+ * msg - Array of Msg indexes for the strings to iterate over.
+ * The value corresponding to each element of msg must be:
+ * value[i] = basevalue + i
+ * func, uvalue - User supplied function to be called for each
+ * string in msg. uvalue is an arbitrary user supplied pointer
+ * to be passed to func.
+ * local_sgs_msg - Pointer to the __sgs_msg array for the
+ * libconv module making the call.
+ *
+ * exit:
+ * The callback function is called for every non-zero item in
+ * msg[]. If any callback returns CONV_ITER_DONE, execution stops
+ * with that item and the function returns immediately. Otherwise,
+ * it continues to the end of the array.
+ *
+ * The value from the last callback is returned.
+ */
+/*ARGSUSED5*/
+static conv_iter_ret_t
+_conv_iter_msgarr(uint32_t basevalue, const Msg *msg, size_t num_msg,
+ conv_iter_cb_t func, void *uvalue, const char *local_sgs_msg)
+{
+ for (; num_msg-- > 0; basevalue++, msg++) {
+ if (*msg != 0)
+ if ((* func)(MSG_ORIG_STRTAB(*msg, local_sgs_msg),
+ basevalue, uvalue) == CONV_ITER_DONE)
+ return (CONV_ITER_DONE);
+ }
+ return (CONV_ITER_CONT);
+}
/*
- * cef_cp() is used by conv_expn_field() to fill in the output buffer.
- * A CONV_EXPN_FIELD_STATE variable is used to maintain the buffer state
- * as the operation progresses.
+ * Iterate over every message string in a given array of Val_desc or
+ * Val_desc2 descriptors, calling a user supplied callback for each one.
*
* entry:
- * arg - As passed to conv_expn_field().
- * state - Variable used to maintain buffer state between calls.
- * list_item - TRUE(1) if this is a list item, and FALSE(0)
- * if it is something else.
- * str - String to be added to the buffer.
+ * osabi,mach (_conv_iter_vd2 only) - The osabi/mach for which
+ * strings are desired. Strings with a non-0 osabi or machine
+ * that do not match are quietly ignored.
+ * vdp - Pointer to NULL terminated array of Val_desc descriptors.
+ * func, uvalue - User supplied function to be called for each
+ * string in msg. uvalue is an arbitrary user supplied pointer
+ * to be passed to func.
+ * local_sgs_msg - Pointer to the __sgs_msg array for the
+ * libconv module making the call.
*
* exit:
- * On Success:
- * buffer contains the output string, including a list
- * separator if appropriate. state has been updated.
- * TRUE(1) is returned.
- * On Failure:
- * Buffer contains the numeric representation for the flags,
- * and FALSE(0) is returned.
+ * The callback function is called for every descriptor referenced by
+ * vdp. In the case of the OSABI-version of this function, strings from
+ * the wrong osabi are not used. If any callback returns CONV_ITER_DONE,
+ * execution stops with that item and the function returns immediately.
+ * Otherwise, it continues to the end of the array.
+ *
+ * The value from the last callback is returned.
*/
-typedef struct {
- char *cur; /* Current output position in buf */
- size_t room; /* # of bytes left in buf */
- int list_cnt; /* # of list items output into buf */
- const char *sep_str; /* String used as list separator */
- int sep_str_len; /* strlen(sep_str) */
-} CONV_EXPN_FIELD_STATE;
-
-static int
-cef_cp(CONV_EXPN_FIELD_ARG *arg, CONV_EXPN_FIELD_STATE *state,
- int list_item, const char *str)
+/*ARGSUSED3*/
+conv_iter_ret_t
+_conv_iter_vd(const Val_desc *vdp, conv_iter_cb_t func, void *uvalue,
+ const char *local_sgs_msg)
{
- Conv_inv_buf_t inv_buf;
- int n;
-
- if (list_item) { /* This is a list item */
- /*
- * If list is non-empty, and the buffer has room,
- * then insert the separator.
- */
- if (state->list_cnt != 0) {
- if (state->sep_str_len < state->room) {
- (void) memcpy(state->cur, state->sep_str,
- state->sep_str_len);
- state->cur += state->sep_str_len;
- state->room -= state->sep_str_len;
- } else {
- /* Ensure code below will catch lack of room */
- state->room = 0;
- }
- }
- state->list_cnt++;
+ for (; vdp->v_msg; vdp++) {
+ if ((* func)(MSG_ORIG_STRTAB(vdp->v_msg, local_sgs_msg),
+ vdp->v_val, uvalue) == CONV_ITER_DONE)
+ return (CONV_ITER_DONE);
}
- n = strlen(str);
- if (n < state->room) {
- (void) memcpy(state->cur, str, n);
- state->cur += n;
- state->room -= n;
- return (TRUE);
+ return (CONV_ITER_CONT);
+}
+
+/*ARGSUSED5*/
+conv_iter_ret_t
+_conv_iter_vd2(conv_iter_osabi_t osabi, Half mach, const Val_desc2 *vdp,
+ conv_iter_cb_t func, void *uvalue, const char *local_sgs_msg)
+{
+ for (; vdp->v_msg; vdp++) {
+ if (CONV_ITER_VD2_SKIP(osabi, mach, vdp))
+ continue;
+
+ if ((* func)(MSG_ORIG_STRTAB(vdp->v_msg, local_sgs_msg),
+ vdp->v_val, uvalue) == CONV_ITER_DONE)
+ return (CONV_ITER_DONE);
}
- /* Buffer too small. Fill in the numeric value and report failure */
- (void) conv_invalid_val(&inv_buf, arg->oflags, 0);
- (void) strlcpy(arg->buf, inv_buf.buf, arg->bufsize);
- return (FALSE);
+ return (CONV_ITER_CONT);
}
+/*
+ * Process an array of conv_ds_XXX_t structures and call the appropriate
+ * iteration functions for the format of the strings given.
+ */
+conv_iter_ret_t
+_conv_iter_ds(conv_iter_osabi_t osabi, Half mach, const conv_ds_t **dsp,
+ conv_iter_cb_t func, void *uvalue, const char *local_sgs_msg)
+{
+ const conv_ds_t *ds;
+
+ for (ds = *dsp; ds != NULL; ds = *(++dsp)) {
+ switch (ds->ds_type) {
+ case CONV_DS_MSGARR:
+ if (_conv_iter_msgarr(ds->ds_baseval,
+ /*LINTED*/
+ ((conv_ds_msg_t *)ds)->ds_msg,
+ ds->ds_topval - ds->ds_baseval + 1, func, uvalue,
+ local_sgs_msg) == CONV_ITER_DONE)
+ return (CONV_ITER_DONE);
+ break;
+ case CONV_DS_VD:
+ /*LINTED*/
+ if (_conv_iter_vd(((conv_ds_vd_t *)ds)->ds_vd,
+ func, uvalue, local_sgs_msg) == CONV_ITER_DONE)
+ return (CONV_ITER_DONE);
+ break;
+
+ case CONV_DS_VD2:
+ if (_conv_iter_vd2(osabi, mach,
+ /*LINTED*/
+ ((conv_ds_vd2_t *)ds)->ds_vd2,
+ func, uvalue, local_sgs_msg) == CONV_ITER_DONE)
+ return (CONV_ITER_DONE);
+ break;
+ }
+ }
+
+ return (CONV_ITER_CONT);
+}
/*
- * Provide a focal point for expanding bit-fields values into
- * their corresponding strings.
+ * Initialize the uvalue block prior to use of an interation function
+ * employing conv_iter_strtol().
*
* entry:
- * arg - Specifies the operation to be carried out. See the
- * definition of CONV_EXPN_FIELD_ARG in conv.h for details.
+ * str - String to be matched to a value
+ * uvalue - Pointer to uninitialized uvalue block
*
* exit:
- * arg->buf contains the formatted result. True (1) is returned if there
- * was no error, and False (0) if the buffer was too small. In the failure
- * case, arg->buf contains a numeric representation of the value.
+ * Initializes the uvalue block for use. Returns True (1) if a non-empty
+ * string was supplied, and False (0).
*/
int
-conv_expn_field(CONV_EXPN_FIELD_ARG *arg, Conv_fmt_flags_t fmt_flags)
+conv_iter_strtol_init(const char *str, conv_strtol_uvalue_t *uvalue)
{
- const Val_desc *vde;
- CONV_EXPN_FIELD_STATE state;
- Xword rflags = arg->rflags;
- const char **lead_str;
-
-
- /* Initialize buffer state */
- state.cur = arg->buf;
- state.room = arg->bufsize;
- state.list_cnt = 0;
- state.sep_str = arg->sep ? arg->sep : MSG_ORIG(MSG_GBL_SEP);
- state.sep_str_len = strlen(state.sep_str);
-
- /* Prefix string */
- if ((fmt_flags & CONV_FMT_NOBKT) == 0)
- if (!cef_cp(arg, &state, FALSE,
- (arg->prefix ? arg->prefix : MSG_ORIG(MSG_GBL_OSQBRKT))))
- return (FALSE);
-
- /* Any strings in the lead_str array go at the head of the list */
- lead_str = arg->lead_str;
- if (lead_str) {
- while (*lead_str) {
- if (!cef_cp(arg, &state, TRUE, *lead_str++))
- return (FALSE);
- }
- }
+ const char *tail;
- /*
- * Traverse the callers Val_desc array and determine if the value
- * corresponds to any array item and add those that are to the list.
- */
- for (vde = arg->vdp; vde->v_msg; vde++) {
- if (arg->oflags & vde->v_val) {
- if (!cef_cp(arg, &state, TRUE, vde->v_msg))
- return (FALSE);
-
- /* Indicate this item has been collected */
- rflags &= ~(vde->v_val);
- }
- }
+ while (isspace(*str))
+ str++;
+ uvalue->csl_str = str;
+ uvalue->csl_found = 0;
- /*
- * If any flags remain, then they are unidentified. Add the numeric
- * representation of these flags to the users output buffer.
- */
- if (rflags) {
- Conv_inv_buf_t inv_buf;
+ tail = str + strlen(str);
+ while ((tail > str) && isspace(*(tail - 1)))
+ tail--;
+ uvalue->csl_strlen = tail - str;
- (void) conv_invalid_val(&inv_buf, rflags, fmt_flags);
- if (!cef_cp(arg, &state, TRUE, inv_buf.buf))
- return (FALSE);
- }
+ return (uvalue->csl_strlen > 0);
+}
- /* Suffix string */
- if ((fmt_flags & CONV_FMT_NOBKT) == 0)
- if (!cef_cp(arg, &state, FALSE,
- (arg->suffix ? arg->suffix : MSG_ORIG(MSG_GBL_CSQBRKT))))
- return (FALSE);
+/*
+ * conv_iter_strtol() is used with iteration functions to map a string
+ * to the value of its corresponding ELF constant.
+ *
+ * entry:
+ * str - String supplied by this iteration
+ * value - Value of ELF constant corresponding to str
+ * uvalue - Pointer to conv_strtol_uvalue_t block previously
+ * initialized by a call to conv_iter_strtol_init().
+ */
+conv_iter_ret_t
+conv_iter_strtol(const char *str, uint32_t value, void *uvalue)
+{
+ conv_strtol_uvalue_t *state = (conv_strtol_uvalue_t *)uvalue;
- /* Terminate the buffer */
- *state.cur = '\0';
+ if ((strlen(str) == state->csl_strlen) &&
+ (strncasecmp(str, state->csl_str, state->csl_strlen) == 0)) {
+ state->csl_found = 1;
+ state->csl_value = value;
+ return (CONV_ITER_DONE); /* Found it. Stop now. */
+ }
- return (TRUE);
+ return (CONV_ITER_CONT); /* Keep looking */
}
diff --git a/usr/src/cmd/sgs/libconv/common/globals_machelf.c b/usr/src/cmd/sgs/libconv/common/globals_machelf.c
new file mode 100644
index 0000000000..cbf0136e5e
--- /dev/null
+++ b/usr/src/cmd/sgs/libconv/common/globals_machelf.c
@@ -0,0 +1,286 @@
+/*
+ * 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
+ * or http://www.opensolaris.org/os/licensing.
+ * 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.
+ */
+
+#include <stdio.h>
+#include <strings.h>
+#include <ctype.h>
+#include <_machelf.h>
+#include "_conv.h"
+#include "globals_msg.h"
+
+
+/*
+ * Given an integer value, generate an ASCII representation of it.
+ *
+ * entry:
+ * inv_buf - Buffer into which the resulting string is generated.
+ * value - Value to be formatted.
+ * fmt_flags - CONV_FMT_* values, used to specify formatting details.
+ *
+ * exit:
+ * The formatted string is placed into inv_buf. The pointer
+ * to the string is returned.
+ */
+const char *
+conv_invalid_val(Conv_inv_buf_t *inv_buf, Xword value,
+ Conv_fmt_flags_t fmt_flags)
+{
+ const char *fmt;
+
+ if (fmt_flags & CONV_FMT_DECIMAL) {
+ if (fmt_flags & CONV_FMT_SPACE)
+ fmt = MSG_ORIG(MSG_GBL_FMT_DECS);
+ else
+ fmt = MSG_ORIG(MSG_GBL_FMT_DEC);
+ } else {
+ if (fmt_flags & CONV_FMT_SPACE)
+ fmt = MSG_ORIG(MSG_GBL_FMT_HEXS);
+ else
+ fmt = MSG_ORIG(MSG_GBL_FMT_HEX);
+ }
+ (void) snprintf(inv_buf->buf, sizeof (inv_buf->buf), fmt, value);
+ return ((const char *)inv_buf->buf);
+}
+
+
+
+/*
+ * cef_cp() is used by conv_expn_field() to fill in the output buffer.
+ * A CONV_EXPN_FIELD_STATE variable is used to maintain the buffer state
+ * as the operation progresses.
+ *
+ * entry:
+ * arg - As passed to conv_expn_field().
+ * state - Variable used to maintain buffer state between calls.
+ * list_item - TRUE(1) if this is a list item, and FALSE(0)
+ * if it is something else.
+ * str - String to be added to the buffer.
+ *
+ * exit:
+ * On Success:
+ * buffer contains the output string, including a list
+ * separator if appropriate. state has been updated.
+ * TRUE(1) is returned.
+ * On Failure:
+ * Buffer contains the numeric representation for the flags,
+ * and FALSE(0) is returned.
+ */
+typedef struct {
+ char *cur; /* Current output position in buf */
+ size_t room; /* # of bytes left in buf */
+ int list_cnt; /* # of list items output into buf */
+ const char *sep_str; /* String used as list separator */
+ int sep_str_len; /* strlen(sep_str) */
+} CONV_EXPN_FIELD_STATE;
+
+static int
+cef_cp(CONV_EXPN_FIELD_ARG *arg, CONV_EXPN_FIELD_STATE *state,
+ int list_item, const char *str)
+{
+ Conv_inv_buf_t inv_buf;
+ int n;
+
+ if (list_item) { /* This is a list item */
+ /*
+ * If list is non-empty, and the buffer has room,
+ * then insert the separator.
+ */
+ if (state->list_cnt != 0) {
+ if (state->sep_str_len < state->room) {
+ (void) memcpy(state->cur, state->sep_str,
+ state->sep_str_len);
+ state->cur += state->sep_str_len;
+ state->room -= state->sep_str_len;
+ } else {
+ /* Ensure code below will catch lack of room */
+ state->room = 0;
+ }
+ }
+ state->list_cnt++;
+ }
+
+ n = strlen(str);
+ if (n < state->room) {
+ (void) memcpy(state->cur, str, n);
+ state->cur += n;
+ state->room -= n;
+ return (TRUE);
+ }
+
+ /* Buffer too small. Fill in the numeric value and report failure */
+ (void) conv_invalid_val(&inv_buf, arg->oflags, 0);
+ (void) strlcpy(arg->buf, inv_buf.buf, arg->bufsize);
+ return (FALSE);
+}
+
+
+
+/*
+ * Common setup code for conv_expn_field() and conv_expn_field2()
+ */
+static int
+cef_setup(CONV_EXPN_FIELD_ARG *arg, Conv_fmt_flags_t fmt_flags,
+ CONV_EXPN_FIELD_STATE *state)
+{
+ const char **lead_str;
+
+ /* Initialize buffer state */
+ state->cur = arg->buf;
+ state->room = arg->bufsize;
+ state->list_cnt = 0;
+ state->sep_str = arg->sep ? arg->sep : MSG_ORIG(MSG_GBL_SEP);
+ state->sep_str_len = strlen(state->sep_str);
+
+ /* Prefix string */
+ if ((fmt_flags & CONV_FMT_NOBKT) == 0)
+ if (!cef_cp(arg, state, FALSE,
+ (arg->prefix ? arg->prefix : MSG_ORIG(MSG_GBL_OSQBRKT))))
+ return (FALSE);
+
+ /* Any strings in the lead_str array go at the head of the list */
+ lead_str = arg->lead_str;
+ if (lead_str) {
+ while (*lead_str) {
+ if (!cef_cp(arg, state, TRUE, *lead_str++))
+ return (FALSE);
+ }
+ }
+
+ return (TRUE);
+}
+
+/*
+ * Common finishing code for conv_expn_field() and conv_expn_field2()
+ */
+static int
+cef_wrap(CONV_EXPN_FIELD_ARG *arg, Conv_fmt_flags_t fmt_flags,
+ CONV_EXPN_FIELD_STATE *state, Xword rflags)
+{
+ /*
+ * If any flags remain, then they are unidentified. Add the numeric
+ * representation of these flags to the users output buffer.
+ */
+ if (rflags) {
+ Conv_inv_buf_t inv_buf;
+
+ (void) conv_invalid_val(&inv_buf, rflags, fmt_flags);
+ if (!cef_cp(arg, state, TRUE, inv_buf.buf))
+ return (FALSE);
+ }
+
+ /* Suffix string */
+ if ((fmt_flags & CONV_FMT_NOBKT) == 0)
+ if (!cef_cp(arg, state, FALSE,
+ (arg->suffix ? arg->suffix : MSG_ORIG(MSG_GBL_CSQBRKT))))
+ return (FALSE);
+
+ /* Terminate the buffer */
+ *state->cur = '\0';
+
+ return (TRUE);
+}
+
+/*
+ * Provide a focal point for expanding bit-fields values into
+ * their corresponding strings.
+ *
+ * entry:
+ * arg - Specifies the operation to be carried out. See the
+ * definition of CONV_EXPN_FIELD_ARG in conv.h for details.
+ * vdp - Array of value descriptors, giving the possible bit values,
+ * and their corresponding strings. Note that the final element
+ * must contain only NULL values. This terminates the list.
+ *
+ * exit:
+ * arg->buf contains the formatted result. True (1) is returned if there
+ * was no error, and False (0) if the buffer was too small. In the failure
+ * case, arg->buf contains a numeric representation of the value.
+ *
+ * note:
+ * The Val_desc2 variant of this routine ignores entries from vdp that
+ * have a non-zero osabi or machine value that does not match that
+ * supplied by the caller.
+ */
+/*ARGSUSED3*/
+int
+_conv_expn_field(CONV_EXPN_FIELD_ARG *arg, const Val_desc *vdp,
+ Conv_fmt_flags_t fmt_flags, const char *local_sgs_msg)
+{
+ CONV_EXPN_FIELD_STATE state;
+ Xword rflags = arg->rflags;
+
+ if (cef_setup(arg, fmt_flags, &state) == FALSE)
+ return (FALSE);
+
+ /*
+ * Traverse the callers Val_desc array and determine if the value
+ * corresponds to any array item and add those that are to the list.
+ */
+ for (; vdp->v_msg; vdp++) {
+ if (arg->oflags & vdp->v_val) {
+ if (!cef_cp(arg, &state, TRUE,
+ MSG_ORIG_STRTAB(vdp->v_msg, local_sgs_msg)))
+ return (FALSE);
+
+ /* Indicate this item has been collected */
+ rflags &= ~(vdp->v_val);
+ }
+ }
+
+ return (cef_wrap(arg, fmt_flags, &state, rflags));
+}
+
+/*ARGSUSED5*/
+int
+_conv_expn_field2(CONV_EXPN_FIELD_ARG *arg, uchar_t osabi, Half mach,
+ const Val_desc2 *vdp, Conv_fmt_flags_t fmt_flags, const char *local_sgs_msg)
+{
+ CONV_EXPN_FIELD_STATE state;
+ Xword rflags = arg->rflags;
+
+ if (cef_setup(arg, fmt_flags, &state) == FALSE)
+ return (FALSE);
+
+ /*
+ * Traverse the callers Val_desc array and determine if the value
+ * corresponds to any array item and add those that are to the list.
+ */
+ for (; vdp->v_msg; vdp++) {
+ if (CONV_VD2_SKIP(osabi, mach, vdp))
+ continue;
+
+ if (arg->oflags & vdp->v_val) {
+ if (!cef_cp(arg, &state, TRUE,
+ MSG_ORIG_STRTAB(vdp->v_msg, local_sgs_msg)))
+ return (FALSE);
+
+ /* Indicate this item has been collected */
+ rflags &= ~(vdp->v_val);
+ }
+ }
+
+ return (cef_wrap(arg, fmt_flags, &state, rflags));
+}
diff --git a/usr/src/cmd/sgs/libconv/common/group.c b/usr/src/cmd/sgs/libconv/common/group.c
index d80fd7aca9..c0e09d99db 100644
--- a/usr/src/cmd/sgs/libconv/common/group.c
+++ b/usr/src/cmd/sgs/libconv/common/group.c
@@ -20,10 +20,9 @@
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
#include <string.h>
#include "rtld.h"
@@ -60,24 +59,24 @@
const char *
conv_grphdl_flags(uint_t flags, Conv_grphdl_flags_buf_t *grphdl_flags_buf)
{
- static Val_desc vda[] = {
- { GPH_ZERO, MSG_ORIG(MSG_GPH_ZERO) },
- { GPH_LDSO, MSG_ORIG(MSG_GPH_LDSO) },
- { GPH_FIRST, MSG_ORIG(MSG_GPH_FIRST) },
- { GPH_FILTEE, MSG_ORIG(MSG_GPH_FILTEE) },
- { GPH_INITIAL, MSG_ORIG(MSG_GPH_INITIAL) },
- { GPH_NOPENDLAZY, MSG_ORIG(MSG_GPH_NOPENDLAZY) },
+ static const Val_desc vda[] = {
+ { GPH_ZERO, MSG_GPH_ZERO },
+ { GPH_LDSO, MSG_GPH_LDSO },
+ { GPH_FIRST, MSG_GPH_FIRST },
+ { GPH_FILTEE, MSG_GPH_FILTEE },
+ { GPH_INITIAL, MSG_GPH_INITIAL },
+ { GPH_NOPENDLAZY, MSG_GPH_NOPENDLAZY },
{ 0, 0 }
};
static CONV_EXPN_FIELD_ARG conv_arg = {
- NULL, sizeof (grphdl_flags_buf->buf), vda };
+ NULL, sizeof (grphdl_flags_buf->buf) };
if (flags == 0)
return (MSG_ORIG(MSG_GBL_NULL));
conv_arg.buf = grphdl_flags_buf->buf;
conv_arg.oflags = conv_arg.rflags = flags;
- (void) conv_expn_field(&conv_arg, 0);
+ (void) conv_expn_field(&conv_arg, vda, 0);
return ((const char *)grphdl_flags_buf->buf);
}
@@ -113,25 +112,25 @@ conv_grphdl_flags(uint_t flags, Conv_grphdl_flags_buf_t *grphdl_flags_buf)
const char *
conv_grpdesc_flags(uint_t flags, Conv_grpdesc_flags_buf_t *grpdesc_flags_buf)
{
- static Val_desc vda[] = {
- { GPD_DLSYM, MSG_ORIG(MSG_GPD_DLSYM) },
- { GPD_RELOC, MSG_ORIG(MSG_GPD_RELOC) },
- { GPD_ADDEPS, MSG_ORIG(MSG_GPD_ADDEPS) },
- { GPD_PARENT, MSG_ORIG(MSG_GPD_PARENT) },
- { GPD_FILTER, MSG_ORIG(MSG_GPD_FILTER) },
- { GPD_PROMOTE, MSG_ORIG(MSG_GPD_PROMOTE) },
- { GPD_REMOVE, MSG_ORIG(MSG_GPD_REMOVE) },
+ static const Val_desc vda[] = {
+ { GPD_DLSYM, MSG_GPD_DLSYM },
+ { GPD_RELOC, MSG_GPD_RELOC },
+ { GPD_ADDEPS, MSG_GPD_ADDEPS },
+ { GPD_PARENT, MSG_GPD_PARENT },
+ { GPD_FILTER, MSG_GPD_FILTER },
+ { GPD_PROMOTE, MSG_GPD_PROMOTE },
+ { GPD_REMOVE, MSG_GPD_REMOVE },
{ 0, 0 }
};
static CONV_EXPN_FIELD_ARG conv_arg = {
- NULL, sizeof (grpdesc_flags_buf->buf), vda };
+ NULL, sizeof (grpdesc_flags_buf->buf) };
if (flags == 0)
return (MSG_ORIG(MSG_GBL_NULL));
conv_arg.buf = grpdesc_flags_buf->buf;
conv_arg.oflags = conv_arg.rflags = flags;
- (void) conv_expn_field(&conv_arg, 0);
+ (void) conv_expn_field(&conv_arg, vda, 0);
return ((const char *)grpdesc_flags_buf->buf);
}
diff --git a/usr/src/cmd/sgs/libconv/common/lintsup.c b/usr/src/cmd/sgs/libconv/common/lintsup.c
index 172ea6bdc9..b05e76e13c 100644
--- a/usr/src/cmd/sgs/libconv/common/lintsup.c
+++ b/usr/src/cmd/sgs/libconv/common/lintsup.c
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * 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
* or http://www.opensolaris.org/os/licensing.
@@ -23,10 +22,9 @@
/* PROTOLIB1 */
/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Supplimental definitions for lint that help us avoid
@@ -38,6 +36,7 @@
* The public interfaces are allowed to be "declared
* but not used".
*/
+#include <stdio.h>
#include <sys/auxv.h>
#include <libelf.h>
#include <link.h>
@@ -48,4 +47,70 @@
#include "rtld.h"
#include "libld.h"
#include "conv.h"
+
+/*
+ * Suppress the actual message codes from the sgsmsg headers.
+ * With multiple string tables, we will have name collisions.
+ */
+#define LINTSUP_SUPPRESS_STRINGS
#include "arch_msg.h"
+#include "c_literal_msg.h"
+#include "cap_msg.h"
+#include "config_msg.h"
+#include "corenote_msg.h"
+#include "data_msg.h"
+#include "deftag_msg.h"
+#include "demangle_msg.h"
+#include "dl_msg.h"
+#include "dwarf_ehe_msg.h"
+#include "dwarf_msg.h"
+#include "dynamic_msg.h"
+#include "elf_msg.h"
+#include "globals_msg.h"
+#include "group_msg.h"
+#include "lddstub_msg.h"
+#include "phdr_msg.h"
+#include "relocate_amd64_msg.h"
+#include "relocate_i386_msg.h"
+#include "relocate_sparc_msg.h"
+#include "sections_msg.h"
+#include "segments_msg.h"
+#include "symbols_msg.h"
+#include "symbols_sparc_msg.h"
+#include "syminfo_msg.h"
+#include "version_msg.h"
+
+void
+foo()
+{
+#define USE(name) (void) name((Msg)&_ ## name[0])
+
+ USE(_sgs_msg_libconv_arch);
+ USE(_sgs_msg_libconv_c_literal);
+ USE(_sgs_msg_libconv_cap);
+ USE(_sgs_msg_libconv_config);
+ USE(_sgs_msg_libconv_corenote);
+ USE(_sgs_msg_libconv_data);
+ USE(_sgs_msg_libconv_deftag);
+ USE(_sgs_msg_libconv_demangle);
+ USE(_sgs_msg_libconv_dl);
+ USE(_sgs_msg_libconv_dwarf_ehe);
+ USE(_sgs_msg_libconv_dwarf);
+ USE(_sgs_msg_libconv_dynamic);
+ USE(_sgs_msg_libconv_elf);
+ USE(_sgs_msg_libconv_globals);
+ USE(_sgs_msg_libconv_group);
+ USE(_sgs_msg_libconv_lddstub);
+ USE(_sgs_msg_libconv_phdr);
+ USE(_sgs_msg_libconv_relocate_amd64);
+ USE(_sgs_msg_libconv_relocate_i386);
+ USE(_sgs_msg_libconv_relocate_sparc);
+ USE(_sgs_msg_libconv_sections);
+ USE(_sgs_msg_libconv_segments);
+ USE(_sgs_msg_libconv_symbols);
+ USE(_sgs_msg_libconv_symbols_sparc);
+ USE(_sgs_msg_libconv_syminfo);
+ USE(_sgs_msg_libconv_version);
+
+#undef USE
+}
diff --git a/usr/src/cmd/sgs/libconv/common/llib-lconv b/usr/src/cmd/sgs/libconv/common/llib-lconv
index 0ba1cbe236..16e86ccb8f 100644
--- a/usr/src/cmd/sgs/libconv/common/llib-lconv
+++ b/usr/src/cmd/sgs/libconv/common/llib-lconv
@@ -20,7 +20,7 @@
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* LINTLIBRARY */
@@ -34,131 +34,258 @@
#include <conv.h>
/*
- * Define all generic interfaces.
+ * Generic miscellaneous interfaces
*/
uchar_t conv_check_native(char **, char **);
-const char *conv_config_feat(int, Conv_config_feat_buf_t *);
+const char *conv_lddstub(int);
+int conv_sys_eclass(void);
+
+/*
+ * Generic core formatting and iteration functionality
+ */
+conv_iter_ret_t _conv_iter_ds(conv_iter_osabi_t, Half, const conv_ds_t **,
+ conv_iter_cb_t, void *, const char *);
+conv_iter_ret_t _conv_iter_ds_msg(const conv_ds_msg_t *, conv_iter_cb_t,
+ void *, const char *);
+conv_iter_ret_t _conv_iter_msgarr(Conv_elfvalue_t, const Msg *, size_t,
+ conv_iter_cb_t, void *, const char *);
+conv_iter_ret_t _conv_iter_vd(const Val_desc *, conv_iter_cb_t,
+ void *, const char *);
+conv_iter_ret_t _conv_iter_vd2(conv_iter_osabi_t, Half, const Val_desc2 *,
+ conv_iter_cb_t, void *, const char *);
+int conv_iter_strtol_init(const char *, conv_strtol_uvalue_t *);
+conv_iter_ret_t conv_iter_strtol(const char *, Conv_elfvalue_t, void *);
+const char *_conv_map2str(Conv_inv_buf_t *, Conv_elfvalue_t,
+ Conv_fmt_flags_t, size_t, const Msg *, const char *);
+const char *_conv_map_ds(uchar_t, Half, Conv_elfvalue_t,
+ const conv_ds_t **, Conv_fmt_flags_t, Conv_inv_buf_t *,
+ const char *);
+const char *_conv_map_vd2str(Conv_inv_buf_t *, Conv_elfvalue_t,
+ Conv_fmt_flags_t, const Val_desc *, const char *);
+const char *_conv_map_vd22str(Conv_inv_buf_t *, uchar_t, Half,
+ Conv_elfvalue_t, Conv_fmt_flags_t, const Val_desc2 *,
+ const char *);
+
+/*
+ * Generic formatting interfaces.
+ */
+const char *conv_bnd_obj(uint_t, Conv_bnd_obj_buf_t *);
+const char *conv_bnd_type(uint_t, Conv_bnd_type_buf_t *);
+const char *conv_config_feat(int, Conv_config_feat_buf_t *);
const char *conv_config_obj(ushort_t, Conv_config_obj_buf_t *);
-const char *conv_config_upm(const char *, const char *, const char *,
- size_t);
+const char *conv_config_upm(const char *, const char *,
+ const char *, size_t);
+const char *conv_cnote_auxv_af(Word, Conv_fmt_flags_t,
+ Conv_cnote_auxv_af_buf_t *);
+const char *conv_cnote_auxv_type(Word, Conv_fmt_flags_t, Conv_inv_buf_t *);
+const char *conv_cnote_cc_content(Lword, Conv_fmt_flags_t,
+ Conv_cnote_cc_content_buf_t *);
+const char *conv_cnote_errno(int, Conv_fmt_flags_t, Conv_inv_buf_t *);
+const char *conv_cnote_fault(Word, Conv_fmt_flags_t, Conv_inv_buf_t *);
+const char *conv_cnote_fltset(uint32_t *, int, Conv_fmt_flags_t,
+ Conv_cnote_fltset_buf_t *);
+const char *conv_cnote_old_pr_flags(int, Conv_fmt_flags_t,
+ Conv_cnote_old_pr_flags_buf_t *);
+const char *conv_cnote_pr_dmodel(Word, Conv_fmt_flags_t, Conv_inv_buf_t *);
+const char *conv_cnote_pr_flags(int, Conv_fmt_flags_t,
+ Conv_cnote_pr_flags_buf_t *);
+const char *conv_cnote_proc_flag(int, Conv_fmt_flags_t,
+ Conv_cnote_proc_flag_buf_t *);
+const char *conv_cnote_pr_regname(Half, int, Conv_fmt_flags_t,
+ Conv_inv_buf_t *inv_buf);
+const char *conv_cnote_pr_stype(Word, Conv_fmt_flags_t, Conv_inv_buf_t *);
+const char *conv_cnote_pr_what(short, short, Conv_fmt_flags_t,
+ Conv_inv_buf_t *);
+const char *conv_cnote_pr_why(short, Conv_fmt_flags_t, Conv_inv_buf_t *);
+const char *conv_cnote_priv(int, Conv_fmt_flags_t, Conv_inv_buf_t *);
+const char *conv_cnote_psetid(int, Conv_fmt_flags_t, Conv_inv_buf_t *);
+const char *conv_cnote_sa_flags(int, Conv_fmt_flags_t,
+ Conv_cnote_sa_flags_buf_t *);
+const char *conv_cnote_signal(Word, Conv_fmt_flags_t, Conv_inv_buf_t *);
+const char *conv_cnote_si_code(Half, int, int, Conv_fmt_flags_t,
+ Conv_inv_buf_t *);
+const char *conv_cnote_sigset(uint32_t *, int, Conv_fmt_flags_t,
+ Conv_cnote_sigset_buf_t *);
+const char *conv_cnote_ss_flags(int, Conv_fmt_flags_t,
+ Conv_cnote_ss_flags_buf_t *);
+const char *conv_cnote_syscall(Word, Conv_fmt_flags_t, Conv_inv_buf_t *);
+const char *conv_cnote_sysset(uint32_t *, int, Conv_fmt_flags_t,
+ Conv_cnote_sysset_buf_t *);
+const char *conv_cnote_type(Word, Conv_fmt_flags_t, Conv_inv_buf_t *);
const char *conv_def_tag(Symref, Conv_inv_buf_t *);
const char *conv_demangle_name(const char *);
-const char *conv_dl_flag(int, int, Conv_dl_flag_buf_t *);
+const char *conv_dl_flag(int, Conv_fmt_flags_t, Conv_dl_flag_buf_t *);
const char *conv_dl_mode(int, int, Conv_dl_mode_buf_t *);
+const char *conv_dwarf_cfa(uchar_t, Conv_fmt_flags_t, Conv_inv_buf_t *);
const char *conv_dwarf_ehe(uint_t, Conv_dwarf_ehe_buf_t *);
+const char *conv_dwarf_regname(Half, Word, Conv_fmt_flags_t,
+ int *, Conv_inv_buf_t *);
+const char *conv_ehdr_abivers(uchar_t, Word, Conv_fmt_flags_t,
+ Conv_inv_buf_t *);
+const char *conv_ehdr_class(uchar_t, Conv_fmt_flags_t, Conv_inv_buf_t *);
+const char *conv_ehdr_data(uchar_t, Conv_fmt_flags_t, Conv_inv_buf_t *);
+const char *conv_ehdr_flags(Half, Word, Conv_fmt_flags_t,
+ Conv_ehdr_flags_buf_t *);
+const char *conv_ehdr_mach(Half, Conv_fmt_flags_t, Conv_inv_buf_t *);
+const char *conv_ehdr_osabi(uchar_t, Conv_fmt_flags_t, Conv_inv_buf_t *);
+const char *conv_ehdr_type(uchar_t, Half, Conv_fmt_flags_t,
+ Conv_inv_buf_t *);
+const char *conv_ehdr_vers(Word, Conv_fmt_flags_t, Conv_inv_buf_t *);
const char *conv_elfdata_type(Elf_Type, Conv_inv_buf_t *);
-int conv_expn_field(CONV_EXPN_FIELD_ARG *, Conv_fmt_flags_t);
const char *conv_grphdl_flags(uint_t, Conv_grphdl_flags_buf_t *);
const char *conv_grpdesc_flags(uint_t, Conv_grpdesc_flags_buf_t *);
Isa_desc *conv_isalist(void);
-const char *conv_lddstub(int);
+const char *conv_phdr_flags(uchar_t, Word, Conv_fmt_flags_t,
+ Conv_phdr_flags_buf_t *);
+const char *conv_phdr_type(uchar_t, Half, Word, Conv_fmt_flags_t,
+ Conv_inv_buf_t *);
+const char *conv_reject_desc(Rej_desc *, Conv_reject_desc_buf_t *,
+ Half mach);
+const char *conv_reloc_type(Half, Word, Conv_fmt_flags_t,
+ Conv_inv_buf_t *);
+const char *conv_reloc_type_static(Half, Word, Conv_fmt_flags_t);
+const char *conv_reloc_386_type(Word, Conv_fmt_flags_t, Conv_inv_buf_t *);
+const char *conv_reloc_amd64_type(Word, Conv_fmt_flags_t,
+ Conv_inv_buf_t *);
+const char *conv_reloc_SPARC_type(Word, Conv_fmt_flags_t,
+ Conv_inv_buf_t *);
+const char *conv_sec_type(uchar_t, Half, Word, Conv_fmt_flags_t,
+ Conv_inv_buf_t *);
const char *conv_seg_flags(Half, Conv_seg_flags_buf_t *);
-int conv_sys_eclass(void);
+void conv_str_to_c_literal(const char *buf, size_t n,
+ Conv_str_to_c_literal_func_t *cb_func, void *uvalue);
+const char *conv_sym_info_bind(uchar_t, Conv_fmt_flags_t,
+ Conv_inv_buf_t *);
+const char *conv_sym_info_type(Half, uchar_t, Conv_fmt_flags_t,
+ Conv_inv_buf_t *);
+const char *conv_sym_shndx(uchar_t, Half, Half, Conv_fmt_flags_t,
+ Conv_inv_buf_t *);
+const char *conv_sym_other(uchar_t, Conv_inv_buf_t *);
+const char *conv_sym_other_vis(uchar_t, Conv_fmt_flags_t,
+ Conv_inv_buf_t *);
+const char *conv_syminfo_boundto(Half, Conv_fmt_flags_t, Conv_inv_buf_t *);
+const char *conv_syminfo_flags(Half, Conv_fmt_flags_t,
+ Conv_syminfo_flags_buf_t *);
Uts_desc *conv_uts(void);
const char *conv_ver_flags(Half, Conv_fmt_flags_t, Conv_ver_flags_buf_t *);
const char *conv_ver_index(Versym, int, Conv_inv_buf_t *);
/*
+ * Generic iteration interfaces.
+ */
+conv_iter_ret_t conv_iter_cap_tags(Conv_fmt_flags_t, conv_iter_cb_t, void *);
+conv_iter_ret_t conv_iter_cap_val_hw1(Half, Conv_fmt_flags_t,
+ conv_iter_cb_t, void *);
+conv_iter_ret_t conv_iter_cap_val_sf1(Conv_fmt_flags_t, conv_iter_cb_t, void *);
+
+conv_iter_ret_t conv_iter_dyn_feature1(Conv_fmt_flags_t,
+ conv_iter_cb_t, void *);
+conv_iter_ret_t conv_iter_dyn_flag(Conv_fmt_flags_t, conv_iter_cb_t, void *);
+conv_iter_ret_t conv_iter_dyn_flag1(Conv_fmt_flags_t, conv_iter_cb_t, void *);
+conv_iter_ret_t conv_iter_dyn_posflag1(Conv_fmt_flags_t,
+ conv_iter_cb_t, void *);
+conv_iter_ret_t conv_iter_dyn_tag(conv_iter_osabi_t, Half,
+ Conv_fmt_flags_t, conv_iter_cb_t, void *);
+
+conv_iter_ret_t conv_iter_ehdr_abivers(conv_iter_osabi_t,
+ Conv_fmt_flags_t, conv_iter_cb_t, void *);
+conv_iter_ret_t conv_iter_ehdr_class(Conv_fmt_flags_t, conv_iter_cb_t, void *);
+conv_iter_ret_t conv_iter_ehdr_data(Conv_fmt_flags_t, conv_iter_cb_t, void *);
+conv_iter_ret_t conv_iter_ehdr_eident(Conv_fmt_flags_t, conv_iter_cb_t, void *);
+conv_iter_ret_t conv_iter_ehdr_flags(Half, Conv_fmt_flags_t,
+ conv_iter_cb_t, void *);
+conv_iter_ret_t conv_iter_ehdr_mach(Conv_fmt_flags_t, conv_iter_cb_t, void *);
+conv_iter_ret_t conv_iter_ehdr_osabi(Conv_fmt_flags_t, conv_iter_cb_t, void *);
+conv_iter_ret_t conv_iter_ehdr_type(conv_iter_osabi_t, Conv_fmt_flags_t,
+ conv_iter_cb_t, void *);
+conv_iter_ret_t conv_iter_ehdr_vers(Conv_fmt_flags_t, conv_iter_cb_t, void *);
+
+conv_iter_ret_t conv_iter_phdr_flags(conv_iter_osabi_t,
+ Conv_fmt_flags_t, conv_iter_cb_t, void *);
+conv_iter_ret_t conv_iter_phdr_type(conv_iter_osabi_t, Conv_fmt_flags_t,
+ conv_iter_cb_t, void *);
+
+conv_iter_ret_t conv_iter_sec_flags(conv_iter_osabi_t, Half,
+ Conv_fmt_flags_t, conv_iter_cb_t, void *);
+conv_iter_ret_t conv_iter_sec_symtab(conv_iter_osabi_t,
+ Conv_fmt_flags_t, conv_iter_cb_t, void *);
+conv_iter_ret_t conv_iter_sec_type(conv_iter_osabi_t, Half,
+ Conv_fmt_flags_t, conv_iter_cb_t, void *);
+
+conv_iter_ret_t conv_iter_sym_info_bind(Conv_fmt_flags_t,
+ conv_iter_cb_t, void *);
+conv_iter_ret_t conv_iter_sym_other_vis(Conv_fmt_flags_t,
+ conv_iter_cb_t, void *);
+conv_iter_ret_t conv_iter_sym_shndx(conv_iter_osabi_t, Half,
+ Conv_fmt_flags_t, conv_iter_cb_t, void *);
+conv_iter_ret_t conv_iter_sym_info_type(Half, Conv_fmt_flags_t,
+ conv_iter_cb_t, void *);
+
+conv_iter_ret_t conv_iter_syminfo_boundto(Conv_fmt_flags_t,
+ conv_iter_cb_t, void *);
+conv_iter_ret_t conv_iter_syminfo_flags(Conv_fmt_flags_t,
+ conv_iter_cb_t, void *);
+
+
+/*
+ * ELFCLASS-specific core formatting functionality
+ */
+int _conv_expn_field(CONV_EXPN_FIELD_ARG *,
+ const Val_desc *, Conv_fmt_flags_t, const char *);
+int _conv_expn_field2(CONV_EXPN_FIELD_ARG *, uchar_t,
+ Half, const Val_desc2 *, Conv_fmt_flags_t, const char *);
+const char *conv_invalid_val(Conv_inv_buf_t *, Xword, Conv_fmt_flags_t);
+
+
+/*
* Define all class specific routines.
*/
-const char *conv32_bnd_obj(uint_t, Conv32_bnd_obj_buf_t *);
-const char *conv64_bnd_obj(uint_t, Conv64_bnd_obj_buf_t *);
-const char *conv32_bnd_type(uint_t, Conv32_bnd_type_buf_t *);
-const char *conv64_bnd_type(uint_t, Conv64_bnd_type_buf_t *);
-const char *conv32_cap_tag(Elf32_Word, Conv32_inv_buf_t *);
-const char *conv64_cap_tag(Elf64_Xword, Conv64_inv_buf_t *);
+const char *conv32_cap_tag(Elf32_Word, Conv_fmt_flags_t,
+ Conv_inv_buf_t *);
+const char *conv64_cap_tag(Elf64_Xword, Conv_fmt_flags_t,
+ Conv_inv_buf_t *);
const char *conv32_cap_val(Elf32_Word, Elf32_Word, Half,
- Conv32_cap_val_buf_t *);
+ Conv_cap_val_buf_t *);
const char *conv64_cap_val(Elf64_Xword, Elf64_Xword, Half,
- Conv64_cap_val_buf_t *);
+ Conv_cap_val_buf_t *);
const char *conv32_cap_val_hw1(Elf32_Word, Half, Conv_fmt_flags_t,
- Conv32_cap_val_hw1_buf_t *);
+ Conv_cap_val_hw1_buf_t *);
const char *conv64_cap_val_hw1(Elf64_Xword, Half, Conv_fmt_flags_t,
- Conv64_cap_val_hw1_buf_t *);
+ Conv_cap_val_hw1_buf_t *);
const char *conv32_cap_val_sf1(Elf32_Word, Half, Conv_fmt_flags_t,
- Conv32_cap_val_sf1_buf_t *);
+ Conv_cap_val_sf1_buf_t *);
const char *conv64_cap_val_sf1(Elf64_Xword, Half, Conv_fmt_flags_t,
- Conv64_cap_val_sf1_buf_t *);
+ Conv_cap_val_sf1_buf_t *);
const char *conv32_dyn_flag1(Elf32_Word, Conv_fmt_flags_t,
- Conv32_dyn_flag1_buf_t *);
+ Conv_dyn_flag1_buf_t *);
const char *conv64_dyn_flag1(Elf64_Xword, Conv_fmt_flags_t,
- Conv64_dyn_flag1_buf_t *);
-const char *conv32_dyn_flag(Elf32_Word, int, Conv32_dyn_flag_buf_t *);
-const char *conv64_dyn_flag(Elf64_Xword, int, Conv64_dyn_flag_buf_t *);
+ Conv_dyn_flag1_buf_t *);
+const char *conv32_dyn_flag(Elf32_Word, int, Conv_dyn_flag_buf_t *);
+const char *conv64_dyn_flag(Elf64_Xword, int, Conv_dyn_flag_buf_t *);
const char *conv32_dyn_posflag1(Elf32_Word, int,
- Conv32_dyn_posflag1_buf_t *);
+ Conv_dyn_posflag1_buf_t *);
const char *conv64_dyn_posflag1(Elf64_Xword, int,
- Conv64_dyn_posflag1_buf_t *);
-const char *conv32_dyn_tag(Elf32_Word, Elf32_Half, int,
- Conv32_inv_buf_t *);
-const char *conv64_dyn_tag(Elf64_Xword, Elf64_Half, int,
- Conv64_inv_buf_t *);
+ Conv_dyn_posflag1_buf_t *);
+const char *conv32_dyn_tag(Elf32_Word, uchar_t, Elf32_Half,
+ Conv_fmt_flags_t, Conv_inv_buf_t *);
+const char *conv64_dyn_tag(Elf64_Xword, uchar_t, Elf64_Half,
+ Conv_fmt_flags_t, Conv_inv_buf_t *);
const char *conv32_dyn_feature1(Elf32_Word, int,
- Conv32_dyn_feature1_buf_t *);
+ Conv_dyn_feature1_buf_t *);
const char *conv64_dyn_feature1(Elf64_Xword, int,
- Conv64_dyn_feature1_buf_t *);
-const char *conv32_ehdr_class(uchar_t, int, Conv32_inv_buf_t *);
-const char *conv64_ehdr_class(uchar_t, int, Conv64_inv_buf_t *);
-const char *conv32_ehdr_data(uchar_t, int, Conv32_inv_buf_t *);
-const char *conv64_ehdr_data(uchar_t, int, Conv64_inv_buf_t *);
-const char *conv32_ehdr_flags(Elf32_Half, Elf32_Word, Conv_fmt_flags_t,
- Conv32_ehdr_flags_buf_t *);
-const char *conv64_ehdr_flags(Elf64_Half, Elf64_Word, Conv_fmt_flags_t,
- Conv64_ehdr_flags_buf_t *);
-const char *conv32_ehdr_mach(Elf32_Half, int, Conv32_inv_buf_t *);
-const char *conv64_ehdr_mach(Elf64_Half, int, Conv64_inv_buf_t *);
-const char *conv32_ehdr_type(Elf32_Half, int, Conv32_inv_buf_t *);
-const char *conv64_ehdr_type(Elf64_Half, int, Conv64_inv_buf_t *);
-const char *conv32_ehdr_vers(Elf32_Word, int, Conv32_inv_buf_t *);
-const char *conv64_ehdr_vers(Elf64_Word, int, Conv64_inv_buf_t *);
-const char *conv32_invalid_val(Conv32_inv_buf_t *, Elf32_Word, int);
-const char *conv64_invalid_val(Conv64_inv_buf_t *, Elf64_Xword, int);
-const char *conv32_phdr_flags(Word, Conv_fmt_flags_t,
- Conv32_phdr_flags_buf_t *);
-const char *conv64_phdr_flags(Word, Conv_fmt_flags_t,
- Conv64_phdr_flags_buf_t *);
-const char *conv32_phdr_type(Elf32_Half, Word, int, Conv32_inv_buf_t *);
-const char *conv64_phdr_type(Elf64_Half, Word, int, Conv64_inv_buf_t *);
-const char *conv32_reject_desc(Rej_desc *, Conv32_reject_desc_buf_t *,
- Elf32_Half);
-const char *conv64_reject_desc(Rej_desc *, Conv64_reject_desc_buf_t *,
- Elf64_Half);
-const char *conv32_reloc_type(Half, Word, int, Conv32_inv_buf_t *);
-const char *conv64_reloc_type(Half, Word, int, Conv64_inv_buf_t *);
-const char *conv32_reloc_type_static(Half, Word, int);
-const char *conv64_reloc_type_static(Half, Word, int);
-const char *conv32_reloc_386_type(Word, int, Conv32_inv_buf_t *);
-const char *conv64_reloc_386_type(Word, int, Conv64_inv_buf_t *);
-const char *conv32_reloc_amd64_type(Word, int, Conv32_inv_buf_t *);
-const char *conv64_reloc_amd64_type(Word, int, Conv64_inv_buf_t *);
-const char *conv32_reloc_SPARC_type(Word, int, Conv32_inv_buf_t *);
-const char *conv64_reloc_SPARC_type(Word, int, Conv64_inv_buf_t *);
-const char *conv32_sec_flags(Elf32_Word, Conv_fmt_flags_t,
- Conv32_sec_flags_buf_t *);
-const char *conv64_sec_flags(Elf64_Xword, Conv_fmt_flags_t,
- Conv64_sec_flags_buf_t *);
+ Conv_dyn_feature1_buf_t *);
+const char *conv32_sec_flags(uchar_t, Half, Elf32_Word, Conv_fmt_flags_t,
+ Conv_sec_flags_buf_t *);
+const char *conv64_sec_flags(uchar_t, Half, Elf64_Xword, Conv_fmt_flags_t,
+ Conv_sec_flags_buf_t *);
const char *conv32_sec_linkinfo(Elf32_Word, Elf32_Word,
- Conv32_inv_buf_t *);
+ Conv_inv_buf_t *);
const char *conv64_sec_linkinfo(Elf64_Word, Elf64_Xword,
- Conv64_inv_buf_t *);
-const char *conv32_sec_type(Elf32_Half, Elf32_Word, int,
- Conv32_inv_buf_t *);
-const char *conv64_sec_type(Elf64_Half, Elf64_Word, int,
- Conv64_inv_buf_t *);
-const char *conv32_sym_info_bind(uchar_t, int, Conv32_inv_buf_t *);
-const char *conv64_sym_info_bind(uchar_t, int, Conv64_inv_buf_t *);
-const char *conv32_sym_info_type(Elf32_Half, uchar_t, int,
- Conv32_inv_buf_t *);
-const char *conv64_sym_info_type(Elf64_Half, uchar_t, int,
- Conv64_inv_buf_t *);
-const char *conv32_sym_shndx(Elf32_Half, Conv32_inv_buf_t *);
-const char *conv64_sym_shndx(Elf64_Half, Conv64_inv_buf_t *);
-const char *conv32_sym_other(uchar_t, Conv32_inv_buf_t *);
-const char *conv64_sym_other(uchar_t, Conv64_inv_buf_t *);
+ Conv_inv_buf_t *);
const char *conv32_sym_value(Elf32_Half, uchar_t, Elf32_Addr,
- Conv32_inv_buf_t *);
+ Conv_inv_buf_t *);
const char *conv64_sym_value(Elf64_Half, uchar_t, Elf64_Addr,
- Conv64_inv_buf_t *);
-const char *conv32_sym_SPARC_value(Elf32_Addr, int, Conv32_inv_buf_t *);
-const char *conv64_sym_SPARC_value(Elf64_Addr, int, Conv64_inv_buf_t *);
+ Conv_inv_buf_t *);
+const char *conv32_sym_SPARC_value(Elf32_Addr, int, Conv_inv_buf_t *);
+const char *conv64_sym_SPARC_value(Elf64_Addr, int, Conv_inv_buf_t *);
diff --git a/usr/src/cmd/sgs/libconv/common/phdr.c b/usr/src/cmd/sgs/libconv/common/phdr.c
index 233387f238..c7522da44a 100644
--- a/usr/src/cmd/sgs/libconv/common/phdr.c
+++ b/usr/src/cmd/sgs/libconv/common/phdr.c
@@ -27,127 +27,263 @@
/*
* String conversion routines for program header attributes.
*/
+#include <stdio.h>
#include <string.h>
#include <_conv.h>
#include <phdr_msg.h>
-/* Instantiate a local copy of conv_map2str() from _conv.h */
-DEFINE_conv_map2str
-
-/*ARGSUSED*/
-const char *
-conv_phdr_type(Half mach, Word type, Conv_fmt_flags_t fmt_flags,
- Conv_inv_buf_t *inv_buf)
+static const conv_ds_t **
+conv_phdr_type_strings(Conv_fmt_flags_t fmt_flags)
{
- static const Msg phdrs[] = {
- MSG_PT_NULL, MSG_PT_LOAD,
- MSG_PT_DYNAMIC, MSG_PT_INTERP,
- MSG_PT_NOTE, MSG_PT_SHLIB,
- MSG_PT_PHDR, MSG_PT_TLS
+#define ALL ELFOSABI_NONE, EM_NONE
+#define SOL ELFOSABI_SOLARIS, EM_NONE
+#define LIN ELFOSABI_LINUX, EM_NONE
+
+ static const Msg phdrs_def[] = {
+ MSG_PT_NULL, MSG_PT_LOAD,
+ MSG_PT_DYNAMIC, MSG_PT_INTERP,
+ MSG_PT_NOTE, MSG_PT_SHLIB,
+ MSG_PT_PHDR, MSG_PT_TLS
+ };
+ static const Msg phdrs_dmp[] = {
+ MSG_PT_NULL_CFNP, MSG_PT_LOAD_CFNP,
+ MSG_PT_DYNAMIC_DMP, MSG_PT_INTERP_CFNP,
+ MSG_PT_NOTE_CFNP, MSG_PT_SHLIB_CFNP,
+ MSG_PT_PHDR_CFNP, MSG_PT_TLS_CFNP
+ };
+ static const Msg phdrs_cf[] = {
+ MSG_PT_NULL_CF, MSG_PT_LOAD_CF,
+ MSG_PT_DYNAMIC_CF, MSG_PT_INTERP_CF,
+ MSG_PT_NOTE_CF, MSG_PT_SHLIB_CF,
+ MSG_PT_PHDR_CF, MSG_PT_TLS_CF
};
- static const Msg phdrs_alt[] = {
- MSG_PT_NULL_ALT, MSG_PT_LOAD_ALT,
- MSG_PT_DYNAMIC_ALT, MSG_PT_INTERP_ALT,
- MSG_PT_NOTE_ALT, MSG_PT_SHLIB_ALT,
- MSG_PT_PHDR_ALT, MSG_PT_TLS_ALT
+ static const Msg phdrs_cfnp[] = {
+ MSG_PT_NULL_CFNP, MSG_PT_LOAD_CFNP,
+ MSG_PT_DYNAMIC_CFNP, MSG_PT_INTERP_CFNP,
+ MSG_PT_NOTE_CFNP, MSG_PT_SHLIB_CFNP,
+ MSG_PT_PHDR_CFNP, MSG_PT_TLS_CFNP
+ };
+ static const Msg phdrs_nf[] = {
+ MSG_PT_NULL_NF, MSG_PT_LOAD_NF,
+ MSG_PT_DYNAMIC_NF, MSG_PT_INTERP_NF,
+ MSG_PT_NOTE_NF, MSG_PT_SHLIB_NF,
+ MSG_PT_PHDR_NF, MSG_PT_TLS_NF
};
#if PT_NUM != (PT_TLS + 1)
error "PT_NUM has grown. Update phdrs[]"
#endif
- static const Msg uphdrs[] = {
- MSG_PT_SUNWBSS, MSG_PT_SUNWSTACK,
- MSG_PT_SUNWDTRACE, MSG_PT_SUNWCAP
+ static const conv_ds_msg_t ds_phdrs_def = {
+ CONV_DS_MSG_INIT(PT_NULL, phdrs_def) };
+ static const conv_ds_msg_t ds_phdrs_dmp = {
+ CONV_DS_MSG_INIT(PT_NULL, phdrs_dmp) };
+ static const conv_ds_msg_t ds_phdrs_cf = {
+ CONV_DS_MSG_INIT(PT_NULL, phdrs_cf) };
+ static const conv_ds_msg_t ds_phdrs_cfnp = {
+ CONV_DS_MSG_INIT(PT_NULL, phdrs_cfnp) };
+ static const conv_ds_msg_t ds_phdrs_nf = {
+ CONV_DS_MSG_INIT(PT_NULL, phdrs_nf) };
+
+
+ static const Val_desc2 phdrs_osabi_def[] = {
+ { PT_SUNWBSS, SOL, MSG_PT_SUNWBSS },
+ { PT_SUNWSTACK, SOL, MSG_PT_SUNWSTACK },
+ { PT_SUNWDTRACE, SOL, MSG_PT_SUNWDTRACE },
+ { PT_SUNWCAP, SOL, MSG_PT_SUNWCAP },
+ { PT_SUNW_UNWIND, SOL, MSG_PT_SUNW_UNWIND },
+ { PT_SUNW_EH_FRAME, SOL, MSG_PT_SUNW_EH_FRAME },
+
+ { PT_GNU_EH_FRAME, LIN, MSG_PT_GNU_EH_FRAME },
+ { PT_GNU_STACK, LIN, MSG_PT_GNU_STACK },
+ { PT_GNU_RELRO, LIN, MSG_PT_GNU_RELRO },
+
+ { 0 }
+ };
+ static const Val_desc2 phdrs_osabi_cf[] = {
+ { PT_SUNWBSS, SOL, MSG_PT_SUNWBSS_CF },
+ { PT_SUNWSTACK, SOL, MSG_PT_SUNWSTACK_CF },
+ { PT_SUNWDTRACE, SOL, MSG_PT_SUNWDTRACE_CF },
+ { PT_SUNWCAP, SOL, MSG_PT_SUNWCAP_CF },
+ { PT_SUNW_UNWIND, SOL, MSG_PT_SUNW_UNWIND_CF },
+ { PT_SUNW_EH_FRAME, SOL, MSG_PT_SUNW_EH_FRAME_CF },
+
+ { PT_GNU_EH_FRAME, LIN, MSG_PT_GNU_EH_FRAME_CF },
+ { PT_GNU_STACK, LIN, MSG_PT_GNU_STACK_CF },
+ { PT_GNU_RELRO, LIN, MSG_PT_GNU_RELRO_CF },
+
+ { 0 }
+ };
+ static const Val_desc2 phdrs_osabi_cfnp[] = {
+ { PT_SUNWBSS, SOL, MSG_PT_SUNWBSS_CFNP },
+ { PT_SUNWSTACK, SOL, MSG_PT_SUNWSTACK_CFNP },
+ { PT_SUNWDTRACE, SOL, MSG_PT_SUNWDTRACE_CFNP },
+ { PT_SUNWCAP, SOL, MSG_PT_SUNWCAP_CFNP },
+ { PT_SUNW_UNWIND, SOL, MSG_PT_SUNW_UNWIND_CFNP },
+ { PT_SUNW_EH_FRAME, SOL, MSG_PT_SUNW_EH_FRAME_CFNP },
+
+ { PT_GNU_EH_FRAME, LIN, MSG_PT_GNU_EH_FRAME_CFNP },
+ { PT_GNU_STACK, LIN, MSG_PT_GNU_STACK_CFNP },
+ { PT_GNU_RELRO, LIN, MSG_PT_GNU_RELRO_CFNP },
+
+ { 0 }
};
- static const Msg uphdrs_alt[] = {
- MSG_PT_SUNWBSS_ALT, MSG_PT_SUNWSTACK_ALT,
- MSG_PT_SUNWDTRACE_ALT, MSG_PT_SUNWCAP_ALT
+ static const Val_desc2 phdrs_osabi_nf[] = {
+ { PT_SUNWBSS, SOL, MSG_PT_SUNWBSS_NF },
+ { PT_SUNWSTACK, SOL, MSG_PT_SUNWSTACK_NF },
+ { PT_SUNWDTRACE, SOL, MSG_PT_SUNWDTRACE_NF },
+ { PT_SUNWCAP, SOL, MSG_PT_SUNWCAP_NF },
+ { PT_SUNW_UNWIND, SOL, MSG_PT_SUNW_UNWIND_NF },
+ { PT_SUNW_EH_FRAME, SOL, MSG_PT_SUNW_EH_FRAME_NF },
+
+ { PT_GNU_EH_FRAME, LIN, MSG_PT_GNU_EH_FRAME_NF },
+ { PT_GNU_STACK, LIN, MSG_PT_GNU_STACK_NF },
+ { PT_GNU_RELRO, LIN, MSG_PT_GNU_RELRO_NF },
+
+ { 0 }
};
#if PT_LOSUNW != PT_SUNWBSS
-#error "PT_LOSUNW has grown. Update uphdrs[]"
+#error "PT_LOSUNW has grown. Update phdrs_osabi[]"
#endif
+ static const conv_ds_vd2_t ds_phdrs_osabi_def = {
+ CONV_DS_VD2, PT_LOOS, PT_HIOS, phdrs_osabi_def };
+ static const conv_ds_vd2_t ds_phdrs_osabi_cf = {
+ CONV_DS_VD2, PT_LOOS, PT_HIOS, phdrs_osabi_cf };
+ static const conv_ds_vd2_t ds_phdrs_osabi_cfnp = {
+ CONV_DS_VD2, PT_LOOS, PT_HIOS, phdrs_osabi_cfnp };
+ static const conv_ds_vd2_t ds_phdrs_osabi_nf = {
+ CONV_DS_VD2, PT_LOOS, PT_HIOS, phdrs_osabi_nf };
+
+
+ /* Build NULL terminated return arrays for each string style */
+ static const const conv_ds_t *ds_def[] = {
+ CONV_DS_ADDR(ds_phdrs_def), CONV_DS_ADDR(ds_phdrs_osabi_def),
+ NULL };
+ static const conv_ds_t *ds_dmp[] = {
+ CONV_DS_ADDR(ds_phdrs_dmp), CONV_DS_ADDR(ds_phdrs_osabi_cfnp),
+ NULL };
+ static const conv_ds_t *ds_cf[] = {
+ CONV_DS_ADDR(ds_phdrs_cf), CONV_DS_ADDR(ds_phdrs_osabi_cf),
+ NULL };
+ static const conv_ds_t *ds_cfnp[] = {
+ CONV_DS_ADDR(ds_phdrs_cfnp), CONV_DS_ADDR(ds_phdrs_osabi_cfnp),
+ NULL };
+ static const conv_ds_t *ds_nf[] = {
+ CONV_DS_ADDR(ds_phdrs_nf), CONV_DS_ADDR(ds_phdrs_osabi_nf),
+ NULL };
+
+ /* Select the strings to use */
+ switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
+ case CONV_FMT_ALT_DUMP:
+ return (ds_dmp);
+ case CONV_FMT_ALT_CF:
+ return (ds_cf);
+ case CONV_FMT_ALT_CFNP:
+ return (ds_cfnp);
+ case CONV_FMT_ALT_NF:
+ return (ds_nf);
+ }
+
+ return (ds_def);
+
+#undef ALL
+#undef SOL
+#undef LIN
+}
+
+const char *
+conv_phdr_type(uchar_t osabi, Half mach, Word type, Conv_fmt_flags_t fmt_flags,
+ Conv_inv_buf_t *inv_buf)
+{
+ return (conv_map_ds(osabi, mach, type,
+ conv_phdr_type_strings(fmt_flags), fmt_flags, inv_buf));
+}
- if (type < PT_NUM) {
- switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
- case CONV_FMT_ALT_DUMP:
- case CONV_FMT_ALT_FILE:
- return (conv_map2str(inv_buf, type, fmt_flags,
- ARRAY_NELTS(phdrs_alt), phdrs_alt));
- default:
- return (conv_map2str(inv_buf, type, fmt_flags,
- ARRAY_NELTS(phdrs), phdrs));
- }
- } else if ((type >= PT_SUNWBSS) && (type <= PT_HISUNW)) {
- switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
- case CONV_FMT_ALT_DUMP:
- case CONV_FMT_ALT_FILE:
- return (conv_map2str(inv_buf, (type - PT_SUNWBSS),
- fmt_flags, ARRAY_NELTS(uphdrs_alt), uphdrs_alt));
- default:
- return (conv_map2str(inv_buf, (type - PT_SUNWBSS),
- fmt_flags, ARRAY_NELTS(uphdrs), uphdrs));
- }
- } else if (type == PT_SUNW_UNWIND) {
- switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
- case CONV_FMT_ALT_DUMP:
- case CONV_FMT_ALT_FILE:
- return (MSG_ORIG(MSG_PT_SUNW_UNWIND_ALT));
- default:
- return (MSG_ORIG(MSG_PT_SUNW_UNWIND));
- }
- } else if (type == PT_SUNW_EH_FRAME) {
- switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
- case CONV_FMT_ALT_DUMP:
- case CONV_FMT_ALT_FILE:
- return (MSG_ORIG(MSG_PT_SUNW_EH_FRAME_ALT));
- default:
- return (MSG_ORIG(MSG_PT_SUNW_EH_FRAME));
- }
- } else
- return (conv_invalid_val(inv_buf, type, 0));
+conv_iter_ret_t
+conv_iter_phdr_type(conv_iter_osabi_t osabi, Conv_fmt_flags_t fmt_flags,
+ conv_iter_cb_t func, void *uvalue)
+{
+ return (conv_iter_ds(osabi, EM_NONE,
+ conv_phdr_type_strings(fmt_flags), func, uvalue));
}
+
+static const Val_desc2 *
+conv_phdr_flags_strings(Conv_fmt_flags_t fmt_flags)
+{
+ /* The CF style has the longest strings */
#define PHDRSZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
- MSG_PF_X_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- MSG_PF_W_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- MSG_PF_R_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- MSG_PF_SUNW_FAILURE_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_PF_X_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_PF_W_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_PF_R_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_PF_SUNW_FAILURE_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
CONV_INV_BUFSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
-/*
- * Ensure that Conv_phdr_flags_buf_t is large enough:
- *
- * PHDRSZ is the real minimum size of the buffer required by conv_phdr_flags().
- * However, Conv_phdr_flags_buf_t uses CONV_PHDR_FLAGS_BUFSIZE to set the
- * buffer size. We do things this way because the definition of PHDRSZ uses
- * information that is not available in the environment of other programs
- * that include the conv.h header file.
- */
+ /*
+ * Ensure that Conv_phdr_flags_buf_t is large enough:
+ *
+ * PHDRSZ is the real minimum size of the buffer required by
+ * conv_phdr_flags(). However, Conv_phdr_flags_buf_t uses
+ * CONV_PHDR_FLAGS_BUFSIZE to set the buffer size. We do things this
+ * way because the definition of PHDRSZ uses information that is not
+ * available in the environment of other programs that include the
+ * conv.h header file.
+ */
#if (CONV_PHDR_FLAGS_BUFSIZE != PHDRSZ) && !defined(__lint)
#define REPORT_BUFSIZE PHDRSZ
#include "report_bufsize.h"
#error "CONV_PHDR_FLAGS_BUFSIZE does not match PHDRSZ"
#endif
+#define ALL ELFOSABI_NONE, EM_NONE
+#define SOL ELFOSABI_SOLARIS, EM_NONE
+
+ static const Val_desc2 vda_cf[] = {
+ { PF_X, ALL, MSG_PF_X_CF },
+ { PF_W, ALL, MSG_PF_W_CF },
+ { PF_R, ALL, MSG_PF_R_CF },
+ { PF_SUNW_FAILURE, SOL, MSG_PF_SUNW_FAILURE_CF },
+ { 0 }
+ };
+ static const Val_desc2 vda_nf[] = {
+ { PF_X, ALL, MSG_PF_X_NF },
+ { PF_W, ALL, MSG_PF_W_NF },
+ { PF_R, ALL, MSG_PF_R_NF },
+ { PF_SUNW_FAILURE, SOL, MSG_PF_SUNW_FAILURE_NF },
+ { 0 }
+ };
+
+ return ((CONV_TYPE_FMT_ALT(fmt_flags) == CONV_FMT_ALT_NF) ?
+ vda_nf : vda_cf);
+
+#undef ALL
+#undef SOL
+}
+
const char *
-conv_phdr_flags(Word flags, Conv_fmt_flags_t fmt_flags,
+conv_phdr_flags(uchar_t osabi, Word flags, Conv_fmt_flags_t fmt_flags,
Conv_phdr_flags_buf_t *phdr_flags_buf)
{
- static Val_desc vda[] = {
- { PF_X, MSG_ORIG(MSG_PF_X) },
- { PF_W, MSG_ORIG(MSG_PF_W) },
- { PF_R, MSG_ORIG(MSG_PF_R) },
- { PF_SUNW_FAILURE, MSG_ORIG(MSG_PF_SUNW_FAILURE) },
- { 0, 0 }
- };
static CONV_EXPN_FIELD_ARG conv_arg = {
- NULL, sizeof (phdr_flags_buf->buf), vda };
+ NULL, sizeof (phdr_flags_buf->buf) };
if (flags == 0)
return (MSG_ORIG(MSG_GBL_ZERO));
conv_arg.buf = phdr_flags_buf->buf;
conv_arg.oflags = conv_arg.rflags = flags;
- (void) conv_expn_field(&conv_arg, fmt_flags);
+ (void) conv_expn_field2(&conv_arg, osabi, EM_NONE,
+ conv_phdr_flags_strings(fmt_flags), fmt_flags);
return ((const char *)phdr_flags_buf->buf);
}
+
+conv_iter_ret_t
+conv_iter_phdr_flags(conv_iter_osabi_t osabi, Conv_fmt_flags_t fmt_flags,
+ conv_iter_cb_t func, void *uvalue)
+{
+ if (conv_iter_vd2(osabi, EM_NONE,
+ conv_phdr_flags_strings(fmt_flags),
+ func, uvalue) == CONV_ITER_DONE)
+ return (CONV_ITER_DONE);
+
+ return (CONV_ITER_CONT);
+}
diff --git a/usr/src/cmd/sgs/libconv/common/phdr.msg b/usr/src/cmd/sgs/libconv/common/phdr.msg
index dbb251c560..c4af313935 100644
--- a/usr/src/cmd/sgs/libconv/common/phdr.msg
+++ b/usr/src/cmd/sgs/libconv/common/phdr.msg
@@ -24,40 +24,86 @@
# Use is subject to license terms.
#
-@ MSG_PT_NULL "[ PT_NULL ]"
-@ MSG_PT_NULL_ALT "PT_NULL"
-@ MSG_PT_LOAD "[ PT_LOAD ]"
-@ MSG_PT_LOAD_ALT "PT_LOAD"
-@ MSG_PT_DYNAMIC "[ PT_DYNAMIC ]"
-@ MSG_PT_DYNAMIC_ALT "PT_DYNAMIC"
-@ MSG_PT_INTERP "[ PT_INTERP ]"
-@ MSG_PT_INTERP_ALT "PT_INTERP"
-@ MSG_PT_NOTE "[ PT_NOTE ]"
-@ MSG_PT_NOTE_ALT "PT_NOTE"
-@ MSG_PT_SHLIB "[ PT_SHLIB ]"
-@ MSG_PT_SHLIB_ALT "PT_SHLIB"
-@ MSG_PT_PHDR "[ PT_PHDR ]"
-@ MSG_PT_PHDR_ALT "PT_PHDR"
-@ MSG_PT_TLS "[ PT_TLS ]"
-@ MSG_PT_TLS_ALT "PT_TLS"
+@ MSG_PT_NULL "[ PT_NULL ]" # 0
+@ MSG_PT_NULL_CF "PT_NULL"
+@ MSG_PT_NULL_CFNP "NULL"
+@ MSG_PT_NULL_NF "null"
+@ MSG_PT_LOAD "[ PT_LOAD ]" # 1
+@ MSG_PT_LOAD_CF "PT_LOAD"
+@ MSG_PT_LOAD_CFNP "LOAD"
+@ MSG_PT_LOAD_NF "load"
+@ MSG_PT_DYNAMIC "[ PT_DYNAMIC ]" # 2
+@ MSG_PT_DYNAMIC_DMP "DYN"
+@ MSG_PT_DYNAMIC_CF "PT_DYNAMIC"
+@ MSG_PT_DYNAMIC_CFNP "DYNAMIC"
+@ MSG_PT_DYNAMIC_NF "dynamic"
+@ MSG_PT_INTERP "[ PT_INTERP ]" # 3
+@ MSG_PT_INTERP_CF "PT_INTERP"
+@ MSG_PT_INTERP_CFNP "INTERP"
+@ MSG_PT_INTERP_NF "interp"
+@ MSG_PT_NOTE "[ PT_NOTE ]" # 4
+@ MSG_PT_NOTE_CF "PT_NOTE"
+@ MSG_PT_NOTE_CFNP "NOTE"
+@ MSG_PT_NOTE_NF "note"
+@ MSG_PT_SHLIB "[ PT_SHLIB ]" # 5
+@ MSG_PT_SHLIB_CF "PT_SHLIB"
+@ MSG_PT_SHLIB_CFNP "SHLIB"
+@ MSG_PT_SHLIB_NF "shlib"
+@ MSG_PT_PHDR "[ PT_PHDR ]" # 6
+@ MSG_PT_PHDR_CF "PT_PHDR"
+@ MSG_PT_PHDR_CFNP "PHDR"
+@ MSG_PT_PHDR_NF "phdr"
+@ MSG_PT_TLS "[ PT_TLS ]" # 7
+@ MSG_PT_TLS_CF "PT_TLS"
+@ MSG_PT_TLS_CFNP "TLS"
+@ MSG_PT_TLS_NF "tls"
-@ MSG_PT_SUNWBSS "[ PT_SUNWBSS ]"
-@ MSG_PT_SUNWBSS_ALT "PT_SUNWBSS"
-@ MSG_PT_SUNWSTACK "[ PT_SUNWSTACK ]"
-@ MSG_PT_SUNWSTACK_ALT "PT_SUNWSTACK"
-@ MSG_PT_SUNWDTRACE "[ PT_SUNWDTRACE ]"
-@ MSG_PT_SUNWDTRACE_ALT "PT_SUNWDTRACE"
-@ MSG_PT_SUNWCAP "[ PT_SUNWCAP ]"
-@ MSG_PT_SUNWCAP_ALT "PT_SUNWCAP"
+@ MSG_PT_SUNW_UNWIND "[ PT_SUNW_UNWIND ]" # 0x6464e550
+@ MSG_PT_SUNW_UNWIND_CF "PT_SUNW_UNWIND"
+@ MSG_PT_SUNW_UNWIND_CFNP "SUNW_UNWIND"
+@ MSG_PT_SUNW_UNWIND_NF "sunw_unwind"
+@ MSG_PT_SUNW_EH_FRAME "[ PT_SUNW_EH_FRAME ]" # 0x6474e550
+@ MSG_PT_SUNW_EH_FRAME_CF "PT_SUNW_EH_FRAME"
+@ MSG_PT_SUNW_EH_FRAME_CFNP "SUNW_EH_FRAME"
+@ MSG_PT_SUNW_EH_FRAME_NF "sunw_eh_frame"
-@ MSG_PT_SUNW_UNWIND "[ PT_SUNW_UNWIND ]"
-@ MSG_PT_SUNW_UNWIND_ALT "PT_SUNW_UNWIND"
-@ MSG_PT_SUNW_EH_FRAME "[ PT_SUNW_EH_FRAME ]"
-@ MSG_PT_SUNW_EH_FRAME_ALT "PT_SUNW_EH_FRAME"
+@ MSG_PT_GNU_EH_FRAME "[ PT_GNU_EH_FRAME ]" # 0x6474e550
+@ MSG_PT_GNU_EH_FRAME_CF "PT_GNU_EH_FRAME"
+@ MSG_PT_GNU_EH_FRAME_CFNP "GNU_EH_FRAME"
+@ MSG_PT_GNU_EH_FRAME_NF "gnu_eh_frame"
+@ MSG_PT_GNU_STACK "[ PT_GNU_STACK ]" # 0x6474e551
+@ MSG_PT_GNU_STACK_CF "PT_GNU_STACK"
+@ MSG_PT_GNU_STACK_CFNP "GNU_STACK"
+@ MSG_PT_GNU_STACK_NF "gnu_stack"
+@ MSG_PT_GNU_RELRO "[ PT_GNU_RELRO ]" # 0x6474e552
+@ MSG_PT_GNU_RELRO_CF "PT_GNU_RELRO"
+@ MSG_PT_GNU_RELRO_CFNP "GNU_RELRO"
+@ MSG_PT_GNU_RELRO_NF "gnu_relro"
-@ MSG_PF_X "PF_X"
-@ MSG_PF_W "PF_W"
-@ MSG_PF_R "PF_R"
-@ MSG_PF_SUNW_FAILURE "PF_SUNW_FAILURE"
+@ MSG_PT_SUNWBSS "[ PT_SUNWBSS ]" # 0x6ffffffa
+@ MSG_PT_SUNWBSS_CF "PT_SUNWBSS"
+@ MSG_PT_SUNWBSS_CFNP "SUNWBSS"
+@ MSG_PT_SUNWBSS_NF "sunwbss"
+@ MSG_PT_SUNWSTACK "[ PT_SUNWSTACK ]" # 0x6ffffffb
+@ MSG_PT_SUNWSTACK_CF "PT_SUNWSTACK"
+@ MSG_PT_SUNWSTACK_CFNP "SUNWSTACK"
+@ MSG_PT_SUNWSTACK_NF "sunwstack"
+@ MSG_PT_SUNWDTRACE "[ PT_SUNWDTRACE ]" # 0x6ffffffc
+@ MSG_PT_SUNWDTRACE_CF "PT_SUNWDTRACE"
+@ MSG_PT_SUNWDTRACE_CFNP "SUNWDTRACE"
+@ MSG_PT_SUNWDTRACE_NF "sunwdtrace"
+@ MSG_PT_SUNWCAP "[ PT_SUNWCAP ]" # 0x6ffffffd
+@ MSG_PT_SUNWCAP_CF "PT_SUNWCAP"
+@ MSG_PT_SUNWCAP_CFNP "SUNWCAP"
+@ MSG_PT_SUNWCAP_NF "sunwcap"
+
+@ MSG_PF_X_CF "PF_X" # 0x1
+@ MSG_PF_X_NF "x"
+@ MSG_PF_W_CF "PF_W" # 0x2
+@ MSG_PF_W_NF "w"
+@ MSG_PF_R_CF "PF_R" # 0x4
+@ MSG_PF_R_NF "r"
+@ MSG_PF_SUNW_FAILURE_CF "PF_SUNW_FAILURE" # 0x00100000
+@ MSG_PF_SUNW_FAILURE_NF "sunw_failure"
@ MSG_GBL_ZERO "0"
diff --git a/usr/src/cmd/sgs/libconv/common/sections.c b/usr/src/cmd/sgs/libconv/common/sections.c
index 2ab0b2faf1..ca763eb223 100644
--- a/usr/src/cmd/sgs/libconv/common/sections.c
+++ b/usr/src/cmd/sgs/libconv/common/sections.c
@@ -20,10 +20,9 @@
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
/*
* String conversion routines for section attributes.
@@ -36,184 +35,472 @@
#include <sections_msg.h>
+static const conv_ds_t **
+sec_type_strings(conv_iter_osabi_t osabi, Half mach, Conv_fmt_flags_t fmt_flags)
+{
+ /*
+ * This routine can return an array with 1 generic array, up to
+ * three osabi arrays, two machine arrays, plus the NULL termination.
+ */
+#define MAX_RET 7
-/* Instantiate a local copy of conv_map2str() from _conv.h */
-DEFINE_conv_map2str
-
-
-
-static const Msg secs[SHT_NUM] = {
- MSG_SHT_NULL, MSG_SHT_PROGBITS, MSG_SHT_SYMTAB,
- MSG_SHT_STRTAB, MSG_SHT_RELA, MSG_SHT_HASH,
- MSG_SHT_DYNAMIC, MSG_SHT_NOTE, MSG_SHT_NOBITS,
- MSG_SHT_REL, MSG_SHT_SHLIB, MSG_SHT_DYNSYM,
- MSG_SHT_UNKNOWN12, MSG_SHT_UNKNOWN13, MSG_SHT_INIT_ARRAY,
- MSG_SHT_FINI_ARRAY, MSG_SHT_PREINIT_ARRAY, MSG_SHT_GROUP,
- MSG_SHT_SYMTAB_SHNDX
-};
-static const Msg secs_alt[SHT_NUM] = {
- MSG_SHT_NULL_ALT, MSG_SHT_PROGBITS_ALT, MSG_SHT_SYMTAB_ALT,
- MSG_SHT_STRTAB_ALT, MSG_SHT_RELA_ALT, MSG_SHT_HASH_ALT,
- MSG_SHT_DYNAMIC_ALT, MSG_SHT_NOTE_ALT, MSG_SHT_NOBITS_ALT,
- MSG_SHT_REL_ALT, MSG_SHT_SHLIB_ALT, MSG_SHT_DYNSYM_ALT,
- MSG_SHT_UNKNOWN12, MSG_SHT_UNKNOWN13, MSG_SHT_INIT_ARRAY_ALT,
- MSG_SHT_FINI_ARRAY_ALT, MSG_SHT_PREINIT_ARRAY_ALT, MSG_SHT_GROUP_ALT,
- MSG_SHT_SYMTAB_SHNDX_ALT
-};
+ static const Msg secs_def[SHT_NUM] = {
+ MSG_SHT_NULL, MSG_SHT_PROGBITS,
+ MSG_SHT_SYMTAB, MSG_SHT_STRTAB,
+ MSG_SHT_RELA, MSG_SHT_HASH,
+ MSG_SHT_DYNAMIC, MSG_SHT_NOTE,
+ MSG_SHT_NOBITS, MSG_SHT_REL,
+ MSG_SHT_SHLIB, MSG_SHT_DYNSYM,
+ MSG_SHT_UNKNOWN12, MSG_SHT_UNKNOWN13,
+ MSG_SHT_INIT_ARRAY, MSG_SHT_FINI_ARRAY,
+ MSG_SHT_PREINIT_ARRAY, MSG_SHT_GROUP,
+ MSG_SHT_SYMTAB_SHNDX
+ };
+ static const Msg secs_dmp[SHT_NUM] = {
+ MSG_SHT_NULL_DMP, MSG_SHT_PROGBITS_DMP,
+ MSG_SHT_SYMTAB_DMP, MSG_SHT_STRTAB_DMP,
+ MSG_SHT_RELA_DMP, MSG_SHT_HASH_DMP,
+ MSG_SHT_DYNAMIC_DMP, MSG_SHT_NOTE_DMP,
+ MSG_SHT_NOBITS_DMP, MSG_SHT_REL_DMP,
+ MSG_SHT_SHLIB_DMP, MSG_SHT_DYNSYM_DMP,
+ MSG_SHT_UNKNOWN12_DMP, MSG_SHT_UNKNOWN13_DMP,
+ MSG_SHT_INIT_ARRAY_DMP, MSG_SHT_FINI_ARRAY_DMP,
+ MSG_SHT_PREINIT_ARRAY_DMP, MSG_SHT_GROUP_DMP,
+ MSG_SHT_SYMTAB_SHNDX_DMP
+ };
+ static const Msg secs_cf[SHT_NUM] = {
+ MSG_SHT_NULL_CF, MSG_SHT_PROGBITS_CF,
+ MSG_SHT_SYMTAB_CF, MSG_SHT_STRTAB_CF,
+ MSG_SHT_RELA_CF, MSG_SHT_HASH_CF,
+ MSG_SHT_DYNAMIC_CF, MSG_SHT_NOTE_CF,
+ MSG_SHT_NOBITS_CF, MSG_SHT_REL_CF,
+ MSG_SHT_SHLIB_CF, MSG_SHT_DYNSYM_CF,
+ MSG_SHT_UNKNOWN12_CF, MSG_SHT_UNKNOWN13_CF,
+ MSG_SHT_INIT_ARRAY_CF, MSG_SHT_FINI_ARRAY_CF,
+ MSG_SHT_PREINIT_ARRAY_CF, MSG_SHT_GROUP_CF,
+ MSG_SHT_SYMTAB_SHNDX_CF
+ };
+ static const Msg secs_nf[SHT_NUM] = {
+ MSG_SHT_NULL_NF, MSG_SHT_PROGBITS_NF,
+ MSG_SHT_SYMTAB_NF, MSG_SHT_STRTAB_NF,
+ MSG_SHT_RELA_NF, MSG_SHT_HASH_NF,
+ MSG_SHT_DYNAMIC_NF, MSG_SHT_NOTE_NF,
+ MSG_SHT_NOBITS_NF, MSG_SHT_REL_NF,
+ MSG_SHT_SHLIB_NF, MSG_SHT_DYNSYM_NF,
+ MSG_SHT_UNKNOWN12_NF, MSG_SHT_UNKNOWN13_NF,
+ MSG_SHT_INIT_ARRAY_NF, MSG_SHT_FINI_ARRAY_NF,
+ MSG_SHT_PREINIT_ARRAY_NF, MSG_SHT_GROUP_NF,
+ MSG_SHT_SYMTAB_SHNDX_NF
+ };
#if (SHT_NUM != (SHT_SYMTAB_SHNDX + 1))
#error "SHT_NUM has grown"
#endif
+ static const conv_ds_msg_t ds_secs_def = {
+ CONV_DS_MSG_INIT(SHT_NULL, secs_def) };
+ static const conv_ds_msg_t ds_secs_dmp = {
+ CONV_DS_MSG_INIT(SHT_NULL, secs_dmp) };
+ static const conv_ds_msg_t ds_secs_cf = {
+ CONV_DS_MSG_INIT(SHT_NULL, secs_cf) };
+ static const conv_ds_msg_t ds_secs_nf = {
+ CONV_DS_MSG_INIT(SHT_NULL, secs_nf) };
+
-static const Msg usecs[SHT_HISUNW - SHT_LOSUNW + 1] = {
- MSG_SHT_SUNW_symsort, MSG_SHT_SUNW_tlssort,
- MSG_SHT_SUNW_LDYNSYM, MSG_SHT_SUNW_dof,
- MSG_SHT_SUNW_cap, MSG_SHT_SUNW_SIGNATURE,
- MSG_SHT_SUNW_ANNOTATE, MSG_SHT_SUNW_DEBUGSTR,
- MSG_SHT_SUNW_DEBUG, MSG_SHT_SUNW_move,
- MSG_SHT_SUNW_COMDAT, MSG_SHT_SUNW_syminfo,
- MSG_SHT_SUNW_verdef, MSG_SHT_SUNW_verneed,
- MSG_SHT_SUNW_versym
-};
-static const Msg usecs_alt[SHT_HISUNW - SHT_LOSUNW + 1] = {
- MSG_SHT_SUNW_symsort_ALT, MSG_SHT_SUNW_tlssort_ALT,
- MSG_SHT_SUNW_LDYNSYM_ALT, MSG_SHT_SUNW_dof_ALT,
- MSG_SHT_SUNW_cap_ALT, MSG_SHT_SUNW_SIGNATURE_ALT,
- MSG_SHT_SUNW_ANNOTATE_ALT, MSG_SHT_SUNW_DEBUGSTR_ALT,
- MSG_SHT_SUNW_DEBUG_ALT, MSG_SHT_SUNW_move_ALT,
- MSG_SHT_SUNW_COMDAT_ALT, MSG_SHT_SUNW_syminfo_ALT,
- MSG_SHT_SUNW_verdef_ALT, MSG_SHT_SUNW_verneed_ALT,
- MSG_SHT_SUNW_versym_ALT
-};
+ static const Msg usecs_def[SHT_HISUNW - SHT_LOSUNW + 1] = {
+ MSG_SHT_SUNW_SYMSORT, MSG_SHT_SUNW_TLSSORT,
+ MSG_SHT_SUNW_LDYNSYM, MSG_SHT_SUNW_DOF,
+ MSG_SHT_SUNW_CAP, MSG_SHT_SUNW_SIGNATURE,
+ MSG_SHT_SUNW_ANNOTATE, MSG_SHT_SUNW_DEBUGSTR,
+ MSG_SHT_SUNW_DEBUG, MSG_SHT_SUNW_MOVE,
+ MSG_SHT_SUNW_COMDAT, MSG_SHT_SUNW_SYMINFO,
+ MSG_SHT_SUNW_VERDEF, MSG_SHT_SUNW_VERNEED,
+ MSG_SHT_SUNW_VERSYM
+ };
+ static const Msg usecs_dmp[SHT_HISUNW - SHT_LOSUNW + 1] = {
+ MSG_SHT_SUNW_SYMSORT_DMP, MSG_SHT_SUNW_TLSSORT_DMP,
+ MSG_SHT_SUNW_LDYNSYM_DMP, MSG_SHT_SUNW_DOF_DMP,
+ MSG_SHT_SUNW_CAP_DMP, MSG_SHT_SUNW_SIGNATURE_DMP,
+ MSG_SHT_SUNW_ANNOTATE_DMP, MSG_SHT_SUNW_DEBUGSTR_DMP,
+ MSG_SHT_SUNW_DEBUG_DMP, MSG_SHT_SUNW_MOVE_DMP,
+ MSG_SHT_SUNW_COMDAT_DMP, MSG_SHT_SUNW_SYMINFO_DMP,
+ MSG_SHT_SUNW_VERDEF_DMP, MSG_SHT_SUNW_VERNEED_DMP,
+ MSG_SHT_SUNW_VERSYM_DMP
+ };
+ static const Msg usecs_cf[SHT_HISUNW - SHT_LOSUNW + 1] = {
+ MSG_SHT_SUNW_SYMSORT_CF, MSG_SHT_SUNW_TLSSORT_CF,
+ MSG_SHT_SUNW_LDYNSYM_CF, MSG_SHT_SUNW_DOF_CF,
+ MSG_SHT_SUNW_CAP_CF, MSG_SHT_SUNW_SIGNATURE_CF,
+ MSG_SHT_SUNW_ANNOTATE_CF, MSG_SHT_SUNW_DEBUGSTR_CF,
+ MSG_SHT_SUNW_DEBUG_CF, MSG_SHT_SUNW_MOVE_CF,
+ MSG_SHT_SUNW_COMDAT_CF, MSG_SHT_SUNW_SYMINFO_CF,
+ MSG_SHT_SUNW_VERDEF_CF, MSG_SHT_SUNW_VERNEED_CF,
+ MSG_SHT_SUNW_VERSYM_CF
+ };
+ static const Msg usecs_nf[SHT_HISUNW - SHT_LOSUNW + 1] = {
+ MSG_SHT_SUNW_SYMSORT_NF, MSG_SHT_SUNW_TLSSORT_NF,
+ MSG_SHT_SUNW_LDYNSYM_NF, MSG_SHT_SUNW_DOF_NF,
+ MSG_SHT_SUNW_CAP_NF, MSG_SHT_SUNW_SIGNATURE_NF,
+ MSG_SHT_SUNW_ANNOTATE_NF, MSG_SHT_SUNW_DEBUGSTR_NF,
+ MSG_SHT_SUNW_DEBUG_NF, MSG_SHT_SUNW_MOVE_NF,
+ MSG_SHT_SUNW_COMDAT_NF, MSG_SHT_SUNW_SYMINFO_NF,
+ MSG_SHT_SUNW_VERDEF_NF, MSG_SHT_SUNW_VERNEED_NF,
+ MSG_SHT_SUNW_VERSYM_NF
+ };
#if (SHT_LOSUNW != SHT_SUNW_symsort)
#error "SHT_LOSUNW has moved"
#endif
+ static const conv_ds_msg_t ds_usecs_def = {
+ CONV_DS_MSG_INIT(SHT_SUNW_symsort, usecs_def) };
+ static const conv_ds_msg_t ds_usecs_dmp = {
+ CONV_DS_MSG_INIT(SHT_SUNW_symsort, usecs_dmp) };
+ static const conv_ds_msg_t ds_usecs_cf = {
+ CONV_DS_MSG_INIT(SHT_SUNW_symsort, usecs_cf) };
+ static const conv_ds_msg_t ds_usecs_nf = {
+ CONV_DS_MSG_INIT(SHT_SUNW_symsort, usecs_nf) };
-const char *
-conv_sec_type(Half mach, Word sec, Conv_fmt_flags_t fmt_flags,
- Conv_inv_buf_t *inv_buf)
-{
- if (sec < SHT_NUM) {
+ /* The Linux osabi range has two separate sequences */
+ static const Msg usecs_gnu1_def[] = {
+ MSG_SHT_GNU_ATTRIBUTES, MSG_SHT_GNU_HASH,
+ MSG_SHT_GNU_LIBLIST, MSG_SHT_CHECKSUM,
+ };
+ static const Msg usecs_gnu1_dmp[] = {
+ MSG_SHT_GNU_ATTRIBUTES_DMP, MSG_SHT_GNU_HASH_DMP,
+ MSG_SHT_GNU_LIBLIST_DMP, MSG_SHT_CHECKSUM_DMP,
+ };
+ static const Msg usecs_gnu1_cf[] = {
+ MSG_SHT_GNU_ATTRIBUTES_CF, MSG_SHT_GNU_HASH_CF,
+ MSG_SHT_GNU_LIBLIST_CF, MSG_SHT_CHECKSUM_CF,
+ };
+ static const Msg usecs_gnu1_nf[] = {
+ MSG_SHT_GNU_ATTRIBUTES_NF, MSG_SHT_GNU_HASH_NF,
+ MSG_SHT_GNU_LIBLIST_NF, MSG_SHT_CHECKSUM_NF,
+ };
+ static const conv_ds_msg_t ds_usecs_gnu1_def = {
+ CONV_DS_MSG_INIT(SHT_GNU_ATTRIBUTES, usecs_gnu1_def) };
+ static const conv_ds_msg_t ds_usecs_gnu1_dmp = {
+ CONV_DS_MSG_INIT(SHT_GNU_ATTRIBUTES, usecs_gnu1_dmp) };
+ static const conv_ds_msg_t ds_usecs_gnu1_cf = {
+ CONV_DS_MSG_INIT(SHT_GNU_ATTRIBUTES, usecs_gnu1_cf) };
+ static const conv_ds_msg_t ds_usecs_gnu1_nf = {
+ CONV_DS_MSG_INIT(SHT_GNU_ATTRIBUTES, usecs_gnu1_nf) };
+
+
+ static const Msg usecs_gnu2_def[] = {
+ MSG_SHT_GNU_VERDEF, MSG_SHT_GNU_VERNEED,
+ MSG_SHT_GNU_VERSYM
+ };
+ static const Msg usecs_gnu2_dmp[] = {
+ MSG_SHT_GNU_VERDEF_DMP, MSG_SHT_GNU_VERNEED_DMP,
+ MSG_SHT_GNU_VERSYM_DMP
+ };
+ static const Msg usecs_gnu2_cf[] = {
+ MSG_SHT_GNU_VERDEF_CF, MSG_SHT_GNU_VERNEED_CF,
+ MSG_SHT_GNU_VERSYM_CF
+ };
+ static const Msg usecs_gnu2_nf[] = {
+ MSG_SHT_GNU_VERDEF_NF, MSG_SHT_GNU_VERNEED_NF,
+ MSG_SHT_GNU_VERSYM_NF
+ };
+ static const conv_ds_msg_t ds_usecs_gnu2_def = {
+ CONV_DS_MSG_INIT(SHT_GNU_verdef, usecs_gnu2_def) };
+ static const conv_ds_msg_t ds_usecs_gnu2_dmp = {
+ CONV_DS_MSG_INIT(SHT_GNU_verdef, usecs_gnu2_dmp) };
+ static const conv_ds_msg_t ds_usecs_gnu2_cf = {
+ CONV_DS_MSG_INIT(SHT_GNU_verdef, usecs_gnu2_cf) };
+ static const conv_ds_msg_t ds_usecs_gnu2_nf = {
+ CONV_DS_MSG_INIT(SHT_GNU_verdef, usecs_gnu2_nf) };
+
+
+ /* sparc processor range */
+ static const Msg sparc_def[] = { MSG_SHT_SPARC_GOTDATA };
+ static const Msg sparc_dmp[] = { MSG_SHT_SPARC_GOTDATA_DMP };
+ static const Msg sparc_cf[] = { MSG_SHT_SPARC_GOTDATA_CF };
+ static const Msg sparc_nf[] = { MSG_SHT_SPARC_GOTDATA_NF };
+ static const conv_ds_msg_t ds_sparc_def = {
+ CONV_DS_MSG_INIT(SHT_SPARC_GOTDATA, sparc_def) };
+ static const conv_ds_msg_t ds_sparc_dmp = {
+ CONV_DS_MSG_INIT(SHT_SPARC_GOTDATA, sparc_dmp) };
+ static const conv_ds_msg_t ds_sparc_cf = {
+ CONV_DS_MSG_INIT(SHT_SPARC_GOTDATA, sparc_cf) };
+ static const conv_ds_msg_t ds_sparc_nf = {
+ CONV_DS_MSG_INIT(SHT_SPARC_GOTDATA, sparc_nf) };
+
+ /* amd64 processor range */
+ static const Msg amd64_def[] = { MSG_SHT_AMD64_UNWIND };
+ static const Msg amd64_dmp[] = { MSG_SHT_AMD64_UNWIND_DMP };
+ static const Msg amd64_cf[] = { MSG_SHT_AMD64_UNWIND_CF };
+ static const Msg amd64_nf[] = { MSG_SHT_AMD64_UNWIND_NF };
+ static const conv_ds_msg_t ds_amd64_def = {
+ CONV_DS_MSG_INIT(SHT_AMD64_UNWIND, amd64_def) };
+ static const conv_ds_msg_t ds_amd64_dmp = {
+ CONV_DS_MSG_INIT(SHT_AMD64_UNWIND, amd64_dmp) };
+ static const conv_ds_msg_t ds_amd64_cf = {
+ CONV_DS_MSG_INIT(SHT_AMD64_UNWIND, amd64_cf) };
+ static const conv_ds_msg_t ds_amd64_nf = {
+ CONV_DS_MSG_INIT(SHT_AMD64_UNWIND, amd64_nf) };
+
+
+ static const conv_ds_t *retarr[MAX_RET];
+ int retndx = 0;
+
+ /* Select the strings to use, based on string style and OSABI */
+ switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
+ case CONV_FMT_ALT_DUMP:
+ retarr[retndx++] = CONV_DS_ADDR(ds_secs_dmp);
+ break;
+ case CONV_FMT_ALT_CF:
+ retarr[retndx++] = CONV_DS_ADDR(ds_secs_cf);
+ break;
+ case CONV_FMT_ALT_NF:
+ retarr[retndx++] = CONV_DS_ADDR(ds_secs_nf);
+ break;
+ default:
+ retarr[retndx++] = CONV_DS_ADDR(ds_secs_def);
+ break;
+ }
+
+ if ((osabi == ELFOSABI_NONE) || (osabi == ELFOSABI_SOLARIS) ||
+ (osabi == CONV_OSABI_ALL)) {
switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
case CONV_FMT_ALT_DUMP:
- return (conv_map2str(inv_buf, sec, fmt_flags,
- ARRAY_NELTS(secs_alt), secs_alt));
+ retarr[retndx++] = CONV_DS_ADDR(ds_usecs_dmp);
+ break;
+ case CONV_FMT_ALT_CF:
+ retarr[retndx++] = CONV_DS_ADDR(ds_usecs_cf);
+ break;
+ case CONV_FMT_ALT_NF:
+ retarr[retndx++] = CONV_DS_ADDR(ds_usecs_nf);
+ break;
default:
- return (conv_map2str(inv_buf, sec, fmt_flags,
- ARRAY_NELTS(secs), secs));
+ retarr[retndx++] = CONV_DS_ADDR(ds_usecs_def);
+ break;
}
- } else if ((sec >= SHT_LOSUNW) && (sec <= SHT_HISUNW)) {
+ }
+
+ if ((osabi == ELFOSABI_LINUX) || (osabi == CONV_OSABI_ALL)) {
switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
case CONV_FMT_ALT_DUMP:
- return (conv_map2str(inv_buf, sec - SHT_LOSUNW,
- fmt_flags, ARRAY_NELTS(usecs_alt), usecs_alt));
+ retarr[retndx++] = CONV_DS_ADDR(ds_usecs_gnu1_dmp);
+ retarr[retndx++] = CONV_DS_ADDR(ds_usecs_gnu2_dmp);
+ break;
+ case CONV_FMT_ALT_CF:
+ retarr[retndx++] = CONV_DS_ADDR(ds_usecs_gnu1_cf);
+ retarr[retndx++] = CONV_DS_ADDR(ds_usecs_gnu2_cf);
+ break;
+ case CONV_FMT_ALT_NF:
+ retarr[retndx++] = CONV_DS_ADDR(ds_usecs_gnu1_nf);
+ retarr[retndx++] = CONV_DS_ADDR(ds_usecs_gnu2_nf);
+ break;
default:
- return (conv_map2str(inv_buf, sec - SHT_LOSUNW,
- fmt_flags, ARRAY_NELTS(usecs), usecs));
+ retarr[retndx++] = CONV_DS_ADDR(ds_usecs_gnu1_def);
+ retarr[retndx++] = CONV_DS_ADDR(ds_usecs_gnu2_def);
+ break;
}
- } else if ((sec >= SHT_LOPROC) && (sec <= SHT_HIPROC)) {
- switch (mach) {
- case EM_SPARC:
- case EM_SPARC32PLUS:
- case EM_SPARCV9:
- if (sec != SHT_SPARC_GOTDATA)
- break;
- switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
- case CONV_FMT_ALT_DUMP:
- case CONV_FMT_ALT_FILE:
- return (MSG_ORIG(MSG_SHT_SPARC_GOTDATA_ALT));
- }
- return (MSG_ORIG(MSG_SHT_SPARC_GOTDATA));
- case EM_AMD64:
- if (sec != SHT_AMD64_UNWIND)
- break;
- switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
- case CONV_FMT_ALT_DUMP:
- case CONV_FMT_ALT_FILE:
- return (MSG_ORIG(MSG_SHT_AMD64_UNWIND_ALT));
- }
- return (MSG_ORIG(MSG_SHT_AMD64_UNWIND));
+ }
+
+ if ((mach == EM_SPARC) || (mach == EM_SPARC32PLUS) ||
+ (mach == EM_SPARCV9) || (mach == CONV_MACH_ALL)) {
+ switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
+ case CONV_FMT_ALT_DUMP:
+ retarr[retndx++] = CONV_DS_ADDR(ds_sparc_dmp);
+ break;
+ case CONV_FMT_ALT_CF:
+ retarr[retndx++] = CONV_DS_ADDR(ds_sparc_cf);
+ break;
+ case CONV_FMT_ALT_NF:
+ retarr[retndx++] = CONV_DS_ADDR(ds_sparc_nf);
+ break;
+ default:
+ retarr[retndx++] = CONV_DS_ADDR(ds_sparc_def);
+ break;
}
}
- /* If we get here, it's an unknown type */
- return (conv_invalid_val(inv_buf, sec, fmt_flags));
+ if ((mach == EM_AMD64) || (mach == CONV_MACH_ALL)) {
+ switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
+ case CONV_FMT_ALT_DUMP:
+ retarr[retndx++] = CONV_DS_ADDR(ds_amd64_dmp);
+ break;
+ case CONV_FMT_ALT_CF:
+ retarr[retndx++] = CONV_DS_ADDR(ds_amd64_cf);
+ break;
+ case CONV_FMT_ALT_NF:
+ retarr[retndx++] = CONV_DS_ADDR(ds_amd64_nf);
+ break;
+ default:
+ retarr[retndx++] = CONV_DS_ADDR(ds_amd64_def);
+ break;
+ }
+ }
+
+ retarr[retndx++] = NULL;
+ assert(retndx <= MAX_RET);
+ return (retarr);
+
+#undef MAX_RET
+}
+
+const char *
+conv_sec_type(uchar_t osabi, Half mach, Word sec, Conv_fmt_flags_t fmt_flags,
+ Conv_inv_buf_t *inv_buf)
+{
+ return (conv_map_ds(osabi, mach, sec,
+ sec_type_strings(osabi, mach, fmt_flags), fmt_flags, inv_buf));
+}
+
+conv_iter_ret_t
+conv_iter_sec_type(conv_iter_osabi_t osabi, Half mach,
+ Conv_fmt_flags_t fmt_flags, conv_iter_cb_t func, void *uvalue)
+{
+ return (conv_iter_ds(osabi, mach,
+ sec_type_strings(osabi, mach, fmt_flags), func, uvalue));
}
-#define FLAGSZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
- MSG_SHF_WRITE_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- MSG_SHF_ALLOC_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- MSG_SHF_EXECINSTR_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- MSG_SHF_MERGE_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- MSG_SHF_STRINGS_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- MSG_SHF_INFO_LINK_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- MSG_SHF_LINK_ORDER_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- MSG_SHF_OS_NONCONFORMING_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- MSG_SHF_GROUP_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- MSG_SHF_TLS_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- MSG_SHF_EXCLUDE_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- MSG_SHF_ORDERED_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- MSG_SHF_AMD64_LARGE_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- CONV_INV_BUFSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
/*
- * Ensure that Conv_sec_flags_buf_t is large enough:
- *
- * FLAGSZ is the real minimum size of the buffer required by conv_sec_flags().
- * However, Conv_sec_flags_buf_t uses CONV_SEC_FLAGS_BUFSIZE to set the
- * buffer size. We do things this way because the definition of FLAGSZ uses
- * information that is not available in the environment of other programs
- * that include the conv.h header file.
+ * Special iteration routine that returns strings for all symbol table
+ * sections.
*/
+conv_iter_ret_t
+conv_iter_sec_symtab(conv_iter_osabi_t osabi, Conv_fmt_flags_t fmt_flags,
+ conv_iter_cb_t func, void *uvalue)
+{
+ static const Val_desc2 symtab_cf[] = {
+ { SHT_SYMTAB, 0, 0, MSG_SHT_SYMTAB_CF },
+ { SHT_DYNSYM, 0, 0, MSG_SHT_DYNSYM_CF },
+ { SHT_SUNW_LDYNSYM, ELFOSABI_SOLARIS, 0,
+ MSG_SHT_SUNW_LDYNSYM_CF },
+
+ { 0 }
+ };
+ static const Val_desc2 symtab_nf[] = {
+ { SHT_SYMTAB, 0, 0, MSG_SHT_SYMTAB_NF },
+ { SHT_DYNSYM, 0, 0, MSG_SHT_DYNSYM_NF },
+ { SHT_SUNW_LDYNSYM, ELFOSABI_SOLARIS, 0,
+ MSG_SHT_SUNW_LDYNSYM_NF },
+
+ { 0 }
+ };
+
+ const Val_desc2 *vdp;
+
+ vdp = (CONV_TYPE_FMT_ALT(fmt_flags) == CONV_FMT_ALT_NF) ?
+ symtab_nf : symtab_cf;
+
+ return (conv_iter_vd2(osabi, EM_NONE, vdp, func, uvalue));
+}
+
+
+const Val_desc2 *
+conv_sec_flags_strings(Conv_fmt_flags_t fmt_flags)
+{
+#define FLAGSZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
+ MSG_SHF_WRITE_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_SHF_ALLOC_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_SHF_EXECINSTR_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_SHF_MERGE_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_SHF_STRINGS_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_SHF_INFO_LINK_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_SHF_LINK_ORDER_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_SHF_OS_NONCONFORMING_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_SHF_GROUP_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_SHF_TLS_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_SHF_EXCLUDE_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_SHF_ORDERED_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_SHF_AMD64_LARGE_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ CONV_INV_BUFSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
+
+ /*
+ * Ensure that Conv_sec_flags_buf_t is large enough:
+ *
+ * FLAGSZ is the real minimum size of the buffer required by
+ * conv_sec_flags(). However, Conv_sec_flags_buf_t uses
+ * CONV_SEC_FLAGS_BUFSIZE to set the buffer size. We do things this
+ * way because the definition of FLAGSZ uses information that is not
+ * available in the environment of other programs that include the
+ * conv.h header file.
+ */
#if (CONV_SEC_FLAGS_BUFSIZE != FLAGSZ) && !defined(__lint)
#define REPORT_BUFSIZE FLAGSZ
#include "report_bufsize.h"
#error "CONV_SEC_FLAGS_BUFSIZE does not match FLAGSZ"
#endif
-const char *
-conv_sec_flags(Xword flags, Conv_fmt_flags_t fmt_flags,
- Conv_sec_flags_buf_t *sec_flags_buf)
-{
- static Val_desc vda[] = {
- { SHF_WRITE, MSG_ORIG(MSG_SHF_WRITE) },
- { SHF_ALLOC, MSG_ORIG(MSG_SHF_ALLOC) },
- { SHF_EXECINSTR, MSG_ORIG(MSG_SHF_EXECINSTR) },
- { SHF_MERGE, MSG_ORIG(MSG_SHF_MERGE) },
- { SHF_STRINGS, MSG_ORIG(MSG_SHF_STRINGS) },
- { SHF_INFO_LINK, MSG_ORIG(MSG_SHF_INFO_LINK) },
- { SHF_LINK_ORDER, MSG_ORIG(MSG_SHF_LINK_ORDER) },
- { SHF_OS_NONCONFORMING, MSG_ORIG(MSG_SHF_OS_NONCONFORMING) },
- { SHF_GROUP, MSG_ORIG(MSG_SHF_GROUP) },
- { SHF_TLS, MSG_ORIG(MSG_SHF_TLS) },
- { SHF_EXCLUDE, MSG_ORIG(MSG_SHF_EXCLUDE) },
- { SHF_ORDERED, MSG_ORIG(MSG_SHF_ORDERED) },
- { SHF_AMD64_LARGE, MSG_ORIG(MSG_SHF_AMD64_LARGE) },
+#define ALL ELFOSABI_NONE, EM_NONE
+#define SOL ELFOSABI_SOLARIS, EM_NONE
+#define AMD ELFOSABI_NONE, EM_AMD64
+
+ static const Val_desc2 vda_cf[] = {
+ { SHF_WRITE, ALL, MSG_SHF_WRITE_CF },
+ { SHF_ALLOC, ALL, MSG_SHF_ALLOC_CF },
+ { SHF_EXECINSTR, ALL, MSG_SHF_EXECINSTR_CF },
+ { SHF_MERGE, ALL, MSG_SHF_MERGE_CF },
+ { SHF_STRINGS, ALL, MSG_SHF_STRINGS_CF },
+ { SHF_INFO_LINK, ALL, MSG_SHF_INFO_LINK_CF },
+ { SHF_LINK_ORDER, ALL, MSG_SHF_LINK_ORDER_CF },
+ { SHF_OS_NONCONFORMING, ALL, MSG_SHF_OS_NONCONFORMING_CF },
+ { SHF_GROUP, ALL, MSG_SHF_GROUP_CF },
+ { SHF_TLS, ALL, MSG_SHF_TLS_CF },
+ { SHF_EXCLUDE, SOL, MSG_SHF_EXCLUDE_CF },
+ { SHF_ORDERED, SOL, MSG_SHF_ORDERED_CF },
+ { SHF_AMD64_LARGE, AMD, MSG_SHF_AMD64_LARGE_CF },
+ { 0, 0 }
+ };
+ static const Val_desc2 vda_nf[] = {
+ { SHF_WRITE, ALL, MSG_SHF_WRITE_NF },
+ { SHF_ALLOC, ALL, MSG_SHF_ALLOC_NF },
+ { SHF_EXECINSTR, ALL, MSG_SHF_EXECINSTR_NF },
+ { SHF_MERGE, ALL, MSG_SHF_MERGE_NF },
+ { SHF_STRINGS, ALL, MSG_SHF_STRINGS_NF },
+ { SHF_INFO_LINK, ALL, MSG_SHF_INFO_LINK_NF },
+ { SHF_LINK_ORDER, ALL, MSG_SHF_LINK_ORDER_NF },
+ { SHF_OS_NONCONFORMING, ALL, MSG_SHF_OS_NONCONFORMING_NF },
+ { SHF_GROUP, ALL, MSG_SHF_GROUP_NF },
+ { SHF_TLS, ALL, MSG_SHF_TLS_NF },
+ { SHF_EXCLUDE, SOL, MSG_SHF_EXCLUDE_NF },
+ { SHF_ORDERED, SOL, MSG_SHF_ORDERED_NF },
+ { SHF_AMD64_LARGE, AMD, MSG_SHF_AMD64_LARGE_NF },
{ 0, 0 }
};
- static CONV_EXPN_FIELD_ARG conv_arg = {
- NULL, sizeof (sec_flags_buf->buf), vda };
-
- if (flags == 0)
- return (MSG_ORIG(MSG_GBL_ZERO));
- conv_arg.buf = sec_flags_buf->buf;
- conv_arg.oflags = conv_arg.rflags = flags;
- (void) conv_expn_field(&conv_arg, fmt_flags);
+ return ((CONV_TYPE_FMT_ALT(fmt_flags) == CONV_FMT_ALT_NF) ?
+ vda_nf : vda_cf);
- return ((const char *)sec_flags_buf->buf);
+#undef ALL
+#undef SOL
+#undef AMD
}
-const char *
-conv_sec_linkinfo(Word info, Xword flags, Conv_inv_buf_t *inv_buf)
+conv_iter_ret_t
+conv_iter_sec_flags(conv_iter_osabi_t osabi, Half mach,
+ Conv_fmt_flags_t fmt_flags, conv_iter_cb_t func, void *uvalue)
{
- if (flags & ALL_SHF_ORDER) {
- if (info == SHN_BEFORE)
- return (MSG_ORIG(MSG_SHN_BEFORE));
- else if (info == SHN_AFTER)
- return (MSG_ORIG(MSG_SHN_AFTER));
+ static const Msg amd64_alias_cf[] = { MSG_SHF_X86_64_LARGE_CF };
+ static const conv_ds_msg_t ds_msg_amd64_alias_cf = {
+ CONV_DS_MSG_INIT(SHF_X86_64_LARGE, amd64_alias_cf) };
+ static const conv_ds_t *ds_amd64_alias_cf[] = {
+ CONV_DS_ADDR(ds_msg_amd64_alias_cf), NULL };
+
+ static const Msg amd64_alias_nf[] = { MSG_SHF_X86_64_LARGE_NF };
+ static const conv_ds_msg_t ds_msg_amd64_alias_nf = {
+ CONV_DS_MSG_INIT(SHF_X86_64_LARGE, amd64_alias_nf) };
+ static const conv_ds_t *ds_amd64_alias_nf[] = {
+ CONV_DS_ADDR(ds_msg_amd64_alias_nf), NULL };
+
+
+ if (conv_iter_vd2(osabi, mach, conv_sec_flags_strings(fmt_flags),
+ func, uvalue) == CONV_ITER_DONE)
+ return (CONV_ITER_DONE);
+
+ /* SHF_AMD64_LARGE is also known as SHF_X86_64_LARGE */
+ if (mach == EM_AMD64) {
+ const conv_ds_t **ds;
+
+ ds = (CONV_TYPE_FMT_ALT(fmt_flags) == CONV_FMT_ALT_NF) ?
+ ds_amd64_alias_nf : ds_amd64_alias_cf;
+
+ return (conv_iter_ds(ELFOSABI_NONE, mach, ds, func, uvalue));
}
- (void) conv_invalid_val(inv_buf, info, CONV_FMT_DECIMAL);
- return ((const char *)inv_buf->buf);
+ return (CONV_ITER_CONT);
}
diff --git a/usr/src/cmd/sgs/libconv/common/sections.msg b/usr/src/cmd/sgs/libconv/common/sections.msg
index fd2db7d3bb..22b3439064 100644
--- a/usr/src/cmd/sgs/libconv/common/sections.msg
+++ b/usr/src/cmd/sgs/libconv/common/sections.msg
@@ -1,5 +1,5 @@
#
-# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# CDDL HEADER START
@@ -21,99 +21,215 @@
#
# CDDL HEADER END
#
-#pragma ident "%Z%%M% %I% %E% SMI"
-#
# Message file for cmd/sgs/libconv/common/sections.c
-@ MSG_SHT_NULL "[ SHT_NULL ]"
-@ MSG_SHT_NULL_ALT "NULL"
-@ MSG_SHT_PROGBITS "[ SHT_PROGBITS ]"
-@ MSG_SHT_PROGBITS_ALT "PBIT"
-@ MSG_SHT_SYMTAB "[ SHT_SYMTAB ]"
-@ MSG_SHT_SYMTAB_ALT "SYMT"
-@ MSG_SHT_STRTAB "[ SHT_STRTAB ]"
-@ MSG_SHT_STRTAB_ALT "STRT"
-@ MSG_SHT_RELA "[ SHT_RELA ]"
-@ MSG_SHT_RELA_ALT "RELA"
-@ MSG_SHT_HASH "[ SHT_HASH ]"
-@ MSG_SHT_HASH_ALT "HASH"
-@ MSG_SHT_DYNAMIC "[ SHT_DYNAMIC ]"
-@ MSG_SHT_DYNAMIC_ALT "DYNM"
-@ MSG_SHT_NOTE "[ SHT_NOTE ]"
-@ MSG_SHT_NOTE_ALT "NOTE"
-@ MSG_SHT_NOBITS "[ SHT_NOBITS ]"
-@ MSG_SHT_NOBITS_ALT "NOBI"
-@ MSG_SHT_REL "[ SHT_REL ]"
-@ MSG_SHT_REL_ALT "REL "
-@ MSG_SHT_SHLIB "[ SHT_SHLIB ]"
-@ MSG_SHT_SHLIB_ALT "SHLB"
-@ MSG_SHT_DYNSYM "[ SHT_DYNSYM ]"
-@ MSG_SHT_DYNSYM_ALT "DYNS"
-@ MSG_SHT_UNKNOWN12 "[ UNKNOWN12 ]"
-@ MSG_SHT_UNKNOWN13 "[ UNKNOWN13 ]"
-@ MSG_SHT_INIT_ARRAY "[ SHT_INIT_ARRAY ]"
-@ MSG_SHT_INIT_ARRAY_ALT "INAR"
-@ MSG_SHT_FINI_ARRAY "[ SHT_FINI_ARRAY ]"
-@ MSG_SHT_FINI_ARRAY_ALT "FNAR"
-@ MSG_SHT_PREINIT_ARRAY "[ SHT_PREINIT_ARRAY ]"
-@ MSG_SHT_PREINIT_ARRAY_ALT "PNAR"
-@ MSG_SHT_GROUP "[ SHT_GROUP ]"
-@ MSG_SHT_GROUP_ALT "GRP "
-@ MSG_SHT_SYMTAB_SHNDX "[ SHT_SYMTAB_SHNDX ]"
-@ MSG_SHT_SYMTAB_SHNDX_ALT "SHDX"
+@ MSG_SHT_NULL "[ SHT_NULL ]" # 0
+@ MSG_SHT_NULL_DMP "NULL"
+@ MSG_SHT_NULL_CF "SHT_NULL"
+@ MSG_SHT_NULL_NF "null"
+@ MSG_SHT_PROGBITS "[ SHT_PROGBITS ]" # 1
+@ MSG_SHT_PROGBITS_DMP "PBIT"
+@ MSG_SHT_PROGBITS_CF "SHT_PROGBITS"
+@ MSG_SHT_PROGBITS_NF "progbits"
+@ MSG_SHT_SYMTAB "[ SHT_SYMTAB ]" # 2
+@ MSG_SHT_SYMTAB_CF "SHT_SYMTAB"
+@ MSG_SHT_SYMTAB_DMP "SYMT"
+@ MSG_SHT_SYMTAB_NF "symtab"
+@ MSG_SHT_STRTAB "[ SHT_STRTAB ]" # 3
+@ MSG_SHT_STRTAB_DMP "STRT"
+@ MSG_SHT_STRTAB_CF "SHT_STRTAB"
+@ MSG_SHT_STRTAB_NF "strtab"
+@ MSG_SHT_RELA "[ SHT_RELA ]" # 4
+@ MSG_SHT_RELA_DMP "RELA"
+@ MSG_SHT_RELA_CF "SHT_RELA"
+@ MSG_SHT_RELA_NF "rela"
+@ MSG_SHT_HASH "[ SHT_HASH ]" # 5
+@ MSG_SHT_HASH_DMP "HASH"
+@ MSG_SHT_HASH_CF "SHT_HASH"
+@ MSG_SHT_HASH_NF "hash"
+@ MSG_SHT_DYNAMIC "[ SHT_DYNAMIC ]" # 6
+@ MSG_SHT_DYNAMIC_DMP "DYNM"
+@ MSG_SHT_DYNAMIC_CF "SHT_DYNAMIC"
+@ MSG_SHT_DYNAMIC_NF "dynamic"
+@ MSG_SHT_NOTE "[ SHT_NOTE ]" # 7
+@ MSG_SHT_NOTE_DMP "NOTE"
+@ MSG_SHT_NOTE_CF "SHT_NOTE"
+@ MSG_SHT_NOTE_NF "note"
+@ MSG_SHT_NOBITS "[ SHT_NOBITS ]" # 8
+@ MSG_SHT_NOBITS_DMP "NOBI"
+@ MSG_SHT_NOBITS_CF "SHT_NOBITS"
+@ MSG_SHT_NOBITS_NF "nobits"
+@ MSG_SHT_REL "[ SHT_REL ]" # 9
+@ MSG_SHT_REL_DMP "REL "
+@ MSG_SHT_REL_CF "SHT_REL"
+@ MSG_SHT_REL_NF "rel"
+@ MSG_SHT_SHLIB "[ SHT_SHLIB ]" # 10
+@ MSG_SHT_SHLIB_DMP "SHLB"
+@ MSG_SHT_SHLIB_CF "SHT_SHLIB"
+@ MSG_SHT_SHLIB_NF "shlib"
+@ MSG_SHT_DYNSYM "[ SHT_DYNSYM ]" # 11
+@ MSG_SHT_DYNSYM_DMP "DYNS"
+@ MSG_SHT_DYNSYM_CF "SHT_DYNSYM"
+@ MSG_SHT_DYNSYM_NF "dynsym"
+@ MSG_SHT_UNKNOWN12 "[ UNKNOWN12 ]" # 12
+@ MSG_SHT_UNKNOWN12_DMP "12"
+@ MSG_SHT_UNKNOWN12_CF "UNKNOWN12"
+@ MSG_SHT_UNKNOWN12_NF "unknown12"
+@ MSG_SHT_UNKNOWN13 "[ UNKNOWN13 ]" # 13
+@ MSG_SHT_UNKNOWN13_DMP "13"
+@ MSG_SHT_UNKNOWN13_CF "UNKNOWN13"
+@ MSG_SHT_UNKNOWN13_NF "unknown13"
+@ MSG_SHT_INIT_ARRAY "[ SHT_INIT_ARRAY ]" # 14
+@ MSG_SHT_INIT_ARRAY_DMP "INAR"
+@ MSG_SHT_INIT_ARRAY_CF "SHT_INIT_ARRAY"
+@ MSG_SHT_INIT_ARRAY_NF "init_array"
+@ MSG_SHT_FINI_ARRAY "[ SHT_FINI_ARRAY ]" # 15
+@ MSG_SHT_FINI_ARRAY_DMP "FNAR"
+@ MSG_SHT_FINI_ARRAY_CF "SHT_FINI_ARRAY"
+@ MSG_SHT_FINI_ARRAY_NF "fini_array"
+@ MSG_SHT_PREINIT_ARRAY "[ SHT_PREINIT_ARRAY ]" # 16
+@ MSG_SHT_PREINIT_ARRAY_DMP "PNAR"
+@ MSG_SHT_PREINIT_ARRAY_CF "SHT_PREINIT_ARRAY"
+@ MSG_SHT_PREINIT_ARRAY_NF "preinit_ARRAY"
+@ MSG_SHT_GROUP "[ SHT_GROUP ]" # 17
+@ MSG_SHT_GROUP_DMP "GRP "
+@ MSG_SHT_GROUP_CF "SHT_GROUP"
+@ MSG_SHT_GROUP_NF "group"
+@ MSG_SHT_SYMTAB_SHNDX "[ SHT_SYMTAB_SHNDX ]" # 18
+@ MSG_SHT_SYMTAB_SHNDX_DMP "SHDX"
+@ MSG_SHT_SYMTAB_SHNDX_CF "SHT_SYMTAB_SHNDX"
+@ MSG_SHT_SYMTAB_SHNDX_NF "symtab_shndx"
+
+@ MSG_SHT_SUNW_SYMSORT "[ SHT_SUNW_symsort ]" # 0x6ffffff1
+@ MSG_SHT_SUNW_SYMSORT_DMP "SSRT"
+@ MSG_SHT_SUNW_SYMSORT_CF "SHT_SUNW_symsort"
+@ MSG_SHT_SUNW_SYMSORT_NF "sunw_symsort"
+@ MSG_SHT_SUNW_TLSSORT "[ SHT_SUNW_tlssort ]" # 0x6ffffff2
+@ MSG_SHT_SUNW_TLSSORT_DMP "TSRT"
+@ MSG_SHT_SUNW_TLSSORT_CF "SHT_SUNW_tlssort"
+@ MSG_SHT_SUNW_TLSSORT_NF "sunw_tlssort"
+@ MSG_SHT_SUNW_LDYNSYM "[ SHT_SUNW_LDYNSYM ]" # 0x6ffffff3
+@ MSG_SHT_SUNW_LDYNSYM_DMP "LDSM"
+@ MSG_SHT_SUNW_LDYNSYM_CF "SHT_SUNW_LDYNSYM"
+@ MSG_SHT_SUNW_LDYNSYM_NF "sunw_ldynsym"
+@ MSG_SHT_SUNW_DOF "[ SHT_SUNW_dof ]" # 0x6ffffff4
+@ MSG_SHT_SUNW_DOF_DMP "DOF "
+@ MSG_SHT_SUNW_DOF_CF "SHT_SUNW_dof"
+@ MSG_SHT_SUNW_DOF_NF "sunw_dof"
+@ MSG_SHT_SUNW_CAP "[ SHT_SUNW_cap ]" # 0x6ffffff5
+@ MSG_SHT_SUNW_CAP_DMP "CAP "
+@ MSG_SHT_SUNW_CAP_CF "SHT_SUNW_cap"
+@ MSG_SHT_SUNW_CAP_NF "sunw_cap"
+@ MSG_SHT_SUNW_SIGNATURE "[ SHT_SUNW_SIGNATURE ]" # 0x6ffffff6
+@ MSG_SHT_SUNW_SIGNATURE_DMP "SIGN"
+@ MSG_SHT_SUNW_SIGNATURE_CF "SHT_SUNW_SIGNATURE"
+@ MSG_SHT_SUNW_SIGNATURE_NF "sunw_signature"
+@ MSG_SHT_SUNW_ANNOTATE "[ SHT_SUNW_ANNOTATE ]" # 0x6ffffff7
+@ MSG_SHT_SUNW_ANNOTATE_DMP "ANOT"
+@ MSG_SHT_SUNW_ANNOTATE_CF "SHT_SUNW_ANNOTATE"
+@ MSG_SHT_SUNW_ANNOTATE_NF "sunw_annotate"
+@ MSG_SHT_SUNW_DEBUGSTR "[ SHT_SUNW_DEBUGSTR ]" # 0x6ffffff8
+@ MSG_SHT_SUNW_DEBUGSTR_DMP "DBGS"
+@ MSG_SHT_SUNW_DEBUGSTR_CF "SHT_SUNW_DEBUGSTR"
+@ MSG_SHT_SUNW_DEBUGSTR_NF "sunw_debugstr"
+@ MSG_SHT_SUNW_DEBUG "[ SHT_SUNW_DEBUG ]" # 0x6ffffff9
+@ MSG_SHT_SUNW_DEBUG_DMP "DBG "
+@ MSG_SHT_SUNW_DEBUG_CF "SHT_SUNW_DEBUG"
+@ MSG_SHT_SUNW_DEBUG_NF "sunw_debug"
+@ MSG_SHT_SUNW_MOVE "[ SHT_SUNW_move ]" # 0x6ffffffa
+@ MSG_SHT_SUNW_MOVE_DMP "MOVE"
+@ MSG_SHT_SUNW_MOVE_CF "SHT_SUNW_move"
+@ MSG_SHT_SUNW_MOVE_NF "sunw_move"
+@ MSG_SHT_SUNW_COMDAT "[ SHT_SUNW_COMDAT ]" # 0x6ffffffb
+@ MSG_SHT_SUNW_COMDAT_DMP "COMD"
+@ MSG_SHT_SUNW_COMDAT_CF "SHT_SUNW_COMDAT"
+@ MSG_SHT_SUNW_COMDAT_NF "sunw_comdat"
+@ MSG_SHT_SUNW_SYMINFO "[ SHT_SUNW_syminfo ]" # 0x6ffffffc
+@ MSG_SHT_SUNW_SYMINFO_DMP "SYMI"
+@ MSG_SHT_SUNW_SYMINFO_CF "SHT_SUNW_syminfo"
+@ MSG_SHT_SUNW_SYMINFO_NF "sunw_syminfo"
+@ MSG_SHT_SUNW_VERDEF "[ SHT_SUNW_verdef ]" # 0x6ffffffd
+@ MSG_SHT_SUNW_VERDEF_DMP "VERD"
+@ MSG_SHT_SUNW_VERDEF_CF "SHT_SUNW_verdef"
+@ MSG_SHT_SUNW_VERDEF_NF "sunw_verdef"
+@ MSG_SHT_SUNW_VERNEED "[ SHT_SUNW_verneed ]" # 0x6ffffffe
+@ MSG_SHT_SUNW_VERNEED_DMP "VERN"
+@ MSG_SHT_SUNW_VERNEED_CF "SHT_SUNW_verneed"
+@ MSG_SHT_SUNW_VERNEED_NF "sunw_verneed"
+@ MSG_SHT_SUNW_VERSYM "[ SHT_SUNW_versym ]" # 0x6fffffff
+@ MSG_SHT_SUNW_VERSYM_DMP "VERS"
+@ MSG_SHT_SUNW_VERSYM_CF "SHT_SUNW_versym"
+@ MSG_SHT_SUNW_VERSYM_NF "sunw_versym"
-@ MSG_SHT_SUNW_symsort "[ SHT_SUNW_symsort ]"
-@ MSG_SHT_SUNW_symsort_ALT "SSRT"
-@ MSG_SHT_SUNW_tlssort "[ SHT_SUNW_tlssort ]"
-@ MSG_SHT_SUNW_tlssort_ALT "TSRT"
-@ MSG_SHT_SUNW_LDYNSYM "[ SHT_SUNW_LDYNSYM ]"
-@ MSG_SHT_SUNW_LDYNSYM_ALT "LDSM"
-@ MSG_SHT_SUNW_dof "[ SHT_SUNW_dof ]"
-@ MSG_SHT_SUNW_dof_ALT "DOF "
-@ MSG_SHT_SUNW_cap "[ SHT_SUNW_cap ]"
-@ MSG_SHT_SUNW_cap_ALT "CAP "
-@ MSG_SHT_SUNW_SIGNATURE "[ SHT_SUNW_SIGNATURE ]"
-@ MSG_SHT_SUNW_SIGNATURE_ALT "SIGN"
-@ MSG_SHT_SUNW_ANNOTATE "[ SHT_SUNW_ANNOTATE ]"
-@ MSG_SHT_SUNW_ANNOTATE_ALT "ANOT"
-@ MSG_SHT_SUNW_DEBUGSTR "[ SHT_SUNW_DEBUGSTR ]"
-@ MSG_SHT_SUNW_DEBUGSTR_ALT "DBGS"
-@ MSG_SHT_SUNW_DEBUG "[ SHT_SUNW_DEBUG ]"
-@ MSG_SHT_SUNW_DEBUG_ALT "DBG "
-@ MSG_SHT_SUNW_move "[ SHT_SUNW_move ]"
-@ MSG_SHT_SUNW_move_ALT "MOVE"
-@ MSG_SHT_SUNW_COMDAT "[ SHT_SUNW_COMDAT ]"
-@ MSG_SHT_SUNW_COMDAT_ALT "COMD"
-@ MSG_SHT_SUNW_syminfo "[ SHT_SUNW_syminfo ]"
-@ MSG_SHT_SUNW_syminfo_ALT "SYMI"
-@ MSG_SHT_SUNW_verdef "[ SHT_SUNW_verdef ]"
-@ MSG_SHT_SUNW_verdef_ALT "VERD"
-@ MSG_SHT_SUNW_verneed "[ SHT_SUNW_verneed ]"
-@ MSG_SHT_SUNW_verneed_ALT "VERN"
-@ MSG_SHT_SUNW_versym "[ SHT_SUNW_versym ]"
-@ MSG_SHT_SUNW_versym_ALT "VERS"
+@ MSG_SHT_GNU_ATTRIBUTES "[ SHT_GNU_ATTRIBUTES ]" # 0x6ffffff5
+@ MSG_SHT_GNU_ATTRIBUTES_DMP "ATTR"
+@ MSG_SHT_GNU_ATTRIBUTES_CF "SHT_GNU_ATTRIBUTES"
+@ MSG_SHT_GNU_ATTRIBUTES_NF "gnu_attributes"
+@ MSG_SHT_GNU_HASH "[ SHT_GNU_HASH ]" # 0x6ffffff6
+@ MSG_SHT_GNU_HASH_DMP "GHSH"
+@ MSG_SHT_GNU_HASH_CF "SHT_GNU_HASH"
+@ MSG_SHT_GNU_HASH_NF "gnu_hash"
+@ MSG_SHT_GNU_LIBLIST "[ SHT_GNU_LIBLIST ]" # 0x6ffffff7
+@ MSG_SHT_GNU_LIBLIST_DMP "LLST"
+@ MSG_SHT_GNU_LIBLIST_CF "SHT_GNU_LIBLIST"
+@ MSG_SHT_GNU_LIBLIST_NF "gnu_liblist"
+@ MSG_SHT_CHECKSUM "[ SHT_CHECKSUM ]" # 0x6ffffff8
+@ MSG_SHT_CHECKSUM_DMP "CSUM"
+@ MSG_SHT_CHECKSUM_CF "SHT_CHECKSUM"
+@ MSG_SHT_CHECKSUM_NF "checksum"
+@ MSG_SHT_GNU_VERDEF "[ SHT_GNU_verdef ]" # 0x6ffffffd
+@ MSG_SHT_GNU_VERDEF_DMP "VERD"
+@ MSG_SHT_GNU_VERDEF_CF "SHT_GNU_verdef"
+@ MSG_SHT_GNU_VERDEF_NF "gnu_verdef"
+@ MSG_SHT_GNU_VERNEED "[ SHT_GNU_verneed ]" # 0x6ffffffe
+@ MSG_SHT_GNU_VERNEED_DMP "VERN"
+@ MSG_SHT_GNU_VERNEED_CF "SHT_GNU_verneed"
+@ MSG_SHT_GNU_VERNEED_NF "gnu_verneed"
+@ MSG_SHT_GNU_VERSYM "[ SHT_GNU_versym ]" # 0x6fffffff
+@ MSG_SHT_GNU_VERSYM_DMP "VERS"
+@ MSG_SHT_GNU_VERSYM_CF "SHT_GNU_versym"
+@ MSG_SHT_GNU_VERSYM_NF "gnu_versym"
-@ MSG_SHT_AMD64_UNWIND "[ SHT_AMD64_UNWIND ]"
-@ MSG_SHT_AMD64_UNWIND_ALT "UNWD"
+@ MSG_SHT_AMD64_UNWIND "[ SHT_AMD64_UNWIND ]" # 0x7000000
+@ MSG_SHT_AMD64_UNWIND_DMP "UNWD"
+@ MSG_SHT_AMD64_UNWIND_CF "SHT_AMD64_UNWIND"
+@ MSG_SHT_AMD64_UNWIND_NF "amd64_unwind"
-@ MSG_SHT_SPARC_GOTDATA "[ SHT_SPARC_GOTDATA ]"
-@ MSG_SHT_SPARC_GOTDATA_ALT "GOTD"
+@ MSG_SHT_SPARC_GOTDATA "[ SHT_SPARC_GOTDATA ]" # 0x7000000
+@ MSG_SHT_SPARC_GOTDATA_DMP "GOTD"
+@ MSG_SHT_SPARC_GOTDATA_CF "SHT_SPARC_GOTDATA"
+@ MSG_SHT_SPARC_GOTDATA_NF "sparc_gotdata"
@ MSG_SHN_AFTER "[ SHN_AFTER ]"
@ MSG_SHN_BEFORE "[ SHN_BEFORE ]"
-@ MSG_SHF_WRITE "SHF_WRITE"
-@ MSG_SHF_ALLOC "SHF_ALLOC"
-@ MSG_SHF_EXECINSTR "SHF_EXECINSTR"
-@ MSG_SHF_MERGE "SHF_MERGE"
-@ MSG_SHF_STRINGS "SHF_STRINGS"
-@ MSG_SHF_INFO_LINK "SHF_INFO_LINK"
-@ MSG_SHF_LINK_ORDER "SHF_LINK_ORDER"
-@ MSG_SHF_OS_NONCONFORMING "SHF_OS_NONCONFORMING"
-@ MSG_SHF_GROUP "SHF_GROUP"
-@ MSG_SHF_TLS "SHF_TLS"
-@ MSG_SHF_EXCLUDE "SHF_EXCLUDE"
-@ MSG_SHF_ORDERED "SHF_ORDERED"
-@ MSG_SHF_AMD64_LARGE "SHF_AMD64_LARGE"
+@ MSG_SHF_WRITE_CF "SHF_WRITE" # 0x01
+@ MSG_SHF_WRITE_NF "write"
+@ MSG_SHF_ALLOC_CF "SHF_ALLOC" # 0x02
+@ MSG_SHF_ALLOC_NF "alloc"
+@ MSG_SHF_EXECINSTR_CF "SHF_EXECINSTR" # 0x04
+@ MSG_SHF_EXECINSTR_NF "execinstr"
+@ MSG_SHF_MERGE_CF "SHF_MERGE" # 0x10
+@ MSG_SHF_MERGE_NF "merge"
+@ MSG_SHF_STRINGS_CF "SHF_STRINGS" # 0x20
+@ MSG_SHF_STRINGS_NF "strings"
+@ MSG_SHF_INFO_LINK_CF "SHF_INFO_LINK" # 0x40
+@ MSG_SHF_INFO_LINK_NF "info_link"
+@ MSG_SHF_LINK_ORDER_CF "SHF_LINK_ORDER" # 0x80
+@ MSG_SHF_LINK_ORDER_NF "link_order"
+@ MSG_SHF_OS_NONCONFORMING_CF "SHF_OS_NONCONFORMING" # 0x100
+@ MSG_SHF_OS_NONCONFORMING_NF "os_nonconforming"
+@ MSG_SHF_GROUP_CF "SHF_GROUP" # 0x200
+@ MSG_SHF_GROUP_NF "group"
+@ MSG_SHF_TLS_CF "SHF_TLS" # 0x400
+@ MSG_SHF_TLS_NF "tls"
+@ MSG_SHF_AMD64_LARGE_CF "SHF_AMD64_LARGE" # 0x10000000
+@ MSG_SHF_AMD64_LARGE_NF "amd64_large"
+@ MSG_SHF_X86_64_LARGE_CF "SHF_X86_64_LARGE" # Alias: SHF_AMD64_LARGE
+@ MSG_SHF_X86_64_LARGE_NF "x86_64_large"
+@ MSG_SHF_ORDERED_CF "SHF_ORDERED" # 0x40000000
+@ MSG_SHF_ORDERED_NF "ordered"
+@ MSG_SHF_EXCLUDE_CF "SHF_EXCLUDE" # 0x80000000
+@ MSG_SHF_EXCLUDE_NF "exclude"
@ MSG_GBL_ZERO "0"
diff --git a/usr/src/cmd/sgs/libconv/common/sections_machelf.c b/usr/src/cmd/sgs/libconv/common/sections_machelf.c
new file mode 100644
index 0000000000..8dc8c0aba9
--- /dev/null
+++ b/usr/src/cmd/sgs/libconv/common/sections_machelf.c
@@ -0,0 +1,71 @@
+/*
+ * 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
+ * or http://www.opensolaris.org/os/licensing.
+ * 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.
+ */
+
+/*
+ * String conversion routines for section attributes.
+ */
+#include <string.h>
+#include <sys/param.h>
+#include <sys/elf_SPARC.h>
+#include <sys/elf_amd64.h>
+#include <_conv.h>
+#include <sections_msg.h>
+
+
+
+const char *
+conv_sec_flags(uchar_t osabi, Half mach, Xword flags,
+ Conv_fmt_flags_t fmt_flags, Conv_sec_flags_buf_t *sec_flags_buf)
+{
+ static CONV_EXPN_FIELD_ARG conv_arg = {
+ NULL, sizeof (sec_flags_buf->buf) };
+
+ if (flags == 0)
+ return (MSG_ORIG(MSG_GBL_ZERO));
+ CONV_XWORD_64TEST(flags, fmt_flags, &sec_flags_buf->inv_buf);
+
+ conv_arg.buf = sec_flags_buf->buf;
+ conv_arg.oflags = conv_arg.rflags = flags;
+ (void) conv_expn_field2(&conv_arg, osabi, mach,
+ conv_sec_flags_strings(fmt_flags), fmt_flags);
+
+ return ((const char *)sec_flags_buf->buf);
+}
+
+const char *
+conv_sec_linkinfo(Word info, Xword flags, Conv_inv_buf_t *inv_buf)
+{
+ if (flags & ALL_SHF_ORDER) {
+ if (info == SHN_BEFORE)
+ return (MSG_ORIG(MSG_SHN_BEFORE));
+ else if (info == SHN_AFTER)
+ return (MSG_ORIG(MSG_SHN_AFTER));
+ }
+
+ CONV_XWORD_64TEST(flags, 0, inv_buf);
+ (void) conv_invalid_val(inv_buf, info, CONV_FMT_DECIMAL);
+ return ((const char *)inv_buf->buf);
+}
diff --git a/usr/src/cmd/sgs/libconv/common/segments.c b/usr/src/cmd/sgs/libconv/common/segments.c
index 7667dbebd1..d121a4a167 100644
--- a/usr/src/cmd/sgs/libconv/common/segments.c
+++ b/usr/src/cmd/sgs/libconv/common/segments.c
@@ -20,10 +20,9 @@
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
/*
* String conversion routine for segment flags.
@@ -68,30 +67,30 @@ const char *
conv_seg_flags(Half flags, Conv_seg_flags_buf_t *seg_flags_buf)
{
static Val_desc vda[] = {
- { FLG_SG_VADDR, MSG_ORIG(MSG_FLG_SG_VADDR) },
- { FLG_SG_PADDR, MSG_ORIG(MSG_FLG_SG_PADDR) },
- { FLG_SG_LENGTH, MSG_ORIG(MSG_FLG_SG_LENGTH) },
- { FLG_SG_ALIGN, MSG_ORIG(MSG_FLG_SG_ALIGN) },
- { FLG_SG_ROUND, MSG_ORIG(MSG_FLG_SG_ROUND) },
- { FLG_SG_FLAGS, MSG_ORIG(MSG_FLG_SG_FLAGS) },
- { FLG_SG_TYPE, MSG_ORIG(MSG_FLG_SG_TYPE) },
- { FLG_SG_ORDER, MSG_ORIG(MSG_FLG_SG_ORDER) },
- { FLG_SG_NOHDR, MSG_ORIG(MSG_FLG_SG_NOHDR) },
- { FLG_SG_EMPTY, MSG_ORIG(MSG_FLG_SG_EMPTY) },
- { FLG_SG_KEY, MSG_ORIG(MSG_FLG_SG_KEY) },
- { FLG_SG_DISABLED, MSG_ORIG(MSG_FLG_SG_DISABLED) },
- { FLG_SG_PHREQ, MSG_ORIG(MSG_FLG_SG_PHREQ) },
+ { FLG_SG_VADDR, MSG_FLG_SG_VADDR },
+ { FLG_SG_PADDR, MSG_FLG_SG_PADDR },
+ { FLG_SG_LENGTH, MSG_FLG_SG_LENGTH },
+ { FLG_SG_ALIGN, MSG_FLG_SG_ALIGN },
+ { FLG_SG_ROUND, MSG_FLG_SG_ROUND },
+ { FLG_SG_FLAGS, MSG_FLG_SG_FLAGS },
+ { FLG_SG_TYPE, MSG_FLG_SG_TYPE },
+ { FLG_SG_ORDER, MSG_FLG_SG_ORDER },
+ { FLG_SG_NOHDR, MSG_FLG_SG_NOHDR },
+ { FLG_SG_EMPTY, MSG_FLG_SG_EMPTY },
+ { FLG_SG_KEY, MSG_FLG_SG_KEY },
+ { FLG_SG_DISABLED, MSG_FLG_SG_DISABLED },
+ { FLG_SG_PHREQ, MSG_FLG_SG_PHREQ },
{ 0, 0 }
};
static CONV_EXPN_FIELD_ARG conv_arg = {
- NULL, sizeof (seg_flags_buf->buf), vda };
+ NULL, sizeof (seg_flags_buf->buf) };
if (flags == 0)
return (MSG_ORIG(MSG_GBL_ZERO));
conv_arg.buf = seg_flags_buf->buf;
conv_arg.oflags = conv_arg.rflags = flags;
- (void) conv_expn_field(&conv_arg, 0);
+ (void) conv_expn_field(&conv_arg, vda, 0);
return ((const char *)seg_flags_buf->buf);
}
diff --git a/usr/src/cmd/sgs/libconv/common/symbols.c b/usr/src/cmd/sgs/libconv/common/symbols.c
index 0ec4c04854..5da02cb407 100644
--- a/usr/src/cmd/sgs/libconv/common/symbols.c
+++ b/usr/src/cmd/sgs/libconv/common/symbols.c
@@ -28,7 +28,6 @@
* String conversion routines for symbol attributes.
*/
#include <stdio.h>
-#include <_machelf.h>
#include <sys/elf_SPARC.h>
#include <sys/elf_amd64.h>
#include "_conv.h"
@@ -61,127 +60,367 @@ conv_sym_other(uchar_t other, Conv_inv_buf_t *inv_buf)
return (inv_buf->buf);
}
+static const conv_ds_t **
+conv_sym_other_vis_strings(Conv_fmt_flags_t fmt_flags)
+{
+ static const Msg vis_def[] = {
+ MSG_STV_DEFAULT_DEF, MSG_STV_INTERNAL_DEF,
+ MSG_STV_HIDDEN_DEF, MSG_STV_PROTECTED_DEF,
+ MSG_STV_EXPORTED_DEF, MSG_STV_SINGLETON_DEF,
+ MSG_STV_ELIMINATE_DEF
+ };
+ static const Msg vis_cf[] = {
+ MSG_STV_DEFAULT_CF, MSG_STV_INTERNAL_CF,
+ MSG_STV_HIDDEN_CF, MSG_STV_PROTECTED_CF,
+ MSG_STV_EXPORTED_CF, MSG_STV_SINGLETON_CF,
+ MSG_STV_ELIMINATE_CF
+ };
+ static const Msg vis_nf[] = {
+ MSG_STV_DEFAULT_NF, MSG_STV_INTERNAL_NF,
+ MSG_STV_HIDDEN_NF, MSG_STV_PROTECTED_NF,
+ MSG_STV_EXPORTED_NF, MSG_STV_SINGLETON_NF,
+ MSG_STV_ELIMINATE_NF
+ };
+ static const conv_ds_msg_t ds_vis_def = {
+ CONV_DS_MSG_INIT(STV_DEFAULT, vis_def) };
+ static const conv_ds_msg_t ds_vis_cf = {
+ CONV_DS_MSG_INIT(STV_DEFAULT, vis_cf) };
+ static const conv_ds_msg_t ds_vis_nf = {
+ CONV_DS_MSG_INIT(STV_DEFAULT, vis_nf) };
+
+ /* Build NULL terminated return arrays for each string style */
+ static const const conv_ds_t *ds_def[] = {
+ CONV_DS_ADDR(ds_vis_def), NULL };
+ static const const conv_ds_t *ds_cf[] = {
+ CONV_DS_ADDR(ds_vis_cf), NULL };
+ static const const conv_ds_t *ds_nf[] = {
+ CONV_DS_ADDR(ds_vis_nf), NULL };
+
+ /* Select the strings to use */
+ switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
+ case CONV_FMT_ALT_CF:
+ return (ds_cf);
+ case CONV_FMT_ALT_NF:
+ return (ds_nf);
+ }
+
+ return (ds_def);
+}
+
const char *
conv_sym_other_vis(uchar_t value, Conv_fmt_flags_t fmt_flags,
Conv_inv_buf_t *inv_buf)
{
- static const Msg vis[] = {
- MSG_STV_DEFAULT, MSG_STV_INTERNAL,
- MSG_STV_HIDDEN, MSG_STV_PROTECTED,
- MSG_STV_EXPORTED, MSG_STV_SINGLETON,
- MSG_STV_ELIMINATE
- };
+ return (conv_map_ds(ELFOSABI_NONE, EM_NONE, value,
+ conv_sym_other_vis_strings(fmt_flags), fmt_flags, inv_buf));
+}
+
+conv_iter_ret_t
+conv_iter_sym_other_vis(Conv_fmt_flags_t fmt_flags, conv_iter_cb_t func,
+ void *uvalue)
+{
+ return (conv_iter_ds(ELFOSABI_NONE, EM_NONE,
+ conv_sym_other_vis_strings(fmt_flags), func, uvalue));
+}
+
+static const conv_ds_t **
+conv_sym_info_type_strings(Half mach, Conv_fmt_flags_t fmt_flags)
+{
+ /*
+ * This routine can return an array with 1 generic array, and
+ * a machine array, plus the NULL termination.
+ */
+#define MAX_RET 3
- static const Msg vis_alt[] = {
- MSG_STV_DEFAULT_ALT, MSG_STV_INTERNAL_ALT,
- MSG_STV_HIDDEN_ALT, MSG_STV_PROTECTED_ALT,
- MSG_STV_EXPORTED_ALT, MSG_STV_SINGLETON_ALT,
- MSG_STV_ELIMINATE_ALT
+ static const Msg types_def[] = {
+ MSG_STT_NOTYPE_DEF, MSG_STT_OBJECT_DEF,
+ MSG_STT_FUNC_DEF, MSG_STT_SECTION_DEF,
+ MSG_STT_FILE_DEF, MSG_STT_COMMON_DEF,
+ MSG_STT_TLS_DEF, MSG_STT_IFUNC_DEF
+ };
+ static const Msg types_cf[] = {
+ MSG_STT_NOTYPE_CF, MSG_STT_OBJECT_CF,
+ MSG_STT_FUNC_CF, MSG_STT_SECTION_CF,
+ MSG_STT_FILE_CF, MSG_STT_COMMON_CF,
+ MSG_STT_TLS_CF, MSG_STT_IFUNC_CF
};
+ static const Msg types_nf[] = {
+ MSG_STT_NOTYPE_NF, MSG_STT_OBJECT_NF,
+ MSG_STT_FUNC_NF, MSG_STT_SECTION_NF,
+ MSG_STT_FILE_NF, MSG_STT_COMMON_NF,
+ MSG_STT_TLS_NF, MSG_STT_IFUNC_NF
+ };
+ static const conv_ds_msg_t ds_types_def = {
+ CONV_DS_MSG_INIT(STT_NOTYPE, types_def) };
+ static const conv_ds_msg_t ds_types_cf = {
+ CONV_DS_MSG_INIT(STT_NOTYPE, types_cf) };
+ static const conv_ds_msg_t ds_types_nf = {
+ CONV_DS_MSG_INIT(STT_NOTYPE, types_nf) };
+
- if (value >= (sizeof (vis) / sizeof (vis[0])))
- return (conv_invalid_val(inv_buf, value, fmt_flags));
+ static const Msg sparc_def[] = { MSG_STT_SPARC_REGISTER_DEF };
+ static const Msg sparc_cf[] = { MSG_STT_SPARC_REGISTER_CF };
+ static const Msg sparc_nf[] = { MSG_STT_SPARC_REGISTER_NF };
+ static const conv_ds_msg_t ds_sparc_def = {
+ CONV_DS_MSG_INIT(STT_SPARC_REGISTER, sparc_def) };
+ static const conv_ds_msg_t ds_sparc_cf = {
+ CONV_DS_MSG_INIT(STT_SPARC_REGISTER, sparc_cf) };
+ static const conv_ds_msg_t ds_sparc_nf = {
+ CONV_DS_MSG_INIT(STT_SPARC_REGISTER, sparc_nf) };
- /* If full ELF names are desired, use those strings */
- if (CONV_TYPE_FMT_ALT(fmt_flags) == CONV_FMT_ALT_FULLNAME)
- return (MSG_ORIG(vis_alt[value]));
- /* Default strings */
- return (MSG_ORIG(vis[value]));
+ static const conv_ds_t *retarr[MAX_RET];
+
+ int retndx = 0;
+ int is_sparc;
+
+ is_sparc = (mach == EM_SPARC) || (mach == EM_SPARCV9) ||
+ (mach == EM_SPARC32PLUS) || (mach == CONV_MACH_ALL);
+
+ switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
+ case CONV_FMT_ALT_CF:
+ retarr[retndx++] = CONV_DS_ADDR(ds_types_cf);
+ if (is_sparc)
+ retarr[retndx++] = CONV_DS_ADDR(ds_sparc_cf);
+ break;
+ case CONV_FMT_ALT_NF:
+ retarr[retndx++] = CONV_DS_ADDR(ds_types_nf);
+ if (is_sparc)
+ retarr[retndx++] = CONV_DS_ADDR(ds_sparc_nf);
+ break;
+ default:
+ retarr[retndx++] = CONV_DS_ADDR(ds_types_def);
+ if (is_sparc)
+ retarr[retndx++] = CONV_DS_ADDR(ds_sparc_def);
+ break;
+ }
+
+ retarr[retndx++] = NULL;
+ assert(retndx <= MAX_RET);
+ return (retarr);
}
const char *
conv_sym_info_type(Half mach, uchar_t type, Conv_fmt_flags_t fmt_flags,
Conv_inv_buf_t *inv_buf)
{
- static const Msg types[] = {
- MSG_STT_NOTYPE, MSG_STT_OBJECT,
- MSG_STT_FUNC, MSG_STT_SECTION,
- MSG_STT_FILE, MSG_STT_COMMON,
- MSG_STT_TLS, MSG_STT_IFUNC
- };
+ return (conv_map_ds(ELFOSABI_NONE, mach, type,
+ conv_sym_info_type_strings(mach, fmt_flags), fmt_flags, inv_buf));
+}
- static const Msg types_alt[] = {
- MSG_STT_NOTYPE_ALT, MSG_STT_OBJECT_ALT,
- MSG_STT_FUNC_ALT, MSG_STT_SECTION_ALT,
- MSG_STT_FILE_ALT, MSG_STT_COMMON_ALT,
- MSG_STT_TLS_ALT, MSG_STT_IFUNC_ALT
+conv_iter_ret_t
+conv_iter_sym_info_type(Half mach, Conv_fmt_flags_t fmt_flags,
+ conv_iter_cb_t func, void *uvalue)
+{
+ return (conv_iter_ds(ELFOSABI_NONE, mach,
+ conv_sym_info_type_strings(mach, fmt_flags), func, uvalue));
+}
+
+static const conv_ds_t **
+conv_sym_info_bind_strings(Conv_fmt_flags_t fmt_flags)
+{
+ static const Msg binds_def[] = {
+ MSG_STB_LOCAL_DEF, MSG_STB_GLOBAL_DEF,
+ MSG_STB_WEAK_DEF
};
+ static const Msg binds_cf[] = {
+ MSG_STB_LOCAL_CF, MSG_STB_GLOBAL_CF,
+ MSG_STB_WEAK_CF
+ };
+ static const Msg binds_nf[] = {
+ MSG_STB_LOCAL_NF, MSG_STB_GLOBAL_NF,
+ MSG_STB_WEAK_NF
+ };
+ static const conv_ds_msg_t ds_binds_def = {
+ CONV_DS_MSG_INIT(STB_LOCAL, binds_def) };
+ static const conv_ds_msg_t ds_binds_cf = {
+ CONV_DS_MSG_INIT(STB_LOCAL, binds_cf) };
+ static const conv_ds_msg_t ds_binds_nf = {
+ CONV_DS_MSG_INIT(STB_LOCAL, binds_nf) };
+
+
+ /* Build NULL terminated return arrays for each string style */
+ static const const conv_ds_t *ds_def[] = {
+ CONV_DS_ADDR(ds_binds_def), NULL };
+ static const const conv_ds_t *ds_cf[] = {
+ CONV_DS_ADDR(ds_binds_cf), NULL };
+ static const const conv_ds_t *ds_nf[] = {
+ CONV_DS_ADDR(ds_binds_nf), NULL };
+
- if (type < STT_NUM) {
- /* If full ELF names are desired, use those strings */
- if (CONV_TYPE_FMT_ALT(fmt_flags) == CONV_FMT_ALT_FULLNAME)
- return (MSG_ORIG(types_alt[type]));
-
- /* Default strings */
- return (MSG_ORIG(types[type]));
- } else if (((mach == EM_SPARC) || (mach == EM_SPARC32PLUS) ||
- (mach == EM_SPARCV9)) && (type == STT_SPARC_REGISTER)) {
- if (CONV_TYPE_FMT_ALT(fmt_flags) == CONV_FMT_ALT_FULLNAME)
- return (MSG_ORIG(MSG_STT_SPARC_REGISTER_ALT));
-
- return (MSG_ORIG(MSG_STT_SPARC_REGISTER));
- } else {
- return (conv_invalid_val(inv_buf, type, fmt_flags));
+ /* Select the strings to use */
+ switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
+ case CONV_FMT_ALT_CF:
+ return (ds_cf);
+ case CONV_FMT_ALT_NF:
+ return (ds_nf);
}
+
+ return (ds_def);
}
const char *
conv_sym_info_bind(uchar_t bind, Conv_fmt_flags_t fmt_flags,
Conv_inv_buf_t *inv_buf)
{
- static const Msg binds[] = {
- MSG_STB_LOCAL, MSG_STB_GLOBAL, MSG_STB_WEAK
- };
+ return (conv_map_ds(ELFOSABI_NONE, EM_NONE, bind,
+ conv_sym_info_bind_strings(fmt_flags), fmt_flags, inv_buf));
+}
- static const Msg binds_alt[] = {
- MSG_STB_LOCAL_ALT, MSG_STB_GLOBAL_ALT, MSG_STB_WEAK_ALT
+conv_iter_ret_t
+conv_iter_sym_info_bind(Conv_fmt_flags_t fmt_flags, conv_iter_cb_t func,
+ void *uvalue)
+{
+ return (conv_iter_ds(ELFOSABI_NONE, EM_NONE,
+ conv_sym_info_bind_strings(fmt_flags), func, uvalue));
+}
+
+static const conv_ds_t **
+conv_sym_shndx_strings(Conv_fmt_flags_t fmt_flags)
+{
+#define ALL ELFOSABI_NONE, EM_NONE
+#define SOL ELFOSABI_SOLARIS, EM_NONE
+#define AMD ELFOSABI_NONE, EM_AMD64
+
+ /*
+ * There aren't many of these values, and they are sparse,
+ * so rather than separate them into different ranges, I use
+ * a single Val_desc2 array for all of them.
+ */
+ static const Val_desc2 shn_def[] = {
+ { SHN_UNDEF, ALL, MSG_SHN_UNDEF_CFNP },
+ { SHN_BEFORE, ALL, MSG_SHN_BEFORE_CFNP },
+ { SHN_AFTER, ALL, MSG_SHN_AFTER_CFNP },
+ { SHN_AMD64_LCOMMON, AMD, MSG_SHN_AMD64_LCOMMON_DEF },
+ { SHN_SUNW_IGNORE, SOL, MSG_SHN_SUNW_IGNORE_DEF },
+ { SHN_ABS, ALL, MSG_SHN_ABS_CFNP },
+ { SHN_COMMON, ALL, MSG_SHN_COMMON_CFNP },
+ { SHN_XINDEX, ALL, MSG_SHN_XINDEX_CFNP },
+ { 0 }
+ };
+ static const Val_desc2 shn_cf[] = {
+ { SHN_UNDEF, ALL, MSG_SHN_UNDEF_CF },
+ { SHN_BEFORE, ALL, MSG_SHN_BEFORE_CF },
+ { SHN_AFTER, ALL, MSG_SHN_AFTER_CF },
+ { SHN_AMD64_LCOMMON, AMD, MSG_SHN_AMD64_LCOMMON_CF },
+ { SHN_SUNW_IGNORE, SOL, MSG_SHN_SUNW_IGNORE_CF },
+ { SHN_ABS, ALL, MSG_SHN_ABS_CF },
+ { SHN_COMMON, ALL, MSG_SHN_COMMON_CF },
+ { SHN_XINDEX, ALL, MSG_SHN_XINDEX_CF },
+ { 0 }
+ };
+ static const Val_desc2 shn_cfnp[] = {
+ { SHN_UNDEF, ALL, MSG_SHN_UNDEF_CFNP },
+ { SHN_BEFORE, ALL, MSG_SHN_BEFORE_CFNP },
+ { SHN_AFTER, ALL, MSG_SHN_AFTER_CFNP },
+ { SHN_AMD64_LCOMMON, AMD, MSG_SHN_AMD64_LCOMMON_CFNP },
+ { SHN_SUNW_IGNORE, SOL, MSG_SHN_SUNW_IGNORE_CFNP },
+ { SHN_ABS, ALL, MSG_SHN_ABS_CFNP },
+ { SHN_COMMON, ALL, MSG_SHN_COMMON_CFNP },
+ { SHN_XINDEX, ALL, MSG_SHN_XINDEX_CFNP },
+ { 0 }
};
+ static const Val_desc2 shn_nf[] = {
+ { SHN_UNDEF, ALL, MSG_SHN_UNDEF_NF },
+ { SHN_BEFORE, ALL, MSG_SHN_BEFORE_NF },
+ { SHN_AFTER, ALL, MSG_SHN_AFTER_NF },
+ { SHN_AMD64_LCOMMON, AMD, MSG_SHN_AMD64_LCOMMON_NF },
+ { SHN_SUNW_IGNORE, SOL, MSG_SHN_SUNW_IGNORE_NF },
+ { SHN_ABS, ALL, MSG_SHN_ABS_NF },
+ { SHN_COMMON, ALL, MSG_SHN_COMMON_NF },
+ { SHN_XINDEX, ALL, MSG_SHN_XINDEX_NF },
+ { 0 }
+ };
+ static const conv_ds_vd2_t ds_shn_def = {
+ CONV_DS_VD2, SHN_UNDEF, SHN_XINDEX, shn_def };
+ static const conv_ds_vd2_t ds_shn_cf = {
+ CONV_DS_VD2, SHN_UNDEF, SHN_XINDEX, shn_cf };
+ static const conv_ds_vd2_t ds_shn_cfnp = {
+ CONV_DS_VD2, SHN_UNDEF, SHN_XINDEX, shn_cfnp };
+ static const conv_ds_vd2_t ds_shn_nf = {
+ CONV_DS_VD2, SHN_UNDEF, SHN_XINDEX, shn_nf };
+
+ /* Build NULL terminated return arrays for each string style */
+ static const const conv_ds_t *ds_def[] = {
+ CONV_DS_ADDR(ds_shn_def), NULL };
+ static const const conv_ds_t *ds_cf[] = {
+ CONV_DS_ADDR(ds_shn_cf), NULL };
+ static const const conv_ds_t *ds_cfnp[] = {
+ CONV_DS_ADDR(ds_shn_cfnp), NULL };
+ static const const conv_ds_t *ds_nf[] = {
+ CONV_DS_ADDR(ds_shn_nf), NULL };
- if (bind >= STB_NUM)
- return (conv_invalid_val(inv_buf, bind, fmt_flags));
+ /* Select the strings to use */
+ switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
+ case CONV_FMT_ALT_CF:
+ return (ds_cf);
+ case CONV_FMT_ALT_CFNP:
+ return (ds_cfnp);
+ case CONV_FMT_ALT_NF:
+ return (ds_nf);
+ }
- /* If full ELF names are desired, use those strings */
- if (CONV_TYPE_FMT_ALT(fmt_flags) == CONV_FMT_ALT_FULLNAME)
- return (MSG_ORIG(binds_alt[bind]));
+ return (ds_def);
- /* Default strings */
- return (MSG_ORIG(binds[bind]));
+#undef ALL
+#undef SOL
+#undef AMD
}
const char *
-conv_sym_shndx(Half shndx, Conv_inv_buf_t *inv_buf)
+conv_sym_shndx(uchar_t osabi, Half mach, Half shndx, Conv_fmt_flags_t fmt_flags,
+ Conv_inv_buf_t *inv_buf)
{
- switch (shndx) {
- case SHN_UNDEF:
- return (MSG_ORIG(MSG_SHN_UNDEF));
- case SHN_SUNW_IGNORE:
- return (MSG_ORIG(MSG_SHN_SUNW_IGNORE));
- case SHN_ABS:
- return (MSG_ORIG(MSG_SHN_ABS));
- case SHN_COMMON:
- return (MSG_ORIG(MSG_SHN_COMMON));
- case SHN_AMD64_LCOMMON:
- return (MSG_ORIG(MSG_SHN_AMD64_LCOMMON));
- case SHN_AFTER:
- return (MSG_ORIG(MSG_SHN_AFTER));
- case SHN_BEFORE:
- return (MSG_ORIG(MSG_SHN_BEFORE));
- case SHN_XINDEX:
- return (MSG_ORIG(MSG_SHN_XINDEX));
- default:
- return (conv_invalid_val(inv_buf, shndx, CONV_FMT_DECIMAL));
- }
+ return (conv_map_ds(osabi, mach, shndx,
+ conv_sym_shndx_strings(fmt_flags), fmt_flags, inv_buf));
}
-const char *
-conv_sym_value(Half mach, uchar_t type, Addr value, Conv_inv_buf_t *inv_buf)
+conv_iter_ret_t
+conv_iter_sym_shndx(conv_iter_osabi_t osabi, Half mach,
+ Conv_fmt_flags_t fmt_flags, conv_iter_cb_t func, void *uvalue)
{
- if (((mach == EM_SPARC) || (mach == EM_SPARC32PLUS) ||
- (mach == EM_SPARCV9)) && (type == STT_SPARC_REGISTER))
- return (conv_sym_SPARC_value(value, 0, inv_buf));
+ static const Msg amd64_alias_cf[] = { MSG_SHN_X86_64_LCOMMON_CF };
+ static const conv_ds_msg_t ds_msg_amd64_alias_cf = {
+ CONV_DS_MSG_INIT(SHN_X86_64_LCOMMON, amd64_alias_cf) };
+ static const conv_ds_t *ds_amd64_alias_cf[] = {
+ CONV_DS_ADDR(ds_msg_amd64_alias_cf), NULL };
- (void) snprintf(inv_buf->buf, sizeof (inv_buf->buf),
- MSG_ORIG(MSG_SYM_FMT_VAL), EC_ADDR(value));
- return (inv_buf->buf);
+ static const Msg amd64_alias_cfnp[] = { MSG_SHN_X86_64_LCOMMON_CFNP };
+ static const conv_ds_msg_t ds_msg_amd64_alias_cfnp = {
+ CONV_DS_MSG_INIT(SHN_X86_64_LCOMMON, amd64_alias_cfnp) };
+ static const conv_ds_t *ds_amd64_alias_cfnp[] = {
+ CONV_DS_ADDR(ds_msg_amd64_alias_cfnp), NULL };
+
+ static const Msg amd64_alias_nf[] = { MSG_SHN_X86_64_LCOMMON_NF };
+ static const conv_ds_msg_t ds_msg_amd64_alias_nf = {
+ CONV_DS_MSG_INIT(SHN_X86_64_LCOMMON, amd64_alias_nf) };
+ static const conv_ds_t *ds_amd64_alias_nf[] = {
+ CONV_DS_ADDR(ds_msg_amd64_alias_nf), NULL };
+
+
+ if (conv_iter_ds(osabi, mach, conv_sym_shndx_strings(fmt_flags),
+ func, uvalue) == CONV_ITER_DONE)
+ return (CONV_ITER_DONE);
+
+ /*
+ * SHN_AMD64_LCOMMON is also known as SHN_X86_64_LCOMMON
+ */
+ if (mach == EM_AMD64) {
+ const conv_ds_t **ds;
+
+ switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
+ case CONV_FMT_ALT_CF:
+ ds = ds_amd64_alias_cf;
+ break;
+ case CONV_FMT_ALT_NF:
+ ds = ds_amd64_alias_nf;
+ break;
+ default:
+ ds = ds_amd64_alias_cfnp;
+ break;
+ }
+ return (conv_iter_ds(ELFOSABI_NONE, mach, ds, func, uvalue));
+ }
+
+ return (CONV_ITER_CONT);
}
diff --git a/usr/src/cmd/sgs/libconv/common/symbols.msg b/usr/src/cmd/sgs/libconv/common/symbols.msg
index f14a159d69..7af17b2a36 100644
--- a/usr/src/cmd/sgs/libconv/common/symbols.msg
+++ b/usr/src/cmd/sgs/libconv/common/symbols.msg
@@ -23,55 +23,95 @@
# Use is subject to license terms.
#
-@ MSG_STT_NOTYPE "NOTY"
-@ MSG_STT_NOTYPE_ALT "STT_NOTYPE"
-@ MSG_STT_OBJECT "OBJT"
-@ MSG_STT_OBJECT_ALT "STT_OBJECT"
-@ MSG_STT_FUNC "FUNC"
-@ MSG_STT_FUNC_ALT "STT_FUNC"
-@ MSG_STT_SECTION "SECT"
-@ MSG_STT_SECTION_ALT "STT_SECTION"
-@ MSG_STT_FILE "FILE"
-@ MSG_STT_FILE_ALT "STT_FILE"
-@ MSG_STT_COMMON "COMM"
-@ MSG_STT_COMMON_ALT "STT_COMMON"
-@ MSG_STT_TLS "TLS"
-@ MSG_STT_TLS_ALT "STT_TLS"
-@ MSG_STT_IFUNC "IFUNC"
-@ MSG_STT_IFUNC_ALT "STT_IFUNC"
-@ MSG_STT_SPARC_REGISTER "REGI"
-@ MSG_STT_SPARC_REGISTER_ALT "STT_SPARC_REGISTER"
+@ MSG_STT_NOTYPE_CF "STT_NOTYPE" # 0
+@ MSG_STT_NOTYPE_NF "notype"
+@ MSG_STT_NOTYPE_DEF "NOTY"
+@ MSG_STT_OBJECT_CF "STT_OBJECT" # 1
+@ MSG_STT_OBJECT_NF "object"
+@ MSG_STT_OBJECT_DEF "OBJT"
+@ MSG_STT_FUNC_CF "STT_FUNC" # 2
+@ MSG_STT_FUNC_NF "func"
+@ MSG_STT_FUNC_DEF "FUNC"
+@ MSG_STT_SECTION_CF "STT_SECTION" # 3
+@ MSG_STT_SECTION_NF "section"
+@ MSG_STT_SECTION_DEF "SECT"
+@ MSG_STT_FILE_CF "STT_FILE" # 4
+@ MSG_STT_FILE_NF "file"
+@ MSG_STT_FILE_DEF "FILE"
+@ MSG_STT_COMMON_CF "STT_COMMON" # 5
+@ MSG_STT_COMMON_NF "common"
+@ MSG_STT_COMMON_DEF "COMM"
+@ MSG_STT_TLS_CF "STT_TLS" # 6
+@ MSG_STT_TLS_NF "tls"
+@ MSG_STT_TLS_DEF "TLS "
+@ MSG_STT_IFUNC_CF "STT_IFUNC" # 6
+@ MSG_STT_IFUNC_NF "ifunc"
+@ MSG_STT_IFUNC_DEF "IFNC"
+@ MSG_STT_SPARC_REGISTER_CF "STT_SPARC_REGISTER" #13
+@ MSG_STT_SPARC_REGISTER_NF "sparc_register"
+@ MSG_STT_SPARC_REGISTER_DEF "REGI"
-@ MSG_STB_LOCAL "LOCL"
-@ MSG_STB_LOCAL_ALT "STB_LOCAL"
-@ MSG_STB_GLOBAL "GLOB"
-@ MSG_STB_GLOBAL_ALT "STB_GLOBAL"
-@ MSG_STB_WEAK "WEAK"
-@ MSG_STB_WEAK_ALT "STB_WEAK"
+@ MSG_STB_LOCAL_CF "STB_LOCAL" # 0
+@ MSG_STB_LOCAL_NF "local"
+@ MSG_STB_LOCAL_DEF "LOCL"
+@ MSG_STB_GLOBAL_CF "STB_GLOBAL" # 1
+@ MSG_STB_GLOBAL_NF "global"
+@ MSG_STB_GLOBAL_DEF "GLOB"
+@ MSG_STB_WEAK_CF "STB_WEAK" # 2
+@ MSG_STB_WEAK_NF "weak"
+@ MSG_STB_WEAK_DEF "WEAK"
-@ MSG_STV_DEFAULT "D"
-@ MSG_STV_DEFAULT_ALT "STV_DEFAULT"
-@ MSG_STV_INTERNAL "I"
-@ MSG_STV_INTERNAL_ALT "STV_INTERNAL"
-@ MSG_STV_HIDDEN "H"
-@ MSG_STV_HIDDEN_ALT "STV_HIDDEN"
-@ MSG_STV_PROTECTED "P"
-@ MSG_STV_PROTECTED_ALT "STV_PROTECTED"
-@ MSG_STV_EXPORTED "X"
-@ MSG_STV_EXPORTED_ALT "STV_EXPORTED"
-@ MSG_STV_SINGLETON "S"
-@ MSG_STV_SINGLETON_ALT "STV_SINGLETON"
-@ MSG_STV_ELIMINATE "E"
-@ MSG_STV_ELIMINATE_ALT "STV_ELIMINATE"
+@ MSG_STV_DEFAULT_CF "STV_DEFAULT" # 0
+@ MSG_STV_DEFAULT_NF "default"
+@ MSG_STV_DEFAULT_DEF "D"
+@ MSG_STV_INTERNAL_CF "STV_INTERNAL" # 1
+@ MSG_STV_INTERNAL_NF "internal"
+@ MSG_STV_INTERNAL_DEF "I"
+@ MSG_STV_HIDDEN_CF "STV_HIDDEN" # 2
+@ MSG_STV_HIDDEN_NF "hidden"
+@ MSG_STV_HIDDEN_DEF "H"
+@ MSG_STV_PROTECTED_CF "STV_PROTECTED" # 3
+@ MSG_STV_PROTECTED_NF "protected"
+@ MSG_STV_PROTECTED_DEF "P"
+@ MSG_STV_EXPORTED_CF "STV_EXPORTED" # 4
+@ MSG_STV_EXPORTED_NF "exported"
+@ MSG_STV_EXPORTED_DEF "X"
+@ MSG_STV_SINGLETON_CF "STV_SINGLETON" # 5
+@ MSG_STV_SINGLETON_NF "singleton"
+@ MSG_STV_SINGLETON_DEF "S"
+@ MSG_STV_ELIMINATE_CF "STV_ELIMINATE" # 6
+@ MSG_STV_ELIMINATE_NF "eliminate"
+@ MSG_STV_ELIMINATE_DEF "E"
-@ MSG_SHN_UNDEF "UNDEF"
-@ MSG_SHN_SUNW_IGNORE "IGNORE"
-@ MSG_SHN_ABS "ABS"
-@ MSG_SHN_COMMON "COMMON"
-@ MSG_SHN_AMD64_LCOMMON "LCOMMON"
-@ MSG_SHN_AFTER "AFTER"
-@ MSG_SHN_BEFORE "BEFORE"
-@ MSG_SHN_XINDEX "XINDEX"
+@ MSG_SHN_UNDEF_CF "SHN_UNDEF" # 0
+@ MSG_SHN_UNDEF_CFNP "UNDEF"
+@ MSG_SHN_UNDEF_NF "undef"
+@ MSG_SHN_BEFORE_CF "SHN_BEFORE" # 0xff00
+@ MSG_SHN_BEFORE_CFNP "BEFORE"
+@ MSG_SHN_BEFORE_NF "before"
+@ MSG_SHN_AFTER_CF "SHN_AFTER" # 0xff01
+@ MSG_SHN_AFTER_CFNP "AFTER"
+@ MSG_SHN_AFTER_NF "after"
+@ MSG_SHN_AMD64_LCOMMON_CF "SHN_AMD64_LCOMMON" # 0xff02
+@ MSG_SHN_AMD64_LCOMMON_CFNP "AMD64_LCOMMON"
+@ MSG_SHN_AMD64_LCOMMON_NF "amd64_lcommon"
+@ MSG_SHN_AMD64_LCOMMON_DEF "LCOMMON"
+@ MSG_SHN_X86_64_LCOMMON_CF "SHN_X86_64_LCOMMON" # Alias: SHN_AMD64_LCOMMON
+@ MSG_SHN_X86_64_LCOMMON_CFNP "X86_64_LCOMMON"
+@ MSG_SHN_X86_64_LCOMMON_NF "x86_64_lcommon"
+@ MSG_SHN_SUNW_IGNORE_CF "SHN_SUNW_IGNORE" # 0xff3f
+@ MSG_SHN_SUNW_IGNORE_CFNP "SUNW_IGNORE"
+@ MSG_SHN_SUNW_IGNORE_NF "sunw_ignore"
+@ MSG_SHN_SUNW_IGNORE_DEF "IGNORE"
+@ MSG_SHN_ABS_CF "SHN_ABS" # 0xfff1
+@ MSG_SHN_ABS_CFNP "ABS"
+@ MSG_SHN_ABS_NF "abs"
+@ MSG_SHN_COMMON_CF "SHN_COMMON" # 0xfff2
+@ MSG_SHN_COMMON_CFNP "COMMON"
+@ MSG_SHN_COMMON_NF "common"
+@ MSG_SHN_XINDEX_CF "SHN_XINDEX" # 0xffff
+@ MSG_SHN_XINDEX_CFNP "XINDEX"
+@ MSG_SHN_XINDEX_NF "xindex"
@ MSG_SYM_FMT_VAL_32 "0x%8.8llx"
@ MSG_SYM_FMT_VAL_64 "0x%16.16llx"
diff --git a/usr/src/cmd/sgs/libconv/common/symbols_machelf.c b/usr/src/cmd/sgs/libconv/common/symbols_machelf.c
new file mode 100644
index 0000000000..d09c00df9c
--- /dev/null
+++ b/usr/src/cmd/sgs/libconv/common/symbols_machelf.c
@@ -0,0 +1,47 @@
+/*
+ * 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
+ * or http://www.opensolaris.org/os/licensing.
+ * 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.
+ */
+
+/*
+ * String conversion routines for symbol attributes.
+ */
+#include <stdio.h>
+#include <_machelf.h>
+#include <sys/elf_SPARC.h>
+#include <sys/elf_amd64.h>
+#include "_conv.h"
+#include "symbols_msg.h"
+
+const char *
+conv_sym_value(Half mach, uchar_t type, Addr value, Conv_inv_buf_t *inv_buf)
+{
+ if (((mach == EM_SPARC) || (mach == EM_SPARC32PLUS) ||
+ (mach == EM_SPARCV9)) && (type == STT_SPARC_REGISTER))
+ return (conv_sym_SPARC_value(value, 0, inv_buf));
+
+ (void) snprintf(inv_buf->buf, sizeof (inv_buf->buf),
+ MSG_ORIG(MSG_SYM_FMT_VAL), EC_ADDR(value));
+ return (inv_buf->buf);
+}
diff --git a/usr/src/cmd/sgs/libconv/common/symbols_sparc_machelf.c b/usr/src/cmd/sgs/libconv/common/symbols_sparc_machelf.c
new file mode 100644
index 0000000000..ad3480bec9
--- /dev/null
+++ b/usr/src/cmd/sgs/libconv/common/symbols_sparc_machelf.c
@@ -0,0 +1,51 @@
+/*
+ * 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
+ * or http://www.opensolaris.org/os/licensing.
+ * 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.
+ */
+
+#include <stdio.h>
+#include "_conv.h"
+#include "symbols_sparc_msg.h"
+#include <sys/elf_SPARC.h>
+
+/*
+ * SPARC specific register symbols
+ */
+
+static const Msg registers[] = { 0,
+ MSG_STO_REGISTERG1, MSG_STO_REGISTERG2, MSG_STO_REGISTERG3,
+ MSG_STO_REGISTERG4, MSG_STO_REGISTERG5, MSG_STO_REGISTERG6,
+ MSG_STO_REGISTERG7
+};
+
+const char *
+conv_sym_SPARC_value(Addr val, Conv_fmt_flags_t fmt_flags,
+ Conv_inv_buf_t *inv_buf)
+{
+ if ((val < STO_SPARC_REGISTER_G1) || (val > STO_SPARC_REGISTER_G7)) {
+ return (conv_invalid_val(inv_buf, val, fmt_flags));
+ } else {
+ return (MSG_ORIG(registers[val]));
+ }
+}
diff --git a/usr/src/cmd/sgs/libconv/common/syminfo.c b/usr/src/cmd/sgs/libconv/common/syminfo.c
index 0a7b561b41..9ae4114f7f 100644
--- a/usr/src/cmd/sgs/libconv/common/syminfo.c
+++ b/usr/src/cmd/sgs/libconv/common/syminfo.c
@@ -20,10 +20,9 @@
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
/*
* String conversion routines for syminfo attributes.
@@ -35,45 +34,87 @@
+static const Val_desc *
+conv_syminfo_flags_strings(Conv_fmt_flags_t fmt_flags)
+{
#define FLAGSZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
- MSG_SYMINFO_FLG_DIRECT_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- MSG_SYMINFO_FLG_COPY_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- MSG_SYMINFO_FLG_LAZYLOAD_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
- MSG_SYMINFO_FLG_DIRECTBIND_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_SYMINFO_FLG_DIRECT_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_SYMINFO_FLG_FILTER_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_SYMINFO_FLG_COPY_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_SYMINFO_FLG_LAZYLOAD_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_SYMINFO_FLG_DIRECTBIND_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_SYMINFO_FLG_NOEXTDIRECT_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_SYMINFO_FLG_AUXILIARY_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_SYMINFO_FLG_INTERPOSE_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
CONV_INV_BUFSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
-/*
- * Ensure that Conv_syminfo_flags_buf_t is large enough:
- *
- * FLAGSZ is the real minimum size of the buffer required by
- * conv_syminfo_flags(). However, Conv_syminfo_flags_buf_t uses
- * CONV_SYMINFO_FLAGS_BUFSIZE to set the buffer size. We do things
- * this way because the definition of FLAGSZ uses information that
- * is not available in the environment of other programs that include
- * the conv.h header file.
- */
+ /*
+ * Ensure that Conv_syminfo_flags_buf_t is large enough:
+ *
+ * FLAGSZ is the real minimum size of the buffer required by
+ * conv_syminfo_flags(). However, Conv_syminfo_flags_buf_t uses
+ * CONV_SYMINFO_FLAGS_BUFSIZE to set the buffer size. We do things
+ * this way because the definition of FLAGSZ uses information that
+ * is not available in the environment of other programs that include
+ * the conv.h header file.
+ */
#if (CONV_SYMINFO_FLAGS_BUFSIZE != FLAGSZ) && !defined(__lint)
#define REPORT_BUFSIZE FLAGSZ
#include "report_bufsize.h"
#error "CONV_SYMINFO_FLAGS_BUFSIZE does not match FLAGSZ"
#endif
+ static const Val_desc vda_cf[] = {
+ { SYMINFO_FLG_DIRECT, MSG_SYMINFO_FLG_DIRECT_CF },
+ { SYMINFO_FLG_FILTER, MSG_SYMINFO_FLG_FILTER_CF },
+ { SYMINFO_FLG_COPY, MSG_SYMINFO_FLG_COPY_CF },
+ { SYMINFO_FLG_LAZYLOAD, MSG_SYMINFO_FLG_LAZYLOAD_CF },
+ { SYMINFO_FLG_DIRECTBIND, MSG_SYMINFO_FLG_DIRECTBIND_CF },
+ { SYMINFO_FLG_NOEXTDIRECT, MSG_SYMINFO_FLG_NOEXTDIRECT_CF },
+ { SYMINFO_FLG_AUXILIARY, MSG_SYMINFO_FLG_AUXILIARY_CF },
+ { SYMINFO_FLG_INTERPOSE, MSG_SYMINFO_FLG_INTERPOSE_CF },
+ { 0 }
+ };
+ static const Val_desc vda_cfnp[] = {
+ { SYMINFO_FLG_DIRECT, MSG_SYMINFO_FLG_DIRECT_CFNP },
+ { SYMINFO_FLG_FILTER, MSG_SYMINFO_FLG_FILTER_CFNP },
+ { SYMINFO_FLG_COPY, MSG_SYMINFO_FLG_COPY_CFNP },
+ { SYMINFO_FLG_LAZYLOAD, MSG_SYMINFO_FLG_LAZYLOAD_CFNP },
+ { SYMINFO_FLG_DIRECTBIND, MSG_SYMINFO_FLG_DIRECTBIND_CFNP },
+ { SYMINFO_FLG_NOEXTDIRECT, MSG_SYMINFO_FLG_NOEXTDIRECT_CFNP },
+ { SYMINFO_FLG_AUXILIARY, MSG_SYMINFO_FLG_AUXILIARY_CFNP },
+ { SYMINFO_FLG_INTERPOSE, MSG_SYMINFO_FLG_INTERPOSE_CFNP },
+ { 0 }
+ };
+ static const Val_desc vda_nf[] = {
+ { SYMINFO_FLG_DIRECT, MSG_SYMINFO_FLG_DIRECT_NF },
+ { SYMINFO_FLG_FILTER, MSG_SYMINFO_FLG_FILTER_NF },
+ { SYMINFO_FLG_COPY, MSG_SYMINFO_FLG_COPY_NF },
+ { SYMINFO_FLG_LAZYLOAD, MSG_SYMINFO_FLG_LAZYLOAD_NF },
+ { SYMINFO_FLG_DIRECTBIND, MSG_SYMINFO_FLG_DIRECTBIND_NF },
+ { SYMINFO_FLG_NOEXTDIRECT, MSG_SYMINFO_FLG_NOEXTDIRECT_NF },
+ { SYMINFO_FLG_AUXILIARY, MSG_SYMINFO_FLG_AUXILIARY_NF },
+ { SYMINFO_FLG_INTERPOSE, MSG_SYMINFO_FLG_INTERPOSE_NF },
+ { 0 }
+ };
+
+ switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
+ case CONV_FMT_ALT_CF:
+ return (vda_cf);
+ case CONV_FMT_ALT_NF:
+ return (vda_nf);
+ }
+
+ return (vda_cfnp);
+}
+
+
const char *
-conv_syminfo_flags(Xword flags, Conv_fmt_flags_t fmt_flags,
+conv_syminfo_flags(Half flags, Conv_fmt_flags_t fmt_flags,
Conv_syminfo_flags_buf_t *syminfo_flags_buf)
{
- static Val_desc vda[] = {
- { SYMINFO_FLG_DIRECT, MSG_ORIG(MSG_SYMINFO_FLG_DIRECT) },
- { SYMINFO_FLG_COPY, MSG_ORIG(MSG_SYMINFO_FLG_COPY) },
- { SYMINFO_FLG_LAZYLOAD, MSG_ORIG(MSG_SYMINFO_FLG_LAZYLOAD) },
- { SYMINFO_FLG_DIRECTBIND,
- MSG_ORIG(MSG_SYMINFO_FLG_DIRECTBIND) },
- { SYMINFO_FLG_NOEXTDIRECT,
- MSG_ORIG(MSG_SYMINFO_FLG_NOEXTDIRECT) },
- { 0, 0 }
- };
static CONV_EXPN_FIELD_ARG conv_arg = {
- NULL, sizeof (syminfo_flags_buf->buf), vda };
+ NULL, sizeof (syminfo_flags_buf->buf) };
if (flags == 0)
return (MSG_ORIG(MSG_GBL_ZERO));
@@ -81,7 +122,74 @@ conv_syminfo_flags(Xword flags, Conv_fmt_flags_t fmt_flags,
conv_arg.buf = syminfo_flags_buf->buf;
conv_arg.oflags = conv_arg.rflags = flags;
conv_arg.prefix = conv_arg.suffix = NULL;
- (void) conv_expn_field(&conv_arg, fmt_flags);
+ (void) conv_expn_field(&conv_arg,
+ conv_syminfo_flags_strings(fmt_flags), fmt_flags);
return ((const char *)syminfo_flags_buf->buf);
}
+
+conv_iter_ret_t
+conv_iter_syminfo_flags(Conv_fmt_flags_t fmt_flags, conv_iter_cb_t func,
+ void *uvalue)
+{
+ return (conv_iter_vd(conv_syminfo_flags_strings(fmt_flags),
+ func, uvalue));
+}
+
+
+static const conv_ds_t **
+conv_syminfo_boundto_strings(Conv_fmt_flags_t fmt_flags)
+{
+ static const Msg boundto_cf[] = {
+ MSG_SYMINFO_BT_EXTERN_CF, MSG_SYMINFO_BT_NONE_CF,
+ MSG_SYMINFO_BT_PARENT_CF, MSG_SYMINFO_BT_SELF_CF
+ };
+ static const Msg boundto_cfnp[] = {
+ MSG_SYMINFO_BT_EXTERN_CFNP, MSG_SYMINFO_BT_NONE_CFNP,
+ MSG_SYMINFO_BT_PARENT_CFNP, MSG_SYMINFO_BT_SELF_CFNP
+ };
+ static const Msg boundto_nf[] = {
+ MSG_SYMINFO_BT_EXTERN_NF, MSG_SYMINFO_BT_NONE_NF,
+ MSG_SYMINFO_BT_PARENT_NF, MSG_SYMINFO_BT_SELF_NF
+ };
+ static const conv_ds_msg_t ds_boundto_cf = {
+ CONV_DS_MSG_INIT(SYMINFO_BT_EXTERN, boundto_cf) };
+ static const conv_ds_msg_t ds_boundto_cfnp = {
+ CONV_DS_MSG_INIT(SYMINFO_BT_EXTERN, boundto_cfnp) };
+ static const conv_ds_msg_t ds_boundto_nf = {
+ CONV_DS_MSG_INIT(SYMINFO_BT_EXTERN, boundto_nf) };
+
+ /* Build NULL terminated return arrays for each string style */
+ static const const conv_ds_t *ds_cf[] = {
+ CONV_DS_ADDR(ds_boundto_cf), NULL };
+ static const const conv_ds_t *ds_cfnp[] = {
+ CONV_DS_ADDR(ds_boundto_cfnp), NULL };
+ static const const conv_ds_t *ds_nf[] = {
+ CONV_DS_ADDR(ds_boundto_nf), NULL };
+
+ /* Select the strings to use */
+ switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
+ case CONV_FMT_ALT_CF:
+ return (ds_cf);
+ case CONV_FMT_ALT_NF:
+ return (ds_nf);
+ }
+
+ return (ds_cfnp);
+}
+
+const char *
+conv_syminfo_boundto(Half value, Conv_fmt_flags_t fmt_flags,
+ Conv_inv_buf_t *inv_buf)
+{
+ return (conv_map_ds(ELFOSABI_NONE, EM_NONE, value,
+ conv_syminfo_boundto_strings(fmt_flags), fmt_flags, inv_buf));
+}
+
+conv_iter_ret_t
+conv_iter_syminfo_boundto(Conv_fmt_flags_t fmt_flags, conv_iter_cb_t func,
+ void *uvalue)
+{
+ return (conv_iter_ds(ELFOSABI_NONE, EM_NONE,
+ conv_syminfo_boundto_strings(fmt_flags), func, uvalue));
+}
diff --git a/usr/src/cmd/sgs/libconv/common/syminfo.msg b/usr/src/cmd/sgs/libconv/common/syminfo.msg
index b5ccd09db4..1d3d53d65f 100644
--- a/usr/src/cmd/sgs/libconv/common/syminfo.msg
+++ b/usr/src/cmd/sgs/libconv/common/syminfo.msg
@@ -19,16 +19,47 @@
# CDDL HEADER END
#
-# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
-#
-@ MSG_SYMINFO_FLG_DIRECT "DIRECT"
-@ MSG_SYMINFO_FLG_COPY "COPY"
-@ MSG_SYMINFO_FLG_LAZYLOAD "LAZYLOAD"
-@ MSG_SYMINFO_FLG_DIRECTBIND "DIRECTBIND"
-@ MSG_SYMINFO_FLG_NOEXTDIRECT "NOEXTDIRECT"
+@ MSG_SYMINFO_FLG_DIRECT_CF "SYMINFO_FLG_DIRECT" # 0x01
+@ MSG_SYMINFO_FLG_DIRECT_CFNP "DIRECT"
+@ MSG_SYMINFO_FLG_DIRECT_NF "direct"
+@ MSG_SYMINFO_FLG_FILTER_CF "SYMINFO_FLG_FILTER" # 0x02
+@ MSG_SYMINFO_FLG_FILTER_CFNP "FILTER"
+@ MSG_SYMINFO_FLG_FILTER_NF "filter"
+@ MSG_SYMINFO_FLG_COPY_CF "SYMINFO_FLG_COPY" # 0x04
+@ MSG_SYMINFO_FLG_COPY_CFNP "COPY"
+@ MSG_SYMINFO_FLG_COPY_NF "copy"
+@ MSG_SYMINFO_FLG_LAZYLOAD_CF "SYMINFO_FLG_LAZYLOAD" # 0x08
+@ MSG_SYMINFO_FLG_LAZYLOAD_CFNP "LAZYLOAD"
+@ MSG_SYMINFO_FLG_LAZYLOAD_NF "lazyload"
+@ MSG_SYMINFO_FLG_DIRECTBIND_CF "SYMINFO_FLG_DIRECTBIND" # 0x10
+@ MSG_SYMINFO_FLG_DIRECTBIND_CFNP "DIRECTBIND"
+@ MSG_SYMINFO_FLG_DIRECTBIND_NF "directbind"
+@ MSG_SYMINFO_FLG_NOEXTDIRECT_CF "SYMINFO_FLG_NOEXTDIRECT" # 0x20
+@ MSG_SYMINFO_FLG_NOEXTDIRECT_CFNP "NOEXTDIRECT"
+@ MSG_SYMINFO_FLG_NOEXTDIRECT_NF "noextdirect"
+@ MSG_SYMINFO_FLG_AUXILIARY_CF "SYMINFO_FLG_AUXILIARY" # 0x40
+@ MSG_SYMINFO_FLG_AUXILIARY_CFNP "AUXILIARY"
+@ MSG_SYMINFO_FLG_AUXILIARY_NF "auxiliary"
+@ MSG_SYMINFO_FLG_INTERPOSE_CF "SYMINFO_FLG_INTERPOSE" # 0x80
+@ MSG_SYMINFO_FLG_INTERPOSE_CFNP "INTERPOSE"
+@ MSG_SYMINFO_FLG_INTERPOSE_NF "interpose"
+
+@ MSG_SYMINFO_BT_EXTERN_CF "SYMINFO_BT_EXTERN" # 0xfffc
+@ MSG_SYMINFO_BT_EXTERN_CFNP "EXTERN"
+@ MSG_SYMINFO_BT_EXTERN_NF "extern"
+@ MSG_SYMINFO_BT_NONE_CF "SYMINFO_BT_NONE" # 0xfffd
+@ MSG_SYMINFO_BT_NONE_CFNP "NONE"
+@ MSG_SYMINFO_BT_NONE_NF "none"
+@ MSG_SYMINFO_BT_PARENT_CF "SYMINFO_BT_PARENT" # 0xfffe
+@ MSG_SYMINFO_BT_PARENT_CFNP "PARENT"
+@ MSG_SYMINFO_BT_PARENT_NF "parent"
+@ MSG_SYMINFO_BT_SELF_CF "SYMINFO_BT_SELF" # 0xffff
+@ MSG_SYMINFO_BT_SELF_CFNP "SELF"
+@ MSG_SYMINFO_BT_SELF_NF "self"
+
@ MSG_GBL_ZERO "0"
diff --git a/usr/src/cmd/sgs/libconv/common/version.c b/usr/src/cmd/sgs/libconv/common/version.c
index 087bfe6951..9719f88565 100644
--- a/usr/src/cmd/sgs/libconv/common/version.c
+++ b/usr/src/cmd/sgs/libconv/common/version.c
@@ -20,7 +20,7 @@
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -56,21 +56,21 @@ const char *
conv_ver_flags(Half flags, Conv_fmt_flags_t fmt_flags,
Conv_ver_flags_buf_t *ver_flags_buf)
{
- static Val_desc vda[] = {
- { VER_FLG_WEAK, MSG_ORIG(MSG_VER_FLG_WEAK) },
- { VER_FLG_BASE, MSG_ORIG(MSG_VER_FLG_BASE) },
- { VER_FLG_INFO, MSG_ORIG(MSG_VER_FLG_INFO) },
+ static const Val_desc vda[] = {
+ { VER_FLG_WEAK, MSG_VER_FLG_WEAK },
+ { VER_FLG_BASE, MSG_VER_FLG_BASE },
+ { VER_FLG_INFO, MSG_VER_FLG_INFO },
{ 0, 0 }
};
static CONV_EXPN_FIELD_ARG conv_arg = {
- NULL, sizeof (ver_flags_buf->buf), vda };
+ NULL, sizeof (ver_flags_buf->buf) };
if (flags == 0)
return (MSG_ORIG(MSG_GBL_NULL));
conv_arg.buf = ver_flags_buf->buf;
conv_arg.oflags = conv_arg.rflags = flags;
- (void) conv_expn_field(&conv_arg, fmt_flags);
+ (void) conv_expn_field(&conv_arg, vda, fmt_flags);
return ((const char *)ver_flags_buf->buf);
}
diff --git a/usr/src/cmd/sgs/libld/common/files.c b/usr/src/cmd/sgs/libld/common/files.c
index 9e261a44d7..bf20e39b6c 100644
--- a/usr/src/cmd/sgs/libld/common/files.c
+++ b/usr/src/cmd/sgs/libld/common/files.c
@@ -543,8 +543,9 @@ invalid_section(const char *name, Ifl_desc *ifl, Shdr *shdr, Elf_Scn *scn,
Conv_inv_buf_t inv_buf;
eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_FIL_INVALSEC),
- ifl->ifl_name, name, conv_sec_type(ifl->ifl_ehdr->e_machine,
- shdr->sh_type, 0, &inv_buf));
+ ifl->ifl_name, name,
+ conv_sec_type(ifl->ifl_ehdr->e_ident[EI_OSABI],
+ ifl->ifl_ehdr->e_machine, shdr->sh_type, 0, &inv_buf));
return (1);
}
@@ -1393,8 +1394,8 @@ rel_process(Is_desc *isc, Ifl_desc *ifl, Ofl_desc *ofl)
if (shdr->sh_type != ld_targ.t_m.m_rel_sht_type) {
eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_FIL_INVALSEC),
ifl->ifl_name, isc->is_name,
- conv_sec_type(ifl->ifl_ehdr->e_machine,
- shdr->sh_type, 0, &inv_buf));
+ conv_sec_type(ifl->ifl_ehdr->e_ident[EI_OSABI],
+ ifl->ifl_ehdr->e_machine, shdr->sh_type, 0, &inv_buf));
ofl->ofl_flags |= FLG_OF_FATAL;
return (0);
}
@@ -1710,8 +1711,9 @@ process_elf(Ifl_desc *ifl, Elf *elf, Ofl_desc *ofl)
eprintf(ofl->ofl_lml, ERR_WARNING,
MSG_INTL(MSG_FIL_INVALSEC), ifl->ifl_name,
- name,
- conv_sec_type(ifl->ifl_ehdr->e_machine,
+ name, conv_sec_type(
+ ifl->ifl_ehdr->e_ident[EI_OSABI],
+ ifl->ifl_ehdr->e_machine,
shdr->sh_type, 0, &inv_buf));
}
diff --git a/usr/src/cmd/sgs/libld/common/ldmain.c b/usr/src/cmd/sgs/libld/common/ldmain.c
index 1b780e6747..bbdce65450 100644
--- a/usr/src/cmd/sgs/libld/common/ldmain.c
+++ b/usr/src/cmd/sgs/libld/common/ldmain.c
@@ -204,9 +204,11 @@ ld_main(int argc, char **argv, Half mach)
}
DBG_CALL(Dbg_util_nl(ofl->ofl_lml, DBG_NL_STD));
- DBG_CALL(Dbg_ent_print(ofl->ofl_lml, ofl->ofl_dehdr->e_machine,
+ DBG_CALL(Dbg_ent_print(ofl->ofl_lml,
+ ofl->ofl_dehdr->e_ident[EI_OSABI], ofl->ofl_dehdr->e_machine,
ofl->ofl_ents, (ofl->ofl_flags & FLG_OF_DYNAMIC) != 0));
- DBG_CALL(Dbg_seg_list(ofl->ofl_lml, ofl->ofl_dehdr->e_machine,
+ DBG_CALL(Dbg_seg_list(ofl->ofl_lml,
+ ofl->ofl_dehdr->e_ident[EI_OSABI], ofl->ofl_dehdr->e_machine,
ofl->ofl_segs));
/*
diff --git a/usr/src/cmd/sgs/libld/common/outfile.c b/usr/src/cmd/sgs/libld/common/outfile.c
index bdfc39c00a..8c51c8e1ef 100644
--- a/usr/src/cmd/sgs/libld/common/outfile.c
+++ b/usr/src/cmd/sgs/libld/common/outfile.c
@@ -432,6 +432,13 @@ ld_create_outfile(Ofl_desc *ofl)
* header table. If a segment is empty, ignore it.
*/
if (!(flags & FLG_OF_RELOBJ)) {
+ /*
+ * If the program header type belongs to the os range,
+ * the resulting object is ELFOSABI_SOLARIS.
+ */
+ if ((ptype >= PT_LOOS) && (ptype <= PT_HIOS))
+ ofl->ofl_flags |= FLG_OF_OSABI;
+
if (ptype == PT_PHDR) {
/*
* If we are generating an interp section (and
@@ -668,6 +675,16 @@ ld_create_outfile(Ofl_desc *ofl)
}
/*
+ * Did we use ELF features from the osabi range? If so,
+ * update the ELF header osabi fields. If this doesn't happen,
+ * those fields remain 0, reflecting a generic System V ELF ABI.
+ */
+ if (ofl->ofl_flags & FLG_OF_OSABI) {
+ ofl->ofl_nehdr->e_ident[EI_OSABI] = ELFOSABI_SOLARIS;
+ ofl->ofl_nehdr->e_ident[EI_ABIVERSION] = EAV_SUNW_CURRENT;
+ }
+
+ /*
* Build an empty PHDR.
*/
if (nseg) {
diff --git a/usr/src/cmd/sgs/libld/common/sections.c b/usr/src/cmd/sgs/libld/common/sections.c
index d0992cb472..fd4a58c880 100644
--- a/usr/src/cmd/sgs/libld/common/sections.c
+++ b/usr/src/cmd/sgs/libld/common/sections.c
@@ -455,7 +455,11 @@ new_section(Ofl_desc *ofl, Word shtype, const char *shname, Xword entcnt,
break;
case SHT_DYNSYM:
+ SET_SEC_INFO_WORD_ALIGN(ELF_T_SYM, SHF_ALLOC, sizeof (Sym))
+ break;
+
case SHT_SUNW_LDYNSYM:
+ ofl->ofl_flags |= FLG_OF_OSABI;
SET_SEC_INFO_WORD_ALIGN(ELF_T_SYM, SHF_ALLOC, sizeof (Sym))
break;
@@ -488,8 +492,12 @@ new_section(Ofl_desc *ofl, Word shtype, const char *shname, Xword entcnt,
break;
case SHT_HASH:
+ SET_SEC_INFO_WORD_ALIGN(ELF_T_WORD, SHF_ALLOC, sizeof (Word))
+ break;
+
case SHT_SUNW_symsort:
case SHT_SUNW_tlssort:
+ ofl->ofl_flags |= FLG_OF_OSABI;
SET_SEC_INFO_WORD_ALIGN(ELF_T_WORD, SHF_ALLOC, sizeof (Word))
break;
@@ -530,10 +538,12 @@ new_section(Ofl_desc *ofl, Word shtype, const char *shname, Xword entcnt,
break;
case SHT_SUNW_cap:
+ ofl->ofl_flags |= FLG_OF_OSABI;
SET_SEC_INFO_WORD_ALIGN(ELF_T_CAP, SHF_ALLOC, sizeof (Cap));
break;
case SHT_SUNW_move:
+ ofl->ofl_flags |= FLG_OF_OSABI;
/*
* The sh_info field of the SHT_*_syminfo section points
* to the header index of the associated .dynamic section,
@@ -544,6 +554,7 @@ new_section(Ofl_desc *ofl, Word shtype, const char *shname, Xword entcnt,
break;
case SHT_SUNW_syminfo:
+ ofl->ofl_flags |= FLG_OF_OSABI;
/*
* The sh_info field of the SHT_*_syminfo section points
* to the header index of the associated .dynamic section,
@@ -555,6 +566,7 @@ new_section(Ofl_desc *ofl, Word shtype, const char *shname, Xword entcnt,
case SHT_SUNW_verneed:
case SHT_SUNW_verdef:
+ ofl->ofl_flags |= FLG_OF_OSABI;
/*
* The info for verneed and versym happen to be the same.
* The entries in these sections are not of uniform size,
@@ -564,6 +576,7 @@ new_section(Ofl_desc *ofl, Word shtype, const char *shname, Xword entcnt,
break;
case SHT_SUNW_versym:
+ ofl->ofl_flags |= FLG_OF_OSABI;
SET_SEC_INFO_WORD_ALIGN(ELF_T_BYTE, SHF_ALLOC,
sizeof (Versym));
break;
@@ -1220,6 +1233,15 @@ make_dynamic(Ofl_desc *ofl)
shdr->sh_size = (Xword)size;
data->d_size = size;
+ /*
+ * There are several tags that are specific to the Solaris osabi
+ * range which we unconditionally put into any dynamic section
+ * we create (e.g. DT_SUNW_STRPAD or DT_SUNW_LDMACH). As such,
+ * any Solaris object with a dynamic section should be tagged as
+ * ELFOSABI_SOLARIS.
+ */
+ ofl->ofl_flags |= FLG_OF_OSABI;
+
return ((uintptr_t)ofl->ofl_osdynamic);
}
diff --git a/usr/src/cmd/sgs/libld/common/support.c b/usr/src/cmd/sgs/libld/common/support.c
index c661c78c2d..90517b4a60 100644
--- a/usr/src/cmd/sgs/libld/common/support.c
+++ b/usr/src/cmd/sgs/libld/common/support.c
@@ -290,6 +290,7 @@ ld_sup_input_section(Ofl_desc *ofl, Ifl_desc *ifl, const char *sname,
*/
if (nshdr != *oshdr) {
Dbg_shdr_modified(ofl->ofl_lml, flp->fl_obj,
+ ifl->ifl_ehdr->e_ident[EI_OSABI],
ifl->ifl_ehdr->e_machine, *oshdr, nshdr, sname);
*oshdr = nshdr;
}
diff --git a/usr/src/cmd/sgs/libld/common/syms.c b/usr/src/cmd/sgs/libld/common/syms.c
index c68e1bd8ae..6638dac5e6 100644
--- a/usr/src/cmd/sgs/libld/common/syms.c
+++ b/usr/src/cmd/sgs/libld/common/syms.c
@@ -155,7 +155,7 @@ demangle_symname(const char *name, const char *symtab_name, Word symndx)
len = strlen(name) + 2; /* Include room for quotes */
} else {
name = MSG_ORIG(MSG_STR_EMPTY);
- len = strlen(symtab_name) + 2 + CONV32_INV_BUFSIZE;
+ len = strlen(symtab_name) + 2 + CONV_INV_BUFSIZE;
}
len++; /* Null termination */
@@ -1815,6 +1815,8 @@ ld_sym_process(Is_desc *isc, Ifl_desc *ifl, Ofl_desc *ofl)
char *strs;
uchar_t type, bind;
Word ndx, hash, local, total;
+ uchar_t osabi = ifl->ifl_ehdr->e_ident[EI_OSABI];
+ Half mach = ifl->ifl_ehdr->e_machine;
Half etype = ifl->ifl_ehdr->e_type;
int etype_rel;
const char *symsecname, *strsecname;
@@ -1945,7 +1947,8 @@ ld_sym_process(Is_desc *isc, Ifl_desc *ifl, Ofl_desc *ofl)
MSG_INTL(MSG_SYM_INVSHNDX),
demangle_symname(name, isc->is_name, ndx),
ifl->ifl_name,
- conv_sym_shndx(sym->st_shndx, &inv_buf));
+ conv_sym_shndx(osabi, mach, sym->st_shndx,
+ CONV_FMT_DECIMAL, &inv_buf));
continue;
}
@@ -2070,7 +2073,8 @@ ld_sym_process(Is_desc *isc, Ifl_desc *ifl, Ofl_desc *ofl)
MSG_INTL(MSG_SYM_INVSHNDX),
demangle_symname(name, isc->is_name,
ndx), ifl->ifl_name,
- conv_sym_shndx(sym->st_shndx,
+ conv_sym_shndx(osabi, mach,
+ sym->st_shndx, CONV_FMT_DECIMAL,
&inv_buf));
}
continue;
@@ -2155,7 +2159,8 @@ ld_sym_process(Is_desc *isc, Ifl_desc *ifl, Ofl_desc *ofl)
MSG_INTL(MSG_SYM_INVSHNDX),
demangle_symname(name, isc->is_name, ndx),
ifl->ifl_name,
- conv_sym_shndx(sym->st_shndx, &inv_buf));
+ conv_sym_shndx(osabi, mach, sym->st_shndx,
+ CONV_FMT_DECIMAL, &inv_buf));
sdp->sd_isc = NULL;
sdp->sd_flags |= FLG_SY_INVALID;
continue;
@@ -2246,7 +2251,8 @@ ld_sym_process(Is_desc *isc, Ifl_desc *ifl, Ofl_desc *ofl)
MSG_INTL(MSG_SYM_INVSHNDX),
demangle_symname(name, isc->is_name, ndx),
ifl->ifl_name,
- conv_sym_shndx(sym->st_shndx, &inv_buf));
+ conv_sym_shndx(osabi, mach, sym->st_shndx,
+ CONV_FMT_DECIMAL, &inv_buf));
continue;
}
@@ -2314,7 +2320,8 @@ ld_sym_process(Is_desc *isc, Ifl_desc *ifl, Ofl_desc *ofl)
MSG_INTL(MSG_SYM_INVSHNDX),
demangle_symname(name, isc->is_name, ndx),
ifl->ifl_name,
- conv_sym_shndx(sym->st_shndx, &inv_buf));
+ conv_sym_shndx(osabi, mach, sym->st_shndx,
+ CONV_FMT_DECIMAL, &inv_buf));
continue;
}
diff --git a/usr/src/cmd/sgs/liblddbg/common/bindings.c b/usr/src/cmd/sgs/liblddbg/common/bindings.c
index 8ff05e1330..a79d6b0c04 100644
--- a/usr/src/cmd/sgs/liblddbg/common/bindings.c
+++ b/usr/src/cmd/sgs/liblddbg/common/bindings.c
@@ -20,7 +20,7 @@
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -83,17 +83,24 @@ Dbg_bind_global(Rt_map *flmp, Addr fabs, Off foff, Xword pltndx,
Pltbindtype pbtype, Rt_map *tlmp, Addr tabs, Off toff,
const char *sym, uint_t binfo)
{
+ /*
+ * MSG_ORIG(MSG_BINFO_DIRECT)
+ * MSG_ORIG(MSG_BINFO_INTERPOSE)
+ * MSG_ORIG(MSG_BINFO_COPYREF)
+ * MSG_ORIG(MSG_BINFO_FILTEE)
+ * MSG_ORIG(MSG_BINFO_PLTADDR)
+ */
static char binfostr[BINFOSZ];
static Val_desc vda[] = {
- { DBG_BINFO_DIRECT, MSG_ORIG(MSG_BINFO_DIRECT) },
- { DBG_BINFO_INTERPOSE, MSG_ORIG(MSG_BINFO_INTERPOSE) },
- { DBG_BINFO_COPYREF, MSG_ORIG(MSG_BINFO_COPYREF) },
- { DBG_BINFO_FILTEE, MSG_ORIG(MSG_BINFO_FILTEE) },
- { DBG_BINFO_PLTADDR, MSG_ORIG(MSG_BINFO_PLTADDR) },
+ { DBG_BINFO_DIRECT, MSG_BINFO_DIRECT },
+ { DBG_BINFO_INTERPOSE, MSG_BINFO_INTERPOSE },
+ { DBG_BINFO_COPYREF, MSG_BINFO_COPYREF },
+ { DBG_BINFO_FILTEE, MSG_BINFO_FILTEE },
+ { DBG_BINFO_PLTADDR, MSG_BINFO_PLTADDR },
{ 0, 0 }
};
static CONV_EXPN_FIELD_ARG conv_arg = { binfostr, sizeof (binfostr),
- vda, NULL, 0, 0, MSG_ORIG(MSG_BINFO_START),
+ NULL, 0, 0, MSG_ORIG(MSG_BINFO_START),
MSG_ORIG(MSG_BINFO_SEP), MSG_ORIG(MSG_BINFO_END) };
const char *ffile = NAME(flmp);
@@ -117,7 +124,7 @@ Dbg_bind_global(Rt_map *flmp, Addr fabs, Off foff, Xword pltndx,
binfo &= DBG_BINFO_MSK;
if (binfo) {
conv_arg.oflags = conv_arg.rflags = binfo;
- (void) conv_expn_field(&conv_arg, 0);
+ (void) conv_expn_field(&conv_arg, vda, 0);
} else {
binfostr[0] = '\0';
}
diff --git a/usr/src/cmd/sgs/liblddbg/common/cap.c b/usr/src/cmd/sgs/liblddbg/common/cap.c
index 96f1902d4e..7f9b0f451a 100644
--- a/usr/src/cmd/sgs/liblddbg/common/cap.c
+++ b/usr/src/cmd/sgs/liblddbg/common/cap.c
@@ -92,7 +92,7 @@ Dbg_cap_sec_entry(Lm_list *lml, uint_t type, Xword tag, Xword val, Half mach)
return;
dbg_print(lml, MSG_INTL(MSG_CAP_SEC_ENTRY), MSG_INTL(captype[type]),
- conv_cap_tag(tag, &inv_buf), conv_cap_val(tag, val, mach,
+ conv_cap_tag(tag, 0, &inv_buf), conv_cap_val(tag, val, mach,
&cap_val_buf));
}
@@ -121,6 +121,6 @@ Elf_cap_entry(Lm_list *lml, Cap *cap, int ndx, Half mach)
(void) snprintf(index, INDEX_STR_SIZE, MSG_ORIG(MSG_FMT_INDEX), ndx);
dbg_print(lml, MSG_INTL(MSG_CAP_ELF_ENTRY), index,
- conv_cap_tag(cap->c_tag, &inv_buf),
+ conv_cap_tag(cap->c_tag, 0, &inv_buf),
conv_cap_val(cap->c_tag, cap->c_un.c_val, mach, &cap_val_buf));
}
diff --git a/usr/src/cmd/sgs/liblddbg/common/dynamic.c b/usr/src/cmd/sgs/liblddbg/common/dynamic.c
index a42c0cb65a..c4789810e6 100644
--- a/usr/src/cmd/sgs/liblddbg/common/dynamic.c
+++ b/usr/src/cmd/sgs/liblddbg/common/dynamic.c
@@ -20,10 +20,9 @@
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
#include <sgs.h>
#include <stdio.h>
@@ -42,14 +41,15 @@ Elf_dyn_title(Lm_list *lml)
}
void
-Elf_dyn_entry(Lm_list *lml, Dyn *dyn, int ndx, const char *name, Half mach)
+Elf_dyn_entry(Lm_list *lml, Dyn *dyn, int ndx, const char *name,
+ uchar_t osabi, Half mach)
{
Conv_inv_buf_t inv_buf;
char index[INDEX_STR_SIZE];
(void) snprintf(index, sizeof (index), MSG_ORIG(MSG_FMT_INDEX), ndx);
dbg_print(lml, MSG_INTL(MSG_DYN_ENTRY), index,
- conv_dyn_tag(dyn->d_tag, mach, 0, &inv_buf),
+ conv_dyn_tag(dyn->d_tag, osabi, mach, 0, &inv_buf),
EC_XWORD(dyn->d_un.d_val), name);
}
@@ -65,12 +65,13 @@ Elf_dyn_null_entry(Lm_list *lml, Dyn *dyn, int start_ndx, int end_ndx)
char index[2 * INDEX_STR_SIZE];
if (start_ndx == end_ndx) {
- Elf_dyn_entry(lml, dyn, start_ndx, MSG_ORIG(MSG_STR_EMPTY), 0);
+ Elf_dyn_entry(lml, dyn, start_ndx, MSG_ORIG(MSG_STR_EMPTY),
+ ELFOSABI_NONE, 0);
} else {
(void) snprintf(index, sizeof (index),
MSG_ORIG(MSG_FMT_INDEX_RANGE), start_ndx, end_ndx);
dbg_print(lml, MSG_INTL(MSG_DYN_ENTRY), index,
- conv_dyn_tag(DT_NULL, 0, 0, &inv_buf),
+ conv_dyn_tag(DT_NULL, ELFOSABI_NONE, 0, 0, &inv_buf),
EC_XWORD(dyn->d_un.d_val), MSG_ORIG(MSG_STR_EMPTY));
}
}
diff --git a/usr/src/cmd/sgs/liblddbg/common/elf.c b/usr/src/cmd/sgs/liblddbg/common/elf.c
index 083a7ea80f..4a6ab74307 100644
--- a/usr/src/cmd/sgs/liblddbg/common/elf.c
+++ b/usr/src/cmd/sgs/liblddbg/common/elf.c
@@ -20,10 +20,9 @@
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
#include <sgs.h>
#include <_debug.h>
@@ -39,6 +38,8 @@ Elf_ehdr(Lm_list *lml, Ehdr *ehdr, Shdr *shdr0)
Byte *byte = &(ehdr->e_ident[0]);
const char *flgs;
int xshdr = 0;
+ uchar_t osabi = ehdr->e_ident[EI_OSABI];
+ Half mach = ehdr->e_machine;
dbg_print(lml, MSG_ORIG(MSG_STR_EMPTY));
dbg_print(lml, MSG_INTL(MSG_ELF_HEADER));
@@ -50,18 +51,22 @@ Elf_ehdr(Lm_list *lml, Ehdr *ehdr, Shdr *shdr0)
dbg_print(lml, MSG_ORIG(MSG_ELF_CLASS),
conv_ehdr_class(ehdr->e_ident[EI_CLASS], 0, &inv_buf1),
conv_ehdr_data(ehdr->e_ident[EI_DATA], 0, &inv_buf2));
+ dbg_print(lml, MSG_ORIG(MSG_ELF_OSABI),
+ conv_ehdr_osabi(ehdr->e_ident[EI_OSABI], 0, &inv_buf1),
+ conv_ehdr_abivers(ehdr->e_ident[EI_OSABI],
+ ehdr->e_ident[EI_ABIVERSION], CONV_FMT_DECIMAL, &inv_buf2));
dbg_print(lml, MSG_ORIG(MSG_ELF_MACHINE),
- conv_ehdr_mach(ehdr->e_machine, 0, &inv_buf1),
+ conv_ehdr_mach(mach, 0, &inv_buf1),
conv_ehdr_vers(ehdr->e_version, 0, &inv_buf2));
dbg_print(lml, MSG_ORIG(MSG_ELF_TYPE),
- conv_ehdr_type(ehdr->e_type, 0, &inv_buf1));
+ conv_ehdr_type(osabi, ehdr->e_type, 0, &inv_buf1));
/*
* Line up the flags differently depending on whether we received a
* numeric (e.g. "0x200") or text representation (e.g.
* "[ EF_SPARC_SUN_US1 ]").
*/
- flgs = conv_ehdr_flags(ehdr->e_machine, ehdr->e_flags, 0, &flags_buf);
+ flgs = conv_ehdr_flags(mach, ehdr->e_flags, 0, &flags_buf);
if (flgs[0] == '[')
dbg_print(lml, MSG_ORIG(MSG_ELF_FLAGS_FMT), flgs);
else
@@ -104,9 +109,9 @@ Elf_ehdr(Lm_list *lml, Ehdr *ehdr, Shdr *shdr0)
dbg_print(lml, MSG_ORIG(MSG_STR_EMPTY));
dbg_print(lml, MSG_ORIG(MSG_SHD0_TITLE));
dbg_print(lml, MSG_ORIG(MSG_SHD0_ADDR), EC_ADDR(shdr0->sh_addr),
- conv_sec_flags(shdr0->sh_flags, 0, &sec_flags_buf));
+ conv_sec_flags(osabi, mach, shdr0->sh_flags, 0, &sec_flags_buf));
dbg_print(lml, MSG_ORIG(MSG_SHD0_SIZE), EC_XWORD(shdr0->sh_size),
- conv_sec_type(ehdr->e_machine, shdr0->sh_type, 0, &inv_buf1));
+ conv_sec_type(osabi, mach, shdr0->sh_type, 0, &inv_buf1));
dbg_print(lml, MSG_ORIG(MSG_SHD0_OFFSET), EC_OFF(shdr0->sh_offset),
EC_XWORD(shdr0->sh_entsize));
dbg_print(lml, MSG_ORIG(MSG_SHD0_LINK), EC_WORD(shdr0->sh_link),
diff --git a/usr/src/cmd/sgs/liblddbg/common/entry.c b/usr/src/cmd/sgs/liblddbg/common/entry.c
index 03c47d94ec..763fe569ee 100644
--- a/usr/src/cmd/sgs/liblddbg/common/entry.c
+++ b/usr/src/cmd/sgs/liblddbg/common/entry.c
@@ -32,7 +32,7 @@
* Print out a single `entry descriptor' entry.
*/
void
-Dbg_ent_entry(Lm_list *lml, Half mach, Ent_desc *enp)
+Dbg_ent_entry(Lm_list *lml, uchar_t osabi, Half mach, Ent_desc *enp)
{
Conv_inv_buf_t inv_buf;
Conv_sec_flags_buf_t sec_flags_buf;
@@ -41,15 +41,15 @@ Dbg_ent_entry(Lm_list *lml, Half mach, Ent_desc *enp)
dbg_print(lml, MSG_ORIG(MSG_ECR_NAME),
(enp->ec_name ? enp->ec_name : MSG_INTL(MSG_STR_NULL)),
- conv_sec_flags(enp->ec_attrmask, 0, &sec_flags_buf));
+ conv_sec_flags(osabi, mach, enp->ec_attrmask, 0, &sec_flags_buf));
dbg_print(lml, MSG_ORIG(MSG_ECR_SEGMENT),
(enp->ec_segment->sg_name ? enp->ec_segment->sg_name :
MSG_INTL(MSG_STR_NULL)),
- conv_sec_flags(enp->ec_attrbits, 0, &sec_flags_buf));
+ conv_sec_flags(osabi, mach, enp->ec_attrbits, 0, &sec_flags_buf));
dbg_print(lml, MSG_ORIG(MSG_ECR_NDX), EC_WORD(enp->ec_ordndx),
- conv_sec_type(mach, enp->ec_type, 0, &inv_buf));
+ conv_sec_type(osabi, mach, enp->ec_type, 0, &inv_buf));
if (enp->ec_files) {
dbg_print(lml, MSG_ORIG(MSG_ECR_FILES));
@@ -62,7 +62,7 @@ Dbg_ent_entry(Lm_list *lml, Half mach, Ent_desc *enp)
* Print out all `entrance descriptor' entries.
*/
void
-Dbg_ent_print(Lm_list *lml, Half mach, Alist *alp, Boolean dmode)
+Dbg_ent_print(Lm_list *lml, uchar_t osabi, Half mach, Alist *alp, Boolean dmode)
{
Ent_desc *enp;
Aliste ndx;
@@ -76,6 +76,6 @@ Dbg_ent_print(Lm_list *lml, Half mach, Alist *alp, Boolean dmode)
for (ALIST_TRAVERSE(alp, ndx, enp)) {
dbg_print(lml, MSG_INTL(MSG_ECR_DESC), EC_WORD(ndx));
- Dbg_ent_entry(lml, mach, enp);
+ Dbg_ent_entry(lml, osabi, mach, enp);
}
}
diff --git a/usr/src/cmd/sgs/liblddbg/common/files.c b/usr/src/cmd/sgs/liblddbg/common/files.c
index d6f32a81a1..b4fbd54845 100644
--- a/usr/src/cmd/sgs/liblddbg/common/files.c
+++ b/usr/src/cmd/sgs/liblddbg/common/files.c
@@ -700,7 +700,8 @@ Dbg_file_generic(Lm_list *lml, Ifl_desc *ifl)
Dbg_util_nl(lml, DBG_NL_STD);
dbg_print(lml, MSG_INTL(MSG_FIL_BASIC), ifl->ifl_name,
- conv_ehdr_type(ifl->ifl_ehdr->e_type, 0, &inv_buf));
+ conv_ehdr_type(ifl->ifl_ehdr->e_ident[EI_OSABI],
+ ifl->ifl_ehdr->e_type, 0, &inv_buf));
}
static const Msg
diff --git a/usr/src/cmd/sgs/liblddbg/common/liblddbg.msg b/usr/src/cmd/sgs/liblddbg/common/liblddbg.msg
index ba09cc2645..b486aa6f74 100644
--- a/usr/src/cmd/sgs/liblddbg/common/liblddbg.msg
+++ b/usr/src/cmd/sgs/liblddbg/common/liblddbg.msg
@@ -1271,8 +1271,9 @@
@ MSG_SUNW_OST_SGS "SUNW_OST_SGS"
@ MSG_ELF_MAGIC " ei_magic: { 0x%x, %c, %c, %c }"
-@ MSG_ELF_CLASS " ei_class: %-18s ei_data: %s"
-@ MSG_ELF_MACHINE " e_machine: %-18s e_version: %s"
+@ MSG_ELF_CLASS " ei_class: %-18s ei_data: %s"
+@ MSG_ELF_OSABI " ei_osabi: %-18s ei_abiversion: %s"
+@ MSG_ELF_MACHINE " e_machine: %-18s e_version: %s"
@ MSG_ELF_TYPE " e_type: %s"
@ MSG_ELF_FLAGS " e_flags: %18s"
@ MSG_ELF_FLAGS_FMT " e_flags: %s"
diff --git a/usr/src/cmd/sgs/liblddbg/common/llib-llddbg b/usr/src/cmd/sgs/liblddbg/common/llib-llddbg
index afac3828e2..08ce393167 100644
--- a/usr/src/cmd/sgs/liblddbg/common/llib-llddbg
+++ b/usr/src/cmd/sgs/liblddbg/common/llib-llddbg
@@ -26,8 +26,6 @@
* Use is subject to license terms.
*/
-#pragma ident "@(#)llib-llddbg 1.79 08/06/20 SMI"
-
#include <sys/types.h>
#include <sys/auxv.h>
#include <debug.h>
@@ -81,8 +79,8 @@ void Dbg64_cap_sec_title(Lm_list *, const char *);
void Dbg32_cap_val_hw1(Lm_list *, Elf32_Word, Elf32_Half);
void Dbg64_cap_val_hw1(Lm_list *, Elf64_Xword, Elf64_Half);
-void Dbg32_ent_print(Lm_list *, Elf32_Half, Alist *, Boolean);
-void Dbg64_ent_print(Lm_list *, Elf64_Half, Alist *, Boolean);
+void Dbg32_ent_print(Lm_list *, uchar_t, Elf32_Half, Alist *, Boolean);
+void Dbg64_ent_print(Lm_list *, uchar_t, Elf64_Half, Alist *, Boolean);
void Dbg32_file_analyze(Rt_map *);
void Dbg64_file_analyze64(Rt_map *);
@@ -309,21 +307,21 @@ void Dbg64_sec_redirected(Lm_list *, const char *, const char *);
void Dbg32_sec_strtab(Lm_list *, Os_desc *, Str_tbl *);
void Dbg64_sec_strtab(Lm_list *, Os_desc *, Str_tbl *);
-void Dbg32_seg_desc_entry(Lm_list *, Elf32_Half, int, Sg_desc *);
-void Dbg64_seg_desc_entry(Lm_list *, Elf64_Half, int, Sg_desc *);
+void Dbg32_seg_desc_entry(Lm_list *, uchar_t, Elf32_Half, int, Sg_desc *);
+void Dbg64_seg_desc_entry(Lm_list *, uchar_t, Elf64_Half, int, Sg_desc *);
void Dbg32_seg_entry(Ofl_desc *, int, Sg_desc *);
void Dbg64_seg_entry(Ofl_desc *, int, Sg_desc *);
-void Dbg32_seg_list(Lm_list *, Elf32_Half, APlist *);
-void Dbg64_seg_list(Lm_list *, Elf64_Half, APlist *);
+void Dbg32_seg_list(Lm_list *, uchar_t, Elf32_Half, APlist *);
+void Dbg64_seg_list(Lm_list *, uchar_t, Elf64_Half, APlist *);
void Dbg32_seg_os(Ofl_desc *, Os_desc *, int);
void Dbg64_seg_os(Ofl_desc *, Os_desc *, int);
void Dbg32_seg_title(Lm_list *);
void Dbg64_seg_title(Lm_list *);
-void Dbg32_shdr_modified(Lm_list *, const char *, Half, Shdr *, Shdr *,
- const char *);
-void Dbg64_shdr_modified(Lm_list *, const char *, Half, Shdr *, Shdr *,
- const char *);
+void Dbg32_shdr_modified(Lm_list *, const char *, uchar_t, Half,
+ Shdr *, Shdr *, const char *);
+void Dbg64_shdr_modified(Lm_list *, const char *, uchar_t, Half,
+ Shdr *, Shdr *, const char *);
void Dbg32_statistics_ar(Ofl_desc *);
void Dbg64_statistics_ar(Ofl_desc *);
@@ -471,8 +469,10 @@ void Elf32_cap_entry(Lm_list *, Elf32_Cap *, int ndx, Elf32_Half);
void Elf64_cap_title(Lm_list *);
void Elf32_cap_title(Lm_list *);
-void Elf64_dyn_entry(Lm_list *, Elf64_Dyn *, int, const char *, Elf64_Half);
-void Elf32_dyn_entry(Lm_list *, Elf32_Dyn *, int, const char *, Elf32_Half);
+void Elf64_dyn_entry(Lm_list *, Elf64_Dyn *, int, const char *, uchar_t,
+ Elf64_Half);
+void Elf32_dyn_entry(Lm_list *, Elf32_Dyn *, int, const char *, uchar_t,
+ Elf32_Half);
void Elf64_dyn_null_entry(Lm_list *, Elf64_Dyn *, int, int);
void Elf32_dyn_null_entry(Lm_list *, Elf32_Dyn *, int, int);
void Elf64_dyn_title(Lm_list *);
@@ -488,8 +488,8 @@ void Elf32_got_entry(Lm_list *, Elf32_Sword, Elf32_Addr, Elf32_Word,
void Elf64_got_title(Lm_list *);
void Elf32_got_title(Lm_list *);
-void Elf64_phdr(Lm_list *, Elf64_Half, Elf64_Phdr *);
-void Elf32_phdr(Lm_list *, Elf32_Half, Elf32_Phdr *);
+void Elf64_phdr(Lm_list *, uchar_t, Elf64_Half, Elf64_Phdr *);
+void Elf32_phdr(Lm_list *, uchar_t, Elf32_Half, Elf32_Phdr *);
void Elf64_reloc_apply_reg(Lm_list *, int, Elf64_Half, Elf64_Xword,
Elf64_Xword);
@@ -508,12 +508,12 @@ void Elf32_reloc_entry_2(Lm_list *, int, const char *, Word, const char *,
void Elf64_reloc_title(Lm_list *, int, Word);
void Elf32_reloc_title(Lm_list *, int, Word);
-void Elf64_shdr(Lm_list *, Elf64_Half, Elf64_Shdr *);
-void Elf32_shdr(Lm_list *, Elf32_Half, Elf32_Shdr *);
+void Elf64_shdr(Lm_list *, uchar_t, Elf64_Half, Elf64_Shdr *);
+void Elf32_shdr(Lm_list *, uchar_t, Elf32_Half, Elf32_Shdr *);
-void Elf64_syms_table_entry(Lm_list *, int, const char *, Elf64_Half,
+void Elf64_syms_table_entry(Lm_list *, int, const char *, uchar_t, Elf64_Half,
Elf64_Sym *, Elf64_Versym, int, const char *, const char *);
-void Elf32_syms_table_entry(Lm_list *, int, const char *, Elf32_Half,
+void Elf32_syms_table_entry(Lm_list *, int, const char *, uchar_t, Elf32_Half,
Elf32_Sym *, Elf32_Versym, int, const char *, const char *);
void Elf64_syms_table_title(Lm_list *, int);
void Elf32_syms_table_title(Lm_list *, int);
diff --git a/usr/src/cmd/sgs/liblddbg/common/map.c b/usr/src/cmd/sgs/liblddbg/common/map.c
index b38378de01..fbea797f5a 100644
--- a/usr/src/cmd/sgs/liblddbg/common/map.c
+++ b/usr/src/cmd/sgs/liblddbg/common/map.c
@@ -103,8 +103,8 @@ Dbg_map_size_old(Ofl_desc *ofl, Sym_desc *sdp)
return;
Elf_syms_table_entry(lml, ELF_DBG_LD, MSG_INTL(MSG_STR_UP_2),
- ofl->ofl_dehdr->e_machine, sdp->sd_sym,
- sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, 0, NULL,
+ ofl->ofl_dehdr->e_ident[EI_OSABI], ofl->ofl_dehdr->e_machine,
+ sdp->sd_sym, sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, 0, NULL,
conv_def_tag(sdp->sd_ref, &inv_buf));
}
@@ -120,8 +120,8 @@ Dbg_map_symbol(Ofl_desc *ofl, Sym_desc *sdp)
return;
Elf_syms_table_entry(lml, ELF_DBG_LD, MSG_INTL(MSG_STR_ENTERED),
- ofl->ofl_dehdr->e_machine, sdp->sd_sym, sdp->sd_aux ?
- sdp->sd_aux->sa_overndx : 0, 0, NULL,
+ ofl->ofl_dehdr->e_ident[EI_OSABI], ofl->ofl_dehdr->e_machine,
+ sdp->sd_sym, sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, 0, NULL,
conv_def_tag(sdp->sd_ref, &inv_buf));
}
@@ -191,7 +191,8 @@ Dbg_map_ent(Lm_list *lml, Boolean new, Ent_desc *enp, Ofl_desc *ofl)
return;
dbg_print(lml, MSG_INTL(MSG_MAP_MAP_DIR));
- Dbg_ent_entry(lml, ofl->ofl_dehdr->e_machine, enp);
+ Dbg_ent_entry(lml, ofl->ofl_dehdr->e_ident[EI_OSABI],
+ ofl->ofl_dehdr->e_machine, enp);
if (new)
Dbg_decl = MSG_INTL(MSG_MAP_SEG_DECL_3);
}
@@ -217,6 +218,7 @@ Dbg_map_seg(Ofl_desc *ofl, int ndx, Sg_desc *sgp)
if (Dbg_decl) {
dbg_print(lml, MSG_ORIG(MSG_FMT_STR), Dbg_decl);
Dbg_seg_desc_entry(ofl->ofl_lml,
+ ofl->ofl_dehdr->e_ident[EI_OSABI],
ofl->ofl_dehdr->e_machine, ndx, sgp);
Dbg_util_nl(lml, DBG_NL_STD);
Dbg_decl = NULL;
diff --git a/usr/src/cmd/sgs/liblddbg/common/phdr.c b/usr/src/cmd/sgs/liblddbg/common/phdr.c
index f1587cc86c..933b799791 100644
--- a/usr/src/cmd/sgs/liblddbg/common/phdr.c
+++ b/usr/src/cmd/sgs/liblddbg/common/phdr.c
@@ -20,10 +20,9 @@
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
#include <sgs.h>
#include <_debug.h>
@@ -31,15 +30,15 @@
#include <msg.h>
void
-Elf_phdr(Lm_list *lml, Half mach, Phdr *phdr)
+Elf_phdr(Lm_list *lml, uchar_t osabi, Half mach, Phdr *phdr)
{
Conv_inv_buf_t inv_buf;
Conv_phdr_flags_buf_t phdr_flags_buf;
dbg_print(lml, MSG_ORIG(MSG_PHD_VADDR), EC_ADDR(phdr->p_vaddr),
- conv_phdr_flags(phdr->p_flags, 0, &phdr_flags_buf));
+ conv_phdr_flags(osabi, phdr->p_flags, 0, &phdr_flags_buf));
dbg_print(lml, MSG_ORIG(MSG_PHD_PADDR), EC_ADDR(phdr->p_paddr),
- conv_phdr_type(mach, phdr->p_type, 0, &inv_buf));
+ conv_phdr_type(osabi, mach, phdr->p_type, 0, &inv_buf));
dbg_print(lml, MSG_ORIG(MSG_PHD_FILESZ), EC_XWORD(phdr->p_filesz),
EC_XWORD(phdr->p_memsz));
dbg_print(lml, MSG_ORIG(MSG_PHD_OFFSET), EC_OFF(phdr->p_offset),
diff --git a/usr/src/cmd/sgs/liblddbg/common/segments.c b/usr/src/cmd/sgs/liblddbg/common/segments.c
index 0e55a7f459..00a6eae94c 100644
--- a/usr/src/cmd/sgs/liblddbg/common/segments.c
+++ b/usr/src/cmd/sgs/liblddbg/common/segments.c
@@ -32,7 +32,8 @@
* Print out a single `segment descriptor' entry.
*/
void
-Dbg_seg_desc_entry(Lm_list *lml, Half mach, int ndx, Sg_desc *sgp)
+Dbg_seg_desc_entry(Lm_list *lml, uchar_t osabi, Half mach, int ndx,
+ Sg_desc *sgp)
{
Conv_seg_flags_buf_t seg_flags_buf;
const char *str;
@@ -45,7 +46,7 @@ Dbg_seg_desc_entry(Lm_list *lml, Half mach, int ndx, Sg_desc *sgp)
Dbg_util_nl(lml, DBG_NL_STD);
dbg_print(lml, MSG_ORIG(MSG_SEG_NAME), ndx, str);
- Elf_phdr(lml, mach, &sgp->sg_phdr);
+ Elf_phdr(lml, osabi, mach, &sgp->sg_phdr);
dbg_print(lml, MSG_ORIG(MSG_SEG_LENGTH), EC_ADDR(sgp->sg_length));
dbg_print(lml, MSG_ORIG(MSG_SEG_FLAGS),
@@ -83,14 +84,15 @@ Dbg_seg_entry(Ofl_desc *ofl, int ndx, Sg_desc *sgp)
if (DBG_NOTCLASS(DBG_C_SEGMENTS))
return;
- Dbg_seg_desc_entry(ofl->ofl_lml, ofl->ofl_dehdr->e_machine, ndx, sgp);
+ Dbg_seg_desc_entry(ofl->ofl_lml, ofl->ofl_dehdr->e_ident[EI_OSABI],
+ ofl->ofl_dehdr->e_machine, ndx, sgp);
}
/*
* Print out the available segment descriptors.
*/
void
-Dbg_seg_list(Lm_list *lml, Half mach, APlist *apl)
+Dbg_seg_list(Lm_list *lml, uchar_t osabi, Half mach, APlist *apl)
{
Aliste idx;
Sg_desc *sgp;
@@ -102,7 +104,7 @@ Dbg_seg_list(Lm_list *lml, Half mach, APlist *apl)
Dbg_util_nl(lml, DBG_NL_STD);
dbg_print(lml, MSG_INTL(MSG_SEG_DESC_AVAIL));
for (APLIST_TRAVERSE(apl, idx, sgp))
- Dbg_seg_desc_entry(lml, mach, ndx++, sgp);
+ Dbg_seg_desc_entry(lml, osabi, mach, ndx++, sgp);
}
/*
@@ -125,7 +127,8 @@ Dbg_seg_os(Ofl_desc *ofl, Os_desc *osp, int ndx)
return;
dbg_print(lml, MSG_ORIG(MSG_SEC_NAME), ndx, osp->os_name);
- Elf_shdr(lml, ofl->ofl_dehdr->e_machine, osp->os_shdr);
+ Elf_shdr(lml, ofl->ofl_dehdr->e_ident[EI_OSABI],
+ ofl->ofl_dehdr->e_machine, osp->os_shdr);
dbg_print(lml, MSG_INTL(MSG_EDATA_TITLE));
shdr = osp->os_shdr;
diff --git a/usr/src/cmd/sgs/liblddbg/common/shdr.c b/usr/src/cmd/sgs/liblddbg/common/shdr.c
index 9b73d08c70..13d40b237d 100644
--- a/usr/src/cmd/sgs/liblddbg/common/shdr.c
+++ b/usr/src/cmd/sgs/liblddbg/common/shdr.c
@@ -20,10 +20,9 @@
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
#include <sgs.h>
#include <_debug.h>
@@ -31,15 +30,15 @@
#include <msg.h>
void
-Elf_shdr(Lm_list *lml, Half mach, Shdr *shdr)
+Elf_shdr(Lm_list *lml, uchar_t osabi, Half mach, Shdr *shdr)
{
Conv_inv_buf_t inv_buf1, inv_buf2;
Conv_sec_flags_buf_t sec_flags_buf;
dbg_print(lml, MSG_ORIG(MSG_SHD_ADDR), EC_ADDR(shdr->sh_addr),
- conv_sec_flags(shdr->sh_flags, 0, &sec_flags_buf));
+ conv_sec_flags(osabi, mach, shdr->sh_flags, 0, &sec_flags_buf));
dbg_print(lml, MSG_ORIG(MSG_SHD_SIZE), EC_XWORD(shdr->sh_size),
- conv_sec_type(mach, shdr->sh_type, 0, &inv_buf1));
+ conv_sec_type(osabi, mach, shdr->sh_type, 0, &inv_buf1));
if (shdr->sh_entsize == 0) {
dbg_print(lml, MSG_ORIG(MSG_SHD_OFFSET),
EC_OFF(shdr->sh_offset), EC_XWORD(shdr->sh_entsize));
@@ -59,8 +58,8 @@ Elf_shdr(Lm_list *lml, Half mach, Shdr *shdr)
}
void
-Dbg_shdr_modified(Lm_list *lml, const char *obj, Half mach, Shdr *oshdr,
- Shdr *nshdr, const char *name)
+Dbg_shdr_modified(Lm_list *lml, const char *obj, uchar_t osabi, Half mach,
+ Shdr *oshdr, Shdr *nshdr, const char *name)
{
if (DBG_NOTCLASS(DBG_C_SECTIONS | DBG_C_SUPPORT))
return;
@@ -71,10 +70,10 @@ Dbg_shdr_modified(Lm_list *lml, const char *obj, Half mach, Shdr *oshdr,
dbg_print(lml, MSG_INTL(MSG_SHD_MODIFIED), name, obj);
dbg_print(lml, MSG_INTL(MSG_SHD_ORIG));
- Elf_shdr(lml, mach, oshdr);
+ Elf_shdr(lml, osabi, mach, oshdr);
dbg_print(lml, MSG_INTL(MSG_SHD_NEW));
- Elf_shdr(lml, mach, nshdr);
+ Elf_shdr(lml, osabi, mach, nshdr);
Dbg_util_nl(lml, DBG_NL_STD);
}
diff --git a/usr/src/cmd/sgs/liblddbg/common/syms.c b/usr/src/cmd/sgs/liblddbg/common/syms.c
index 2bcf8a19c2..8b9321fa7e 100644
--- a/usr/src/cmd/sgs/liblddbg/common/syms.c
+++ b/usr/src/cmd/sgs/liblddbg/common/syms.c
@@ -20,7 +20,7 @@
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -240,7 +240,7 @@ Dbg_syms_entered(Ofl_desc *ofl, Sym *sym, Sym_desc *sdp)
return;
Elf_syms_table_entry(lml, ELF_DBG_LD, MSG_INTL(MSG_STR_ENTERED),
- ofl->ofl_dehdr->e_machine, sym,
+ ofl->ofl_dehdr->e_ident[EI_OSABI], ofl->ofl_dehdr->e_machine, sym,
sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, 0, NULL,
conv_def_tag(sdp->sd_ref, &inv_buf));
}
@@ -255,7 +255,8 @@ Dbg_syms_process(Lm_list *lml, Ifl_desc *ifl)
Dbg_util_nl(lml, DBG_NL_STD);
dbg_print(lml, MSG_INTL(MSG_SYM_PROCESS), ifl->ifl_name,
- conv_ehdr_type(ifl->ifl_ehdr->e_type, 0, &inv_buf));
+ conv_ehdr_type(ifl->ifl_ehdr->e_ident[EI_OSABI],
+ ifl->ifl_ehdr->e_type, 0, &inv_buf));
}
void
@@ -324,8 +325,8 @@ Dbg_syms_ignore(Ofl_desc *ofl, Sym_desc *sdp)
return;
Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD, MSG_INTL(MSG_STR_IGNORE),
- ofl->ofl_dehdr->e_machine, sdp->sd_sym, 0, 0, NULL,
- MSG_INTL(MSG_STR_UNUSED));
+ ofl->ofl_dehdr->e_ident[EI_OSABI], ofl->ofl_dehdr->e_machine,
+ sdp->sd_sym, 0, 0, NULL, MSG_INTL(MSG_STR_UNUSED));
}
void
@@ -337,8 +338,9 @@ Dbg_syms_old(Ofl_desc *ofl, Sym_desc *sdp)
return;
Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD, MSG_INTL(MSG_STR_OLD),
- ofl->ofl_dehdr->e_machine, sdp->sd_sym,
- sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, 0, NULL, sdp->sd_name);
+ ofl->ofl_dehdr->e_ident[EI_OSABI], ofl->ofl_dehdr->e_machine,
+ sdp->sd_sym, sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0,
+ 0, NULL, sdp->sd_name);
}
void
@@ -352,7 +354,7 @@ Dbg_syms_new(Ofl_desc *ofl, Sym *sym, Sym_desc *sdp)
return;
Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD, MSG_INTL(MSG_STR_NEW),
- ofl->ofl_dehdr->e_machine, sym,
+ ofl->ofl_dehdr->e_ident[EI_OSABI], ofl->ofl_dehdr->e_machine, sym,
sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, 0, NULL,
conv_def_tag(sdp->sd_ref, &inv_buf));
}
@@ -372,8 +374,8 @@ Dbg_syms_updated(Ofl_desc *ofl, Sym_desc *sdp, const char *name)
return;
Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD, MSG_ORIG(MSG_STR_EMPTY),
- ofl->ofl_dehdr->e_machine, sdp->sd_sym,
- sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, 0, NULL,
+ ofl->ofl_dehdr->e_ident[EI_OSABI], ofl->ofl_dehdr->e_machine,
+ sdp->sd_sym, sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, 0, NULL,
conv_def_tag(sdp->sd_ref, &inv_buf));
}
@@ -391,6 +393,7 @@ Dbg_syms_resolving(Ofl_desc *ofl, Word ndx, const char *name, int row,
int col, Sym *osym, Sym *nsym, Sym_desc *sdp, Ifl_desc *ifl)
{
Lm_list *lml = ofl->ofl_lml;
+ uchar_t osabi = ofl->ofl_dehdr->e_ident[EI_OSABI];
Half mach = ofl->ofl_dehdr->e_machine;
if (DBG_NOTCLASS(DBG_C_SYMBOLS))
@@ -403,11 +406,11 @@ Dbg_syms_resolving(Ofl_desc *ofl, Word ndx, const char *name, int row,
return;
Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD, MSG_INTL(MSG_STR_OLD),
- mach, osym, sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, 0, NULL,
- sdp->sd_file->ifl_name);
+ osabi, mach, osym, sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0,
+ 0, NULL, sdp->sd_file->ifl_name);
Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD, MSG_INTL(MSG_STR_NEW),
- mach, nsym, 0, 0, NULL, ifl->ifl_name);
+ osabi, mach, nsym, 0, 0, NULL, ifl->ifl_name);
}
void
@@ -421,7 +424,8 @@ Dbg_syms_resolved(Ofl_desc *ofl, Sym_desc *sdp)
return;
Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD,
- MSG_INTL(MSG_STR_RESOLVED), ofl->ofl_dehdr->e_machine, sdp->sd_sym,
+ MSG_INTL(MSG_STR_RESOLVED), ofl->ofl_dehdr->e_ident[EI_OSABI],
+ ofl->ofl_dehdr->e_machine, sdp->sd_sym,
sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, 0, NULL,
conv_def_tag(sdp->sd_ref, &inv_buf));
}
@@ -449,8 +453,8 @@ Dbg_syms_reloc(Ofl_desc *ofl, Sym_desc *sdp)
return;
Elf_syms_table_entry(lml, ELF_DBG_LD, MSG_ORIG(MSG_SYM_COPY),
- ofl->ofl_dehdr->e_machine, sdp->sd_sym,
- sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, 0, NULL,
+ ofl->ofl_dehdr->e_ident[EI_OSABI], ofl->ofl_dehdr->e_machine,
+ sdp->sd_sym, sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, 0, NULL,
conv_def_tag(sdp->sd_ref, &inv_buf));
}
@@ -491,8 +495,8 @@ Dbg_syms_reduce(Ofl_desc *ofl, int which, Sym_desc *sdp, int idx,
return;
Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD, MSG_ORIG(MSG_SYM_LOCAL),
- ofl->ofl_dehdr->e_machine, sdp->sd_sym,
- sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, 0, NULL,
+ ofl->ofl_dehdr->e_ident[EI_OSABI], ofl->ofl_dehdr->e_machine,
+ sdp->sd_sym, sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, 0, NULL,
sdp->sd_file->ifl_name);
}
@@ -569,8 +573,9 @@ Elf_syms_table_title(Lm_list *lml, int caller)
}
void
-Elf_syms_table_entry(Lm_list *lml, int caller, const char *prestr, Half mach,
- Sym *sym, Versym verndx, int gnuver, const char *sec, const char *poststr)
+Elf_syms_table_entry(Lm_list *lml, int caller, const char *prestr,
+ uchar_t osabi, Half mach, Sym *sym, Versym verndx, int gnuver,
+ const char *sec, const char *poststr)
{
Conv_inv_buf_t inv_buf1, inv_buf2, inv_buf3;
Conv_inv_buf_t inv_buf4, inv_buf5, inv_buf6;
@@ -585,13 +590,16 @@ Elf_syms_table_entry(Lm_list *lml, int caller, const char *prestr, Half mach,
else
msg = MSG_INTL(MSG_SYM_EFL_ENTRY);
+ if (sec == NULL)
+ sec = conv_sym_shndx(osabi, mach, sym->st_shndx,
+ CONV_FMT_DECIMAL, &inv_buf6);
+
dbg_print(lml, msg, prestr,
conv_sym_value(mach, type, sym->st_value, &inv_buf1),
sym->st_size, conv_sym_info_type(mach, type, 0, &inv_buf2),
conv_sym_info_bind(bind, 0, &inv_buf3),
conv_sym_other(sym->st_other, &inv_buf4),
conv_ver_index(verndx, gnuver, &inv_buf5),
- sec ? sec : conv_sym_shndx(sym->st_shndx, &inv_buf6),
- Elf_demangle_name(poststr));
+ sec, Elf_demangle_name(poststr));
}
}
diff --git a/usr/src/cmd/sgs/liblddbg/common/tls.c b/usr/src/cmd/sgs/liblddbg/common/tls.c
index 3df8c6e5fc..bd4250ef6c 100644
--- a/usr/src/cmd/sgs/liblddbg/common/tls.c
+++ b/usr/src/cmd/sgs/liblddbg/common/tls.c
@@ -20,12 +20,10 @@
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <link.h>
#include <libc_int.h>
#include <rtld.h>
@@ -41,19 +39,21 @@
static void
Dbg_tls_modent(Lm_list *lml, TLS_modinfo * tmodent)
{
+ /*
+ * MSG_ORIG(MSG_TLS_FLAG_STATIC)
+ */
static char flagstr[FLAGSZ];
static Val_desc vda[] = {
- { TM_FLG_STATICTLS, MSG_ORIG(MSG_TLS_FLAG_STATIC) },
+ { TM_FLG_STATICTLS, MSG_TLS_FLAG_STATIC },
{ 0, 0 }
};
- static CONV_EXPN_FIELD_ARG conv_arg = { flagstr,
- sizeof (flagstr), vda };
+ static CONV_EXPN_FIELD_ARG conv_arg = { flagstr, sizeof (flagstr) };
ulong_t flags;
if ((flags = tmodent->tm_flags) != 0) {
conv_arg.oflags = conv_arg.rflags = flags;
- (void) conv_expn_field(&conv_arg, 0);
+ (void) conv_expn_field(&conv_arg, vda, 0);
} else {
flagstr[0] = '\0';
}
diff --git a/usr/src/cmd/sgs/packages/common/SUNWonld-README b/usr/src/cmd/sgs/packages/common/SUNWonld-README
index b32f0f5952..615cb9a1a4 100644
--- a/usr/src/cmd/sgs/packages/common/SUNWonld-README
+++ b/usr/src/cmd/sgs/packages/common/SUNWonld-README
@@ -1467,3 +1467,5 @@ Bugid Risk Synopsis
6821646 xVM dom0 doesn't boot on daily.0324 and beyond
6822828 librtld_db can return RD_ERR before RD_NOMAPS, which compromises dbx
expectations.
+6821619 Solaris linkers need systematic approach to ELF OSABI
+ PSARC/2009/196 ELF objects to set OSABI / elfdump -O option
diff --git a/usr/src/cmd/sgs/rtld/mdbmod/common/rtld.c b/usr/src/cmd/sgs/rtld/mdbmod/common/rtld.c
index a4c04cd2de..dca4ca14d6 100644
--- a/usr/src/cmd/sgs/rtld/mdbmod/common/rtld.c
+++ b/usr/src/cmd/sgs/rtld/mdbmod/common/rtld.c
@@ -1346,7 +1346,7 @@ dcmd_ElfDyn(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
}
mdb_printf(MSG_ORIG(MSG_ELFDYN_TITLE), addr);
- dynstr = conv_dyn_tag(dyn.d_tag, M_MACH, 0, &inv_buf);
+ dynstr = conv_dyn_tag(dyn.d_tag, ELFOSABI_SOLARIS, M_MACH, 0, &inv_buf);
mdb_printf(MSG_ORIG(MSG_ELFDYN_LINE1), addr, dynstr, dyn.d_un.d_ptr);
mdb_set_dot(addr + sizeof (Dyn));
@@ -1394,7 +1394,7 @@ dcmd_ElfEhdr(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
conv_ehdr_mach(ehdr.e_machine, 0, &inv_buf1),
conv_ehdr_vers(ehdr.e_version, 0, &inv_buf2));
mdb_printf(MSG_ORIG(MSG_EHDR_LINE4),
- conv_ehdr_type(ehdr.e_type, 0, &inv_buf1));
+ conv_ehdr_type(ehdr.e_ident[EI_OSABI], ehdr.e_type, 0, &inv_buf1));
/*
* Line up the flags differently depending on whether we
@@ -1445,9 +1445,10 @@ dcmd_ElfPhdr(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
mdb_printf(MSG_ORIG(MSG_EPHDR_TITLE), addr);
mdb_printf(MSG_ORIG(MSG_EPHDR_LINE1), phdr.p_vaddr,
- conv_phdr_flags(phdr.p_flags, 0, &phdr_flags_buf));
+ conv_phdr_flags(ELFOSABI_SOLARIS, phdr.p_flags, 0,
+ &phdr_flags_buf));
mdb_printf(MSG_ORIG(MSG_EPHDR_LINE2), phdr.p_paddr,
- conv_phdr_type(M_MACH, phdr.p_type, 0, &inv_buf));
+ conv_phdr_type(ELFOSABI_SOLARIS, M_MACH, phdr.p_type, 0, &inv_buf));
mdb_printf(MSG_ORIG(MSG_EPHDR_LINE3), phdr.p_filesz, phdr.p_memsz);
mdb_printf(MSG_ORIG(MSG_EPHDR_LINE4), phdr.p_offset, phdr.p_align);
diff --git a/usr/src/cmd/sgs/tools/common/sgsmsg.c b/usr/src/cmd/sgs/tools/common/sgsmsg.c
index 9b2e37b507..8afdbddb82 100644
--- a/usr/src/cmd/sgs/tools/common/sgsmsg.c
+++ b/usr/src/cmd/sgs/tools/common/sgsmsg.c
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
* sgsmsg generates several message files from an input template file. Messages
@@ -66,7 +66,6 @@
* the data array being built in msg.c. The index into this array
* becomes the `message' identifier created in the msg.h file.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
#include <fcntl.h>
#include <stdlib.h>
@@ -393,15 +392,22 @@ init_defs(void)
return (1);
}
+ if (fprintf(fddefs, "#include <sgsmsg.h>\t/* Msg typedef */\n\n") < 0) {
+ (void) fprintf(stderr, Errmsg_wrte, fldefs, strerror(errno));
+ return (1);
+ }
+
if (fprintf(fddefs, "#ifndef\t__lint\n\n") < 0) {
(void) fprintf(stderr, Errmsg_wrte, fldefs, strerror(errno));
return (1);
}
/*
- * add "typedef int Msg;"
+ * The MSG_SGS_ARRAY_NAME macro supplies a generic way to
+ * reference the string table regardless of its name.
*/
- if (fprintf(fddefs, "typedef int\tMsg;\n\n") < 0) {
+ if (fprintf(fddefs, "#define\tMSG_SGS_LOCAL_ARRAY\t__%s\n\n",
+ interface) < 0) {
(void) fprintf(stderr, Errmsg_wrte, fldefs, strerror(errno));
return (1);
}
@@ -418,7 +424,13 @@ init_defs(void)
return (1);
}
}
- if (fprintf(fddefs, "#define\tMSG_ORIG(x)\t&__%s[x]\n\n",
+ if (fprintf(fddefs,
+ "#define\tMSG_ORIG_STRTAB(_x, _s)\t&_s[_x]\n\n") < 0) {
+ (void) fprintf(stderr, Errmsg_wrte, fldefs, strerror(errno));
+ return (1);
+ }
+ if (fprintf(fddefs,
+ "#define\tMSG_ORIG(x)\tMSG_ORIG_STRTAB(x, __%s)\n\n",
interface) < 0) {
(void) fprintf(stderr, Errmsg_wrte, fldefs, strerror(errno));
return (1);
@@ -453,17 +465,14 @@ fini_defs(void)
return (1);
}
- /*
- * When __lint is defined, Msg is a char *. This allows lint to
- * check our format strings against it's arguments.
- */
- if (fprintf(fddefs, "\ntypedef char *\tMsg;\n\n") < 0) {
+ if (fprintf(fddefs, "extern\tconst char *\t_%s(Msg);\n\n",
+ interface) < 0) {
(void) fprintf(stderr, Errmsg_wrte, fldefs, strerror(errno));
return (1);
}
- if (fprintf(fddefs, "extern\tconst char *\t_%s(Msg);\n\n",
- interface) < 0) {
+ if (fprintf(fddefs, "#ifndef MSG_SGS_LOCAL_ARRAY\n"
+ "#define\tMSG_SGS_LOCAL_ARRAY\t\"\"\n#endif\n\n") < 0) {
(void) fprintf(stderr, Errmsg_wrte, fldefs, strerror(errno));
return (1);
}
@@ -478,12 +487,25 @@ fini_defs(void)
}
if (fprintf(fddefs,
+ "#define MSG_ORIG_STRTAB(_x, _s)\t_x\n"
"#define MSG_ORIG(x)\tx\n#define MSG_INTL(x)\tx\n") < 0) {
(void) fprintf(stderr, Errmsg_wrte, fldefs, strerror(errno));
return (1);
}
/*
+ * Provide a way to get the array and function declarations above
+ * without also getting the actual messages. This is useful in
+ * our lintsup.c files that include more than one message header.
+ * lintsup doesn't need the actual messages, and this prevents
+ * macro name collisions.
+ */
+ if (fprintf(fddefs, "\n#ifndef LINTSUP_SUPPRESS_STRINGS\n") < 0) {
+ (void) fprintf(stderr, Errmsg_wrte, fldefs, strerror(errno));
+ return (1);
+ }
+
+ /*
* Copy the temporary lint defs file into the new header.
*/
if (fdlint) {
@@ -510,6 +532,11 @@ fini_defs(void)
(void) free(buf);
}
+ if (fprintf(fddefs, "\n#endif\t/* LINTSUP_SUPPRESS_STRINGS */\n") < 0) {
+ (void) fprintf(stderr, Errmsg_wrte, fldefs, strerror(errno));
+ return (1);
+ }
+
if (fprintf(fddefs, "\n#endif\t/* __lint */\n") < 0) {
(void) fprintf(stderr, Errmsg_wrte, fldefs, strerror(errno));
return (1);