* 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.
This commit is contained in:
Roland McGrath 2012-11-01 23:27:00 +00:00
parent c06dec1422
commit 62fe925ad4
10 changed files with 100 additions and 83 deletions

View File

@ -1,23 +1,32 @@
2012-11-01 Roland McGrath <mcgrathr@google.com> 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 * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
SYMNDX to off_t before comparing it to this->data_size(). SYMNDX to off_t before comparing it to this->data_size().
* output.cc (Output_symtab_xindex::endian_do_write): Likewise. * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
* incremental.cc (Output_section_incremental_inputs::do_write): * incremental.cc (Output_section_incremental_inputs::do_write):
Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE. 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. * 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> 2012-10-30 Steve McIntyre <steve.mcintyre@linaro.org>
* gold.cc (Target_arm::do_adjust_elf_header): Add the * gold.cc (Target_arm::do_adjust_elf_header): Add the

View File

@ -2293,7 +2293,8 @@ class Target_arm : public Sized_target<32, big_endian>
const unsigned char* prelocs, const unsigned char* prelocs,
size_t reloc_count, size_t reloc_count,
Output_section* output_section, Output_section* output_section,
off_t offset_in_output_section, typename elfcpp::Elf_types<32>::Elf_Off
offset_in_output_section,
const Relocatable_relocs*, const Relocatable_relocs*,
unsigned char* view, unsigned char* view,
Arm_address view_address, Arm_address view_address,
@ -2309,7 +2310,8 @@ class Target_arm : public Sized_target<32, big_endian>
const unsigned char* preloc_in, const unsigned char* preloc_in,
size_t relnum, size_t relnum,
Output_section* output_section, Output_section* output_section,
off_t offset_in_output_section, typename elfcpp::Elf_types<32>::Elf_Off
offset_in_output_section,
unsigned char* view, unsigned char* view,
typename elfcpp::Elf_types<32>::Elf_Addr typename elfcpp::Elf_types<32>::Elf_Addr
view_address, view_address,
@ -9603,7 +9605,7 @@ Target_arm<big_endian>::relocate_relocs(
const unsigned char* prelocs, const unsigned char* prelocs,
size_t reloc_count, size_t reloc_count,
Output_section* output_section, 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, const Relocatable_relocs* rr,
unsigned char* view, unsigned char* view,
Arm_address view_address, Arm_address view_address,
@ -9638,7 +9640,7 @@ Target_arm<big_endian>::relocate_special_relocatable(
const unsigned char* preloc_in, const unsigned char* preloc_in,
size_t relnum, size_t relnum,
Output_section* output_section, Output_section* output_section,
off_t offset_in_output_section, typename elfcpp::Elf_types<32>::Elf_Off offset_in_output_section,
unsigned char* view, unsigned char* view,
elfcpp::Elf_types<32>::Elf_Addr view_address, elfcpp::Elf_types<32>::Elf_Addr view_address,
section_size_type, section_size_type,

View File

@ -414,7 +414,8 @@ class Target_i386 : public Sized_target<32, false>
const unsigned char* prelocs, const unsigned char* prelocs,
size_t reloc_count, size_t reloc_count,
Output_section* output_section, Output_section* output_section,
off_t offset_in_output_section, typename elfcpp::Elf_types<32>::Elf_Off
offset_in_output_section,
const Relocatable_relocs*, const Relocatable_relocs*,
unsigned char* view, unsigned char* view,
elfcpp::Elf_types<32>::Elf_Addr view_address, elfcpp::Elf_types<32>::Elf_Addr view_address,
@ -3617,7 +3618,7 @@ Target_i386::relocate_relocs(
const unsigned char* prelocs, const unsigned char* prelocs,
size_t reloc_count, size_t reloc_count,
Output_section* output_section, 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, const Relocatable_relocs* rr,
unsigned char* view, unsigned char* view,
elfcpp::Elf_types<32>::Elf_Addr view_address, elfcpp::Elf_types<32>::Elf_Addr view_address,

View File

@ -393,7 +393,8 @@ class Target_powerpc : public Sized_target<size, big_endian>
const unsigned char* prelocs, const unsigned char* prelocs,
size_t reloc_count, size_t reloc_count,
Output_section* output_section, Output_section* output_section,
off_t offset_in_output_section, typename elfcpp::Elf_types<size>::Elf_Off
offset_in_output_section,
const Relocatable_relocs*, const Relocatable_relocs*,
unsigned char*, unsigned char*,
Address view_address, Address view_address,
@ -2511,7 +2512,7 @@ savegpr0_tail(unsigned char* p, int r)
} }
template<bool big_endian> template<bool big_endian>
static unsigned char* static unsigned char*
restgpr0(unsigned char* p, int r) restgpr0(unsigned char* p, int r)
{ {
uint32_t insn = ld_0_1 + (r << 21) + (1 << 16) - (32 - r) * 8; uint32_t insn = ld_0_1 + (r << 21) + (1 << 16) - (32 - r) * 8;
@ -2520,7 +2521,7 @@ restgpr0(unsigned char* p, int r)
} }
template<bool big_endian> template<bool big_endian>
static unsigned char* static unsigned char*
restgpr0_tail(unsigned char* p, int r) restgpr0_tail(unsigned char* p, int r)
{ {
uint32_t insn = ld_0_1 + 16; uint32_t insn = ld_0_1 + 16;
@ -2539,7 +2540,7 @@ restgpr0_tail(unsigned char* p, int r)
} }
template<bool big_endian> template<bool big_endian>
static unsigned char* static unsigned char*
savegpr1(unsigned char* p, int r) savegpr1(unsigned char* p, int r)
{ {
uint32_t insn = std_0_12 + (r << 21) + (1 << 16) - (32 - r) * 8; uint32_t insn = std_0_12 + (r << 21) + (1 << 16) - (32 - r) * 8;
@ -2548,7 +2549,7 @@ savegpr1(unsigned char* p, int r)
} }
template<bool big_endian> template<bool big_endian>
static unsigned char* static unsigned char*
savegpr1_tail(unsigned char* p, int r) savegpr1_tail(unsigned char* p, int r)
{ {
p = savegpr1<big_endian>(p, r); p = savegpr1<big_endian>(p, r);
@ -2557,7 +2558,7 @@ savegpr1_tail(unsigned char* p, int r)
} }
template<bool big_endian> template<bool big_endian>
static unsigned char* static unsigned char*
restgpr1(unsigned char* p, int r) restgpr1(unsigned char* p, int r)
{ {
uint32_t insn = ld_0_12 + (r << 21) + (1 << 16) - (32 - r) * 8; uint32_t insn = ld_0_12 + (r << 21) + (1 << 16) - (32 - r) * 8;
@ -2566,7 +2567,7 @@ restgpr1(unsigned char* p, int r)
} }
template<bool big_endian> template<bool big_endian>
static unsigned char* static unsigned char*
restgpr1_tail(unsigned char* p, int r) restgpr1_tail(unsigned char* p, int r)
{ {
p = restgpr1<big_endian>(p, r); p = restgpr1<big_endian>(p, r);
@ -2575,7 +2576,7 @@ restgpr1_tail(unsigned char* p, int r)
} }
template<bool big_endian> template<bool big_endian>
static unsigned char* static unsigned char*
savefpr(unsigned char* p, int r) savefpr(unsigned char* p, int r)
{ {
uint32_t insn = stfd_0_1 + (r << 21) + (1 << 16) - (32 - r) * 8; uint32_t insn = stfd_0_1 + (r << 21) + (1 << 16) - (32 - r) * 8;
@ -2584,7 +2585,7 @@ savefpr(unsigned char* p, int r)
} }
template<bool big_endian> template<bool big_endian>
static unsigned char* static unsigned char*
savefpr0_tail(unsigned char* p, int r) savefpr0_tail(unsigned char* p, int r)
{ {
p = savefpr<big_endian>(p, r); p = savefpr<big_endian>(p, r);
@ -2595,7 +2596,7 @@ savefpr0_tail(unsigned char* p, int r)
} }
template<bool big_endian> template<bool big_endian>
static unsigned char* static unsigned char*
restfpr(unsigned char* p, int r) restfpr(unsigned char* p, int r)
{ {
uint32_t insn = lfd_0_1 + (r << 21) + (1 << 16) - (32 - r) * 8; uint32_t insn = lfd_0_1 + (r << 21) + (1 << 16) - (32 - r) * 8;
@ -2604,7 +2605,7 @@ restfpr(unsigned char* p, int r)
} }
template<bool big_endian> template<bool big_endian>
static unsigned char* static unsigned char*
restfpr0_tail(unsigned char* p, int r) restfpr0_tail(unsigned char* p, int r)
{ {
write_insn<big_endian>(p, ld_0_1 + 16); write_insn<big_endian>(p, ld_0_1 + 16);
@ -2622,7 +2623,7 @@ restfpr0_tail(unsigned char* p, int r)
} }
template<bool big_endian> template<bool big_endian>
static unsigned char* static unsigned char*
savefpr1_tail(unsigned char* p, int r) savefpr1_tail(unsigned char* p, int r)
{ {
p = savefpr<big_endian>(p, r); p = savefpr<big_endian>(p, r);
@ -2631,7 +2632,7 @@ savefpr1_tail(unsigned char* p, int r)
} }
template<bool big_endian> template<bool big_endian>
static unsigned char* static unsigned char*
restfpr1_tail(unsigned char* p, int r) restfpr1_tail(unsigned char* p, int r)
{ {
p = restfpr<big_endian>(p, r); p = restfpr<big_endian>(p, r);
@ -2640,7 +2641,7 @@ restfpr1_tail(unsigned char* p, int r)
} }
template<bool big_endian> template<bool big_endian>
static unsigned char* static unsigned char*
savevr(unsigned char* p, int r) savevr(unsigned char* p, int r)
{ {
uint32_t insn = li_12_0 + (1 << 16) - (32 - r) * 16; uint32_t insn = li_12_0 + (1 << 16) - (32 - r) * 16;
@ -2652,7 +2653,7 @@ savevr(unsigned char* p, int r)
} }
template<bool big_endian> template<bool big_endian>
static unsigned char* static unsigned char*
savevr_tail(unsigned char* p, int r) savevr_tail(unsigned char* p, int r)
{ {
p = savevr<big_endian>(p, r); p = savevr<big_endian>(p, r);
@ -2661,7 +2662,7 @@ savevr_tail(unsigned char* p, int r)
} }
template<bool big_endian> template<bool big_endian>
static unsigned char* static unsigned char*
restvr(unsigned char* p, int r) restvr(unsigned char* p, int r)
{ {
uint32_t insn = li_12_0 + (1 << 16) - (32 - r) * 16; uint32_t insn = li_12_0 + (1 << 16) - (32 - r) * 16;
@ -2673,7 +2674,7 @@ restvr(unsigned char* p, int r)
} }
template<bool big_endian> template<bool big_endian>
static unsigned char* static unsigned char*
restvr_tail(unsigned char* p, int r) restvr_tail(unsigned char* p, int r)
{ {
p = restvr<big_endian>(p, r); p = restvr<big_endian>(p, r);
@ -5177,7 +5178,7 @@ Target_powerpc<size, big_endian>::relocate_relocs(
const unsigned char* prelocs, const unsigned char* prelocs,
size_t reloc_count, size_t reloc_count,
Output_section* output_section, 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, const Relocatable_relocs* rr,
unsigned char*, unsigned char*,
Address view_address, Address view_address,

View File

@ -138,7 +138,8 @@ class Target_sparc : public Sized_target<size, big_endian>
const unsigned char* prelocs, const unsigned char* prelocs,
size_t reloc_count, size_t reloc_count,
Output_section* output_section, Output_section* output_section,
off_t offset_in_output_section, typename elfcpp::Elf_types<size>::Elf_Off
offset_in_output_section,
const Relocatable_relocs*, const Relocatable_relocs*,
unsigned char* view, unsigned char* view,
typename elfcpp::Elf_types<size>::Elf_Addr view_address, typename elfcpp::Elf_types<size>::Elf_Addr view_address,
@ -4213,7 +4214,7 @@ Target_sparc<size, big_endian>::relocate_relocs(
const unsigned char* prelocs, const unsigned char* prelocs,
size_t reloc_count, size_t reloc_count,
Output_section* output_section, 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, const Relocatable_relocs* rr,
unsigned char* view, unsigned char* view,
typename elfcpp::Elf_types<size>::Elf_Addr view_address, typename elfcpp::Elf_types<size>::Elf_Addr view_address,

View File

@ -1,6 +1,7 @@
// target-reloc.h -- target specific relocation support -*- C++ -*- // 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>. // Written by Ian Lance Taylor <iant@google.com>.
// This file is part of gold. // This file is part of gold.
@ -87,7 +88,7 @@ scan_relocs(
// //
// FIXME: We should issue a warning if this is an // FIXME: We should issue a warning if this is an
// allocated section; is this the best place to do it? // allocated section; is this the best place to do it?
// //
// FIXME: The old GNU linker would in some cases look // FIXME: The old GNU linker would in some cases look
// for the linkonce section which caused this section to // for the linkonce section which caused this section to
// be discarded, and, if the other section was the same // be discarded, and, if the other section was the same
@ -311,7 +312,7 @@ relocate_section(
// If the local symbol belongs to a section we are discarding, // If the local symbol belongs to a section we are discarding,
// and that section is a debug section, try to find the // and that section is a debug section, try to find the
// corresponding kept section and map this symbol to its // 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. // correspond to a section we are folding.
bool is_ordinary; bool is_ordinary;
shndx = psymval->input_shndx(&is_ordinary); shndx = psymval->input_shndx(&is_ordinary);
@ -606,7 +607,7 @@ relocate_relocs(
const unsigned char* prelocs, const unsigned char* prelocs,
size_t reloc_count, size_t reloc_count,
Output_section* output_section, 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, const Relocatable_relocs* rr,
unsigned char* view, unsigned char* view,
typename elfcpp::Elf_types<size>::Elf_Addr view_address, typename elfcpp::Elf_types<size>::Elf_Addr view_address,

View File

@ -838,7 +838,8 @@ class Sized_target : public Target
const unsigned char* prelocs, const unsigned char* prelocs,
size_t reloc_count, size_t reloc_count,
Output_section* output_section, Output_section* output_section,
off_t offset_in_output_section, typename elfcpp::Elf_types<size>::Elf_Off
offset_in_output_section,
const Relocatable_relocs*, const Relocatable_relocs*,
unsigned char* view, unsigned char* view,
typename elfcpp::Elf_types<size>::Elf_Addr view_address, typename elfcpp::Elf_types<size>::Elf_Addr view_address,
@ -868,7 +869,8 @@ class Sized_target : public Target
const unsigned char* /* preloc_in */, const unsigned char* /* preloc_in */,
size_t /* relnum */, size_t /* relnum */,
Output_section* /* output_section */, Output_section* /* output_section */,
off_t /* offset_in_output_section */, typename elfcpp::Elf_types<size>::Elf_Off
/* offset_in_output_section */,
unsigned char* /* view */, unsigned char* /* view */,
typename elfcpp::Elf_types<size>::Elf_Addr typename elfcpp::Elf_types<size>::Elf_Addr
/* view_address */, /* view_address */,

View File

@ -74,8 +74,8 @@ class Target_test : public Sized_target<size, big_endian>
void void
relocate_relocs(const Relocate_info<size, big_endian>*, relocate_relocs(const Relocate_info<size, big_endian>*,
unsigned int, const unsigned char*, size_t, unsigned int, const unsigned char*, size_t,
Output_section*, off_t, const Relocatable_relocs*, Output_section*, typename elfcpp::Elf_types<size>::Elf_Off,
unsigned char*, const Relocatable_relocs*, unsigned char*,
typename elfcpp::Elf_types<size>::Elf_Addr, typename elfcpp::Elf_types<size>::Elf_Addr,
section_size_type, unsigned char*, section_size_type, unsigned char*,
section_size_type) section_size_type)

View File

@ -316,7 +316,7 @@ class Target_tilegx : public Sized_target<size, big_endian>
const unsigned char* prelocs, const unsigned char* prelocs,
size_t reloc_count, size_t reloc_count,
Output_section* output_section, Output_section* output_section,
off_t offset_in_output_section, typename elfcpp::Elf_types<size>::Elf_Off offset_in_output_section,
const Relocatable_relocs*, const Relocatable_relocs*,
unsigned char* view, unsigned char* view,
typename elfcpp::Elf_types<size>::Elf_Addr view_address, typename elfcpp::Elf_types<size>::Elf_Addr view_address,
@ -780,7 +780,7 @@ public:
// right shift operand by this number of bits. // right shift operand by this number of bits.
unsigned char srshift; unsigned char srshift;
// the offset to apply relocation. // the offset to apply relocation.
unsigned char doffset; unsigned char doffset;
// set to 1 for pc-relative relocation. // set to 1 for pc-relative relocation.
@ -899,7 +899,7 @@ private:
Valtype* wv = reinterpret_cast<Valtype*>(view); Valtype* wv = reinterpret_cast<Valtype*>(view);
Valtype val = elfcpp::Swap<valsize, big_endian>::readval(wv); Valtype val = elfcpp::Swap<valsize, big_endian>::readval(wv);
Valtype reloc = 0; Valtype reloc = 0;
if (size == 32) if (size == 32)
reloc = Bits<32>::sign_extend(psymval->value(object, addend) - address) reloc = Bits<32>::sign_extend(psymval->value(object, addend) - address)
>> srshift; >> srshift;
else else
@ -927,7 +927,7 @@ private:
Valtype; Valtype;
unsigned char* wv = view; unsigned char* wv = view;
Valtype reloc = 0; Valtype reloc = 0;
if (size == 32) if (size == 32)
reloc = Bits<32>::sign_extend(psymval->value(object, addend) - address) reloc = Bits<32>::sign_extend(psymval->value(object, addend) - address)
>> srshift; >> srshift;
else else
@ -954,7 +954,7 @@ private:
Valtype* wv = reinterpret_cast<Valtype*>(view); Valtype* wv = reinterpret_cast<Valtype*>(view);
Valtype val = elfcpp::Swap<valsize, big_endian>::readval(wv); Valtype val = elfcpp::Swap<valsize, big_endian>::readval(wv);
Valtype reloc = 0; Valtype reloc = 0;
if (size == 32) if (size == 32)
reloc = Bits<32>::sign_extend(psymval->value(object, addend) - address) reloc = Bits<32>::sign_extend(psymval->value(object, addend) - address)
>> srshift; >> srshift;
else else
@ -1043,7 +1043,7 @@ public:
const Symbol_value<size>* psymval, const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr addend, typename elfcpp::Elf_types<size>::Elf_Addr addend,
Tilegx_howto &r_howto) Tilegx_howto &r_howto)
{ {
This::template rela<64>(view, object, psymval, addend, This::template rela<64>(view, object, psymval, addend,
(elfcpp::Elf_Xword)(r_howto.srshift), (elfcpp::Elf_Xword)(r_howto.srshift),
(elfcpp::Elf_Xword)(r_howto.doffset), (elfcpp::Elf_Xword)(r_howto.doffset),
@ -1057,7 +1057,7 @@ public:
typename elfcpp::Elf_types<size>::Elf_Addr addend, typename elfcpp::Elf_types<size>::Elf_Addr addend,
typename elfcpp::Elf_types<size>::Elf_Addr address, typename elfcpp::Elf_types<size>::Elf_Addr address,
Tilegx_howto &r_howto) Tilegx_howto &r_howto)
{ {
This::template pcrela<64>(view, object, psymval, addend, address, This::template pcrela<64>(view, object, psymval, addend, address,
(elfcpp::Elf_Xword)(r_howto.srshift), (elfcpp::Elf_Xword)(r_howto.srshift),
(elfcpp::Elf_Xword)(r_howto.doffset), (elfcpp::Elf_Xword)(r_howto.doffset),
@ -1071,7 +1071,7 @@ public:
typename elfcpp::Elf_types<size>::Elf_Addr addend, typename elfcpp::Elf_types<size>::Elf_Addr addend,
typename elfcpp::Elf_types<size>::Elf_Addr address, typename elfcpp::Elf_types<size>::Elf_Addr address,
unsigned int r_type) unsigned int r_type)
{ {
elfcpp::Elf_Xword doffset1 = 0llu; elfcpp::Elf_Xword doffset1 = 0llu;
elfcpp::Elf_Xword doffset2 = 0llu; elfcpp::Elf_Xword doffset2 = 0llu;
@ -1111,8 +1111,8 @@ public:
static inline void static inline void
tls_relax(unsigned char* view, unsigned int r_type, tls_relax(unsigned char* view, unsigned int r_type,
tls::Tls_optimization opt_t) tls::Tls_optimization opt_t)
{ {
const uint64_t TILEGX_X_MOVE_R0_R0 = 0x283bf8005107f000llu; const uint64_t TILEGX_X_MOVE_R0_R0 = 0x283bf8005107f000llu;
const uint64_t TILEGX_Y_MOVE_R0_R0 = 0xae05f800540bf000llu; const uint64_t TILEGX_Y_MOVE_R0_R0 = 0xae05f800540bf000llu;
const uint64_t TILEGX_X_LD = 0x286ae80000000000llu; const uint64_t TILEGX_X_LD = 0x286ae80000000000llu;
@ -1176,7 +1176,7 @@ public:
// LE: 1. copy dest operand into the first source operand // LE: 1. copy dest operand into the first source operand
// 2. change the opcode to "move" // 2. change the opcode to "move"
reloc = (val & 0x3Fllu) << 6; 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; val &= ~R_TILEGX_IMM8_X0_TLS_ADD_LE_MASK;
} else } else
gold_unreachable(); gold_unreachable();
@ -1228,7 +1228,7 @@ public:
break; break;
case elfcpp::R_TILEGX_IMM8_X0_TLS_GD_ADD: case elfcpp::R_TILEGX_IMM8_X0_TLS_GD_ADD:
if (opt_t == tls::TLSOPT_NONE) { 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; reloc = TILEGX_X_MOVE_R0_R0 & TILEGX_X0_RRR_SRCB_MASK;
val &= ~TILEGX_X0_RRR_SRCB_MASK; val &= ~TILEGX_X0_RRR_SRCB_MASK;
} else if (opt_t == tls::TLSOPT_TO_IE } else if (opt_t == tls::TLSOPT_TO_IE
@ -1890,7 +1890,7 @@ Target_tilegx<size, big_endian>::got_section(Symbol_table* symtab,
false, false); false, false);
this->got_->add_global(this->tilegx_dynamic_, GOT_TYPE_STANDARD); this->got_->add_global(this->tilegx_dynamic_, GOT_TYPE_STANDARD);
} else } else
// for executable, just set the first entry to zero. // for executable, just set the first entry to zero.
this->got_->set_current_data_size(size / 8); this->got_->set_current_data_size(size / 8);
@ -2022,7 +2022,7 @@ Output_data_plt_tilegx<size, big_endian>::add_entry(Symbol_table* symtab,
plt_index = *pcount; plt_index = *pcount;
// TILEGX .plt section layout // TILEGX .plt section layout
// //
// ---- // ----
// plt_header // plt_header
// ---- // ----
@ -2030,9 +2030,9 @@ Output_data_plt_tilegx<size, big_endian>::add_entry(Symbol_table* symtab,
// ---- // ----
// ... // ...
// ---- // ----
// //
// TILEGX .got.plt section layout // TILEGX .got.plt section layout
// //
// ---- // ----
// reserv1 // reserv1
// ---- // ----
@ -2041,7 +2041,7 @@ Output_data_plt_tilegx<size, big_endian>::add_entry(Symbol_table* symtab,
// entries for normal function // entries for normal function
// ---- // ----
// ... // ...
// ---- // ----
// entries for ifunc // entries for ifunc
// ---- // ----
// ... // ...
@ -2874,8 +2874,8 @@ Target_tilegx<size, big_endian>::got_mod_index_entry(Symbol_table* symtab,
// move r0, r0 Y0/Y1/X0/X1 // move r0, r0 Y0/Y1/X0/X1
// move r0, r0 Y0/Y1/X0/X1 // move r0, r0 Y0/Y1/X0/X1
// add adr, r0, tp Y0/Y1/X0/X1 // add adr, r0, tp Y0/Y1/X0/X1
// //
// //
// compiler IE reference // compiler IE reference
// | // |
// V // V
@ -3123,7 +3123,7 @@ Target_tilegx<size, big_endian>::Scan::unsupported_reloc_local(
} }
// We are about to emit a dynamic relocation of type R_TYPE. If the // 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> template<int size, bool big_endian>
void void
Target_tilegx<size, big_endian>::Scan::check_non_pic(Relobj* object, Target_tilegx<size, big_endian>::Scan::check_non_pic(Relobj* object,
@ -3296,7 +3296,7 @@ Target_tilegx<size, big_endian>::Scan::local(Symbol_table* symtab,
data_shndx, data_shndx,
reloc.get_r_offset(), reloc.get_r_offset(),
reloc.get_r_addend()); reloc.get_r_addend());
} }
} }
break; break;
@ -3450,7 +3450,7 @@ Target_tilegx<size, big_endian>::Scan::local(Symbol_table* symtab,
break; break;
// GD: requires two GOT entry for module index and offset // 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 // LE: shouldn't happen for global symbol
case elfcpp::R_TILEGX_IMM16_X0_HW0_TLS_GD: case elfcpp::R_TILEGX_IMM16_X0_HW0_TLS_GD:
case elfcpp::R_TILEGX_IMM16_X1_HW0_TLS_GD: case elfcpp::R_TILEGX_IMM16_X1_HW0_TLS_GD:
@ -3473,7 +3473,7 @@ Target_tilegx<size, big_endian>::Scan::local(Symbol_table* symtab,
r_sym, shndx); r_sym, shndx);
else else
got->add_local_pair_with_rel(object, r_sym, shndx, got->add_local_pair_with_rel(object, r_sym, shndx,
GOT_TYPE_TLS_PAIR, GOT_TYPE_TLS_PAIR,
target->rela_dyn_section(layout), target->rela_dyn_section(layout),
size == 32 size == 32
? elfcpp::R_TILEGX_TLS_DTPMOD32 ? elfcpp::R_TILEGX_TLS_DTPMOD32
@ -3493,7 +3493,7 @@ Target_tilegx<size, big_endian>::Scan::local(Symbol_table* symtab,
? elfcpp::R_TILEGX_TLS_TPOFF32 ? elfcpp::R_TILEGX_TLS_TPOFF32
: elfcpp::R_TILEGX_TLS_TPOFF64, : elfcpp::R_TILEGX_TLS_TPOFF64,
got, off, 0); 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 // only TO_LE is allowed for local symbol
unsupported_reloc_local(object, r_type); unsupported_reloc_local(object, r_type);
} }
@ -4010,7 +4010,7 @@ Target_tilegx<size, big_endian>::Scan::global(Symbol_table* symtab,
symtab->lookup("__tls_get_addr")); symtab->lookup("__tls_get_addr"));
} }
break; break;
// only make effect when applying relocation // only make effect when applying relocation
case elfcpp::R_TILEGX_TLS_IE_LOAD: case elfcpp::R_TILEGX_TLS_IE_LOAD:
case elfcpp::R_TILEGX_IMM8_X0_TLS_ADD: case elfcpp::R_TILEGX_IMM8_X0_TLS_ADD:
@ -4022,9 +4022,9 @@ Target_tilegx<size, big_endian>::Scan::global(Symbol_table* symtab,
case elfcpp::R_TILEGX_IMM8_Y0_TLS_GD_ADD: case elfcpp::R_TILEGX_IMM8_Y0_TLS_GD_ADD:
case elfcpp::R_TILEGX_IMM8_Y1_TLS_GD_ADD: case elfcpp::R_TILEGX_IMM8_Y1_TLS_GD_ADD:
break; break;
// GD: requires two GOT entry for module index and offset // 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 // LE: shouldn't happen for global symbol
case elfcpp::R_TILEGX_IMM16_X0_HW0_TLS_GD: case elfcpp::R_TILEGX_IMM16_X0_HW0_TLS_GD:
case elfcpp::R_TILEGX_IMM16_X1_HW0_TLS_GD: case elfcpp::R_TILEGX_IMM16_X1_HW0_TLS_GD:
@ -4058,7 +4058,7 @@ Target_tilegx<size, big_endian>::Scan::global(Symbol_table* symtab,
unsupported_reloc_global(object, r_type, gsym); unsupported_reloc_global(object, r_type, gsym);
} }
break; break;
// IE // IE
case elfcpp::R_TILEGX_IMM16_X0_HW0_TLS_IE: case elfcpp::R_TILEGX_IMM16_X0_HW0_TLS_IE:
case elfcpp::R_TILEGX_IMM16_X1_HW0_TLS_IE: case elfcpp::R_TILEGX_IMM16_X1_HW0_TLS_IE:
@ -4081,7 +4081,7 @@ Target_tilegx<size, big_endian>::Scan::global(Symbol_table* symtab,
unsupported_reloc_global(object, r_type, gsym); unsupported_reloc_global(object, r_type, gsym);
} }
break; break;
// LE // LE
case elfcpp::R_TILEGX_IMM16_X0_HW0_TLS_LE: case elfcpp::R_TILEGX_IMM16_X0_HW0_TLS_LE:
case elfcpp::R_TILEGX_IMM16_X1_HW0_TLS_LE: case elfcpp::R_TILEGX_IMM16_X1_HW0_TLS_LE:
@ -4626,16 +4626,16 @@ Target_tilegx<size, big_endian>::Relocate::relocate(
} // else if (opt_t == tls::TLSOPT_TO_LE) } // else if (opt_t == tls::TLSOPT_TO_LE)
// both GD/IE are turned into LE, which // both GD/IE are turned into LE, which
// is absolute relocation. // is absolute relocation.
// //
// | go through // | go through
// | // |
// V // V
// LE // LE
// //
// tp // tp
// | // |
// V // V
// t_var1 | t_var2 | t_var3 | ... // t_var1 | t_var2 | t_var3 | ...
// -------------------------------------------------- // --------------------------------------------------
// //
// so offset to tp should be negative, we get offset // so offset to tp should be negative, we get offset
@ -4656,7 +4656,7 @@ Target_tilegx<size, big_endian>::Relocate::relocate(
|| issue_undefined_symbol_error(gsym)); || issue_undefined_symbol_error(gsym));
return false; return false;
} }
typename elfcpp::Elf_types<size>::Elf_Addr value typename elfcpp::Elf_types<size>::Elf_Addr value
= psymval->value(relinfo->object, 0); = psymval->value(relinfo->object, 0);
symval.set_output_value(value); symval.set_output_value(value);
@ -4836,7 +4836,7 @@ Target_tilegx<size, big_endian>::relocate_relocs(
const unsigned char* prelocs, const unsigned char* prelocs,
size_t reloc_count, size_t reloc_count,
Output_section* output_section, 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, const Relocatable_relocs* rr,
unsigned char* view, unsigned char* view,
typename elfcpp::Elf_types<size>::Elf_Addr view_address, typename elfcpp::Elf_types<size>::Elf_Addr view_address,
@ -4889,7 +4889,7 @@ Target_tilegx<size, big_endian>::do_ehframe_datarel_base() const
return ssym->value(); return ssym->value();
} }
// The selector for tilegx object files. // The selector for tilegx object files.
template<int size, bool big_endian> template<int size, bool big_endian>
class Target_selector_tilegx : public Target_selector class Target_selector_tilegx : public Target_selector

View File

@ -477,7 +477,7 @@ class Target_x86_64 : public Sized_target<size, false>
const unsigned char* prelocs, const unsigned char* prelocs,
size_t reloc_count, size_t reloc_count,
Output_section* output_section, Output_section* output_section,
off_t offset_in_output_section, typename elfcpp::Elf_types<size>::Elf_Off offset_in_output_section,
const Relocatable_relocs*, const Relocatable_relocs*,
unsigned char* view, unsigned char* view,
typename elfcpp::Elf_types<size>::Elf_Addr view_address, typename elfcpp::Elf_types<size>::Elf_Addr view_address,
@ -2307,7 +2307,7 @@ Target_x86_64<size>::Scan::local(Symbol_table* symtab,
unsigned int r_sym = elfcpp::elf_r_sym<size>(reloc.get_r_info()); unsigned int r_sym = elfcpp::elf_r_sym<size>(reloc.get_r_info());
Reloc_section* rela_dyn = target->rela_dyn_section(layout); Reloc_section* rela_dyn = target->rela_dyn_section(layout);
rela_dyn->add_local_relative(object, r_sym, rela_dyn->add_local_relative(object, r_sym,
(size == 32 (size == 32
? elfcpp::R_X86_64_RELATIVE64 ? elfcpp::R_X86_64_RELATIVE64
: elfcpp::R_X86_64_RELATIVE), : elfcpp::R_X86_64_RELATIVE),
output_section, data_shndx, output_section, data_shndx,
@ -4221,7 +4221,7 @@ Target_x86_64<size>::relocate_relocs(
const unsigned char* prelocs, const unsigned char* prelocs,
size_t reloc_count, size_t reloc_count,
Output_section* output_section, 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, const Relocatable_relocs* rr,
unsigned char* view, unsigned char* view,
typename elfcpp::Elf_types<size>::Elf_Addr view_address, typename elfcpp::Elf_types<size>::Elf_Addr view_address,