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