diff options
Diffstat (limited to 'gold/target.cc')
-rw-r--r-- | gold/target.cc | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/gold/target.cc b/gold/target.cc index d971cff..b129b59 100644 --- a/gold/target.cc +++ b/gold/target.cc @@ -23,6 +23,7 @@ #include "gold.h" #include "target.h" #include "dynobj.h" +#include "elfcpp.h" namespace gold { @@ -135,4 +136,50 @@ Target::do_make_elf_object(const std::string& name, Input_file* input_file, } #endif +// Default conversion for -fsplit-stack is to give an error. + +void +Target::do_calls_non_split(Relobj* object, unsigned int, section_offset_type, + section_size_type, unsigned char*, section_size_type, + std::string*, std::string*) const +{ + static bool warned; + if (!warned) + { + gold_error(_("linker does not include stack split support " + "required by %s"), + object->name().c_str()); + warned = true; + } +} + +// Return whether BYTES/LEN matches VIEW/VIEW_SIZE at OFFSET. + +bool +Target::match_view(const unsigned char* view, section_size_type view_size, + section_offset_type offset, const char* bytes, + size_t len) const +{ + if (offset + len > view_size) + return false; + return memcmp(view + offset, bytes, len) == 0; +} + +// Set the contents of a VIEW/VIEW_SIZE to nops starting at OFFSET +// for LEN bytes. + +void +Target::set_view_to_nop(unsigned char* view, section_size_type view_size, + section_offset_type offset, size_t len) const +{ + gold_assert(offset >= 0 && offset + len <= view_size); + if (!this->has_code_fill()) + memset(view + offset, 0, len); + else + { + std::string fill = this->code_fill(len); + memcpy(view + offset, fill.data(), len); + } +} + } // End namespace gold. |