Illegal instruction
Aklilu Noah
naklilu@gpu.srv.ualberta.ca
Thu May 11 16:19:00 GMT 2000
Hi
I am compiling code to run on m68306 micro using
gcc 2.95.2, binutils 2.9.1 and newlib 1.8.2. However I am
encountering an illegal instruction when I call atexit from
my crt0.S as shown below
movel IMM(__FINI_SECTION__),(sp)
jsr SYM(atexit)
I traced through the code using the monitor and it made the jump
to the atexit code but I dissambled the code and got the following
(atexit is entered at 304a0)
$000304A0 4E56 0000 link.w A6,#0 ?
$000304A4 2079 0003 12FE movea.l ($312FE).L,A0 ?
$000304AA 2268 0146 movea.l ($146,A0),A1 ?
$000304AE 4A89 DC.W ?
$000304B0 6608 bne.b $304BA ?
$000304B2 43E8 014A lea.l ($14A,A0),A1 ?
$000304B6 2149 0146 move.l A1,($146,A0) ?
$000304BA 701F moveq.l #$1F,D0 ?
$000304BC B0A9 0004 cmp.l ($4,A1),D0 ?
$000304C0 6C26 bge.b $304E8 ?
$000304C2 4878 0088 pea.l ($88).W ?
$000304C6 4EB9 0003 0500 jsr ($30500).L ?
$000304CC 2240 movea.l D0,A1 ?
$000304CE 4A89 DC.W ?
$000304D0 6604 bne.b $304D6 ?
$000304D2 70FF moveq.l #$FF,D0 ?
$000304D4 6026 bra.b $304FC ?
$000304D6 42A9 0004 clr.l ($4,A1) ?
$000304DA 2079 0003 12FE movea.l ($312FE).L,A0 ?
The problem occurs at 304ae, where the illegal instruction
is. Note that there are additional illegal instructions
at 304CE. The problem seems to go away if I comment out
that section of crt0 and things run ok.
Not really actually malloc has a pointer (called from a test program to
make sure it works) that seems to be uninitialized, eventhough I
zero out the bss and shbss sections. It causes an illegal memory access
to occur which traps the monitor. It doesn't even get
to call sbrk (I have it output a character when it is entered)
before it dies. But one problem at a time.
Noah Aklilu
aklilu@nyquist.ee.ualberta.ca
http://www.ee.ualberta.ca/~aklilu/
"Integrity is something you do when no one is looking"
------
Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com
More information about the crossgcc
mailing list