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

Alexey Brodkin
2019-06-21T15:39:27Z

Hi Vineet,

> -----Original Message-----
> From: linux-snps-arc <linux-snps-arc-bounces@lists.infradead.org> On Behalf Of Vineet Gupta
> Sent: Thursday, June 20, 2019 11:50 PM
> To: Peter Zijlstra <peterz@infradead.org>
> Cc: linux-arch@vger.kernel.org; Ard Biesheuvel <ard.biesheuvel@linaro.org>; Alexey Brodkin
> <abrodkin@synopsys.com>; linux-kernel@vger.kernel.org; Jason Baron <jbaron@akamai.com>; Paolo Bonzini
> <pbonzini@redhat.com>; linux-snps-arc@lists.infradead.org; Eugeniy Paltsev
> <Eugeniy.Paltsev@synopsys.com>
> 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