Re: arm-none-eabi-gcc 5.3 and LTO, mixing ARM and Thumb instructions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Gabriel,

On 06/02/2016 01:28 AM, Gabriel Marcano wrote:
My apologies, I forgot to attach the files.



----- Original Message -----
From: Gabriel Marcano <gabemarcano@xxxxxxxxx>
To: "gcc-help@xxxxxxxxxxx" <gcc-help@xxxxxxxxxxx>
Sent: Wednesday, June 1, 2016 7:23 PM
Subject: arm-none-eabi-gcc 5.3 and LTO, mixing ARM and Thumb instructions

Could someone help me understand this behavior with LTO? I am working with an
ARM cross compiler, arm-none-eabi. I am trying to make the compiler compile two
separate files in different ARM modes/targets, one of them in ARM, one of them
in Thumb. When I compile the two source files without -flto, one with -mthumb
-thumb-interwork, and the other with the same flags just -marm appended as to
override -mthumb, the resulting binary, when dissasembled with objdump, has code
in both modes, and it is rather aparent. When I enable -flto, the resulting
program ends up in a single mode, all of it.

I am attaching a couple of files to this email:
   arm.c      : The file to be compiled as ARM
   main.c     : The main function, compiled as Thumb
   Makefile   : Add -flto to LDFLAGS and CFLAGS to enable lto, remvove it to
                disable it.
   lto.txt    : The arm-none-eabi-objdump dissassembly of the resulting lto
                binary.
   no-lto.txt : the arm-none-eabi-objdump dissassembly of the resulting binary
                without lto.

Is there something obvious about the behavior of LTO that I'm missing? Does it
just generate the final machine code at link time, scrapping the flags used to
compile object files?

Thanks,

Gabriel E. Marcano

This is correct behavior, but unfortunately, it is broken in 5.3. LTO support with target modes intermixing was fixed for GCC 6.1.

Compiled with 6.1, your example correctly shows the jumps from thumb main to arm foo with the veneer

Note that you can mix functions compiled with either command line target options for attributes targets

Regards

Christian



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux