public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/45729]  New: -flto conflicts with -mthumb
@ 2010-09-19 19:09 rafael dot carre at gmail dot com
  2010-09-21 15:30 ` [Bug lto/45729] " ibolton at gcc dot gnu dot org
  0 siblings, 1 reply; 6+ messages in thread
From: rafael dot carre at gmail dot com @ 2010-09-19 19:09 UTC (permalink / raw)
  To: gcc-bugs

% cat thumb.i 
int _start(void)
{
    extern int f(void);
    return f();
}

% cat arm.i 
int f(void)
{
    int ret;
    asm ("\tmov %0, #0x200\n" : "=r"(ret));
    return ret;
}

% /usr/local/arm-elf-eabi-cvs/bin/arm-elf-eabi-gcc -O -flto -mthumb-interwork
thumb.i -c -mthumb                   
% /usr/local/arm-elf-eabi-cvs/bin/arm-elf-eabi-gcc -O -flto -mthumb-interwork
arm.i -c          
% /usr/local/arm-elf-eabi-cvs/bin/arm-elf-eabi-gcc -O -flto -mthumb-interwork
arm.o thumb.o -lgcc -nostdlib        
/tmp/cc6zNKqK.s: Assembler messages:
/tmp/cc6zNKqK.s:20: Error: invalid immediate: 512 is out of range
lto-wrapper: /usr/local/arm-elf-eabi-cvs/bin/arm-elf-eabi-gcc returned 1 exit
status
collect2: lto-wrapper returned 1 exit status
% /usr/local/arm-elf-eabi-cvs/bin/arm-elf-eabi-gcc -O -flto -mthumb-interwork
arm.o thumb.o -lgcc -nostdlib -mthumb   
/tmp/ccIIQlpY.s: Assembler messages:
/tmp/ccIIQlpY.s:20: Error: invalid immediate: 512 is out of range
lto-wrapper: /usr/local/arm-elf-eabi-cvs/bin/arm-elf-eabi-gcc returned 1 exit
status
collect2: lto-wrapper returned 1 exit status
% /usr/local/arm-elf-eabi-cvs/bin/arm-elf-eabi-gcc -O -flto -mthumb-interwork
arm.o thumb.o -lgcc -nostdlib -mno-thumb


% /usr/local/arm-elf-eabi-cvs/bin/arm-elf-eabi-gcc -v                           
Using built-in specs.
COLLECT_GCC=/usr/local/arm-elf-eabi-cvs/bin/arm-elf-eabi-gcc
COLLECT_LTO_WRAPPER=/usr/local/arm-elf-eabi-cvs/libexec/gcc/arm-elf-eabi/4.6.0/lto-wrapper
Target: arm-elf-eabi
Configured with: ../gcc-4.6-20100918/configure
--prefix=/usr/local/arm-elf-eabi-cvs --target=arm-elf-eabi --enable-lto
--enable-languages=c --disable-docs --disable-libssp
Thread model: single
gcc version 4.6.0 20100918 (experimental) (GCC) 


I am not sure what is wrong here:

If -mthumb is not specified during linking, I would expect -flto to generate
ARM code which is interworked properly with existing thumb code
If -mthumb is explicited, I would expect -flto to generate Thumb code which is
interworked properly with existing ARM code


Linking with -mno-thumb on a larger binary (rockbox) shows that the binary is
using both Thumb and ARM,
does it mean that -flto doesn't regenerate assembler for every file from the
GIMPLE representation?


-- 
           Summary: -flto conflicts with -mthumb
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rafael dot carre at gmail dot com
GCC target triplet: arm-elf-eabi


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45729


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug lto/45729] -flto conflicts with -mthumb
  2010-09-19 19:09 [Bug lto/45729] New: -flto conflicts with -mthumb rafael dot carre at gmail dot com
@ 2010-09-21 15:30 ` ibolton at gcc dot gnu dot org
  0 siblings, 0 replies; 6+ messages in thread
From: ibolton at gcc dot gnu dot org @ 2010-09-21 15:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from ibolton at gcc dot gnu dot org  2010-09-21 15:30 -------
Unfortunately, LTO does not officially work on ARM yet.  There are many LTO
failures in the gcc testsuite at the moment.

Can you retry without LTO so we can diagnose the interworking problems?


-- 

ibolton at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ibolton at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-09-21 15:30:17
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45729


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug lto/45729] -flto conflicts with -mthumb
       [not found] <bug-45729-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2015-06-22  8:19 ` chrbr at gcc dot gnu.org
@ 2015-06-22  8:22 ` chrbr at gcc dot gnu.org
  3 siblings, 0 replies; 6+ messages in thread
From: chrbr at gcc dot gnu.org @ 2015-06-22  8:22 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=45729
Bug 45729 depends on bug 52144, which changed state.

Bug 52144 Summary: ARM should support arm/thumb function attribute to permit different instruction sets in the same source
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52144

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug lto/45729] -flto conflicts with -mthumb
       [not found] <bug-45729-4@http.gcc.gnu.org/bugzilla/>
  2010-09-29 22:22 ` rafael.carre at gmail dot com
  2014-10-22 21:21 ` andre.rosa at lge dot com
@ 2015-06-22  8:19 ` chrbr at gcc dot gnu.org
  2015-06-22  8:22 ` chrbr at gcc dot gnu.org
  3 siblings, 0 replies; 6+ messages in thread
From: chrbr at gcc dot gnu.org @ 2015-06-22  8:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=45729

chrbr at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |chrbr at gcc dot gnu.org
         Depends on|                            |52144

--- Comment #4 from chrbr at gcc dot gnu.org ---
need to add __attribute__((noinline)) for f(void) to make sure it is compiled
in arm mode, otherwise it takes the mode of the caller


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52144
[Bug 52144] ARM should support arm/thumb function attribute to permit different
instruction sets in the same source


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug lto/45729] -flto conflicts with -mthumb
       [not found] <bug-45729-4@http.gcc.gnu.org/bugzilla/>
  2010-09-29 22:22 ` rafael.carre at gmail dot com
@ 2014-10-22 21:21 ` andre.rosa at lge dot com
  2015-06-22  8:19 ` chrbr at gcc dot gnu.org
  2015-06-22  8:22 ` chrbr at gcc dot gnu.org
  3 siblings, 0 replies; 6+ messages in thread
From: andre.rosa at lge dot com @ 2014-10-22 21:21 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=45729

Andre Goddard Rosa <andre.rosa at lge dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andre.rosa at lge dot com

--- Comment #3 from Andre Goddard Rosa <andre.rosa at lge dot com> ---
Is LTO playing well with thumb as far as 4.8.3 is concerned or still not
supported?

Got the following when mixing "-mthumb" with "-flto=8 -fuse-linker-plugin":

| /tmp/ccQ4Z3ej.s: Assembler messages:
| /tmp/ccQ4Z3ej.s:21: Error: lo register required -- `str lr,[sp,#4]'
| /tmp/ccQ4Z3ej.s:31: Error: lo register required -- `str lr,[sp,#4]'
...
| /tmp/ccQ4Z3ej.s:1134: Error: lo register required -- `ldr lr,[sp,#0x38]'
| /tmp/ccQ4Z3ej.s:1158: Error: instruction not supported in Thumb16 mode --
`adds r3,#5'
| /tmp/ccQ4Z3ej.s:1173: Error: lo register required -- `ldr r10,[r1,#60]'
| /tmp/ccQ4Z3ej.s:1174: Error: lo register required -- `ldr r3,[r10,#0]'
| /tmp/ccQ4Z3ej.s:1186: Error: instruction not supported in Thumb16 mode --
`adds r3,#5'
| /tmp/ccQ4Z3ej.s:1201: Error: lo register required -- `ldr r10,[r1,#60]'
| /tmp/ccQ4Z3ej.s:1202: Error: lo register required -- `ldr r3,[r10,#0]'
| /tmp/ccQ4Z3ej.s:1216: Error: instruction not supported in Thumb16 mode --
`adds r3,#5'
| /tmp/ccQ4Z3ej.s:1234: Error: lo register required -- `ldr r10,[r1,#60]'
| /tmp/ccQ4Z3ej.s:1241: Error: dest must overlap one source register -- `mul
r2,r3,r0'
| /tmp/ccQ4Z3ej.s:1242: Error: instruction not supported in Thumb16 mode --
`lsls r0,r0,#3'
| /tmp/ccQ4Z3ej.s:1245: Error: unshifted register required -- `add
r3,r5,r0,lsl#0'
| /tmp/ccQ4Z3ej.s:1247: Error: instruction not supported in Thumb16 mode --
`subs r4,r4,#32'
| /tmp/ccQ4Z3ej.s:1249: Error: unshifted register required -- `add
r3,r5,r0,lsl#0'
| /tmp/ccQ4Z3ej.s:1252: Error: unshifted register required -- `mvn r3,#7'
| /tmp/ccQ4Z3ej.s:1253: Error: instruction not supported in Thumb16 mode --
`adds r0,r3'
| /tmp/ccQ4Z3ej.s:1261: Error: instruction not supported in Thumb16 mode --
`lsls r0,r0,#3'
| /tmp/ccQ4Z3ej.s:1262: Error: instruction not supported in Thumb16 mode --
`subs r0,r5,r0'

Removing LTO or -mthumb makes the problem go away.
$ ld --version
GNU ld (crosstool-NG 1.19.0 - 4.8-2014.10-x86_64) 2.24.0.20140311 Linaro
2014.03
Copyright 2013 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.
$ gcc --version
gcc-original (crosstool-NG 1.19.0 - 4.8-2014.10-x86_64) 4.8.3 20140401
(prerelease)
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug lto/45729] -flto conflicts with -mthumb
       [not found] <bug-45729-4@http.gcc.gnu.org/bugzilla/>
@ 2010-09-29 22:22 ` rafael.carre at gmail dot com
  2014-10-22 21:21 ` andre.rosa at lge dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: rafael.carre at gmail dot com @ 2010-09-29 22:22 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45729

Rafaël Carré <rafael.carre at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID

--- Comment #2 from Rafaël Carré <rafael.carre at gmail dot com> 2010-09-29 17:58:18 UTC ---
(In reply to comment #1)
> Can you retry without LTO so we can diagnose the interworking problems?

It works fine without LTO so I guess this bug can be closed


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-06-22  8:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-19 19:09 [Bug lto/45729] New: -flto conflicts with -mthumb rafael dot carre at gmail dot com
2010-09-21 15:30 ` [Bug lto/45729] " ibolton at gcc dot gnu dot org
     [not found] <bug-45729-4@http.gcc.gnu.org/bugzilla/>
2010-09-29 22:22 ` rafael.carre at gmail dot com
2014-10-22 21:21 ` andre.rosa at lge dot com
2015-06-22  8:19 ` chrbr at gcc dot gnu.org
2015-06-22  8:22 ` chrbr at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).