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.
pull/10704/head
Hugues Kamba 2019-05-29 14:42:28 +01:00
parent 9cc1caa031
commit e12889d8e1
1 changed files with 17 additions and 0 deletions

View File

@ -68,3 +68,20 @@ MBED_WEAK void __aeabi_assert(const char *expr, const char *file, int line)
{ {
mbed_assert_internal(expr, file, line); mbed_assert_internal(expr, file, line);
} }
// The below resolves the linker error generated by a bug in Arm Compiler 6
// When building with MicroLib, the compiler inadvertently introduces the
// _scanf_mbtowc symbol to the build. The code below provides a weak reference
// for the missing symbol
#include <stdio.h>
typedef int ScanfReadRec;
MBED_WEAK long int _scanf_mbtowc(
int ignored,
FILE *p,
ScanfReadRec *sr,
int *charmap,
int exact
)
{
return 0;
}