public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libgcc/58660] New: ARM/Thumb non-interworking code broken in libgcc
@ 2013-10-07 22:49 jifl-bugzilla at jifvik dot org
  2013-10-08  8:50 ` [Bug libgcc/58660] " rearnsha at gcc dot gnu.org
  2015-05-21  9:16 ` ramana at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: jifl-bugzilla at jifvik dot org @ 2013-10-07 22:49 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 58660
           Summary: ARM/Thumb non-interworking code broken in libgcc
           Product: gcc
           Version: 4.7.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libgcc
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jifl-bugzilla at jifvik dot org

Created attachment 30966
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30966&action=edit
libgcc patch to correct operation with non-interworking thumb builds

I have included a multilib in my GCC for ARM to generate thumb code with
interworking disabled, intended for an ARMv4T CPU (e.g. ARM7T or ARM9). In
other words, -mcpu=arm9 -mthumb -mno-thumb-interwork.

However this fails to work because of a problem in libgcc making it incorrect
for non-interworking operation. A specific example is aeabi_uldivmod in bpabi.S
which is an ARM (not thumb) function, which includes a bl to
__gnu_uldivmod_helper. __gnu_uldivmod_helper is from bpabi.c and is in Thumb
mode.

The linker helpfully adds a little trampoline to switch to Thumb mode  with the
bx instruction (____gnu_uldivmod_helper_from_arm). However GCC returns from
__gnu_uldivmod_helper with:

  pop     {r3, r4, r5, r6, r7, pc}

This means that no mode switch happens on the return from the Thumb mode
function to the ARM mode aeabi_uldivmod function.

As well as the obvious aeabi_ldivmod, someone may want to double-check whether
this sort of problem may apply to other functions (although I haven't found any
others yet myself, but I'm not sure about how functions like those in
unaligned-funcs.c would be called).

I am attaching a potential fix for the problem with aeabi_ldivmod and
aeabi_uldivmod, so it would be good for that to be applied at least, including
on the 4.7 branch.

2013-10-07  Jonathan Larmour  <jifl@eCosCentric.com>

    * config/arm/bpabi.S (aeabi_ldivmod, aeabi_uldivmod): Allow for
    non-interworking Thumb builds.

Thanks,

Jifl


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

* [Bug libgcc/58660] ARM/Thumb non-interworking code broken in libgcc
  2013-10-07 22:49 [Bug libgcc/58660] New: ARM/Thumb non-interworking code broken in libgcc jifl-bugzilla at jifvik dot org
@ 2013-10-08  8:50 ` rearnsha at gcc dot gnu.org
  2015-05-21  9:16 ` ramana at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: rearnsha at gcc dot gnu.org @ 2013-10-08  8:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Richard Earnshaw <rearnsha at gcc dot gnu.org> ---
Please post patches to gcc-patches@gcc.gnu.org and x-ref this PR.


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

* [Bug libgcc/58660] ARM/Thumb non-interworking code broken in libgcc
  2013-10-07 22:49 [Bug libgcc/58660] New: ARM/Thumb non-interworking code broken in libgcc jifl-bugzilla at jifvik dot org
  2013-10-08  8:50 ` [Bug libgcc/58660] " rearnsha at gcc dot gnu.org
@ 2015-05-21  9:16 ` ramana at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: ramana at gcc dot gnu.org @ 2015-05-21  9:16 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-05-21
                 CC|                            |ramana at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #2 from Ramana Radhakrishnan <ramana at gcc dot gnu.org> ---
Confirmed.


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

end of thread, other threads:[~2015-05-21  9:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-07 22:49 [Bug libgcc/58660] New: ARM/Thumb non-interworking code broken in libgcc jifl-bugzilla at jifvik dot org
2013-10-08  8:50 ` [Bug libgcc/58660] " rearnsha at gcc dot gnu.org
2015-05-21  9:16 ` ramana 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).