// For each object with merge sections, we store an Object_merge_map.
// This is used to map locations in input sections to a merged output
// section. The output section itself is not recorded here--it can be
-// found in the map_to_output_ field of the Object.
+// found in the output_sections_ field of the Object.
class Object_merge_map
{
: Output_section_data(addralign), merge_map_(), entsize_(entsize)
{ }
+ // Return the entry size.
+ uint64_t
+ entsize() const
+ { return this->entsize_; }
+
+ // Whether this is a merge string section. This is only true of
+ // Output_merge_string.
+ bool
+ is_string()
+ { return this->do_is_string(); }
+
protected:
// Return the output offset for an input offset.
bool
bool
do_is_merge_section_for(const Relobj*, unsigned int shndx) const;
- // Return the entry size.
- uint64_t
- entsize() const
- { return this->entsize_; }
-
// Add a mapping from an OFFSET in input section SHNDX in object
// OBJECT to an OUTPUT_OFFSET in the output section. OUTPUT_OFFSET
// is the offset from the start of the merged data in the output
this->merge_map_.add_mapping(object, shndx, offset, length, output_offset);
}
+ // This may be overriden by the child class.
+ virtual bool
+ do_is_string()
+ { return false; }
+
private:
// A mapping from input object/section/offset to offset in output
// section.
void
do_write_to_buffer(unsigned char*);
+ // Write to a map file.
+ void
+ do_print_to_mapfile(Mapfile* mapfile) const
+ { mapfile->print_output_data(this, _("** merge constants")); }
+
// Print merge stats to stderr.
void
do_print_merge_stats(const char* section_name);
void
do_write_to_buffer(unsigned char*);
+ // Write to a map file.
+ void
+ do_print_to_mapfile(Mapfile* mapfile) const
+ { mapfile->print_output_data(this, _("** merge strings")); }
+
// Print merge stats to stderr.
void
do_print_merge_stats(const char* section_name);
clear_stringpool()
{ this->stringpool_.clear(); }
+ // Whether this is a merge string section.
+ virtual bool
+ do_is_string()
+ { return true; }
+
private:
// The name of the string type, for stats.
const char*