2018-04-27 00:15:47 |
Ed |
bug |
|
|
added bug |
2018-05-02 14:39:51 |
Launchpad Janitor |
gcc-arm-none-eabi (Ubuntu): status |
New |
Confirmed |
|
2018-05-08 08:34:30 |
Stephan Bechstedt |
bug |
|
|
added subscriber Stephan Bechstedt |
2018-05-17 10:32:08 |
kFYatek |
bug |
|
|
added subscriber kFYatek |
2018-05-25 11:47:35 |
Hubert Miś |
bug |
|
|
added subscriber Hubert Miś |
2018-06-13 07:39:41 |
fl0 |
bug |
|
|
added subscriber fl0 |
2018-06-28 10:21:23 |
Linas |
bug |
|
|
added subscriber Linas |
2018-07-09 08:37:23 |
rojer |
bug |
|
|
added subscriber rojer |
2018-07-11 05:16:45 |
Joel Stanley |
bug |
|
|
added subscriber Joel Stanley |
2018-07-12 20:18:44 |
Rob Willard |
bug |
|
|
added subscriber Rob Willard |
2018-07-16 08:09:58 |
Jacob |
bug watch added |
|
https://github.com/bbcmicrobit/micropython/issues/514 |
|
2018-08-14 19:38:14 |
David Lawrence |
bug |
|
|
added subscriber David Lawrence |
2018-08-30 13:47:27 |
andrea merello |
bug |
|
|
added subscriber andrea merello |
2018-10-01 06:04:38 |
om omundu |
bug |
|
|
added subscriber om omundu |
2018-12-17 16:17:26 |
Akkenoth |
bug |
|
|
added subscriber Akkenoth |
2018-12-17 16:21:08 |
Akkenoth |
bug |
|
|
added subscriber Matthias Klose |
2018-12-17 16:23:26 |
Michał |
bug |
|
|
added subscriber Michał |
2018-12-18 11:02:52 |
Thomas Preud'homme |
bug |
|
|
added subscriber Ubuntu Sponsors Team |
2018-12-18 11:03:57 |
Thomas Preud'homme |
affects |
gcc-arm-none-eabi (Ubuntu) |
newlib (Ubuntu) |
|
2018-12-18 11:16:57 |
Thomas Preud'homme |
description |
The multilib setup is not working in the bionic version of gcc-arm-none-eabi (gcc v6.3.1). For example, if I build a project with "-mcpu=cortex-m4" or "-march=armv7e-m" and link with:
arm-none-eabi-gcc -o someoutput.elf object1.o object2.o -mthumb -Wl,--gc-sections -ffast-math -march=armv7-m -Tlinker_script.ld
I get as output:
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/crt0.o: Conflicting CPU architectures 13/1
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/crt0.o
arm-none-eabi-readelf -A on any of my object files produces:
Attribute Section: aeabi
File Attributes
Tag_CPU_name: "Cortex-M4"
Tag_CPU_arch: v7E-M
Tag_CPU_arch_profile: Microcontroller
Tag_THUMB_ISA_use: Thumb-2
Tag_ABI_PCS_wchar_t: 4
Tag_ABI_FP_number_model: Finite
Tag_ABI_align_needed: 8-byte
Tag_ABI_align_preserved: 8-byte, except leaf SP
Tag_ABI_enum_size: small
Tag_ABI_optimization_goals: Prefer Speed
Tag_CPU_unaligned_access: v6
But "arm-none-eabi-readelf -A /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/crt0.o" gives
Attribute Section: aeabi
File Attributes
Tag_CPU_arch: v4
Tag_ARM_ISA_use: Yes
If I define "void _init(void){}" and use -nostartfiles, compilation finishes but the resulting binary does not work. I have not examined the output file but it appears that it has somehow linked to code containing ARM as well as thumb code:
# readelf -A someoutput.elf
Attribute Section: aeabi
File Attributes
Tag_CPU_name: "Cortex-M4"
Tag_CPU_arch: v7E-M
Tag_CPU_arch_profile: Microcontroller
Tag_ARM_ISA_use: Yes
Tag_THUMB_ISA_use: Thumb-2
Tag_ABI_PCS_wchar_t: 4
Tag_ABI_FP_denormal: Needed
Tag_ABI_FP_exceptions: Needed
Tag_ABI_FP_number_model: IEEE 754
Tag_ABI_align_needed: 8-byte
Tag_ABI_align_preserved: 8-byte, except leaf SP
Tag_ABI_enum_size: small
Tag_ABI_optimization_goals: Prefer Speed
Tag_CPU_unaligned_access: v6
I can work around the problem by manually specifying compatible versions of libc and libgcc with -nostdlib:
-nostdlib /usr/lib/arm-none-eabi/newlib/thumb/libc.a /usr/lib/gcc/arm-none-eabi/6.3.1/thumb/v7e-m/libgcc.a
This produces a working binary. However, there is still something wrong because readelf -A still includes "Tag_ARM_ISA_use: Yes":
Attribute Section: aeabi
File Attributes
Tag_CPU_name: "Cortex-M4"
Tag_CPU_arch: v7E-M
Tag_CPU_arch_profile: Microcontroller
Tag_ARM_ISA_use: Yes
Tag_THUMB_ISA_use: Thumb-2
Tag_ABI_PCS_wchar_t: 4
Tag_ABI_FP_denormal: Needed
Tag_ABI_FP_exceptions: Needed
Tag_ABI_FP_number_model: IEEE 754
Tag_ABI_align_needed: 8-byte
Tag_ABI_align_preserved: 8-byte, except leaf SP
Tag_ABI_enum_size: small
Tag_ABI_optimization_goals: Prefer Speed
Tag_CPU_unaligned_access: v6
Previously, using xenial and gcc v4, readelf gives the following output on the output binary:
Attribute Section: aeabi
File Attributes
Tag_CPU_name: "7E-M"
Tag_CPU_arch: v7E-M
Tag_CPU_arch_profile: Microcontroller
Tag_THUMB_ISA_use: Thumb-2
Tag_ABI_PCS_wchar_t: 4
Tag_ABI_FP_denormal: Needed
Tag_ABI_FP_exceptions: Needed
Tag_ABI_FP_number_model: IEEE 754
Tag_ABI_align_needed: 8-byte
Tag_ABI_enum_size: small
Tag_ABI_optimization_goals: Prefer Speed
Tag_CPU_unaligned_access: v6
(Also, what happened to gdb-arm-none-eabi?) |
[Impact]
This bug prevents users to produce binaries for some of the targets supported by the compiler. In some case, binaries can get produced but will fail to execute properly.
To fix this issue the package needs to be rebuilt from the same source. Risk of regressions are thus limited to an issue in the arm-none-eabi toolchain used for the rebuild.
The bug stems from newlib having libraries for various targets (called multilib) in a different location than where the compiler expects them to be, thus making the wrong libraries get selected. The location of the newlib libraries is decided at build time by asking the compiler (provided in gcc-arm-none-eabi) where it will be looking for these. Unfortunately, the version of newlib in Ubuntu bionic was built using a different version of gcc-arm-none-eabi than the one currently in bionic and GCC changed where to look for library between those 2 versions. This is why rebuilding against the current gcc-arm-none-eabi will solve the issue.
[Test Case]
Compile the following hello world testcase (in hello.c) with arm-none-eabi-gcc -o hello.axf hello.c -mthumb -Wl,--gc-sections -ffast-math -march=armv7e-m -specs=rdimon.specs
#include <stdio.h>
int
main (void)
{
puts ("Hello, World!");
return 0;
}
[Regression Potential]
As explained in the impact, no source change is necessary so any regression would be due to bugs in the compiler which would be good to catch anyway.
Original bug report below:
The multilib setup is not working in the bionic version of gcc-arm-none-eabi (gcc v6.3.1). For example, if I build a project with "-mcpu=cortex-m4" or "-march=armv7e-m" and link with:
arm-none-eabi-gcc -o someoutput.elf object1.o object2.o -mthumb -Wl,--gc-sections -ffast-math -march=armv7-m -Tlinker_script.ld
I get as output:
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/crt0.o: Conflicting CPU architectures 13/1
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/crt0.o
arm-none-eabi-readelf -A on any of my object files produces:
Attribute Section: aeabi
File Attributes
Tag_CPU_name: "Cortex-M4"
Tag_CPU_arch: v7E-M
Tag_CPU_arch_profile: Microcontroller
Tag_THUMB_ISA_use: Thumb-2
Tag_ABI_PCS_wchar_t: 4
Tag_ABI_FP_number_model: Finite
Tag_ABI_align_needed: 8-byte
Tag_ABI_align_preserved: 8-byte, except leaf SP
Tag_ABI_enum_size: small
Tag_ABI_optimization_goals: Prefer Speed
Tag_CPU_unaligned_access: v6
But "arm-none-eabi-readelf -A /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/crt0.o" gives
Attribute Section: aeabi
File Attributes
Tag_CPU_arch: v4
Tag_ARM_ISA_use: Yes
If I define "void _init(void){}" and use -nostartfiles, compilation finishes but the resulting binary does not work. I have not examined the output file but it appears that it has somehow linked to code containing ARM as well as thumb code:
# readelf -A someoutput.elf
Attribute Section: aeabi
File Attributes
Tag_CPU_name: "Cortex-M4"
Tag_CPU_arch: v7E-M
Tag_CPU_arch_profile: Microcontroller
Tag_ARM_ISA_use: Yes
Tag_THUMB_ISA_use: Thumb-2
Tag_ABI_PCS_wchar_t: 4
Tag_ABI_FP_denormal: Needed
Tag_ABI_FP_exceptions: Needed
Tag_ABI_FP_number_model: IEEE 754
Tag_ABI_align_needed: 8-byte
Tag_ABI_align_preserved: 8-byte, except leaf SP
Tag_ABI_enum_size: small
Tag_ABI_optimization_goals: Prefer Speed
Tag_CPU_unaligned_access: v6
I can work around the problem by manually specifying compatible versions of libc and libgcc with -nostdlib:
-nostdlib /usr/lib/arm-none-eabi/newlib/thumb/libc.a /usr/lib/gcc/arm-none-eabi/6.3.1/thumb/v7e-m/libgcc.a
This produces a working binary. However, there is still something wrong because readelf -A still includes "Tag_ARM_ISA_use: Yes":
Attribute Section: aeabi
File Attributes
Tag_CPU_name: "Cortex-M4"
Tag_CPU_arch: v7E-M
Tag_CPU_arch_profile: Microcontroller
Tag_ARM_ISA_use: Yes
Tag_THUMB_ISA_use: Thumb-2
Tag_ABI_PCS_wchar_t: 4
Tag_ABI_FP_denormal: Needed
Tag_ABI_FP_exceptions: Needed
Tag_ABI_FP_number_model: IEEE 754
Tag_ABI_align_needed: 8-byte
Tag_ABI_align_preserved: 8-byte, except leaf SP
Tag_ABI_enum_size: small
Tag_ABI_optimization_goals: Prefer Speed
Tag_CPU_unaligned_access: v6
Previously, using xenial and gcc v4, readelf gives the following output on the output binary:
Attribute Section: aeabi
File Attributes
Tag_CPU_name: "7E-M"
Tag_CPU_arch: v7E-M
Tag_CPU_arch_profile: Microcontroller
Tag_THUMB_ISA_use: Thumb-2
Tag_ABI_PCS_wchar_t: 4
Tag_ABI_FP_denormal: Needed
Tag_ABI_FP_exceptions: Needed
Tag_ABI_FP_number_model: IEEE 754
Tag_ABI_align_needed: 8-byte
Tag_ABI_enum_size: small
Tag_ABI_optimization_goals: Prefer Speed
Tag_CPU_unaligned_access: v6
(Also, what happened to gdb-arm-none-eabi?) |
|
2018-12-18 11:17:37 |
Thomas Preud'homme |
bug |
|
|
added subscriber Ubuntu Stable Release Updates Team |
2018-12-18 11:28:37 |
Julian Andres Klode |
nominated for series |
|
Ubuntu Bionic |
|
2018-12-18 11:28:37 |
Julian Andres Klode |
bug task added |
|
newlib (Ubuntu Bionic) |
|
2018-12-18 11:28:37 |
Julian Andres Klode |
nominated for series |
|
Ubuntu Disco |
|
2018-12-18 11:28:37 |
Julian Andres Klode |
bug task added |
|
newlib (Ubuntu Disco) |
|
2018-12-18 11:28:37 |
Julian Andres Klode |
nominated for series |
|
Ubuntu Cosmic |
|
2018-12-18 11:28:37 |
Julian Andres Klode |
bug task added |
|
newlib (Ubuntu Cosmic) |
|
2018-12-18 11:30:11 |
Julian Andres Klode |
newlib (Ubuntu Bionic): status |
New |
Triaged |
|
2018-12-18 11:30:15 |
Julian Andres Klode |
newlib (Ubuntu Disco): status |
Confirmed |
New |
|
2018-12-19 00:17:29 |
Launchpad Janitor |
newlib (Ubuntu): status |
New |
Confirmed |
|
2018-12-19 00:17:29 |
Launchpad Janitor |
newlib (Ubuntu Cosmic): status |
New |
Confirmed |
|
2018-12-19 00:18:27 |
Brendan Haines |
bug |
|
|
added subscriber Brendan Haines |
2019-01-14 13:26:11 |
Gabriele Tramonte |
bug |
|
|
added subscriber Gabriele Tramonte |
2019-02-02 22:57:15 |
Mathew Hodson |
newlib (Ubuntu Bionic): importance |
Undecided |
Medium |
|
2019-02-02 22:57:19 |
Mathew Hodson |
newlib (Ubuntu Cosmic): importance |
Undecided |
Medium |
|
2019-02-02 22:57:23 |
Mathew Hodson |
newlib (Ubuntu Disco): importance |
Undecided |
Medium |
|
2019-04-20 18:40:47 |
Simon Quigley |
removed subscriber Ubuntu Sponsors Team |
|
|
|
2019-04-22 13:52:52 |
David Lawrence |
bug |
|
|
added subscriber Simon Quigley |
2019-04-22 16:44:41 |
Simon Quigley |
newlib (Ubuntu Cosmic): status |
Confirmed |
Fix Released |
|
2019-04-22 16:44:43 |
Simon Quigley |
newlib (Ubuntu Disco): status |
Confirmed |
Fix Released |
|
2019-04-22 16:44:46 |
Simon Quigley |
newlib (Ubuntu Bionic): status |
Triaged |
In Progress |
|
2019-04-22 16:44:49 |
Simon Quigley |
newlib (Ubuntu Bionic): assignee |
|
Simon Quigley (tsimonq2) |
|
2019-04-22 17:00:24 |
Adam Conrad |
newlib (Ubuntu Bionic): status |
In Progress |
Fix Committed |
|
2019-04-22 17:00:28 |
Adam Conrad |
bug |
|
|
added subscriber SRU Verification |
2019-04-22 17:00:36 |
Adam Conrad |
tags |
|
verification-needed verification-needed-bionic |
|
2019-04-23 16:55:08 |
David Lawrence |
tags |
verification-needed verification-needed-bionic |
verification-failed-bionic verification-needed |
|
2019-05-03 23:27:53 |
Mathew Hodson |
newlib (Ubuntu): status |
Confirmed |
Fix Released |
|
2019-05-03 23:27:58 |
Mathew Hodson |
bug task deleted |
newlib (Ubuntu Cosmic) |
|
|
2019-05-03 23:28:03 |
Mathew Hodson |
bug task deleted |
newlib (Ubuntu Disco) |
|
|
2019-05-03 23:28:23 |
Mathew Hodson |
newlib (Ubuntu Bionic): status |
Fix Committed |
Triaged |
|
2019-05-21 16:12:30 |
Tim Perkins |
bug |
|
|
added subscriber Tim Perkins |
2019-06-01 23:01:49 |
Mathew Hodson |
tags |
verification-failed-bionic verification-needed |
verification-failed-bionic |
|
2019-06-20 22:36:54 |
Steve Langasek |
newlib (Ubuntu Bionic): status |
Triaged |
Fix Committed |
|
2019-06-20 22:37:09 |
Steve Langasek |
tags |
verification-failed-bionic |
verification-needed verification-needed-bionic |
|
2019-06-21 15:31:18 |
David Lawrence |
tags |
verification-needed verification-needed-bionic |
verification-done-bionic |
|
2019-06-22 03:26:29 |
Mathew Hodson |
bug watch removed |
https://github.com/bbcmicrobit/micropython/issues/514 |
|
|
2019-07-01 08:05:15 |
Łukasz Zemczak |
removed subscriber Ubuntu Stable Release Updates Team |
|
|
|
2019-07-01 08:15:20 |
Launchpad Janitor |
newlib (Ubuntu Bionic): status |
Fix Committed |
Fix Released |
|