This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
arm-none-eabi-gcc 5.3 and LTO, mixing ARM and Thumb instructions
- From: Gabriel Marcano <gabemarcano at yahoo dot com>
- To: "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
- Date: Wed, 1 Jun 2016 23:23:58 +0000 (UTC)
- Subject: arm-none-eabi-gcc 5.3 and LTO, mixing ARM and Thumb instructions
- Authentication-results: sourceware.org; auth=none
- References: <423755014 dot 24238 dot 1464823438599 dot JavaMail dot yahoo dot ref at mail dot yahoo dot com>
- Reply-to: Gabriel Marcano <gabemarcano at yahoo dot com>
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