2#ifndef ROSE_SgAsmElfFileHeader_H
3#define ROSE_SgAsmElfFileHeader_H
5#include <Cxx_GrammarDeclarations.h>
6#include <SgAsmGenericHeader.h>
27#include <Rose/BinaryAnalysis/ByteOrder.h>
34#if !defined(DOCUMENTATION)
49#ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
51 friend class boost::serialization::access;
57 s & BOOST_SERIALIZATION_NVP(p_e_ident_file_class);
58 s & BOOST_SERIALIZATION_NVP(p_e_ident_data_encoding);
59 s & BOOST_SERIALIZATION_NVP(p_e_ident_file_version);
60 s & BOOST_SERIALIZATION_NVP(p_e_ident_padding);
61 s & BOOST_SERIALIZATION_NVP(p_e_type);
62 s & BOOST_SERIALIZATION_NVP(p_e_machine);
63 s & BOOST_SERIALIZATION_NVP(p_e_flags);
64 s & BOOST_SERIALIZATION_NVP(p_e_ehsize);
65 s & BOOST_SERIALIZATION_NVP(p_phextrasz);
66 s & BOOST_SERIALIZATION_NVP(p_e_phnum);
67 s & BOOST_SERIALIZATION_NVP(p_shextrasz);
68 s & BOOST_SERIALIZATION_NVP(p_e_shnum);
69 s & BOOST_SERIALIZATION_NVP(p_e_shstrndx);
70 s & BOOST_SERIALIZATION_NVP(p_sectionTable);
71 s & BOOST_SERIALIZATION_NVP(p_segmentTable);
107 struct Elf32FileHeader_disk {
108 unsigned char e_ident_magic[4];
109 unsigned char e_ident_file_class;
110 unsigned char e_ident_data_encoding;
111 unsigned char e_ident_file_version;
112 unsigned char e_ident_padding[9];
121 uint16_t e_phentsize;
123 uint16_t e_shentsize;
127#if !defined(SWIG) && !defined(_MSC_VER)
128 __attribute__((packed))
132 struct Elf64FileHeader_disk {
133 unsigned char e_ident_magic[4];
134 unsigned char e_ident_file_class;
135 unsigned char e_ident_data_encoding;
136 unsigned char e_ident_file_version;
137 unsigned char e_ident_padding[9];
146 uint16_t e_phentsize;
148 uint16_t e_shentsize;
152#if !defined(SWIG) && !defined(_MSC_VER)
153 __attribute__((packed))
171 unsigned char const& get_e_ident_file_class()
const;
172 void set_e_ident_file_class(
unsigned char const&);
181 unsigned char const& get_e_ident_data_encoding()
const;
182 void set_e_ident_data_encoding(
unsigned char const&);
191 unsigned char const& get_e_ident_file_version()
const;
192 void set_e_ident_file_version(
unsigned char const&);
201 SgUnsignedCharList
const& get_e_ident_padding()
const;
202 void set_e_ident_padding(SgUnsignedCharList
const&);
211 unsigned long const& get_e_type()
const;
212 void set_e_type(
unsigned long const&);
221 unsigned long const& get_e_machine()
const;
222 void set_e_machine(
unsigned long const&);
231 unsigned long const& get_e_flags()
const;
232 void set_e_flags(
unsigned long const&);
241 unsigned long const& get_e_ehsize()
const;
242 void set_e_ehsize(
unsigned long const&);
251 unsigned long const& get_phextrasz()
const;
252 void set_phextrasz(
unsigned long const&);
261 unsigned long const& get_e_phnum()
const;
262 void set_e_phnum(
unsigned long const&);
271 unsigned long const& get_shextrasz()
const;
272 void set_shextrasz(
unsigned long const&);
281 unsigned long const& get_e_shnum()
const;
282 void set_e_shnum(
unsigned long const&);
291 unsigned long const& get_e_shstrndx()
const;
292 void set_e_shstrndx(
unsigned long const&);
334 uint64_t maximumPageSize();
352 virtual void unparse(std::ostream&)
const override;
355 virtual void dump(FILE*,
const char *prefix, ssize_t idx)
const override;
361 SgAsmGenericSectionPtrList get_sectionTableSections();
364 SgAsmGenericSectionPtrList get_segmentTableSections();
367 virtual const char *
formatName()
const override;
381 uint64_t max_page_size() ROSE_DEPRECATED("use maximumPageSize");
385 SgAsmGenericSectionPtrList get_sectab_sections() ROSE_DEPRECATED("use get_sectionTableSections");
386 SgAsmGenericSectionPtrList get_segtab_sections() ROSE_DEPRECATED("use get_segmentTableSections");
387 virtual const
char *format_name() const override ROSE_DEPRECATED("use formatName");
403 void initializeProperties();
422 virtual std::
string class_name() const override;
425 virtual VariantT variantT() const override;
430 enum { static_variant = V_SgAsmElfFileHeader };
445 static const unsigned pool_size;
447 static std::vector<unsigned char *> pools;
452 static unsigned long initializeStorageClassArray(SgAsmElfFileHeaderStorageClass *);
455 static void clearMemoryPool();
456 static void deleteMemoryPool();
459 static void extendMemoryPoolForFileIO();
464 static SgAsmElfFileHeader * getPointerFromGlobalIndex(AstSpecificDataManagingClass *,
unsigned long);
467 static unsigned long getNumberOfValidNodesAndSetGlobalIndexInFreepointer(
unsigned long);
469 static void resetValidFreepointers();
471 static unsigned long getNumberOfLastValidPointer();
474#if defined(INLINE_FUNCTIONS)
476 inline void *
operator new (
size_t size);
479 void *
operator new (
size_t size);
482 void operator delete (
void* pointer,
size_t size);
485 void operator delete (
void* pointer)
531#ifndef ROSE_USE_INTERNAL_FRONTEND_DEVELOPMENT
534 virtual RTIReturnType
roseRTI()
override;
548 virtual const char*
sage_class_name() const override ROSE_DEPRECATED_FUNCTION;
554 virtual int variant() const ROSE_DEPRECATED_FUNCTION;
736 friend class SgAsmElfFileHeaderStorageClass;
739 friend class AstSpecificDataManagingClass;
742 friend class AstSpecificDataManagingClassStorageClass;
774#define BUILD_ATERM_SUPPORT 0
775 #if BUILD_ATERM_SUPPORT
776 #ifdef ROSE_USE_ROSE_ATERM_SUPPORT
788 virtual ATerm generate_ATerm()
override;
791 virtual void generate_ATerm_Annotation(ATerm & term)
override;
831unsigned char p_e_ident_file_class;
835unsigned char p_e_ident_data_encoding;
839unsigned char p_e_ident_file_version;
843SgUnsignedCharList p_e_ident_padding;
847unsigned long p_e_type;
851unsigned long p_e_machine;
855unsigned long p_e_flags;
859unsigned long p_e_ehsize;
863unsigned long p_phextrasz;
867unsigned long p_e_phnum;
871unsigned long p_shextrasz;
875unsigned long p_e_shnum;
879unsigned long p_e_shstrndx;
Class holding static data and functions supporting File I/O.
Attribute containing a regex expression as a string.
Represents an ELF section table.
Represents an ELF segment table.
Base class for binary files.
virtual SgAsmGenericSection * parse()
Parse contents of the section.
Supporting class from copy mechanism within ROSE.
This class represents the base class for all IR nodes within Sage III.
virtual size_t get_numberOfTraversalSuccessors()
return number of children in the traversal successor list
virtual RTIReturnType roseRTI()
return C++ Runtime-Time-Information
virtual std::vector< std::string > get_traversalSuccessorNamesContainer()
container of names of variables or container indices used used in the traversal to access AST success...
virtual void debugSerializationEnd(const char *className)
Called by generated serializers.
static std::string getNodeIdString(SgNode *sgnode)
compute the NodeId for a particular SgNode*.
virtual bool isInMemoryPool()
FOR INTERNAL USE This is used in internal tests to verify that all IR nodes are allocated from the he...
int variant() const
Older version function returns enum value "NODE".
virtual void processDataMemberReferenceToPointers(ReferenceToPointerHandler *)
FOR INTERNAL USE Processes pairs of references to SgNode* and strings for use in AST tools
virtual long getChildIndex(SgNode *childNode) const
FOR INTERNAL USE Returns a unique index value for the childNode in the list of children at this IR no...
virtual size_t get_childIndex(SgNode *child)
index-based access to traversal successors by child node
virtual void debugSerializationBegin(const char *className)
Called by generated serializers.
virtual std::vector< SgNode * > get_traversalSuccessorContainer()
container of pointers to AST successor nodes used in the traversal overridden in every class by gener...
static void visitRepresentativeNode(ROSE_VisitTraversal &visit)
FOR INTERNAL USE Support for type-based traversal.
virtual void checkDataMemberPointersIfInMemoryPool()
FOR INTERNAL USE This is used in internal tests to verify that all IR nodes are allocated from the he...
static size_t numberOfNodes()
Returns the total number of IR nodes of this type.
virtual void accept(ROSE_VisitorPattern &visitor)
support for the classic visitor pattern done in GoF
virtual SgNode * get_traversalSuccessorByIndex(size_t idx)
index-based access to traversal successors by index number
static void traverseMemoryPoolVisitorPattern(ROSE_VisitorPattern &visitor)
FOR INTERNAL USE Support for visitor pattern.
void executeVisitorMemberFunction(ROSE_VisitorPattern &visitor)
FOR INTERNAL USE Support for visitor pattern.
static SgNode * getNodeByNodeId(VariantT variantT, size_t poolIdx, size_t itemIdx)
Find a node by its variant type, pool index, and item index.
static size_t memoryUsage()
Returns the size in bytes of the total memory allocated for all IR nodes of this type.
static void traverseMemoryPoolNodes(ROSE_VisitTraversal &visit)
FOR INTERNAL USE Support for visitor pattern over all IR nodes by type of IR node.
virtual const char * sage_class_name() const
generates string representing the class name: (e.g. for SgNode returns "SgNode").
virtual std::vector< std::pair< SgNode *, std::string > > returnDataMemberPointers() const
FOR INTERNAL USE Returns STL vector of pairs of SgNode* and strings for use in AST tools
static SgNode * getNodeByNodeIdInternal(size_t poolIdx, size_t itemIdx)
FOR INTERNAL USE Find an SgNode from its memory pool and location therin.
SgNode * addRegExpAttribute(std::string s, AstRegExAttribute *a)
Support for AST matching using regular expression.
void serialize(std::ostream &output, Graph &graph)
Serialize a graph into a stream of bytes.
void copy(const Word *src, const BitRange &srcRange, Word *dst, const BitRange &dstRange)
Copy some bits.