Comment 18 for bug 1697255

Revision history for this message
John (jjpenn) wrote :

Bumping this thread. Has any fix/patch been put in place for this issue. I just got hit with the same issue on a Cortex-M4, linking with the latest GCC version (GNU Tools for Arm Embedded Processors 7-2018-q2-update) against an ARM Holdings generated elf file. I am using -fpie which seems to cause this issue. The symbols from the ARM elf file are:
00006d31 0 FUNC GLOBAL DEFAULT ABS memcpy (using readelf)
00006d31 g F *ABS* 00000000 memcpy (using objdump)

and GCC generates the following veneer:
00512ccc <__memcmp_veneer>:
  512ccc: 4778 bx pc <--THIS IS BAD!
  512cce: 46c0 nop ; (mov r8, r8)
  512cd0: e59fc004 ldr ip, [pc, #4] ; 512cdc <__memcmp_veneer+0x10>
  512cd4: e08fc00c add ip, pc, ip
  512cd8: e12fff1c bx ip
  512cdc: ffb6b1ed .word 0xffb6b1ed

The first instruction causes the mode to switch from Thumb to ARM. As it has been stated before this is illegal.
There is nothing I can do except use -mlong-calls which bloats the code by nearly 10%.