summaryrefslogtreecommitdiff
path: root/usr/src/cmd/file/file.c
diff options
context:
space:
mode:
authorab196087 <none@none>2006-05-15 08:44:26 -0700
committerab196087 <none@none>2006-05-15 08:44:26 -0700
commitc13de8f6a88563211bd4432ca11ca38ed3bf0fc0 (patch)
treed0c5256802f12c3e6548ff480c584f381151ac4a /usr/src/cmd/file/file.c
parent5ff020828878e7a894f8cec67e6719c5379d5f4e (diff)
downloadillumos-joyent-c13de8f6a88563211bd4432ca11ca38ed3bf0fc0.tar.gz
PSARC 2006/301 elf_M32.h removal
PSARC 2006/309 crle(1) configuration file format change 6174390 crle configuration files are inconsistent across platforms --HG-- rename : usr/src/cmd/sgs/dump/common/util.c => deleted_files/usr/src/cmd/sgs/dump/common/util.c rename : usr/src/uts/common/sys/elf_M32.h => deleted_files/usr/src/uts/common/sys/elf_M32.h
Diffstat (limited to 'usr/src/cmd/file/file.c')
-rw-r--r--usr/src/cmd/file/file.c49
1 files changed, 39 insertions, 10 deletions
diff --git a/usr/src/cmd/file/file.c b/usr/src/cmd/file/file.c
index 8c48682c3d..18bca230ed 100644
--- a/usr/src/cmd/file/file.c
+++ b/usr/src/cmd/file/file.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.
@@ -27,7 +26,7 @@
/* All Rights Reserved */
/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -35,6 +34,9 @@
#define _LARGEFILE64_SOURCE
+/* Get definitions for the relocation types supported. */
+#define ELF_TARGET_ALL
+
#include <ctype.h>
#include <unistd.h>
#include <fcntl.h>
@@ -53,14 +55,13 @@
#include <sys/mkdev.h>
#include <sys/stat.h>
#include <sys/elf.h>
-#include <sys/elf_M32.h>
-#include <sys/elf_SPARC.h>
#include <procfs.h>
#include <sys/core.h>
#include <sys/dumphdr.h>
#include <netinet/in.h>
#include <gelf.h>
#include <elfcap.h>
+#include <sgsrtcid.h>
#include "file.h"
typedef Elf64_Nhdr GElf_Nhdr;
@@ -188,6 +189,7 @@ static void usage(void);
static void default_magic(void);
static void add_to_mlist(char *, int);
static void fd_cleanup(void);
+static int is_rtld_config(void);
#ifdef XPG4
/* SUSv3 requires a single <space> after the colon */
@@ -608,6 +610,7 @@ def_position_tests(void)
(void) putchar('\n');
return (1);
+
/* LINTED: pointer cast may result in improper alignment */
} else if (*(int *)fbuf == CORE_MAGIC) {
/* LINTED: pointer cast may result in improper alignment */
@@ -622,6 +625,12 @@ def_position_tests(void)
}
/*
+ * Runtime linker (ld.so.1) configuration file.
+ */
+ if (is_rtld_config())
+ return (1);
+
+ /*
* ZIP files, JAR files, and Java executables
*/
if (zipfile(fbuf, ifd))
@@ -1069,10 +1078,6 @@ static void
print_elf_flags(int machine, unsigned int flags)
{
switch (machine) {
- case EM_M32:
- if (flags & EF_M32_MAU)
- (void) printf("%s", gettext(", MAU Required"));
- break;
case EM_SPARCV9:
if (flags & EF_SPARC_EXT_MASK) {
if (flags & EF_SPARC_SUN_US3) {
@@ -1312,6 +1317,30 @@ is_stripped(Elf *elf)
}
/*
+ * is_rtld_config - If file is a runtime linker config file, prints
+ * the description and returns True (1). Otherwise, silently returns
+ * False (0).
+ */
+int
+is_rtld_config(void)
+{
+ Rtc_id *id;
+
+ if ((fbsz >= sizeof (*id)) && RTC_ID_TEST(fbuf)) {
+ (void) printf(gettext("Runtime Linking Configuration"));
+ /* LINTED: pointer cast may result in improper alignment */
+ id = (Rtc_id *) fbuf;
+ print_elf_class(id->id_class);
+ print_elf_datatype(id->id_data);
+ print_elf_machine(id->id_machine);
+ (void) printf("\n");
+ return (1);
+ }
+
+ return (0);
+}
+
+/*
* lookup -
* Attempts to match one of the strings from a list, 'tab',
* with what is in the file, starting at the current index position 'i'.