/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Wrap data in an elf file.
*/
#include <fcntl.h>
#include <unistd.h>
#include <libgen.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <locale.h>
#include <libintl.h>
#include <conv.h>
#include <msg.h>
#include <_elfwrap.h>
const char *
{
}
int
{
/*
* If we're on a 64-bit kernel, try to exec a full 64-bit version of
* the binary. If successful, conv_check_native() won't return.
*/
/*
* Establish locale.
*/
opterr = 0;
switch (var) {
case '6': /* Create a 64-bit object */
if (optarg[0] != '4') {
return (1);
}
class = ELFCLASS64;
break;
case 'o': /* output file name */
break;
case 'z': /* output file platform */
MSG_ARG_TARGET_SIZE) == 0)
else {
return (1);
}
break;
case '?':
prog);
return (1);
default:
break;
}
}
/*
* Verify that we have at least one input data file, and if no output
* file has been specified, provide a default. Update argc and argv
* for input() to continue processing any input files.
*/
if (argc == 0) {
return (1);
}
/*
* If the user specified a target, use it to determine the machine type
* for the output object. If no target is specified, we leave "mach" as
* EM_NONE. output() will replace EM_NONE with the appropriate machine
* code for the system running elfwrap(1).
*/
if (pstr) {
if (class == ELFCLASS64)
mach = EM_SPARCV9;
else
if (class == ELFCLASS64)
else
} else {
pstr);
return (1);
}
}
/*
* Create the input information for the new image.
*/
if (class == ELFCLASS64) {
return (1);
} else {
return (1);
}
/*
* Create and truncate the output file.
*/
return (1);
}
/*
* Initialize libelf, and create the new ELF file as the class dictates.
*/
return (1);
}
if (class == ELFCLASS64)
else
}