1elfwrap(1)                       User Commands                      elfwrap(1)
2
3
4

NAME

6       elfwrap - wrap data in an ELF file
7

SYNOPSIS

9       elfwrap [-64] [-o relobj-file] [-z target=sparc | x86]
10       data-file...
11
12

DESCRIPTION

14       The  elfwrap utility creates an ELF relocatable object file from one or
15       more data files. The relocatable object  encapsulates  each  data  file
16       within an individual section, together with symbols that can be used to
17       reference the section. The relocatable object is appropriate for inclu‐
18       sion  with a subsequent link-edit. Users can reference the encapsulated
19       data using the associated symbols.
20
21
22       By default, a 32-bit ELF relocatable object is created that  is  appro‐
23       priate for the machine on which elfwrap is executed. The -64 option can
24       be used to create a 64-bit ELF relocatable object. The -z target option
25       can be used to create a relocatable object for a specific machine type.
26
27       Note -
28
29         Any  data  encapsulated  with elfwrap must be in a format appropriate
30         for the destination target.
31
32
33       By default, the relocatable object a.wrap.o is created. The  -o  option
34       can be used to specify an alternative relocatable object name.
35
36
37       The  basename(1)  of each data file is used to create various pieces of
38       ELF information.  For example, if the input data file is  ISV/isv-data,
39       the following ELF information is created within the relocatable object.
40
41       An ELF section named .isv-data
42
43           This section contains the entire contents of the input data file.
44
45
46       An ELF symbol named isv-data_start
47
48           This symbol reflects the starting address of the .isv-data section.
49
50
51       An ELF symbol named isv-data_end
52
53           This  symbol  reflects  the address of the first location after the
54           .isv-data section.
55
56

OPTIONS

58       The following options are supported:
59
60       -64
61
62           Create a 64-bit ELF relocatable object.
63
64
65       -o relobj-file
66
67           Produce a relocatable object that is named relobj-file.
68
69
70       -z target=sparc | x86
71
72           Specifies the machine type for the output relocatable object.  Sup‐
73           ported  targets  are sparc and x86. The 32-bit machine type for the
74           specified target is used unless the -64 option is also present,  in
75           which  case  the  corresponding  64-bit  machine  type  is used. By
76           default, the relocatable object that is generated is 32-bit for the
77           machine one which elfwrap is executed.
78
79

EXAMPLES

81       The  following example encapsulates the system passwd file and the sys‐
82       tem group file within a relocatable object passgroup.o.
83
84         example% elfwrap -o passgroup.o /etc/passwd /etc/group
85         example% elfdump -s passgroup.o | egrep "passwd|group"
86           [2]  0x00000000 0x00000000  SECT LOCL  D  0 .passwd
87           [3]  0x00000000 0x00000000  SECT LOCL  D  0 .group
88           [7]  0x00000000 0x000002f0  OBJT GLOB  D  0 .passwd  passwd_start
89           [8]  0x000002f0 0x00000000  OBJT GLOB  D  0 .passwd  passwd_end
90           [9]  0x00000000 0x00000121  OBJT GLOB  D  0 .group   group_start
91          [10]  0x00000121 0x00000000  OBJT GLOB  D  0 .group   group_end
92         example% strings -N.passwd passgroup.o | head -1
93         root:x:0:0:Super-User:/:/sbin/sh
94         example% strings -N.group passgroup.o | head -1
95         root::0:
96
97
98
99
100       This relocatable object can be referenced from the following user code.
101
102         example% cat main.c
103         #include        <stdio.h>
104
105         extern char     passwd_start, passwd_end;
106
107         void main()
108         {
109             char    *pstart = &passwd_start, *pend = &passwd_end;
110             char    *str, *lstr;
111
112             for (lstr = str = pstart; str < pend; str++) {
113                 if ((*str == '0) && (str != (pend - 1)))  {
114                     (void) printf("%.*s", (++str - lstr), lstr);
115                  lstr = str;
116                 }
117             }
118         }
119         example% cc -o main main.c passgroup.o
120         example% ./main
121         root:x:0:0:Super-User:/:/sbin/sh
122         ....
123         nobody4:x:65534:65534:SunOS 4.x NFS Anonymous Access User:/:
124
125
126

FILES

128       a.wrap.o    The default relocatable object file created.
129
130

ATTRIBUTES

132       See attributes(5) for descriptions of the following attributes:
133
134
135
136
137       ┌─────────────────────────────┬─────────────────────────────┐
138       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
139       ├─────────────────────────────┼─────────────────────────────┤
140       │Availability                 │SUNWtoo                      │
141       ├─────────────────────────────┼─────────────────────────────┤
142       │Interface Stability          │Committed                    │
143       └─────────────────────────────┴─────────────────────────────┘
144

SEE ALSO

146       elfdump(1),  ld(1),  strings(1),  elf(3ELF),  attributes(5),   ddi_mod‐
147       open(9F)
148
149
150       Linker and Libraries Guide
151
152
153
154SunOS 5.11                       17 March 2008                      elfwrap(1)
Impressum