From 7bb3655e07c50280b666c5e572e4b127f4746b84 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Mon, 1 Oct 2007 23:42:58 +0000 Subject: [PATCH] Cleanups from Craig Silverstein. --- gold/i386.cc | 4 +--- gold/po/gold.pot | 30 ++++++++++++++++-------------- gold/reloc.h | 46 ---------------------------------------------- gold/x86_64.cc | 7 +++++++ 4 files changed, 24 insertions(+), 63 deletions(-) diff --git a/gold/i386.cc b/gold/i386.cc index 54c388b63d8..b041166385e 100644 --- a/gold/i386.cc +++ b/gold/i386.cc @@ -199,7 +199,7 @@ class Target_i386 : public Sized_target<32, false> make_plt_entry(Symbol_table*, Layout*, Symbol*); // Get the PLT section. - Output_data_plt_i386* + const Output_data_plt_i386* plt_section() const { gold_assert(this->plt_ != NULL); @@ -370,8 +370,6 @@ Output_data_plt_i386::Output_data_plt_i386(Layout* layout, elfcpp::SHF_ALLOC, this->rel_); } -// For some reason - void Output_data_plt_i386::do_adjust_output_section(Output_section* os) { diff --git a/gold/po/gold.pot b/gold/po/gold.pot index 208c6b35b5c..ca36b5cdce7 100644 --- a/gold/po/gold.pot +++ b/gold/po/gold.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2007-10-01 14:30-0700\n" +"POT-Creation-Date: 2007-10-01 16:41-0700\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -270,54 +270,56 @@ msgstr "" msgid "%s: missing expected TLS relocation\n" msgstr "" -#: i386.cc:751 i386.cc:912 i386.cc:1174 x86_64.cc:733 x86_64.cc:886 -#: x86_64.cc:1169 +#. TODO(csilvers): correct? +#. TODO(csilvers): correct? +#: i386.cc:749 i386.cc:910 i386.cc:1172 x86_64.cc:744 x86_64.cc:911 +#: x86_64.cc:1247 #, c-format msgid "%s: %s: unexpected reloc %u in object file\n" msgstr "" -#: i386.cc:788 i386.cc:808 x86_64.cc:767 x86_64.cc:788 +#: i386.cc:786 i386.cc:806 x86_64.cc:781 x86_64.cc:804 #, c-format msgid "%s: %s: unsupported reloc %u against local symbol\n" msgstr "" -#: i386.cc:948 i386.cc:969 x86_64.cc:920 x86_64.cc:942 +#: i386.cc:946 i386.cc:967 x86_64.cc:947 x86_64.cc:971 #, c-format msgid "%s: %s: unsupported reloc %u against global symbol %s\n" msgstr "" -#: i386.cc:992 +#: i386.cc:990 #, c-format msgid "%s: %s: unsupported RELA reloc section\n" msgstr "" -#: i386.cc:1082 x86_64.cc:1055 +#: i386.cc:1080 x86_64.cc:1084 #, c-format msgid "%s: %s: missing expected TLS relocation\n" msgstr "" -#: i386.cc:1206 i386.cc:1283 i386.cc:1294 x86_64.cc:1203 x86_64.cc:1281 -#: x86_64.cc:1290 +#: i386.cc:1204 i386.cc:1281 i386.cc:1292 x86_64.cc:1287 x86_64.cc:1365 +#: x86_64.cc:1374 #, c-format msgid "%s: %s: unsupported reloc %u\n" msgstr "" -#: i386.cc:1233 x86_64.cc:1231 +#: i386.cc:1231 x86_64.cc:1315 #, c-format msgid "%s: %s: TLS reloc but no TLS segment\n" msgstr "" -#: i386.cc:1268 x86_64.cc:1266 +#: i386.cc:1266 x86_64.cc:1350 #, c-format msgid "%s: %s: unsupported reloc type %u\n" msgstr "" -#: i386.cc:1477 x86_64.cc:1478 +#: i386.cc:1475 x86_64.cc:1562 #, c-format msgid "%s: %s: TLS relocation out of range\n" msgstr "" -#: i386.cc:1495 x86_64.cc:1496 +#: i386.cc:1493 x86_64.cc:1580 #, c-format msgid "%s: %s: TLS relocation against invalid instruction\n" msgstr "" @@ -725,7 +727,7 @@ msgstr "" msgid "%s: %s: undefined reference to '%s'\n" msgstr "" -#: x86_64.cc:965 +#: x86_64.cc:994 #, c-format msgid "%s: %s: unsupported REL reloc section\n" msgstr "" diff --git a/gold/reloc.h b/gold/reloc.h index bc538c561f8..1bf0457ecc3 100644 --- a/gold/reloc.h +++ b/gold/reloc.h @@ -220,31 +220,6 @@ private: elfcpp::Swap::writeval(wv, x); } - // Like rel(), but sign-extends the value to SIZE. - template - static inline void - signedrel(unsigned char* view, - const Sized_relobj* object, - const Symbol_value* psymval) - { - typedef typename elfcpp::Swap::Valtype Valtype; - typedef typename elfcpp::Swap::Signed_valtype - Signed_valtype; - typedef typename elfcpp::Swap::Valtype Sizetype; - typedef typename elfcpp::Swap::Signed_valtype - Signed_sizetype; - Valtype* wv = reinterpret_cast(view); - Valtype x = elfcpp::Swap::readval(wv); - - // Sign extend the value. - Signed_valtype signed_x = static_cast(x); - Signed_sizetype signed_extended_x = static_cast(signed_x); - Sizetype unsigned_extended_x = static_cast(signed_extended_x); - - x = psymval->value(object, unsigned_extended_x); - elfcpp::Swap::writeval(wv, x); - } - // Do a simple PC relative relocation with the addend in the section // contents. VALSIZE is the size of the value. template @@ -333,13 +308,6 @@ public: unsigned char addend) { This::template rela<8>(view, object, psymval, addend); } - // Do an 8-bit REL relocation, sign extending the addend to SIZE. - static inline void - rel8s(unsigned char* view, - const Sized_relobj* object, - const Symbol_value* psymval) - { This::template signedrel<8>(view, object, psymval); } - // Do a simple 8-bit PC relative relocation with the addend in the // section contents. static inline void @@ -393,13 +361,6 @@ public: elfcpp::Elf_Half addend) { This::template rela<16>(view, object, psymval, addend); } - // Do a 16-bit REL relocation, sign extending the addend to SIZE. - static inline void - rel16s(unsigned char* view, - const Sized_relobj* object, - const Symbol_value* psymval) - { This::template signedrel<16>(view, object, psymval); } - // Do a simple 16-bit PC relative REL relocation with the addend in // the section contents. static inline void @@ -454,13 +415,6 @@ public: elfcpp::Elf_Word addend) { This::template rela<32>(view, object, psymval, addend); } - // Do a 32-bit REL relocation, sign extending the addend to SIZE. - static inline void - rel32s(unsigned char* view, - const Sized_relobj* object, - const Symbol_value* psymval) - { This::template signedrel<32>(view, object, psymval); } - // Do a simple 32-bit PC relative REL relocation with the addend in // the section contents. static inline void diff --git a/gold/x86_64.cc b/gold/x86_64.cc index 4d73eac705d..f9de8abb33e 100644 --- a/gold/x86_64.cc +++ b/gold/x86_64.cc @@ -1121,10 +1121,17 @@ Target_x86_64::Relocate::relocate(const Relocate_info<64, false>* relinfo, break; case elfcpp::R_X86_64_32: + // FIXME: we need to verify that value + addend fits into 32 bits: + // uint64_t x = value + addend; + // x == static_cast(static_cast(x)) + // Likewise for other <=32-bit relocations (but see R_X86_64_32S). Relocate_functions<64, false>::rela32(view, object, psymval, addend); break; case elfcpp::R_X86_64_32S: + // FIXME: we need to verify that value + addend fits into 32 bits: + // int64_t x = value + addend; // note this quantity is signed! + // x == static_cast(static_cast(x)) Relocate_functions<64, false>::rela32(view, object, psymval, addend); break; -- 2.30.2