20c1c3551cb3b3117591ae38463d16aada597c48Rod Evans#
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evans# CDDL HEADER START
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evans#
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evans# The contents of this file are subject to the terms of the
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evans# Common Development and Distribution License (the "License").
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evans# You may not use this file except in compliance with the License.
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evans#
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evans# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evans# or http://www.opensolaris.org/os/licensing.
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evans# See the License for the specific language governing permissions
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evans# and limitations under the License.
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evans#
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evans# When distributing Covered Code, include this CDDL HEADER in each
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evans# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evans# If applicable, add the following below this CDDL HEADER, with the
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evans# fields enclosed by brackets "[]" replaced with your own identifying
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evans# information: Portions Copyright [yyyy] [name of copyright owner]
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evans#
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evans# CDDL HEADER END
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evans#
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evans#
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evans# Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved.
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evans#
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evans
20c1c3551cb3b3117591ae38463d16aada597c48Rod EvansThis directory contains sample programs that demonstrate how to use libelf.
20c1c3551cb3b3117591ae38463d16aada597c48Rod EvansManual pages for libelf routines are located in section 3e: Library Functions.
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evans
20c1c3551cb3b3117591ae38463d16aada597c48Rod EvansEach of these sample programs displays, or manipulates information from a ELF
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evansfile. Each program uses libelf differently. To learn more about ELF files
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evansand their format refer to the "Linker & Libraries Guide", which is part of the
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evans"Software Developer Collection", and the "System V Application Binary
20c1c3551cb3b3117591ae38463d16aada597c48Rod EvansInterface".
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evans
20c1c3551cb3b3117591ae38463d16aada597c48Rod EvansThe following source files are provided:
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evans
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evanspcom.c print comment: prints the .comment section of an ELF file.
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evans Demonstrates how to examine a file opened with
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evans elf_begin(ELF_C_READ)
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evans
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evansacom.c append comment: appends to, or creates a .comment section
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evans within an ELF file. Demonstrates the updating of a file with
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evans elf_begin(ELF_C_RDWR)
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evans
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evansdcom.c delete comment: deletes a .comment section from an ELF file.
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evans Demonstrates the creation of a ELF file with
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evans elf_begin(ELF_C_WRITE)
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evans
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evanstpcom.c threaded print comment: a threaded version of pcom.c.
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evans Demonstrates that libelf is MT-Safe and can be used by a
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evans threaded program.
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evans
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evansdispsyms.c print symbols: scans a ELF file for any symbol tables
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evans (SHT_SYMTAB, SHT_DYNSYM, or SHT_SUNW_LDYNSYM) and
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evans displays the symbol tables contents.
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evans
20c1c3551cb3b3117591ae38463d16aada597c48Rod EvansMakefile make file to build the above programs.
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evans
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evans
20c1c3551cb3b3117591ae38463d16aada597c48Rod EvansBuilding the demos
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evans------------------
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evans
20c1c3551cb3b3117591ae38463d16aada597c48Rod EvansTo build the programs:
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evans
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evans % make all
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evans
20c1c3551cb3b3117591ae38463d16aada597c48Rod EvansTo test the programs:
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evans
20c1c3551cb3b3117591ae38463d16aada597c48Rod Evans % make test