From 080bb7bbe9d06424be5a989ae87160d655d22e2e Mon Sep 17 00:00:00 2001
From: Nick Clifton <nickc@redhat.com>
Date: Fri, 10 Apr 2015 08:26:07 +0100
Subject: [PATCH] Add documentation about the interation of the ARM assembler's
 -EB option and the linker's --be8 option.

	PR binutils/18198
	* ld.texinfo (--be8): Add a note about the interaction of this
	option with the assembler's -EB option.

	* doc/c-arm.texi (ARM Options): Add a note about the interaction of
	the -EB option with the linker's --be8 option.
---
 gas/ChangeLog      | 6 ++++++
 gas/doc/c-arm.texi | 6 ++++++
 ld/ChangeLog       | 6 ++++++
 ld/ld.texinfo      | 6 ++++--
 4 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/gas/ChangeLog b/gas/ChangeLog
index fb4355eb787..636ef3c6fd5 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,9 @@
+2015-04-10  Nick Clifton  <nickc@redhat.com>
+
+	PR binutils/18198
+	* doc/c-arm.texi (ARM Options): Add a note about the interaction of
+	the -EB option with the linker's --be8 option.
+
 2015-04-09  Hans-Peter Nilsson  <hp@axis.com>
 
 	* doc/c-rx.texi: Fix markup typos in last change.
diff --git a/gas/doc/c-arm.texi b/gas/doc/c-arm.texi
index 18becb7aa37..f07aa62bd41 100644
--- a/gas/doc/c-arm.texi
+++ b/gas/doc/c-arm.texi
@@ -362,6 +362,12 @@ and
 This option specifies that the output generated by the assembler should
 be marked as being encoded for a big-endian processor.
 
+Note: If a program is being built for a system with big-endian data
+and little-endian instructions then it should be assembled with the
+@option{-EB} option, (all of it, code and data) and then linked with
+the @option{--be8} option.  This will reverse the endianness of the
+instructions back to little-endian, but leave the data as big-endian.
+
 @cindex @code{-EL} command line option, ARM
 @item -EL
 This option specifies that the output generated by the assembler should
diff --git a/ld/ChangeLog b/ld/ChangeLog
index b4d3ceb63c9..da54c5c5605 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,9 @@
+2015-04-10  Nick Clifton  <nickc@redhat.com>
+
+	PR binutils/18198
+	* ld.texinfo (--be8): Add a note about the interaction of this
+	option with the assembler's -EB option.
+
 2015-04-10  Alan Modra  <amodra@gmail.com>
 
 	PR ld/18223
diff --git a/ld/ld.texinfo b/ld/ld.texinfo
index 82735e9558d..5384c98bd15 100644
--- a/ld/ld.texinfo
+++ b/ld/ld.texinfo
@@ -6424,8 +6424,10 @@ import tables. By default this option is turned off.
 @cindex BE8
 @kindex --be8
 The @samp{--be8} switch instructs @command{ld} to generate BE8 format
-executables.  This option is only valid when linking big-endian objects.
-The resulting image will contain big-endian data and little-endian code.
+executables.  This option is only valid when linking big-endian
+objects - ie ones which have been assembled with the @option{-EB}
+option.  The resulting image will contain big-endian data and
+little-endian code.
 
 @cindex TARGET1
 @kindex --target1-rel