Good news: I got rid of my seg fault, thanks to miskinis' "shot in the dark". Instead of adding a filler (which would require me to add an element everywhere the structure is used), I changed submenu->type to a 4-byte element, type uint. Voila, alignment achieved and I can finally, finally do remote capture with my Z!
Bad news: This issue is very confusing, and it certainly was a pain to troubleshoot. Look at the structure:
struct submenu {
char *label;
char *name;
uint16_t propid;
uint16_t vendorid;
uint16_t type;
get_func getfunc;
put_func putfunc;
};
If the function pointers are unaligned, other things would appear to be so as well - the character arrays can be uneven # of bytes, and if propid happens to be aligned, vendorid isn't! For the same reason I did consider miskinis' suggestion very unlikely to work and was close to not even trying. Is it only some types of objects, such as pointers, that need alignment?
It appears that compilers by default will add padding in some places to achieve alignment, and in other places they won't. Inconsistent, but perhaps a compromise between memory efficiency and avoiding crashes. What I really don't understand are the following two things:
1) How is "packing" going to help? Doesn't that tell the compiler not to add any padding, increasing the likelyhood of unaligned accesses? I did try all packing suggestions anyway and, indeed, couldn't make any work.
2) How the heck to make the compiler align the offending elements? You'd think that's what e.g. __attribute__((aligned(4))) is for, but I've applied it both to the function pointers and, to be sure, the element just before them (submenu->type). Still unaligned!! Finally, the flag -Wcast-align is supposed to warn of possible bad alignments. It did come with warnings, just not where the alignment problem was.
In the end, only a shot in the dark worked. This doesn't seem right. Do we have a buggy toolchain (zgcc-3.4.5)? Which leads me back to asking: Can the newer GNU ARM toolchain be used to compile programs for the Z and pdaXrom without major difficulties?
P.S. To make sure the post doesn't appear ungrateful I'd like to thank everybody who made suggestions.