Skip to content

Commit b6e50f5

Browse files
Merge pull request #5525 from deepikabhavnani/errno_fix
Fixed: errno update failure with IAR8.x
2 parents 5e7851c + 83409c5 commit b6e50f5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

platform/mbed_retarget.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -942,7 +942,11 @@ extern "C" WEAK void __iar_file_Mtxdst(__iar_Rmtx *mutex) {}
942942
extern "C" WEAK void __iar_file_Mtxlock(__iar_Rmtx *mutex) {}
943943
extern "C" WEAK void __iar_file_Mtxunlock(__iar_Rmtx *mutex) {}
944944
#if defined(__IAR_SYSTEMS_ICC__ ) && (__VER__ >= 8000000)
945-
extern "C" WEAK void *__aeabi_read_tp (void) { return NULL ;}
945+
#pragma section="__iar_tls$$DATA"
946+
extern "C" WEAK void *__aeabi_read_tp (void) {
947+
// Thread Local storage is not supported, using main thread memory for errno
948+
return __section_begin("__iar_tls$$DATA");
949+
}
946950
#endif
947951
#elif defined(__CC_ARM)
948952
// Do nothing

0 commit comments

Comments
 (0)