This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]