Use nops when doing alignment padding between code sections.

This commit is contained in:
Ian Lance Taylor
2007-09-21 05:31:19 +00:00
parent ec51df9f10
commit c51e6221b8
5 changed files with 173 additions and 8 deletions

View File

@@ -63,6 +63,11 @@ class Target
has_resolve() const
{ return this->pti_->has_resolve; }
// Whether this target has a specific code fill function.
bool
has_code_fill() const
{ return this->pti_->has_code_fill; }
// Return the default name of the dynamic linker.
const char*
dynamic_linker() const
@@ -89,6 +94,13 @@ class Target
finalize_sections(const General_options* options, Layout* layout)
{ return this->do_finalize_sections(options, layout); }
// Return a string to use to fill out a code section. This is
// basically one or more NOPS which must fill out the specified
// length in bytes.
std::string
code_fill(off_t length)
{ return this->do_code_fill(length); }
protected:
// This struct holds the constant information for a child class. We
// use a struct to avoid the overhead of virtual function calls for
@@ -105,6 +117,8 @@ class Target
bool has_make_symbol;
// Whether this target has a specific resolve function.
bool has_resolve;
// Whether this target has a specific code fill function.
bool has_code_fill;
// The default dynamic linker name.
const char* dynamic_linker;
// The default text segment address.
@@ -124,6 +138,12 @@ class Target
do_finalize_sections(const General_options*, Layout*)
{ }
// Virtual function which must be implemented by the child class if
// needed.
virtual std::string
do_code_fill(off_t)
{ gold_unreachable(); }
private:
Target(const Target&);
Target& operator=(const Target&);