elfwrap man page on SmartOS

Man page or keyword search:  
man Server   16655 pages
apropos Keyword Search (all sections)
Output format
SmartOS logo
[printable version]

ELFWRAP(1)							    ELFWRAP(1)

       elfwrap - wrap data in an ELF file

       elfwrap [-64] [-o relobj-file] [-z target=sparc | x86]

       The  elfwrap utility creates an ELF relocatable object file from one or
       more data files. The relocatable object	encapsulates  each  data  file
       within an individual section, together with symbols that can be used to
       reference the section. The relocatable object is appropriate for inclu‐
       sion  with a subsequent link-edit. Users can reference the encapsulated
       data using the associated symbols.

       By default, a 32-bit ELF relocatable object is created that  is	appro‐
       priate for the machine on which elfwrap is executed. The -64 option can
       be used to create a 64-bit ELF relocatable object. The -z target option
       can be used to create a relocatable object for a specific machine type.

       Note -

	 Any  data  encapsulated  with elfwrap must be in a format appropriate
	 for the destination target.

       By default, the relocatable object a.wrap.o is created. The  -o	option
       can be used to specify an alternative relocatable object name.

       The  basename(1)	 of each data file is used to create various pieces of
       ELF information.	 For example, if the input data file is	 ISV/isv-data,
       the following ELF information is created within the relocatable object.

       An ELF section named .isv-data

	   This section contains the entire contents of the input data file.

       An ELF symbol named isv-data_start

	   This symbol reflects the starting address of the .isv-data section.

       An ELF symbol named isv-data_end

	   This	 symbol	 reflects  the address of the first location after the
	   .isv-data section.

       The following options are supported:


	   Create a 64-bit ELF relocatable object.

       -o relobj-file

	   Produce a relocatable object that is named relobj-file.

       -z target=sparc | x86

	   Specifies the machine type for the output relocatable object.  Sup‐
	   ported  targets  are sparc and x86. The 32-bit machine type for the
	   specified target is used unless the -64 option is also present,  in
	   which  case	the  corresponding  64-bit  machine  type  is used. By
	   default, the relocatable object that is generated is 32-bit for the
	   machine one which elfwrap is executed.

       The  following example encapsulates the system passwd file and the sys‐
       tem group file within a relocatable object passgroup.o.

	 example% elfwrap -o passgroup.o /etc/passwd /etc/group
	 example% elfdump -s passgroup.o | egrep "passwd|group"
	   [2]	0x00000000 0x00000000  SECT LOCL  D  0 .passwd
	   [3]	0x00000000 0x00000000  SECT LOCL  D  0 .group
	   [7]	0x00000000 0x000002f0  OBJT GLOB  D  0 .passwd	passwd_start
	   [8]	0x000002f0 0x00000000  OBJT GLOB  D  0 .passwd	passwd_end
	   [9]	0x00000000 0x00000121  OBJT GLOB  D  0 .group	group_start
	  [10]	0x00000121 0x00000000  OBJT GLOB  D  0 .group	group_end
	 example% strings -N.passwd passgroup.o | head -1
	 example% strings -N.group passgroup.o | head -1

       This relocatable object can be referenced from the following user code.

	 example% cat main.c
	 #include	 <stdio.h>

	 extern char	 passwd_start, passwd_end;

	 void main()
	     char    *pstart = &passwd_start, *pend = &passwd_end;
	     char    *str, *lstr;

	     for (lstr = str = pstart; str < pend; str++) {
		 if ((*str == '\n') && (str != (pend - 1)))  {
		     (void) printf("%.*s", (++str - lstr), lstr);
		  lstr = str;
	 example% cc -o main main.c passgroup.o
	 example% ./main
	 nobody4:x:65534:65534:SunOS 4.x NFS Anonymous Access User:/:

		   The default relocatable object file created.

       See attributes(5) for descriptions of the following attributes:

       │Interface Stability │ Committed	      │

       elfdump(1),  ld(1),  strings(1),	 elf(3ELF),  attributes(5),   ddi_mod‐

       Linker and Libraries Guide

				 Sep 10, 2013			    ELFWRAP(1)

List of man pages available for SmartOS

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
Vote for polarhome
Free Shell Accounts :: the biggest list on the net