MIPS/GAS: Use non-zero frag offset directly in PIC branch relaxation
[deliverable/binutils-gdb.git] / gold / target.h
index 27e8a2ecdf400f8d0722be1a4e5af333cdb77879..5ca8435c5ba1a18e900db94208576733c47cc586 100644 (file)
@@ -1,6 +1,6 @@
 // target.h -- target support for gold   -*- C++ -*-
 
-// Copyright (C) 2006-2016 Free Software Foundation, Inc.
+// Copyright (C) 2006-2017 Free Software Foundation, Inc.
 // Written by Ian Lance Taylor <iant@google.com>.
 
 // This file is part of gold.
@@ -119,9 +119,19 @@ class Target
   { return this->pti_->dynamic_linker; }
 
   // Return the default address to use for the text segment.
+  // If a -z max-page-size argument has set the ABI page size
+  // to a value larger than the default starting address,
+  // bump the starting address up to the page size, to avoid
+  // misaligning the text segment in the file.
   uint64_t
   default_text_segment_address() const
-  { return this->pti_->default_text_segment_address; }
+  {
+    uint64_t addr = this->pti_->default_text_segment_address;
+    uint64_t pagesize = this->abi_pagesize();
+    if (addr < pagesize)
+      addr = pagesize;
+    return addr;
+  }
 
   // Return the ABI specified page size.
   uint64_t
@@ -321,13 +331,15 @@ class Target
   ehframe_datarel_base() const
   { return this->do_ehframe_datarel_base(); }
 
-  // Return true if a reference to SYM from a reloc of type R_TYPE
+  // Return true if a reference to SYM from a reloc at *PRELOC
   // means that the current function may call an object compiled
   // without -fsplit-stack.  SYM is known to be defined in an object
   // compiled without -fsplit-stack.
   bool
-  is_call_to_non_split(const Symbol* sym, unsigned int r_type) const
-  { return this->do_is_call_to_non_split(sym, r_type); }
+  is_call_to_non_split(const Symbol* sym, const unsigned char* preloc,
+                      const unsigned char* view,
+                      section_size_type view_size) const
+  { return this->do_is_call_to_non_split(sym, preloc, view, view_size); }
 
   // A function starts at OFFSET in section SHNDX in OBJECT.  That
   // function was compiled with -fsplit-stack, but it refers to a
@@ -661,7 +673,8 @@ class Target
   // default implementation is that any function not defined by the
   // ABI is a call to a non-split function.
   virtual bool
-  do_is_call_to_non_split(const Symbol* sym, unsigned int) const;
+  do_is_call_to_non_split(const Symbol* sym, const unsigned char*,
+                         const unsigned char*, section_size_type) const;
 
   // Virtual function which may be overridden by the child class.
   virtual void
@@ -831,7 +844,7 @@ class Sized_target : public Target
   // symbol table.  This will only be called if has_make_symbol()
   // returns true.
   virtual Sized_symbol<size>*
-  make_symbol() const
+  make_symbol(const char*, elfcpp::STT, Object*, unsigned int, uint64_t)
   { gold_unreachable(); }
 
   // Resolve a symbol for the target.  This should be overridden by a
@@ -926,6 +939,22 @@ class Sized_target : public Target
                          const unsigned char* plocal_symbols,
                          Relocatable_relocs*) = 0;
 
+  // Scan the relocs for --emit-relocs.  The parameters are
+  // like scan_relocatable_relocs.
+  virtual void
+  emit_relocs_scan(Symbol_table* symtab,
+                  Layout* layout,
+                  Sized_relobj_file<size, big_endian>* object,
+                  unsigned int data_shndx,
+                  unsigned int sh_type,
+                  const unsigned char* prelocs,
+                  size_t reloc_count,
+                  Output_section* output_section,
+                  bool needs_special_offset_handling,
+                  size_t local_symbol_count,
+                  const unsigned char* plocal_syms,
+                  Relocatable_relocs* rr) = 0;
+
   // Emit relocations for a section during a relocatable link, and for
   // --emit-relocs.  The parameters are like relocate_section, with
   // additional parameters for the view of the output reloc section.
@@ -1084,6 +1113,19 @@ class Sized_target : public Target
                              dst_obj, dst_shndx, dst_off);
   }
 
+  // Return the r_sym field from a relocation.
+  // Most targets can use the default version of this routine,
+  // but some targets have a non-standard r_info field, and will
+  // need to provide a target-specific version.
+  virtual unsigned int
+  get_r_sym(const unsigned char* preloc) const
+  {
+    // Since REL and RELA relocs share the same structure through
+    // the r_info field, we can just use REL here.
+    elfcpp::Rel<size, big_endian> rel(preloc);
+    return elfcpp::elf_r_sym<size>(rel.get_r_info());
+  }
+
  protected:
   Sized_target(const Target::Target_info* pti)
     : Target(pti)
This page took 0.024106 seconds and 4 git commands to generate.