Fix ARMC6 linker error for the bare metal profile

The ARMC6 compiler inadvertently introduces the `_scanf_mbtowc` symbol
to the build. The commit provides a weak definition of the symbol to
satisfy the linker whenever the symbol is included. This affects ARM
Compiler 6 version 6.12 and earlier.

The compiler error was previously observed when the MICROLIB library is
used with the uARM toolchain. However, the weak definition was put in
`mbed-os/rtos` which is not included when the bare metal profile is used.
pull/11564/head
Hugues Kamba 2019-09-25 12:20:50 +01:00
parent ab857c4963
commit cc7403457d
2 changed files with 18 additions and 18 deletions

View File

@ -1735,3 +1735,21 @@ MBED_WEAK const ticker_info_t *lp_ticker_get_info()
};
return &info;
}
// The below resolves the linker error generated by a bug in Arm Compiler 6
// The compiler inadvertently introduces the
// _scanf_mbtowc symbol to the build. The code below provides a weak reference
// for the missing symbol.
// Arm Compiler 6 version 6.12 and earlier versions are affected.
typedef int ScanfReadRec;
extern "C" MBED_WEAK long int _scanf_mbtowc(
int ignored,
FILE *p,
ScanfReadRec *sr,
int *charmap,
int exact
)
{
return 0;
}

View File

@ -68,21 +68,3 @@ MBED_WEAK void __aeabi_assert(const char *expr, const char *file, int 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.
// Arm Compiler 6 version 6.12 and earlier versions are affected.
#include <stdio.h>
typedef int ScanfReadRec;
MBED_WEAK long int _scanf_mbtowc(
int ignored,
FILE *p,
ScanfReadRec *sr,
int *charmap,
int exact
)
{
return 0;
}