summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRahul Chaudhry <rahulchaudhry@google.com>2018-03-27 06:39:14 +0000
committerandroid-build-merger <android-build-merger@google.com>2018-03-27 06:39:14 +0000
commit7f65d8fed5de8795b736897cfd2345a2b3ece9fc (patch)
tree1617aeedbfca2349489397204ad988a7bf8d6dda
parent8d586522fb86dc59bd9401aafabcdc69b9320b48 (diff)
parent61006b8176afc5d532e2c15f68ff53ade41f6e84 (diff)
downloadbinutils-7f65d8fed5de8795b736897cfd2345a2b3ece9fc.tar.gz
gold: better error message on seeing odd offset for RELR relocation. am: b4a70cbe16
am: 61006b8176 Change-Id: I9d5b9c2f0f760e5833c66e9d2ec338350c3f9be8
-rw-r--r--binutils-2.27/gold/dwp.h5
-rw-r--r--binutils-2.27/gold/output.h15
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;