The code
extern a, b
mov edi, a+b
causes the error "Invalid operand type" for all formats I tested.
For bin, this is understandable, though I really think the error message should be "binary output format does not support external references" in that case.
For all other formats, it seems to me that it should be possible to put multiple relocations at the same address. A cursory glance through the COFF spec supports this, as does my experience with one homebrew relocation loader.
If I glanced to quickly, then I'd like to see a message to the effect of "<format> does not support multiple relocations at the same address", instead, as you'd get for "mov di, a".
The same applies to code of the form
extern a, b
mov edi, [a+b]
except that, in this case, the error message has some inscrutable leading jibberish: "beroset-p-650-invalid effective address". Sometimes the number is different; I can also get 637.
Logged In: YES
user_id=73628
Originator: NO
Given the limited resources of the development team and the fact that one can accomplish the desired result with the current code by changing "mov edi,a+b" to "mov edi,a" and adding "add edi,b", the only way we could justify accepting this request is if you supplied a tested patch for our consideration.
Logged In: YES
user_id=762255
Originator: YES
In fact, that's about the way I do it right now. But it works poorly in effective addresses, and would fail completely for dd a+b.
So, the limitation is in NASM code, and not in the output formats (other than bin, obviously)? I've managed to get NASM built with useful-to-me debugging information, finally, so see what I can work up.
Logged In: YES
user_id=73628
Originator: NO
Yes, the error messages you are seeing are coming from parser.c, because your code does not match any of the ModR/M formats. The output format modules create the relocation sections, but they do so solely from references to the symbol table which are passed to them, along with a relocation type, by the code generation routines.
Logged In: YES
user_id=762255
Originator: YES
I'm a bit disturbed by the fact that I can't find any instructions that set operand::wrt to anything other than NO_SEG. Are there instructions involving externs that do that, or can I ignore wrt?
Logged In: YES
user_id=73628
Originator: NO
wrt is a syntax extension which means different things to the various output formats, and you must be careful not to break existing code. However, for the flat model formats, wrt is not used in conjunction with the EXTERN directive.