[Bug c/71922] New: arm: ifuncs are broken in for arm (gcc generates incorrect code in object file)

2016-07-18 Thread dimitry at google dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71922

Bug ID: 71922
   Summary: arm: ifuncs are broken in for arm (gcc generates
incorrect code in object file)
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: dimitry at google dot com
  Target Milestone: ---

This is code in question:
https://android.googlesource.com/platform/bionic/+/master/tests/libs/dlopen_testlib_ifunc.c

This library is used to test ifunc functionality in android-linker.

after compiling an object file looks like this...

0948 :
 948:   f001 bb2e   b.w 1fa8
<_ZN9libunwind13Registers_arm19restoreiWMMXControlEPj+0x14>

1fa8:   46c04778;  instruction:
0x46c04778
1fac:   e59fc000ldr ip, [pc]; 1fb4
<_ZN9libunwind13Registers_arm19restoreiWMMXControlEPj+0x20>
1fb0:   e08cf00fadd pc, ip, pc
1fb4:   e96d;  instruction:
0xe96d
1fb8:   46c04778;  instruction:
0x46c04778
1fbc:   e59fc000ldr ip, [pc]; 1fc4
<_ZN9libunwind13Registers_arm19restoreiWMMXControlEPj+0x30>
1fc0:   e08cf00fadd pc, ip, pc
1fc4:   e7c4;  instruction:
0xe7c4
1fc8:   46c04778;  instruction:
0x46c04778
1fcc:   e59fc000ldr ip, [pc]; 1fd4
<_ZN9libunwind13Registers_arm19restoreiWMMXControlEPj+0x40>
1fd0:   e08cf00fadd pc, ip, pc
1fd4:   ff4c;  instruction:
0xff4c
1fd8:   46c04778;  instruction:
0x46c04778
1fdc:   e59fc000ldr ip, [pc]; 1fe4
<_ZN9libunwind13Registers_arm19restoreiWMMXControlEPj+0x50>
1fe0:   e08cf00fadd pc, ip, pc
1fe4:   ffac;  instruction:
0xffac


which seems to be wrong.

Note that other platforms work fine and generate correct code for this - tested
arm64/x86/x86_64

[Bug target/71922] arm: ifuncs are broken in for arm (gcc generates incorrect code in object file)

2016-07-18 Thread dimitry at google dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71922

--- Comment #2 from dimitry  ---
The test is failing at runtime. which was the reason I started looking at
objdump

[Bug target/71922] arm: ifuncs are broken in for arm (gcc generates incorrect code in object file)

2016-07-18 Thread dimitry at google dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71922

--- Comment #4 from dimitry  ---
(I am from the bionic team)

I do not have access to arm ld-linux.so.

The problem here is that code generated by gcc is incorrect for arm.

[Bug target/71922] arm: ifuncs are broken in for arm (gcc generates incorrect code in object file)

2016-07-18 Thread dimitry at google dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71922

--- Comment #6 from dimitry  ---
ok one correction - this is objdump of the .so file, not the object file. What
I expected to see here is branch to ptl (which uses result of ARM_IRELATIVE
reloc) This does not seem to be the case. (the reloc itself is in place and
looks good)

(I am taking another look at .o files for arm/arm64)