broken big-endian compilation on GCC8
ARM GCC 8 (Version 8-2019-q3-update or 8-2018-q4-major) generate invalid binary for big endian. GCC7 and bellow was correct. IT looks like some problem on linker (ld tool from binutils)
Short description:
Lets have empty file empty.ld and file test.c with this content:
int main(){}
Compile it by command
arm-
Make dump by command
arm-
GCC8 create invalid output like this:
test.elf: file format elf32-littlearm
Contents of section .init:
0000 f8b500bf .... <<<<< !!!!!!! here is problem !!!!!!!
Disassembly of section .init:
00000000 <_init>:
0: b5f8 push {r3, r4, r5, r6, r7, lr}
2: bf00 nop
Correct GCC7 generated contents of section .init:
0000 b5f8bf00 ....
Binary content have broken endianity for every instruction.
In long, it looks like problem on ld (binutils). When I try compile it to object file, this step is correct.
arm-none-eabi-g++ -o test.o -c -mcpu=cortex-r5 -mthumb -T empty.ld -Wl,--gc-sections test.c -mbig-endian
arm-none-
It create correct binary dump:
test.o: file format elf32-bigarm
Contents of section .text:
0000 b480af00 23004618 46bdbc80 4770 ....#.F.F...Gp
Disassembly of section .text:
00000000 <main>:
0: b480 push {r7}
2: af00 add r7, sp, #0
4: 2300 movs r3, #0
6: 4618 mov r0, r3
8: 46bd mov sp, r7
a: bc80 pop {r7}
c: 4770 bx lr
Jiri
PS: I know that big-endian is not supported version. Default package not contain needed multilib library variants. For all previous version was sufficient to use simple patch https:/
Something in GCC8 broke it completely.
Question information
- Language:
- English Edit question
- Status:
- Solved
- Assignee:
- No assignee Edit question
- Solved by:
- jdobry
- Solved:
- Last query:
- Last reply: