2015Q4 newlib nano for ARMv5TE uses Thumb-2 instructions
After upgrading to 5.2 2015Q4 from 4.9 2015Q3, I encountered an undefined instruction exception on my ARM968E-S (NXP LPC2929). I investigated and found that the default newlib nano (arm-none-
<other object files>
lib_a-strlen.o: file format elf32-littlearm
Disassembly of section .text:
00000000 <strlen>:
0: 4603 mov r3, r0
2: f813 2b01 ldrb.w r2, [r3], #1
6: 2a00 cmp r2, #0
8: d1fb bne.n 2 <strlen+0x2>
a: 1a18 subs r0, r3, r0
c: 3801 subs r0, #1
e: 4770 bx lr
<other object files>
This makes it into my final executable, and the CPU never gets past <strlen+2>. It appears from a quick regex search of the objdump output that there are no other functions using Thumb instructions, so perhaps this was a hand-coded assembly function?
I'm using the prebuilt Win32 toolchain from Launchpad, host OS Windows 10 Pro. My final link command is:
arm-none-eabi-g++ -g -Og -mcpu=arm968e-s -march=armv5te --specs=nano.specs -nostartfiles -Wl,--gc-sections -Tboard/cs2.ld -Wl,-Map=
I would expect this to produce a binary with only ARM and Thumb (not Thumb-2) instructions. Using the 2015Q3 release, for example, strlen is all in ARM mode.
Question information
- Language:
- English Edit question
- Status:
- Answered
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask Doug Brunner for more information if necessary.