#ifndef GOLD_RELOC_H
#define GOLD_RELOC_H
+#include <vector>
#include <byteswap.h>
+#include "elfcpp.h"
#include "workqueue.h"
namespace gold
{
class General_options;
+class Object;
class Relobj;
class Read_relocs_data;
class Symbol;
class Layout;
+class Output_section;
template<int size>
class Sized_symbol;
// The standard Task methods.
- Is_runnable_type
- is_runnable(Workqueue*);
+ Task_token*
+ is_runnable();
- Task_locker*
- locks(Workqueue*);
+ void
+ locks(Task_locker*);
void
run(Workqueue*);
+ std::string
+ get_name() const;
+
private:
const General_options& options_;
Symbol_table* symtab_;
// The standard Task methods.
- Is_runnable_type
- is_runnable(Workqueue*);
+ Task_token*
+ is_runnable();
- Task_locker*
- locks(Workqueue*);
+ void
+ locks(Task_locker*);
void
run(Workqueue*);
- private:
- class Scan_relocs_locker;
+ std::string
+ get_name() const;
+ private:
const General_options& options_;
Symbol_table* symtab_;
Layout* layout_;
// The standard Task methods.
- Is_runnable_type
- is_runnable(Workqueue*);
+ Task_token*
+ is_runnable();
- Task_locker*
- locks(Workqueue*);
+ void
+ locks(Task_locker*);
void
run(Workqueue*);
- private:
- class Relocate_locker;
+ std::string
+ get_name() const;
+ private:
const General_options& options_;
const Symbol_table* symtab_;
const Layout* layout_;
// index of the section to which the reloc is being applied.
void
save(Symbol* sym, Relobj*, unsigned int shndx,
- const elfcpp::Rel<size, big_endian>&);
+ Output_section* output_section, const elfcpp::Rel<size, big_endian>&);
// Save a Rela against SYM for possible emission later.
void
save(Symbol* sym, Relobj*, unsigned int shndx,
- const elfcpp::Rela<size, big_endian>&);
+ Output_section* output_section, const elfcpp::Rela<size, big_endian>&);
// Return whether there are any relocs to emit. This also discards
// entries which need not be emitted.
public:
Copy_reloc_entry(Symbol* sym, unsigned int reloc_type,
Relobj* relobj, unsigned int shndx,
+ Output_section* output_section,
Address address, Addend addend)
: sym_(sym), reloc_type_(reloc_type), relobj_(relobj),
- shndx_(shndx), address_(address), addend_(addend)
+ shndx_(shndx), output_section_(output_section),
+ address_(address), addend_(addend)
{ }
// Return whether we should emit this reloc. If we should not
unsigned int reloc_type_;
Relobj* relobj_;
unsigned int shndx_;
+ Output_section* output_section_;
Address address_;
Addend addend_;
};
{
public:
Track_relocs()
- : object_(NULL), prelocs_(NULL), len_(0), pos_(0), reloc_size_(0)
+ : prelocs_(NULL), len_(0), pos_(0), reloc_size_(0)
{ }
// Initialize the Track_relocs object. OBJECT is the object holding
// (elfcpp::SHT_REL or elfcpp::SHT_RELA). This returns false if
// something went wrong.
bool
- initialize(Sized_relobj<size, big_endian>* object, unsigned int reloc_shndx,
+ initialize(Object* object, unsigned int reloc_shndx,
unsigned int reloc_type);
// Return the offset in the data section to which the next reloc
advance(off_t offset);
private:
- // The object file.
- Sized_relobj<size, big_endian>* object_;
- // The contents of the reloc section.
+ // The contents of the input object's reloc section.
const unsigned char* prelocs_;
// The length of the reloc section.
- off_t len_;
+ section_size_type len_;
// Our current position in the reloc section.
- off_t pos_;
+ section_size_type pos_;
// The size of the relocs in the section.
int reloc_size_;
};