Bug 1166416 - gcc selects wrong library for thumb support
Summary: gcc selects wrong library for thumb support
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: arm-none-eabi-gcc-cs
Version: 21
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Michal Hlavinka
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-11-20 23:46 UTC by bztdlinux
Modified: 2015-04-29 13:06 UTC (History)
8 users (show)

Fixed In Version: arm-none-eabi-gcc-cs-4.9.2-3.fc22
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-04-28 13:11:04 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description bztdlinux 2014-11-20 23:46:04 UTC
When building for a thumb-only architecture, ld fails to link:
/usr/lib64/gcc/arm-none-eabi/4.8.1/../../../../arm-none-eabi/bin/ld: skipping incompatible /usr/lib64/gcc/arm-none-eabi/4.8.1/libgcc.a when searching for -lgcc
/usr/lib64/gcc/arm-none-eabi/4.8.1/../../../../arm-none-eabi/bin/ld: cannot find -lgcc


Presumably the right version is /usr/lib64/gcc/arm-none-eabi/4.8.1/thumb/libgcc.a, but gcc picks the wrong version. I am passing in -mthumb and -mcpu so it should know which one to pick.

Comment 1 Michal Hlavinka 2014-11-21 16:16:27 UTC
Could you provide some reproducer? Preferably small one, not whole project. Thanks.

Comment 2 bztdlinux 2014-12-01 00:07:32 UTC
libopencm3 (https://github.com/libopencm3/libopencm3-examples) will build libopencm3 successfully, but will then fail to link when starting to compile executables.

I can whip up a smaller project if you want, but the libopencm3-examples git isn't too big.

Comment 3 Maciek Borzecki 2014-12-09 11:05:25 UTC
I think there's a larger problem with the toolchain, as the libraries do not seem to use EABI.

Example, binary built using F21 arm-none-eabi-* toolchain:

ELF Header:
  Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF32
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              REL (Relocatable file)
  Machine:                           ARM
  Version:                           0x1
  Entry point address:               0x0
  Start of program headers:          0 (bytes into file)
  Start of section headers:          1588 (bytes into file)
  Flags:                             0x5000000, Version5 EABI
  Size of this header:               52 (bytes)
  Size of program headers:           0 (bytes)
  Number of program headers:         0
  Size of section headers:           40 (bytes)
  Number of section headers:         21
  Section header string table index: 18

Let's see the incompatible libgcc.a from F21.

File: /usr/lib64/gcc/arm-none-eabi/4.8.3/thumb/libgcc.a(_thumb1_case_sqi.o)
ELF Header:
  Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF32
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              REL (Relocatable file)
  Machine:                           None
  Version:                           0x1
  Entry point address:               0x0
  Start of program headers:          0 (bytes into file)
  Start of section headers:          156 (bytes into file)
  Flags:                             0x5000000 <--- note missing EABI
  Size of this header:               52 (bytes)
  Size of program headers:           0 (bytes)
  Number of program headers:         0
  Size of section headers:           40 (bytes)

Same for rawhide. Basically the toolchain is not EABI.

For comparison working arm-none-eabi 4.8.1 toolchain from F20:

File: /usr/lib64/gcc/arm-none-eabi/4.8.1/thumb/libgcc.a(_thumb1_case_sqi.o)
ELF Header:
  Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF32
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              REL (Relocatable file)
  Machine:                           ARM
  Version:                           0x1
  Entry point address:               0x0
  Start of program headers:          0 (bytes into file)
  Start of section headers:          592 (bytes into file)
  Flags:                             0x5000000, Version5 EABI
  Size of this header:               52 (bytes)
  Size of program headers:           0 (bytes)
  Number of program headers:         0
  Size of section headers:           40 (bytes)
  Number of section headers:         15
  Section header string table index: 12

Comment 4 Jon Neal 2015-01-22 03:57:21 UTC
I believe just ran in to this problem as well. I had successfully compiled arm projects (libopencm3 stuff like above) on this install, but I upgraded from fedora 19 to 21 and now I'm getting this error. This is blocking some of my work so I will try to find a work around until something else can be figured out.

Comment 5 Maciek Borzecki 2015-01-22 08:55:26 UTC
(In reply to Jon Neal from comment #4)
> I believe just ran in to this problem as well. I had successfully compiled
> arm projects (libopencm3 stuff like above) on this install, but I upgraded
> from fedora 19 to 21 and now I'm getting this error. This is blocking some
> of my work so I will try to find a work around until something else can be
> figured out.

You can download previous packages from koji like this:

koji download-build arm-none-eabi-gcc-cs-2013.11.24-2.fc20 --arch x86_64
koji download-build arm-none-eabi-newlib-2.1.0-3.fc20 --arch noarch
koji download-build arm-none-eabi-binutils-cs-2013.11.24-1.fc20 --arch x86_64
koji download-build arm-none-eabi-gdb-7.6.2-1.fc20 --arch x86_64

And add exclude=arm-none-eabi-* in /etc/dnf/dnf.conf

However I ran into problems with newlib on Cortex-M3, where scanf would consistently cause hard faults for some reason. So, I've switched to Linaro arm-none-eabi toolchain temporarily.

Comment 6 Hedayat Vatankhah 2015-02-28 17:43:56 UTC
The problem is not limited to thumb libraries. Compiling binaries with this toolchain on F21 doesn't work at all. Bug #1178520 should be marked as duplicate of this bug, and the title of this bug should be made more generic.

Comment 7 Tarjei Knapstad 2015-04-13 10:13:56 UTC
The problem is still present in the latest rawhide packages as of today

arm-none-eabi-gcc-cs-2014.05.28-1.fc22.x86_64
arm-none-eabi-binutils-cs-2014.05.28-3.fc22.x86_64

Comment 8 Fedora Update System 2015-04-16 15:08:56 UTC
arm-none-eabi-gcc-cs-4.9.2-3.fc20,arm-none-eabi-newlib-2.2.0_1-1.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/arm-none-eabi-gcc-cs-4.9.2-3.fc20,arm-none-eabi-newlib-2.2.0_1-1.fc20

Comment 9 Fedora Update System 2015-04-16 15:10:12 UTC
arm-none-eabi-gcc-cs-4.9.2-3.fc21,arm-none-eabi-newlib-2.2.0_1-1.fc21 has been submitted as an update for Fedora 21.
https://admin.fedoraproject.org/updates/arm-none-eabi-gcc-cs-4.9.2-3.fc21,arm-none-eabi-newlib-2.2.0_1-1.fc21

Comment 10 Fedora Update System 2015-04-16 15:10:22 UTC
arm-none-eabi-gcc-cs-4.9.2-3.fc22,arm-none-eabi-newlib-2.2.0_1-1.fc22 has been submitted as an update for Fedora 22.
https://admin.fedoraproject.org/updates/arm-none-eabi-gcc-cs-4.9.2-3.fc22,arm-none-eabi-newlib-2.2.0_1-1.fc22

Comment 11 Fedora Update System 2015-04-17 18:36:39 UTC
Package arm-none-eabi-gcc-cs-4.9.2-3.fc22, arm-none-eabi-newlib-2.2.0_1-1.fc22:
* should fix your issue,
* was pushed to the Fedora 22 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing arm-none-eabi-gcc-cs-4.9.2-3.fc22 arm-none-eabi-newlib-2.2.0_1-1.fc22'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2015-6237/arm-none-eabi-gcc-cs-4.9.2-3.fc22,arm-none-eabi-newlib-2.2.0_1-1.fc22
then log in and leave karma (feedback).

Comment 12 bztdlinux 2015-04-27 21:31:43 UTC
I can confirm that these packages for both f21 and f22 fix the problem for me.

Comment 13 Tarjei Knapstad 2015-04-27 22:34:47 UTC
Confirmed working on F21

Comment 14 Fedora Update System 2015-04-28 13:11:04 UTC
arm-none-eabi-gcc-cs-4.9.2-3.fc21, arm-none-eabi-newlib-2.2.0_1-1.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 15 Fedora Update System 2015-04-29 12:57:55 UTC
arm-none-eabi-gcc-cs-4.9.2-3.fc20, arm-none-eabi-newlib-2.2.0_1-1.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 16 Fedora Update System 2015-04-29 13:06:39 UTC
arm-none-eabi-gcc-cs-4.9.2-3.fc22, arm-none-eabi-newlib-2.2.0_1-1.fc22 has been pushed to the Fedora 22 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.