1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmELF.h,v $
6 Date: $Date: 2008-03-02 21:19:40 $
7 Version: $Revision: 1.4 $
9 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
10 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
16 =========================================================================*/
20 #if !defined(CMAKE_USE_ELF_PARSER)
21 # error "This file may be included only if CMAKE_USE_ELF_PARSER is enabled."
27 * \brief Executable and Link Format (ELF) parser.
32 /** Construct with the name of the ELF input file to parse. */
33 cmELF(const char* fname
);
38 /** Get the error message if any. */
39 std::string
const& GetErrorMessage() const
41 return this->ErrorMessage
;
44 /** Boolean conversion. True if the ELF file is valid. */
45 operator bool() const { return this->Valid(); }
47 /** Enumeration of ELF file types. */
51 FileTypeRelocatableObject
,
53 FileTypeSharedLibrary
,
59 /** Represent string table entries. */
62 // The string value itself.
65 // The position in the file at which the string appears.
66 unsigned long Position
;
68 // The size of the string table entry. This includes the space
69 // allocated for one or more null terminators.
73 /** Get the type of the file opened. */
74 FileType
GetFileType() const;
76 /** Get the number of ELF sections present. */
77 unsigned int GetNumberOfSections() const;
79 /** Get the SONAME field if any. */
80 bool GetSOName(std::string
& soname
);
81 StringEntry
const* GetSOName();
83 /** Get the RPATH field if any. */
84 StringEntry
const* GetRPath();
86 /** Get the RUNPATH field if any. */
87 StringEntry
const* GetRunPath();
89 /** Print human-readable information about the ELF file. */
90 void PrintInfo(std::ostream
& os
) const;
93 friend class cmELFInternal
;
95 cmELFInternal
* Internal
;
96 std::string ErrorMessage
;