Jump to content
Jagware
Tyrant

Linker behaviour (alignment bug)

Recommended Posts

Tyrant    0

I've just spent an entire day trying in vain to chase down a bug in my code relating to alignment. I still haven't got it so I'm hoping someone more knowledgeable than I can help. I've managed to find several places where, if I insert one or more nop's, the entire system (68k/op, no risc) locks up and my alpine won't even respond to the halt button (but reset works). I'm pretty sure all the sections that require proper alignment are aligned right (op list entries, bitmap data).

 

I think I saw somewhere someone complaining that ALN moves things round in an arbitrary way and doesn't necessarily put things in the order they're given to it on the command line, but that wouldn't go so far as to re-arrange allocations within a file, would it? I'm really stumped at this point as to wtf is going on, as I've been through everything, I think.

 

I have had before the problem of trying to read a word from an odd-aligned address, in which case the 68k throws an address error and that's fine, but this is a case of it locking up rather than giving any kind of error, so I don't think it's that. I'm thinking it's probably an OP problem, but like I said, every object I'm making is aligned properly with .qphrase directives.

 

I guess I'm really looking for general advice on what to do in a situation like this. I've tried the usual one of slapping writes to the background colour register all over the place, but that just broke my test case by pushing the alignment back into something that works. I'm also having a hell of a time trying to single step through my code since so much of it is opl-generating, and writing out half an object causes the op to dance a fandango on core when the link address isn't set right.

 

Any thoughts would be welcomed at this point.

Share this post


Link to post
Share on other sites
Tursi    0

Have you tried generating a map file and looking at where your objects and data structures are actually being placed, just to be sure?

 

Share this post


Link to post
Share on other sites
Tyrant    0
Have you tried generating a map file and looking at where your objects and data structures are actually being placed, just to be sure?

I considered it, but I don't know any automated (or even semi-automated) way of doing it.

Share this post


Link to post
Share on other sites
Tyrant    0
Do you mean generating the map file ? There's a simple option to add to ALN's command line for that.

Or do you mean something else ?

No that's what I meant, I didn't realise there was an option to spit one out... although it would be nice if it would print them one symbol per line.

Share this post


Link to post
Share on other sites
Tursi    0
No that's what I meant, I didn't realise there was an option to spit one out... although it would be nice if it would print them one symbol per line.

 

Just add -m to your linker flags, IIRC. (Check aln docs if that doesn't work). I think that only dumps it to the console, I seem to have captured the console output to file (with >) when I needed to review it.

 

You could probably use a perl script to quickly break it into multiple lines, if you needed that, though.

 

Share this post


Link to post
Share on other sites
Tyrant    0

In the end I still couldn't work out what it was. Everything was aligned to even addresses except a couple of byte-sized fields, my object list spacing was fine, everything was fine. So I reverted to the last checkpoint and I'll add the extra stuff back in when I have time. Right now I've got more pressing matters to deal with but I thought I should update this thread anyway to say thanks for helping.

 

Alpines and wdb are lovely tools when they work, but when they crash and the debugging link locks up, they're rather frustrating.

Share this post


Link to post
Share on other sites
Guest
You are commenting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoticons maximum are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×