RE: [PATCH] ARC: ARCv2: jump label: implement jump label patching

From: Alexey Brodkin
Date: Fri Jun 21 2019 - 11:39:34 EST


Hi Vineet,

> -----Original Message-----
> From: linux-snps-arc <linux-snps-arc-bounces@xxxxxxxxxxxxxxxxxxx> On Behalf Of Vineet Gupta
> Sent: Thursday, June 20, 2019 11:50 PM
> To: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
> Cc: linux-arch@xxxxxxxxxxxxxxx; Ard Biesheuvel <ard.biesheuvel@xxxxxxxxxx>; Alexey Brodkin
> <abrodkin@xxxxxxxxxxxx>; linux-kernel@xxxxxxxxxxxxxxx; Jason Baron <jbaron@xxxxxxxxxx>; Paolo Bonzini
> <pbonzini@xxxxxxxxxx>; linux-snps-arc@xxxxxxxxxxxxxxxxxxx; Eugeniy Paltsev
> <Eugeniy.Paltsev@xxxxxxxxxxxx>
> Subject: Re: [PATCH] ARC: ARCv2: jump label: implement jump label patching

[snip]

> Insn encoding is always middl eendina - irrespective of endianness.

Apparently only in little-endian mode instructions are encoded as middle-endian,
see:
-------------->8-------------
# cat endian.S

.global myfunc
myfunc:
mov r0, r1
-------------->8-------------

Little-endian:
-------------->8-------------
# arc-linux-gcc -c -mcpu=archs endian.S -EL
# arc-linux-objdump -d endian.o

endian.o: file format elf32-littlearc

Disassembly of section .text:
00000000 <myfunc>:
0: 200a 0040 mov r0,r1

# arc-linux-readelf -x .text endian.o
Hex dump of section '.text':
0x00000000 0a204000 . @.
-------------->8-------------

Big-endian:
-------------->8-------------
# arc-linux-gcc -c -mcpu=archs endian.S -EB
# arc-linux-objdump -d endian.o

endian.o: file format elf32-bigarc

Disassembly of section .text:
00000000 <myfunc>:
0: 200a 0040 mov r0,r1

# arc-linux-readelf -x .text endian.o

Hex dump of section '.text':
0x00000000 200a0040 ..@
-------------->8-------------

-Alexey