ctype.h library function isalpha() issue

Asked by JiriJ

Dear all,

we are using the previous version of GCC - 4.6 2012q4. The library function isalpha() is being called from our code. But it seems that there is an error within the lib. Please check the following piece of listing file (and disassembler) and MAP file:
-------------------------------------------------------
LST file:
-------------------------------------------------------
                                               return(isalpha(chr));
  46 .loc 1 107 0
  47 0004 F2400300 movw r3, #:lower16:__ctype_ptr__
  48 0008 F2C00300 movt r3, #:upper16:__ctype_ptr__
  49 000c 681A ldr r2, [r3, #0]
  50 000e 9B01 ldr r3, [sp, #4]
  51 0010 F1030301 add r3, r3, #1
  52 0014 18D3 adds r3, r2, r3
  53 0016 781B ldrb r3, [r3, #0] @ zero_extendqisi2
  54 0018 F0030303 and r3, r3, #3

-------------------------------------------------------
disassembler by debugger:
-------------------------------------------------------
return(isalpha(chr));
0000b224: movw r3, #36048 ; 0x8cd0
0000b228: movt r3, #2050 ; 0x802
0000b22c: ldr r2, [r3, #0]
0000b22e: ldr r3, [sp, #4]
0000b230: add.w r3, r3, #1
0000b234: adds r3, r2, r3
0000b236: ldrb r3, [r3, #0]
0000b238: and.w r3, r3, #3

Please check the __ctype_prt__ address below:
-------------------------------------------------------
MAP file:
-------------------------------------------------------
 .data 0x08028cd0 0x0 c:/Program Files (x86)/GNU Tools ARM Embedded/4.6 2012q4/arm-none-eabi/lib/armv7-r/thumb/fpu.hard/eb\libg.a(lib_a-ctype_.o)
 .data 0x08028cd0 0x0 c:/Program Files (x86)/GNU Tools ARM Embedded/4.6 2012q4/arm-none-eabi/lib/armv7-r/thumb/fpu.hard/eb\libg.a(lib_a-memcmp.o)

Obviously there is no code added by the system library.

Please may you comment this issue and propose how to fix the library (or when a fix if needed can be released)?

Many thanks in advance,
Best regards
JiriJ

Question information

Language:
English Edit question
Status:
Solved
For:
GNU Arm Embedded Toolchain Edit question
Assignee:
No assignee Edit question
Solved by:
JiriJ
Solved:
Last query:
Last reply:
Revision history for this message
Joey Ye (jinyun-ye) said :
#1

Jiri,

Thanks for reporting this issue.

However, it seems you rebuilt the toolchain for big-endian. Hereby I suspect there is issue in your build config. The problematic point is around newlib/libc/ctype/ctype_.c line 111. Please check you build configure to make sure __ctype_ptr__ is defined correctly.

Joey

Revision history for this message
JiriJ (jirij-0) said :
#2

Joey,

thanks for your hint!

Yes, you are right - we have rebuilt the toolchain for the big-endian Cortex-R4F core by TI. But this is not a root cause of the issue.
The described behaviour is caused by our code - to be more precise - this is caused by missing startup code for C environment initialization.

Thanks for your time and advise,
Best regards
JiriJ