xref: /illumos-gate/usr/src/cmd/sgs/libelf/demo/00README (revision 20c1c355)
1*20c1c355SRod Evans#
2*20c1c355SRod Evans# CDDL HEADER START
3*20c1c355SRod Evans#
4*20c1c355SRod Evans# The contents of this file are subject to the terms of the
5*20c1c355SRod Evans# Common Development and Distribution License (the "License").
6*20c1c355SRod Evans# You may not use this file except in compliance with the License.
7*20c1c355SRod Evans#
8*20c1c355SRod Evans# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*20c1c355SRod Evans# or http://www.opensolaris.org/os/licensing.
10*20c1c355SRod Evans# See the License for the specific language governing permissions
11*20c1c355SRod Evans# and limitations under the License.
12*20c1c355SRod Evans#
13*20c1c355SRod Evans# When distributing Covered Code, include this CDDL HEADER in each
14*20c1c355SRod Evans# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*20c1c355SRod Evans# If applicable, add the following below this CDDL HEADER, with the
16*20c1c355SRod Evans# fields enclosed by brackets "[]" replaced with your own identifying
17*20c1c355SRod Evans# information: Portions Copyright [yyyy] [name of copyright owner]
18*20c1c355SRod Evans#
19*20c1c355SRod Evans# CDDL HEADER END
20*20c1c355SRod Evans#
21*20c1c355SRod Evans#
22*20c1c355SRod Evans# Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved.
23*20c1c355SRod Evans#
24*20c1c355SRod Evans
25*20c1c355SRod EvansThis directory contains sample programs that demonstrate how to use libelf.
26*20c1c355SRod EvansManual pages for libelf routines are located in section 3e: Library Functions.
27*20c1c355SRod Evans
28*20c1c355SRod EvansEach of these sample programs displays, or manipulates information from a ELF
29*20c1c355SRod Evansfile.  Each program uses libelf differently.  To learn more about ELF files
30*20c1c355SRod Evansand their format refer to the "Linker & Libraries Guide", which is part of the
31*20c1c355SRod Evans"Software Developer Collection", and the "System V Application Binary
32*20c1c355SRod EvansInterface".
33*20c1c355SRod Evans
34*20c1c355SRod EvansThe following source files are provided:
35*20c1c355SRod Evans
36*20c1c355SRod Evanspcom.c		print comment: prints the .comment section of an ELF file.
37*20c1c355SRod Evans		Demonstrates how to examine a file opened with
38*20c1c355SRod Evans		elf_begin(ELF_C_READ)
39*20c1c355SRod Evans
40*20c1c355SRod Evansacom.c		append comment: appends to, or creates a .comment section
41*20c1c355SRod Evans		within an ELF file.  Demonstrates the updating of a file with
42*20c1c355SRod Evans		elf_begin(ELF_C_RDWR)
43*20c1c355SRod Evans
44*20c1c355SRod Evansdcom.c		delete comment: deletes a .comment section from an ELF file.
45*20c1c355SRod Evans		Demonstrates the creation of a ELF file with
46*20c1c355SRod Evans		elf_begin(ELF_C_WRITE)
47*20c1c355SRod Evans
48*20c1c355SRod Evanstpcom.c		threaded print comment:  a threaded version of pcom.c.
49*20c1c355SRod Evans		Demonstrates that libelf is MT-Safe and can be used by a
50*20c1c355SRod Evans		threaded program.
51*20c1c355SRod Evans
52*20c1c355SRod Evansdispsyms.c	print symbols:  scans a ELF file for any symbol tables
53*20c1c355SRod Evans		(SHT_SYMTAB, SHT_DYNSYM, or SHT_SUNW_LDYNSYM) and
54*20c1c355SRod Evans		displays the symbol tables contents.
55*20c1c355SRod Evans
56*20c1c355SRod EvansMakefile	make file to build the above programs.
57*20c1c355SRod Evans
58*20c1c355SRod Evans
59*20c1c355SRod EvansBuilding the demos
60*20c1c355SRod Evans------------------
61*20c1c355SRod Evans
62*20c1c355SRod EvansTo build the programs:
63*20c1c355SRod Evans
64*20c1c355SRod Evans  % make all
65*20c1c355SRod Evans
66*20c1c355SRod EvansTo test the programs:
67*20c1c355SRod Evans
68*20c1c355SRod Evans  % make test
69