Skip to content

Commit df16c78

Browse files
committed
microlib support: Fix build with Arm Compiler 6 and MicroLib
Building binaries with MicroLib and Arm compiler 6 has been failing because of a bug in Arm compiler 6. The compiler introduces a symbol, `__scanf_mbtowc`, which is not present in MicroLib C library. The present commit adds a weak reference to the symbol to allow a successful linkage. This is a temporary fix until the bug in the compiler is fixed. It should be removed after the compiler bug is fixed.
1 parent 9cc1caa commit df16c78

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

rtos/TARGET_CORTEX/TOOLCHAIN_ARM_MICRO/mbed_boot_arm_micro.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,21 @@ MBED_WEAK void __aeabi_assert(const char *expr, const char *file, int line)
6868
{
6969
mbed_assert_internal(expr, file, line);
7070
}
71+
72+
// The below resolves the linker error generated by a bug in Arm Compiler 6
73+
// When building with MicroLib, the compiler inadvertently introduces the
74+
// _scanf_mbtowc symbol to the build. The code below provides a weak reference
75+
// for the missing symbol.
76+
// Arm Compiler 6 version 6.12 and earlier versions are affected.
77+
#include <stdio.h>
78+
typedef int ScanfReadRec;
79+
MBED_WEAK long int _scanf_mbtowc(
80+
int ignored,
81+
FILE *p,
82+
ScanfReadRec *sr,
83+
int *charmap,
84+
int exact
85+
)
86+
{
87+
return 0;
88+
}

0 commit comments

Comments
 (0)