public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
From: Richard Earnshaw <rearnsha@arm.com>
To: mckennad@esatclear.ie
Cc: Richard Earnshaw <rearnsha@arm.com>,
	gdb@sources.redhat.com, insight@sources.redhat.com,
	Richard.Earnshaw@arm.com
Subject: Re: ARM Simulator Bug?
Date: Tue, 02 Sep 2003 18:17:00 -0000	[thread overview]
Message-ID: <200309021817.h82IH0b21887@pc960.cambridge.arm.com> (raw)
In-Reply-To: Your message of "Tue, 02 Sep 2003 15:31:11 BST." <3f54a9af.472.0@esatclear.ie>

> Hi Richard,
> 
> Thanks for the reply.
> 
> >It's more likely to be the way you are trying to get into Thumb state.  Try
> 
> >
> >	adr	r0, __start_of_thumb
> 
> Should this line not be
> 
> 	adr	r0, __start_of_thumb+1
> 
> To set the LSB to tell the core we want to enter Thumb mode
> 

Well, no.  If the bottom bit isn't being set automatically when the target 
is a thumb symbol then that's really a bug in the tools.


> >	bx	r0
> >	.code 16
> >	.global __start_of_thumb
> >	.thumb_func
> >__start_of_thumb:
> >
> >
> >This is really brokenness in the way gas implements ARM and Thumb code 
> >areas, but it's hard to fix properly until GAS starts using mapping 
> >symbols.
> 
> If I use the +1 code above, and set a breakpoint at the adr command, I can single
> step successfully past the BX command and into my main.

It appears that GAS is broken:

$ cat test.s
	.arm
	adr	r0, __thumb
	bx	r0
	.thumb
	.globl	__thumb
	.thumb_func
__thumb:
	nop

$ arm-elf-as test.s -o test.o
$ arm-elf-objdump -dr test.o

test.o:     file format elf32-littlearm

Disassembly of section .text:

00000000 <__thumb-0x8>:
   0:   e28f0000        add     r0, pc, #0      ; 0x0	####### Bzzt no!
   4:   e12fff10        bx      r0

00000008 <__thumb>:
   8:   46c0            nop                     (mov r8, r8)

Try using an 

	LDR r0, =__thumb

expression.  You'll need to squeeze the constant pool in somewhere.

R.

  reply	other threads:[~2003-09-02 18:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-02 14:31 David Mc Kenna
2003-09-02 18:17 ` Richard Earnshaw [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-09-03 14:57 David Mc Kenna
2003-09-03 15:20 ` Richard Earnshaw
2003-09-04 11:45   ` Richard Earnshaw
2003-09-03 10:36 David Mc Kenna
2003-09-03 13:53 ` Richard Earnshaw
2003-09-03  9:13 David Mc Kenna
2003-09-03  9:51 ` Richard Earnshaw
2003-09-02 11:27 David Mc Kenna
2003-09-02 12:43 ` Richard Earnshaw

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200309021817.h82IH0b21887@pc960.cambridge.arm.com \
    --to=rearnsha@arm.com \
    --cc=Richard.Earnshaw@arm.com \
    --cc=gdb@sources.redhat.com \
    --cc=insight@sources.redhat.com \
    --cc=mckennad@esatclear.ie \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).