diff mbox

[14/14] ARM: set --be8 when linking modules

Message ID 1374661682-9349-15-git-send-email-ben.dooks@codethink.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Ben Dooks July 24, 2013, 10:28 a.m. UTC
To avoid having to make every text section swap the instruction order
of all instructions, make sure modules are built also built with --be8
(as is the current kernel final link).

If we do not do this, we would end up having to swap all instructions
when loading a module, instead of just the instructions that we are
applying ELF relocations to.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
---
 arch/arm/Makefile |    1 +
 1 file changed, 1 insertion(+)

Comments

Will Deacon July 24, 2013, 4:25 p.m. UTC | #1
On Wed, Jul 24, 2013 at 11:28:02AM +0100, Ben Dooks wrote:
> To avoid having to make every text section swap the instruction order
> of all instructions, make sure modules are built also built with --be8
> (as is the current kernel final link).
> 
> If we do not do this, we would end up having to swap all instructions
> when loading a module, instead of just the instructions that we are
> applying ELF relocations to.
> 
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>

Reviewed-by: Will Deacon <will.deacon@arm.com>

Will
Nicolas Pitre July 24, 2013, 11:41 p.m. UTC | #2
On Wed, 24 Jul 2013, Ben Dooks wrote:

> To avoid having to make every text section swap the instruction order
> of all instructions, make sure modules are built also built with --be8
> (as is the current kernel final link).
> 
> If we do not do this, we would end up having to swap all instructions
> when loading a module, instead of just the instructions that we are
> applying ELF relocations to.

That wouldn't work anyway as you'd also swap constants embedded in the 
instruction stream such as literal pools which are most certainly in BE 
mode already.

> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>

Please make sure the kernel will reject modules if they're not compiled 
appropriately.  Either by looking at the ELF record or by altering 
MODULE_ARCH_VERMAGIC.


Nicolas
diff mbox

Patch

diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 1ba358b..70bc19e 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -16,6 +16,7 @@  LDFLAGS		:=
 LDFLAGS_vmlinux	:=-p --no-undefined -X
 ifeq ($(CONFIG_CPU_ENDIAN_BE8),y)
 LDFLAGS_vmlinux	+= --be8
+LDFLAGS_MODULE	+= --be8
 endif
 
 OBJCOPYFLAGS	:=-O binary -R .comment -S