Print this page
12745 man page typos

Split Close
Expand all
Collapse all
          --- old/usr/src/man/man1/elfedit.1
          +++ new/usr/src/man/man1/elfedit.1
   1    1  '\" te
   2    2  .\" Copyright (c) 2008, Sun Microsystems Inc. All
   3    3  .\" Rights Reserved.
   4    4  .\" 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.
   5    5  .\" 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.
   6    6  .\" 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]
   7      -.TH ELFEDIT 1 "Jan 28, 2008"
        7 +.TH ELFEDIT 1 "May 17, 2020"
   8    8  .SH NAME
   9    9  elfedit \- examine or edit ELF files
  10   10  .SH SYNOPSIS
  11      -.LP
  12   11  .nf
  13   12  \fBelfedit\fR [\fB-adr\fR] [\fB-e\fR \fIcmd\fR] [\fB-L\fR \fIpath\fR] [\fB-o\fR \fBdefault\fR | \fBsimple\fR | \fBnum\fR]
  14   13       [\fIinfile\fR] [\fIoutfile\fR]
  15   14  .fi
  16   15  
  17   16  .SH DESCRIPTION
  18      -.sp
  19      -.LP
  20   17  \fBelfedit\fR is a tool for examining or modifying the contents of an existing
  21   18  ELF object. Specifically, \fBelfedit\fR is used to modify the ELF metadata
  22   19  contained in the object. Access is provided to most of the ELF data contained
  23   20  in an object, including the ELF header, section header table, program header
  24   21  table, dynamic section, hardware and software capabilities, string tables, and
  25   22  symbol tables.
  26   23  .SS "Syntax"
  27      -.sp
  28      -.LP
  29   24  \fBelfedit\fR processes commands from the command line (\fB-e\fR option) or
  30   25  from standard input. If standard input is a terminal, \fBelfedit\fR provides
  31   26  terminal editing capabilities, as well as extensive command completion. ELF
  32   27  uses many standard symbolic names for special integer values and bit masks.
  33   28  \fBelfedit\fR is aware of most possible completions for such names. You can
  34   29  press TAB at any point while entering an \fBelfedit\fR command to cause
  35   30  \fBelfedit\fR to display a usage message and any known completions for the text
  36   31  at the current cursor.
  37   32  .sp
  38   33  .LP
↓ open down ↓ 256 lines elided ↑ open up ↑
 295  290  .sp
 296  291  .ne 2
 297  292  .na
 298  293  \fB\fBsys\fR\fR
 299  294  .ad
 300  295  .RS 11n
 301  296  Core built in \fBelfedit\fR commands
 302  297  .RE
 303  298  
 304  299  .SS "Status And Command Documentation"
 305      -.sp
 306      -.LP
 307  300  Status And Command Documentation
 308  301  .sp
 309  302  .LP
 310  303  The status (\fBsys:status\fR) command displays information about the current
 311  304  \fBelfedit\fR session:
 312  305  .RS +4
 313  306  .TP
 314  307  .ie t \(bu
 315  308  .el o
 316  309  Input and output files
↓ open down ↓ 75 lines elided ↑ open up ↑
 392  385  help (\fBsys:help\fR) can be used to obtain help on itself:
 393  386  .sp
 394  387  .in +2
 395  388  .nf
 396  389  > help help
 397  390  .fi
 398  391  .in -2
 399  392  .sp
 400  393  
 401  394  .SS "Module Search Path"
 402      -.sp
 403      -.LP
 404  395  \fBelfedit\fR modules are implemented as sharable objects which are loaded on
 405  396  demand. When a module is required, \fBelfedit\fR searches a module path in
 406  397  order to locate the sharable object that implements the module. The path is a
 407  398  sequence of directory names delimited by colon (\fB:\fR) characters. In
 408  399  addition to normal characters, the path can also contain any of the following
 409  400  tokens:
 410  401  .sp
 411  402  .ne 2
 412  403  .na
 413  404  \fB\fB%i\fR\fR
↓ open down ↓ 23 lines elided ↑ open up ↑
 437  428  appending or prepending directories to the default path.
 438  429  .RE
 439  430  
 440  431  .sp
 441  432  .ne 2
 442  433  .na
 443  434  \fB\fB%r\fR\fR
 444  435  .ad
 445  436  .RS 6n
 446  437  Root of file system tree holding the \fBelfedit\fR program, assuming that
 447      -\fBelfedit\fR is installed as \fBusr/bin/elfedi\fRt within the tree. On a
      438 +\fBelfedit\fR is installed as \fBusr/bin/elfedit\fR within the tree. On a
 448  439  standard system, this is simply the standard system root directory (\fB/\fR).
 449  440  On a development system, where the copy of \fBelfedit\fR can be installed
 450  441  elsewhere, the use of \fB%r\fR can be used to ensure that the matching set of
 451  442  modules are used.
 452  443  .RE
 453  444  
 454  445  .sp
 455  446  .ne 2
 456  447  .na
 457  448  \fB\fB%%\fR\fR
↓ open down ↓ 42 lines elided ↑ open up ↑
 500  491  .RS 28n
 501  492  64-bit \fBelfedit\fR (\fBx86\fR)
 502  493  .RE
 503  494  
 504  495  .sp
 505  496  .LP
 506  497  The default search path can be changed by setting the \fBELFEDIT_PATH\fR
 507  498  environment variable, or by using the \fB-L\fR command line option. If you
 508  499  specify both, the \fB-L\fR option supersedes the environment variable.
 509  500  .SH OPTIONS
 510      -.sp
 511      -.LP
 512  501  The following options are supported:
 513  502  .sp
 514  503  .ne 2
 515  504  .na
 516  505  \fB\fB-a\fR\fR
 517  506  .ad
 518  507  .RS 29n
 519  508  Enable \fBautoprint\fR mode. When \fBautoprint\fR is enabled, \fBelfedit\fR
 520  509  prints the modified values that result when the ELF file is modified. This
 521  510  output is shown in the current output style, which can be changed using the
↓ open down ↓ 99 lines elided ↑ open up ↑
 621  610  .RS 29n
 622  611  Read-only mode. The input file is opened for read-only access, and the results
 623  612  of the edit session are not saved. \fBelfedit\fR does not allow the
 624  613  \fIoutfile\fR argument when \fB-r\fR is specified. Read-only mode is highly
 625  614  recommended when there is no intention to modify the file. In addition to
 626  615  providing extra protection against accidental modification, it allows for the
 627  616  examination of files for which the user does not have write permission.
 628  617  .RE
 629  618  
 630  619  .SH OPERANDS
 631      -.sp
 632      -.LP
 633  620  The following operands are supported:
 634  621  .sp
 635  622  .ne 2
 636  623  .na
 637  624  \fB\fIinfile\fR\fR
 638  625  .ad
 639  626  .RS 11n
 640  627  Input file containing an ELF object to process.
 641  628  .sp
 642  629  This can be an executable (\fBET_EXEC\fR), shared object (\fBET_DYN\fR), or
↓ open down ↓ 22 lines elided ↑ open up ↑
 665  652  .na
 666  653  \fB\fIoutfile\fR\fR
 667  654  .ad
 668  655  .RS 11n
 669  656  Output file. If both \fIinfile\fR and \fIoutfile\fR are present, \fIinfile\fR
 670  657  is opened for read-only access, and the modified object contents are written to
 671  658  \fIoutfile\fR.
 672  659  .RE
 673  660  
 674  661  .SH USAGE
 675      -.sp
 676      -.LP
 677  662  When supported by the system, \fBelfedit\fR runs as a 64-bit application,
 678  663  capable of processing files greater than or equal to 2 Gbytes (2^31 bytes).
 679  664  .sp
 680  665  .LP
 681  666  At startup, \fBelfedit\fR uses \fBlibelf\fR to open the input file and cache a
 682  667  copy of its contents in memory for editing. It can then execute one or more
 683  668  commands. A session finishes by optionally writing the modified object to the
 684  669  output file, and then exiting.
 685  670  .sp
 686  671  .LP
↓ open down ↓ 8 lines elided ↑ open up ↑
 695  680  (\fBsys:write\fR) and quit (\fBsys:qui\fRt) immediately following the given
 696  681  commands, causing the output file to be written and the \fBelfedit\fR process
 697  682  to exit. This form of use is convenient in shell scripts and makefiles.
 698  683  .sp
 699  684  .LP
 700  685  If no \fB-e\fR options are specified, \fBelfedit\fR reads commands from
 701  686  \fBstdin\fR and executes them in the order given. The caller must explicitly
 702  687  issue the write (\fBsys:write\fR) and quit (\fBsys:quit\fR) commands to save
 703  688  their work and exit when running in this mode.
 704  689  .SH EXIT STATUS
 705      -.sp
 706      -.LP
 707  690  The following exit values are returned:
 708  691  .sp
 709  692  .ne 2
 710  693  .na
 711  694  \fB\fB0\fR\fR
 712  695  .ad
 713  696  .RS 5n
 714  697  Successful completion.
 715  698  .RE
 716  699  
↓ open down ↓ 9 lines elided ↑ open up ↑
 726  709  .sp
 727  710  .ne 2
 728  711  .na
 729  712  \fB\fB2\fR\fR
 730  713  .ad
 731  714  .RS 5n
 732  715  Invalid command line options were specified.
 733  716  .RE
 734  717  
 735  718  .SH EXAMPLES
 736      -.sp
 737      -.LP
 738  719  In the following examples, interactive use of \fBelfedit\fR is shown with the
 739  720  shell prompt (\fB%\fR) and the \fBelfedit\fR prompt (\fB>\fR). Neither of these
 740  721  characters should be entered by the user.
 741  722  .LP
 742  723  \fBExample 1 \fRChanging the Runpath of an Executable
 743  724  .sp
 744  725  .LP
 745  726  The following example presupposes an executable named \fBprog\fR, installed in
 746  727  a bin directory that has an adjacent lib directory for sharable objects. The
 747  728  following command sets the \fBrunpath\fR of that executable to the \fBlib\fR
↓ open down ↓ 111 lines elided ↑ open up ↑
 859  840  .in +2
 860  841  .nf
 861  842  % TYPE=`elfedit -r -osimple -e 'sym:st_type unlink' /lib/libc.so`
 862  843  % echo $TYPE
 863  844  STT_FUNC
 864  845  .fi
 865  846  .in -2
 866  847  .sp
 867  848  
 868  849  .SH ENVIRONMENT VARIABLES
 869      -.sp
 870  850  .ne 2
 871  851  .na
 872  852  \fB\fBELFEDIT_PATH\fR\fR
 873  853  .ad
 874  854  .RS 16n
 875  855  Alters the default module search path. Module search paths are discussed in the
 876  856  \fBModule Search Path\fR section of this manual page.
 877  857  .RE
 878  858  
 879  859  .sp
↓ open down ↓ 10 lines elided ↑ open up ↑
 890  870  .ne 2
 891  871  .na
 892  872  \fB\fBPAGER\fR\fR
 893  873  .ad
 894  874  .RS 16n
 895  875  Interactively delivers output from \fBelfedit\fR to the screen. If not set,
 896  876  \fBmore\fR is used. See \fBmore\fR(1).
 897  877  .RE
 898  878  
 899  879  .SH FILES
 900      -.sp
 901  880  .ne 2
 902  881  .na
 903  882  \fB\fB/usr/lib/elfedit\fR\fR
 904  883  .ad
 905  884  .RS 20n
 906  885  Default directory for \fBelfedit\fR modules that are loaded on demand to supply
 907  886  editing commands.
 908  887  .RE
 909  888  
 910  889  .sp
 911  890  .ne 2
 912  891  .na
 913  892  \fB\fB~/.teclarc\fR\fR
 914  893  .ad
 915  894  .RS 20n
 916  895  Personal \fBtecla\fR customization file for command line editing. See
 917  896  \fBtecla\fR(5).
 918  897  .RE
 919  898  
 920  899  .SH ATTRIBUTES
 921      -.sp
 922      -.LP
 923  900  See \fBattributes\fR(5) for descriptions of the following attributes:
 924  901  .sp
 925  902  
 926  903  .sp
 927  904  .TS
 928  905  box;
 929  906  c | c
 930  907  l | l .
 931  908  ATTRIBUTE TYPE  ATTRIBUTE VALUE
 932  909  _
 933  910  Interface Stability     Committed
 934  911  .TE
 935  912  
 936  913  .SH SEE ALSO
 937      -.sp
 938      -.LP
 939  914  \fBdump\fR(1), \fBelfdump\fR(1), \fBld.so.1\fR(1), \fBmore\fR(1), \fBnm\fR(1),
 940  915  \fBpvs\fR(1), \fBelf\fR(3ELF), \fBlibelf\fR(3LIB), \fBtecla\fR(5),
 941  916  \fBattributes\fR(5)
 942  917  .sp
 943  918  .LP
 944  919  \fILinker and Libraries Guide\fR
 945  920  .SH WARNINGS
 946      -.sp
 947      -.LP
 948  921  \fBelfedit\fR is designed to be a tool for testing and development of the ELF
 949  922  system. It offers the ability to examine and change nearly every piece of ELF
 950  923  metadata in the object. It quietly allows edits that can produce an invalid or
 951  924  unusable ELF file. The user is expected to have knowledge of the ELF format and
 952  925  of the rules and conventions that govern them. The \fILinker and Libraries
 953  926  Guide\fR can be helpful when using \fBelfedit\fR.
 954  927  .sp
 955  928  .LP
 956  929  \fBelfedit\fR allows the user to alter the ELF metadata in an object, but
 957  930  cannot understand or alter the code of the actual program. Setting ELF
 958  931  attributes such as types, sizes, alignments, and so forth in a manner that does
 959  932  not agree with the actual contents of the file is therefore likely to yield a
 960  933  broken and unusable output object. Such changes might be useful for testing of
 961  934  linker components, but should be avoided otherwise.
 962  935  .sp
 963  936  .LP
 964  937  Higher level operations, such as the use of the \fBdyn:runpath\fR command to
 965  938  change the \fBrunpath\fR of an object, are safe, and can be carried out without
 966  939  the sort of risk detailed in this section.
 967  940  .SH NOTES
 968      -.sp
 969      -.LP
 970  941  Not every ELF operation supported by \fBelfedit\fR can be successfully carried
 971  942  out on every ELF object. \fBelfedit\fR is constrained by the existing sections
 972  943  found in the file.
 973  944  .sp
 974  945  .LP
 975  946  One area of particular interest is that \fBelfedit\fR might not be able to
 976  947  modify the \fBrunpath\fR of a given object. To modify a \fBrunpath\fR, the
 977  948  following must be true:
 978  949  .RS +4
 979  950  .TP
↓ open down ↓ 62 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX