Skip to content

microlib support: Fix build with Arm Compiler 6 and MicroLib #10704

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions rtos/TARGET_CORTEX/TOOLCHAIN_ARM_MICRO/mbed_boot_arm_micro.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,20 @@ 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
#include <stdio.h>
typedef int ScanfReadRec;
MBED_WEAK long int _scanf_mbtowc(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we know what this function does? Basically what will fail for this setup.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It converts multibyte charaters to wide characters. This function is not used in MicroLib which does not support wide characters or multibyte strings. The compiler inadvertently adds this symbol even if it is not used. There is an internal ticket being looked at by the compiler team which has acknowledged the bug.
The present commit essentially provides a stud for an unused functionality to satisfy the linker.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add here what version is affected (to know when we can remove it) , something along the lines <6.x.x is affected.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add here what version is affected (to know when we can remove it) , something along the lines <6.x.x is affected.

6855093

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The info about the compiler versions affected has been last in the last commit.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*lost, correct, I cant find the comment "Arm Compiler 6 version 6.12 and earlier versions are affected." here.

Copy link
Collaborator Author

@hugueskamba hugueskamba Jun 24, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The info about the compiler versions affected has been last in the last commit.

It has now been restored. Thanks.

int ignored,
FILE *p,
ScanfReadRec *sr,
int *charmap,
int exact
)
{
return 0;
}