2012-11-01 Roland McGrath <mcgrathr@google.com>
+ * target.h (Sized_target::relocate_relocs): Use Elf_Off
+ for offset_in_output_section parameter.
+ (Sized_target::relocate_special_relocatable): Likewise.
+ * arm.cc (Target_arm::relocate_relocs): Likewise.
+ (Target_arm::relocate_special_relocatable): Likewise.
+ * i386.cc (Target_i386::relocate_relocs): Likewise.
+ * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
+ * sparc.cc (Target_sparc::relocate_relocs): Likewise.
+ * target-reloc.h (relocate_relocs): Likewise.
+ * testsuite/testfile.cc (Target_test): Likewise.
+ * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
+ * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
+
+ * system.h: Move inclusion of <clocale> to after <libintl.h> in
+ [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
+
+ * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
+ parameter, which is unused in the [!F_SETFD] case.
+
* dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
SYMNDX to off_t before comparing it to this->data_size().
* output.cc (Output_symtab_xindex::endian_do_write): Likewise.
* incremental.cc (Output_section_incremental_inputs::do_write):
Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
-2012-11-01 Roland McGrath <mcgrathr@google.com>
-
- * system.h: Move inclusion of <clocale> to after <libintl.h> in
- [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
-
* nacl.cc: Include "libiberty.h" for vasprintf declaration.
-2012-11-01 Roland McGrath <mcgrathr@google.com>
-
- * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
- parameter, which is unused in the [!F_SETFD] case.
-
2012-10-30 Steve McIntyre <steve.mcintyre@linaro.org>
* gold.cc (Target_arm::do_adjust_elf_header): Add the
const unsigned char* prelocs,
size_t reloc_count,
Output_section* output_section,
- off_t offset_in_output_section,
+ typename elfcpp::Elf_types<32>::Elf_Off
+ offset_in_output_section,
const Relocatable_relocs*,
unsigned char* view,
Arm_address view_address,
const unsigned char* preloc_in,
size_t relnum,
Output_section* output_section,
- off_t offset_in_output_section,
+ typename elfcpp::Elf_types<32>::Elf_Off
+ offset_in_output_section,
unsigned char* view,
typename elfcpp::Elf_types<32>::Elf_Addr
view_address,
const unsigned char* prelocs,
size_t reloc_count,
Output_section* output_section,
- off_t offset_in_output_section,
+ typename elfcpp::Elf_types<32>::Elf_Off offset_in_output_section,
const Relocatable_relocs* rr,
unsigned char* view,
Arm_address view_address,
const unsigned char* preloc_in,
size_t relnum,
Output_section* output_section,
- off_t offset_in_output_section,
+ typename elfcpp::Elf_types<32>::Elf_Off offset_in_output_section,
unsigned char* view,
elfcpp::Elf_types<32>::Elf_Addr view_address,
section_size_type,
const unsigned char* prelocs,
size_t reloc_count,
Output_section* output_section,
- off_t offset_in_output_section,
+ typename elfcpp::Elf_types<32>::Elf_Off
+ offset_in_output_section,
const Relocatable_relocs*,
unsigned char* view,
elfcpp::Elf_types<32>::Elf_Addr view_address,
const unsigned char* prelocs,
size_t reloc_count,
Output_section* output_section,
- off_t offset_in_output_section,
+ typename elfcpp::Elf_types<32>::Elf_Off offset_in_output_section,
const Relocatable_relocs* rr,
unsigned char* view,
elfcpp::Elf_types<32>::Elf_Addr view_address,
const unsigned char* prelocs,
size_t reloc_count,
Output_section* output_section,
- off_t offset_in_output_section,
+ typename elfcpp::Elf_types<size>::Elf_Off
+ offset_in_output_section,
const Relocatable_relocs*,
unsigned char*,
Address view_address,
}
template<bool big_endian>
-static unsigned char*
+static unsigned char*
restgpr0(unsigned char* p, int r)
{
uint32_t insn = ld_0_1 + (r << 21) + (1 << 16) - (32 - r) * 8;
}
template<bool big_endian>
-static unsigned char*
+static unsigned char*
restgpr0_tail(unsigned char* p, int r)
{
uint32_t insn = ld_0_1 + 16;
}
template<bool big_endian>
-static unsigned char*
+static unsigned char*
savegpr1(unsigned char* p, int r)
{
uint32_t insn = std_0_12 + (r << 21) + (1 << 16) - (32 - r) * 8;
}
template<bool big_endian>
-static unsigned char*
+static unsigned char*
savegpr1_tail(unsigned char* p, int r)
{
p = savegpr1<big_endian>(p, r);
}
template<bool big_endian>
-static unsigned char*
+static unsigned char*
restgpr1(unsigned char* p, int r)
{
uint32_t insn = ld_0_12 + (r << 21) + (1 << 16) - (32 - r) * 8;
}
template<bool big_endian>
-static unsigned char*
+static unsigned char*
restgpr1_tail(unsigned char* p, int r)
{
p = restgpr1<big_endian>(p, r);
}
template<bool big_endian>
-static unsigned char*
+static unsigned char*
savefpr(unsigned char* p, int r)
{
uint32_t insn = stfd_0_1 + (r << 21) + (1 << 16) - (32 - r) * 8;
}
template<bool big_endian>
-static unsigned char*
+static unsigned char*
savefpr0_tail(unsigned char* p, int r)
{
p = savefpr<big_endian>(p, r);
}
template<bool big_endian>
-static unsigned char*
+static unsigned char*
restfpr(unsigned char* p, int r)
{
uint32_t insn = lfd_0_1 + (r << 21) + (1 << 16) - (32 - r) * 8;
}
template<bool big_endian>
-static unsigned char*
+static unsigned char*
restfpr0_tail(unsigned char* p, int r)
{
write_insn<big_endian>(p, ld_0_1 + 16);
}
template<bool big_endian>
-static unsigned char*
+static unsigned char*
savefpr1_tail(unsigned char* p, int r)
{
p = savefpr<big_endian>(p, r);
}
template<bool big_endian>
-static unsigned char*
+static unsigned char*
restfpr1_tail(unsigned char* p, int r)
{
p = restfpr<big_endian>(p, r);
}
template<bool big_endian>
-static unsigned char*
+static unsigned char*
savevr(unsigned char* p, int r)
{
uint32_t insn = li_12_0 + (1 << 16) - (32 - r) * 16;
}
template<bool big_endian>
-static unsigned char*
+static unsigned char*
savevr_tail(unsigned char* p, int r)
{
p = savevr<big_endian>(p, r);
}
template<bool big_endian>
-static unsigned char*
+static unsigned char*
restvr(unsigned char* p, int r)
{
uint32_t insn = li_12_0 + (1 << 16) - (32 - r) * 16;
}
template<bool big_endian>
-static unsigned char*
+static unsigned char*
restvr_tail(unsigned char* p, int r)
{
p = restvr<big_endian>(p, r);
const unsigned char* prelocs,
size_t reloc_count,
Output_section* output_section,
- off_t offset_in_output_section,
+ typename elfcpp::Elf_types<size>::Elf_Off offset_in_output_section,
const Relocatable_relocs* rr,
unsigned char*,
Address view_address,
const unsigned char* prelocs,
size_t reloc_count,
Output_section* output_section,
- off_t offset_in_output_section,
+ typename elfcpp::Elf_types<size>::Elf_Off
+ offset_in_output_section,
const Relocatable_relocs*,
unsigned char* view,
typename elfcpp::Elf_types<size>::Elf_Addr view_address,
const unsigned char* prelocs,
size_t reloc_count,
Output_section* output_section,
- off_t offset_in_output_section,
+ typename elfcpp::Elf_types<size>::Elf_Off offset_in_output_section,
const Relocatable_relocs* rr,
unsigned char* view,
typename elfcpp::Elf_types<size>::Elf_Addr view_address,
// target-reloc.h -- target specific relocation support -*- C++ -*-
-// Copyright 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+// Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2012
+// Free Software Foundation, Inc.
// Written by Ian Lance Taylor <iant@google.com>.
// This file is part of gold.
//
// FIXME: We should issue a warning if this is an
// allocated section; is this the best place to do it?
- //
+ //
// FIXME: The old GNU linker would in some cases look
// for the linkonce section which caused this section to
// be discarded, and, if the other section was the same
// If the local symbol belongs to a section we are discarding,
// and that section is a debug section, try to find the
// corresponding kept section and map this symbol to its
- // counterpart in the kept section. The symbol must not
+ // counterpart in the kept section. The symbol must not
// correspond to a section we are folding.
bool is_ordinary;
shndx = psymval->input_shndx(&is_ordinary);
const unsigned char* prelocs,
size_t reloc_count,
Output_section* output_section,
- typename elfcpp::Elf_types<size>::Elf_Addr offset_in_output_section,
+ typename elfcpp::Elf_types<size>::Elf_Off offset_in_output_section,
const Relocatable_relocs* rr,
unsigned char* view,
typename elfcpp::Elf_types<size>::Elf_Addr view_address,
const unsigned char* prelocs,
size_t reloc_count,
Output_section* output_section,
- off_t offset_in_output_section,
+ typename elfcpp::Elf_types<size>::Elf_Off
+ offset_in_output_section,
const Relocatable_relocs*,
unsigned char* view,
typename elfcpp::Elf_types<size>::Elf_Addr view_address,
const unsigned char* /* preloc_in */,
size_t /* relnum */,
Output_section* /* output_section */,
- off_t /* offset_in_output_section */,
+ typename elfcpp::Elf_types<size>::Elf_Off
+ /* offset_in_output_section */,
unsigned char* /* view */,
typename elfcpp::Elf_types<size>::Elf_Addr
/* view_address */,
void
relocate_relocs(const Relocate_info<size, big_endian>*,
unsigned int, const unsigned char*, size_t,
- Output_section*, off_t, const Relocatable_relocs*,
- unsigned char*,
+ Output_section*, typename elfcpp::Elf_types<size>::Elf_Off,
+ const Relocatable_relocs*, unsigned char*,
typename elfcpp::Elf_types<size>::Elf_Addr,
section_size_type, unsigned char*,
section_size_type)
const unsigned char* prelocs,
size_t reloc_count,
Output_section* output_section,
- off_t offset_in_output_section,
+ typename elfcpp::Elf_types<size>::Elf_Off offset_in_output_section,
const Relocatable_relocs*,
unsigned char* view,
typename elfcpp::Elf_types<size>::Elf_Addr view_address,
// right shift operand by this number of bits.
unsigned char srshift;
- // the offset to apply relocation.
+ // the offset to apply relocation.
unsigned char doffset;
// set to 1 for pc-relative relocation.
Valtype* wv = reinterpret_cast<Valtype*>(view);
Valtype val = elfcpp::Swap<valsize, big_endian>::readval(wv);
Valtype reloc = 0;
- if (size == 32)
+ if (size == 32)
reloc = Bits<32>::sign_extend(psymval->value(object, addend) - address)
>> srshift;
else
Valtype;
unsigned char* wv = view;
Valtype reloc = 0;
- if (size == 32)
+ if (size == 32)
reloc = Bits<32>::sign_extend(psymval->value(object, addend) - address)
>> srshift;
else
Valtype* wv = reinterpret_cast<Valtype*>(view);
Valtype val = elfcpp::Swap<valsize, big_endian>::readval(wv);
Valtype reloc = 0;
- if (size == 32)
+ if (size == 32)
reloc = Bits<32>::sign_extend(psymval->value(object, addend) - address)
>> srshift;
else
const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr addend,
Tilegx_howto &r_howto)
- {
+ {
This::template rela<64>(view, object, psymval, addend,
(elfcpp::Elf_Xword)(r_howto.srshift),
(elfcpp::Elf_Xword)(r_howto.doffset),
typename elfcpp::Elf_types<size>::Elf_Addr addend,
typename elfcpp::Elf_types<size>::Elf_Addr address,
Tilegx_howto &r_howto)
- {
+ {
This::template pcrela<64>(view, object, psymval, addend, address,
(elfcpp::Elf_Xword)(r_howto.srshift),
(elfcpp::Elf_Xword)(r_howto.doffset),
typename elfcpp::Elf_types<size>::Elf_Addr addend,
typename elfcpp::Elf_types<size>::Elf_Addr address,
unsigned int r_type)
- {
+ {
elfcpp::Elf_Xword doffset1 = 0llu;
elfcpp::Elf_Xword doffset2 = 0llu;
static inline void
tls_relax(unsigned char* view, unsigned int r_type,
tls::Tls_optimization opt_t)
- {
-
+ {
+
const uint64_t TILEGX_X_MOVE_R0_R0 = 0x283bf8005107f000llu;
const uint64_t TILEGX_Y_MOVE_R0_R0 = 0xae05f800540bf000llu;
const uint64_t TILEGX_X_LD = 0x286ae80000000000llu;
// LE: 1. copy dest operand into the first source operand
// 2. change the opcode to "move"
reloc = (val & 0x3Fllu) << 6;
- reloc |= (TILEGX_X_MOVE_R0_R0 & TILEGX_X0_RRR_SRCB_MASK);
+ reloc |= (TILEGX_X_MOVE_R0_R0 & TILEGX_X0_RRR_SRCB_MASK);
val &= ~R_TILEGX_IMM8_X0_TLS_ADD_LE_MASK;
} else
gold_unreachable();
break;
case elfcpp::R_TILEGX_IMM8_X0_TLS_GD_ADD:
if (opt_t == tls::TLSOPT_NONE) {
- // GD see comments for optimize_tls_reloc
+ // GD see comments for optimize_tls_reloc
reloc = TILEGX_X_MOVE_R0_R0 & TILEGX_X0_RRR_SRCB_MASK;
val &= ~TILEGX_X0_RRR_SRCB_MASK;
} else if (opt_t == tls::TLSOPT_TO_IE
false, false);
this->got_->add_global(this->tilegx_dynamic_, GOT_TYPE_STANDARD);
- } else
+ } else
// for executable, just set the first entry to zero.
this->got_->set_current_data_size(size / 8);
plt_index = *pcount;
// TILEGX .plt section layout
- //
+ //
// ----
// plt_header
// ----
// ----
// ...
// ----
- //
+ //
// TILEGX .got.plt section layout
- //
+ //
// ----
// reserv1
// ----
// entries for normal function
// ----
// ...
- // ----
+ // ----
// entries for ifunc
// ----
// ...
// move r0, r0 Y0/Y1/X0/X1
// move r0, r0 Y0/Y1/X0/X1
// add adr, r0, tp Y0/Y1/X0/X1
-//
-//
+//
+//
// compiler IE reference
// |
// V
}
// We are about to emit a dynamic relocation of type R_TYPE. If the
-// dynamic linker does not support it, issue an error.
+// dynamic linker does not support it, issue an error.
template<int size, bool big_endian>
void
Target_tilegx<size, big_endian>::Scan::check_non_pic(Relobj* object,
data_shndx,
reloc.get_r_offset(),
reloc.get_r_addend());
-
+
}
}
break;
break;
// GD: requires two GOT entry for module index and offset
- // IE: requires one GOT entry for tp-relative offset
+ // IE: requires one GOT entry for tp-relative offset
// LE: shouldn't happen for global symbol
case elfcpp::R_TILEGX_IMM16_X0_HW0_TLS_GD:
case elfcpp::R_TILEGX_IMM16_X1_HW0_TLS_GD:
r_sym, shndx);
else
got->add_local_pair_with_rel(object, r_sym, shndx,
- GOT_TYPE_TLS_PAIR,
+ GOT_TYPE_TLS_PAIR,
target->rela_dyn_section(layout),
size == 32
? elfcpp::R_TILEGX_TLS_DTPMOD32
? elfcpp::R_TILEGX_TLS_TPOFF32
: elfcpp::R_TILEGX_TLS_TPOFF64,
got, off, 0);
- } else if (opt_t != tls::TLSOPT_TO_LE)
+ } else if (opt_t != tls::TLSOPT_TO_LE)
// only TO_LE is allowed for local symbol
unsupported_reloc_local(object, r_type);
}
symtab->lookup("__tls_get_addr"));
}
break;
-
+
// only make effect when applying relocation
case elfcpp::R_TILEGX_TLS_IE_LOAD:
case elfcpp::R_TILEGX_IMM8_X0_TLS_ADD:
case elfcpp::R_TILEGX_IMM8_Y0_TLS_GD_ADD:
case elfcpp::R_TILEGX_IMM8_Y1_TLS_GD_ADD:
break;
-
+
// GD: requires two GOT entry for module index and offset
- // IE: requires one GOT entry for tp-relative offset
+ // IE: requires one GOT entry for tp-relative offset
// LE: shouldn't happen for global symbol
case elfcpp::R_TILEGX_IMM16_X0_HW0_TLS_GD:
case elfcpp::R_TILEGX_IMM16_X1_HW0_TLS_GD:
unsupported_reloc_global(object, r_type, gsym);
}
break;
-
+
// IE
case elfcpp::R_TILEGX_IMM16_X0_HW0_TLS_IE:
case elfcpp::R_TILEGX_IMM16_X1_HW0_TLS_IE:
unsupported_reloc_global(object, r_type, gsym);
}
break;
-
+
// LE
case elfcpp::R_TILEGX_IMM16_X0_HW0_TLS_LE:
case elfcpp::R_TILEGX_IMM16_X1_HW0_TLS_LE:
} // else if (opt_t == tls::TLSOPT_TO_LE)
// both GD/IE are turned into LE, which
// is absolute relocation.
- //
+ //
// | go through
- // |
+ // |
// V
// LE
- //
+ //
// tp
// |
// V
- // t_var1 | t_var2 | t_var3 | ...
+ // t_var1 | t_var2 | t_var3 | ...
// --------------------------------------------------
//
// so offset to tp should be negative, we get offset
|| issue_undefined_symbol_error(gsym));
return false;
}
-
+
typename elfcpp::Elf_types<size>::Elf_Addr value
= psymval->value(relinfo->object, 0);
symval.set_output_value(value);
const unsigned char* prelocs,
size_t reloc_count,
Output_section* output_section,
- off_t offset_in_output_section,
+ typename elfcpp::Elf_types<size>::Elf_Off offset_in_output_section,
const Relocatable_relocs* rr,
unsigned char* view,
typename elfcpp::Elf_types<size>::Elf_Addr view_address,
return ssym->value();
}
-// The selector for tilegx object files.
+// The selector for tilegx object files.
template<int size, bool big_endian>
class Target_selector_tilegx : public Target_selector
const unsigned char* prelocs,
size_t reloc_count,
Output_section* output_section,
- off_t offset_in_output_section,
+ typename elfcpp::Elf_types<size>::Elf_Off offset_in_output_section,
const Relocatable_relocs*,
unsigned char* view,
typename elfcpp::Elf_types<size>::Elf_Addr view_address,
unsigned int r_sym = elfcpp::elf_r_sym<size>(reloc.get_r_info());
Reloc_section* rela_dyn = target->rela_dyn_section(layout);
rela_dyn->add_local_relative(object, r_sym,
- (size == 32
+ (size == 32
? elfcpp::R_X86_64_RELATIVE64
: elfcpp::R_X86_64_RELATIVE),
output_section, data_shndx,
const unsigned char* prelocs,
size_t reloc_count,
Output_section* output_section,
- off_t offset_in_output_section,
+ typename elfcpp::Elf_types<size>::Elf_Off offset_in_output_section,
const Relocatable_relocs* rr,
unsigned char* view,
typename elfcpp::Elf_types<size>::Elf_Addr view_address,