From 703d02da7640f756751a5cd94961127d68efcd22 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Thu, 30 Aug 2012 05:54:59 +0000 Subject: * output.h (Output_reloc::Output_reloc ): Add is_relative param. Adjust calls. (Output_reloc::add_output_section_relative): New functions. * output.cc (Output_reloc::Output_reloc ): Handle is_relative. (Output_reloc::symbol_value): Handle SECTION_CODE. --- gold/output.h | 67 ++++++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 52 insertions(+), 15 deletions(-) (limited to 'gold/output.h') diff --git a/gold/output.h b/gold/output.h index 25a6b89..98c07fc 100644 --- a/gold/output.h +++ b/gold/output.h @@ -1046,11 +1046,11 @@ class Output_reloc // A reloc against the STT_SECTION symbol of an output section. Output_reloc(Output_section* os, unsigned int type, Output_data* od, - Address address); + Address address, bool is_relative); Output_reloc(Output_section* os, unsigned int type, - Sized_relobj* relobj, - unsigned int shndx, Address address); + Sized_relobj* relobj, unsigned int shndx, + Address address, bool is_relative); // An absolute relocation with no symbol. @@ -1296,14 +1296,15 @@ class Output_reloc // A reloc against the STT_SECTION symbol of an output section. Output_reloc(Output_section* os, unsigned int type, Output_data* od, - Address address, Addend addend) - : rel_(os, type, od, address), addend_(addend) + Address address, Addend addend, bool is_relative) + : rel_(os, type, od, address, is_relative), addend_(addend) { } Output_reloc(Output_section* os, unsigned int type, Sized_relobj* relobj, - unsigned int shndx, Address address, Addend addend) - : rel_(os, type, relobj, shndx, address), addend_(addend) + unsigned int shndx, Address address, Addend addend, + bool is_relative) + : rel_(os, type, relobj, shndx, address, is_relative), addend_(addend) { } // An absolute relocation with no symbol. @@ -1745,13 +1746,13 @@ class Output_data_reloc void add_output_section(Output_section* os, unsigned int type, Output_data* od, Address address) - { this->add(od, Output_reloc_type(os, type, od, address)); } + { this->add(od, Output_reloc_type(os, type, od, address, false)); } void add_output_section(Output_section* os, unsigned int type, Output_data* od, Sized_relobj* relobj, unsigned int shndx, Address address) - { this->add(od, Output_reloc_type(os, type, relobj, shndx, address)); } + { this->add(od, Output_reloc_type(os, type, relobj, shndx, address, false)); } void add_output_section_generic(Output_section* os, unsigned int type, @@ -1760,7 +1761,8 @@ class Output_data_reloc { gold_assert(addend == 0); this->add(od, Output_reloc_type(os, type, od, - convert_types(address))); + convert_types(address), + false)); } void @@ -1773,9 +1775,24 @@ class Output_data_reloc Sized_relobj* sized_relobj = static_cast*>(relobj); this->add(od, Output_reloc_type(os, type, sized_relobj, shndx, - convert_types(address))); + convert_types(address), + false)); } + // As above, but the reloc TYPE is relative + + void + add_output_section_relative(Output_section* os, unsigned int type, + Output_data* od, Address address) + { this->add(od, Output_reloc_type(os, type, od, address, true)); } + + void + add_output_section_relative(Output_section* os, unsigned int type, + Output_data* od, + Sized_relobj* relobj, + unsigned int shndx, Address address) + { this->add(od, Output_reloc_type(os, type, relobj, shndx, address, true)); } + // Add an absolute relocation. void @@ -2021,14 +2038,14 @@ class Output_data_reloc void add_output_section(Output_section* os, unsigned int type, Output_data* od, Address address, Addend addend) - { this->add(od, Output_reloc_type(os, type, od, address, addend)); } + { this->add(od, Output_reloc_type(os, type, od, address, addend, false)); } void add_output_section(Output_section* os, unsigned int type, Output_data* od, Sized_relobj* relobj, unsigned int shndx, Address address, Addend addend) { this->add(od, Output_reloc_type(os, type, relobj, shndx, address, - addend)); } + addend, false)); } void add_output_section_generic(Output_section* os, unsigned int type, @@ -2037,7 +2054,8 @@ class Output_data_reloc { this->add(od, Output_reloc_type(os, type, od, convert_types(address), - convert_types(addend))); + convert_types(addend), + false)); } void @@ -2050,7 +2068,26 @@ class Output_data_reloc static_cast*>(relobj); this->add(od, Output_reloc_type(os, type, sized_relobj, shndx, convert_types(address), - convert_types(addend))); + convert_types(addend), + false)); + } + + // As above, but the reloc TYPE is relative + + void + add_output_section_relative(Output_section* os, unsigned int type, + Output_data* od, Address address, Addend addend) + { this->add(od, Output_reloc_type(os, type, od, address, addend, true)); } + + void + add_output_section_relative(Output_section* os, unsigned int type, + Output_data* od, + Sized_relobj* relobj, + unsigned int shndx, Address address, + Addend addend) + { + this->add(od, Output_reloc_type(os, type, relobj, shndx, + address, addend, true)); } // Add an absolute relocation. -- cgit v1.1