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

Conversation

hugueskamba
Copy link
Collaborator

Description

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 request type

[x] Fix
[ ] Refactor
[ ] Target update
[ ] Functionality change
[ ] Docs update
[ ] Test update
[ ] Breaking change

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.
@ciarmcom ciarmcom requested review from a team May 29, 2019 15:01
@ciarmcom
Copy link
Member

@hugueskamba, thank you for your changes.
@ARMmbed/mbed-os-core @ARMmbed/mbed-os-maintainers please review.

// 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.

Copy link
Contributor

@0xc0170 0xc0170 left a comment

Choose a reason for hiding this comment

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

How was this discovered - any tests failing, or we have missed the coverage?

@hugueskamba
Copy link
Collaborator Author

hugueskamba commented May 31, 2019

How was this discovered - any tests failing, or we have missed the coverage?

It was discovered by attempting to build an application using the uARM toolchain. We currently do not have a CI test for this. I was planning on adding that next.

@0xc0170
Copy link
Contributor

0xc0170 commented May 31, 2019

Started CI meanwhile

@mbed-ci
Copy link

mbed-ci commented May 31, 2019

Test run: SUCCESS

Summary: 11 of 11 test jobs passed
Build number : 1
Build artifacts

@0xc0170
Copy link
Contributor

0xc0170 commented Jun 4, 2019

Finalizing reviews, this is ready for integration

@hugueskamba hugueskamba force-pushed the fix-microlib-with-arm-compiler-6 branch from 6855093 to e12889d Compare June 18, 2019 14:43
@adbridge
Copy link
Contributor

@0xc0170 please re-review latest changes

Copy link
Contributor

@0xc0170 0xc0170 left a comment

Choose a reason for hiding this comment

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

latest forced pushed resulted in missing the requested version

// for the missing symbol
#include <stdio.h>
typedef int ScanfReadRec;
MBED_WEAK long int _scanf_mbtowc(
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.

@hugueskamba
Copy link
Collaborator Author

How was this discovered - any tests failing, or we have missed the coverage?

It was discovered by attempting to build an application using the uARM toolchain. We currently do not have a CI test for this. I was planning on adding that next.

Regarding this. A request was made (via Jira) for the test team in Finland to add the test for uARM as they are responsible for adding it.

@hugueskamba hugueskamba force-pushed the fix-microlib-with-arm-compiler-6 branch from e12889d to df16c78 Compare June 24, 2019 13:57
@0xc0170
Copy link
Contributor

0xc0170 commented Jun 24, 2019

Ci restarted

@mbed-ci
Copy link

mbed-ci commented Jun 25, 2019

Test run: SUCCESS

Summary: 11 of 11 test jobs passed
Build number : 2
Build artifacts

@hugueskamba hugueskamba force-pushed the fix-microlib-with-arm-compiler-6 branch from df16c78 to e12889d Compare June 25, 2019 07:59
@0xc0170
Copy link
Contributor

0xc0170 commented Jun 25, 2019

@hugueskamba if you force push, leave a comment - let everyone know what has changed and why it was updated . This needs now CI again.

@0xc0170
Copy link
Contributor

0xc0170 commented Jun 25, 2019

CI restarted

@mbed-ci
Copy link

mbed-ci commented Jun 25, 2019

Test run: SUCCESS

Summary: 11 of 11 test jobs passed
Build number : 3
Build artifacts

@0xc0170
Copy link
Contributor

0xc0170 commented Jun 25, 2019

@evedon All good with this PR?

@hugueskamba
Copy link
Collaborator Author

hugueskamba commented Jun 25, 2019

@hugueskamba if you force push, leave a comment - let everyone know what has changed and why it was updated . This needs now CI again.

I am not sure what that force push was as I was not even working on this branch. I need to figure out what is happening. I think when I force push on one branch it somehow push stuff on other branches too. I am investigating this at the moment.

@evedon
Copy link
Contributor

evedon commented Jun 25, 2019

All good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants