aboutsummaryrefslogtreecommitdiff
path: root/gold/target.h
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>2011-06-28 22:25:14 +0000
committerIan Lance Taylor <ian@airs.com>2011-06-28 22:25:14 +0000
commit200b2bb9e8930d9d47fa5f378cf595328ee9c9bc (patch)
tree57dd95b99e99a1306e2503f90771d01f1e71d518 /gold/target.h
parentb3ce541e970466431bf6abfa8ad58424a1d1a7ec (diff)
downloadgdb-200b2bb9e8930d9d47fa5f378cf595328ee9c9bc.zip
gdb-200b2bb9e8930d9d47fa5f378cf595328ee9c9bc.tar.gz
gdb-200b2bb9e8930d9d47fa5f378cf595328ee9c9bc.tar.bz2
* target.h (class Target): Add osabi_ field.
(Target::osabi): New function. (Target::set_osabi): New function. (Target::Target): Initialize osabi_. (Target::do_adjust_elf_header): Make pure virtual. (Sized_target::do_adjust_elf_header): Declare. * target.cc (Sized_target::do_adjust_elf_header): New function. (class Sized_target): Instantiate all versions. * freebsd.h (class Target_freebsd): Remove. (Target_selector_freebsd::do_recognize): Call set_osabi on Target. (Target_selector_freebsd::do_recognize_by_name): Likewise. (Target_selector_freebsd::set_osabi): Remove. * i386.cc (class Target_i386): Inherit from Sized_target rather than Target_freebsd. * x86_64.cc (class Target_x86_64): Likewise.
Diffstat (limited to 'gold/target.h')
-rw-r--r--gold/target.h27
1 files changed, 23 insertions, 4 deletions
diff --git a/gold/target.h b/gold/target.h
index 1d523b8..f9b8c04 100644
--- a/gold/target.h
+++ b/gold/target.h
@@ -375,6 +375,17 @@ class Target
select_as_default_target()
{ this->do_select_as_default_target(); }
+ // Return the value to store in the EI_OSABI field in the ELF
+ // header.
+ elfcpp::ELFOSABI
+ osabi() const
+ { return this->osabi_; }
+
+ // Set the value to store in the EI_OSABI field in the ELF header.
+ void
+ set_osabi(elfcpp::ELFOSABI osabi)
+ { this->osabi_ = osabi; }
+
protected:
// This struct holds the constant information for a child class. We
// use a struct to avoid the overhead of virtual function calls for
@@ -427,7 +438,7 @@ class Target
Target(const Target_info* pti)
: pti_(pti), processor_specific_flags_(0),
- are_processor_specific_flags_set_(false)
+ are_processor_specific_flags_set_(false), osabi_(elfcpp::ELFOSABI_NONE)
{ }
// Virtual function which may be implemented by the child class.
@@ -459,10 +470,10 @@ class Target
// Adjust the output file header before it is written out. VIEW
// points to the header in external form. LEN is the length, and
// will be one of the values of elfcpp::Elf_sizes<size>::ehdr_size.
- // By default, we do nothing.
+ // By default, we set the EI_OSABI field if requested (in
+ // Sized_target).
virtual void
- do_adjust_elf_header(unsigned char*, int) const
- { }
+ do_adjust_elf_header(unsigned char*, int) const = 0;
// Virtual function which may be overridden by the child class.
virtual bool
@@ -622,6 +633,10 @@ class Target
elfcpp::Elf_Word processor_specific_flags_;
// Whether the processor-specific flags are set at least once.
bool are_processor_specific_flags_set_;
+ // If not ELFOSABI_NONE, the value to put in the EI_OSABI field of
+ // the ELF header. This is handled at this level because it is
+ // OS-specific rather than processor-specific.
+ elfcpp::ELFOSABI osabi_;
};
// The abstract class for a specific size and endianness of target.
@@ -873,6 +888,10 @@ class Sized_target : public Target
gold_assert(pti->size == size);
gold_assert(pti->is_big_endian ? big_endian : !big_endian);
}
+
+ // Set the EI_OSABI field if requested.
+ virtual void
+ do_adjust_elf_header(unsigned char*, int) const;
};
} // End namespace gold.