4 * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
5 * See included license file for license details.
7 #if !defined(_GHSSecInfo_h_)
10 #include "StELFFile.h"
11 #include "smart_ptr.h"
17 * \brief Wrapper around the GHS-specific .secinfo ELF section.
19 * ELF files produced by the Green Hills MULTI toolset will have a
20 * special .secinfo section. For the most part, this section contains
22 * ranges that should be filled by the C runtime startup code. The
23 * address ranges correspond to those of ELF sections whose type is
24 * #SHT_NOBITS. The GHS runtime uses this table instead of just filling
25 * all #SHT_NOBITS sections because the linker command file can
26 * be used to optionally not fill individual sections.
28 * The isSectionFilled() methods let calling code determine if an ELF
29 * section is found in the .secinfo table. If the section is found,
30 * then it should be filled.
35 //! \brief Default constructor.
36 GHSSecInfo(StELFFile * elf);
38 //! \brief Returns true if there is a .secinfo section present in the ELF file.
39 bool hasSecinfo() const { return m_hasInfo; }
41 //! \brief Determines if a section should be filled.
42 bool isSectionFilled(uint32_t addr, uint32_t length);
44 //! \brief Determines if \a section should be filled.
45 bool isSectionFilled(const Elf32_Shdr & section);
52 * \brief The structure of one .secinfo entry.
56 uint32_t m_clearAddr; //!< Address to start filling from.
57 uint32_t m_clearValue; //!< Value to fill with.
58 uint32_t m_numBytesToClear; //!< Number of bytes to fill.
64 StELFFile * m_elf; //!< The parser object for our ELF file.
65 bool m_hasInfo; //!< Whether .secinfo is present in the ELF file.
66 smart_array_ptr<ghs_secinfo_t> m_info; //!< Pointer to the .secinfo entries. Will be NULL if there is no .secinfo section in the file.
67 unsigned m_entryCount; //!< Number of entries in #m_info.
70 }; // namespace elftosb
72 #endif // _GHSSecInfo_h_