This is the mail archive of the gcc-bugs@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]

[Bug target/54721] New: Generate arm/thumb interwork veneers at compile time?


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


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