diff options
author | Rahul Chaudhry <rahulchaudhry@google.com> | 2018-03-27 06:33:10 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2018-03-27 06:33:10 +0000 |
commit | 61006b8176afc5d532e2c15f68ff53ade41f6e84 (patch) | |
tree | 1617aeedbfca2349489397204ad988a7bf8d6dda | |
parent | 73fe135cd39d4b1bcba39293dc9446a7b26c5d32 (diff) | |
parent | b4a70cbe16cb2549cc554be9f995cfd515442c6b (diff) | |
download | binutils-61006b8176afc5d532e2c15f68ff53ade41f6e84.tar.gz |
gold: better error message on seeing odd offset for RELR relocation.
am: b4a70cbe16
Change-Id: Iee9ed64d9af676334c861e08485b79119247cf5a
-rw-r--r-- | binutils-2.27/gold/dwp.h | 5 | ||||
-rw-r--r-- | binutils-2.27/gold/output.h | 15 |
2 files changed, 18 insertions, 2 deletions
diff --git a/binutils-2.27/gold/dwp.h b/binutils-2.27/gold/dwp.h index c0c4d567..4538a199 100644 --- a/binutils-2.27/gold/dwp.h +++ b/binutils-2.27/gold/dwp.h @@ -84,6 +84,11 @@ gold_exit(Exit_status status) ATTRIBUTE_NORETURN; extern void gold_fatal(const char* format, ...) ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF_1; +// This function is called to issue an error. This will cause gold to +// eventually exit with failure. +extern void +gold_error(const char* msg, ...) ATTRIBUTE_PRINTF_1; + // This function is called to issue a warning. extern void gold_warning(const char* msg, ...) ATTRIBUTE_PRINTF_1; diff --git a/binutils-2.27/gold/output.h b/binutils-2.27/gold/output.h index 78fd4265..f4b8e5eb 100644 --- a/binutils-2.27/gold/output.h +++ b/binutils-2.27/gold/output.h @@ -27,6 +27,10 @@ #include <list> #include <vector> +// __STDC_FORMAT_MACROS is needed to turn on macros in <inttypes.h>. +#define __STDC_FORMAT_MACROS +#include <inttypes.h> + #include "elfcpp.h" #include "mapfile.h" #include "layout.h" @@ -2523,8 +2527,15 @@ class Output_data_reloc<elfcpp::SHT_RELR, dynamic, size, big_endian> while (curr != this->relocs_.end()) { Address current = curr->rel_.get_address(); - // Odd addresses are not supported in SHT_RELR. - gold_assert(current%2 == 0); + if (current%2 != 0) + { + // Odd addresses are not supported in SHT_RELR. + gold_error( + _("odd offset for RELR relocation (0x%" PRIx64 "), " + "pass --no-experimental-use-relr flag " + "to disable RELR dynamic relocations"), + static_cast<uint64_t>(current)); + } Relr_Data bits = 0; typename Relocs::iterator next = curr; |