16 #ifndef PSTORE_MCREPO_BSS_SECTION_HPP 17 #define PSTORE_MCREPO_BSS_SECTION_HPP 20 #include "pstore/mcrepo/repo_error.hpp" 21 #include "pstore/support/gsl.hpp" 33 using size_type = std::uint32_t;
38 PSTORE_STATIC_ASSERT (std::is_standard_layout<bss_section>::value);
39 PSTORE_STATIC_ASSERT (offsetof (
bss_section, field64_) == 0);
43 PSTORE_ASSERT (bit_count::pop_count (align) == 1);
44 align_ = bit_count::ctz (align);
45 PSTORE_STATIC_ASSERT (decltype (
size_)::last_bit - decltype (
size_)::first_bit ==
46 sizeof (size_type) * 8);
58 unsigned align ()
const noexcept {
return 1U <<
align_.value (); }
59 size_type size ()
const noexcept {
return static_cast<size_type
> (
size_.value ()); }
69 std::uint64_t field64_ = 0;
80 inline unsigned section_alignment<pstore::repo::bss_section> (
82 return section.align ();
87 return section.size ();
109 PSTORE_ASSERT (kind == section_kind::bss);
127 std::uint8_t * write (std::uint8_t * out)
const final;
132 std::uintptr_t aligned_impl (std::uintptr_t in)
const final;
135 PSTORE_ASSERT (sec->ifixups.empty () && sec->xfixups.empty ());
136 if (sec->data.size () > std::numeric_limits<bss_section::size_type>::max ()) {
137 raise (error_code::bss_section_too_large);
167 unsigned align ()
const final {
return b_.align (); }
168 std::size_t size ()
const final {
return b_.size (); }
186 #endif // PSTORE_MCREPO_BSS_SECTION_HPP Declares the generic section.
A simple wrapper around the elements of one of the three arrays that make up a section.
Definition: section.hpp:152
Maps from the type of data that is associated with a fragment's section to a "dispatcher" subclass wh...
Definition: section.hpp:146
bit_field< std::uint64_t, 8, 32 > size_
The number of bytes in the BSS section's data payload.
Definition: bss_section.hpp:75
This class is used to add virtual methods to a fragment's section.
Definition: section.hpp:195
An empty class used as the base type for all sections.
Definition: section.hpp:69
bss_section(unsigned const align, size_type const size)
Definition: bss_section.hpp:37
Maps from the type of data that is associated with a fragment's section to a "dispatcher" subclass wh...
Definition: section.hpp:214
container< std::uint8_t > payload() const final
Return the data section stored in the object file.
Definition: bss_section.hpp:171
bit_field< std::uint64_t, 0, 8 > align_
The alignment of this section expressed as a power of two (i.e.
Definition: bss_section.hpp:73
Definition: bss_section.hpp:95
Definition: bss_section.hpp:31
Definition: bss_section.hpp:152
Definition: nonpod2.cpp:40
Definition: generic_section.hpp:386
static std::size_t size_bytes() noexcept
Returns the number of bytes occupied by this section.
Definition: bss_section.hpp:65
A section creation dispatcher is used to instantiate and construct each of a fragment's sections in p...
Definition: section.hpp:91