binutils: fix building perf on ARC
It turned out one of the previous fixes (required to build Linux
kernel)
------------------>8-------------------
ARC Binutils: https://github.com/foss-for-synopsys-dwc-arc-processors/binutils-gdb/commit/
a65b844aed9153789356e098984452df2f5d9058
Buildroot: http://git.buildroot.net/buildroot/commit/?id=
2d4e2e238a0ea9395152ae71d882d79b1f35094c
------------------>8-------------------
broke building of some other software packages.
In particular perf built for ARCv2 had corrupted .plt entries that lead
to immediate crash on perf execution.
That's an example of normal .plt entries:
------------------>8-------------------
< 1-st PLT entry >:
12c24: 30 27 8c 7f 0d 00 74 95 ld r12,[pcl,0x000d9574]
12c2c: 21 20 00 03 j.d [r12]
12c30: 0a 24 c0 1f mov r12,pcl
< 2-nd PLT entry >:
12c34: 30 27 8c 7f 0d 00 68 95 ld r12,[pcl,0x000d9568]
12c3c: 21 20 00 03 j.d [r12]
12c40: 0a 24 c0 1f mov r12,pcl
------------------>8-------------------
Note right after jump in its delay-slot r12 gets set with current value
of program counter. This is required for the first symbol resolution,
see implementation of _dl_linux_resolve here:
http://git.uclibc.org/uClibc/tree/ldso/ldso/arc/resolve.S#n46
And that's what we got in .plt after mentioned fixes:
------------------>8-------------------
< 1-st PLT entry>:
13384: 30 27 8c 7f 0f 00 84 75 ld r12,[pcl,0x000f7584]
1338c: 21 20 00 03 j.d [r12]
< 2-nd PLT entry>:
13390: 30 27 8c 7f 0f 00 78 75 ld r12,[pcl,0x000f7578]
13398: 21 20 00 03 j.d [r12]
------------------>8-------------------
Note r12 setup is missing.
That happened because linker thought the size of PLT entry is 12 bytes
(which is exactly the size of PLT entry for ARCv1, read ARC750/770)
while for ARCv2 PLT entry is 16-bytes long. And erroneously trailing 4
bytes were truncated.
Current commit fixes this misbehavior and PLT gets generated properly
again.
Now we have a fix for that issue, see
https://github.com/foss-for-synopsys-dwc-arc-processors/binutils-gdb/commit/
5df50c61083165455aae5504c5c3566fa5ccebb1
This fix is in arc-2.23-dev branch and will be a part of the next
release of ARC tools, so then this patch must be removed from buildroot.
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>