public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/54721] New: Generate arm/thumb interwork veneers at compile time?
@ 2012-09-26 20:28 linux at horizon dot com
  2012-09-26 21:00 ` [Bug target/54721] " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: linux at horizon dot com @ 2012-09-26 20:28 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 54721
           Summary: Generate arm/thumb interwork veneers at compile time?
    Classification: Unclassified
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: linux@horizon.com


When using -mthumb-interwork, the linker generates calling veneers named
__foo_from_arm and __bar_from_thumb on demand.  These look like

    .arm
__foo_from_arm
    ldr    ip, [pc]    ; <__foo_from_arm+0x8>
    bx    ip
    .word    foo

    .thumb_func
__bar_from_thumb:
    bx    pc
    nop
    b    bar

It would be possible to shrink each of these by 4 bytes and some cycles if they
were located before the beginning of the relevant function.

I've tried the following in a .s file and the linker appears to DTRT with it:

    .arm
    .global    foo
    .type    foo, %function
__foo_from_arm:
    adr    ip, foo+1
    bx    ip
    .thumb_func
foo:
    add    r0, r0, #1
    bx    lr
    .size    foo, .-foo

    .global    bar
    .type    bar, %function
__bar_from_thumb:
    bx    pc
    nop
    .arm
bar:
    add    r0, r0, #2
    bx    lr
    .size    bar, .-bar

It would be nice if there were a function attribute to declare that a function
is likely to be called from both ARM and thumb code, and so should generate the
veneers in line.

(It seems like a pretty ovvious feature, so my apologies if this exists
already; my RTFM and google-fu has not managed to locate it.)


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

* [Bug target/54721] Generate arm/thumb interwork veneers at compile time?
  2012-09-26 20:28 [Bug target/54721] New: Generate arm/thumb interwork veneers at compile time? linux at horizon dot com
@ 2012-09-26 21:00 ` pinskia at gcc dot gnu.org
  2012-10-24 12:44 ` mans at mansr dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-09-26 21:00 UTC (permalink / raw)
  To: gcc-bugs


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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |arm*-*-*

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-09-26 21:00:21 UTC ---
IIRC interwork like this is only required for non-armv7 targets.


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

* [Bug target/54721] Generate arm/thumb interwork veneers at compile time?
  2012-09-26 20:28 [Bug target/54721] New: Generate arm/thumb interwork veneers at compile time? linux at horizon dot com
  2012-09-26 21:00 ` [Bug target/54721] " pinskia at gcc dot gnu.org
@ 2012-10-24 12:44 ` mans at mansr dot com
  2012-11-28  2:54 ` ramana at gcc dot gnu.org
  2012-11-28  8:38 ` linux at horizon dot com
  3 siblings, 0 replies; 5+ messages in thread
From: mans at mansr dot com @ 2012-10-24 12:44 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #2 from Mans Rullgard <mans at mansr dot com> 2012-10-24 12:44:24 UTC ---
ARMv5T removed the need for most interworking with the addition of BLX and
interworking POP instructions.  That said, even armv7 needs some interworking
code for a state-switching tail call since there is no branch immediate with
state change, only BLX.  This is rare enough that I don't think the slight
overhead mentioned is anything to worry about.


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

* [Bug target/54721] Generate arm/thumb interwork veneers at compile time?
  2012-09-26 20:28 [Bug target/54721] New: Generate arm/thumb interwork veneers at compile time? linux at horizon dot com
  2012-09-26 21:00 ` [Bug target/54721] " pinskia at gcc dot gnu.org
  2012-10-24 12:44 ` mans at mansr dot com
@ 2012-11-28  2:54 ` ramana at gcc dot gnu.org
  2012-11-28  8:38 ` linux at horizon dot com
  3 siblings, 0 replies; 5+ messages in thread
From: ramana at gcc dot gnu.org @ 2012-11-28  2:54 UTC (permalink / raw)
  To: gcc-bugs


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

Ramana Radhakrishnan <ramana at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P5
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-11-28
                 CC|                            |ramana at gcc dot gnu.org
     Ever Confirmed|0                           |1

--- Comment #3 from Ramana Radhakrishnan <ramana at gcc dot gnu.org> 2012-11-28 02:54:10 UTC ---
 I wouldn't expect this to be something of high priority currently. 


Ramana


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

* [Bug target/54721] Generate arm/thumb interwork veneers at compile time?
  2012-09-26 20:28 [Bug target/54721] New: Generate arm/thumb interwork veneers at compile time? linux at horizon dot com
                   ` (2 preceding siblings ...)
  2012-11-28  2:54 ` ramana at gcc dot gnu.org
@ 2012-11-28  8:38 ` linux at horizon dot com
  3 siblings, 0 replies; 5+ messages in thread
From: linux at horizon dot com @ 2012-11-28  8:38 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #4 from George Spelvin <linux at horizon dot com> 2012-11-28 08:37:50 UTC ---
> I wouldn't expect this to be something of high priority currently.

I know the benefit is low; I had just hoped that it would be a fairly small and
simple change and thus the cost/benefit ratio would be reasonable.

The comments so far seem to implicitly agree that it would be a useful feature,
if only a magical fairy would appear and implement it.  If anyone would be
willing to say so explicitly, and suggest a name (__attribute__(("interwork"))
comes to mind, but the floor is open for suggestions), it would perhaps
embolden some future ARM hacker looking for a small project.


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

end of thread, other threads:[~2012-11-28  8:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-26 20:28 [Bug target/54721] New: Generate arm/thumb interwork veneers at compile time? linux at horizon dot com
2012-09-26 21:00 ` [Bug target/54721] " pinskia at gcc dot gnu.org
2012-10-24 12:44 ` mans at mansr dot com
2012-11-28  2:54 ` ramana at gcc dot gnu.org
2012-11-28  8:38 ` linux at horizon dot com

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).